@elyx-code/project-logic-tree 0.0.6841 → 0.0.6842
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 +1 -1
- package/dist/index.js +1 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -45,7 +45,7 @@ You can attach new logic to the existing 'global-event' but creating a new calla
|
|
|
45
45
|
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:r,explanations:a,modifiedData:i}}subscribeDependents(i){return i.forEach(r=>{this.detachedDependents[r.entity.id]||(this.detachedDependents[r.entity.id]=r)}),this}unsubscribeDependents(i){return i.forEach(r=>{this.detachedDependents[r.entity.id]&&delete this.detachedDependents[r.entity.id]}),this}syncDependents(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,"sync-dependents"))){const r=[],a=[],c=[],e=[];return Object.values(this.detachedDependents).forEach(f=>{const h=f.entity.afterAllChildrenInitialized(i);r.push(...h.updated),a.push(...h.added),c.push(...h.removed),e.push(...h.affected)}),i==null||i.attemptAutoclose("sync-dependents",this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}onDetachedDependencyRemoved(i,r,a){const c=[],e=[],f=[],h=[];return{updated:C(c),added:C(e),removed:C(f),affected:C(h),self:this}}onDetachedDependencyRestored(i,r,a){const c=[],e=[],f=[],h=[];return{updated:C(c),added:C(e),removed:C(f),affected:C(h),self:this}}unsubscribeFromDependencies(){return this}subscribeToDependencies(){return this}increaseVersion(i){if(i&&!B(i).isValid())throw new Error(`The shared timestamp '${i}' is not a valid ISO 8601 date string.`);return i&&B(i).isSame(B(this.createdAt))?this:(this.previousVersion=this.version,this.version=N.UUID.uuid(),this.createdAt=B(i).toISOString()||B().toISOString(),this)}captureVersion(){var r;const i=((r=this.knownVersions)==null?void 0:r.get(this.version))||new bi(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.dataType=this.dataType,i.error=this.error,i.parent=this.parent,this}recursiveCaptureUpstreamVersions(i){const r=[],a=[],c=[],e=[];if(this.parent&&this.parent.type!==d.BuiltInBaseEntity&&this.parent.type!==d.PrimitiveEntity){this.parent.increaseVersion(i);const f=this.parent.recursiveCaptureUpstreamVersions(i);r.push(this.parent,...f.updated),a.push(...f.added),c.push(...f.removed)}return{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}async restoreVersion(i){var h;const r=[],a=[],c=[],e=[];if(this.version===i)return{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this};if(!this.knownVersions){const m=new Map;for(const[E,b]of this.knownVersions||new Map){if(m.set(E,b),b.activeVersion=!1,b.knownVersions)for(const[g,_]of b.knownVersions)m.set(g,_);b.knownVersions=null}}let f=(h=this.knownVersions)==null?void 0:h.get(i);if(!f){const m=await this.APILoadVersion({},i);if(!m)throw new Error(`Version with id '${i}' for entity with id '${this.id}' not found.`);f=new bi(m,this.project)}return this.metaSync(f.toShallowJSON(),null),this.previousVersion=f.previousVersion,this.version=f.version,this.createdAt=f.createdAt,this.author=f.author,this.deleted=f.deleted,this.inputs=f.inputs,this.dataType=f.dataType,this.error=f.error,this.parent=f.parent,{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}updateWithShallowTransfer(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.UpdateWithShallowTransfer))){if(!this.checkCanEdit(this,r))return z.Logger.warn(`[updateWithShallowTransfer] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.UpdateWithShallowTransfer,this.id),this;if(this.metaSync(i,r),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 a=X(i.parent),c=this.project.get(a),e=this.parent;if(e&&e.id!==(c==null?void 0:c.id)&&(this.removeFromParent(r),this.parent=null),c)this.setParent(c,r),this.addSelfToProject(r);else throw r==null||r.attemptAutoclose(w.UpdateWithShallowTransfer,this.id),new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${a}' that isn't found in the project`)}else throw r==null||r.attemptAutoclose(w.UpdateWithShallowTransfer,this.id),new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(i.error||this.setError(null,r),i.inputs.forEach(a=>{const c=X(a),e=this.project.get(c);e&&(this.addInput(e,r),e.setParent(this,r))}),[...this.inputs].forEach(a=>{i.inputs.find(e=>X(e)===a.id)||(this.removeInput(a,r),a.removeFromParent(r))}),i.dataType){const a=X(i.dataType),c=this.project.get(a);c&&this.setDataType(c,r)}else this.setDataType(null,r);return this.captureVersion(),this.subscribeToDependencies(),r==null||r.attemptAutoclose(w.UpdateWithShallowTransfer,this.id),this}updateWithGenerationTarget(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.UpdateWithGenerationTarget))){if(!this.checkCanEdit(this,r))return z.Logger.warn(`[updateWithGenerationTarget] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.UpdateWithGenerationTarget,this.id),this;if(this.metaSync(i,r),i.parent){const a=X(i.parent),c=this.project.get(a),e=this.parent;if(e&&e.id!==(c==null?void 0:c.id)&&(this.removeFromParent(r),this.parent=null),c)this.setParent(c,r),this.addSelfToProject(r);else throw r==null||r.attemptAutoclose(w.UpdateWithGenerationTarget,this.id),new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${a}' that isn't found in the project`)}return this.captureVersion(),this.subscribeToDependencies(),r==null||r.attemptAutoclose(w.UpdateWithGenerationTarget,this.id),this}hydrateAncestors(){const i=[],r=[],a=[],c=[];if(this.initialData.parent){const e=X(this.initialData.parent),f=this.project.get(e);if(f)this.setParent(f,null),i.push(f);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'`);return{updated:C(i),added:C(r),removed:C(a),affected:C(c),self:this}}afterAllChildrenInitialized(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.AfterAllChildrenInitialized))){if(!this.checkCanEdit(this,i))return z.Logger.warn(`[afterAllChildrenInitialized] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(w.AfterAllChildrenInitialized,this.id),{updated:[],added:[],removed:[],affected:[],self:this};const r=[],a=[],c=[],e=[];return this.initialized=!0,this.inputs.sort((f,h)=>f.index-h.index),this.captureVersion(),i==null||i.attemptAutoclose(w.AfterAllChildrenInitialized,this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}addSelfToProject(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,"add-self-to-project"))){const r=[this],a=[],c=[],e=[];return this.parent?(this.parent.type===d.DefinitionEntity?(this.parent.addAbstractMethod(this,i),e.push(this.parent)):this.parent.type===d.DataType&&(this.parent.setEntity(this,i),e.push(this.parent)),this.subscribe(),this.subscribeToDependencies(),i==null||i.attemptAutoclose("add-self-to-project",this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}):(this.subscribe(),this.subscribeToDependencies(),i==null||i.attemptAutoclose("add-self-to-project",this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this})}setParent(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.SetParent))){var a;return this.checkCanEditWithCounterpartAndSideEffects(this,i,w.SetParent,r)?(((a=this.parent)==null?void 0:a.id)!==(i==null?void 0:i.id)&&(this.parent=i,r&&(r==null||r.add(this,W.Updated))),r==null||r.attemptAutoclose(w.SetParent,this.id),this):this}initChildren(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,"init-children"))){return this.initialized||this.startedInitialization?this:(this.startedInitialization=!0,this.initialData.dataType&&(this.dataType=Ae(this.initialData.dataType,this.project),this.dataType.setParent(this,null),this.dataType.initChildren(i)),this.inputs=this.initialData.inputs.map(r=>{const a=Ae(r,this.project);return a.setParent(this,null),a.initChildren(i),a}),this.initialData.error&&(this.error=Ae(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)}subscribe(){return this.activeVersion=!0,this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,"meta-sync"))){const a=Wr(this,i,r),c=Hr(this,a),e=this.toMeta();return this.name=a.name!==void 0?a.name:e.name,this.codeName=a.codeName!==void 0?a.codeName:e.codeName,this.description=a.description!==void 0?a.description:e.description,super.baseMetaSync(a,this,r),a.deleted===!0&&!e.deleted?r==null||r.add(this,W.Removed):a.deleted===!1&&e.deleted?r==null||r.add(this,W.Added):c&&(r==null||r.add(this,W.Updated)),r==null||r.attemptAutoclose("meta-sync",this.id),this}async APILoad(i=Se,...r){return await bi.repository.APILoad(this.id,...r),this}async APICreate(i=Se,...r){return await bi.repository.APICreate(this.toShallowJSON(),...r),this}async APIUpdate(i=Se,...r){return await bi.repository.APIUpdate(this.toShallowJSON(),...r),this}async APIDelete(i=Se,...r){return await bi.repository.APIDelete(this.toShallowJSON(),...r),this}async APIClone(i=Se,...r){return await bi.repository.APIClone(this.id,...r),this}async APILoadVersion(i=Se,r,...a){return await bi.repository.APILoadVersion(this.id,r,...a)}removeFromParent(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.RemoveFromParent))){if(!this.checkCanEdit(this,i))return z.Logger.warn(`[removeFromParent] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(w.RemoveFromParent,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const r=[],a=[],c=[],e=[];return this.parent&&(this.parent.type===d.DataType?(this.parent.setEntity(null,i),e.push(this.parent)):this.parent.type===d.DefinitionEntity&&(this.parent.removeAbstractMethod(this,i),e.push(this.parent))),i==null||i.attemptAutoclose(w.RemoveFromParent,this.id),{added:C(c),updated:C(r),removed:C(a),affected:C(e),self:this}}remove({ignoreUpstream:i}={ignoreUpstream:!1},r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.RemoveEntity))){var h;if(!this.checkCanDelete(this,r))return z.Logger.warn(`[remove] User is not allowed to delete or edit this ${this.type} entity with id: ${this.id}`),r==null||r.event({id:`${w.RemoveEntity}-${this.id}--${Be.ActionOwnerEntityNonDeletable}`,action:w.RemoveEntity,owner:this,errorReason:Be.ActionOwnerEntityNonDeletable,rootAction:((h=r==null?void 0:r.self)==null?void 0:h.id)===this.id&&(r==null?void 0:r.autoCloseActionName)===w.RemoveEntity}),r==null||r.attemptAutoclose(w.RemoveEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const a=[],c=[],e=[],f=[];if(r!=null&&r.hasRemoved(this.id))return r==null||r.attemptAutoclose(w.RemoveEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(c.push(this),this.unsubscribe(),this.project.subscribeDeletedInstance(this),this.metaSync({deleted:!0},r),Object.values(this.detachedDependents).forEach(m=>{const{updated:E,removed:b,added:g}=m.entity.onDetachedDependencyRemoved(this,m.field,r);a.push(...E),c.push(...b),e.push(...g)}),this.inputs.forEach(m=>{const E=m.remove({ignoreUpstream:!0},r);a.push(...E.updated),c.push(...E.removed)}),this.dataType){const{updated:m,removed:E}=this.dataType.remove({ignoreUpstream:!0},r);a.push(...m),c.push(...E)}if(this.error){const m=this.error.remove({ignoreUpstream:!0},r);a.push(...m.updated),c.push(...m.removed)}if(this.parent&&!i){const m=this.removeFromParent(r);e.push(...m.added),a.push(...m.updated),c.push(...m.removed),f.push(...m.affected)}return r==null||r.attemptAutoclose(w.RemoveEntity,this.id),{added:C(e),updated:C(a),removed:C(c),affected:C(f),self:this}}restore({}={},i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.RestoreEntity))){if(!this.checkCanEdit(this,i))return z.Logger.warn(`[restore] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(w.RestoreEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const r=[],a=[],c=[],e=[];if(i!=null&&i.hasAdded(this.id))return i==null||i.attemptAutoclose(w.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(f=>{const{updated:h,removed:m,added:E}=f.entity.onDetachedDependencyRestored(this,f.field,i);a.push(...h),c.push(...m),r.push(...E)}),this.inputs.forEach(f=>{const h=f.restore({},i);a.push(...h.updated)}),this.dataType){const{updated:f}=this.dataType.restore({},i);a.push(...f)}if(this.error){const f=this.error.restore({},i);a.push(...f.updated)}return i==null||i.attemptAutoclose(w.RestoreEntity,this.id),{added:C(r),updated:C(a),removed:C(c),affected:C(e),self:this}}toFlat(i=new Set){var a;return i.has(this.id)?[]:(i.add(this.id),[this,...((a=this.dataType)==null?void 0:a.toFlat(i))||[],...this.inputs.flatMap(c=>c.toFlat(i))])}toFlatIds(i=new Set){var a;return i.has(this.id)?[]:(i.add(this.id),[this.id,...((a=this.dataType)==null?void 0:a.toFlatIds(i))||[],...this.inputs.flatMap(c=>c.toFlatIds(i))])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,codeName:this.codeName,description:this.description,outputName:this.outputName,outputDescription:this.outputDescription,index:this.index,type:this.type,editable:this.editable,deletable:this.deletable,name:this.name}}toJSON(i=new Set){var r,a,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,codeName:this.codeName,description:this.description,outputName:this.outputName,outputDescription:this.outputDescription,index:this.index,dataType:((r=this.dataType)==null?void 0:r.toJSON(i))||null,error:((a=this.error)==null?void 0:a.toJSON(i))||null,inputs:this.inputs.map(e=>e.toJSON(i)),parent:((c=this.parent)==null?void 0:c.toReference())||null})}toJSONClone(i=nt){var a,c,e,f,h,m,E,b;let r;return(a=i.seenEntityMaps)!=null&&a.has(this.id)?r=i.seenEntityMaps.get(this.id):(r=i.newId||Xr(this,this.project,i.uuidStrategy),i.seenEntityMaps&&i.seenEntityMaps.set(this.id,r)),(c=i.seenEntities)!=null&&c.has(r)||(e=i.seenEntities)!=null&&e.has(this.id)?this.toReference({seenEntityMaps:i.seenEntityMaps}):((f=i.seenEntities)==null||f.add(r),(h=i.seenEntities)==null||h.add(this.id),{id:r,version:N.UUID.uuid(),createdAt:i.timestamp||B().toISOString(),previousVersion:null,author:this.author,deleted:this.deleted,type:this.type,editable:this.editable,deletable:this.deletable,name:this.name,codeName:this.codeName,description:this.description,outputName:this.outputName,outputDescription:this.outputDescription,index:this.index,dataType:((m=this.dataType)==null?void 0:m.toJSONClone({...i,newId:null}))||null,error:((E=this.error)==null?void 0:E.toJSONClone({...i,newId:null}))||null,inputs:this.inputs.map(g=>g.toJSONClone({...i,newId:null})),parent:((b=this.parent)==null?void 0:b.toReference({seenEntityMaps:i.seenEntityMaps}))||null})}toReference(i=nt){var a;let r=this.id;return(a=i.seenEntityMaps)!=null&&a.has(this.id)&&(r=i.seenEntityMaps.get(this.id)),{id:r+"--"+N.UUID.uuid()+"--ref",type:d.GenericReference,entityId:r,version:this.version,entityType:this.type}}toShallowJSON(i=nt){var a,c,e,f;let r=this.id;return(a=i.seenEntityMaps)!=null&&a.has(this.id)&&(r=i.seenEntityMaps.get(this.id)),{id:r,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,codeName:this.codeName,description:this.description,outputName:this.outputName,outputDescription:this.outputDescription,index:this.index,dataType:((c=this.dataType)==null?void 0:c.toReference(i))||null,error:((e=this.error)==null?void 0:e.toReference(i))||null,inputs:this.inputs.map(h=>h.toReference(i)),parent:((f=this.parent)==null?void 0:f.toReference(i))||null}}toFlatJSON(i=new Set){var a;return i.has(this.id)?[]:(i.add(this.id),[this.toShallowJSON(),...((a=this.dataType)==null?void 0:a.toFlatJSON(i))||[],...this.inputs.flatMap(c=>c.toFlatJSON(i))])}toGenerationTarget(i=nt){var a,c;let r=this.id;return(a=i.seenEntityMaps)!=null&&a.has(this.id)&&(r=i.seenEntityMaps.get(this.id)),{id:r,name:this.name,codeName:this.codeName,description:this.description,type:this.type,parent:((c=this.parent)==null?void 0:c.id)||void 0,outputName:this.outputName,outputDescription:this.outputDescription,index:this.index}}toFlatGenerationTarget(i=new Set){var a;return i.has(this.id)?[]:(i.add(this.id),[this.toGenerationTarget(),...((a=this.dataType)==null?void 0:a.toFlatGenerationTarget(i))||[],...this.inputs.flatMap(c=>c.toFlatGenerationTarget(i))])}implementAsGlobalEvent(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,"implement-as-global-event")),r,a){const c=r||this.project,e=a||N.UUID.uuid(),f=N.UUID.uuid(),h={id:e,version:f,createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.GlobalEvent,name:this.name,description:this.description,inputs:[],calls:[],collapsed:!1,implements:this.toJSON(),parent:(c==null?void 0:c.toReference())||null,x:0,y:0},m=Ae(h,this.project);if(m.setParent(c,i),m.initChildren(i),i==null||i.add(m,W.Added),m.hydrateAncestors(),m.addSelfToProject(i),this.inputs.map(E=>E.implementAsArgumentDeclaration(i,m)),this.dataType&&this.dataType.entity&&this.dataType.entity.type===d.DefinitionEntity&&this.dataType.entity.properties.length){const E=N.UUID.uuid(),b=N.UUID.uuid(),g={id:N.UUID.uuid(),type:d.GenericReference,version:f,entityType:d.GlobalEvent,entityId:e},_={id:N.UUID.uuid(),type:d.GenericReference,version:f,entityType:d.GlobalEvent,entityId:e},$=this.dataType.toJSONClone(),L={id:E,version:b,createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.ReturnStatement,outputs:[],throws:null,calledBySuccess:[],calledByError:[],calledByEntry:[_],defaultValue:null,dataType:$,readsValue:null,parent:g,x:0,y:0},j=Ae(L,this.project);j.setParent(m,i),j.initChildren(i),i==null||i.add(j,W.Added),j.hydrateAncestors(),j.addSelfToProject(i),this.dataType.entity.properties.map((k,G)=>{var ae;const H={id:N.UUID.uuid(),type:d.GenericReference,entityId:E,version:b,entityType:d.ReturnStatement},ie={dataType:null,id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.InputMap,parentRelationType:null,name:k.name,codeName:k.codeName,description:k.description,readsValue:null,defaultValue:null,declaration:k.toJSON(),index:G,parent:H},ee=Ae(ie,this.project);ee.setParent(j,i),ee.initChildren(i),i==null||i.add(ee,W.Added),ee.hydrateAncestors(),ee.addSelfToProject(i);const ue=((ae=k.dataType)==null?void 0:ae.clone(i,ee))||null;ue&&(i==null||i.add(ue,W.Added)),ee.setDataType(ue,i)})}return i==null||i.attemptAutoclose("implement-as-function-declaration",this.id),m}implementAsFunctionDeclaration(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,"implement-as-function-declaration")),r,a){let c=r?Br(r,this):this.project;const e=r||this.project,f=a||N.UUID.uuid(),h=N.UUID.uuid(),m=td.new(i);if(m.id=f,m.version=h,m.parent=(e==null?void 0:e.toReference())||null,m.codeName=this.codeName,m.name=this.name,m.description=this.description,m.implements=this.toJSON(),e.type===d.DefinitionEntity){let g=this.index||0;const _=e.methods.filter($=>!$.deleted);_.length&&(g>=_.length?g=_.length:g<0?g=0:_.filter($=>($.index||0)>=g).forEach($=>{$.metaSync({index:($.index||0)+1},i),i==null||i.add($,W.Updated)})),m.index=g}const E=Ae(m,c);E.hydrateAncestors(),E.setParent(e,i),i==null||i.add(E,W.Added),E.addSelfToProject(i),E.initChildren(i);const b=[];return this.dataType&&(this.dataType.entity&&(this.dataType.entity.type===d.DefinitionEntity||this.dataType.entity.type===d.BuiltInBaseEntity)&&this.dataType.entity.properties.length?b.push(this.dataType):(this.dataType.orChildrenGroup||[]).forEach(g=>{g.entity&&(g.entity.type===d.DefinitionEntity||g.entity.type===d.BuiltInBaseEntity)&&g.entity.properties.length&&b.push(g)})),b.forEach(g=>{const _=N.UUID.uuid(),$=N.UUID.uuid(),L={id:N.UUID.uuid(),type:d.GenericReference,version:h,entityType:d.FunctionDeclaration,entityId:f},j={id:N.UUID.uuid(),type:d.GenericReference,version:h,entityType:d.FunctionDeclaration,entityId:f},k=Sd.new(i);k.id=_,k.version=$,k.parent=L,k.calledByEntry=[j];const G=Ae(k,c);G.hydrateAncestors(),G.setParent(E,i),G.addSelfToProject(i),i==null||i.add(G,W.Added),G.initChildren(i),this.project.diggestedBuiltInBaseEntitiesIds.has(g.id)?G.setDataType(c.getBuiltIn(g.id),i):g.clone(i,G),G.afterAllChildrenInitialized(i)}),i==null||i.attemptAutoclose("implement-as-function-declaration",this.id),E}implementAsLoop(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,"implement-as-loop")),r,a){const c=r||this.project,e=a||N.UUID.uuid(),f=N.UUID.uuid(),h={catchesError:!1,id:e,version:f,createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.Loop,writesValues:[],declaration:this.toJSON(),inputs:[],outputs:[],error:null,dataType:null,successCalls:[],errorCalls:[],calledByEntry:[],calledByError:[],calledBySuccess:[],body:null,x:0,y:0,parent:c.toReference()},m=Ae(h,this.project);return m.hydrateAncestors(),m.setParent(c,i),i==null||i.add(m,W.Added),m.addSelfToProject(i),m.initChildren(i),c===this.project&&this.project.addLoop(m),i==null||i.attemptAutoclose("implement-as-loop",this.id),m}implementAsOperation(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,"implement-as-operation")),r,a){const c=r||this.project,e=a||N.UUID.uuid(),f=N.UUID.uuid(),h={catchesError:!1,id:e,version:f,createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.Operation,writesValues:[],declaration:this.toJSON(),inputs:[],outputs:[],error:null,successCalls:[],errorCalls:[],calledByEntry:[],calledByError:[],calledBySuccess:[],x:0,y:0,parent:c.toReference()},m=Ae(h,this.project);return m.hydrateAncestors(),m.setParent(c,i),i==null||i.add(m,W.Added),m.addSelfToProject(i),m.initChildren(i),c===this.project&&this.project.addOperation(m),i==null||i.attemptAutoclose("implement-as-operation",this.id),m}implementAsCondition(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,"implement-as-condition")),r,a){const c=r||this.project,e=a||N.UUID.uuid(),f=N.UUID.uuid(),h={id:e,version:f,createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.Condition,index:null,andChildrenGroup:null,orChildrenGroup:null,declaration:this.toJSON(),inputs:[],successCalls:[],errorCalls:[],calledByEntry:[],calledByError:[],calledBySuccess:[],x:0,y:0,parent:c.toReference()},m=Ae(h,this.project);return m.hydrateAncestors(),m.setParent(c,i),i==null||i.add(m,W.Added),m.addSelfToProject(i),m.initChildren(i),c===this.project&&this.project.addCondition(m),i==null||i.attemptAutoclose("implement-as-condition",this.id),m}clearErrors(){var i,r;return this.errors=[],this.inputs.forEach(a=>a.clearErrors()),(i=this.dataType)==null||i.clearErrors(),(r=this.error)==null||r.clearErrors(),this}validate(){return this.errors=T_e(this),{success:!0}}async validateAsync(i={}){const r=z.YieldTracker.from(i);return this.errors=await m_e(this,{tracker:r}),{success:!0}}getErrors(){var r;return[...this.errors,...((r=this.dataType)==null?void 0:r.getErrors())||[],...this.inputs.flatMap(a=>a.getErrors())]}async getErrorsAsync(i={}){const r=z.YieldTracker.from(i),a=[...this.errors];if(await r.tick(),this.dataType){const c=await this.dataType.getErrorsAsync({tracker:r});a.push(...c)}for(const c of this.inputs){const e=await c.getErrorsAsync({tracker:r});a.push(...e)}return a}getShallowErrors(){return this.errors}clone(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.CloneEntity)),r=null,a=null,c=!0){var $,L;if(this.project.diggestedBuiltInBaseEntitiesIds.has(this.id))return this;const e=Br(r,this),f=this.toJSON(),h=a||N.UUID.uuid();f.inputs=[],f.dataType=null,f.error=null;const m=h.split("-id"),E=m[m.length-1||0]||h;f.id=h,f.version=N.UUID.uuid(),f.createdAt=(i==null?void 0:i.timestamp)||B().toISOString(),f.author=(i==null?void 0:i.author)||"1",f.previousVersion=null,f.deleted=!1,f.deletable=!0,f.editable=!0;const b=Yi(f,e);r?b.setParent(r,i):this.parent&&b.setParent(this.parent,null),c&&b.subscribe(),b.initChildren(i),i==null||i.add(b,W.Added);const g=($=this.dataType)==null?void 0:$.clone(i,b,N.UUID.uuid(),c);b.setDataType(g||null,i);const _=(L=this.inputs)==null?void 0:L.map((j,k)=>j.clone(i,b,E+"-argument-value-descriptor-"+k+"-id",c));return b.inputs=_,this.error&&(b.error=this.error.clone(i,b,E+"-error-action-descriptor-id",c)),i==null||i.attemptAutoclose(w.CloneEntity,this.id),b}addInput(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.AddInput))){if(this.id==="base-up-sql-row-transformer")throw new Error("Cannot modify built-in entity");return this.checkCanEdit(this,r)?(this.inputs.find(a=>a.id===i.id)||(this.inputs.push(i),r==null||r.add(this,W.Affected)),r==null||r.attemptAutoclose(w.AddInput,this.id),this):(z.Logger.warn(`[addInput] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.AddInput,this.id),this)}removeInput(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.RemoveInput))){return this.checkCanEdit(this,r)?(this.inputs.find(a=>a.id===i.id)&&(this.inputs=this.inputs.filter(a=>a.id!==i.id),r==null||r.add(this,W.Affected)),r==null||r.attemptAutoclose(w.RemoveInput,this.id),this):(z.Logger.warn(`[removeInput] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.RemoveInput,this.id),this)}setError(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.SetErrorEntity))){if(!this.checkCanEdit(this,r))return z.Logger.warn(`[setError] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.SetErrorEntity,this.id),this;const a=this.error;return(a==null?void 0:a.id)!==(i==null?void 0:i.id)&&(a==null||a.remove({ignoreUpstream:!0},r),this.error=i,this.subscribeToDependencies(),r==null||r.add(this,W.Affected)),r==null||r.attemptAutoclose(w.SetErrorEntity,this.id),this}setDataType(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.SetDataType))){if(!this.checkCanEdit(this,r))return z.Logger.warn(`[setDataType] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.SetDataType,this.id),this;const a=this.dataType;return(a==null?void 0:a.id)!==(i==null?void 0:i.id)&&(a==null||a.remove({ignoreUpstream:!0},r),this.dataType=i,this.subscribeToDependencies(),r==null||r.add(this,W.Affected)),r==null||r.attemptAutoclose(w.SetDataType,this.id),this}removeDataType(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.RemoveDataType))){return this.checkCanEdit(this,i)?(this.dataType&&(this.dataType.remove({ignoreUpstream:!0},i),i==null||i.add(this,W.Affected),this.dataType=null),i==null||i.attemptAutoclose(w.RemoveDataType,this.id),this):(z.Logger.warn(`[removeDataType] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(w.RemoveDataType,this.id),this)}getDataType(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,"get-data-type"))){return i==null||i.attemptAutoclose("get-data-type",this.id),this.dataType||null}createInternalCall(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,"create-internal")),r,a={}){const c={catchesError:!1,id:a.id||N.UUID.uuid(),version:a.version||N.UUID.uuid(),createdAt:a.createdAt||(i==null?void 0:i.timestamp)||B().toISOString(),author:a.author||N.sessionAuthor||"1",previousVersion:a.previousVersion||null,deleted:a.deleted||!1,deletable:!0,editable:!0,type:d.InternalCall,writesValues:[],parent:r.toReference(),successCalls:a.successCalls||[],errorCalls:a.errorCalls||[],inputs:a.inputs||[],outputs:a.outputs||[],error:a.error||null,calledBySuccess:a.calledBySuccess||[],calledByError:a.calledByError||[],calledByEntry:a.calledByEntry||[],declaration:this.toShallowJSON(),index:r.internalCalls.length},e=Ae(c,this.project);return e.hydrateAncestors(),i==null||i.add(e,W.Added),e.addSelfToProject(i),e.setParent(r,i),e.initChildren(i),e.afterAllChildrenInitialized(i),i==null||i.attemptAutoclose("create-internal",this.id),e}getUniqueOutputProperties(){const i=[];return this.dataType&&this.dataType.entity&&this.dataType.entity.type===d.DefinitionEntity&&this.dataType.entity.properties.length?this.dataType.entity.properties:i}};R(bi,"repository",{APICreate:async(i,...r)=>i,APIUpdate:async(i,...r)=>i,APIDelete:async(i,...r)=>i,APIClone:async(i,...r)=>{},APILoad:async(i,...r)=>null,APILoadVersion:async(i,r,...a)=>null}),R(bi,"type",d.ActionDescriptor),R(bi,"USER_MANAGED_PARENT_TYPES",[d.DefinitionEntity,d.DataType]),R(bi,"PARENT_TYPES",[...bi.USER_MANAGED_PARENT_TYPES,d.PrimitiveEntity,d.BuiltInBaseEntity]),R(bi,"MUTABLE_BASE_PROPERTIES",["name","codeName","description","index","outputName","outputDescription"]),R(bi,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),R(bi,"BASE_PROPERTIES",[...bi.MUTABLE_BASE_PROPERTIES,...bi.INMUTABLE_BASE_PROPERTIES]),R(bi,"MUTABLE_META_PROPERTIES",[...bi.MUTABLE_BASE_PROPERTIES]),R(bi,"INMUTABLE_META_PROPERTIES",[...bi.INMUTABLE_BASE_PROPERTIES]),R(bi,"META_PROPERTIES",[...bi.MUTABLE_META_PROPERTIES,...bi.INMUTABLE_META_PROPERTIES]),R(bi,"MUTABLE_UPSTREAM_PROPERTIES",[]),R(bi,"INMUTABLE_UPSTREAM_PROPERTIES",["parent"]),R(bi,"UPSTREAM_PROPERTIES",[...bi.MUTABLE_UPSTREAM_PROPERTIES,...bi.INMUTABLE_UPSTREAM_PROPERTIES]),R(bi,"MUTABLE_DOWNSTREAM_PROPERTIES",["inputs","outputs"]),R(bi,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),R(bi,"DOWNSTREAM_PROPERTIES",[...bi.MUTABLE_DOWNSTREAM_PROPERTIES,...bi.INMUTABLE_DOWNSTREAM_PROPERTIES]),R(bi,"PROPERTIES",[...bi.META_PROPERTIES,...bi.UPSTREAM_PROPERTIES,...bi.DOWNSTREAM_PROPERTIES]);let ki=bi;var v_e=(l=>(l.Parent="loop-parent-field",l.LoopDataTypeEntity="loop-data-type-entity-field",l.LoopDataType="loop-data-type-field",l.LoopBodyDataTypeEntity="loop-body-data-type-entity-field",l.LoopBodyDataType="loop-body-data-type-field",l))(v_e||{});const Jt=class Jt extends Qr{constructor(i,r){super(i);R(this,"initialData");R(this,"id");R(this,"x");R(this,"y");R(this,"type",d.Loop);R(this,"catchesError",!1);R(this,"declaration");R(this,"writesValues",[]);R(this,"dataType",null);R(this,"inputs",[]);R(this,"outputs",[]);R(this,"successCalls",[]);R(this,"errorCalls",[]);R(this,"error",null);R(this,"body");R(this,"calledBySuccess",[]);R(this,"calledByError",[]);R(this,"calledByEntry",[]);R(this,"parent");R(this,"detachedChildren",[]);R(this,"errors",[]);R(this,"project");R(this,"detachedDependents",{});R(this,"knownVersions",null);R(this,"activeVersion",!1);R(this,"initialized",!1);R(this,"startedInitialization",!1);this.initialData=i,this.project=r,this.id=i.id,this.x=i.x,this.y=i.y,this.catchesError=i.catchesError||!1}static new(i=null){return{id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:(i==null?void 0:i.author)||N.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.Loop,writesValues:[],catchesError:!1,declaration:null,inputs:[],outputs:[],dataType:null,error:null,body:null,parent:null,calledByEntry:[],calledBySuccess:[],calledByError:[],errorCalls:[],successCalls:[],x:0,y:0}}static fromGenerationTarget(i,r){let a=r;if(i.parent){const g=X(i.parent);a=r.get(g)}const c=X(i.declaration),e=r.get(c),f=(i.calledByEntry||[]).map(g=>{const _=X(g);return r.get(_)}),h=(i.calledBySuccess||[]).map(g=>{const _=X(g);return r.get(_)}),m=(i.calledByError||[]).map(g=>{const _=X(g);return r.get(_)}),E={id:i.id,version:N.UUID.uuid(),createdAt:B().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.Loop,writesValues:[],dataType:null,catchesError:i.catchesError||!1,declaration:e.toJSON(),calledByEntry:f.map(g=>g.toReference()),calledBySuccess:h.map(g=>g.toReference()),calledByError:m.map(g=>g.toReference()),errorCalls:[],successCalls:[],inputs:[],outputs:[],body:null,error:null,x:0,y:0,parent:a.toReference()},b=Ae(E,r);return b.hydrateAncestors(),b.setParent(a,null),b}static validateGenerationTarget(i,r){let a=JSON.parse(JSON.stringify(i));const c=[],e=[],f=wn(a,{parent:{list:!1,types:[...vr,d.Project],optional:!0},declaration:{list:!1,types:[d.ActionDescriptor]}},r);c.push(...f.explanations),a=f.modifiedData;const h=Zr(a);if(e.push(...f.errors,...h.errors),c.push(...h.explanations),!i.declaration)e.push(new Re({id:`${i.id}--${we.InvalidObjectStructure}`,code:we.InvalidObjectStructure,severity:me.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 '${d.Loop}' entities.`})),c.push({id:Ji.AllOperationActionDescriptors,message:Cg(r)});else if(!r.get(i.declaration))e.push(new Re({id:`${i.id}--${he.ReferencedEntityNotFound}`,code:he.ReferencedEntityNotFound,severity:me.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 '${d.Loop}' entities.`})),c.push({id:Ji.AllOperationActionDescriptors,message:Cg(r)});else{const E=Qje(i.declaration,r);e.push(...E.errors),c.push(...E.explanations)}return{errors:e,explanations:c,modifiedData:a}}get currentIterationNumberArgumentDeclaration(){var a;const i=(a=re[d.Loop][this.declaration.id].body.inputs.iterationNumber)==null?void 0:a.id;return this.body.inputs.find(c=>!!c.implements.find(e=>e.id===i)||c.name===Jt.CURRENT_ITERATION_NUMBER_ARG_NAME)}get currentValueArgumentDeclaration(){var a;if(this.declaration.id===pt.ManualFlow||this.declaration.id===pt.Counted)return null;const i=(a=re[d.Loop][this.declaration.id].body.inputs.currentValue)==null?void 0:a.id;return this.body.inputs.find(c=>!!c.implements.find(e=>e.id===i)||c.name===Jt.CURRENT_VALUE_ARG_NAME)||null}get continueStatements(){return yt(this.body).filter(a=>a.type===d.ContinueStatement&&a.parent.id===this.id)}get breakStatements(){return yt(this.body).filter(a=>a.type===d.BreakStatement&&a.parent.id===this.id)}validateGeneratedUpdate(i){const r=[],a=[];return i.parent&&r.push(new Re({id:`${this.id}--${he.InvalidParentUpdate}`,code:he.InvalidParentUpdate,severity:me.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.
|
|
46
46
|
If an entity is called by another, they must be in the same scope, which means they have the same parent.
|
|
47
47
|
You shouldn't have to manually update a 'parent' property. The equivalent result is to change its callers, the value writers of its inputs, or the value readers of its outputs.`})),{errors:r,explanations:a,modifiedData:i}}subscribeDependents(i){return i.forEach(r=>{this.detachedDependents[r.entity.id]||(this.detachedDependents[r.entity.id]=r)}),this}unsubscribeDependents(i){return i.forEach(r=>{this.detachedDependents[r.entity.id]&&delete this.detachedDependents[r.entity.id]}),this}syncDependents(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,"sync-dependents"))){const r=[],a=[],c=[],e=[];return Object.values(this.detachedDependents).forEach(f=>{const h=f.entity.afterAllChildrenInitialized(i);r.push(...h.updated),a.push(...h.added),c.push(...h.removed),e.push(...h.affected)}),i==null||i.attemptAutoclose("sync-dependents",this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}onDetachedDependencyRemoved(i,r,a){const c=[],e=[],f=[],h=[];if(r==="loop-parent-field"){const{updated:m,added:E,removed:b}=this.remove({ignoreUpstream:!1},a);c.push(...m),e.push(...E),f.push(...b)}return{updated:C(c),added:C(e),removed:C(f),affected:C(h),self:this}}onDetachedDependencyRestored(i,r,a){const c=[],e=[],f=[],h=[];if(r==="loop-parent-field"){const{updated:m,added:E,removed:b}=this.restore({},a);c.push(...m),e.push(...E),f.push(...b)}return{updated:C(c),added:C(e),removed:C(f),affected:C(h),self:this}}unsubscribeFromDependencies(){var i,r,a,c,e,f,h,m,E,b,g,_,$;return(i=this.parent)==null||i.unsubscribeDependents([{entity:this,field:"loop-parent-field"}]),(c=(a=(r=this.dataType)==null?void 0:r.entity)==null?void 0:a.unsubscribeDependents)==null||c.call(a,[{entity:this,field:"loop-data-type-entity-field"}]),(f=(e=this.dataType)==null?void 0:e.unsubscribeDependents)==null||f.call(e,[{entity:this,field:"loop-data-type-field"}]),(b=(E=(m=(h=this.body)==null?void 0:h.dataType)==null?void 0:m.entity)==null?void 0:E.unsubscribeDependents)==null||b.call(E,[{entity:this,field:"loop-body-data-type-entity-field"}]),($=(_=(g=this.body)==null?void 0:g.dataType)==null?void 0:_.unsubscribeDependents)==null||$.call(_,[{entity:this,field:"loop-body-data-type-field"}]),this}subscribeToDependencies(){var i,r,a,c,e,f,h,m,E,b,g,_,$;return(i=this.parent)==null||i.subscribeDependents([{entity:this,field:"loop-parent-field"}]),(c=(a=(r=this.dataType)==null?void 0:r.entity)==null?void 0:a.subscribeDependents)==null||c.call(a,[{entity:this,field:"loop-data-type-entity-field"}]),(f=(e=this.dataType)==null?void 0:e.subscribeDependents)==null||f.call(e,[{entity:this,field:"loop-data-type-field"}]),(b=(E=(m=(h=this.body)==null?void 0:h.dataType)==null?void 0:m.entity)==null?void 0:E.subscribeDependents)==null||b.call(E,[{entity:this,field:"loop-body-data-type-entity-field"}]),($=(_=(g=this.body)==null?void 0:g.dataType)==null?void 0:_.subscribeDependents)==null||$.call(_,[{entity:this,field:"loop-body-data-type-field"}]),this}increaseVersion(i){if(i&&!B(i).isValid())throw new Error(`The shared timestamp '${i}' is not a valid ISO 8601 date string.`);return i&&B(i).isSame(B(this.createdAt))?this:(this.previousVersion=this.version,this.version=N.UUID.uuid(),this.createdAt=B(i).toISOString()||B().toISOString(),this)}captureVersion(){var r;const i=((r=this.knownVersions)==null?void 0:r.get(this.version))||new Jt(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.error=this.error,i.successCalls=[...this.successCalls],i.errorCalls=[...this.errorCalls],i.declaration=this.declaration,i.body=this.body,i.calledByEntry=[...this.calledByEntry],i.calledBySuccess=[...this.calledBySuccess],i.calledByError=[...this.calledByError],i.dataType=this.dataType,i.parent=this.parent,this}recursiveCaptureUpstreamVersions(i){const r=[],a=[],c=[],e=[];if(this.parent){this.parent.increaseVersion(i);const f=this.parent.recursiveCaptureUpstreamVersions(i);r.push(this.parent,...f.updated),a.push(...f.added),c.push(...f.removed)}return{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}async restoreVersion(i){var h;const r=[],a=[],c=[],e=[];if(this.version===i)return{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this};if(!this.knownVersions){const m=new Map;for(const[E,b]of this.knownVersions||new Map){if(m.set(E,b),b.activeVersion=!1,b.knownVersions)for(const[g,_]of b.knownVersions)m.set(g,_);b.knownVersions=null}}let f=(h=this.knownVersions)==null?void 0:h.get(i);if(!f){const m=await this.APILoadVersion({},i);if(!m)throw new Error(`Version with id '${i}' for entity with id '${this.id}' not found.`);f=new Jt(m,this.project)}return this.metaSync(f.toShallowJSON(),null),this.previousVersion=f.previousVersion,this.version=f.version,this.createdAt=f.createdAt,this.author=f.author,this.deleted=f.deleted,this.inputs=f.inputs,this.outputs=f.outputs,this.error=f.error,this.successCalls=f.successCalls,this.errorCalls=f.errorCalls,this.declaration=f.declaration,this.body=f.body,this.calledByEntry=f.calledByEntry,this.calledBySuccess=f.calledBySuccess,this.calledByError=f.calledByError,this.dataType=f.dataType,this.parent=f.parent,{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}updateWithShallowTransfer(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.UpdateWithShallowTransfer))){if(!this.checkCanEdit(this,r))return z.Logger.warn(`[updateWithShallowTransfer] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.UpdateWithShallowTransfer,this.id),this;if(this.metaSync(i,r),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 a=X(i.parent),c=this.project.get(a),e=this.parent;if(e&&e.id!==(c==null?void 0:c.id)&&this.removeFromParent(r),c)this.setParent(c,r),this.addSelfToProject(r);else throw r==null||r.attemptAutoclose(w.UpdateWithShallowTransfer,this.id),new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${a}' that isn't found in the project`)}else throw r==null||r.attemptAutoclose(w.UpdateWithShallowTransfer,this.id),new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(i.declaration){const a=X(i.declaration),c=this.project.get(a);c&&this.setDeclaration(c)}if(i.calledByEntry.forEach(a=>{const c=X(a),e=this.project.get(c);e&&(this.addEntryCaller(e,r),e.addCall(this,r))}),[...this.calledByEntry].forEach(a=>{i.calledByEntry.find(e=>X(e)===a.id)||(this.removeCaller(a,r),a.removeCall(this,r))}),i.calledBySuccess.forEach(a=>{const c=X(a),e=this.project.get(c);e&&(this.addSuccessCaller(e,r),e.addSuccessCall(this,r))}),[...this.calledBySuccess].forEach(a=>{i.calledBySuccess.find(e=>X(e)===a.id)||(this.removeCaller(a,r),a.removeCall(this,r))}),i.calledByError.forEach(a=>{const c=X(a),e=this.project.get(c);e&&(this.addErrorCaller(e,r),e.addErrorCall(this,r))}),[...this.calledByError].forEach(a=>{i.calledByError.find(e=>X(e)===a.id)||(this.removeCaller(a,r),a.removeCall(this,r))}),i.dataType){const a=X(i.dataType),c=this.project.get(a);c&&this.setDataType(c,r)}else this.setDataType(null,r);return i.outputs.forEach(a=>{const c=X(a),e=this.project.get(c);e&&(this.addOutput(e,r),e.setParent(this,r))}),[...this.outputs].forEach(a=>{i.outputs.find(e=>X(e)===a.id)||(this.removeOutput(a,r),a.removeFromParent(r))}),i.inputs.forEach(a=>{const c=X(a),e=this.project.get(c);e&&(this.addInput(e,r),e.setParent(this,r))}),[...this.inputs].forEach(a=>{i.inputs.find(e=>X(e)===a.id)||(this.removeInput(a,r),a.removeFromParent(r))}),i.writesValues.forEach(a=>{const c=X(a),e=this.project.get(c);e&&(this.addValueReader(e,r),e.setValueWriter(this,r))}),[...this.writesValues].forEach(a=>{i.writesValues.find(e=>X(e)===a.id)||(this.removeValueReader(a,r),a.setValueWriter(null,r))}),this.captureVersion(),this.subscribeToDependencies(),r==null||r.attemptAutoclose(w.UpdateWithShallowTransfer,this.id),this}updateWithGenerationTarget(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.UpdateWithGenerationTarget))){var a,c,e;if(!this.checkCanEdit(this,r))return z.Logger.warn(`[updateWithGenerationTarget] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.UpdateWithGenerationTarget,this.id),this;if(this.metaSync(i,r),i.parent){const f=X(i.parent),h=this.project.get(f),m=this.parent;if(m&&m.id!==(h==null?void 0:h.id)&&this.removeFromParent(r),h)this.setParent(h,r),this.addSelfToProject(r);else throw r==null||r.attemptAutoclose(w.UpdateWithGenerationTarget,this.id),new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${f}' that isn't found in the project`)}if(i.declaration){const f=X(i.declaration),h=this.project.get(f);if(h)this.setDeclaration(h);else throw new Error(`${this.type} with id '${this.id}' has a 'declaration' reference '${f}' that isn't found in the project`)}return(a=i.calledByEntry)==null||a.forEach(f=>{const h=X(f),m=this.project.get(h);if(m)this.addEntryCaller(m,r),m.addCall(this,r);else throw new Error(`${this.type} with id '${this.id}' has a 'calledByEntry' reference '${h}' that isn't found in the project`)}),i.calledByEntry&&[...this.calledByEntry].forEach(f=>{var m;((m=i.calledByEntry)==null?void 0:m.find(E=>X(E)===f.id))||(this.removeCaller(f,r),f.removeCall(this,r))}),(c=i.calledBySuccess)==null||c.forEach(f=>{const h=X(f),m=this.project.get(h);if(m)this.addSuccessCaller(m,r),m.addSuccessCall(this,r);else throw new Error(`${this.type} with id '${this.id}' has a 'calledBySuccess' reference '${h}' that isn't found in the project`)}),i.calledBySuccess&&[...this.calledBySuccess].forEach(f=>{var m;((m=i.calledBySuccess)==null?void 0:m.find(E=>X(E)===f.id))||(this.removeCaller(f,r),f.removeCall(this,r))}),(e=i.calledByError)==null||e.forEach(f=>{const h=X(f),m=this.project.get(h);if(m)this.addErrorCaller(m,r),m.addErrorCall(this,r);else throw new Error(`${this.type} with id '${this.id}' has a 'calledByError' reference '${h}' that isn't found in the project`)}),i.calledByError&&[...this.calledByError].forEach(f=>{var m;((m=i.calledByError)==null?void 0:m.find(E=>X(E)===f.id))||(this.removeCaller(f,r),f.removeCall(this,r))}),this.captureVersion(),this.subscribeToDependencies(),r==null||r.attemptAutoclose(w.UpdateWithGenerationTarget,this.id),this}hydrateAncestors(){const i=[],r=[],a=[],c=[];if(this.initialData.parent){const e=X(this.initialData.parent),f=this.project.get(e);if(f)this.setParent(f,null),i.push(f);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=X(this.initialData.declaration),f=this.project.get(e);f&&(this.setDeclaration(f),i.push(f))}return this.initialData.calledByEntry.forEach(e=>{const f=X(e),h=this.project.get(f);h&&this.addEntryCaller(h,null)}),this.initialData.calledBySuccess.forEach(e=>{const f=X(e),h=this.project.get(f);h&&this.addSuccessCaller(h,null)}),this.initialData.calledByError.forEach(e=>{const f=X(e),h=this.project.get(f);h&&this.addErrorCaller(h,null)}),{updated:C(i),added:C(r),removed:C(a),affected:C(c),self:this}}afterAllChildrenInitialized(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.AfterAllChildrenInitialized))){if(!this.checkCanEdit(this,i))return z.Logger.warn(`[afterAllChildrenInitialized] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(w.AfterAllChildrenInitialized,this.id),{updated:[],added:[],removed:[],affected:[],self:this};const r=[],a=[],c=[],e=[];if(this.initialized=!0,this.checkIsSynced())return i==null||i.attemptAutoclose(w.AfterAllChildrenInitialized,this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this};const{updated:f,added:h,removed:m}=this.syncChildren(i);return r.push(...f),a.push(...h),c.push(...m),this.inputs.sort((E,b)=>{var g,_;return(E.index??((g=E.declaration)==null?void 0:g.index))-(b.index??((_=b.declaration)==null?void 0:_.index))}),this.outputs.sort((E,b)=>{var g,_;return(E.index??((g=E.declaration)==null?void 0:g.index))-(b.index??((_=b.declaration)==null?void 0:_.index))}),this.captureVersion(),i==null||i.attemptAutoclose(w.AfterAllChildrenInitialized,this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}addSelfToProject(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,"add-self-to-project"))){const r=[this],a=[],c=[],e=[];return this.parent===this.project&&this.project.addLoop(this),this.successCalls.forEach(f=>{f.addSuccessCaller(this,i),r.push(f)}),this.errorCalls.forEach(f=>{f.addErrorCaller(this,i),r.push(f)}),this.calledByEntry.forEach(f=>{f.addCall(this,i),r.push(f)}),this.calledBySuccess.forEach(f=>{f.addSuccessCall(this,i),r.push(f)}),this.calledByError.forEach(f=>{f.addErrorCall(this,i),r.push(f)}),this.subscribe(),this.subscribeToDependencies(),i==null||i.attemptAutoclose("add-self-to-project",this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}get calledBy(){return[...this.calledByEntry,...this.calledBySuccess,...this.calledByError]}removeInput(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.RemoveInput))){if(!this.checkCanEdit(this,r))return z.Logger.warn(`[removeInput] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.RemoveInput,this.id),this;const a=this.inputs.findIndex(c=>c.id===i.id);return a>-1&&(this.inputs.splice(a,1),r&&(r==null||r.add(this,W.Affected))),r==null||r.attemptAutoclose(w.RemoveInput,this.id),this}addInput(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.AddInput))){return this.checkCanEdit(this,r)?this.inputs.includes(i)?(r==null||r.attemptAutoclose(w.AddInput,this.id),this):(this.inputs.push(i),r==null||r.add(this,W.Affected),r==null||r.attemptAutoclose(w.AddInput,this.id),this):(z.Logger.warn(`[addInput] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.AddInput,this.id),this)}addOutput(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,"add-output"))){return this.checkCanEdit(this,r)?this.outputs.includes(i)?(r==null||r.attemptAutoclose("add-output",this.id),this):(this.outputs.push(i),r==null||r.add(this,W.Affected),r==null||r.attemptAutoclose("add-output",this.id),this):(z.Logger.warn(`[addOutput] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose("add-output",this.id),this)}removeOutput(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,"remove-output"))){if(!this.checkCanEdit(this,r))return z.Logger.warn(`[removeOutput] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose("remove-output",this.id),this;const a=this.outputs.findIndex(c=>c.id===i.id);return a>-1&&(this.outputs.splice(a,1),r&&(r==null||r.add(this,W.Affected))),r==null||r.attemptAutoclose("remove-output",this.id),this}setBody(i){return this.body=i,this}detachBody(){return this.body=null,this}addSuccessCaller(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.AddSuccessCaller)),a=!1){var c;return this.checkCanEditWithCounterpartAndSideEffects(this,i,w.AddSuccessCaller,r)?((i==null?void 0:i.id)===this.id&&(r==null||r.event({id:`${w.AddSuccessCaller}-${this.id}--${Be.CannotSuccessCallItself}`,action:w.AddSuccessCaller,owner:this,errorReason:Be.CannotSuccessCallItself,rootAction:((c=r==null?void 0:r.self)==null?void 0:c.id)===this.id&&(r==null?void 0:r.autoCloseActionName)===w.AddSuccessCaller})),this.calledBySuccess.find(e=>e.id===i.id)||(this.calledBySuccess.push(i),r==null||r.add(this,W.Updated),a&&Tt(this,r)),r==null||r.attemptAutoclose(w.AddSuccessCaller,this.id),this):this}addErrorCaller(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.AddErrorCaller)),a=!1){var c;return this.checkCanEditWithCounterpartAndSideEffects(this,i,w.AddErrorCaller,r)?((i==null?void 0:i.id)===this.id&&(r==null||r.event({id:`${w.AddErrorCaller}-${this.id}--${Be.CannotErrorCallItself}`,action:w.AddErrorCaller,owner:this,errorReason:Be.CannotErrorCallItself,rootAction:((c=r==null?void 0:r.self)==null?void 0:c.id)===this.id&&(r==null?void 0:r.autoCloseActionName)===w.AddErrorCaller})),this.calledByError.find(e=>e.id===i.id)||(this.calledByError.push(i),r==null||r.add(this,W.Updated),a&&Tt(this,r)),r==null||r.attemptAutoclose(w.AddErrorCaller,this.id),this):this}addEntryCaller(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.AddEntryCaller)),a=!1){var c;return this.checkCanEditWithCounterpartAndSideEffects(this,i,w.AddEntryCaller,r)?((i==null?void 0:i.id)===this.id&&(r==null||r.event({id:`${w.AddEntryCaller}-${this.id}--${Be.CannotEntryCallItself}`,action:w.AddEntryCaller,owner:this,errorReason:Be.CannotEntryCallItself,rootAction:((c=r==null?void 0:r.self)==null?void 0:c.id)===this.id&&(r==null?void 0:r.autoCloseActionName)===w.AddEntryCaller})),this.calledByEntry.find(e=>e.id===i.id)||(this.calledByEntry.push(i),r==null||r.add(this,W.Updated),a&&Tt(this,r)),r==null||r.attemptAutoclose(w.AddEntryCaller,this.id),this):this}addErrorCall(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.AddErrorCall)),a=!1){var c;return this.checkCanEditWithCounterpartAndSideEffects(this,i,w.AddErrorCall,r)?((i==null?void 0:i.id)===this.id&&(r==null||r.event({id:`${w.AddErrorCaller}-${this.id}--${Be.CannotErrorCallItself}`,action:w.AddErrorCaller,owner:this,errorReason:Be.CannotErrorCallItself,rootAction:((c=r==null?void 0:r.self)==null?void 0:c.id)===this.id&&(r==null?void 0:r.autoCloseActionName)===w.AddErrorCaller})),this.errorCalls.find(e=>e.id===i.id)||(this.errorCalls.push(i),this.catchesError&&this.metaSync({catchesError:!1},r),a&&Tt(this,r),r==null||r.add(this,W.Affected)),r==null||r.attemptAutoclose(w.AddErrorCall,this.id),this):this}addSuccessCall(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.AddSuccessCall)),a=!1){var c;return this.checkCanEditWithCounterpartAndSideEffects(this,i,w.AddSuccessCall,r)?((i==null?void 0:i.id)===this.id&&(r==null||r.event({id:`${w.AddSuccessCaller}-${this.id}`,action:w.AddSuccessCaller,owner:this,errorReason:Be.CannotSuccessCallItself,rootAction:((c=r==null?void 0:r.self)==null?void 0:c.id)===this.id&&(r==null?void 0:r.autoCloseActionName)===w.AddSuccessCaller})),this.successCalls.find(e=>e.id===i.id)||(this.successCalls.push(i),a&&Tt(this,r),r==null||r.add(this,W.Affected)),r==null||r.attemptAutoclose(w.AddSuccessCall,this.id),this):this}removeCall(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.RemoveCall)),a=!1){if(!this.checkCanEditWithCounterpartAndSideEffects(this,i,w.RemoveCall,r))return this;const c=this.successCalls.findIndex(f=>f.id===i.id);c>-1&&(this.successCalls.splice(c,1),r==null||r.add(this,W.Affected));const e=this.errorCalls.findIndex(f=>f.id===i.id);return e>-1&&(this.errorCalls.splice(e,1),r==null||r.add(this,W.Affected)),a&&Tt(this,r),r==null||r.attemptAutoclose(w.RemoveCall,this.id),this}removeCaller(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,"remove-caller")),a=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,i,w.RemoveCaller,r)?(this.calledBySuccess=this.calledBySuccess.filter(c=>c.id!==i.id?!0:(r==null||r.add(this,W.Updated),r==null||r.add(c,W.Affected),!1)),this.calledByError=this.calledByError.filter(c=>c.id!==i.id?!0:(r==null||r.add(this,W.Updated),r==null||r.add(c,W.Affected),!1)),this.calledByEntry=this.calledByEntry.filter(c=>c.id!==i.id?!0:(r==null||r.add(this,W.Updated),r==null||r.add(c,W.Affected),!1)),a&&Tt(this,r),r==null||r.attemptAutoclose(w.RemoveCaller,this.id),this):this}replaceDetachedChild(i,r){const a=this.detachedChildren.indexOf(i);return a!==-1&&(this.detachedChildren[a]=r),this}subscribeDetachedChild(i){return this.detachedChildren.includes(i)||this.detachedChildren.push(i),this}unsubscribeDetachedChild(i){const r=this.detachedChildren.indexOf(i);return r!==-1&&this.detachedChildren.splice(r,1),this}setError(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.SetErrorEntity))){if(!this.checkCanEdit(this,r))return z.Logger.warn(`[setError] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.SetErrorEntity,this.id),this;const a=this.error;return(a==null?void 0:a.id)!==(i==null?void 0:i.id)&&(a==null||a.remove({ignoreUpstream:!0},r),this.error=i,this.subscribeToDependencies(),r==null||r.add(this,W.Affected)),r==null||r.attemptAutoclose(w.SetErrorEntity,this.id),this}setParent(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.SetParent))){var a;return this.checkCanEditWithCounterpartAndSideEffects(this,i,w.SetParent,r)?(((a=this.parent)==null?void 0:a.id)!==(i==null?void 0:i.id)&&(this.parent=i,r&&(r==null||r.add(this,W.Updated))),r==null||r.attemptAutoclose(w.SetParent,this.id),this):this}setDeclaration(i){return this.declaration=i,this}initChildren(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,"init-children"))){if(this.initialized||this.startedInitialization)return this;if(this.startedInitialization=!0,this.declaration=Ae(this.initialData.declaration,this.project),this.initialData.dataType){const r=Ae(this.initialData.dataType,this.project);this.setDataType(r,null),this.dataType.setParent(this,null),this.dataType.initChildren(i)}return this.successCalls=this.initialData.successCalls.map(r=>{const a=Ae(r,this.project);if(a.addSuccessCaller(this,null),[d.BreakStatement,d.ContinueStatement].includes(a.type))a.setParent(this.parent.parent,null),a.initChildren(i);else if(a.type===d.ReturnStatement){const c=fn(this,this.project);a.setParent(c,null),a.initChildren(i)}else a.type!==d.InternalCall&&(a.setParent(this.parent,null),a.initChildren(i));return a}),this.errorCalls=this.initialData.errorCalls.map(r=>{const a=Ae(r,this.project);if(a.addErrorCaller(this,null),[d.BreakStatement,d.ContinueStatement].includes(a.type))a.setParent(this.parent.parent,null),a.initChildren(i);else if(a.type===d.ReturnStatement){const c=fn(this,this.project);a.setParent(c,null),a.initChildren(i)}else a.type!==d.InternalCall&&(a.setParent(this.parent,null),a.initChildren(i));return a}),this.inputs=this.initialData.inputs.map(r=>{const a=Ae(r,this.project);return a.setParent(this,null),a.initChildren(i),a}),this.outputs=this.initialData.outputs.map(r=>{const a=Ae(r,this.project);return a.setParent(this,null),a.initChildren(i),a}),this.initialData.body&&(this.body=Ae(this.initialData.body,this.project),this.body.setParent(this,null),this.body.initChildren(i)),this.initialData.error&&(this.error=Ae(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}subscribe(){return this.activeVersion=!0,this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,"meta-sync"))){const a=Wr(this,i,r),c=Hr(this,a),e=this.toMeta();return this.x=a.x||e.x,this.y=a.y||e.y,this.catchesError=a.catchesError!==void 0?a.catchesError:this.catchesError,super.baseMetaSync(a,this,r),a.deleted===!0&&!e.deleted?r==null||r.add(this,W.Removed):a.deleted===!1&&e.deleted?r==null||r.add(this,W.Added):c&&(r==null||r.add(this,W.Updated)),r==null||r.attemptAutoclose("meta-sync",this.id),this}async APILoad(i=Se,...r){return await Jt.repository.APILoad(this.id,...r),this}async APICreate(i=Se,...r){return await Jt.repository.APICreate(this.toShallowJSON(),...r),this}async APIUpdate(i=Se,...r){return await Jt.repository.APIUpdate(this.toShallowJSON(),...r),this}async APIDelete(i=Se,...r){return await Jt.repository.APIDelete(this.toShallowJSON(),...r),this}async APIClone(i=Se,...r){return await Jt.repository.APIClone(this.id,...r),this}async APILoadVersion(i=Se,r,...a){return await Jt.repository.APILoadVersion(this.id,r,...a)}removeFromParent(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.RemoveFromParent))){if(!this.checkCanEdit(this,i))return z.Logger.warn(`[removeFromParent] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(w.RemoveFromParent,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const r=[],a=[],c=[],e=[];return this.parent.type===d.Project?(this.parent.removeLoop(this),e.push(this.parent)):this.parent.detachedChildren.includes(this)&&this.parent.unsubscribeDetachedChild(this),i==null||i.attemptAutoclose(w.RemoveFromParent,this.id),{added:C(c),updated:C(r),removed:C(a),affected:C(e),self:this}}remove({ignoreUpstream:i}={ignoreUpstream:!1},r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.RemoveEntity))){var h;if(!this.checkCanDelete(this,r))return z.Logger.warn(`[remove] User is not allowed to delete or edit this ${this.type} entity with id: ${this.id}`),r==null||r.event({id:`${w.RemoveEntity}-${this.id}--${Be.ActionOwnerEntityNonDeletable}`,action:w.RemoveEntity,owner:this,errorReason:Be.ActionOwnerEntityNonDeletable,rootAction:((h=r==null?void 0:r.self)==null?void 0:h.id)===this.id&&(r==null?void 0:r.autoCloseActionName)===w.RemoveEntity}),r==null||r.attemptAutoclose(w.RemoveEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const a=[],c=[],e=[],f=[];if(r!=null&&r.hasRemoved(this.id))return r==null||r.attemptAutoclose(w.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},r),Object.values(this.detachedDependents).forEach(m=>{const{updated:E,removed:b,added:g}=m.entity.onDetachedDependencyRemoved(this,m.field,r);a.push(...E),c.push(...b),e.push(...g)}),this.inputs.forEach(m=>{const{updated:E,removed:b}=m.remove({ignoreUpstream:!0},r);a.push(...E),c.push(...b)}),this.outputs.forEach(m=>{const{updated:E,removed:b}=m.remove({ignoreUpstream:!0},r);a.push(...E),c.push(...b)}),this.body.remove({ignoreUpstream:!0},r),this.error){const{updated:m,removed:E}=this.error.remove({ignoreUpstream:!0},r);a.push(...m),c.push(...E)}if(this.dataType){const{updated:m,removed:E}=this.dataType.remove({ignoreUpstream:!0},r);a.push(...m),c.push(...E)}if(this.successCalls.forEach(m=>{a.push(m),m.removeCaller(this,r)}),this.errorCalls.forEach(m=>{a.push(m),m.removeCaller(this,r)}),!i){const m=this.removeFromParent(r);e.push(...m.added),a.push(...m.updated),c.push(...m.removed),f.push(...m.affected),this.calledBy.forEach(E=>{a.push(E),E.removeCall(this,r)})}return r==null||r.attemptAutoclose(w.RemoveEntity,this.id),{added:C(e),updated:C(a),removed:C(c),affected:C(f),self:this}}restore({}={},i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.RestoreEntity))){if(!this.checkCanEdit(this,i))return z.Logger.warn(`[restore] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(w.RestoreEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const r=[],a=[],c=[],e=[];if(i!=null&&i.hasAdded(this.id))return i==null||i.attemptAutoclose(w.RestoreEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(this.subscribe(),this.project.unsubscribeDeletedInstance(this),this.metaSync({deleted:!1},i),this.inputs.forEach(f=>{const{updated:h}=f.restore({},i);a.push(...h)}),this.outputs.forEach(f=>{const{updated:h}=f.restore({},i);a.push(...h)}),this.body.restore({},i),this.successCalls.forEach(f=>{a.push(f),f.addSuccessCaller(this,i)}),this.errorCalls.forEach(f=>{a.push(f),f.addErrorCaller(this,i)}),this.error){const{updated:f}=this.error.restore({},i);a.push(...f)}if(this.dataType){const{updated:f}=this.dataType.restore({},i);a.push(...f)}return this.calledBySuccess.forEach(f=>{a.push(f),f.addSuccessCall(this,i)}),this.calledByError.forEach(f=>{a.push(f),f.addErrorCall(this,i)}),this.calledByEntry.forEach(f=>{a.push(f),f.addCall(this,i)}),i==null||i.attemptAutoclose(w.RestoreEntity,this.id),{added:C(r),updated:C(a),removed:C(c),affected:C(e),self:this}}toFlat(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this,...this.inputs.flatMap(a=>a.toFlat(i)),...this.outputs.flatMap(a=>a.toFlat(i)),...this.successCalls.flatMap(a=>a.toFlat(i)),...this.errorCalls.flatMap(a=>a.toFlat(i)),...this.error?this.error.toFlat(i):[],...this.body?this.body.toFlat(i):[],...this.dataType?this.dataType.toFlat(i):[],...this.continueStatements.flatMap(a=>a.toFlat(i)),...this.breakStatements.flatMap(a=>a.toFlat(i))])}toFlatIds(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this.id,...this.inputs.flatMap(a=>a.toFlatIds(i)),...this.outputs.flatMap(a=>a.toFlatIds(i)),...this.successCalls.flatMap(a=>a.toFlatIds(i)),...this.errorCalls.flatMap(a=>a.toFlatIds(i)),...this.error?this.error.toFlatIds(i):[],...this.body?this.body.toFlatIds(i):[],...this.dataType?this.dataType.toFlatIds(i):[],...this.continueStatements.flatMap(a=>a.toFlatIds(i)),...this.breakStatements.flatMap(a=>a.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,catchesError:this.catchesError}}toJSON(i=new Set){var r,a;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,catchesError:this.catchesError,x:this.x,y:this.y,dataType:((r=this.dataType)==null?void 0:r.toJSON(i))||null,calledBySuccess:this.calledBySuccess.map(c=>c.toReference()),calledByError:this.calledByError.map(c=>c.toReference()),calledByEntry:this.calledByEntry.map(c=>c.toReference()),writesValues:this.writesValues.map(c=>c.toJSON(i)),declaration:this.declaration.toJSON(i),inputs:this.inputs.map(c=>c.toJSON(i)),outputs:this.outputs.map(c=>c.toJSON(i)),successCalls:this.successCalls.map(c=>c.toJSON(i)),errorCalls:this.errorCalls.map(c=>c.toJSON(i)),error:((a=this.error)==null?void 0:a.toJSON(i))||null,body:this.body.toJSON(i),parent:this.parent.toReference()})}toJSONClone(i=nt){var a,c,e,f,h,m,E;let r;return(a=i.seenEntityMaps)!=null&&a.has(this.id)?r=i.seenEntityMaps.get(this.id):(r=i.newId||Xr(this,this.project,i.uuidStrategy),i.seenEntityMaps&&i.seenEntityMaps.set(this.id,r)),(c=i.seenEntities)!=null&&c.has(r)||(e=i.seenEntities)!=null&&e.has(this.id)?this.toReference({seenEntityMaps:i.seenEntityMaps}):((f=i.seenEntities)==null||f.add(r),(h=i.seenEntities)==null||h.add(this.id),{id:r,version:N.UUID.uuid(),createdAt:i.timestamp||B().toISOString(),previousVersion:null,author:this.author,deleted:this.deleted,type:this.type,editable:this.editable,deletable:this.deletable,x:this.x,y:this.y,catchesError:this.catchesError,dataType:((m=this.dataType)==null?void 0:m.toJSONClone({...i,newId:null}))||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})),declaration:this.declaration.toJSON(),inputs:this.inputs.map(b=>b.toJSONClone({...i,newId:null})),outputs:this.outputs.map(b=>b.toJSONClone({...i,newId:null})),writesValues:this.writesValues.map(b=>b.toJSONClone({...i,newId:null})),successCalls:this.successCalls.map(b=>b.toJSONClone({...i,newId:null})),errorCalls:this.errorCalls.map(b=>b.toJSONClone({...i,newId:null})),error:((E=this.error)==null?void 0:E.toJSONClone({...i,newId:null}))||null,body:this.body.toJSONClone({...i,newId:null}),parent:this.parent.toReference({seenEntityMaps:i.seenEntityMaps})})}toReference(i=nt){var a;let r=this.id;return(a=i.seenEntityMaps)!=null&&a.has(this.id)&&(r=i.seenEntityMaps.get(this.id)),{id:r+"--"+N.UUID.uuid()+"--ref",type:d.GenericReference,entityId:r,version:this.version,entityType:this.type}}toShallowJSON(i=nt){var a,c,e,f,h;let r=this.id;return(a=i.seenEntityMaps)!=null&&a.has(this.id)&&(r=i.seenEntityMaps.get(this.id)),{id:r,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,editable:this.editable,deletable:this.deletable,catchesError:this.catchesError,x:this.x,y:this.y,dataType:((c=this.dataType)==null?void 0:c.toReference(i))||null,declaration:((e=this.declaration)==null?void 0:e.toReference(i))||null,body:((f=this.body)==null?void 0:f.toReference(i))||null,inputs:this.inputs.map(m=>m.toReference(i)),outputs:this.outputs.map(m=>m.toReference(i)),writesValues:this.writesValues.map(m=>m.toReference(i)),successCalls:this.successCalls.map(m=>m.toReference(i)),errorCalls:this.errorCalls.map(m=>m.toReference(i)),calledBySuccess:this.calledBySuccess.map(m=>m.toReference(i)),calledByError:this.calledByError.map(m=>m.toReference(i)),calledByEntry:this.calledByEntry.map(m=>m.toReference(i)),error:((h=this.error)==null?void 0:h.toReference(i))||null,parent:this.parent.toReference(i)}}toFlatJSON(i=new Set){var a;return i.has(this.id)?[]:(i.add(this.id),[this.toShallowJSON(),...((a=this.body)==null?void 0:a.toFlatJSON(i))||[],...this.successCalls.flatMap(c=>c.toFlatJSON(i)),...this.errorCalls.flatMap(c=>c.toFlatJSON(i)),...this.inputs.flatMap(c=>c.toFlatJSON(i)),...this.outputs.flatMap(c=>c.toFlatJSON(i)),...this.continueStatements.flatMap(c=>c.toFlatJSON(i)),...this.breakStatements.flatMap(c=>c.toFlatJSON(i)),...this.error?this.error.toFlatJSON(i):[],...this.dataType?this.dataType.toFlatJSON(i):[]])}toGenerationTarget(i=nt){var c,e;const r=this.parent.type===d.Project?void 0:(c=i.seenEntityMaps)!=null&&c.has(this.parent.id)?i.seenEntityMaps.get(this.parent.id):this.parent.id;let a=this.id;return(e=i.seenEntityMaps)!=null&&e.has(this.id)&&(a=i.seenEntityMaps.get(this.id)),{id:a,type:this.type,calledByEntry:this.calledByEntry.map(f=>f.id),calledBySuccess:this.calledBySuccess.map(f=>f.id),calledByError:this.calledByError.map(f=>f.id),declaration:this.declaration.id,parent:r}}toFlatGenerationTarget(i=new Set){var a;return i.has(this.id)?[]:(i.add(this.id),[this.toGenerationTarget(),...((a=this.body)==null?void 0:a.toFlatGenerationTarget(i))||[],...this.successCalls.flatMap(c=>c.toFlatGenerationTarget(i)),...this.errorCalls.flatMap(c=>c.toFlatGenerationTarget(i)),...this.inputs.flatMap(c=>c.toFlatGenerationTarget(i)),...this.outputs.flatMap(c=>c.toFlatGenerationTarget(i)),...this.continueStatements.flatMap(c=>c.toFlatGenerationTarget(i)),...this.breakStatements.flatMap(c=>c.toFlatGenerationTarget(i)),...this.error?this.error.toFlatGenerationTarget(i):[],...this.dataType?this.dataType.toFlatGenerationTarget(i):[]])}clearErrors(){var i,r;return this.errors=[],this.inputs.forEach(a=>a.clearErrors()),this.outputs.forEach(a=>a.clearErrors()),this.successCalls.forEach(a=>a.clearErrors()),this.errorCalls.forEach(a=>a.clearErrors()),this.continueStatements.forEach(a=>a.clearErrors()),this.breakStatements.forEach(a=>a.clearErrors()),(i=this.error)==null||i.clearErrors(),(r=this.dataType)==null||r.clearErrors(),this}validate(){return this.errors=mx(this),{success:!0}}async validateAsync(i={}){const r=z.YieldTracker.from(i);return this.errors=await h_e(this,{tracker:r}),{success:!0}}getErrors(){return[...this.errors,...this.inputs.flatMap(r=>r.getErrors()),...this.outputs.flatMap(r=>r.getErrors()),...this.body?this.body.getErrors():[],...this.error?this.error.getErrors():[],...this.dataType?this.dataType.getErrors():[]]}async getErrorsAsync(i={}){const r=z.YieldTracker.from(i),a=[...this.errors];await r.tick();for(const c of this.inputs)a.push(...await c.getErrorsAsync({tracker:r}));for(const c of this.outputs)a.push(...await c.getErrorsAsync({tracker:r}));return this.body&&a.push(...await this.body.getErrorsAsync({tracker:r})),this.error&&a.push(...await this.error.getErrorsAsync({tracker:r})),this.dataType&&a.push(...await this.dataType.getErrorsAsync({tracker:r})),a}getShallowErrors(){return this.errors}clone(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.CloneEntity)),r=null,a=null,c=!0){var $,L;const e=Br(r,this),f=this.toJSON(),h=a||N.UUID.uuid();f.inputs=[];const m=h.split("-id"),E=m[m.length-1||0]||h;f.id=h,f.version=N.UUID.uuid(),f.createdAt=(i==null?void 0:i.timestamp)||B().toISOString(),f.author=(i==null?void 0:i.author)||"1",f.previousVersion=null,f.deleted=!1,f.deletable=!0,f.editable=!0;const b=Yi(f,e);r?b.setParent(r,i):b.setParent(this.parent,null),c&&b.subscribe(),b.initChildren(i),i==null||i.add(b,W.Added);const g=($=this.inputs)==null?void 0:$.map((j,k)=>j.clone(i,b,E+"-input-map-"+k+"-id",c));b.inputs=g;const _=(L=this.outputs)==null?void 0:L.map((j,k)=>j.clone(i,b,E+"-output-map-"+k+"-id",c));return b.outputs=_,this.body&&(b.body=this.body.clone(i,b,E+"-body-id",c,!0)),this.error&&(b.error=this.error.clone(i,b,E+"-error-map-id",c)),this.dataType&&(b.dataType=this.dataType.clone(i,b,E+"-data-type-id",c)),i==null||i.attemptAutoclose(w.CloneEntity,this.id),b}getVariableInstances(){return this.body?sr(this.body).filter(a=>a.type===d.VariableInstance):[]}addReturnStatement(i){return Ft.includes(this.parent.type)&&this.parent.addReturnStatement(i),this}removeReturnStatement(i){return Ft.includes(this.parent.type)&&this.parent.removeReturnStatement(i),this}addBreakStatement(i){return this.breakStatements.includes(i)||this.breakStatements.push(i),this}removeBreakStatement(i){const r=this.breakStatements.indexOf(i);return r!==-1&&this.breakStatements.splice(r,1),this}addContinueStatement(i){return this.continueStatements.includes(i)||this.continueStatements.push(i),this}removeContinueStatement(i){const r=this.continueStatements.indexOf(i);return r!==-1&&this.continueStatements.splice(r,1),this}getUniqueInputMaps(){const i=[];return[...this.breakStatements,...this.continueStatements].forEach(a=>{a.outputs.filter(e=>{var f;return!e.deleted&&!((f=e.declaration)!=null&&f.deleted)}).forEach(e=>{i.find(h=>h===e||se(h,this.project)===se(e,this.project)&&si(h.dataType,e.dataType))||i.push(e)})}),C(i)}syncTerminationStatements(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,"sync-termination-statements"))){const r=[],a=[],c=[],e=[],f=this.getUniqueInputMaps();return[...this.breakStatements,...this.continueStatements].forEach(m=>{const E=m.outputs.filter(g=>{var _;return!g.deleted&&!((_=g.declaration)!=null&&_.deleted)}),b=f.filter(g=>!E.find(_=>se(g,this.project)===se(_,this.project)&&si(g.dataType,_.dataType)));b.length&&(r.push(m),i==null||i.add(m,W.Updated)),b.forEach(g=>{const _=g.clone(i,m);i==null||i.add(_,W.Added),_.addSelfToProject(i),a.push(_)})}),i==null||i.attemptAutoclose("sync-termination-statements",this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}syncBodyInputIndexes(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,"sync-body-input-indexes"))){const r=[],a=[],c=[],e=[];return this.body.inputs.sort((f,h)=>f.index-h.index),i==null||i.attemptAutoclose("sync-body-input-indexes",this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}syncBodyArgumentsDeclarations(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,"sync-body-arguments-declarations"))){var L,j,k,G,H,ie;const r=[],a=[],c=[],e=[],{updated:f,added:h,removed:m}=this.syncFixedBodyArgumentDeclarations(i);r.push(...f),a.push(...h),c.push(...m);const E=this.getUniqueInputMaps(),b=this.body.inputs;if(E.sort((ee,ue)=>ee.index-ue.index),((k=(j=(L=this.body)==null?void 0:L.dataType)==null?void 0:j.entity)==null?void 0:k.id)!==re["primitive-entity"].void.id&&!b.find(ue=>{var ae,de,ce,ne,le,Q,oe;return ue.id!==((ae=this.currentIterationNumberArgumentDeclaration)==null?void 0:ae.id)&&ue.id!==((de=this.currentValueArgumentDeclaration)==null?void 0:de.id)&&((ne=(ce=ue.dataType)==null?void 0:ce.entity)==null?void 0:ne.id)===((oe=(Q=(le=this.body)==null?void 0:le.dataType)==null?void 0:Q.entity)==null?void 0:oe.id)})){let ue=0;this.currentIterationNumberArgumentDeclaration&&ue++,this.currentValueArgumentDeclaration&&ue++;const ae=Na.new(i);ae.name="Aggregate result",ae.description="Aggretated list of all previously outputted values from each iteration",ae.constant=!0,ae.index=ue,ae.required=!1,ae.parent=this.body.toReference();const de=Ae(ae,this.project);if(de.hydrateAncestors(),de.addSelfToProject(i),i==null||i.add(de,W.Added),a.push(de),de.setParent(this.body,i),de.initChildren(i),!de.dataType&&((G=this.body)!=null&&G.dataType)){const ce=mr.new(i);ce.parent=de.toReference();const ne=Ae(ce,this.project);ne.hydrateAncestors(),ne.addSelfToProject(i),a.push(ne),ne.setParent(de,i),ne.initChildren(i),ne.merge((H=this.body)==null?void 0:H.dataType,i),ne.setEntity((ie=this.body)==null?void 0:ie.dataType.entity,i),i==null||i.add(ne,W.Added)}}const{updated:g,added:_,removed:$}=this.removeExtraBodyArgumentDeclarations(i);return r.push(...g),a.push(..._),c.push(...$),i==null||i.attemptAutoclose("sync-body-arguments-declarations",this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}reAttachAllTerminationInputMapsToDeclarations(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,"reattach-termination-input-maps-to-declarations"))){var h,m,E;const r=[],a=[],c=[],e=[];return!((h=this.body)!=null&&h.dataType)||!((m=this.body)!=null&&m.dataType.entity)||((E=this.body)==null?void 0:E.dataType.entity.type)!==d.DefinitionEntity?(i==null||i.attemptAutoclose("reattach-termination-input-maps-to-declarations",this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}):([...this.breakStatements,...this.continueStatements].forEach(b=>{var j,k,G;const g=b.outputs.filter(H=>{var ie;return!H.deleted&&!((ie=H.declaration)!=null&&ie.deleted)}),_=g.filter(H=>!H.declaration&&!!H.readsValue),$=g.filter(H=>!H.declaration&&!H.readsValue);let L=(((G=(k=(j=this.body)==null?void 0:j.dataType)==null?void 0:k.entity)==null?void 0:G.properties)||[]).filter(H=>!g.find(ie=>{var ee,ue;return!ie.deleted&&!((ee=ie.declaration)!=null&&ee.deleted)&&((ue=ie.declaration)==null?void 0:ue.id)===H.id}));_.forEach(H=>{const ie=H.getDataType(i);if(H.readsValue){const ee=se(H.readsValue,this.project),ue=L.find(ae=>se(ae,this.project)===ee&&si(ae.dataType,ie));if(ue){H.setDeclaration(ue,i),r.push(H),L=L.filter(ae=>ae!==ue);return}}}),$.forEach(H=>{const ie=H.getDataType(i),ee=L.find(ue=>si(ue.dataType,ie));if(ee){H.setDeclaration(ee,i),r.push(H),L=L.filter(ue=>ue!==ee);return}}),g.forEach(H=>{const ie=L.find(ee=>se(ee,this.project)===se(H,this.project));H.declaration&&!L.includes(H.declaration)&&ie&&(H.setDeclaration(ie,i),r.push(H),L=L.filter(ee=>ee!==ie))})}),i==null||i.attemptAutoclose("reattach-termination-input-maps-to-declarations",this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this})}syncOutputDataType(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,"sync-outputs-properties"))){var $,L,j,k,G,H,ie,ee,ue,ae,de,ce,ne,le,Q,oe,Ee,Te,Ve,Le,$e;const r=[],a=[],c=[],e=[],f=[...this.breakStatements,...this.continueStatements];if(!f.every(ke=>ke.initialized))return i==null||i.attemptAutoclose("sync-outputs-properties",this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this};if(!(($=this.body)!=null&&$.dataType)){const ke=mr.new(i);ke.parent=this.body.toReference(),ke.inferred=!0;const Ke=Ae(ke,this.project);Ke.hydrateAncestors(),Ke.addSelfToProject(i),i==null||i.add(Ke,W.Added),Ke.initChildren(i),a.push(Ke)}const h=f.find(ke=>!!ke.readsValue);if(h){const ke=(L=h.readsValue)==null?void 0:L.getDataType(i);ke&&((k=(j=this.body)==null?void 0:j.dataType)==null||k.merge(ke,i))}const m=this.getUniqueInputMaps();let E=(H=(G=this.body)==null?void 0:G.dataType)==null?void 0:H.entity;if(m.length&&(!E||E.id===re["primitive-entity"].void.id)){const ke=Ds.new(i);ke.parent=((ie=this.body)==null?void 0:ie.dataType).toReference(),ke.name=`${se(this,this.project)} output definition`,ke.description=`The definition of the output data type of the loop '${se(this,this.project)}'`;const Ke=Ae(ke,this.project);Ke.setParent((ee=this.body)==null?void 0:ee.dataType,i),Ke.hydrateAncestors(),i==null||i.add(Ke,W.Added),Ke.addSelfToProject(i),Ke.initChildren(i),a.push(Ke),E=Ke,(ae=(ue=this.body)==null?void 0:ue.dataType)==null||ae.metaSync({inferred:!0},i)}const b=(E==null?void 0:E.properties)||[];(ce=(de=this.body)==null?void 0:de.dataType)!=null&&ce.inferred&&((le=(ne=this.body)==null?void 0:ne.dataType.entity)==null?void 0:le.type)===d.DefinitionEntity&&(m.forEach(ke=>{var Xt,tr,nr,Xn,nn;const Ke=ke.getDataType(i);let rt=b.find(ji=>se(ji,this.project)===se(ke,this.project)&&si(ji.dataType,ke.dataType));if(!rt){const ji=ts.new(i);ji.name=se(ke,this.project),ji.description=`Aggretated list of all previously outputted values from each iteration by the output '${se(ke,this.project)}'`,ji.index=ke.index,ji.required=((Xt=ke.declaration)==null?void 0:Xt.required)||!1,ji.parent=((nr=(tr=this.body)==null?void 0:tr.dataType)==null?void 0:nr.entity).toReference();const ar=Ae(ji,this.project);ar.hydrateAncestors(),ar.setParent((nn=(Xn=this.body)==null?void 0:Xn.dataType)==null?void 0:nn.entity,i),ar.addSelfToProject(i),i==null||i.add(ar,W.Added),ar.initChildren(i),a.push(ar),rt=ar}rt.index!==ke.index&&(rt.metaSync({index:ke.index},i),r.push(rt));let Et=rt.getDataType(i);if(Ke)if(!Et||!si(Et,Ke)){if(!Et){const ji=Ke.clone(i,rt);i==null||i.add(ji,W.Added),ji.addSelfToProject(i),Et=ji,a.push(ji),r.push(rt)}Et.merge(Ke,i),Et.metaSync({isList:!0},i)}else Et.isList||(Et.metaSync({isList:!0},i),r.push(Et));if(!Ke&&!Et){const ji={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.DataType,foreignKeyRef:null,foreignKeyAllowed:null,options:[],implementationChooseOne:!1,staticEntities:null,interactiveEntities:null,index:null,actionEntities:null,parentRelationType:null,isList:!0,entity:null,asType:!1,like:!1,inferred:!1,andChildrenGroup:null,orChildrenGroup:null,parent:rt.toReference()},ar=Ae(ji,this.project);ar.metaSync({isList:!0},i),ar.setParent(rt,i),ar.initChildren(i),i==null||i.add(ar,W.Added),ar.addSelfToProject(i),a.push(ar)}}),this.reAttachAllTerminationInputMapsToDeclarations(i)),(oe=(Q=this.body)==null?void 0:Q.dataType)!=null&&oe.inferred&&((Te=(Ee=this.body)==null?void 0:Ee.dataType.entity)==null?void 0:Te.type)===d.DefinitionEntity&&b.filter(Ke=>!m.find(rt=>se(Ke,this.project)===se(rt,this.project))).forEach(Ke=>{if(!(i!=null&&i.hasRemoved(Ke.id))&&!Ke.deleted){const{updated:Je,removed:rt}=Ke.remove({ignoreUpstream:!1},i);r.push(...Je),c.push(...rt)}}),f.forEach(ke=>{ke.outputs.filter(Je=>{var rt;return!Je.deleted&&!((rt=Je.declaration)!=null&&rt.deleted)}).forEach(Je=>{var Rt,Et,Xt;if(!(((Xt=(Et=(Rt=this.body)==null?void 0:Rt.dataType)==null?void 0:Et.entity)==null?void 0:Xt.properties)||[]).find(tr=>{var nr;return((nr=Je.declaration)==null?void 0:nr.id)===tr.id})&&!(i!=null&&i.hasRemoved(Je.id))&&!Je.deleted){const{updated:tr,removed:nr}=Je.remove({ignoreUpstream:!1},i);r.push(...tr),c.push(...nr)}})});const g=this.getUniqueInputMaps();if(f.every(ke=>!ke.readsValue)&&!g.length){const ke=this.project.getBuiltIn(re["primitive-entity"].void.id);(Le=(Ve=this.body)==null?void 0:Ve.dataType)==null||Le.setEntity(ke,i),r.push(($e=this.body)==null?void 0:$e.dataType)}return i==null||i.attemptAutoclose("sync-outputs-properties",this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}syncOutputMaps(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.SyncOutputs))){var E,b,g;const r=[],a=[],c=[],e=[],f=((g=(b=(E=this.body)==null?void 0:E.dataType)==null?void 0:b.entity)==null?void 0:g.properties)||[],h=this.outputs;return f.forEach(_=>{var j;let L=h.find(k=>{var G,H;return((G=k.declaration)==null?void 0:G.id)===_.id&&si((H=k.declaration)==null?void 0:H.dataType,_.dataType)});if(L)((j=L.declaration)==null?void 0:j.id)!==_.id&&(L.setDeclaration(_,i),r.push(L));else{const k={dataType:null,id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.OutputMap,index:_.index,declaration:_.toJSON(),writesValues:[],parent:this.toReference()},G=Ae(k,this.project);G.setParent(this,i),G.initChildren(i),i==null||i.add(G,W.Added),G.addSelfToProject(i),a.push(G),L=G}L.index!==_.index&&(L.metaSync({index:_.index},i),r.push(L))}),h.filter(_=>!f.find(L=>{var j;return((j=_.declaration)==null?void 0:j.id)===L.id})).forEach(_=>{const{updated:$,removed:L}=_.remove({ignoreUpstream:!1},i);r.push(...$),c.push(...L)}),i==null||i.attemptAutoclose(w.SyncOutputs,this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}createCurrentIterationNumberArgumentDeclaration(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,"create-current-iteration-number-argument-declaration"))){const r=[],a=[],c=[],e=[];let h=this.body.inputs.find(g=>{var _;return g.name===Jt.CURRENT_ITERATION_NUMBER_ARG_NAME||g.id===((_=this.currentIterationNumberArgumentDeclaration)==null?void 0:_.id)});const m=this.getCurrentIterationNumberBuiltInValueDescriptor();if(!h){const g={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.ArgumentDeclaration,name:Jt.CURRENT_ITERATION_NUMBER_ARG_NAME,codeName:null,description:"The number of the current iteration",defaultValue:null,constant:!0,dataType:null,implements:[m==null?void 0:m.toJSON()],index:this.body.inputs.length,required:!0,parent:this.body.toReference(),writesValues:[]},_=Ae(g,this.project);_.setParent(this.body,i),_.initChildren(i),i==null||i.add(_,W.Added),_.addSelfToProject(i),a.push(_),h=_}!h.index&&h.index!==0&&(h.metaSync({index:0},i),r.push(h)),(!h.implements||!h.implements.find(g=>g.id===m.id))&&(h.addImplementation(m,i),r.push(h));let b=h.getDataType(i);if(!b){const g={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.DataType,foreignKeyRef:null,foreignKeyAllowed:null,options:[],implementationChooseOne:!1,staticEntities:null,interactiveEntities:null,actionEntities:null,parentRelationType:null,isList:!1,index:null,entity:null,asType:!1,like:!1,inferred:!1,andChildrenGroup:null,orChildrenGroup:null,parent:h.toReference()},_=Ae(g,this.project);_.setParent(h,i),_.initChildren(i),i==null||i.add(_,W.Added),_.addSelfToProject(i),a.push(_),b=_}if(!b.entity||b.entity.type!==d.PrimitiveEntity||b.entity.name!==ye.Number||b.entity.id!==re["primitive-entity"].number.id){const g=this.project.getBuiltIn(re["primitive-entity"].number.id);b.setEntity(g,i),r.push(b)}return i==null||i.attemptAutoclose("create-current-iteration-number-argument-declaration",this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}removeExtraBodyArgumentDeclarations(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,"remove-extra-body-argument-declarations"))){const r=[],a=[],c=[],e=[];return this.body.inputs.filter(m=>{var E,b,g,_,$,L,j,k;return m===this.currentIterationNumberArgumentDeclaration||m===this.currentValueArgumentDeclaration?!1:((g=(b=(E=this.body)==null?void 0:E.dataType)==null?void 0:b.entity)==null?void 0:g.id)===re["primitive-entity"].void.id?!0:(($=(_=m.dataType)==null?void 0:_.entity)==null?void 0:$.id)!==((k=(j=(L=this.body)==null?void 0:L.dataType)==null?void 0:j.entity)==null?void 0:k.id)}).forEach(m=>{const{updated:E,removed:b}=m.remove({ignoreUpstream:!1},i);r.push(...E),c.push(...b)}),i==null||i.attemptAutoclose("remove-extra-body-argument-declarations",this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}createCurrentValueInputBasedOnInputMap(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,"create-current-value-input-based-on-input-map"))){var E,b,g,_,$,L,j,k,G;const r=[],a=[],c=[],e=[];switch(this.declaration.id){case pt.List:{const H=this.body.inputs.find(ue=>!!ue.implements.find(ae=>ae.id===re[d.Loop][pt.List].body.inputs.currentValue.id)),ie=this.inputs.find(ue=>{var ae;return((ae=ue.declaration)==null?void 0:ae.id)===re[d.Loop][pt.List].inputs.list.id});if(!ie)break;const ee=this.getCurrentValueBuiltInValueDescriptor();if(H){ee&&!H.implements.find(ce=>ce.id===ee.id)&&(H.addImplementation(ee,i),r.push(H));let ae=H.getDataType(i);if(!ae){const ce={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.DataType,foreignKeyRef:null,foreignKeyAllowed:null,options:[],implementationChooseOne:!1,parentRelationType:null,staticEntities:null,interactiveEntities:null,index:null,actionEntities:null,isList:!1,entity:null,asType:!1,like:!1,inferred:!1,andChildrenGroup:null,orChildrenGroup:null,parent:(E=this.currentValueArgumentDeclaration)==null?void 0:E.toReference()},ne=Ae(ce,this.project);ne.setParent(this.currentValueArgumentDeclaration,i),ne.initChildren(i),i==null||i.add(ne,W.Added),ne.addSelfToProject(i),a.push(ne),ae=ne}const de=ie.getDataType(i);ae.merge(de,i),ae.metaSync({isList:!1},i)}else{const ue={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.ArgumentDeclaration,name:Jt.CURRENT_VALUE_ARG_NAME,codeName:null,description:null,defaultValue:null,index:this.body.inputs.length,constant:!0,required:!0,implements:[ee],writesValues:[],dataType:null,parent:this.body.toReference()},ae=Ae(ue,this.project);ae.setParent(this.body,i),ae.initChildren(i),i==null||i.add(ae,W.Added),ae.addSelfToProject(i),ee&&!ae.implements.find(de=>de.id===ee.id)&&(ae.addImplementation(ee,i),r.push(ae)),a.push(ae)}break}case pt.ManualFlow:break;case pt.Counted:break;case pt.ObjectKeys:{const H=this.body.inputs.find(ue=>!!ue.implements.find(ae=>ae.id===re[d.Loop][pt.ObjectKeys].body.inputs.currentValue.id));if(!this.inputs.find(ue=>{var ae;return((ae=ue.declaration)==null?void 0:ae.id)===re[d.Loop][pt.ObjectKeys].inputs.object.id}))break;const ee=this.getCurrentValueBuiltInValueDescriptor();if(H){ee&&!H.implements.find(de=>de.id===ee.id)&&(H.addImplementation(ee),r.push(H));let ae=H.getDataType(i);if(ae){const de=this.project.getBuiltIn(re["primitive-entity"].string.id);((g=ae.entity)==null?void 0:g.id)!==de.id&&(ae.setEntity(de,i),r.push(ae))}else{const de={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.DataType,foreignKeyRef:null,foreignKeyAllowed:null,options:[],implementationChooseOne:!1,parentRelationType:null,staticEntities:null,interactiveEntities:null,index:null,actionEntities:null,isList:!1,entity:null,asType:!1,like:!1,inferred:!1,andChildrenGroup:null,orChildrenGroup:null,parent:(b=this.currentValueArgumentDeclaration)==null?void 0:b.toReference()},ce=Ae(de,this.project);ce.setParent(this.currentValueArgumentDeclaration,i),ce.initChildren(i),i==null||i.add(ce,W.Added),ce.addSelfToProject(i),ae=ce}}else{const ue={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.ArgumentDeclaration,name:Jt.CURRENT_VALUE_ARG_NAME,codeName:null,description:null,defaultValue:null,index:this.body.inputs.length,constant:!0,required:!0,implements:[ee],writesValues:[],dataType:null,parent:this.body.toReference()},ae=Ae(ue,this.project);ae.setParent(this.body,i),ae.initChildren(i),i==null||i.add(ae,W.Added),ae.addSelfToProject(i),ee&&!ae.implements.find(de=>de.id===ee.id)&&(ae.addImplementation(ee,i),r.push(ae)),a.push(ae)}break}case pt.ObjectValues:{const H=this.body.inputs.find(ue=>!!ue.implements.find(ae=>ae.id===re[d.Loop][pt.ObjectValues].body.inputs.currentValue.id)),ie=this.inputs.find(ue=>{var ae;return((ae=ue.declaration)==null?void 0:ae.id)===re[d.Loop][pt.ObjectValues].inputs.object.id});if(!ie)break;const ee=this.getCurrentValueBuiltInValueDescriptor();if(H){ee&&!H.implements.find(de=>de.id===ee.id)&&(H.addImplementation(ee,i),r.push(H));let ae=H.getDataType(i);if(ae){const de=ie.getDataType(i),ce=((L=de==null?void 0:de.entity)==null?void 0:L.properties)||[];(j=ae.orChildrenGroup)==null||j.forEach(ne=>{const{updated:le,removed:Q}=ne.remove({ignoreUpstream:!1},i);r.push(...le),c.push(...Q)}),ce.forEach(ne=>{if(!ne.getDataType(i)){const Q={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.DataType,foreignKeyRef:null,foreignKeyAllowed:null,options:[],implementationChooseOne:!1,staticEntities:null,interactiveEntities:null,actionEntities:null,index:null,isList:!1,entity:null,asType:!1,like:!1,inferred:!1,andChildrenGroup:null,orChildrenGroup:null,parentRelationType:We.OrDataTypeGroup,parent:ae.toReference()},oe=Ae(Q,this.project);oe.setParent(ae,i),oe.initChildren(i),i==null||i.add(oe,W.Added),oe.addSelfToProject(i),a.push(oe)}})}else{const de={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.DataType,foreignKeyRef:null,foreignKeyAllowed:null,options:[],implementationChooseOne:!1,parentRelationType:null,staticEntities:null,interactiveEntities:null,index:null,actionEntities:null,isList:!1,entity:null,asType:!1,like:!1,inferred:!1,andChildrenGroup:null,orChildrenGroup:null,parent:(_=this.currentValueArgumentDeclaration)==null?void 0:_.toReference()},ce=Ae(de,this.project);ce.setParent(this.currentValueArgumentDeclaration,i),ce.initChildren(i),i==null||i.add(ce,W.Added),ce.addSelfToProject(i),ae=ce;const ne=ie.getDataType(i);((($=ne==null?void 0:ne.entity)==null?void 0:$.properties)||[]).forEach(Q=>{if(!Q.getDataType(i)){const Ee={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.DataType,foreignKeyRef:null,foreignKeyAllowed:null,options:[],implementationChooseOne:!1,staticEntities:null,interactiveEntities:null,actionEntities:null,index:null,isList:!1,entity:null,asType:!1,like:!1,inferred:!1,andChildrenGroup:null,orChildrenGroup:null,parentRelationType:We.OrDataTypeGroup,parent:ce.toReference()},Te=Ae(Ee,this.project);Te.setParent(ce,i),Te.initChildren(i),i==null||i.add(Te,W.Added),Te.addSelfToProject(i),a.push(Te)}})}}else{const ue={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.ArgumentDeclaration,name:Jt.CURRENT_VALUE_ARG_NAME,codeName:null,description:null,constant:!0,defaultValue:null,index:this.body.inputs.length,required:!0,implements:[ee],writesValues:[],dataType:null,parent:this.body.toReference()},ae=Ae(ue,this.project);ae.setParent(this.body,i),ae.initChildren(i),i==null||i.add(ae,W.Added),ae.addSelfToProject(i),ee&&!ae.implements.find(de=>de.id===ee.id)&&(ae.addImplementation(ee,i),r.push(ae)),a.push(ae)}break}case pt.String:{const H=this.body.inputs.find(ue=>!!ue.implements.find(ae=>ae.id===re[d.Loop][pt.String].body.inputs.currentValue.id));if(!this.inputs.find(ue=>{var ae;return((ae=ue.declaration)==null?void 0:ae.id)===re[d.Loop][pt.String].inputs.string.id}))break;const ee=this.getCurrentValueBuiltInValueDescriptor();if(H){ee&&!H.implements.find(de=>de.id===ee.id)&&(H.addImplementation(ee,i),r.push(H));let ae=H.getDataType(i);if(ae){const de=this.project.getBuiltIn(re["primitive-entity"].string.id);((G=ae.entity)==null?void 0:G.id)!==de.id&&(ae.setEntity(de,i),r.push(ae))}else{const de={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.DataType,foreignKeyRef:null,foreignKeyAllowed:null,options:[],implementationChooseOne:!1,parentRelationType:null,staticEntities:null,interactiveEntities:null,index:null,actionEntities:null,isList:!1,entity:null,asType:!1,like:!1,inferred:!1,andChildrenGroup:null,orChildrenGroup:null,parent:(k=this.currentValueArgumentDeclaration)==null?void 0:k.toReference()},ce=Ae(de,this.project);ce.setParent(this.currentValueArgumentDeclaration,i),ce.initChildren(i),i==null||i.add(ce,W.Added),ce.addSelfToProject(i),a.push(ce),ae=ce}}else{const ue={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.ArgumentDeclaration,name:Jt.CURRENT_VALUE_ARG_NAME,codeName:null,description:null,index:this.body.inputs.length,required:!0,constant:!0,defaultValue:null,implements:[ee],writesValues:[],dataType:null,parent:this.body.toReference()},ae=Ae(ue,this.project);ae.setParent(this.body,i),ae.initChildren(i),i==null||i.add(ae,W.Added),ae.addSelfToProject(i),ee&&!ae.implements.find(de=>de.id===ee.id)&&(ae.addImplementation(ee,i),r.push(ae)),a.push(ae)}break}}const{updated:f,added:h,removed:m}=this.removeExtraBodyArgumentDeclarations(i);return r.push(...f),a.push(...h),c.push(...m),i==null||i.attemptAutoclose("create-current-value-input-based-on-input-map",this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}syncFixedBodyArgumentDeclarations(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,"sync-fixed-body-argument-declarations"))){const r=[],a=[],c=[],e=[],{updated:f,added:h,removed:m}=this.createCurrentIterationNumberArgumentDeclaration(i);r.push(...f),a.push(...h),c.push(...m);const{updated:E,added:b,removed:g}=this.createCurrentValueInputBasedOnInputMap(i);return r.push(...E),a.push(...b),c.push(...g),i==null||i.attemptAutoclose("sync-fixed-body-argument-declarations",this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}syncInputMaps(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,"sync-input-maps"))){const r=[],a=[],c=[],e=[];switch(this.declaration.id){case pt.List:{let f=null;if(this.inputs.forEach(m=>{var E;((E=m.declaration)==null?void 0:E.id)===re[d.Loop]["list-loop"].inputs.list.id?f=m:(m.remove({ignoreUpstream:!1},i),c.push(m))}),f){if(f.declaration.id!==re[d.Loop]["list-loop"].inputs.list.id){const m=this.project.get(re[d.Loop]["list-loop"].inputs.list.id);f.setDeclaration(m,i),r.push(f)}}else{const m=this.project.get(re[d.Loop]["list-loop"].inputs.list.id),E={dataType:null,id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.InputMap,parentRelationType:null,name:null,codeName:null,description:null,index:0,declaration:m.toJSON(),readsValue:null,defaultValue:null,parent:this.toReference()},b=Ae(E,this.project);b.setParent(this,i),b.initChildren(i),i==null||i.add(b,W.Added),b.addSelfToProject(i),a.push(b)}[...this.inputs].forEach(m=>{var E;((E=m.declaration)==null?void 0:E.id)!==re[d.Loop]["list-loop"].inputs.list.id&&(m.remove({ignoreUpstream:!1},i),c.push(m))}),this.inputs.sort((m,E)=>B(m.createdAt).isBefore(B(E.createdAt))?-1:1).forEach((m,E)=>{E!==0&&(m.remove({ignoreUpstream:!1},i),c.push(m))});break}case pt.ManualFlow:{this.inputs.forEach(f=>{f.remove({ignoreUpstream:!1},i),c.push(f)});break}case pt.Counted:{let f=null;if(this.inputs.forEach(m=>{var E;((E=m.declaration)==null?void 0:E.id)===re[d.Loop]["counted-loop"].inputs.number.id?f=m:(m.remove({ignoreUpstream:!1},i),c.push(m))}),f){if(f.declaration.id!==re[d.Loop]["counted-loop"].inputs.number.id){const m=this.project.get(re[d.Loop]["counted-loop"].inputs.number.id);f.setDeclaration(m,i),r.push(f)}}else{const m=this.project.get(re[d.Loop]["counted-loop"].inputs.number.id),E={dataType:null,id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.InputMap,parentRelationType:null,name:null,codeName:null,description:null,index:0,declaration:m.toJSON(),readsValue:null,defaultValue:null,parent:this.toReference()},b=Ae(E,this.project);b.setParent(this,i),b.initChildren(i),i==null||i.add(b,W.Added),b.addSelfToProject(i),a.push(b)}[...this.inputs].forEach(m=>{var E;((E=m.declaration)==null?void 0:E.id)!==re[d.Loop]["counted-loop"].inputs.number.id&&(m.remove({ignoreUpstream:!1},i),c.push(m))}),this.inputs.sort((m,E)=>B(m.createdAt).isBefore(B(E.createdAt))?-1:1).forEach((m,E)=>{E!==0&&(m.remove({ignoreUpstream:!1},i),c.push(m))});break}case pt.ObjectKeys:{let f=null;if(this.inputs.forEach(m=>{var E;((E=m.declaration)==null?void 0:E.id)===re[d.Loop]["object-keys-loop"].inputs.object.id?f=m:(m.remove({ignoreUpstream:!1},i),c.push(m))}),f){if(f.declaration.id!==re[d.Loop]["object-keys-loop"].inputs.object.id){const m=this.project.get(re[d.Loop]["object-keys-loop"].inputs.object.id);f.setDeclaration(m,i),r.push(f)}}else{const m=this.project.get(re[d.Loop]["object-keys-loop"].inputs.object.id),E={dataType:null,id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.InputMap,parentRelationType:null,name:null,codeName:null,description:null,index:0,declaration:m.toJSON(),readsValue:null,defaultValue:null,parent:this.toReference()},b=Ae(E,this.project);b.setParent(this,i),b.initChildren(i),i==null||i.add(b,W.Added),b.addSelfToProject(i),a.push(b)}[...this.inputs].forEach(m=>{var E;((E=m.declaration)==null?void 0:E.id)!==re[d.Loop]["object-keys-loop"].inputs.object.id&&(m.remove({ignoreUpstream:!1},i),c.push(m))}),this.inputs.sort((m,E)=>B(m.createdAt).isBefore(B(E.createdAt))?-1:1).forEach((m,E)=>{E!==0&&(m.remove({ignoreUpstream:!1},i),c.push(m))});break}case pt.ObjectValues:{let f=null;if(this.inputs.forEach(m=>{var E;((E=m.declaration)==null?void 0:E.id)===re[d.Loop]["object-values-loop"].inputs.object.id?f=m:(m.remove({ignoreUpstream:!1},i),c.push(m))}),f){if(f.declaration.id!==re[d.Loop]["object-values-loop"].inputs.object.id){const m=this.project.get(re[d.Loop]["object-values-loop"].inputs.object.id);f.setDeclaration(m,i),r.push(f)}}else{const m=this.project.get(re[d.Loop]["object-values-loop"].inputs.object.id),E={dataType:null,id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.InputMap,parentRelationType:null,name:null,codeName:null,description:null,index:0,declaration:m.toJSON(),readsValue:null,defaultValue:null,parent:this.toReference()},b=Ae(E,this.project);b.setParent(this,i),b.initChildren(i),i==null||i.add(b,W.Added),b.addSelfToProject(i),a.push(b)}[...this.inputs].forEach(m=>{var E;((E=m.declaration)==null?void 0:E.id)!==re[d.Loop]["object-values-loop"].inputs.object.id&&(m.remove({ignoreUpstream:!1},i),c.push(m))}),this.inputs.sort((m,E)=>B(m.createdAt).isBefore(B(E.createdAt))?-1:1).forEach((m,E)=>{E!==0&&(m.remove({ignoreUpstream:!1},i),c.push(m))});break}case pt.String:{let f=null;if(this.inputs.forEach(m=>{var E;((E=m.declaration)==null?void 0:E.id)===re[d.Loop]["string-loop"].inputs.string.id?f=m:(m.remove({ignoreUpstream:!1},i),c.push(m))}),f){if(f.declaration.id!==re[d.Loop]["string-loop"].inputs.string.id){const m=this.project.get(re[d.Loop]["string-loop"].inputs.string.id);f.setDeclaration(m,i),r.push(f)}}else{const m=this.project.get(re[d.Loop]["string-loop"].inputs.string.id),E={dataType:null,id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.InputMap,parentRelationType:null,name:null,codeName:null,description:null,index:0,declaration:m.toJSON(),readsValue:null,defaultValue:null,parent:this.toReference()},b=Ae(E,this.project);b.setParent(this,i),b.initChildren(i),i==null||i.add(b,W.Added),b.addSelfToProject(i),a.push(b)}[...this.inputs].forEach(m=>{var E;((E=m.declaration)==null?void 0:E.id)!==re[d.Loop]["string-loop"].inputs.string.id&&(m.remove({ignoreUpstream:!1},i),c.push(m))}),this.inputs.sort((m,E)=>B(m.createdAt).isBefore(B(E.createdAt))?-1:1).forEach((m,E)=>{E!==0&&(m.remove({ignoreUpstream:!1},i),c.push(m))});break}}return i==null||i.attemptAutoclose("sync-input-maps",this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}getValueInputMapDeclarationId(){switch(this.declaration.id){case pt.List:return re[d.Loop]["list-loop"].inputs.list.id;case pt.ObjectKeys:return re[d.Loop]["object-keys-loop"].inputs.object.id;case pt.ObjectValues:return re[d.Loop]["object-values-loop"].inputs.object.id;case pt.String:return re[d.Loop]["string-loop"].inputs.string.id;case pt.Counted:return re[d.Loop]["counted-loop"].inputs.number.id;default:return null}}getCurrentValueBuiltInValueDescriptor(){var r;if(this.declaration.id===pt.ManualFlow||this.declaration.id===pt.Counted)return null;const i=(r=re[d.Loop][this.declaration.id].body.inputs.currentValue)==null?void 0:r.id;return i?this.project.get(i):null}getCurrentIterationNumberBuiltInValueDescriptor(){const i=re[d.Loop][this.declaration.id].body.inputs.iterationNumber.id;return this.project.get(i)}syncBody(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,"sync-body"))){var m;const r=[],a=[],c=[],e=[],f=re[d.Loop][this.declaration.id].body.id,h=this.project.getBuiltIn(f);if(this.body)((m=this.body.implements)==null?void 0:m.id)!==h.id&&(this.body.setImplements(h,i),this.body.setParent(this,i),r.push(this.body));else{const E=td.new(i);E.implements=h.toJSON(),E.name=h.name,E.parent=this.toReference();const b=Ae(E,this.project);b.setParent(this,i),b.initChildren(i),i==null||i.add(b,W.Added),b.addSelfToProject(i),a.push(b)}return i==null||i.attemptAutoclose("sync-body",this.id),{self:this,updated:C(r),added:C(a),removed:C(c),affected:C(e)}}checkIsSynced(){var b,g,_,$,L,j,k,G,H,ie,ee,ue,ae,de,ce,ne,le,Q,oe,Ee,Te,Ve,Le,$e,ke;if((!this.body||!((b=this.body)!=null&&b.dataType)||!((g=this.body)!=null&&g.dataType.entity))&&this.id)return!1;const i=[pt.List,pt.ObjectKeys,pt.ObjectValues,pt.String],r=this.body.inputs.find(Ke=>Ke.implements.find(Je=>Je.id===re[d.Loop][this.declaration.id].body.inputs.iterationNumber.id))||null,a=this.body.inputs.find(Ke=>Ke.implements.find(Je=>{var rt;return Je.id===((rt=re[d.Loop][this.declaration.id].body.inputs.currentValue)==null?void 0:rt.id)}))||null;if(!r||i.includes(this.declaration.id)&&!a)return!1;const c=[...this.breakStatements,...this.continueStatements];if(((L=($=(_=this.body)==null?void 0:_.dataType)==null?void 0:$.entity)==null?void 0:L.id)!==re["primitive-entity"].void.id){if(!this.body.inputs.find(Je=>{var rt,Rt,Et,Xt,tr;return((Rt=(rt=Je.dataType)==null?void 0:rt.entity)==null?void 0:Rt.id)===((tr=(Xt=(Et=this.body)==null?void 0:Et.dataType)==null?void 0:Xt.entity)==null?void 0:tr.id)})||((G=(k=(j=this.body)==null?void 0:j.dataType)==null?void 0:k.entity)==null?void 0:G.type)===d.DefinitionEntity&&(!((ie=(H=this.body)==null?void 0:H.dataType)==null?void 0:ie.entity).properties.every(Rt=>this.outputs.find(Et=>{var Xt;return((Xt=Et.declaration)==null?void 0:Xt.id)===Rt.id}))||!c.every(Rt=>{var nr,Xn;const Et=Rt.outputs.filter(nn=>!nn.deleted),Xt=((Xn=(nr=this.body)==null?void 0:nr.dataType)==null?void 0:Xn.entity).properties.every(nn=>Et.find(ji=>{var ar;return((ar=ji.declaration)==null?void 0:ar.id)===nn.id})),tr=Et.every(nn=>{var ji,ar;return((ar=(ji=this.body)==null?void 0:ji.dataType)==null?void 0:ar.entity).properties.find(Io=>{var Ro;return Io.id===((Ro=nn.declaration)==null?void 0:Ro.id)})});return Xt&&tr})))return!1}else if(this.body.inputs.find(rt=>{var Rt,Et,Xt,tr,nr;return((Et=(Rt=rt.dataType)==null?void 0:Rt.entity)==null?void 0:Et.id)===((nr=(tr=(Xt=this.body)==null?void 0:Xt.dataType)==null?void 0:tr.entity)==null?void 0:nr.id)})||this.outputs.length>0||![...this.breakStatements,...this.continueStatements].every(rt=>rt.outputs.filter(Rt=>!Rt.deleted).length===0))return!1;if([pt.List,pt.Counted,pt.ObjectKeys,pt.ObjectValues,pt.String].includes(this.declaration.id)){if(this.inputs.length!==1)return!1;const Ke=this.inputs[0],Je=this.getValueInputMapDeclarationId();if(((ee=Ke.declaration)==null?void 0:ee.id)!==Je)return!1}else if(this.inputs.length>0)return!1;if((ae=(ue=this.body)==null?void 0:ue.dataType)!=null&&ae.inferred){const Ke=this.getUniqueInputMaps();if(c.every(Et=>!Et.readsValue)&&!Ke.length&&((ne=(ce=(de=this.body)==null?void 0:de.dataType)==null?void 0:ce.entity)==null?void 0:ne.id)!==re["primitive-entity"].void.id)return!1;const rt=c.find(Et=>Et.readsValue),Rt=(oe=(Q=(le=rt==null?void 0:rt.readsValue)==null?void 0:le.getDataType(null))==null?void 0:Q.entity)==null?void 0:oe.id;if(Rt&&Rt!==((Ve=(Te=(Ee=this.body)==null?void 0:Ee.dataType)==null?void 0:Te.entity)==null?void 0:Ve.id))return!1}const f=((ke=($e=(Le=this.body)==null?void 0:Le.dataType)==null?void 0:$e.entity)==null?void 0:ke.properties)||[],h=this.outputs,m=f.every(Ke=>h.find(Je=>{var rt;return((rt=Je.declaration)==null?void 0:rt.id)===Ke.id})),E=h.every(Ke=>f.find(Je=>{var rt;return Je.id===((rt=Ke.declaration)==null?void 0:rt.id)}));return!(!m||!E)}syncFromDataType(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,"sync-from-data-type"))){const r=[],a=[],c=[],e=[],{updated:f,added:h,removed:m}=this.syncOutputDataType(i);r.push(...f),a.push(...h),c.push(...m);const{updated:E,added:b,removed:g}=this.syncBodyArgumentsDeclarations(i);r.push(...E),a.push(...b),c.push(...g);const{updated:_,added:$,removed:L}=this.syncBodyInputIndexes(i);r.push(..._),a.push(...$),c.push(...L);const{updated:j,added:k,removed:G}=this.syncOutputMaps(i);return r.push(...j),a.push(...k),c.push(...G),i==null||i.attemptAutoclose("sync-from-data-type",this.id),{self:this,updated:C(r),added:C(a),removed:C(c),affected:C(e)}}syncChildren(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,"sync-children"))){const r=[],a=[],c=[],e=[],{updated:f,added:h,removed:m}=this.syncBody(i);r.push(...f),a.push(...h),c.push(...m);const{updated:E,added:b,removed:g}=this.syncInputMaps(i);r.push(...E),a.push(...b),c.push(...g);const{updated:_,added:$,removed:L}=this.syncTerminationStatements(i);r.push(..._),a.push(...$),c.push(...L);const{updated:j,added:k,removed:G}=this.syncFromDataType(i);return r.push(...j),a.push(...k),c.push(...G),i==null||i.attemptAutoclose("sync-children",this.id),{self:this,updated:C(r),added:C(a),removed:C(c),affected:C(e)}}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)}addValueReader(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.AddValueReader))){var e,f,h,m;if(!this.checkCanEditFromScopeOwnerWithSideEffects(this,w.AddValueReader,r))return this;(i==null?void 0:i.id)===this.id&&(r==null||r.event({id:`${w.SetValueWriter}-${this.id}`,action:w.SetValueWriter,owner:this,errorReason:Be.CannotValueWriteItself,rootAction:((e=r==null?void 0:r.self)==null?void 0:e.id)===this.id&&(r==null?void 0:r.autoCloseActionName)===w.SetValueWriter}));const a=i.type===d.InputMap&&i.parent.type===d.VariableInstance&&((f=i.declaration)==null?void 0:f.type)===d.Property&&((h=i.declaration)==null?void 0:h.constant),c=i.type===d.VariableInstance&&((m=i.declaration)==null?void 0:m.constant);return(a||c)&&i?(r==null||r.event({id:`${w.SetValueWriter}-${this.id}--${i.id}`,action:w.SetValueWriter,owner:i,counterpart:this,errorReason:Be.ValueReadingOverridesConstantVariable,rootAction:!1}),r==null||r.attemptAutoclose(w.AddValueReader,this.id),this):this.writesValues.includes(i)?(r==null||r.attemptAutoclose(w.AddValueReader,this.id),this):(this.writesValues.push(i),r==null||r.add(this,W.Affected),this)}setDataType(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.SetDataType))){if(!this.checkCanEdit(this,r))return z.Logger.warn(`[setDataType] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.SetDataType,this.id),this;const a=this.dataType;return(a==null?void 0:a.id)!==(i==null?void 0:i.id)&&(a==null||a.remove({ignoreUpstream:!0},r),this.dataType=i,this.subscribeToDependencies(),r==null||r.add(this,W.Affected)),r==null||r.attemptAutoclose(w.SetDataType,this.id),this}removeValueReader(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.RemoveValueReader))){return this.checkCanEditFromScopeOwnerWithSideEffects(this,w.RemoveValueReader,r)?this.writesValues.includes(i)?(this.writesValues=this.writesValues.filter(a=>a.id!==i.id),r==null||r.add(this,W.Affected),this):(r==null||r.attemptAutoclose(w.RemoveValueReader,this.id),this):this}removeDataType(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.RemoveDataType))){return this.checkCanEdit(this,i)?(this.dataType&&(this.dataType.remove({ignoreUpstream:!0},i),i==null||i.add(this,W.Affected),this.dataType=null),i==null||i.attemptAutoclose(w.RemoveDataType,this.id),this):(z.Logger.warn(`[removeDataType] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(w.RemoveDataType,this.id),this)}getDataType(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,"get-data-type"))){var r;return i==null||i.attemptAutoclose("get-data-type",this.id),this.dataType||((r=this.body)==null?void 0:r.dataType)||null}};R(Jt,"repository",{APICreate:async(i,...r)=>i,APIUpdate:async(i,...r)=>i,APIDelete:async(i,...r)=>i,APIClone:async(i,...r)=>{},APILoad:async(i,...r)=>null,APILoadVersion:async(i,r,...a)=>null}),R(Jt,"type",d.Loop),R(Jt,"USER_MANAGED_PARENT_TYPES",[...vr,d.Project]),R(Jt,"PARENT_TYPES",[...ki.USER_MANAGED_PARENT_TYPES]),R(Jt,"CURRENT_ITERATION_NUMBER_ARG_NAME","Current iteration number"),R(Jt,"CURRENT_VALUE_ARG_NAME","Current value"),R(Jt,"MUTABLE_BASE_PROPERTIES",["catchesError"]),R(Jt,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),R(Jt,"BASE_PROPERTIES",[...Jt.MUTABLE_BASE_PROPERTIES,...Jt.INMUTABLE_BASE_PROPERTIES]),R(Jt,"MUTABLE_META_PROPERTIES",[...Jt.MUTABLE_BASE_PROPERTIES,"x","y"]),R(Jt,"INMUTABLE_META_PROPERTIES",[...Jt.INMUTABLE_BASE_PROPERTIES]),R(Jt,"META_PROPERTIES",[...Jt.MUTABLE_META_PROPERTIES,...Jt.INMUTABLE_META_PROPERTIES]),R(Jt,"MUTABLE_UPSTREAM_PROPERTIES",["calledBySuccess","calledByError","calledByEntry"]),R(Jt,"INMUTABLE_UPSTREAM_PROPERTIES",["parent","declaration","dataType"]),R(Jt,"UPSTREAM_PROPERTIES",[...Jt.MUTABLE_UPSTREAM_PROPERTIES,...Jt.INMUTABLE_UPSTREAM_PROPERTIES]),R(Jt,"MUTABLE_DOWNSTREAM_PROPERTIES",["body","inputs","outputs","successCalls","errorCalls","error","breakStatements","continueStatements"]),R(Jt,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),R(Jt,"DOWNSTREAM_PROPERTIES",[...Jt.MUTABLE_DOWNSTREAM_PROPERTIES,...Jt.INMUTABLE_DOWNSTREAM_PROPERTIES]),R(Jt,"PROPERTIES",[...Jt.META_PROPERTIES,...Jt.UPSTREAM_PROPERTIES,...Jt.DOWNSTREAM_PROPERTIES]);let fp=Jt;async function E_e(l,p={}){const i=z.YieldTracker.from(p),r=da(l),a=ua(l),c=[...r,...a],e=kt(l.errors,c);await i.tick();for(const f of l.inputs)await f.validateAsync({tracker:i});return e}function b_e(l){l.inputs.forEach(a=>a.validate());const p=da(l),i=ua(l),r=[...p,...i];return kt(l.errors,r)}const $Ai=Object.freeze(Object.defineProperty({__proto__:null,validate:b_e,validateAsync:E_e},Symbol.toStringTag,{value:"Module"}));var A_e=(l=>(l.Parent="parent",l))(A_e||{});const xi=class xi extends Qr{constructor(i,r){super(i);R(this,"initialData");R(this,"id");R(this,"x");R(this,"y");R(this,"type",d.Condition);R(this,"index",null);R(this,"successCalls",[]);R(this,"errorCalls",[]);R(this,"declaration");R(this,"inputs",[]);R(this,"calledBySuccess",[]);R(this,"calledByError",[]);R(this,"calledByEntry",[]);R(this,"andChildrenGroup",null);R(this,"orChildrenGroup",null);R(this,"project");R(this,"errors",[]);R(this,"parent");R(this,"detachedDependents",{});R(this,"knownVersions",null);R(this,"activeVersion",!1);R(this,"initialized",!1);R(this,"startedInitialization",!1);this.initialData=i,this.project=r,this.id=i.id,this.x=i.x,this.y=i.y,this.index=i.index??null}static new(i=null){return{id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:(i==null?void 0:i.author)||N.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.Condition,declaration:null,index:null,inputs:[],parent:null,andChildrenGroup:null,orChildrenGroup:null,calledByEntry:[],calledBySuccess:[],calledByError:[],errorCalls:[],successCalls:[],x:0,y:0}}static fromGenerationTarget(i,r){var g,_;let a=r;if(i.parent){const $=X(i.parent);a=r.get($)}const c=(i.calledByEntry||[]).map($=>{const L=X($);return r.get(L)}),e=(i.calledBySuccess||[]).map($=>{const L=X($);return r.get(L)}),f=(i.calledByError||[]).map($=>{const L=X($);return r.get(L)});let h;if(i.declaration){const $=X(i.declaration);h=r.get($)}let m=null;a&&a.type===d.Condition&&(((g=a.declaration)==null?void 0:g.id)===Ir.Or?m=(a.orChildrenGroup||[]).length:((_=a.declaration)==null?void 0:_.id)===Ir.And&&(m=(a.andChildrenGroup||[]).length));const E={id:i.id,version:N.UUID.uuid(),createdAt:B().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.Condition,index:m,declaration:h.toJSON(),andChildrenGroup:[],orChildrenGroup:[],calledByEntry:c.map($=>$.toReference()),calledBySuccess:e.map($=>$.toReference()),calledByError:f.map($=>$.toReference()),errorCalls:[],successCalls:[],inputs:[],x:0,y:0,parent:a.toReference()},b=Ae(E,r);return b.hydrateAncestors(),b.setParent(a,null),b}static validateGenerationTarget(i,r){let a=JSON.parse(JSON.stringify(i));const c=[],e=[],f=wn(a,{parent:{list:!1,types:[...vr,d.Project],optional:!0}},r);c.push(...f.explanations),a=f.modifiedData;const h=Zr(a);if(e.push(...f.errors,...h.errors),c.push(...h.explanations),!i.declaration)e.push(new Re({id:`${i.id}--${we.InvalidObjectStructure}`,code:we.InvalidObjectStructure,severity:me.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 '${d.Condition}' entities.`})),c.push({id:Ji.AllConditionActionDescriptors,message:_g(r)});else if(!r.get(i.declaration))e.push(new Re({id:`${i.id}--${he.ReferencedEntityNotFound}`,code:he.ReferencedEntityNotFound,severity:me.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 '${d.Condition}' entities.`})),c.push({id:Ji.AllConditionActionDescriptors,message:_g(r)});else{const E=Xje(i.declaration,r);e.push(...E.errors),c.push(...E.explanations)}return{errors:e,explanations:c,modifiedData:a}}validateGeneratedUpdate(i){const r=[],a=[];return i.parent&&r.push(new Re({id:`${this.id}--${he.InvalidParentUpdate}`,code:he.InvalidParentUpdate,severity:me.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.
|
|
48
|
-
If an entity is called by another, they must be in the same scope, which means they have the same parent.`})),{errors:r,explanations:a,modifiedData:i}}subscribeDependents(i){return i.forEach(r=>{this.detachedDependents[r.entity.id]||(this.detachedDependents[r.entity.id]=r)}),this}unsubscribeDependents(i){return i.forEach(r=>{this.detachedDependents[r.entity.id]&&delete this.detachedDependents[r.entity.id]}),this}syncDependents(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,"sync-dependents"))){const r=[],a=[],c=[],e=[];return Object.values(this.detachedDependents).forEach(f=>{const h=f.entity.afterAllChildrenInitialized(i);r.push(...h.updated),a.push(...h.added),c.push(...h.removed),e.push(...h.affected)}),i==null||i.attemptAutoclose("sync-dependents",this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}onDetachedDependencyRemoved(i,r,a){const c=[],e=[],f=[],h=[];if(r==="parent"){const{updated:m,added:E,removed:b}=this.remove({ignoreUpstream:!1},a);c.push(...m),e.push(...E),f.push(...b)}return{updated:C(c),added:C(e),removed:C(f),affected:C(h),self:this}}onDetachedDependencyRestored(i,r,a){const c=[],e=[],f=[],h=[];if(r==="parent"){const{updated:m,added:E,removed:b}=this.restore({},a);c.push(...m),e.push(...E),f.push(...b)}return{updated:C(c),added:C(e),removed:C(f),affected:C(h),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&&!B(i).isValid())throw new Error(`The shared timestamp '${i}' is not a valid ISO 8601 date string.`);return i&&B(i).isSame(B(this.createdAt))?this:(this.previousVersion=this.version,this.version=N.UUID.uuid(),this.createdAt=B(i).toISOString()||B().toISOString(),this)}captureVersion(){var r;const i=((r=this.knownVersions)==null?void 0:r.get(this.version))||new xi(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 r=[],a=[],c=[],e=[];if(this.parent){this.parent.increaseVersion(i);const f=this.parent.recursiveCaptureUpstreamVersions(i);r.push(this.parent,...f.updated),a.push(...f.added),c.push(...f.removed)}return{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}async restoreVersion(i){var h;const r=[],a=[],c=[],e=[];if(this.version===i)return{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this};if(!this.knownVersions){const m=new Map;for(const[E,b]of this.knownVersions||new Map){if(m.set(E,b),b.activeVersion=!1,b.knownVersions)for(const[g,_]of b.knownVersions)m.set(g,_);b.knownVersions=null}}let f=(h=this.knownVersions)==null?void 0:h.get(i);if(!f){const m=await this.APILoadVersion({},i);if(!m)throw new Error(`Version with id '${i}' for entity with id '${this.id}' not found.`);f=new xi(m,this.project)}return this.metaSync(f.toShallowJSON(),null),this.previousVersion=f.previousVersion,this.version=f.version,this.createdAt=f.createdAt,this.author=f.author,this.deleted=f.deleted,this.inputs=f.inputs,this.declaration=f.declaration,this.andChildrenGroup=f.andChildrenGroup,this.orChildrenGroup=f.orChildrenGroup,this.successCalls=f.successCalls,this.errorCalls=f.errorCalls,this.calledBySuccess=f.calledBySuccess,this.calledByError=f.calledByError,this.calledByEntry=f.calledByEntry,this.parent=f.parent,{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}updateWithShallowTransfer(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.UpdateWithShallowTransfer))){var a,c;if(!this.checkCanEdit(this,r))return z.Logger.warn(`[updateWithShallowTransfer] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.UpdateWithShallowTransfer,this.id),this;if(this.metaSync(i,r),this.version=i.version,this.createdAt=i.createdAt,this.author=i.author,this.deleted=i.deleted,this.previousVersion=i.previousVersion,i.parent){const e=X(i.parent),f=this.project.get(e),h=this.parent;if(h&&h.id!==(f==null?void 0:f.id)&&this.removeFromParent(r),f)this.setParent(f,r),this.addSelfToProject(r);else throw r==null||r.attemptAutoclose(w.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 r==null||r.attemptAutoclose(w.UpdateWithShallowTransfer,this.id),new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(i.declaration){const e=X(i.declaration),f=this.project.get(e);f&&this.setDeclaration(f)}return(a=i.andChildrenGroup)==null||a.forEach(e=>{const f=X(e),h=this.project.get(f);h&&(this.addToAndGroup(h,r),h.setParent(this,r))}),[...this.andChildrenGroup||[]].forEach(e=>{var h;((h=i.andChildrenGroup)==null?void 0:h.find(m=>X(m)===e.id))||(this.removeChildGroup(e,r),e.removeFromParent(r))}),(c=i.orChildrenGroup)==null||c.forEach(e=>{const f=X(e),h=this.project.get(f);h&&(this.addToOrGroup(h,r),h.setParent(this,r))}),[...this.orChildrenGroup||[]].forEach(e=>{var h;((h=i.orChildrenGroup)==null?void 0:h.find(m=>X(m)===e.id))||(this.removeChildGroup(e,r),e.removeFromParent(r))}),i.calledByEntry.forEach(e=>{const f=X(e),h=this.project.get(f);h&&(this.addEntryCaller(h,r),h.addCall(this,r))}),[...this.calledByEntry].forEach(e=>{i.calledByEntry.find(h=>X(h)===e.id)||(this.removeCaller(e,r),e.removeCall(this,r))}),i.calledBySuccess.forEach(e=>{const f=X(e),h=this.project.get(f);h&&(this.addSuccessCaller(h,r),h.addSuccessCall(this,r))}),[...this.calledBySuccess].forEach(e=>{i.calledBySuccess.find(h=>X(h)===e.id)||(this.removeCaller(e,r),e.removeCall(this,r))}),i.calledByError.forEach(e=>{const f=X(e),h=this.project.get(f);h&&(this.addErrorCaller(h,r),h.addErrorCall(this,r))}),[...this.calledByError].forEach(e=>{i.calledByError.find(h=>X(h)===e.id)||(this.removeCaller(e,r),e.removeCall(this,r))}),this.captureVersion(),this.subscribeToDependencies(),r==null||r.attemptAutoclose(w.UpdateWithShallowTransfer,this.id),this}updateWithGenerationTarget(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.UpdateWithGenerationTarget))){var a,c,e;if(!this.checkCanEdit(this,r))return z.Logger.warn(`[updateWithGenerationTarget] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.UpdateWithGenerationTarget,this.id),this;if(this.metaSync(i,r),i.parent){const f=X(i.parent),h=this.project.get(f),m=this.parent;if(m&&m.id!==(h==null?void 0:h.id)&&this.removeFromParent(r),h)this.setParent(h,r),this.addSelfToProject(r);else throw r==null||r.attemptAutoclose(w.UpdateWithGenerationTarget,this.id),new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${f}' that isn't found in the project`)}if(i.declaration){const f=X(i.declaration),h=this.project.get(f);if(h)this.setDeclaration(h);else throw new Error(`${this.type} with id '${this.id}' has a 'declaration' reference '${f}' that isn't found in the project`)}return(a=i.calledByEntry)==null||a.forEach(f=>{const h=X(f),m=this.project.get(h);if(m)this.addEntryCaller(m,r),m.addCall(this,r);else throw new Error(`${this.type} with id '${this.id}' has a 'calledByEntry' reference '${h}' that isn't found in the project`)}),i.calledByEntry&&[...this.calledByEntry].forEach(f=>{var m;((m=i.calledByEntry)==null?void 0:m.find(E=>X(E)===f.id))||(this.removeCaller(f,r),f.removeCall(this,r))}),(c=i.calledBySuccess)==null||c.forEach(f=>{const h=X(f),m=this.project.get(h);if(m)this.addSuccessCaller(m,r),m.addSuccessCall(this,r);else throw new Error(`${this.type} with id '${this.id}' has a 'calledBySuccess' reference '${h}' that isn't found in the project`)}),i.calledBySuccess&&[...this.calledBySuccess].forEach(f=>{var m;((m=i.calledBySuccess)==null?void 0:m.find(E=>X(E)===f.id))||(this.removeCaller(f,r),f.removeCall(this,r))}),(e=i.calledByError)==null||e.forEach(f=>{const h=X(f),m=this.project.get(h);if(m)this.addErrorCaller(m,r),m.addErrorCall(this,r);else throw new Error(`${this.type} with id '${this.id}' has a 'calledByError' reference '${h}' that isn't found in the project`)}),i.calledByError&&[...this.calledByError].forEach(f=>{var m;((m=i.calledByError)==null?void 0:m.find(E=>X(E)===f.id))||(this.removeCaller(f,r),f.removeCall(this,r))}),this.captureVersion(),this.subscribeToDependencies(),r==null||r.attemptAutoclose(w.UpdateWithGenerationTarget,this.id),this}hydrateAncestors(){const i=[],r=[],a=[],c=[];if(this.initialData.parent){const e=X(this.initialData.parent),f=this.project.get(e);if(f)this.setParent(f,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=X(this.initialData.declaration),f=this.project.get(e);f&&(this.setDeclaration(f),i.push(f))}return this.initialData.calledByEntry.forEach(e=>{const f=X(e),h=this.project.get(f);h&&this.addEntryCaller(h,null)}),this.initialData.calledBySuccess.forEach(e=>{const f=X(e),h=this.project.get(f);h&&this.addSuccessCaller(h,null)}),this.initialData.calledByError.forEach(e=>{const f=X(e),h=this.project.get(f);h&&this.addErrorCaller(h,null)}),{updated:C(i),added:C(r),removed:C(a),affected:C(c),self:this}}afterAllChildrenInitialized(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.AfterAllChildrenInitialized))){var E,b;if(!this.checkCanEdit(this,i))return z.Logger.warn(`[afterAllChildrenInitialized] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(w.AfterAllChildrenInitialized,this.id),{updated:[],added:[],removed:[],affected:[],self:this};const r=[],a=[],c=[],e=[];if(this.initialized=!0,this.parent.type===d.Condition){let g=this.index||0;const _=(this.parent.declaration.id===Ir.And?this.parent.andChildrenGroup||[]:this.parent.orChildrenGroup||[]).filter(L=>!L.deleted&&L.id!==this.id);_.length&&(g>_.length+1?g=_.length:g<0&&(g=0)),_.find(L=>(L.index||0)===g&&!L.deleted)&&_.filter(L=>(L.index||0)>=g&&!L.deleted).forEach(L=>{L.metaSync({index:(L.index||0)+1},i),i==null||i.add(L,W.Updated),r.push(L)}),this.metaSync({index:g},i)}(E=this.andChildrenGroup)!=null&&E.length&&this.andChildrenGroup.sort((g,_)=>(g.index||0)-(_.index||0)),(b=this.orChildrenGroup)!=null&&b.length&&this.orChildrenGroup.sort((g,_)=>(g.index||0)-(_.index||0)),this.inputs.sort((g,_)=>{var $,L;return(g.index??(($=g.declaration)==null?void 0:$.index))-(_.index??((L=_.declaration)==null?void 0:L.index))});const{updated:f,added:h,removed:m}=this.syncInputs(i);return r.push(...f),a.push(...h),c.push(...m),this.captureVersion(),i==null||i.attemptAutoclose(w.AfterAllChildrenInitialized,this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}addSelfToProject(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,"add-self-to-project"))){const r=[this],a=[],c=[],e=[];return this.parent===this.project?this.project.addCondition(this):this.parent.type===d.Condition&&(this.parent.declaration.id===Ir.And?this.parent.addToAndGroup(this,i):this.parent.declaration.id===Ir.Or&&this.parent.addToOrGroup(this,i)),this.successCalls.forEach(f=>{f.addSuccessCaller(this,i),r.push(f)}),this.errorCalls.forEach(f=>{f.addErrorCaller(this,i),r.push(f)}),this.calledByEntry.forEach(f=>{f.addCall(this,i),r.push(f)}),this.calledBySuccess.forEach(f=>{f.addSuccessCall(this,i),r.push(f)}),this.calledByError.forEach(f=>{f.addErrorCall(this,i),r.push(f)}),this.subscribe(),this.subscribeToDependencies(),i==null||i.attemptAutoclose("add-self-to-project",this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}get calledBy(){return[...this.calledByEntry,...this.calledBySuccess,...this.calledByError]}removeInput(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.RemoveInput))){if(!this.checkCanEdit(this,r))return z.Logger.warn(`[removeInput] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.RemoveInput,this.id),this;const a=this.inputs.findIndex(c=>c.id===i.id);return a>-1&&(this.inputs.splice(a,1),r&&(r==null||r.add(this,W.Affected))),r==null||r.attemptAutoclose(w.RemoveInput,this.id),this}addInput(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.AddInput))){return this.checkCanEdit(this,r)?this.inputs.includes(i)?(r==null||r.attemptAutoclose(w.AddInput,this.id),this):(this.inputs.push(i),r==null||r.add(this,W.Affected),r==null||r.attemptAutoclose(w.AddInput,this.id),this):(z.Logger.warn(`[addInput] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.AddInput,this.id),this)}addOutput(i){return this}removeOutput(i){return this}addSuccessCaller(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.AddSuccessCaller)),a=!1){var c;return this.checkCanEditWithCounterpartAndSideEffects(this,i,w.AddSuccessCaller,r)?((i==null?void 0:i.id)===this.id&&(r==null||r.event({id:`${w.AddSuccessCaller}-${this.id}--${Be.CannotSuccessCallItself}`,action:w.AddSuccessCaller,owner:this,errorReason:Be.CannotSuccessCallItself,rootAction:((c=r==null?void 0:r.self)==null?void 0:c.id)===this.id&&(r==null?void 0:r.autoCloseActionName)===w.AddSuccessCaller})),this.calledBySuccess.find(e=>e.id===i.id)||(this.calledBySuccess.push(i),r==null||r.add(this,W.Updated),a&&Tt(this,r)),r==null||r.attemptAutoclose(w.AddSuccessCaller,this.id),this):this}addErrorCaller(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.AddErrorCaller)),a=!1){var c;return this.checkCanEditWithCounterpartAndSideEffects(this,i,w.AddErrorCaller,r)?((i==null?void 0:i.id)===this.id&&(r==null||r.event({id:`${w.AddErrorCaller}-${this.id}--${Be.CannotErrorCallItself}`,action:w.AddErrorCaller,owner:this,errorReason:Be.CannotErrorCallItself,rootAction:((c=r==null?void 0:r.self)==null?void 0:c.id)===this.id&&(r==null?void 0:r.autoCloseActionName)===w.AddErrorCaller})),this.calledByError.find(e=>e.id===i.id)||(this.calledByError.push(i),r==null||r.add(this,W.Updated),a&&Tt(this,r)),r==null||r.attemptAutoclose(w.AddErrorCaller,this.id),this):this}addEntryCaller(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.AddEntryCaller)),a=!1){var c;return this.checkCanEditWithCounterpartAndSideEffects(this,i,w.AddEntryCaller,r)?((i==null?void 0:i.id)===this.id&&(r==null||r.event({id:`${w.AddEntryCaller}-${this.id}--${Be.CannotEntryCallItself}`,action:w.AddEntryCaller,owner:this,errorReason:Be.CannotEntryCallItself,rootAction:((c=r==null?void 0:r.self)==null?void 0:c.id)===this.id&&(r==null?void 0:r.autoCloseActionName)===w.AddEntryCaller})),this.calledByEntry.find(e=>e.id===i.id)||(this.calledByEntry.push(i),r==null||r.add(this,W.Updated),a&&Tt(this,r)),r==null||r.attemptAutoclose(w.AddEntryCaller,this.id),this):this}addErrorCall(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.AddErrorCall)),a=!1){var c;return this.checkCanEditWithCounterpartAndSideEffects(this,i,w.AddErrorCall,r)?((i==null?void 0:i.id)===this.id&&(r==null||r.event({id:`${w.AddErrorCaller}-${this.id}--${Be.CannotErrorCallItself}`,action:w.AddErrorCaller,owner:this,errorReason:Be.CannotErrorCallItself,rootAction:((c=r==null?void 0:r.self)==null?void 0:c.id)===this.id&&(r==null?void 0:r.autoCloseActionName)===w.AddErrorCaller})),this.errorCalls.find(e=>e.id===i.id)||(this.errorCalls.push(i),a&&Tt(this,r),r==null||r.add(this,W.Affected)),r==null||r.attemptAutoclose(w.AddErrorCall,this.id),this):this}addSuccessCall(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.AddSuccessCall)),a=!1){var c;return this.checkCanEditWithCounterpartAndSideEffects(this,i,w.AddSuccessCall,r)?((i==null?void 0:i.id)===this.id&&(r==null||r.event({id:`${w.AddSuccessCaller}-${this.id}`,action:w.AddSuccessCaller,owner:this,errorReason:Be.CannotSuccessCallItself,rootAction:((c=r==null?void 0:r.self)==null?void 0:c.id)===this.id&&(r==null?void 0:r.autoCloseActionName)===w.AddSuccessCaller})),this.successCalls.find(e=>e.id===i.id)||(this.successCalls.push(i),a&&Tt(this,r),r==null||r.add(this,W.Affected)),r==null||r.attemptAutoclose(w.AddSuccessCall,this.id),this):this}removeCall(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.RemoveCall)),a=!1){if(!this.checkCanEditWithCounterpartAndSideEffects(this,i,w.RemoveCall,r))return this;const c=this.successCalls.findIndex(f=>f.id===i.id);c>-1&&(this.successCalls.splice(c,1),r==null||r.add(this,W.Affected));const e=this.errorCalls.findIndex(f=>f.id===i.id);return e>-1&&(this.errorCalls.splice(e,1),r==null||r.add(this,W.Affected)),a&&Tt(this,r),r==null||r.attemptAutoclose(w.RemoveCall,this.id),this}removeCaller(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.RemoveCaller)),a=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,i,w.RemoveCaller,r)?(this.calledBySuccess=this.calledBySuccess.filter(c=>c.id!==i.id?!0:(r==null||r.add(this,W.Updated),r==null||r.add(c,W.Affected),!1)),this.calledByError=this.calledByError.filter(c=>c.id!==i.id?!0:(r==null||r.add(this,W.Updated),r==null||r.add(c,W.Affected),!1)),this.calledByEntry=this.calledByEntry.filter(c=>c.id!==i.id?!0:(r==null||r.add(this,W.Updated),r==null||r.add(c,W.Affected),!1)),a&&Tt(this,r),r==null||r.attemptAutoclose(w.RemoveCaller,this.id),this):this}setParent(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.SetParent))){var a;return this.checkCanEditWithCounterpartAndSideEffects(this,i,w.SetParent,r)?(((a=this.parent)==null?void 0:a.id)!==(i==null?void 0:i.id)&&(this.parent=i,r&&(r==null||r.add(this,W.Updated))),r==null||r.attemptAutoclose(w.SetParent,this.id),this):this}removeChildGroup(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.RemoveChildGroup))){if(!this.checkCanEdit(this,r))return z.Logger.warn(`[removeChildGroup] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.RemoveChildGroup,this.id),this;if(this.andChildrenGroup){const a=this.andChildrenGroup.findIndex(c=>c.id===i.id);a!==-1&&(this.andChildrenGroup.splice(a,1),r==null||r.add(this,W.Updated))}if(this.orChildrenGroup){const a=this.orChildrenGroup.findIndex(c=>c.id===i.id);a!==-1&&(this.orChildrenGroup.splice(a,1),r==null||r.add(this,W.Updated))}return r==null||r.attemptAutoclose(w.RemoveChildGroup,this.id),this}setDeclaration(i){return this.declaration=i,this}initChildren(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,"init-children"))){return this.initialized||this.startedInitialization?this:(this.startedInitialization=!0,this.declaration=Ae(this.initialData.declaration,this.project),this.initialData.andChildrenGroup&&(this.andChildrenGroup=this.initialData.andChildrenGroup.map(r=>{const a=Ae(r,this.project);return a.setParent(this,null),a.initChildren(i),a})),this.initialData.orChildrenGroup&&(this.orChildrenGroup=this.initialData.orChildrenGroup.map(r=>{const a=Ae(r,this.project);return a.setParent(this,null),a.initChildren(i),a})),this.successCalls=this.initialData.successCalls.map(r=>{const a=Ae(r,this.project);if(a.addSuccessCaller(this,null),[d.BreakStatement,d.ContinueStatement].includes(a.type))a.setParent(this.parent.parent,null),a.initChildren(i);else if(a.type===d.ReturnStatement){const c=fn(this,this.project);a.setParent(c,null),a.initChildren(i)}else a.type!==d.InternalCall&&(a.setParent(this.parent,null),a.initChildren(i));return a}),this.errorCalls=this.initialData.errorCalls.map(r=>{const a=Ae(r,this.project);if(a.addErrorCaller(this,null),[d.BreakStatement,d.ContinueStatement].includes(a.type))a.setParent(this.parent.parent,null),a.initChildren(i);else if(a.type===d.ReturnStatement){const c=fn(this,this.project);a.setParent(c,null),a.initChildren(i)}else a.type!==d.InternalCall&&(a.setParent(this.parent,null),a.initChildren(i));return a}),this.inputs=this.initialData.inputs.map(r=>{const a=Ae(r,this.project);return a.setParent(this,null),a.initChildren(i),a}),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,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,"meta-sync"))){const a=Wr(this,i,r),c=Hr(this,a),e=this.toMeta();return this.x=a.x!==void 0?a.x:e.x,this.y=a.y!==void 0?a.y:e.y,this.index=a.index!==void 0?a.index:e.index,super.baseMetaSync(a,this,r),a.deleted===!0&&!e.deleted?r==null||r.add(this,W.Removed):a.deleted===!1&&e.deleted?r==null||r.add(this,W.Added):c&&(r==null||r.add(this,W.Updated)),r==null||r.attemptAutoclose("meta-sync",this.id),this}async APILoad(i=Se,...r){return await xi.repository.APILoad(this.id,...r),this}async APICreate(i=Se,...r){return await xi.repository.APICreate(this.toShallowJSON(),...r),this}async APIUpdate(i=Se,...r){return await xi.repository.APIUpdate(this.toShallowJSON(),...r),this}async APIDelete(i=Se,...r){return await xi.repository.APIDelete(this.toShallowJSON(),...r),this}async APIClone(i=Se,...r){return await xi.repository.APIClone(this.id,...r),this}async APILoadVersion(i=Se,r,...a){return await xi.repository.APILoadVersion(this.id,r,...a)}removeFromParent(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.RemoveFromParent))){var f;if(!this.checkCanEdit(this,i))return z.Logger.warn(`[removeFromParent] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(w.RemoveFromParent,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const r=[],a=[],c=[],e=[];return this.parent.type===d.Project?(this.parent.removeCondition(this),e.push(this.parent)):((f=this.parent)==null?void 0:f.type)===d.Condition?this.parent.removeChildGroup(this):this.parent.detachedChildren.includes(this)&&this.parent.unsubscribeDetachedChild(this),i==null||i.attemptAutoclose(w.RemoveFromParent,this.id),{added:C(c),updated:C(r),removed:C(a),affected:C(e),self:this}}remove({ignoreUpstream:i}={ignoreUpstream:!1},r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.RemoveEntity))){var h;if(!this.checkCanDelete(this,r))return z.Logger.warn(`[remove] User is not allowed to delete or edit this ${this.type} entity with id: ${this.id}`),r==null||r.event({id:`${w.RemoveEntity}-${this.id}--${Be.ActionOwnerEntityNonDeletable}`,action:w.RemoveEntity,owner:this,errorReason:Be.ActionOwnerEntityNonDeletable,rootAction:((h=r==null?void 0:r.self)==null?void 0:h.id)===this.id&&(r==null?void 0:r.autoCloseActionName)===w.RemoveEntity}),r==null||r.attemptAutoclose(w.RemoveEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const a=[],c=[],e=[],f=[];if(r!=null&&r.hasRemoved(this.id))return r==null||r.attemptAutoclose(w.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},r),Object.values(this.detachedDependents).forEach(m=>{const{updated:E,removed:b,added:g}=m.entity.onDetachedDependencyRemoved(this,m.field,r);a.push(...E),c.push(...b),e.push(...g)}),this.andChildrenGroup&&this.andChildrenGroup.forEach(m=>{const{removed:E,updated:b}=m.remove({ignoreUpstream:!0},r);c.push(...E),a.push(...b)}),this.orChildrenGroup&&this.orChildrenGroup.forEach(m=>{const{removed:E,updated:b}=m.remove({ignoreUpstream:!0},r);c.push(...E),a.push(...b)}),this.inputs.forEach(m=>{const{updated:E,removed:b}=m.remove({ignoreUpstream:!0},r);a.push(...E),c.push(...b)}),this.successCalls.forEach(m=>{a.push(m),m.removeCaller(this,r)}),this.errorCalls.forEach(m=>{a.push(m),m.removeCaller(this,r)}),!i){const m=this.removeFromParent(r);e.push(...m.added),a.push(...m.updated),c.push(...m.removed),f.push(...m.affected),this.calledBy.forEach(E=>{a.push(E),E.removeCall(this,r)})}return r==null||r.attemptAutoclose(w.RemoveEntity,this.id),{added:C(e),updated:C(a),removed:C(c),affected:C(f),self:this}}restore({}={},i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.RestoreEntity))){if(!this.checkCanEdit(this,i))return z.Logger.warn(`[restore] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(w.RestoreEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const r=[],a=[],c=[],e=[];return i!=null&&i.hasAdded(this.id)?(i==null||i.attemptAutoclose(w.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(f=>{const{updated:h,removed:m,added:E}=f.entity.onDetachedDependencyRestored(this,f.field,i);a.push(...h),c.push(...m),r.push(...E)}),this.andChildrenGroup&&this.andChildrenGroup.forEach(f=>{const{updated:h,added:m}=f.restore({},i);a.push(...h),r.push(...m)}),this.orChildrenGroup&&this.orChildrenGroup.forEach(f=>{const{updated:h,added:m}=f.restore({},i);a.push(...h),r.push(...m)}),this.inputs.forEach(f=>{const{updated:h}=f.restore({},i);a.push(...h)}),this.successCalls.forEach(f=>{a.push(f),f.addSuccessCaller(this,i)}),this.errorCalls.forEach(f=>{a.push(f),f.addErrorCaller(this,i)}),this.calledBySuccess.forEach(f=>{a.push(f),f.addSuccessCall(this,i)}),this.calledByError.forEach(f=>{a.push(f),f.addErrorCall(this,i)}),this.calledByEntry.forEach(f=>{a.push(f),f.addCall(this,i)}),this.parent.type===d.Project&&this.project.addCondition(this),i==null||i.attemptAutoclose(w.RestoreEntity,this.id),{added:C(r),updated:C(a),removed:C(c),affected:C(e),self:this})}toFlat(i=new Set){var a,c;return i.has(this.id)?[]:(i.add(this.id),[this,...((a=this.andChildrenGroup)==null?void 0:a.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 a,c;return i.has(this.id)?[]:(i.add(this.id),[this.id,...((a=this.andChildrenGroup)==null?void 0:a.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 r,a;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:((r=this.andChildrenGroup)==null?void 0:r.map(c=>c.toJSON(i)))||null,orChildrenGroup:((a=this.orChildrenGroup)==null?void 0:a.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=nt){var a,c,e,f,h,m,E;let r;return(a=i.seenEntityMaps)!=null&&a.has(this.id)?r=i.seenEntityMaps.get(this.id):(r=i.newId||Xr(this,this.project,i.uuidStrategy),i.seenEntityMaps&&i.seenEntityMaps.set(this.id,r)),(c=i.seenEntities)!=null&&c.has(r)||(e=i.seenEntities)!=null&&e.has(this.id)?this.toReference({seenEntityMaps:i.seenEntityMaps}):((f=i.seenEntities)==null||f.add(r),(h=i.seenEntities)==null||h.add(this.id),{id:r,version:N.UUID.uuid(),createdAt:i.timestamp||B().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:((m=this.andChildrenGroup)==null?void 0:m.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=nt){var a;let r=this.id;return(a=i.seenEntityMaps)!=null&&a.has(this.id)&&(r=i.seenEntityMaps.get(this.id)),{id:r+"--"+N.UUID.uuid()+"--ref",type:d.GenericReference,entityId:r,version:this.version,entityType:this.type}}toShallowJSON(i=nt){var a,c,e;let r=this.id;return(a=i.seenEntityMaps)!=null&&a.has(this.id)&&(r=i.seenEntityMaps.get(this.id)),{id:r,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(f=>f.toReference(i)))||null,orChildrenGroup:((e=this.orChildrenGroup)==null?void 0:e.map(f=>f.toReference(i)))||null,inputs:this.inputs.map(f=>f.toReference(i)),successCalls:this.successCalls.map(f=>f.toReference(i)),errorCalls:this.errorCalls.map(f=>f.toReference(i)),calledBySuccess:this.calledBySuccess.map(f=>f.toReference(i)),calledByError:this.calledByError.map(f=>f.toReference(i)),calledByEntry:this.calledByEntry.map(f=>f.toReference(i)),parent:this.parent.toReference(i)}}toFlatJSON(i=new Set){var a,c;return i.has(this.id)?[]:(i.add(this.id),[this.toShallowJSON(),...((a=this.andChildrenGroup)==null?void 0:a.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(i=nt){var c,e;const r=this.parent.type===d.Project?void 0:(c=i.seenEntityMaps)!=null&&c.has(this.parent.id)?i.seenEntityMaps.get(this.parent.id):this.parent.id;let a=this.id;return(e=i.seenEntityMaps)!=null&&e.has(this.id)&&(a=i.seenEntityMaps.get(this.id)),{id:a,type:this.type,declaration:this.declaration.id,calledByEntry:this.calledByEntry.map(f=>f.id),calledBySuccess:this.calledBySuccess.map(f=>f.id),calledByError:this.calledByError.map(f=>f.id),parent:r}}toFlatGenerationTarget(i=new Set){var a,c;return i.has(this.id)?[]:(i.add(this.id),[this.toGenerationTarget(),...((a=this.andChildrenGroup)==null?void 0:a.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,r;return this.errors=[],(i=this.andChildrenGroup)==null||i.forEach(a=>a.clearErrors()),(r=this.orChildrenGroup)==null||r.forEach(a=>a.clearErrors()),this.inputs.forEach(a=>a.clearErrors()),this.successCalls.forEach(a=>a.clearErrors()),this.errorCalls.forEach(a=>a.clearErrors()),this}validate(){return this.errors=b_e(this),{success:!0}}async validateAsync(i={}){const r=z.YieldTracker.from(i);return this.errors=await E_e(this,{tracker:r}),{success:!0}}getErrors(){return[...this.errors,...this.inputs.flatMap(r=>r.getErrors()),...this.andChildrenGroup?this.andChildrenGroup.flatMap(r=>r.getErrors()):[],...this.orChildrenGroup?this.orChildrenGroup.flatMap(r=>r.getErrors()):[]]}async getErrorsAsync(i={}){const r=z.YieldTracker.from(i),a=[...this.errors];await r.tick();for(const c of this.inputs){const e=await c.getErrorsAsync({tracker:r});a.push(...e)}if(await r.tick(),this.andChildrenGroup)for(const c of this.andChildrenGroup){const e=await c.getErrorsAsync({tracker:r});a.push(...e)}if(this.orChildrenGroup)for(const c of this.orChildrenGroup){const e=await c.getErrorsAsync({tracker:r});a.push(...e)}return a}getShallowErrors(){return this.errors}clone(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.CloneEntity)),r=null,a=null,c=!0){var L,j,k;const e=Br(r,this),f=this.toJSON(),h=a||N.UUID.uuid();f.inputs=[];const m=h.split("-id"),E=m[m.length-1||0]||h;f.id=h,f.version=N.UUID.uuid(),f.createdAt=(i==null?void 0:i.timestamp)||B().toISOString(),f.author=(i==null?void 0:i.author)||"1",f.previousVersion=null,f.deleted=!1,f.deletable=!0,f.editable=!0;const b=Yi(f,e);r?b.setParent(r,i):b.setParent(this.parent,null),c&&b.subscribe(),b.initChildren(i),i==null||i.add(b,W.Added);const g=(L=this.andChildrenGroup)==null?void 0:L.map(G=>G.clone(i,b,N.UUID.uuid(),c)),_=(j=this.orChildrenGroup)==null?void 0:j.map(G=>G.clone(i,b,N.UUID.uuid(),c));b.andChildrenGroup=g||null,b.orChildrenGroup=_||null;const $=(k=this.inputs)==null?void 0:k.map((G,H)=>G.clone(i,b,E+"-input-map-"+H+"-id",c));return b.inputs=$,i==null||i.attemptAutoclose(w.CloneEntity,this.id),b}addToAndGroup(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.AddToAndGroup))){return this.checkCanEdit(this,r)?(this.andChildrenGroup||(this.andChildrenGroup=[]),this.andChildrenGroup.includes(i)||(this.andChildrenGroup.push(i),r==null||r.add(i,W.Affected)),r==null||r.attemptAutoclose(w.AddToAndGroup,this.id),this):(z.Logger.warn(`[addToAndGroup] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.AddToAndGroup,this.id),this)}addToOrGroup(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.AddToOrGroup))){return this.checkCanEdit(this,r)?(this.orChildrenGroup||(this.orChildrenGroup=[]),this.orChildrenGroup.includes(i)||(this.orChildrenGroup.push(i),r==null||r.add(i,W.Affected)),r==null||r.attemptAutoclose(w.AddToOrGroup,this.id),this):(z.Logger.warn(`[addToOrGroup] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.AddToOrGroup,this.id),this)}removeUnrecognizedInputs(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.RemoveUnrecognizedInputs))){if(!this.checkCanEdit(this,i))return z.Logger.warn(`[removeUnrecognizedInputs] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(w.RemoveUnrecognizedInputs,this.id),{updated:[],added:[],removed:[],affected:[],self:this};const r=[],a=[],c=[],e=[];return this.inputs.forEach(h=>{if(!this.declaration.inputs.find(E=>{var b;return E.id===((b=h.declaration)==null?void 0:b.id)})){const E=h.remove({ignoreUpstream:!1},i);c.push(...E.removed),r.push(...E.updated)}}),this.inputs.filter((h,m)=>{const E=this.inputs.findIndex(g=>g.declaration===h.declaration&&g!==h);if(E===-1)return!1;const b=this.inputs[E];return B(b==null?void 0:b.createdAt).isSame(B(h.createdAt))?m>E:!!B(b==null?void 0:b.createdAt).isAfter(h.createdAt)}).forEach(h=>{const m=h.remove({ignoreUpstream:!1},i);c.push(...m.removed),r.push(...m.updated)}),i==null||i.attemptAutoclose(w.RemoveUnrecognizedInputs,this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}syncInputs(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.SyncInputs))){if(!this.checkCanEdit(this,i))return z.Logger.warn(`[syncInputs] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(w.SyncInputs,this.id),{updated:[],added:[],removed:[],affected:[],self:this};const r=[],a=[],c=[],e=[],f=this.declaration.inputs.filter(b=>b.parentRelationType===M.FixedArguments&&!this.inputs.find(g=>g.declaration.id===b.id));this.inputs.sort((b,g)=>b.index-g.index),f.forEach(b=>{this.inputs.forEach($=>{$.index>=b.index&&$.metaSync({index:$.index+1},i)});const g={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.InputMap,dataType:null,parentRelationType:null,declaration:b.toJSON(),readsValue:null,defaultValue:null,index:b.index,name:null,codeName:null,description:null,parent:this.toReference()},_=Ae(g,this.project);_.setParent(this,i),_.initChildren(i),i==null||i.add(_,W.Added),_.addSelfToProject(i)}),this.inputs.sort((b,g)=>b.index-g.index);const{updated:h,added:m,removed:E}=this.removeUnrecognizedInputs(i);return r.push(...h),a.push(...m),c.push(...E),i==null||i.attemptAutoclose(w.SyncInputs,this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(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,N.sessionAuthor,B().toISOString(),this,!0,"get-data-type"))){var a;const r=((a=this.declaration)==null?void 0:a.getDataType(i))||null;return i==null||i.attemptAutoclose("get-data-type",this.id),r}};R(xi,"repository",{APICreate:async(i,...r)=>i,APIUpdate:async(i,...r)=>i,APIDelete:async(i,...r)=>i,APIClone:async(i,...r)=>{},APILoad:async(i,...r)=>null,APILoadVersion:async(i,r,...a)=>null}),R(xi,"type",d.Condition),R(xi,"USER_MANAGED_PARENT_TYPES",[...vr,d.Project,d.Condition]),R(xi,"PARENT_TYPES",[...xi.USER_MANAGED_PARENT_TYPES]),R(xi,"MUTABLE_BASE_PROPERTIES",["operator"]),R(xi,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion","index"]),R(xi,"BASE_PROPERTIES",[...xi.MUTABLE_BASE_PROPERTIES,...xi.INMUTABLE_BASE_PROPERTIES]),R(xi,"MUTABLE_META_PROPERTIES",["x","y"]),R(xi,"INMUTABLE_META_PROPERTIES",[...xi.INMUTABLE_BASE_PROPERTIES]),R(xi,"META_PROPERTIES",[...xi.MUTABLE_META_PROPERTIES,...xi.INMUTABLE_META_PROPERTIES]),R(xi,"MUTABLE_UPSTREAM_PROPERTIES",["calledBySuccess","calledByError","calledByEntry","parent"]),R(xi,"INMUTABLE_UPSTREAM_PROPERTIES",[]),R(xi,"UPSTREAM_PROPERTIES",[...xi.MUTABLE_UPSTREAM_PROPERTIES,...xi.INMUTABLE_UPSTREAM_PROPERTIES]),R(xi,"MUTABLE_DOWNSTREAM_PROPERTIES",["andChildrenGroup","orChildrenGroup","successCalls","errorCalls","inputsDeclarations","inputs"]),R(xi,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),R(xi,"DOWNSTREAM_PROPERTIES",[...xi.MUTABLE_DOWNSTREAM_PROPERTIES,...xi.INMUTABLE_DOWNSTREAM_PROPERTIES]),R(xi,"PROPERTIES",[...xi.META_PROPERTIES,...xi.UPSTREAM_PROPERTIES,...xi.DOWNSTREAM_PROPERTIES]);let yp=xi;async function LAi(l,p={}){const i=z.YieldTracker.from(p),r=[],a=kt(l.errors,r);return await i.tick(),a}function BAi(l){const p=[];return kt(l.errors,p)}async function g_e(l,p={}){const i=z.YieldTracker.from(p),r=[],a=kt(l.errors,r);return await i.tick(),a}function I_e(l){const p=[];return kt(l.errors,p)}const MAi=Object.freeze(Object.defineProperty({__proto__:null,validate:I_e,validateAsync:g_e},Symbol.toStringTag,{value:"Module"}));function GAi(l,p){const i=[],r=[];if(l.parent)if(l.parent){const a=p.get(l.parent);a?Nr.USER_MANAGED_PARENT_TYPES.includes(a.type)||r.push(new Re({id:`${l.id}--${l.parent}--${he.InvalidParentReference}`,code:he.InvalidParentReference,severity:me.Error,message:`Entity of type "${l.type}" with id "${l.id}", has a parent reference which is of type ${a.type}, and therefore that isn't pointing to the following valid types for this reference: '${vt(Nr.USER_MANAGED_PARENT_TYPES,"', '","' or '")}'.`})):r.push(new Re({id:`${l.id}--${l.parent}--${he.ReferencedEntityNotFound}`,code:he.ReferencedEntityNotFound,severity:me.Error,message:`Entity of type "${l.type}" with id "${l.id}", is referencing an entity with id "${l.parent}" at 'parent' that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`}))}else r.push(new Re({id:`${l.id}--${we.InvalidObjectStructure}`,code:we.InvalidObjectStructure,severity:me.Error,message:`Entity of type "${l.type}" with id "${l.id}" is missing a 'parent' reference. The 'parent' of a literal value entity must be a reference to an entity of type '${vt(Nr.USER_MANAGED_PARENT_TYPES,"', '","', or '")}'.`}));else return r.push(new Re({id:`${l.id}--${we.InvalidObjectStructure}`,code:we.InvalidObjectStructure,severity:me.Error,message:`Entity of type "${l.type}" with id "${l.id}" is missing a 'parent' reference. The 'parent' of a literal value entity must be a reference to an entity of type '${vt(Nr.USER_MANAGED_PARENT_TYPES,"', '","', or '")}'.`})),{errors:r,explanations:i};if(l.valueAsTypeSingle){const a=[],c=[],e=l.valueAsTypeSingle;Array.isArray(e)?e.forEach(f=>{typeof f=="string"?c.push(f):a.push(f)}):typeof e=="string"?c.push(e):a.push(e),a.forEach(f=>{const h=N1(f);r.push(...h),h.length===0&&c.push(f.entityId)}),c.forEach(f=>{const h=p.get(f);h?[d.DefinitionEntity,d.BuiltInBaseEntity].includes(h.type)||r.push(new Re({id:`${l.id}--${f}--${he.InvalidImplementsReference}`,code:he.InvalidImplementsReference,severity:me.Error,message:`Entity of type "${l.type}" with id "${l.id}", has an 'valueAsTypeSingle' reference which is of type ${h.type}, and therefore that isn't pointing to the following valid types for this reference: 'definition-entity', 'function-declaration' or 'operation'.`})):r.push(new Re({id:`${l.id}--${f}--${he.ReferencedEntityNotFound}`,code:he.ReferencedEntityNotFound,severity:me.Error,message:`Entity of type "${l.type}" with id "${l.id}", is referencing an entity with id "${f}" at 'valueAsTypeSingle' that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`}))})}return{errors:r,explanations:i}}var R_e=(l=>(l.ValueAsTypeSingle="value-as-type-single",l.ValueAsTypeList="value-as-type-list",l))(R_e||{});const pi=class pi extends Qr{constructor(i,r){super(i);R(this,"initialData");R(this,"type",d.LiteralValue);R(this,"id");R(this,"name");R(this,"autogeneration",null);R(this,"value",null);R(this,"valueAsTypeSingle",null);R(this,"valueAsTypeList",null);R(this,"errors",[]);R(this,"parent");R(this,"standaloneParent");R(this,"project");R(this,"detachedDependents",{});R(this,"knownVersions",null);R(this,"activeVersion",!1);R(this,"initialized",!1);R(this,"startedInitialization",!1);R(this,"standalone",!1);if(this.initialData=i,this.project=r,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:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:(i==null?void 0:i.author)||N.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.LiteralValue,standaloneParent:null,name:"",autogeneration:null,value:null,valueAsTypeSingle:null,valueAsTypeList:null,parent:null}}static fromGenerationTarget(i,r){const a=X(i.parent),c=r.get(a);let e=null,f=null;i.valueAsTypeList?Array.isArray(i.valueAsTypeList)&&(f=i.valueAsTypeList.map(E=>r.get(E)||r.getBuiltIn(E))):i.valueAsTypeSingle&&(e=r.get(i.valueAsTypeSingle)||r.getBuiltIn(i.valueAsTypeSingle));const h={id:i.id,version:N.UUID.uuid(),createdAt:B().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.LiteralValue,standaloneParent:null,name:i.name,autogeneration:i.autogeneration,valueAsTypeSingle:e,valueAsTypeList:f,value:i.value||null,parent:c.toReference()},m=Ae(h,r);return m.setParent(c,null),m}static validateGenerationTarget(i,r){let a=JSON.parse(JSON.stringify(i));const c=[],e=[],f=GAi(a,r),h=Zr(a);return e.push(...f.errors,...h.errors),c.push(...f.explanations,...h.explanations),{errors:e,explanations:c,modifiedData:a}}get valueAsType(){return this.valueAsTypeSingle?this.valueAsTypeSingle:this.valueAsTypeList?this.valueAsTypeList:null}get isFinal(){return!!(this.parent.type===d.Property&&(this.parent.constant||this.parent.implements.some(i=>i.constant))||this.parent.type===d.Property&&this.parent.parent.type===d.DefinitionEntity&&!tl(this.parent.parent))}validateGeneratedUpdate(i){const r=[],a=[];return i.parent&&r.push(new Re({id:`${this.id}--${he.InvalidParentUpdate}`,code:he.InvalidParentUpdate,severity:me.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.
|
|
48
|
+
If an entity is called by another, they must be in the same scope, which means they have the same parent.`})),{errors:r,explanations:a,modifiedData:i}}subscribeDependents(i){return i.forEach(r=>{this.detachedDependents[r.entity.id]||(this.detachedDependents[r.entity.id]=r)}),this}unsubscribeDependents(i){return i.forEach(r=>{this.detachedDependents[r.entity.id]&&delete this.detachedDependents[r.entity.id]}),this}syncDependents(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,"sync-dependents"))){const r=[],a=[],c=[],e=[];return Object.values(this.detachedDependents).forEach(f=>{const h=f.entity.afterAllChildrenInitialized(i);r.push(...h.updated),a.push(...h.added),c.push(...h.removed),e.push(...h.affected)}),i==null||i.attemptAutoclose("sync-dependents",this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}onDetachedDependencyRemoved(i,r,a){const c=[],e=[],f=[],h=[];if(r==="parent"){const{updated:m,added:E,removed:b}=this.remove({ignoreUpstream:!1},a);c.push(...m),e.push(...E),f.push(...b)}return{updated:C(c),added:C(e),removed:C(f),affected:C(h),self:this}}onDetachedDependencyRestored(i,r,a){const c=[],e=[],f=[],h=[];if(r==="parent"){const{updated:m,added:E,removed:b}=this.restore({},a);c.push(...m),e.push(...E),f.push(...b)}return{updated:C(c),added:C(e),removed:C(f),affected:C(h),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&&!B(i).isValid())throw new Error(`The shared timestamp '${i}' is not a valid ISO 8601 date string.`);return i&&B(i).isSame(B(this.createdAt))?this:(this.previousVersion=this.version,this.version=N.UUID.uuid(),this.createdAt=B(i).toISOString()||B().toISOString(),this)}captureVersion(){var r;const i=((r=this.knownVersions)==null?void 0:r.get(this.version))||new xi(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 r=[],a=[],c=[],e=[];if(this.parent){this.parent.increaseVersion(i);const f=this.parent.recursiveCaptureUpstreamVersions(i);r.push(this.parent,...f.updated),a.push(...f.added),c.push(...f.removed)}return{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}async restoreVersion(i){var h;const r=[],a=[],c=[],e=[];if(this.version===i)return{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this};if(!this.knownVersions){const m=new Map;for(const[E,b]of this.knownVersions||new Map){if(m.set(E,b),b.activeVersion=!1,b.knownVersions)for(const[g,_]of b.knownVersions)m.set(g,_);b.knownVersions=null}}let f=(h=this.knownVersions)==null?void 0:h.get(i);if(!f){const m=await this.APILoadVersion({},i);if(!m)throw new Error(`Version with id '${i}' for entity with id '${this.id}' not found.`);f=new xi(m,this.project)}return this.metaSync(f.toShallowJSON(),null),this.previousVersion=f.previousVersion,this.version=f.version,this.createdAt=f.createdAt,this.author=f.author,this.deleted=f.deleted,this.inputs=f.inputs,this.declaration=f.declaration,this.andChildrenGroup=f.andChildrenGroup,this.orChildrenGroup=f.orChildrenGroup,this.successCalls=f.successCalls,this.errorCalls=f.errorCalls,this.calledBySuccess=f.calledBySuccess,this.calledByError=f.calledByError,this.calledByEntry=f.calledByEntry,this.parent=f.parent,{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}updateWithShallowTransfer(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.UpdateWithShallowTransfer))){var a,c;if(!this.checkCanEdit(this,r))return z.Logger.warn(`[updateWithShallowTransfer] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.UpdateWithShallowTransfer,this.id),this;if(this.metaSync(i,r),this.version=i.version,this.createdAt=i.createdAt,this.author=i.author,this.deleted=i.deleted,this.previousVersion=i.previousVersion,i.parent){const e=X(i.parent),f=this.project.get(e),h=this.parent;if(h&&h.id!==(f==null?void 0:f.id)&&this.removeFromParent(r),f)this.setParent(f,r),this.addSelfToProject(r);else throw r==null||r.attemptAutoclose(w.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 r==null||r.attemptAutoclose(w.UpdateWithShallowTransfer,this.id),new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(i.declaration){const e=X(i.declaration),f=this.project.get(e);f&&this.setDeclaration(f)}return(a=i.andChildrenGroup)==null||a.forEach(e=>{const f=X(e),h=this.project.get(f);h&&(this.addToAndGroup(h,r),h.setParent(this,r))}),[...this.andChildrenGroup||[]].forEach(e=>{var h;((h=i.andChildrenGroup)==null?void 0:h.find(m=>X(m)===e.id))||(this.removeChildGroup(e,r),e.removeFromParent(r))}),(c=i.orChildrenGroup)==null||c.forEach(e=>{const f=X(e),h=this.project.get(f);h&&(this.addToOrGroup(h,r),h.setParent(this,r))}),[...this.orChildrenGroup||[]].forEach(e=>{var h;((h=i.orChildrenGroup)==null?void 0:h.find(m=>X(m)===e.id))||(this.removeChildGroup(e,r),e.removeFromParent(r))}),i.calledByEntry.forEach(e=>{const f=X(e),h=this.project.get(f);h&&(this.addEntryCaller(h,r),h.addCall(this,r))}),[...this.calledByEntry].forEach(e=>{i.calledByEntry.find(h=>X(h)===e.id)||(this.removeCaller(e,r),e.removeCall(this,r))}),i.calledBySuccess.forEach(e=>{const f=X(e),h=this.project.get(f);h&&(this.addSuccessCaller(h,r),h.addSuccessCall(this,r))}),[...this.calledBySuccess].forEach(e=>{i.calledBySuccess.find(h=>X(h)===e.id)||(this.removeCaller(e,r),e.removeCall(this,r))}),i.calledByError.forEach(e=>{const f=X(e),h=this.project.get(f);h&&(this.addErrorCaller(h,r),h.addErrorCall(this,r))}),[...this.calledByError].forEach(e=>{i.calledByError.find(h=>X(h)===e.id)||(this.removeCaller(e,r),e.removeCall(this,r))}),this.captureVersion(),this.subscribeToDependencies(),r==null||r.attemptAutoclose(w.UpdateWithShallowTransfer,this.id),this}updateWithGenerationTarget(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.UpdateWithGenerationTarget))){var a,c,e;if(!this.checkCanEdit(this,r))return z.Logger.warn(`[updateWithGenerationTarget] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.UpdateWithGenerationTarget,this.id),this;if(this.metaSync(i,r),i.parent){const f=X(i.parent),h=this.project.get(f),m=this.parent;if(m&&m.id!==(h==null?void 0:h.id)&&this.removeFromParent(r),h)this.setParent(h,r),this.addSelfToProject(r);else throw r==null||r.attemptAutoclose(w.UpdateWithGenerationTarget,this.id),new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${f}' that isn't found in the project`)}if(i.declaration){const f=X(i.declaration),h=this.project.get(f);if(h)this.setDeclaration(h);else throw new Error(`${this.type} with id '${this.id}' has a 'declaration' reference '${f}' that isn't found in the project`)}return(a=i.calledByEntry)==null||a.forEach(f=>{const h=X(f),m=this.project.get(h);if(m)this.addEntryCaller(m,r),m.addCall(this,r);else throw new Error(`${this.type} with id '${this.id}' has a 'calledByEntry' reference '${h}' that isn't found in the project`)}),i.calledByEntry&&[...this.calledByEntry].forEach(f=>{var m;((m=i.calledByEntry)==null?void 0:m.find(E=>X(E)===f.id))||(this.removeCaller(f,r),f.removeCall(this,r))}),(c=i.calledBySuccess)==null||c.forEach(f=>{const h=X(f),m=this.project.get(h);if(m)this.addSuccessCaller(m,r),m.addSuccessCall(this,r);else throw new Error(`${this.type} with id '${this.id}' has a 'calledBySuccess' reference '${h}' that isn't found in the project`)}),i.calledBySuccess&&[...this.calledBySuccess].forEach(f=>{var m;((m=i.calledBySuccess)==null?void 0:m.find(E=>X(E)===f.id))||(this.removeCaller(f,r),f.removeCall(this,r))}),(e=i.calledByError)==null||e.forEach(f=>{const h=X(f),m=this.project.get(h);if(m)this.addErrorCaller(m,r),m.addErrorCall(this,r);else throw new Error(`${this.type} with id '${this.id}' has a 'calledByError' reference '${h}' that isn't found in the project`)}),i.calledByError&&[...this.calledByError].forEach(f=>{var m;((m=i.calledByError)==null?void 0:m.find(E=>X(E)===f.id))||(this.removeCaller(f,r),f.removeCall(this,r))}),this.captureVersion(),this.subscribeToDependencies(),r==null||r.attemptAutoclose(w.UpdateWithGenerationTarget,this.id),this}hydrateAncestors(){const i=[],r=[],a=[],c=[];if(this.initialData.parent){const e=X(this.initialData.parent),f=this.project.get(e);if(f)this.setParent(f,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=X(this.initialData.declaration),f=this.project.get(e);f&&(this.setDeclaration(f),i.push(f))}return this.initialData.calledByEntry.forEach(e=>{const f=X(e),h=this.project.get(f);h&&this.addEntryCaller(h,null)}),this.initialData.calledBySuccess.forEach(e=>{const f=X(e),h=this.project.get(f);h&&this.addSuccessCaller(h,null)}),this.initialData.calledByError.forEach(e=>{const f=X(e),h=this.project.get(f);h&&this.addErrorCaller(h,null)}),{updated:C(i),added:C(r),removed:C(a),affected:C(c),self:this}}afterAllChildrenInitialized(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.AfterAllChildrenInitialized))){var E,b;if(!this.checkCanEdit(this,i))return z.Logger.warn(`[afterAllChildrenInitialized] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(w.AfterAllChildrenInitialized,this.id),{updated:[],added:[],removed:[],affected:[],self:this};const r=[],a=[],c=[],e=[];if(this.initialized=!0,this.parent.type===d.Condition){let g=this.index||0;const _=(this.parent.declaration.id===Ir.And?this.parent.andChildrenGroup||[]:this.parent.orChildrenGroup||[]).filter(L=>!L.deleted&&L.id!==this.id);_.length&&(g>_.length+1?g=_.length:g<0&&(g=0)),_.find(L=>(L.index||0)===g&&!L.deleted)&&_.filter(L=>(L.index||0)>=g&&!L.deleted).forEach(L=>{L.metaSync({index:(L.index||0)+1},i),i==null||i.add(L,W.Updated),r.push(L)}),this.metaSync({index:g},i)}(E=this.andChildrenGroup)!=null&&E.length&&this.andChildrenGroup.sort((g,_)=>(g.index||0)-(_.index||0)),(b=this.orChildrenGroup)!=null&&b.length&&this.orChildrenGroup.sort((g,_)=>(g.index||0)-(_.index||0)),this.inputs.sort((g,_)=>{var $,L;return(g.index??(($=g.declaration)==null?void 0:$.index))-(_.index??((L=_.declaration)==null?void 0:L.index))});const{updated:f,added:h,removed:m}=this.syncInputs(i);return r.push(...f),a.push(...h),c.push(...m),this.captureVersion(),i==null||i.attemptAutoclose(w.AfterAllChildrenInitialized,this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}addSelfToProject(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,"add-self-to-project"))){const r=[this],a=[],c=[],e=[];return this.parent===this.project?this.project.addCondition(this):this.parent.type===d.Condition&&(this.parent.declaration.id===Ir.And?this.parent.addToAndGroup(this,i):this.parent.declaration.id===Ir.Or&&this.parent.addToOrGroup(this,i)),this.successCalls.forEach(f=>{f.addSuccessCaller(this,i),r.push(f)}),this.errorCalls.forEach(f=>{f.addErrorCaller(this,i),r.push(f)}),this.calledByEntry.forEach(f=>{f.addCall(this,i),r.push(f)}),this.calledBySuccess.forEach(f=>{f.addSuccessCall(this,i),r.push(f)}),this.calledByError.forEach(f=>{f.addErrorCall(this,i),r.push(f)}),this.subscribe(),this.subscribeToDependencies(),i==null||i.attemptAutoclose("add-self-to-project",this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}get calledBy(){return[...this.calledByEntry,...this.calledBySuccess,...this.calledByError]}removeInput(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.RemoveInput))){if(!this.checkCanEdit(this,r))return z.Logger.warn(`[removeInput] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.RemoveInput,this.id),this;const a=this.inputs.findIndex(c=>c.id===i.id);return a>-1&&(this.inputs.splice(a,1),r&&(r==null||r.add(this,W.Affected))),r==null||r.attemptAutoclose(w.RemoveInput,this.id),this}addInput(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.AddInput))){return this.checkCanEdit(this,r)?this.inputs.includes(i)?(r==null||r.attemptAutoclose(w.AddInput,this.id),this):(this.inputs.push(i),r==null||r.add(this,W.Affected),r==null||r.attemptAutoclose(w.AddInput,this.id),this):(z.Logger.warn(`[addInput] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.AddInput,this.id),this)}addOutput(i){return this}removeOutput(i){return this}addSuccessCaller(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.AddSuccessCaller)),a=!1){var c;return this.checkCanEditWithCounterpartAndSideEffects(this,i,w.AddSuccessCaller,r)?((i==null?void 0:i.id)===this.id&&(r==null||r.event({id:`${w.AddSuccessCaller}-${this.id}--${Be.CannotSuccessCallItself}`,action:w.AddSuccessCaller,owner:this,errorReason:Be.CannotSuccessCallItself,rootAction:((c=r==null?void 0:r.self)==null?void 0:c.id)===this.id&&(r==null?void 0:r.autoCloseActionName)===w.AddSuccessCaller})),this.calledBySuccess.find(e=>e.id===i.id)||(this.calledBySuccess.push(i),r==null||r.add(this,W.Updated),a&&Tt(this,r)),r==null||r.attemptAutoclose(w.AddSuccessCaller,this.id),this):this}addErrorCaller(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.AddErrorCaller)),a=!1){var c;return this.checkCanEditWithCounterpartAndSideEffects(this,i,w.AddErrorCaller,r)?((i==null?void 0:i.id)===this.id&&(r==null||r.event({id:`${w.AddErrorCaller}-${this.id}--${Be.CannotErrorCallItself}`,action:w.AddErrorCaller,owner:this,errorReason:Be.CannotErrorCallItself,rootAction:((c=r==null?void 0:r.self)==null?void 0:c.id)===this.id&&(r==null?void 0:r.autoCloseActionName)===w.AddErrorCaller})),this.calledByError.find(e=>e.id===i.id)||(this.calledByError.push(i),r==null||r.add(this,W.Updated),a&&Tt(this,r)),r==null||r.attemptAutoclose(w.AddErrorCaller,this.id),this):this}addEntryCaller(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.AddEntryCaller)),a=!1){var c;return this.checkCanEditWithCounterpartAndSideEffects(this,i,w.AddEntryCaller,r)?((i==null?void 0:i.id)===this.id&&(r==null||r.event({id:`${w.AddEntryCaller}-${this.id}--${Be.CannotEntryCallItself}`,action:w.AddEntryCaller,owner:this,errorReason:Be.CannotEntryCallItself,rootAction:((c=r==null?void 0:r.self)==null?void 0:c.id)===this.id&&(r==null?void 0:r.autoCloseActionName)===w.AddEntryCaller})),this.calledByEntry.find(e=>e.id===i.id)||(this.calledByEntry.push(i),r==null||r.add(this,W.Updated),a&&Tt(this,r)),r==null||r.attemptAutoclose(w.AddEntryCaller,this.id),this):this}addErrorCall(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.AddErrorCall)),a=!1){var c;return this.checkCanEditWithCounterpartAndSideEffects(this,i,w.AddErrorCall,r)?((i==null?void 0:i.id)===this.id&&(r==null||r.event({id:`${w.AddErrorCaller}-${this.id}--${Be.CannotErrorCallItself}`,action:w.AddErrorCaller,owner:this,errorReason:Be.CannotErrorCallItself,rootAction:((c=r==null?void 0:r.self)==null?void 0:c.id)===this.id&&(r==null?void 0:r.autoCloseActionName)===w.AddErrorCaller})),this.errorCalls.find(e=>e.id===i.id)||(this.errorCalls.push(i),a&&Tt(this,r),r==null||r.add(this,W.Affected)),r==null||r.attemptAutoclose(w.AddErrorCall,this.id),this):this}addSuccessCall(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.AddSuccessCall)),a=!1){var c;return this.checkCanEditWithCounterpartAndSideEffects(this,i,w.AddSuccessCall,r)?((i==null?void 0:i.id)===this.id&&(r==null||r.event({id:`${w.AddSuccessCaller}-${this.id}`,action:w.AddSuccessCaller,owner:this,errorReason:Be.CannotSuccessCallItself,rootAction:((c=r==null?void 0:r.self)==null?void 0:c.id)===this.id&&(r==null?void 0:r.autoCloseActionName)===w.AddSuccessCaller})),this.successCalls.find(e=>e.id===i.id)||(this.successCalls.push(i),a&&Tt(this,r),r==null||r.add(this,W.Affected)),r==null||r.attemptAutoclose(w.AddSuccessCall,this.id),this):this}removeCall(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.RemoveCall)),a=!1){if(!this.checkCanEditWithCounterpartAndSideEffects(this,i,w.RemoveCall,r))return this;const c=this.successCalls.findIndex(f=>f.id===i.id);c>-1&&(this.successCalls.splice(c,1),r==null||r.add(this,W.Affected));const e=this.errorCalls.findIndex(f=>f.id===i.id);return e>-1&&(this.errorCalls.splice(e,1),r==null||r.add(this,W.Affected)),a&&Tt(this,r),r==null||r.attemptAutoclose(w.RemoveCall,this.id),this}removeCaller(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.RemoveCaller)),a=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,i,w.RemoveCaller,r)?(this.calledBySuccess=this.calledBySuccess.filter(c=>c.id!==i.id?!0:(r==null||r.add(this,W.Updated),r==null||r.add(c,W.Affected),!1)),this.calledByError=this.calledByError.filter(c=>c.id!==i.id?!0:(r==null||r.add(this,W.Updated),r==null||r.add(c,W.Affected),!1)),this.calledByEntry=this.calledByEntry.filter(c=>c.id!==i.id?!0:(r==null||r.add(this,W.Updated),r==null||r.add(c,W.Affected),!1)),a&&Tt(this,r),r==null||r.attemptAutoclose(w.RemoveCaller,this.id),this):this}setParent(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.SetParent))){var a;return this.checkCanEditWithCounterpartAndSideEffects(this,i,w.SetParent,r)?(((a=this.parent)==null?void 0:a.id)!==(i==null?void 0:i.id)&&(this.parent=i,r&&(r==null||r.add(this,W.Updated))),r==null||r.attemptAutoclose(w.SetParent,this.id),this):this}removeChildGroup(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.RemoveChildGroup))){if(!this.checkCanEdit(this,r))return z.Logger.warn(`[removeChildGroup] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.RemoveChildGroup,this.id),this;if(this.andChildrenGroup){const a=this.andChildrenGroup.findIndex(c=>c.id===i.id);a!==-1&&(this.andChildrenGroup.splice(a,1),r==null||r.add(this,W.Updated))}if(this.orChildrenGroup){const a=this.orChildrenGroup.findIndex(c=>c.id===i.id);a!==-1&&(this.orChildrenGroup.splice(a,1),r==null||r.add(this,W.Updated))}return r==null||r.attemptAutoclose(w.RemoveChildGroup,this.id),this}setDeclaration(i){return this.declaration=i,this}initChildren(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,"init-children"))){return this.initialized||this.startedInitialization?this:(this.startedInitialization=!0,this.declaration=Ae(this.initialData.declaration,this.project),this.initialData.andChildrenGroup&&(this.andChildrenGroup=this.initialData.andChildrenGroup.map(r=>{const a=Ae(r,this.project);return a.setParent(this,null),a.initChildren(i),a})),this.initialData.orChildrenGroup&&(this.orChildrenGroup=this.initialData.orChildrenGroup.map(r=>{const a=Ae(r,this.project);return a.setParent(this,null),a.initChildren(i),a})),this.successCalls=this.initialData.successCalls.map(r=>{const a=Ae(r,this.project);if(a.addSuccessCaller(this,null),[d.BreakStatement,d.ContinueStatement].includes(a.type))a.setParent(this.parent.parent,null),a.initChildren(i);else if(a.type===d.ReturnStatement){const c=fn(this,this.project);a.setParent(c,null),a.initChildren(i)}else a.type!==d.InternalCall&&(a.setParent(this.parent,null),a.initChildren(i));return a}),this.errorCalls=this.initialData.errorCalls.map(r=>{const a=Ae(r,this.project);if(a.addErrorCaller(this,null),[d.BreakStatement,d.ContinueStatement].includes(a.type))a.setParent(this.parent.parent,null),a.initChildren(i);else if(a.type===d.ReturnStatement){const c=fn(this,this.project);a.setParent(c,null),a.initChildren(i)}else a.type!==d.InternalCall&&(a.setParent(this.parent,null),a.initChildren(i));return a}),this.inputs=this.initialData.inputs.map(r=>{const a=Ae(r,this.project);return a.setParent(this,null),a.initChildren(i),a}),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,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,"meta-sync"))){const a=Wr(this,i,r),c=Hr(this,a),e=this.toMeta();return this.x=a.x!==void 0?a.x:e.x,this.y=a.y!==void 0?a.y:e.y,this.index=a.index!==void 0?a.index:e.index,super.baseMetaSync(a,this,r),a.deleted===!0&&!e.deleted?r==null||r.add(this,W.Removed):a.deleted===!1&&e.deleted?r==null||r.add(this,W.Added):c&&(r==null||r.add(this,W.Updated)),r==null||r.attemptAutoclose("meta-sync",this.id),this}async APILoad(i=Se,...r){return await xi.repository.APILoad(this.id,...r),this}async APICreate(i=Se,...r){return await xi.repository.APICreate(this.toShallowJSON(),...r),this}async APIUpdate(i=Se,...r){return await xi.repository.APIUpdate(this.toShallowJSON(),...r),this}async APIDelete(i=Se,...r){return await xi.repository.APIDelete(this.toShallowJSON(),...r),this}async APIClone(i=Se,...r){return await xi.repository.APIClone(this.id,...r),this}async APILoadVersion(i=Se,r,...a){return await xi.repository.APILoadVersion(this.id,r,...a)}removeFromParent(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.RemoveFromParent))){var f;if(!this.checkCanEdit(this,i))return z.Logger.warn(`[removeFromParent] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(w.RemoveFromParent,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const r=[],a=[],c=[],e=[];return this.parent.type===d.Project?(this.parent.removeCondition(this),e.push(this.parent)):((f=this.parent)==null?void 0:f.type)===d.Condition?this.parent.removeChildGroup(this):this.parent.detachedChildren.includes(this)&&this.parent.unsubscribeDetachedChild(this),i==null||i.attemptAutoclose(w.RemoveFromParent,this.id),{added:C(c),updated:C(r),removed:C(a),affected:C(e),self:this}}remove({ignoreUpstream:i}={ignoreUpstream:!1},r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.RemoveEntity))){var h;if(!this.checkCanDelete(this,r))return z.Logger.warn(`[remove] User is not allowed to delete or edit this ${this.type} entity with id: ${this.id}`),r==null||r.event({id:`${w.RemoveEntity}-${this.id}--${Be.ActionOwnerEntityNonDeletable}`,action:w.RemoveEntity,owner:this,errorReason:Be.ActionOwnerEntityNonDeletable,rootAction:((h=r==null?void 0:r.self)==null?void 0:h.id)===this.id&&(r==null?void 0:r.autoCloseActionName)===w.RemoveEntity}),r==null||r.attemptAutoclose(w.RemoveEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const a=[],c=[],e=[],f=[];if(r!=null&&r.hasRemoved(this.id))return r==null||r.attemptAutoclose(w.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},r),Object.values(this.detachedDependents).forEach(m=>{const{updated:E,removed:b,added:g}=m.entity.onDetachedDependencyRemoved(this,m.field,r);a.push(...E),c.push(...b),e.push(...g)}),this.andChildrenGroup&&this.andChildrenGroup.forEach(m=>{const{removed:E,updated:b}=m.remove({ignoreUpstream:!0},r);c.push(...E),a.push(...b)}),this.orChildrenGroup&&this.orChildrenGroup.forEach(m=>{const{removed:E,updated:b}=m.remove({ignoreUpstream:!0},r);c.push(...E),a.push(...b)}),this.inputs.forEach(m=>{const{updated:E,removed:b}=m.remove({ignoreUpstream:!0},r);a.push(...E),c.push(...b)}),this.successCalls.forEach(m=>{a.push(m),m.removeCaller(this,r)}),this.errorCalls.forEach(m=>{a.push(m),m.removeCaller(this,r)}),!i){const m=this.removeFromParent(r);e.push(...m.added),a.push(...m.updated),c.push(...m.removed),f.push(...m.affected),this.calledBy.forEach(E=>{a.push(E),E.removeCall(this,r)})}return r==null||r.attemptAutoclose(w.RemoveEntity,this.id),{added:C(e),updated:C(a),removed:C(c),affected:C(f),self:this}}restore({}={},i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.RestoreEntity))){if(!this.checkCanEdit(this,i))return z.Logger.warn(`[restore] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(w.RestoreEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const r=[],a=[],c=[],e=[];return i!=null&&i.hasAdded(this.id)?(i==null||i.attemptAutoclose(w.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(f=>{const{updated:h,removed:m,added:E}=f.entity.onDetachedDependencyRestored(this,f.field,i);a.push(...h),c.push(...m),r.push(...E)}),this.andChildrenGroup&&this.andChildrenGroup.forEach(f=>{const{updated:h,added:m}=f.restore({},i);a.push(...h),r.push(...m)}),this.orChildrenGroup&&this.orChildrenGroup.forEach(f=>{const{updated:h,added:m}=f.restore({},i);a.push(...h),r.push(...m)}),this.inputs.forEach(f=>{const{updated:h}=f.restore({},i);a.push(...h)}),this.successCalls.forEach(f=>{a.push(f),f.addSuccessCaller(this,i)}),this.errorCalls.forEach(f=>{a.push(f),f.addErrorCaller(this,i)}),this.calledBySuccess.forEach(f=>{a.push(f),f.addSuccessCall(this,i)}),this.calledByError.forEach(f=>{a.push(f),f.addErrorCall(this,i)}),this.calledByEntry.forEach(f=>{a.push(f),f.addCall(this,i)}),this.parent.type===d.Project&&this.project.addCondition(this),i==null||i.attemptAutoclose(w.RestoreEntity,this.id),{added:C(r),updated:C(a),removed:C(c),affected:C(e),self:this})}toFlat(i=new Set){var a,c;return i.has(this.id)?[]:(i.add(this.id),[this,...((a=this.andChildrenGroup)==null?void 0:a.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 a,c;return i.has(this.id)?[]:(i.add(this.id),[this.id,...((a=this.andChildrenGroup)==null?void 0:a.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 r,a;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:((r=this.andChildrenGroup)==null?void 0:r.map(c=>c.toJSON(i)))||null,orChildrenGroup:((a=this.orChildrenGroup)==null?void 0:a.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=nt){var a,c,e,f,h,m,E;let r;return(a=i.seenEntityMaps)!=null&&a.has(this.id)?r=i.seenEntityMaps.get(this.id):(r=i.newId||Xr(this,this.project,i.uuidStrategy),i.seenEntityMaps&&i.seenEntityMaps.set(this.id,r)),(c=i.seenEntities)!=null&&c.has(r)||(e=i.seenEntities)!=null&&e.has(this.id)?this.toReference({seenEntityMaps:i.seenEntityMaps}):((f=i.seenEntities)==null||f.add(r),(h=i.seenEntities)==null||h.add(this.id),{id:r,version:N.UUID.uuid(),createdAt:i.timestamp||B().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:((m=this.andChildrenGroup)==null?void 0:m.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=nt){var a;let r=this.id;return(a=i.seenEntityMaps)!=null&&a.has(this.id)&&(r=i.seenEntityMaps.get(this.id)),{id:r+"--"+N.UUID.uuid()+"--ref",type:d.GenericReference,entityId:r,version:this.version,entityType:this.type}}toShallowJSON(i=nt){var a,c,e;let r=this.id;return(a=i.seenEntityMaps)!=null&&a.has(this.id)&&(r=i.seenEntityMaps.get(this.id)),{id:r,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(f=>f.toReference(i)))||null,orChildrenGroup:((e=this.orChildrenGroup)==null?void 0:e.map(f=>f.toReference(i)))||null,inputs:this.inputs.map(f=>f.toReference(i)),successCalls:this.successCalls.map(f=>f.toReference(i)),errorCalls:this.errorCalls.map(f=>f.toReference(i)),calledBySuccess:this.calledBySuccess.map(f=>f.toReference(i)),calledByError:this.calledByError.map(f=>f.toReference(i)),calledByEntry:this.calledByEntry.map(f=>f.toReference(i)),parent:this.parent.toReference(i)}}toFlatJSON(i=new Set){var a,c;return i.has(this.id)?[]:(i.add(this.id),[this.toShallowJSON(),...((a=this.andChildrenGroup)==null?void 0:a.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(i=nt){var c,e;const r=this.parent.type===d.Project?void 0:(c=i.seenEntityMaps)!=null&&c.has(this.parent.id)?i.seenEntityMaps.get(this.parent.id):this.parent.id;let a=this.id;return(e=i.seenEntityMaps)!=null&&e.has(this.id)&&(a=i.seenEntityMaps.get(this.id)),{id:a,type:this.type,declaration:this.declaration.id,calledByEntry:this.calledByEntry.map(f=>f.id),calledBySuccess:this.calledBySuccess.map(f=>f.id),calledByError:this.calledByError.map(f=>f.id),parent:r}}toFlatGenerationTarget(i=new Set){var a,c;return i.has(this.id)?[]:(i.add(this.id),[this.toGenerationTarget(),...((a=this.andChildrenGroup)==null?void 0:a.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,r;return this.errors=[],(i=this.andChildrenGroup)==null||i.forEach(a=>a.clearErrors()),(r=this.orChildrenGroup)==null||r.forEach(a=>a.clearErrors()),this.inputs.forEach(a=>a.clearErrors()),this.successCalls.forEach(a=>a.clearErrors()),this.errorCalls.forEach(a=>a.clearErrors()),this}validate(){return this.errors=b_e(this),{success:!0}}async validateAsync(i={}){const r=z.YieldTracker.from(i);return this.errors=await E_e(this,{tracker:r}),{success:!0}}getErrors(){return[...this.errors,...this.inputs.flatMap(r=>r.getErrors()),...this.andChildrenGroup?this.andChildrenGroup.flatMap(r=>r.getErrors()):[],...this.orChildrenGroup?this.orChildrenGroup.flatMap(r=>r.getErrors()):[]]}async getErrorsAsync(i={}){const r=z.YieldTracker.from(i),a=[...this.errors];await r.tick();for(const c of this.inputs){const e=await c.getErrorsAsync({tracker:r});a.push(...e)}if(await r.tick(),this.andChildrenGroup)for(const c of this.andChildrenGroup){const e=await c.getErrorsAsync({tracker:r});a.push(...e)}if(this.orChildrenGroup)for(const c of this.orChildrenGroup){const e=await c.getErrorsAsync({tracker:r});a.push(...e)}return a}getShallowErrors(){return this.errors}clone(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.CloneEntity)),r=null,a=null,c=!0){var L,j,k;const e=Br(r,this),f=this.toJSON(),h=a||N.UUID.uuid();f.inputs=[];const m=h.split("-id"),E=m[m.length-1||0]||h;f.id=h,f.version=N.UUID.uuid(),f.createdAt=(i==null?void 0:i.timestamp)||B().toISOString(),f.author=(i==null?void 0:i.author)||"1",f.previousVersion=null,f.deleted=!1,f.deletable=!0,f.editable=!0;const b=Yi(f,e);r?b.setParent(r,i):b.setParent(this.parent,null),c&&b.subscribe(),b.initChildren(i),i==null||i.add(b,W.Added);const g=(L=this.andChildrenGroup)==null?void 0:L.map(G=>G.clone(i,b,N.UUID.uuid(),c)),_=(j=this.orChildrenGroup)==null?void 0:j.map(G=>G.clone(i,b,N.UUID.uuid(),c));b.andChildrenGroup=g||null,b.orChildrenGroup=_||null;const $=(k=this.inputs)==null?void 0:k.map((G,H)=>G.clone(i,b,E+"-input-map-"+H+"-id",c));return b.inputs=$,i==null||i.attemptAutoclose(w.CloneEntity,this.id),b}addToAndGroup(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.AddToAndGroup))){return this.checkCanEdit(this,r)?(this.andChildrenGroup||(this.andChildrenGroup=[]),this.andChildrenGroup.includes(i)||(this.andChildrenGroup.push(i),r==null||r.add(i,W.Affected)),r==null||r.attemptAutoclose(w.AddToAndGroup,this.id),this):(z.Logger.warn(`[addToAndGroup] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.AddToAndGroup,this.id),this)}addToOrGroup(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.AddToOrGroup))){return this.checkCanEdit(this,r)?(this.orChildrenGroup||(this.orChildrenGroup=[]),this.orChildrenGroup.includes(i)||(this.orChildrenGroup.push(i),r==null||r.add(i,W.Affected)),r==null||r.attemptAutoclose(w.AddToOrGroup,this.id),this):(z.Logger.warn(`[addToOrGroup] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.AddToOrGroup,this.id),this)}removeUnrecognizedInputs(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.RemoveUnrecognizedInputs))){if(!this.checkCanEdit(this,i))return z.Logger.warn(`[removeUnrecognizedInputs] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(w.RemoveUnrecognizedInputs,this.id),{updated:[],added:[],removed:[],affected:[],self:this};const r=[],a=[],c=[],e=[];return this.inputs.forEach(h=>{if(!this.declaration.inputs.find(E=>{var b;return E.id===((b=h.declaration)==null?void 0:b.id)})){const E=h.remove({ignoreUpstream:!1},i);c.push(...E.removed),r.push(...E.updated)}}),this.inputs.filter((h,m)=>{const E=this.inputs.findIndex(g=>g.declaration===h.declaration&&g!==h);if(E===-1)return!1;const b=this.inputs[E];return B(b==null?void 0:b.createdAt).isSame(B(h.createdAt))?m>E:!!B(b==null?void 0:b.createdAt).isAfter(h.createdAt)}).forEach(h=>{const m=h.remove({ignoreUpstream:!1},i);c.push(...m.removed),r.push(...m.updated)}),i==null||i.attemptAutoclose(w.RemoveUnrecognizedInputs,this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}syncInputs(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.SyncInputs))){if(!this.checkCanEdit(this,i))return z.Logger.warn(`[syncInputs] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(w.SyncInputs,this.id),{updated:[],added:[],removed:[],affected:[],self:this};const r=[],a=[],c=[],e=[],f=this.declaration.inputs.filter(b=>b.parentRelationType===M.FixedArguments&&!this.inputs.find(g=>g.declaration.id===b.id));this.inputs.sort((b,g)=>b.index-g.index),f.forEach(b=>{this.inputs.forEach($=>{$.index>=b.index&&$.metaSync({index:$.index+1},i)});const g={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.InputMap,dataType:null,parentRelationType:null,declaration:b.toJSON(),readsValue:null,defaultValue:null,index:b.index,name:null,codeName:null,description:null,parent:this.toReference()},_=Ae(g,this.project);_.setParent(this,i),_.initChildren(i),i==null||i.add(_,W.Added),_.addSelfToProject(i)}),this.inputs.sort((b,g)=>b.index-g.index);const{updated:h,added:m,removed:E}=this.removeUnrecognizedInputs(i);return r.push(...h),a.push(...m),c.push(...E),i==null||i.attemptAutoclose(w.SyncInputs,this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(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,N.sessionAuthor,B().toISOString(),this,!0,"get-data-type"))){var a;const r=((a=this.declaration)==null?void 0:a.getDataType(i))||null;return i==null||i.attemptAutoclose("get-data-type",this.id),r}};R(xi,"repository",{APICreate:async(i,...r)=>i,APIUpdate:async(i,...r)=>i,APIDelete:async(i,...r)=>i,APIClone:async(i,...r)=>{},APILoad:async(i,...r)=>null,APILoadVersion:async(i,r,...a)=>null}),R(xi,"type",d.Condition),R(xi,"USER_MANAGED_PARENT_TYPES",[...vr,d.Project,d.Condition]),R(xi,"PARENT_TYPES",[...xi.USER_MANAGED_PARENT_TYPES]),R(xi,"MUTABLE_BASE_PROPERTIES",["operator"]),R(xi,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion","index"]),R(xi,"BASE_PROPERTIES",[...xi.MUTABLE_BASE_PROPERTIES,...xi.INMUTABLE_BASE_PROPERTIES]),R(xi,"MUTABLE_META_PROPERTIES",["x","y"]),R(xi,"INMUTABLE_META_PROPERTIES",[...xi.INMUTABLE_BASE_PROPERTIES]),R(xi,"META_PROPERTIES",[...xi.MUTABLE_META_PROPERTIES,...xi.INMUTABLE_META_PROPERTIES]),R(xi,"MUTABLE_UPSTREAM_PROPERTIES",["calledBySuccess","calledByError","calledByEntry","parent"]),R(xi,"INMUTABLE_UPSTREAM_PROPERTIES",[]),R(xi,"UPSTREAM_PROPERTIES",[...xi.MUTABLE_UPSTREAM_PROPERTIES,...xi.INMUTABLE_UPSTREAM_PROPERTIES]),R(xi,"MUTABLE_DOWNSTREAM_PROPERTIES",["andChildrenGroup","orChildrenGroup","successCalls","errorCalls","inputsDeclarations","inputs"]),R(xi,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),R(xi,"DOWNSTREAM_PROPERTIES",[...xi.MUTABLE_DOWNSTREAM_PROPERTIES,...xi.INMUTABLE_DOWNSTREAM_PROPERTIES]),R(xi,"PROPERTIES",[...xi.META_PROPERTIES,...xi.UPSTREAM_PROPERTIES,...xi.DOWNSTREAM_PROPERTIES]);let yp=xi;async function LAi(l,p={}){const i=z.YieldTracker.from(p),r=[],a=kt(l.errors,r);return await i.tick(),a}function BAi(l){const p=[];return kt(l.errors,p)}async function g_e(l,p={}){const i=z.YieldTracker.from(p),r=[],a=kt(l.errors,r);return await i.tick(),a}function I_e(l){const p=[];return kt(l.errors,p)}const MAi=Object.freeze(Object.defineProperty({__proto__:null,validate:I_e,validateAsync:g_e},Symbol.toStringTag,{value:"Module"}));function GAi(l,p){const i=[],r=[];if(l.parent)if(l.parent){const a=p.get(l.parent);a?Nr.USER_MANAGED_PARENT_TYPES.includes(a.type)||r.push(new Re({id:`${l.id}--${l.parent}--${he.InvalidParentReference}`,code:he.InvalidParentReference,severity:me.Error,message:`Entity of type "${l.type}" with id "${l.id}", has a parent reference which is of type ${a.type}, and therefore that isn't pointing to the following valid types for this reference: '${vt(Nr.USER_MANAGED_PARENT_TYPES,"', '","' or '")}'.`})):r.push(new Re({id:`${l.id}--${l.parent}--${he.ReferencedEntityNotFound}`,code:he.ReferencedEntityNotFound,severity:me.Error,message:`Entity of type "${l.type}" with id "${l.id}", is referencing an entity with id "${l.parent}" at 'parent' that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`}))}else r.push(new Re({id:`${l.id}--${we.InvalidObjectStructure}`,code:we.InvalidObjectStructure,severity:me.Error,message:`Entity of type "${l.type}" with id "${l.id}" is missing a 'parent' reference. The 'parent' of a literal value entity must be a reference to an entity of type '${vt(Nr.USER_MANAGED_PARENT_TYPES,"', '","', or '")}'.`}));else return r.push(new Re({id:`${l.id}--${we.InvalidObjectStructure}`,code:we.InvalidObjectStructure,severity:me.Error,message:`Entity of type "${l.type}" with id "${l.id}" is missing a 'parent' reference. The 'parent' of a literal value entity must be a reference to an entity of type '${vt(Nr.USER_MANAGED_PARENT_TYPES,"', '","', or '")}'.`})),{errors:r,explanations:i};if(l.valueAsTypeSingle){const a=[],c=[],e=l.valueAsTypeSingle;Array.isArray(e)?e.forEach(f=>{typeof f=="string"?c.push(f):a.push(f)}):typeof e=="string"?c.push(e):a.push(e),a.forEach(f=>{const h=N1(f);r.push(...h),h.length===0&&c.push(f.entityId)}),c.forEach(f=>{const h=p.get(f);h?[d.DefinitionEntity,d.BuiltInBaseEntity].includes(h.type)||r.push(new Re({id:`${l.id}--${f}--${he.InvalidImplementsReference}`,code:he.InvalidImplementsReference,severity:me.Error,message:`Entity of type "${l.type}" with id "${l.id}", has an 'valueAsTypeSingle' reference which is of type ${h.type}, and therefore that isn't pointing to the following valid types for this reference: 'definition-entity', 'function-declaration' or 'operation'.`})):r.push(new Re({id:`${l.id}--${f}--${he.ReferencedEntityNotFound}`,code:he.ReferencedEntityNotFound,severity:me.Error,message:`Entity of type "${l.type}" with id "${l.id}", is referencing an entity with id "${f}" at 'valueAsTypeSingle' that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`}))})}return{errors:r,explanations:i}}var R_e=(l=>(l.ValueAsTypeSingle="value-as-type-single",l.ValueAsTypeList="value-as-type-list",l))(R_e||{});const pi=class pi extends Qr{constructor(i,r){super(i);R(this,"initialData");R(this,"type",d.LiteralValue);R(this,"id");R(this,"name");R(this,"autogeneration",null);R(this,"value",null);R(this,"valueAsTypeSingle",null);R(this,"valueAsTypeList",null);R(this,"errors",[]);R(this,"parent");R(this,"standaloneParent");R(this,"project");R(this,"detachedDependents",{});R(this,"knownVersions",null);R(this,"activeVersion",!1);R(this,"initialized",!1);R(this,"startedInitialization",!1);R(this,"standalone",!1);if(this.initialData=i,this.project=r,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:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:(i==null?void 0:i.author)||N.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.LiteralValue,standaloneParent:null,name:"",autogeneration:null,value:null,valueAsTypeSingle:null,valueAsTypeList:null,parent:null}}static fromGenerationTarget(i,r){const a=X(i.parent),c=r.get(a);let e=null,f=null;i.valueAsTypeList?Array.isArray(i.valueAsTypeList)&&(f=i.valueAsTypeList.map(E=>r.get(E)||r.getBuiltIn(E))):i.valueAsTypeSingle&&(e=r.get(i.valueAsTypeSingle)||r.getBuiltIn(i.valueAsTypeSingle));const h={id:i.id,version:N.UUID.uuid(),createdAt:B().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.LiteralValue,standaloneParent:null,name:i.name,autogeneration:i.autogeneration,valueAsTypeSingle:e,valueAsTypeList:f,value:i.value||null,parent:c.toReference()},m=Ae(h,r);return m.setParent(c,null),m}static validateGenerationTarget(i,r){let a=JSON.parse(JSON.stringify(i));(a.valueAsTypeList||a.valueAsTypeSingle)&&(a.name=ye.EntityTemplate);const c=[],e=[],f=GAi(a,r),h=Zr(a);return e.push(...f.errors,...h.errors),c.push(...f.explanations,...h.explanations),{errors:e,explanations:c,modifiedData:a}}get valueAsType(){return this.valueAsTypeSingle?this.valueAsTypeSingle:this.valueAsTypeList?this.valueAsTypeList:null}get isFinal(){return!!(this.parent.type===d.Property&&(this.parent.constant||this.parent.implements.some(i=>i.constant))||this.parent.type===d.Property&&this.parent.parent.type===d.DefinitionEntity&&!tl(this.parent.parent))}validateGeneratedUpdate(i){const r=[],a=[];return i.parent&&r.push(new Re({id:`${this.id}--${he.InvalidParentUpdate}`,code:he.InvalidParentUpdate,severity:me.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.
|
|
49
49
|
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:r,explanations:a,modifiedData:i}}subscribeDependents(i){return i.forEach(r=>{this.detachedDependents[r.entity.id]||(this.detachedDependents[r.entity.id]=r)}),this}unsubscribeDependents(i){return i.forEach(r=>{this.detachedDependents[r.entity.id]&&delete this.detachedDependents[r.entity.id]}),this}syncDependents(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,"sync-dependents"))){const r=[],a=[],c=[],e=[];return Object.values(this.detachedDependents).forEach(f=>{const h=f.entity.afterAllChildrenInitialized(i);r.push(...h.updated),a.push(...h.added),c.push(...h.removed),e.push(...h.affected)}),i==null||i.attemptAutoclose("sync-dependents",this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}onDetachedDependencyRemoved(i,r,a){const c=[],e=[],f=[],h=[];return r==="value-as-type-single"&&(this.valueAsTypeSingle=null,a==null||a.add(this,W.Updated)),r==="value-as-type-list"&&(this.valueAsTypeList=(this.valueAsTypeList||[]).filter(m=>m.id!==i.id),a==null||a.add(this,W.Updated)),{updated:C(c),added:C(e),removed:C(f),affected:C(h),self:this}}onDetachedDependencyRestored(i,r,a){const c=[],e=[],f=[],h=[];return r==="value-as-type-single"&&(this.valueAsTypeSingle=i,a==null||a.add(this,W.Updated)),r==="value-as-type-list"&&(this.valueAsTypeList=[...Array.isArray(this.valueAsTypeList||[])?this.valueAsTypeList:[],i],a==null||a.add(this,W.Updated)),{updated:C(c),added:C(e),removed:C(f),affected:C(h),self:this}}unsubscribeFromDependencies(){return this.valueAsTypeSingle&&this.valueAsTypeSingle.type!==d.BuiltInBaseEntity&&this.valueAsTypeSingle.unsubscribeDependents([{entity:this,field:"value-as-type-single"}]),this.valueAsTypeList&&Array.isArray(this.valueAsTypeList)&&this.valueAsTypeList.forEach(i=>{i.type!==d.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!==d.BuiltInBaseEntity&&i.subscribeDependents([{entity:this,field:"value-as-type-list"}])}):this.valueAsTypeSingle&&this.valueAsTypeSingle.type!==d.BuiltInBaseEntity&&this.valueAsTypeSingle.subscribeDependents([{entity:this,field:"value-as-type-single"}]),this)}increaseVersion(i){if(i&&!B(i).isValid())throw new Error(`The shared timestamp '${i}' is not a valid ISO 8601 date string.`);return i&&B(i).isSame(B(this.createdAt))?this:(this.previousVersion=this.version,this.version=N.UUID.uuid(),this.createdAt=B(i).toISOString()||B().toISOString(),this)}captureVersion(){var r;const i=((r=this.knownVersions)==null?void 0:r.get(this.version))||new pi(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 r=[],a=[],c=[],e=[];if(this.parent){this.parent.increaseVersion(i);const f=this.parent.recursiveCaptureUpstreamVersions(i);r.push(this.parent,...f.updated),a.push(...f.added),c.push(...f.removed)}return{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}async restoreVersion(i){var h;const r=[],a=[],c=[],e=[];if(this.version===i)return{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this};if(!this.knownVersions){const m=new Map;for(const[E,b]of this.knownVersions||new Map){if(m.set(E,b),b.activeVersion=!1,b.knownVersions)for(const[g,_]of b.knownVersions)m.set(g,_);b.knownVersions=null}}let f=(h=this.knownVersions)==null?void 0:h.get(i);if(!f){const m=await this.APILoadVersion({},i);if(!m)throw new Error(`Version with id '${i}' for entity with id '${this.id}' not found.`);f=new pi(m,this.project)}return this.metaSync(f.toShallowJSON(),null),this.previousVersion=f.previousVersion,this.version=f.version,this.createdAt=f.createdAt,this.author=f.author,this.deleted=f.deleted,this.valueAsTypeSingle=f.valueAsTypeSingle,this.parent=f.parent,{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}updateWithShallowTransfer(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.UpdateWithShallowTransfer))){if(!this.checkCanEdit(this,r))return z.Logger.warn(`[updateWithShallowTransfer] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.UpdateWithShallowTransfer,this.id),this;if(this.metaSync(i,r),this.version=i.version,this.createdAt=i.createdAt,this.author=i.author,this.deleted=i.deleted,this.previousVersion=i.previousVersion,this.unsubscribeFromDependencies(),i.parent&&i.standaloneParent)throw new Error(`Entity with id '${this.id}' cannot have both 'parent' and 'standaloneParent' properties set.`);if(i.parent){const a=X(i.parent),c=this.project.get(a),e=this.parent;if(e&&e.id!==(c==null?void 0:c.id)&&this.removeFromParent(r),c)this.setParent(c,r),this.addSelfToProject(r);else throw new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${a}' that isn't found in the project`)}else if(i.standaloneParent){const a=X(i.standaloneParent),c=this.project.get(a);if(c)this.setStandaloneParent(c,r);else throw new Error(`${this.type} with id '${this.id}' has a 'standaloneParent' reference '${a}' 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(a=>{const c=X(a),e=this.project.get(c);e&&this.addValueAsTypeToList(e,r)}),[...this.valueAsTypeList].forEach(a=>{(i.valueAsTypeList||[]).find(e=>X(e)===a.id)||this.removeValueAsTypeFromList(a,r)}),this.setValueAsTypeSingle(null,r),this.metaSync({value:null},r);else if(i.valueAsTypeSingle){const a=X(i.valueAsTypeSingle),c=this.project.get(a);c&&(this.setValueAsTypeSingle(c,r),this.setValueAsTypeList(null,r),this.metaSync({value:null},r))}else this.setValueAsTypeSingle(null,r),this.setValueAsTypeList(null,r);return this.captureVersion(),this.subscribeToDependencies(),r==null||r.attemptAutoclose(w.UpdateWithShallowTransfer,this.id),this}updateWithGenerationTarget(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.UpdateWithGenerationTarget))){if(!this.checkCanEdit(this,r))return z.Logger.warn(`[updateWithGenerationTarget] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.UpdateWithGenerationTarget,this.id),this;if(this.metaSync(i,r),i.parent&&i.standaloneParent)throw new Error(`Entity with id '${this.id}' cannot have both 'parent' and 'standaloneParent' properties set.`);if(i.parent){const a=X(i.parent),c=this.project.get(a),e=this.parent;if(e&&e.id!==(c==null?void 0:c.id)&&this.removeFromParent(r),c)this.setParent(c,r),this.addSelfToProject(r);else throw new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${a}' that isn't found in the project`)}else if(i.standaloneParent){const a=X(i.standaloneParent),c=this.project.get(a);if(c)this.setStandaloneParent(c,r);else throw new Error(`${this.type} with id '${this.id}' has a 'standaloneParent' reference '${a}' that isn't found in the project`)}if(i.valueAsTypeList&&Array.isArray(i.valueAsTypeList))this.valueAsTypeList=this.valueAsTypeList||[],i.valueAsTypeList.forEach(a=>{const c=X(a),e=this.project.get(c);e&&this.addValueAsTypeToList(e,r)}),[...this.valueAsTypeList].forEach(a=>{(i.valueAsTypeList||[]).find(e=>X(e)===a.id)||this.removeValueAsTypeFromList(a,r)}),this.setValueAsTypeSingle(null,r),this.metaSync({value:null},r);else if(i.valueAsTypeSingle){const a=X(i.valueAsTypeSingle),c=this.project.get(a);c&&(this.setValueAsTypeSingle(c,r),this.setValueAsTypeList(null,r),this.metaSync({value:null},r))}return(i.valueAsTypeSingle===null||i.valueAsTypeList||i.value!==null&&i.value!==void 0)&&this.setValueAsTypeSingle(null,r),(i.valueAsTypeList===null||i.valueAsTypeSingle||i.value!==null&&i.value!==void 0)&&this.setValueAsTypeList(null,r),this.captureVersion(),this.subscribeToDependencies(),r==null||r.attemptAutoclose(w.UpdateWithGenerationTarget,this.id),this}hydrateAncestors(){const i=[],r=[],a=[],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=X(this.initialData.parent),f=this.project.get(e);if(z.Logger.log(`[LiteralValueState.hydrateAncestors] Hydrating parent reference '${e}' for entity with id '${this.id}'`),f)z.Logger.log(`[LiteralValueState.hydrateAncestors] Setting parent reference '${f.id}' for entity with id '${this.id}'`),this.setParent(f,null),i.push(f);else throw z.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=X(this.initialData.standaloneParent),f=this.project.get(e);if(z.Logger.log(`[LiteralValueState.hydrateAncestors] Hydrating standalone parent reference '${e}' for entity with id '${this.id}'`),f)z.Logger.log(`[LiteralValueState.hydrateAncestors] Setting standalone parent reference '${f.id}' for entity with id '${this.id}'`),this.setStandaloneParent(f,null);else throw z.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 z.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 f=X(e),h=this.project.get(f);h&&this.valueAsTypeList.push(h)});else if(this.initialData.valueAsTypeSingle){const e=X(this.initialData.valueAsTypeSingle),f=this.project.get(e);f&&(this.valueAsTypeSingle=f)}return{updated:C(i),added:C(r),removed:C(a),affected:C(c),self:this}}afterAllChildrenInitialized(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.AfterAllChildrenInitialized))){if(!this.checkCanEdit(this,i))return z.Logger.warn(`[afterAllChildrenInitialized] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(w.AfterAllChildrenInitialized,this.id),{updated:[],added:[],removed:[],affected:[],self:this};const r=[],a=[],c=[],e=[];return this.initialized=!0,this.captureVersion(),i==null||i.attemptAutoclose(w.AfterAllChildrenInitialized,this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}addSelfToProject(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,"add-self-to-project"))){var f,h;const r=[this],a=[],c=[],e=[];return((f=this.parent)==null?void 0:f.type)===d.DataType?this.parent.setEntity(this,i):(h=this.parent)==null||h.setDefaultValue(this,i),e.push(this.parent),this.subscribe(),this.subscribeToDependencies(),i==null||i.attemptAutoclose("add-self-to-project",this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}setParent(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.SetParent))){var a;return this.checkCanEditWithCounterpartAndSideEffects(this,i,w.SetParent,r)?(((a=this.parent)==null?void 0:a.id)!==(i==null?void 0:i.id)&&(this.parent=i,r&&(r==null||r.add(this,W.Updated))),r==null||r.attemptAutoclose(w.SetParent,this.id),this):this}setStandaloneParent(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.SetStandaloneParent))){var a;return this.checkCanEditWithCounterpartAndSideEffects(this,i,w.SetStandaloneParent,r)?(((a=this.standaloneParent)==null?void 0:a.id)!==(i==null?void 0:i.id)&&(this.standaloneParent=i,r&&(r==null||r.add(this,W.Updated))),r==null||r.attemptAutoclose(w.SetStandaloneParent,this.id),this):this}addValueAsTypeToList(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.AddValueAsTypeToList))){return this.checkCanEdit(this,r)?((this.valueAsTypeList||[]).includes(i)||(this.valueAsTypeList=this.valueAsTypeList||[],this.valueAsTypeList.push(i),this.value!==null&&this.metaSync({value:null},r),this.valueAsTypeSingle!==null&&(this.valueAsTypeSingle=null,r==null||r.add(this,W.Updated)),r==null||r.add(this,W.Updated)),r==null||r.attemptAutoclose(w.AddValueAsTypeToList,this.id),this):(z.Logger.warn(`[addValueAsTypeToList] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.AddValueAsTypeToList,this.id),this)}removeValueAsTypeFromList(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.RemoveValueAsTypeFromList))){return this.checkCanEdit(this,r)?(this.valueAsTypeList&&Array.isArray(this.valueAsTypeList)&&(this.valueAsTypeList||[]).includes(i)&&(this.valueAsTypeList=this.valueAsTypeList.filter(a=>a.id!==i.id),this.valueAsTypeList.length===0?this.valueAsTypeList=null:(this.value!==null&&this.metaSync({value:null},r),this.valueAsTypeSingle!==null&&(this.valueAsTypeSingle=null,r==null||r.add(this,W.Updated))),r==null||r.add(this,W.Updated)),r==null||r.attemptAutoclose(w.RemoveValueAsTypeFromList,this.id),this):(z.Logger.warn(`[removeValueAsTypeFromList] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.RemoveValueAsTypeFromList,this.id),this)}setValueAsTypeSingle(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.SetValueAsTypeSingle))){return this.checkCanEdit(this,r)?(this.valueAsTypeSingle!==i&&(this.valueAsTypeSingle=i,r==null||r.add(this,W.Updated)),r==null||r.attemptAutoclose(w.SetValueAsTypeSingle,this.id),this):(z.Logger.warn(`[setValueAsTypeSingle] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.SetValueAsTypeSingle,this.id),this)}setValueAsTypeList(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.SetValueAsTypeList))){var a,c;return this.checkCanEdit(this,r)?(!i&&this.valueAsTypeList?(this.valueAsTypeList=null,r==null||r.add(this,W.Updated)):i&&!this.valueAsTypeList?(this.valueAsTypeList=i,r==null||r.add(this,W.Updated)):i&&this.valueAsTypeList&&((a=this.valueAsTypeList)==null?void 0:a.length)!==i.length?(this.valueAsTypeList=i,r==null||r.add(this,W.Updated)):i&&this.valueAsTypeList&&((c=this.valueAsTypeList)!=null&&c.every((e,f)=>e!==i[f]))&&(this.valueAsTypeList=i,r==null||r.add(this,W.Updated)),r==null||r.attemptAutoclose(w.SetValueAsTypeList,this.id),this):(z.Logger.warn(`[setValueAsTypeList] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.SetValueAsTypeList,this.id),this)}setValueAsType(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.SetValueAsType))){return this.checkCanEdit(this,r)?i?(Array.isArray(i)?this.setValueAsTypeList(i,r):this.setValueAsTypeSingle(i,r),r==null||r.attemptAutoclose(w.SetValueAsType,this.id),this):(this.setValueAsTypeSingle(null,r),this.setValueAsTypeList(null,r),this):(z.Logger.warn(`[setValueAsType] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.SetValueAsType,this.id),this)}initChildren(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().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(r=>{if(r.type===d.GenericReference){const c=this.project.findSubscribedBuiltInInstanceFromReference(r);if(!c)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${r.entityType}' with id '${r.entityId}' that is not part of the project state.`);return c}const a=this.project.get(r.id);if(!a)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${r.type}' with id '${r.id}' that is not part of the project state.`);return a});else if(this.initialData.valueAsTypeSingle){if(this.initialData.valueAsTypeSingle.type===d.GenericReference){const a=this.project.findSubscribedBuiltInInstanceFromReference(this.initialData.valueAsTypeSingle);if(!a)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=a,this}const r=this.project.get(this.initialData.valueAsTypeSingle.id);if(!r)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=r}return this}if(this.initialData.valueAsTypeList&&Array.isArray(this.initialData.valueAsTypeList))this.valueAsTypeList=this.initialData.valueAsTypeList.map(r=>{if(r.type===d.GenericReference){const c=this.project.findSubscribedBuiltInInstanceFromReference(r);if(!c)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${r.entityType}' with id '${r.entityId}' that is not part of the project state.`);return c}const a=this.project.get(r.id);if(!a)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${r.type}' with id '${r.id}' that is not part of the project state.`);return a});else if(this.initialData.valueAsTypeSingle){if(this.initialData.valueAsTypeSingle.type===d.GenericReference){const a=X(this.initialData.valueAsTypeSingle),c=a?this.project.get(a):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 r=this.project.get(this.initialData.valueAsTypeSingle.id);if(!r)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=r}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,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,"meta-sync"))){const a=Wr(this,i,r),c=Hr(this,a),e=this.toMeta();return this.name=a.name!==void 0?a.name:e.name,this.autogeneration=a.autogeneration!==void 0?a.autogeneration:e.autogeneration,this.value=a.value!==void 0?a.value:e.value,super.baseMetaSync(a,this,r),a.deleted===!0&&!e.deleted?r==null||r.add(this,W.Removed):a.deleted===!1&&e.deleted?r==null||r.add(this,W.Added):c&&(r==null||r.add(this,W.Updated)),r==null||r.attemptAutoclose("meta-sync",this.id),this}async APILoad(i=Se,...r){return await pi.repository.APILoad(this.id,...r),this}async APICreate(i=Se,...r){return await pi.repository.APICreate(this.toShallowJSON(),...r),this}async APIUpdate(i=Se,...r){return await pi.repository.APIUpdate(this.toShallowJSON(),...r),this}async APIDelete(i=Se,...r){return await pi.repository.APIDelete(this.toShallowJSON(),...r),this}async APIClone(i=Se,...r){return await pi.repository.APIClone(this.id,...r),this}async APILoadVersion(i=Se,r,...a){return await pi.repository.APILoadVersion(this.id,r,...a)}removeFromParent(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.RemoveFromParent))){if(!this.checkCanEdit(this,i))return z.Logger.warn(`[removeFromParent] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(w.RemoveFromParent,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const r=[],a=[],c=[],e=[];return this.parent&&(this.parent.type===d.DataType?this.parent.setEntity(null,i):Zg.includes(this.parent.type)&&this.parent.setDefaultValue(null,i),e.push(this.parent)),i==null||i.attemptAutoclose(w.RemoveFromParent,this.id),{added:C(c),updated:C(r),removed:C(a),affected:C(e),self:this}}remove({ignoreUpstream:i}={ignoreUpstream:!1},r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.RemoveEntity))){var h;if(!this.checkCanDelete(this,r))return z.Logger.warn(`[remove] User is not allowed to delete or edit this ${this.type} entity with id: ${this.id}`),r==null||r.event({id:`${w.RemoveEntity}-${this.id}--${Be.ActionOwnerEntityNonDeletable}`,action:w.RemoveEntity,owner:this,errorReason:Be.ActionOwnerEntityNonDeletable,rootAction:((h=r==null?void 0:r.self)==null?void 0:h.id)===this.id&&(r==null?void 0:r.autoCloseActionName)===w.RemoveEntity}),r==null||r.attemptAutoclose(w.RemoveEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const a=[],c=[],e=[],f=[];if(r!=null&&r.hasRemoved(this.id))return r==null||r.attemptAutoclose(w.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},r),Object.values(this.detachedDependents).forEach(m=>{const{updated:E,removed:b,added:g}=m.entity.onDetachedDependencyRemoved(this,m.field,r);a.push(...E),c.push(...b),e.push(...g)}),!i){const m=this.removeFromParent(r);e.push(...m.added),a.push(...m.updated),c.push(...m.removed),f.push(...m.affected)}return r==null||r.attemptAutoclose(w.RemoveEntity,this.id),{added:C(e),updated:C(a),removed:C(c),affected:C(f),self:this}}restore({}={},i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.RestoreEntity))){if(!this.checkCanEdit(this,i))return z.Logger.warn(`[restore] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(w.RestoreEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const r=[],a=[],c=[],e=[];return i!=null&&i.hasAdded(this.id)?(i==null||i.attemptAutoclose(w.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(f=>{const{updated:h,removed:m,added:E}=f.entity.onDetachedDependencyRestored(this,f.field,i);a.push(...h),c.push(...m),r.push(...E)}),i==null||i.attemptAutoclose(w.RestoreEntity,this.id),{added:C(r),updated:C(a),removed:C(c),affected:C(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(a=>a.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(a=>a.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 r,a,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:((r=this.valueAsTypeSingle)==null?void 0:r.toJSON(i))||null,valueAsTypeList:Array.isArray(this.valueAsTypeSingle)?this.valueAsTypeSingle.map(e=>e.toJSON(i)):null,parent:(a=this.parent)==null?void 0:a.toReference(),standaloneParent:(c=this.standaloneParent)==null?void 0:c.toReference()})}toJSONClone(i=nt){var a,c,e,f,h,m,E;let r;return(a=i.seenEntityMaps)!=null&&a.has(this.id)?r=i.seenEntityMaps.get(this.id):(r=i.newId||Xr(this,this.project,i.uuidStrategy),i.seenEntityMaps&&i.seenEntityMaps.set(this.id,r)),(c=i.seenEntities)!=null&&c.has(r)||(e=i.seenEntities)!=null&&e.has(this.id)?this.toReference({seenEntityMaps:i.seenEntityMaps}):((f=i.seenEntities)==null||f.add(r),(h=i.seenEntities)==null||h.add(this.id),{id:r,version:N.UUID.uuid(),createdAt:i.timestamp||B().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:(m=this.parent)==null?void 0:m.toReference({seenEntityMaps:i.seenEntityMaps}),standaloneParent:(E=this.standaloneParent)==null?void 0:E.toReference({seenEntityMaps:i.seenEntityMaps})})}toReference(i=nt){var a;let r=this.id;return(a=i.seenEntityMaps)!=null&&a.has(this.id)&&(r=i.seenEntityMaps.get(this.id)),{id:r+"--"+N.UUID.uuid()+"--ref",type:d.GenericReference,entityId:r,version:this.version,entityType:this.type}}toShallowJSON(i=nt){var a,c,e,f;let r=this.id;return(a=i.seenEntityMaps)!=null&&a.has(this.id)&&(r=i.seenEntityMaps.get(this.id)),{id:r,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(h=>h.toReference(i)):null,value:this.value,autogeneration:this.autogeneration,parent:(e=this.parent)==null?void 0:e.toReference(i),standaloneParent:(f=this.standaloneParent)==null?void 0:f.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(a=>a.toFlatJSON(i)):[]])}toGenerationTarget(i=nt){var a,c,e,f;let r=this.id;return(a=i.seenEntityMaps)!=null&&a.has(this.id)&&(r=i.seenEntityMaps.get(this.id)),{id:r,type:this.type,name:this.name,valueAsTypeSingle:((c=this.valueAsTypeSingle)==null?void 0:c.id)||null,valueAsTypeList:Array.isArray(this.valueAsTypeSingle)?this.valueAsTypeSingle.map(h=>h.id):null,value:this.value,autogeneration:this.autogeneration,parent:(e=this.parent)==null?void 0:e.id,standaloneParent:(f=this.standaloneParent)==null?void 0:f.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(a=>a.toFlatGenerationTarget(i)):[]])}clearErrors(){return this.errors=[],this}validate(){return this.errors=I_e(this),{success:!0}}async validateAsync(i={}){const r=z.YieldTracker.from(i);return this.errors=await g_e(this,{tracker:r}),{success:!0}}getErrors(){return[...this.errors]}async getErrorsAsync(i={}){const r=z.YieldTracker.from(i),a=[...this.errors];return await r.tick(),a}getShallowErrors(){return this.errors}clone(i=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,w.CloneEntity)),r=null,a=null,c=!0){const e=Br(r,this),f=this.toJSON(),h=a||N.UUID.uuid();f.id=h,f.version=N.UUID.uuid(),f.createdAt=(i==null?void 0:i.timestamp)||B().toISOString(),f.author=(i==null?void 0:i.author)||"1",f.previousVersion=null,f.deleted=!1,f.editable=!0,f.deletable=!0;const m=Yi(f,e);return m.hydrateAncestors(),r&&m.setParent(r,i),c&&(m.subscribe(),m.addSelfToProject(i)),i==null||i.add(m,W.Added),m.initChildren(i),i==null||i.attemptAutoclose(w.CloneEntity,this.id),m}merge(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),this,!0,"merge-literal-value"))){const a=[],c=[],e=[],f=[];return this.valueAsTypeSingle!==(i==null?void 0:i.valueAsTypeSingle)&&(this.setValueAsType(i.valueAsTypeSingle,r),a.push(this)),this.valueAsTypeList!==i.valueAsTypeList&&(this.setValueAsTypeList(i.valueAsTypeList,r),a.push(this)),this.value!==i.value&&(this.metaSync({value:i.value},r),a.push(this)),this.autogeneration!==i.autogeneration&&(this.metaSync({autogeneration:i.autogeneration},r),a.push(this)),this.name!==i.name&&(this.metaSync({name:i.name},r),a.push(this)),r==null||r.attemptAutoclose("merge-literal-value",this.id),{updated:C(a),added:C(c),removed:C(e),affected:C(f),self:this}}};R(pi,"repository",{APICreate:async(i,...r)=>i,APIUpdate:async(i,...r)=>i,APIDelete:async(i,...r)=>i,APIClone:async(i,...r)=>{},APILoad:async(i,...r)=>null,APILoadVersion:async(i,r,...a)=>null}),R(pi,"type",d.LiteralValue),R(pi,"USER_MANAGED_PARENT_TYPES",[d.DataType,d.InputMap,d.Property,d.ArgumentDeclaration,d.ReturnStatement,d.BreakStatement,d.ContinueStatement,d.VariableDeclaration,d.VariableInstance,d.ValueDescriptor]),R(pi,"USER_MANAGED_STANDALONE_PARENT_TYPES",[...qg]),R(pi,"PARENT_TYPES",[...pi.USER_MANAGED_PARENT_TYPES]),R(pi,"MUTABLE_BASE_PROPERTIES",["name","autogeneration","value"]),R(pi,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),R(pi,"BASE_PROPERTIES",[...pi.MUTABLE_BASE_PROPERTIES,...pi.INMUTABLE_BASE_PROPERTIES]),R(pi,"MUTABLE_META_PROPERTIES",[...pi.MUTABLE_BASE_PROPERTIES]),R(pi,"INMUTABLE_META_PROPERTIES",[...pi.INMUTABLE_BASE_PROPERTIES]),R(pi,"META_PROPERTIES",[...pi.MUTABLE_META_PROPERTIES,...pi.INMUTABLE_META_PROPERTIES]),R(pi,"MUTABLE_UPSTREAM_PROPERTIES",["valueAsTypeSingle","valueAsTypeList"]),R(pi,"INMUTABLE_UPSTREAM_PROPERTIES",["parent"]),R(pi,"UPSTREAM_PROPERTIES",[...pi.MUTABLE_UPSTREAM_PROPERTIES,...pi.INMUTABLE_UPSTREAM_PROPERTIES]),R(pi,"MUTABLE_DOWNSTREAM_PROPERTIES",[]),R(pi,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),R(pi,"DOWNSTREAM_PROPERTIES",[...pi.MUTABLE_DOWNSTREAM_PROPERTIES,...pi.INMUTABLE_DOWNSTREAM_PROPERTIES]),R(pi,"PROPERTIES",[...pi.META_PROPERTIES,...pi.UPSTREAM_PROPERTIES,...pi.DOWNSTREAM_PROPERTIES]);let Nr=pi;function Bf(l){if(typeof crypto<"u"&&typeof crypto.getRandomValues=="function"){const i=new Uint8Array(l);return crypto.getRandomValues(i),i}const{randomBytes:p}=require("crypto");return p(l)}function D_e(l,p){const i=p-l+1,a=zR()*i;return Math.floor(a)+l}function w_e(){const l=Bf(4);return(l[0]<<24|l[1]<<16|l[2]<<8|l[3])>>>0}function zR(){return w_e()/2**32}function Tx(l){const p=Bf(l);return Array.from(p).map(i=>i.toString(16).padStart(2,"0")).join("")}const c_="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";function vx(l){let p="";const i=Bf(l);for(let r=0;r<l;r++)p+=c_[i[r]%c_.length];return p}function C_e(l){const p=Bf(l);let i;if(typeof Buffer<"u")i=Buffer.from(p).toString("base64");else{const r=String.fromCharCode(...p);i=btoa(r)}return i.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Ex(l){return vx(l)}function bx(l,p=c_){let i="";const r=Bf(l);for(let a=0;a<l;a++)i+=p[r[a]%p.length];return i}function np(){const l=Bf(16);l[6]=l[6]&15|64,l[8]=l[8]&63|128;const p=Array.from(l).map(i=>i.toString(16).padStart(2,"0")).join("");return[p.slice(0,8),p.slice(8,12),p.slice(12,16),p.slice(16,20),p.slice(20,32)].join("-")}function O_e(){return bx(6)}function __e(){return Tx(32)}const jAi=63,UAi=/^[a-z][a-z0-9-]*[a-z0-9]$/;function kAi(l){return l.length>=1&&l.length<=jAi&&UAi.test(l)&&!l.includes("--")}function*FAi(){yield"";const l="abcdefghijklmnopqrstuvwxyz";for(let p=1;;p++){const i=new Array(p).fill(0);let r=!1;for(;!r;){yield i.map(a=>l[a]).join("");for(let a=p-1;a>=0&&(i[a]++,!(i[a]<l.length));a--)i[a]=0,a===0&&(r=!0)}}}function KAi(l,p){const i=new Set(l.map(a=>a.toLowerCase())),r=p>0?"secondary-db":"main";for(const a of FAi()){const c=a?`${r}-${a}`:r;if(kAi(c)&&!i.has(c))return c}throw new Error("Unable to generate identifier")}function V_e(l,p){switch(l.id){case re["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.id:{const i=l.project.entities.filter(h=>!!h.implements.find(m=>m.id===re["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id)),r=i.find(h=>{const m=h.properties.find(g=>g.implements.find(_=>_.id===re["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id)),E=m==null?void 0:m.getDefaultValue();return(E==null?void 0:E.value)===!0});if(!r&&i.length){const m=i[0].properties.find(b=>b.implements.find(g=>g.id===re["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id)),E=m==null?void 0:m.defaultValue;if(E)E.metaSync({value:!0},p);else if(m!=null&&m.dataType){const b={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(p==null?void 0:p.timestamp)||new Date().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.LiteralValue,standaloneParent:null,name:ye.EntityTemplate,autogeneration:null,value:!0,valueAsTypeSingle:null,valueAsTypeList:null,parent:m==null?void 0:m.toReference()},g=Ae(b,l.project);return g.setParent(m,p),g.initChildren(p),p==null||p.add(g,W.Added),g.addSelfToProject(p),{newEntities:[g]}}return{newEntities:[]}}else if(r)return{newEntities:[]};const a=l.project.get(re["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id),c=YR(a,"Main database",p);if(c.errors.length>0)return{newEntities:[]};const e=c.properties.find(h=>h.implements.find(m=>m.id===re["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id)),f=e==null?void 0:e.defaultValue;if(f)f.metaSync({value:!0},p);else if(e!=null&&e.dataType){const h={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(p==null?void 0:p.timestamp)||new Date().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.LiteralValue,standaloneParent:null,name:ye.EntityTemplate,autogeneration:null,value:!0,valueAsTypeSingle:null,valueAsTypeList:null,parent:e==null?void 0:e.toReference()},m=Ae(h,l.project);m.setParent(e,p),m.initChildren(p),p==null||p.add(m,W.Added),m.addSelfToProject(p)}return{newEntities:[c]}}}return{newEntities:[]}}function P_e(l,p){const i=[],r=[],a=[],c=[];return l.implements.filter(f=>f.type===d.BuiltInBaseEntity).forEach(f=>{var h,m,E,b,g;switch(f.id){case re["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.id:{const _=l.project.entities.filter(G=>G.implements.find(H=>H.id===re["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id));let $=_.find(G=>!!G.properties.find(H=>{var ie;return H.implements.find(ee=>ee.id===re["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id)&&((ie=H.getDefaultValue())==null?void 0:ie.value)===!0}));if(!$&&_.length)$=_[0];else if(!$&&!_.length){$=l.project.getBuiltIn(re["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id).implement("Relational database",p);const H=$.properties.find(ie=>ie.implements.find(ee=>ee.id===re["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id));(h=H==null?void 0:H.defaultValue)==null||h.metaSync({value:!0},p),r.push($)}const L=l.properties.find(G=>G.implements.find(H=>H.id===re["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.properties.database.id));if(L&&!(L!=null&&L.defaultValue)){const G={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(p==null?void 0:p.timestamp)||new Date().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.LiteralValue,standaloneParent:null,name:ye.EntityTemplate,autogeneration:null,value:null,valueAsTypeSingle:($==null?void 0:$.toJSON())||null,valueAsTypeList:null,parent:L==null?void 0:L.toReference()},H=Ae(G,l.project);H.hydrateAncestors(),H.setParent(L,p),H.addSelfToProject(p),p==null||p.add(H,W.Added),H.initChildren(p),(L==null?void 0:L.defaultValue).setValueAsTypeSingle($||null,p),r.push(H);return}else L!=null&&L.defaultValue&&!(L!=null&&L.defaultValue.valueAsTypeSingle)&&(L==null||L.defaultValue.setValueAsTypeSingle($||null,p));const j=l.properties.find(G=>G.implements.find(H=>H.id===re["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.properties.primaryKey.id));if(!j)throw new Error(`[handleAfterEntityImplementationSideEffects] Primary key property not found for implemented base entity ${re["built-in-base-entity"]}`);if(!j.dataType){const G=mr.new(p);G.parent=j.toReference();const H=Ae(G,l.project);H.hydrateAncestors(),H.setParent(j,p),H.addSelfToProject(p),p==null||p.add(H,W.Added),H.initChildren(p)}const k=l.project.getBuiltIn(re["primitive-entity"].number.id);(m=j.dataType)==null||m.setEntity(k,p);return}case re["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id:{const _=l.project.entities.filter(ie=>ie.implements.find(ee=>ee.id===re["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id)&&ie.id!==l.id),$=_.map(ie=>{var ae;const ee=ie.properties.find(de=>de.implements.find(ce=>ce.id===re["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.identifier.id));return(ae=ee==null?void 0:ee.getDefaultValue())==null?void 0:ae.value}).filter(ie=>!!ie),L=l.properties.find(ie=>ie.implements.find(ee=>ee.id===re["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.identifier.id));if(!_.find(ie=>!!ie.properties.find(ee=>{var ue;return ee.implements.find(ae=>ae.id===re["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id)&&((ue=ee.getDefaultValue())==null?void 0:ue.value)===!0}))){const ie=l.properties.find(ee=>ee.implements.find(ue=>ue.id===re["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id));if(!ie)throw new Error("Default boolean property not found for relational database entity with id: "+l.id);if(!(ie!=null&&ie.defaultValue)){const ee=Nr.new(p);ee.parent=ie.toReference();const ue=Ae(ee,l.project);ue.hydrateAncestors(),ue.setParent(ie,p),ue.addSelfToProject(p),p==null||p.add(ue,W.Added),ue.initChildren(p)}(E=ie==null?void 0:ie.defaultValue)==null||E.metaSync({value:!0},p)}if(!L)throw new Error("Identifier property not found for relational database entity with id: "+l.id);if(!(L!=null&&L.defaultValue)){const ie=Nr.new(p);ie.parent=L.toReference();const ee=Ae(ie,l.project);ee.hydrateAncestors(),ee.setParent(L,p),ee.addSelfToProject(p),ee.initChildren(p),p==null||p.add(ee,W.Added)}const k=KAi($,_.length);(b=L.defaultValue)==null||b.metaSync({value:k},p);const G=l.properties.find(ie=>ie.implements.find(ee=>ee.id===re["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.password.id));if(!G)throw new Error(`[handleAfterEntityImplementationSideEffects] Password property not found for implemented base entity ${re["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id} with id ${l.id}`);if(!G.defaultValue){const ie=Nr.new(p);ie.parent=G.toReference();const ee=Ae(ie,l.project);ee.hydrateAncestors(),ee.setParent(G,p),ee.addSelfToProject(p),ee.initChildren(p),p==null||p.add(ee,W.Added),r.push(ee)}const H=Ex(24);(g=G.defaultValue)==null||g.metaSync({value:H},p);return}case re["built-in-base-entity"].BUILT_IN_SQL_ROW_TRANSFORMER_ENTITY.id:{const _=l.properties.find(k=>k.implements.find(G=>G.id===re["built-in-base-entity"].BUILT_IN_SQL_ROW_TRANSFORMER_ENTITY.properties.time.id));if(!_)throw new Error(`[handleAfterEntityImplementationSideEffects] Time property not found for implemented base entity ${re["built-in-base-entity"].BUILT_IN_SQL_ROW_TRANSFORMER_ENTITY.id} with id ${l.id}`);let $=_.defaultValue||null;if(!$){const k=Nr.new(p);k.parent=_.toReference(),k.name=ye.Date,k.id=N.UUID.uuid(),$=Ae(k,l.project),$.hydrateAncestors(),$.setParent(_,p),$.addSelfToProject(p),$.initChildren(p),p==null||p.add($,W.Added)}$.metaSync({value:new Date().toISOString()},p),$.metaSync({editable:!1,deletable:!1},p),_.metaSync({editable:!1,deletable:!1},p);const L=l.properties.find(k=>k.implements.find(G=>G.id===re["built-in-base-entity"].BUILT_IN_SQL_ROW_TRANSFORMER_ENTITY.properties.definition.id));if(!L)throw new Error(`[handleAfterEntityImplementationSideEffects] Definition property not found for implemented base entity ${re["built-in-base-entity"].BUILT_IN_SQL_ROW_TRANSFORMER_ENTITY.id} with id ${l.id}`);let j=L.defaultValue||null;if(!j){const k=Nr.new(p);k.name=ye.EntityTemplate,k.parent=L.toReference(),k.id=N.UUID.uuid(),j=Ae(k,l.project),j.hydrateAncestors(),j.setParent(L,p),j.addSelfToProject(p),j.initChildren(p),p==null||p.add(j,W.Added)}}}}),{self:l,updated:C(i),added:C(r),removed:C(a),affected:C(c)}}function YR(l,p,i,r){const a=r||N.UUID.uuid(),c=Ds.new(i);c.id=a,c.name=p,c.static=l.static,c.implements=[l.toJSON()],c.parent=l.project.toReference(),c.static=l.static,V_e(l,i);const e=Ae(c,l.project);return e.hydrateAncestors(),i==null||i.add(e,W.Added),e.addSelfToProject(i),e.initChildren(i),P_e(e,i),e.afterAllChildrenInitialized(i),e}function Ax(l,p){return p.entities.find(a=>{const c=a.properties,e=c.map(b=>b.name),f=l.every(b=>e.includes(b)),h=e.filter(b=>!l.includes(b)),m=c.every(b=>!h.includes(b.name)||!b.required);return f&&m})||null}function N_e(l,p,i,r=We.OrDataTypeGroup){const a=[],c=[],e=[],f=[],h=N.UUID.uuid(),m=mr.new(i);m.id=h,m.parent=p.toReference(),m.like=!0,m.parentRelationType=r;const E=Ae(m,l.project);return c.push(E),E.setParent(p,i),E.initChildren(i),i==null||i.add(E,W.Added),E.setEntity(l,i),E.addSelfToProject(i),{updated:C(a),added:C(c),removed:C(e),affected:C(f),self:E}}function gx(l,p,i,r,a){var m,E,b,g,_,$,L,j;const c=[],e=[],f=[],h=[];switch(typeof l){case"string":let k=!1;const G=new Date(l);if(G instanceof Date&&!isNaN(G.valueOf())&&(k=!0),k){const H=p.project.getBuiltIn(re[d.PrimitiveEntity][ye.Date].id);p.setEntity(H,r);break}else{const H=p.project.getBuiltIn(re[d.PrimitiveEntity][ye.String].id);p.setEntity(H,r);break}case"number":p.setEntity(p.project.getBuiltIn(re[d.PrimitiveEntity][ye.Number].id),r);break;case"boolean":p.setEntity(p.project.getBuiltIn(re[d.PrimitiveEntity][ye.Boolean].id),r);break;case"object":if(l===null){p.setEntity(p.project.getBuiltIn(re[d.PrimitiveEntity][ye.Null].id),r);break}else if(Array.isArray(l))if(p.metaSync({isList:!0},r),l.length>0){const H=l.slice(0,5).filter(ee=>ee!==void 0);if(H.every(ee=>typeof ee==typeof H[0])&&(typeof H[0]!="object"||H[0]===null))switch(typeof H[0]){case"string":p.setEntity(p.project.getBuiltIn(re[d.PrimitiveEntity][ye.String].id),r);break;case"number":p.setEntity(p.project.getBuiltIn(re[d.PrimitiveEntity][ye.Number].id),r);break;case"boolean":p.setEntity(p.project.getBuiltIn(re[d.PrimitiveEntity][ye.Boolean].id),r);break;case"object":p.setEntity(p.project.getBuiltIn(re[d.PrimitiveEntity][ye.Null].id),r);break}else{const ee=[];let ue=!1;H.forEach(de=>{var ce,ne,le,Q;if(Array.isArray(de)&&(ue=!0),typeof de=="object"&&!Array.isArray(de)&&de!==null){const oe=UA(de,p.project,{...i,id:N.UUID.uuid()},r,a);oe.hasCreated&&ee.push((ce=oe.changeSet)==null?void 0:ce.self),c.push(...(ne=oe.changeSet)==null?void 0:ne.updated),e.push(...(le=oe.changeSet)==null?void 0:le.added),f.push(...(Q=oe.changeSet)==null?void 0:Q.removed)}});const ae=C(ee);if(!ae.length&&!ue){H.forEach(de=>{const ce=mr.new(r);ce.parentRelationType=We.OrDataTypeGroup,ce.parent=p.toReference();const ne=Ae(ce,p.project);switch(ne.setParent(p,r),ne.initChildren(r),r==null||r.add(ne,W.Added),ne.addSelfToProject(r),typeof de){case"string":ne.setEntity(ne.project.getBuiltIn(re[d.PrimitiveEntity][ye.String].id),r);break;case"number":ne.setEntity(ne.project.getBuiltIn(re[d.PrimitiveEntity][ye.Number].id),r);break;case"boolean":ne.setEntity(ne.project.getBuiltIn(re[d.PrimitiveEntity][ye.Boolean].id),r);break;case"object":ne.setEntity(ne.project.getBuiltIn(re[d.PrimitiveEntity][ye.Null].id),r);break}});break}else ae.length===1&&!ue?p.setEntity(ae[0],r):H.forEach(de=>{if(typeof de=="object"&&!Array.isArray(de)&&de!==null){const ce=Ax(Object.keys(de),p.project);if(ce){const ne=N_e(ce||ae[0],p,r,We.OrDataTypeGroup);c.push(...ne.updated),e.push(...ne.added),f.push(...ne.removed)}}else{const ce=mr.new(r);ce.parentRelationType=We.OrDataTypeGroup,ce.parent=p.toReference();const ne=Ae(ce,p.project);ne.setParent(p,r),ne.initChildren(r),r==null||r.add(ne,W.Added),ne.addSelfToProject(r);const le=gx(de,ne,{...i,id:N.UUID.uuid()},r,a);c.push(...le.updated),e.push(...le.added),f.push(...le.removed)}})}}else{const H=UA(l[0],p.project,{...i},r,a);p.setEntity((m=H.changeSet)==null?void 0:m.self,r),c.push(...(E=H.changeSet)==null?void 0:E.updated),e.push(...(b=H.changeSet)==null?void 0:b.added),f.push(...(g=H.changeSet)==null?void 0:g.removed);break}else{const H=UA(l,p.project,{...i},r,a);p.setEntity((_=H.changeSet)==null?void 0:_.self,r),c.push(...($=H.changeSet)==null?void 0:$.updated),e.push(...(L=H.changeSet)==null?void 0:L.added),f.push(...(j=H.changeSet)==null?void 0:j.removed);break}}return{updated:C(c),added:C(e),removed:C(f),affected:C(h),self:p}}function UA(l,p,i,r,a){const c=[],e=[],f=[],h=[],m=Object.keys(l),E=Ax(m,p);if(E)return{hasCreated:!1,changeSet:{updated:[],added:[],removed:[],affected:[],self:E}};const b=a?i.name+" of "+a.name:i.name,_={id:i.id||N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(r==null?void 0:r.timestamp)||new Date().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,name:b,codeName:null,deletable:!0,editable:!0,type:d.DefinitionEntity,additionalProperties:!1,additionalPropertiesDataType:null,allPropertiesImplement:null,description:i.description||null,static:i.static||!1,abstract:i.abstract||!1,properties:[],methods:[],abstractMethods:[],extends:null,implements:[],x:0,y:0,parent:p.toReference()},$=Ae(_,p);return $.setParent(p,r),$.initChildren(r),r==null||r.add($,W.Added),$.addSelfToProject(r),e.push($),m.forEach((L,j)=>{const k=N.UUID.uuid(),G=ts.new(r);G.id=k,G.name=L,G.codeName=L,G.parent=$.toReference(),G.index=j,G.required=!0,G.interactive=!0;const H=Ae(G,p);H.setParent($,r),H.initChildren(r),r==null||r.add(H,W.Added),H.addSelfToProject(r),e.push(H);const ie=l[L],ee=N.UUID.uuid(),ue=mr.new(r);ue.id=ee,ue.parent=H.toReference(),ue.like=!0,ue.isList=!1;const ae=Ae(ue,p);ae.setParent(H,r),ae.initChildren(r),r==null||r.add(ae,W.Added),ae.addSelfToProject(r),e.push(ae);const de=gx(ie,ae,{...i,name:L,id:N.UUID.uuid()},r,a||$);c.push(...de.updated),e.push(...de.added),f.push(...de.removed)}),{hasCreated:!0,changeSet:{updated:C(c),added:C(e),removed:C(f),affected:C(h),self:$}}}function $d(l,p,i,r){const a=[];return!l.length||!p.length?{errors:a,overlap:!1}:(l.length>p.length?l.forEach(c=>{const e=p.find(h=>h.name===c.name),f=p.find(h=>{var m,E;return Array.isArray(h.implements)?h.implements.some(b=>!!c.implements.find(g=>g.id===b.id)):((m=h.implements)==null?void 0:m.id)===((E=c.implements)==null?void 0:E.id)});if(e){const h=new Si({id:c.id+"--"+e.id+"--"+r,message:`Entity of type ${c.type} named "${c.name}" with id "${c.id}" overrides a base ${e.type} ${e.name} with id "${e.id}" that has the same name`,severity:me.Error,code:r,entity:c,firstRelationship:e});a.push(h)}if(f){const h=new Si({id:c.id+"--"+f.id+"--"+i,message:`Entity of type ${c.type} named "${c.name}" with id "${c.id}" overrides a base ${f.type} ${f.name} with id "${f.id}" that implements the same base descriptor`,severity:me.Error,code:i,entity:c,firstRelationship:f});a.push(h)}}):p.forEach(c=>{var h;const e=l.find(m=>m.name===c.name),f=l.find(m=>{var E,b;return m.implements&&Array.isArray(m.implements)?m.implements.some(g=>!!c.implements.find(_=>_.id===g.id)):((E=m.implements)==null?void 0:E.id)===((b=c.implements)==null?void 0:b.id)});if(e){const m=new Si({id:e.id+"--"+c.id+"--"+r,message:`Entity of type ${e.type} named "${e.name}" with id "${e.id}" overrides a base entity ${c.name} with id "${c.id}" that has the same name`,severity:me.Error,code:r,entity:e,firstRelationship:c});a.push(m)}if(f){const m=new Si({id:f.id+"--"+c.id+"--"+i,message:`Entity of type ${f.type} named "${f.name}" with id "${f.id}" overrides a base entity ${c.name} with id "${c.id}" that implements the same base ${Array.isArray(f==null?void 0:f.implements)?vt(f==null?void 0:f.implements.map(E=>E.type),"', '","' and '"):(h=f.implements)==null?void 0:h.id}`,severity:me.Error,code:i,entity:f,firstRelationship:c});a.push(m)}}),{errors:a,overlap:!!a.length})}function SAi(l,p){return l.abstract||(l.properties.forEach(r=>{r.abstract||r.metaSync({abstract:!0},p)}),Object.values(l.detachedDependents).forEach(r=>{r.field===Z$.EntityField&&r.entity.remove({ignoreUpstream:!1},p)}),l.metaSync({abstract:!0},p)),l}function qAi(l,p){return l.abstract&&(l.properties.forEach(r=>{r.abstract&&r.metaSync({abstract:!1},p)}),Object.values(l.detachedDependents).forEach(r=>{(r.field===Vg.Implements||r.field===Vg.Extends)&&r.entity.onDetachedDependencyRemoved(l,r.field,p)}),l.metaSync({abstract:!1},p)),l}function ZAi(l,p){return l.static||(l.properties.forEach(r=>{r.static||r.metaSync({static:!0},p)}),l.metaSync({static:!0},p)),l}function HAi(l,p){return l.static&&l.metaSync({static:!1},p),l}const xT=class xT extends cx{constructor(i,r){super(i);R(this,"initialData");R(this,"id");R(this,"version");R(this,"name");R(this,"description",null);R(this,"type",d.BuiltInBaseEntity);R(this,"abstract",!1);R(this,"static");R(this,"additionalProperties",!1);R(this,"properties",[]);R(this,"allPropertiesImplement",null);R(this,"additionalPropertiesDataType",null);R(this,"methods",[]);R(this,"abstractMethods",[]);R(this,"extends",null);R(this,"interactive",!1);R(this,"errors",[]);R(this,"project");if(this.initialData=this.initialData||i,this.project=this.project||r,this.id=this.id||i.id,this.version=this.version||i.version,this.name=this.name||i.name,this.static=this.static||i.static,this.interactive=this.interactive||i.interactive,this.abstract=i.abstract,this.additionalProperties=i.additionalProperties,this.properties=this.initialData.properties.map(a=>{const c=Ae(a,this.project);return c.setParent(this,null),c.initChildren(null),c}),this.methods=this.initialData.methods.map(a=>{const c=Ae(a,this.project);return c.setParent(this,null),c.initChildren(null),c}),this.abstractMethods=this.initialData.abstractMethods.map(a=>{const c=Ae(a,this.project);return c.setParent(this,null),c.initChildren(null),c}),this.initialData.allPropertiesImplement){const a=Ae(this.initialData.allPropertiesImplement,this.project);a.setParent(this,null),a.initChildren(null),this.allPropertiesImplement=a}if(this.initialData.additionalPropertiesDataType){const a=Ae(this.initialData.additionalPropertiesDataType,this.project);a.setParent(this,null),a.initChildren(null),this.additionalPropertiesDataType=a}this.initialData.extends&&(this.extends=Ae(this.initialData.extends,this.project))}get allMethods(){return C([...this.ownDeclaredMethods,...this.allBaseMethodsFromOriginalParents])}get allProperties(){return C([...this.ownDeclaredProperties,...this.allBasePropertiesFromOriginalParents])}get allBaseMethodsFromOriginalParents(){var a;const i=((a=this.extends)==null?void 0:a.allMethods)||[],r=[...i].filter(c=>!i.some(e=>e.id!==c.id));return C(r)}get allBasePropertiesFromOriginalParents(){var a;const i=((a=this.extends)==null?void 0:a.allProperties)||[],r=[...i].filter(c=>!i.some(e=>{var f;return e.id!==c.id&&(!!e.implements.find(h=>h.id===c.id)||((f=e.extends)==null?void 0:f.id)===c.id)}));return C(r)}get allBasePropertiesFromExtendedAndImplementedEntities(){var a,c;const i=[...((a=this.extends)==null?void 0:a.ownDeclaredProperties)||[],...((c=this.extends)==null?void 0:c.allBasePropertiesFromExtendedAndImplementedEntities)||[]].filter(e=>!e.abstract),r=[...i].filter(e=>!i.some(f=>{var h;return f.id!==e.id&&(!!f.implements.find(m=>m.id===e.id)||((h=f.extends)==null?void 0:h.id)===e.id)}));return C([...r])}get allBaseMethodsFromExtendedAndImplementedEntities(){return C([...(this.extends?[this.extends]:[]).reduce((i,r)=>r.type===d.PrimitiveEntity?i:[...[...r.ownDeclaredMethods,...r.allBaseMethodsFromExtendedAndImplementedEntities].filter(c=>c.type!==d.ActionDescriptor),...i],[])])}get extendedPropertiesFromOriginalParents(){var a,c;const i=[...((a=this.extends)==null?void 0:a.ownDeclaredProperties)||[],...((c=this.extends)==null?void 0:c.extendedPropertiesFromOriginalParents)||[]].filter(e=>!e.abstract),r=[...i].filter(e=>!i.some(f=>{var h;return f.id!==e.id&&(!!f.implements.find(m=>m.id===e.id)||((h=f.extends)==null?void 0:h.id)===e.id)}));return C(r)}get implementedPropertiesFromOriginalParents(){return C([...(this.extends?[this.extends]:[]).reduce((i,r)=>{const a=r.implementedPropertiesFromOriginalParents,c=[...r.ownDeclaredProperties].filter(h=>!!h.abstract),e=[...a,...c,...i];return[...e].filter(h=>!!!e.find(E=>{var b;return((b=E.extends)==null?void 0:b.id)===h.id||!!E.implements.find(g=>g.id===h.id)}))},[])].filter(i=>!!i.abstract))}get extendedProperties(){return this.properties.filter(i=>i.isExtendedProperty)}get ownDeclaredMethods(){return[...this.methods,...this.abstractMethods]}get ownDeclaredProperties(){return this.properties.filter(i=>!i.isExtendedProperty)}subscribe(){return this.project.subscribeBuiltInInstance(this),this}unsubscribe(){return this.project.unsubscribeBuiltInInstance(this),this}async APILoad(i=Se,...r){return await xT.repository.APILoad(this.id,...r),this}toFlat(i=new Set){var a;return i.has(this.id)?[]:(i.add(this.id),[this,...this.properties.flatMap(c=>c.toFlat(i)),...this.methods.flatMap(c=>c.toFlat(i)),...this.abstractMethods.flatMap(c=>c.toFlat(i)),...((a=this.extends)==null?void 0:a.toFlat(i))||[]])}toFlatIds(i=new Set){var a;return i.has(this.id)?[]:(i.add(this.id),[this.id,...this.properties.flatMap(c=>c.toFlatIds(i)),...this.methods.flatMap(c=>c.toFlatIds(i)),...this.abstractMethods.flatMap(c=>c.toFlatIds(i)),...((a=this.extends)==null?void 0:a.toFlatIds(i))||[]])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,description:this.description,interactive:this.interactive,additionalProperties:this.additionalProperties,abstract:this.abstract,static:this.static,type:this.type,name:this.name}}toJSON(i=new Set){var r,a,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,name:this.name,description:this.description,abstract:this.abstract,static:this.static,additionalProperties:this.additionalProperties,interactive:this.interactive,additionalPropertiesDataType:((r=this.additionalPropertiesDataType)==null?void 0:r.toJSON(i))||null,allPropertiesImplement:((a=this.allPropertiesImplement)==null?void 0:a.toJSON(i))||null,properties:this.properties.map(e=>e.toJSON(i)),methods:this.methods.map(e=>e.toJSON(i)),abstractMethods:this.abstractMethods.map(e=>e.toJSON(i)),extends:((c=this.extends)==null?void 0:c.toJSON(i))||null})}toReference(i=nt){return{id:this.id+"--"+N.UUID.uuid()+"--ref",type:d.GenericReference,entityId:this.id,version:this.version,entityType:this.type}}toShallowJSON(i=nt){var r,a,c;return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,description:this.description,abstract:this.abstract,static:this.static,interactive:this.interactive,additionalProperties:this.additionalProperties,additionalPropertiesDataType:((r=this.additionalPropertiesDataType)==null?void 0:r.toReference())||null,allPropertiesImplement:((a=this.allPropertiesImplement)==null?void 0:a.toReference())||null,properties:this.properties.map(e=>e.toReference()),methods:this.methods.map(e=>e.toReference()),abstractMethods:this.abstractMethods.map(e=>e.toReference()),extends:((c=this.extends)==null?void 0:c.toReference())||null}}toFlatJSON(i=new Set){var a,c;return i.has(this.id)?[]:(i.add(this.id),[this.toShallowJSON(),...this.properties.flatMap(e=>e.toFlatJSON(i)),...this.methods.flatMap(e=>e.toFlatJSON(i)),...this.abstractMethods.flatMap(e=>e.toFlatJSON(i)),...((a=this.additionalPropertiesDataType)==null?void 0:a.toFlatJSON(i))||[],...((c=this.allPropertiesImplement)==null?void 0:c.toFlatJSON(i))||[]])}toGenerationTarget(i=nt){var r;return{id:this.id,type:this.type,name:this.name,description:this.description,static:this.static,abstract:this.abstract,interactive:this.interactive,additionalProperties:this.additionalProperties,extends:(r=this.extends)==null?void 0:r.id}}toFlatGenerationTarget(i=new Set){var a,c;return i.has(this.id)?[]:(i.add(this.id),[this.toGenerationTarget(),...this.properties.flatMap(e=>e.toFlatGenerationTarget(i)),...this.methods.flatMap(e=>e.toFlatGenerationTarget(i)),...this.abstractMethods.flatMap(e=>e.toFlatGenerationTarget(i)),...((a=this.additionalPropertiesDataType)==null?void 0:a.toFlatGenerationTarget(i))||[],...((c=this.allPropertiesImplement)==null?void 0:c.toFlatGenerationTarget(i))||[]])}clearErrors(){var i,r;return this.errors=[],this.properties.forEach(a=>a.clearErrors()),this.methods.forEach(a=>a.clearErrors()),this.abstractMethods.forEach(a=>a.clearErrors()),(i=this.additionalPropertiesDataType)==null||i.clearErrors(),(r=this.allPropertiesImplement)==null||r.clearErrors(),this}validate(){return this.errors=BAi(this),{success:!0}}async validateAsync(i={}){const r=z.YieldTracker.from(i);return this.errors=await LAi(this,{tracker:r}),{success:!0}}getErrors(){var r,a;return[...this.errors,...this.properties.flatMap(c=>c.getErrors()),...this.methods.flatMap(c=>c.getErrors()),...this.abstractMethods.flatMap(c=>c.getErrors()),...((r=this.additionalPropertiesDataType)==null?void 0:r.getErrors())||[],...((a=this.allPropertiesImplement)==null?void 0:a.getErrors())||[]]}async getErrorsAsync(i={}){const r=z.YieldTracker.from(i),a=[...this.errors];await r.tick();for(const c of this.properties){const e=await c.getErrorsAsync({tracker:r});a.push(...e)}for(const c of this.methods){const e=await c.getErrorsAsync({tracker:r});a.push(...e)}for(const c of this.abstractMethods){const e=await c.getErrorsAsync({tracker:r});a.push(...e)}if(this.additionalPropertiesDataType){const c=await this.additionalPropertiesDataType.getErrorsAsync({tracker:r});a.push(...c)}if(this.allPropertiesImplement){const c=await this.allPropertiesImplement.getErrorsAsync({tracker:r});a.push(...c)}return a}getShallowErrors(){return this.errors}implement(i,r=this.project.addChangeSet(new q(this.project,N.sessionAuthor,B().toISOString(),null,!0,"implement-built-in-base-entity")),a){const c=YR(this,i,r,a);return r==null||r.attemptAutoclose("implement-built-in-base-entity",this.id),c}getAllPropertiesImplements(){var r;const i=[];return this.allPropertiesImplement&&i.push(this.allPropertiesImplement),((r=this.extends)==null?void 0:r.type)===d.BuiltInBaseEntity&&i.push(...this.extends.getAllPropertiesImplements()||[]),i}getAllInteractiveMethods(){const i=[];if(this.interactive){if(i.push(...this.methods,...this.abstractMethods),!this.extends||this.extends.type===d.BuiltInBaseEntity&&this.extends.interactive||this.extends.type===d.PrimitiveEntity)return i;this.extends instanceof xT&&i.push(...this.extends.getAllInteractiveMethods())}return C(i)}};R(xT,"repository",{APILoad:async(i,...r)=>null});let qd=xT;class x_e extends qd{constructor(i){super(bn,i);R(this,"initialData");R(this,"id",Ie.PERSISTED_ENTITY);R(this,"version","1");R(this,"name",Ie.PERSISTED_ENTITY);R(this,"description",bn.description);R(this,"type",d.BuiltInBaseEntity);R(this,"abstract",bn.abstract);R(this,"static",bn.static);R(this,"properties",[]);R(this,"methods",[]);R(this,"abstractMethods",[]);R(this,"extends",null);R(this,"errors",[]);R(this,"project");this.initialData=bn,this.project=i,this.id=bn.id,this.version=bn.version,this.name=bn.name,this.static=bn.static,this.abstract=bn.abstract,this.properties=this.initialData.properties.map(r=>{const a=Ae(r,this.project);return a.setParent(this,null),a.initChildren(null),a}),this.methods=this.initialData.methods.map(r=>{const a=Ae(r,this.project);return a.parent=this,a}),this.abstractMethods=this.initialData.abstractMethods.map(r=>{const a=Ae(r,this.project);return a.parent=this,a}),this.initialData.extends&&(this.extends=Ae(this.initialData.extends,this.project))}}var ya=(l=>(l.StringValueMustNotHaveSpaces="string-value-must-not-have-spaces",l.StringValueMustNotHaveDashes="string-value-must-not-have-dashes",l.MustBeUniqueAmongSameEntities="must-be-unique-among-same-entities",l))(ya||{});function Ix(l,p){const i=[],r=p;if(!r)return{errors:i,override:p};if(typeof r!="string")return{errors:[],override:p};if(r.includes(" ")){const a=new Si({id:l.id+"--string-value-must-not-have-spaces",message:`Entity of type ${l.type} with id "${l.id}" has an invalid value "${p}". The value cannot contain spaces.`,severity:me.Error,code:"string-value-must-not-have-spaces",entity:l});i.push(a)}return{errors:i,override:r.replace(/\s/g,"-")}}function $_e(l,p){const i=[],r=p;if(!r)return{errors:i,override:p};if(typeof r!="string")return{errors:[],override:p};if(r.includes(" ")){const a=new Si({id:l.id+"--string-value-must-not-have-spaces",message:`Entity of type ${l.type} with id "${l.id}" has an invalid value "${p}". The value cannot contain spaces or dashes.`,severity:me.Error,code:"string-value-must-not-have-spaces",entity:l});i.push(a)}if(r.includes("-")){const a=new Si({id:l.id+"--string-value-must-not-have-dashes",message:`Entity of type ${l.type} with id "${l.id}" has an invalid value "${p}". The value cannot contain spaces or dashes.`,severity:me.Error,code:"string-value-must-not-have-dashes",entity:l});i.push(a)}return{errors:i,override:r.replace(/\s|-/g,"_")}}var id=(l=>(l.StatusCodeMustBeNumber="status-code-must-be-number",l.StatusCodeMustBeBetween100And599="status-code-must-be-between-100-and-599",l))(id||{});function L_e(l,p){const i=[];if(typeof p!="number"){const r=new Si({id:l.id+"--status-code-must-be-number",message:`Entity of type ${l.type} with id "${l.id}" has an invalid value "${p}". The value must be a number.`,severity:me.Error,code:"status-code-must-be-number",entity:l});return i.push(r),{errors:i,override:p}}if(p<100){const r=new Si({id:l.id+"--status-code-must-be-between-100-and-599",message:`Entity of type ${l.type} with id "${l.id}" has an invalid value "${p}". The value must be a number between 100 and 599.`,severity:me.Error,code:"status-code-must-be-between-100-and-599",entity:l});i.push(r)}if(p>599){const r=new Si({id:l.id+"--status-code-must-be-between-100-and-599",message:`Entity of type ${l.type} with id "${l.id}" has an invalid value "${p}". The value must be a number between 100 and 599.`,severity:me.Error,code:"status-code-must-be-between-100-and-599",entity:l});i.push(r)}return{errors:i,override:p}}class B_e extends qd{constructor(i){var e,f;super(Za,i);R(this,"initialData");R(this,"id",Ie.PERSISTED_ENTITY);R(this,"version","1");R(this,"name",Ie.PERSISTED_ENTITY);R(this,"description",Za.description);R(this,"type",d.BuiltInBaseEntity);R(this,"abstract",Za.abstract);R(this,"static",Za.static);R(this,"properties",[]);R(this,"methods",[]);R(this,"abstractMethods",[]);R(this,"extends",null);R(this,"errors",[]);R(this,"project");this.initialData=Za,this.project=i,this.id=Za.id,this.version=Za.version,this.name=Za.name,this.static=Za.static,this.abstract=Za.abstract,this.properties=this.initialData.properties.map(h=>{const m=Ae(h,this.project);return m.setParent(this,null),m.initChildren(null),m}),this.methods=this.initialData.methods.map(h=>{const m=Ae(h,this.project);return m.parent=this,m}),this.abstractMethods=this.initialData.abstractMethods.map(h=>{const m=Ae(h,this.project);return m.parent=this,m}),this.initialData.extends&&(this.extends=Ae(this.initialData.extends,this.project));const r=this.properties.find(h=>h.id===re["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.properties.path.id);if(!r)throw new Error("Path property not found in endpoint entity");r._codeNativeValueValidation=(h,m)=>{const E=Ix(h,m);if(h.project.entities.filter(g=>Wi(g,Ie.HTTP_ENDPOINT)&&g.id!==h.parent.id).map(g=>{const _=g.properties.find(j=>j.implements.find(k=>k.id===re["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.properties.path.id));if(!_)throw new Error("Path property not found in endpoint entity "+g.name+" ("+g.id+")");const $=_.getDefaultValue();return($==null?void 0:$.value)||""}).includes(m)){const g=new Si({id:h.id+"--"+ya.MustBeUniqueAmongSameEntities,message:`Entity of type ${h.type} with id "${h.id}" has an invalid value "${m}". The value must be unique among all endpoint paths.`,severity:me.Error,code:ya.MustBeUniqueAmongSameEntities,entity:h});E.errors.push(g)}return E};const a=this.abstractMethods.find(h=>h.id===re["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.methods.handler.id);if(!a)throw new Error("Handler method not found in endpoint entity");const c=(((f=(e=a.dataType)==null?void 0:e.entity)==null?void 0:f.properties)||[]).find(h=>h.id===re["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.methods.handler.dataType.entity.properties.statusCode.id);if(!c)throw new Error("Status code output not found in handler method");c._codeNativeValueValidation=(h,m)=>L_e(h,m)}}class M_e extends ki{constructor(i){super(So,i);R(this,"id",Hi.Parallel);R(this,"name",Hi.Parallel);R(this,"description","Programmatically execute a list of actions one after the other");R(this,"version","1");R(this,"autoexecutable",!0);R(this,"type",d.ActionDescriptor);R(this,"inputs",[]);R(this,"dataType",null);R(this,"error",null);R(this,"project");this.project=i,this.inputs=So.inputs.map(r=>{const a=Ae(r,this.project);return a.setParent(this,null),a.initChildren(null),a}),this.dataType=Ae(So.dataType,this.project),this.dataType.setParent(this,null),this.dataType.initChildren(null),this.error=So.error?Ae(So.error,this.project):null}}class G_e extends ki{constructor(i){super(bs,i);R(this,"id",bs.id);R(this,"name",bs.name);R(this,"description",bs.description);R(this,"version",bs.version);R(this,"autoexecutable",!1);R(this,"type",d.ActionDescriptor);R(this,"inputs",[]);R(this,"dataType",null);R(this,"error",null);R(this,"project");this.project=i,this.inputs=bs.inputs.map(r=>{const a=Ae(r,this.project);return a.setParent(this,null),a.initChildren(null),a}),this.dataType=Ae(bs.dataType,this.project),this.dataType.setParent(this,null),this.dataType.initChildren(null),this.error=bs.error?Ae(bs.error,this.project):null}}class j_e extends ki{constructor(i){super(Ju,i);R(this,"id",Hi.Sequential);R(this,"name",Hi.Sequential);R(this,"description","Programmatically execute a list of actions one after the other");R(this,"version","1");R(this,"autoexecutable",!0);R(this,"type",d.ActionDescriptor);R(this,"inputs",[]);R(this,"dataType",null);R(this,"error",null);R(this,"project");this.project=i,this.inputs=Ju.inputs.map(r=>{const a=Ae(r,this.project);return a.setParent(this,null),a.initChildren(null),a}),this.dataType=Ae(Ju.dataType,this.project),this.dataType.setParent(this,null),this.dataType.initChildren(null),this.error=Ju.error?Ae(Ju.error,this.project):null}}var Ya=(l=>(l.UUIDMustBeString="uuid-must-be-string",l.UUIDMustBeValidFormat="uuid-must-be-valid-format",l.UUIDMustNotContainSpaces="uuid-must-not-contain-spaces",l))(Ya||{});function WAi(l,p){const i=[];if(typeof p!="string"){const a=new Si({id:l.id+"--uuid-must-be-string",message:`Entity of type ${l.type} with id "${l.id}" has an invalid value "${p}". The value must be text.`,severity:me.Error,code:"uuid-must-be-string",entity:l});return i.push(a),{errors:i,override:p}}const r=Ix(l,p);if(r.errors.length>0)return i.push(...r.errors),{errors:i,override:p};if(!px(p)){const a=new Si({id:l.id+"--uuid-must-be-valid-format",message:`Entity of type ${l.type} with id "${l.id}" has an invalid value "${p}". The value must be a valid UUID format. Eg: "123e4567-e89b-12d3-a456-426614174000".`,severity:me.Error,code:"uuid-must-be-valid-format",entity:l});i.push(a)}return{errors:i,override:p}}var Me=(l=>(l.Inherited="inherited",l.DefaultValue="default-value",l.Missing="missing",l.Empty="empty",l.AutoCalculated="auto-calculated",l.QueuedAutocalculation="queued-autocalculation",l.External="external",l.Testing="testing",l.ExecutionResult="execution-result",l))(Me||{});const U_e={initialized:!1,id:"",project:null,values:{},onWriteCallback:()=>{},onRemoveCallback:()=>{},onWrite:()=>{},onRemove:()=>{},init:()=>{},toJSON:()=>({}),writeValue:()=>{},readValue:()=>null,removeValue:()=>{},clear:()=>{}};function hT(l,p){return{...U_e,id:l,project:p}}class mT{constructor(p,i){R(this,"initialized",!1);R(this,"id");R(this,"project");R(this,"values",{});R(this,"onWriteCallback",()=>{});R(this,"onRemoveCallback",()=>{});this.id=p,this.project=i,this.init()}onWrite(p){this.onWriteCallback=p}onRemove(p){this.onRemoveCallback=p}init(){var r;if(!((r=this.project)!=null&&r.id)||this.initialized)return;const p={},i={};Object.keys(p).forEach(a=>{const c=p[a],e=new Nr(c,this.project);try{if(c.parent){const m=this.project.findSubscribedInstanceFromReference(c.parent);if(!m)return;e.setParent(m,null),e.hydrateAncestors(),e.initChildren(null)}else if(c.standaloneParent){const m=this.project.findSubscribedInstanceFromReference(c.standaloneParent);if(!m)return;e.standalone=!0,e.setStandaloneParent(m,null),e.hydrateAncestors(),e.initChildren(null)}i[a]=e;const f=e.parent||e.standaloneParent,h=rVe(e,f,this.project);h?i[a]=h:delete p[a]}catch(f){z.Logger.error("Error hydrating ancestors: ",f),delete p[a]}}),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 a=this.values[p.id];if(!a)if(i instanceof Nr)a=i;else if(i)a=Yi(i,this.project);else{const c={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:new Date().toISOString(),author:N.sessionAuthor,deleted:!1,previousVersion:null,value:null,deletable:!0,editable:!0,type:d.LiteralValue,standaloneParent:p.toReference(),parent:null,valueAsTypeSingle:null,valueAsTypeList:null,autogeneration:null,name:Wc(p.getDataType(null))};a=Yi(c,this.project)}a.standalone=!0,a.initialData.standaloneParent||z.Logger.warn("instance.initialData: ",a.initialData),a.setStandaloneParent(p,null),a.hydrateAncestors(),a.initChildren(null),i&&(a.metaSync({...i},null),a.setValueAsType(i.valueAsType,null)),this.values[p.id]=a,this.onWriteCallback(p,a)}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 gr(l){return l!==null&&typeof l=="object"&&!Array.isArray(l)}function Rx(l){if(Array.isArray(l))return l.map(h=>typeof h=="number"?h:e(h)?Number(h):String(h));const p=[];let i=0,r="",a=!1,c=null;for(;i<l.length;){const h=l[i];if(h==="."&&!a){r.length&&(p.push(f(r)),r=""),i++;continue}if(h==="["&&!a){r.length&&(p.push(f(r)),r=""),a=!0,i++;continue}if(a){if(!c&&(h==='"'||h==="'")){c=h,i++;continue}if(c){if(h==="\\"&&i+1<l.length){r+=l[i+1],i+=2;continue}if(h===c){c=null,i++;continue}r+=h,i++;continue}if(h==="]"){p.push(f(r)),r="",a=!1,i++;continue}if(/\s/.test(h)&&!c){i++;continue}r+=h,i++;continue}r+=h,i++}return r.length&&p.push(f(r)),p;function e(h){return/^[0-9]+$/.test(h)}function f(h){const m=h.trim();return e(m)?Number(m):m}}function JR(l,p,i){if(l==null)return i;const r=Rx(p);let a=l;for(let c=0;c<r.length;c++){const e=r[c];if(a==null)return i;if(Array.isArray(a)&&typeof e=="number"){if(!(e in a))return i;a=a[e]}else{if(!Object.prototype.hasOwnProperty.call(a,e))return i;a=a[e]}}return a}const zAi=new Set(["__proto__","prototype","constructor"]);function k_e(l){return typeof l=="string"&&zAi.has(l)}function YAi(l,p,i,r){const{createMissing:a=!0,coerce:c=!0}=r??{};if(l==null||typeof l!="object")throw new TypeError("set(...) expects a non-null object as target.");const e=Rx(p);if(e.length===0)throw new Error("set(...) path must not be empty.");let f=l;for(let h=0;h<e.length;h++){const m=e[h];if(k_e(m))throw new Error(`Refusing to set unsafe key "${String(m)}" on object.`);const E=h===e.length-1,g=typeof e[h+1]=="number",_=Array.isArray(f)&&typeof m=="number";if(E){if(_&&f[m]==null&&!a)throw new Error(`set(...) missing array index "${String(m)}" (createMissing=false).`);return f[m]=i,l}else{if(!Object.prototype.hasOwnProperty.call(f,m)||f[m]==null){if(!a)throw new Error(`set(...) missing parent at segment "${String(m)}" (createMissing=false).`);f[m]=g?[]:{}}else{const $=f[m],L=$!==null&&typeof $=="object",j=Array.isArray($);if(g){if(!j){if(!c)throw new Error(`set(...) expected an array at "${String(m)}" but found non-array (coerce=false).`);f[m]=[]}}else if(!L||j){if(!c)throw new Error(`set(...) expected an object at "${String(m)}" but found non-object (coerce=false).`);f[m]={}}}f=f[m]}}return l}function Dx(l,p,i,r){const a=Rx(p);if(a.length===0)return l;function c(e,f){const h=a[f],m=f===a.length-1;if(r==="strict-set"||r==="strict-delete"){if(k_e(h))throw new Error(`Unsafe key "${String(h)}"`);if(e==null||typeof e!="object"&&!Array.isArray(e))throw new Error(`Missing parent or invalid container at segment "${String(h)}".`);if(r==="strict-delete"&&m&&!(h in e))return e}let E;if(Array.isArray(e))E=[...e];else if(e&&typeof e=="object")E={...e};else if(r==="safe-set")E=typeof h=="number"?[]:{};else throw new Error(`Cannot traverse path at "${String(h)}"`);if(m)return r==="strict-delete"?delete E[h]:E[h]=i,E;const b=e?e[h]:void 0;if(r==="safe-set"&&b==null){const g=typeof a[f+1]=="number",_=c(g?[]:{},f+1);return E[h]=_,E}return E[h]=c(b,f+1),E}if(l==null&&r==="safe-set"){const e=typeof a[0]=="number";return c(e?[]:{},0)}return c(l,0)}const AU=Symbol("missing"),JAi=l=>l!=null&&typeof l=="object";function XR(l,p){if(typeof l!="string")throw new TypeError(`${p} expects the key to be a string.`);return l}function Em(l,p){if(typeof l!="string"&&!Array.isArray(l))throw new TypeError(`${p} expects the path to be string or array.`);return l}function Mf(l,p){if(!gr(l))throw new TypeError(`${p} expects the first argument to be an object.`);return l??{}}function F_e(l,p){const i=XR(p,"ReadKey");return(l??{})[i]}function K_e(l,p,i){const r=XR(p,"WriteKey");if(l&&typeof l=="object"){const a=Array.isArray(l)?[...l]:{...l};return a[r]=i,a}return{[r]:i}}function S_e(l,p){if(!l||typeof l!="object")return{};const i=String(p),{[i]:r,...a}=l;return a}function q_e(l,p,i){const r=Mf(l,"ReadNestedKey"),a=Em(p,"ReadNestedKey");return JR(r,a,i)}function Z_e(l,p,i){const r=Mf(l,"WriteNestedKey"),a=Em(p,"WriteNestedKey");return Dx(r,a,i,"strict-set")}function H_e(l,p,i){const r=Mf(l,"WriteSafeNestedKeyRecursively"),a=Em(p,"WriteSafeNestedKeyRecursively");return Dx(r,a,i,"safe-set")}function W_e(l,p){const i=Mf(l,"DeleteNestedKey"),r=Em(p,"DeleteNestedKey");return Dx(i,r,null,"strict-delete")}function z_e(l,p){const i=XR(p,"HasKey"),r=l;return r!=null&&JAi(r)&&Object.prototype.hasOwnProperty.call(r,i)}function Y_e(l,p,i){const r=XR(p,"KeyValueEquals");return l==null||typeof l!="object"?!1:l[r]===i}function J_e(l,p){const i=l,r=Em(p,"HasNestedKey");return JR(i,r,AU)!==AU}function X_e(l,p,i){const r=Em(p,"NestedKeyValueEquals");return JR(l,r)===i}function Q_e(...l){const p={};for(let i=0;i<l.length;i++){const r=l[i];if(r!=null){if(!gr(r))throw new TypeError("MergeObjects expects every argument to be an object (or null/undefined).");Object.assign(p,r)}}return p}function eVe(l){const p=Mf(l,"ObjectKeys");return Object.keys(p)}function tVe(l){const p=Mf(l,"ObjectValues");return Object.values(p)}function iVe(l){const p=Mf(l,"ObjectEntries");return Object.entries(p)}function XAi(l){return{execution:null,project:l,localTestValues:hT("local-test-values",l),resolvedValues:hT("resolved-values",l),persistedExecutionResults:hT("persisted-execution-results",l),lastExecutionResults:hT("last-execution-results",l),getValueTypePreference:()=>null,setValueTypePreference:()=>{}}}function wu(l,p,i,r){var f;let a;if(((f=l==null?void 0:l.entity)==null?void 0:f.type)===d.PrimitiveEntity)switch(l.entity.name){case ye.EntityTemplate:a=ye.EntityTemplate;break;case ye.String:a=ye.String;break;case ye.Number:a=ye.Number;break;case ye.Boolean:a=ye.Boolean;break;case ye.Null:a=ye.Null;break;case ye.Enum:a=ye.Enum;break;case ye.KeyValue:a=ye.KeyValue;break;case ye.Untyped:a=ye.Untyped;break;case ye.KeyValue:a=ye.KeyValue;break;case ye.Date:a=ye.Date;break;case ye.UUID:a=ye.UUID;break;case ye.File:a=ye.File;break;case ye.Void:a=ye.Void;break;case ye.ActionDescriptor:a=ye.ActionDescriptor;break;case ye.Bytes:a=ye.Bytes;break;default:throw new Error(`Primitive type ${se(l.entity,i)} is not supported`)}else a=ye.Untyped;const c=Nr.new(r);c.name=a,c.parent=p.toReference();const e=Ae(c,i);return e.hydrateAncestors(),r==null||r.add(e,W.Added),e.addSelfToProject(r),e.initChildren(r),e}function Jo(l,p,i=new Set){var r,a,c;if(i.has(l.id))return[];if(i.add(l.id),_t.includes(l.type)){const e=yr(l);return C([e,...[e].flatMap(f=>Jo(f,p,i))])}else if(l.type===d.OutputMap){if(_t.includes(l.parent.type)&&((r=l.declaration)==null?void 0:r.type)===d.Property&&l.declaration.static)return C([l,l.declaration,...[l,l.declaration].flatMap(e=>Jo(e,p,i))])}else if(l.type===d.InputMap&&_t.includes(l.parent.type)&&((a=l.declaration)==null?void 0:a.type)===d.Property&&(c=l.declaration)!=null&&c.static)return C([l.declaration,...[l.declaration].flatMap(e=>Jo(e,p,i))]);return[l]}function rVe(l,p,i){return l}function bm(l,p,i=!1){const r=l.readsValue;let a=null;const c=lf(r,p,i);if(c){const e={sources:[c],target:l};a={value:c.value,valueOwner:l,type:Me.Inherited,inheritanceLink:e}}return a}function xt(l,p,i){var f;if(!p)return null;let r;if(((f=l==null?void 0:l.entity)==null?void 0:f.type)===d.PrimitiveEntity)switch(l.entity.name){case ye.EntityTemplate:r=ye.EntityTemplate;break;case ye.String:r=ye.String;break;case ye.Number:r=ye.Number;break;case ye.Boolean:r=ye.Boolean;break;case ye.Null:r=ye.Null;break;case ye.Enum:r=ye.Enum;break;case ye.KeyValue:r=ye.KeyValue;break;case ye.Untyped:r=ye.Untyped;break;case ye.KeyValue:r=ye.KeyValue;break;case ye.Date:r=ye.Date;break;case ye.UUID:r=ye.UUID;break;case ye.File:r=ye.File;break;case ye.Void:r=ye.Void;break;case ye.ActionDescriptor:r=ye.ActionDescriptor;break;case ye.Bytes:r=ye.Bytes;break;default:throw new Error(`Primitive type ${se(l.entity,i)} is not supported`)}else r=ye.Untyped;if(!i.get(p.id))return null;const c=Nr.new(null);c.name=r,c.standaloneParent=p.toReference();let e=new Nr(c,i);return e.hydrateAncestors(),e.standalone=!0,e.setStandaloneParent(p,null),e.initChildren(null),e}function nVe(l,p,i=!1){var c,e;if(p.execution&&p.execution.hasEntity(l)&&!i){const f=(c=p.lastExecutionResults)==null?void 0:c.readValue(l.id);if(f)return{value:f,valueOwner:l,type:Me.ExecutionResult,inheritanceLink:null}}const r=(e=p.localTestValues)==null?void 0:e.readValue(l.id),a=p.getValueTypePreference(l.id);return r&&!i&&(a===null||a!==Me.DefaultValue)?{value:r,valueOwner:l,type:Me.Testing,inheritanceLink:null}:{value:null,valueOwner:l,type:Me.QueuedAutocalculation,inheritanceLink:null}}function kA(l,p,i,r=!1){var e,f;const a={...l},c=p.type===d.VariableDeclaration?p.inputs:Dt.includes(p.type)?p.outputs:[];if(!c||c.length===0)return a;for(const h of c){if(!xE(h))continue;const m=BT(h,i,r);if(m&&m.value){const E=se(h,i.project),b=h.codeName||((e=h.declaration)==null?void 0:e.codeName)||ir(E);a[b]=Pn((m==null?void 0:m.value)||null)?a[b]:(f=m==null?void 0:m.value)==null?void 0:f.value}}return a}function TT(l,p,i,r=!1){var e,f;const a={...l},c=p.inputs;if(!c)return a;for(const h of c){if(!xE(h))continue;const m=rE(h,i,r);if(m&&m.value){const E=se(h,i.project),b=h.codeName||((e=h.declaration)==null?void 0:e.codeName)||ir(E);a[b]=(f=m==null?void 0:m.value)==null?void 0:f.value}}return a}function aVe(l,p,i=!1){var E,b,g,_,$,L,j,k;let r={};if(((b=(E=l.getDataType(null))==null?void 0:E.entity)==null?void 0:b.type)===d.DefinitionEntity&&(r={...r,...((g=l.getDataType(null))==null?void 0:g.entity).getActiveRawDefaultValue()}),p.execution&&p.execution.hasEntity(l)&&!i){const G=(_=p.lastExecutionResults)==null?void 0:_.readValue(l.id);if(G){if(gr(G.value)){const ie={...r,...G.value},ee={...TT(ie,l,p,i)};G.metaSync({value:ee},null)}return{value:G,valueOwner:l,type:Me.ExecutionResult,inheritanceLink:null}}}const a=!!(($=p.execution)!=null&&$.entities.length),c=(L=p.execution)==null?void 0:L.hasEntity(l),e=l.readsValue;let f=null;if(e){const G=(j=p.execution)==null?void 0:j.hasEntity(e);if((!a||a&&G&&c||a&&!G&&!c)&&(f=bm(l,p,i),f&&f.value&&gr(f.value.value))){const ie={...r,...f.value.value},ee={...TT(ie,l,p,i)};f.value.metaSync({value:ee},null)}}const h=l.defaultValue,m=p.getValueTypePreference(l.id);if(!f&&h){const G=h;if(G&&G.value===null&&G.autogeneration){const H=J1(G);if(G.metaSync({value:H},null),gr(H)){const ie={...TT(H,l,p,i)};G.metaSync({value:ie},null)}}(i||m===null||m!==Me.Testing)&&(f={value:G,valueOwner:l,type:Pn(G)?l.readsValue?Me.Inherited:Me.Empty:Me.DefaultValue,inheritanceLink:null})}if(!f||(f.type===Me.DefaultValue||f.type===Me.External)&&!i||m===null||m!==Me.DefaultValue){const G=(k=p.localTestValues)==null?void 0:k.readValue(l.id);if(G){if(gr(G.value)){const H={...r,...G.value},ie={...TT(H,l,p,i)};G.metaSync({value:ie},null)}return{value:G,valueOwner:l,type:Me.Testing,inheritanceLink:null}}}return Pn((f==null?void 0:f.value)||null)?{value:null,valueOwner:l,type:l.readsValue?Me.Inherited:Me.Empty,inheritanceLink:null}:f}function wx(l,p,i=!1){var e,f,h,m,E,b,g,_,$;let r={};if(((f=(e=l.getDataType(null))==null?void 0:e.entity)==null?void 0:f.type)===d.DefinitionEntity&&(r={...r,...((h=l.getDataType(null))==null?void 0:h.entity).getActiveRawDefaultValue()}),p.execution&&p.execution.hasEntity(l)&&!i){const L=(m=p.lastExecutionResults)==null?void 0:m.readValue(l.id);if(L){if(gr(L.value)){const k={...r,...L.value},G=kA(k,l,p,i);L==null||L.metaSync({value:G},null)}return{value:L,valueOwner:l,type:Me.ExecutionResult,inheritanceLink:null}}}const a=(E=p.localTestValues)==null?void 0:E.readValue(l.id),c=p.getValueTypePreference(l.id);if(a&&!i&&(c===null||c!==Me.DefaultValue)){if(gr(a.value)){const j={...r,...a.value},k=kA(j,l,p,i);a.metaSync({value:k},null)}return{value:a,valueOwner:l,type:Me.Testing,inheritanceLink:null}}if((b=l.getDataType(null))!=null&&b.entity&&((_=(g=l.getDataType(null))==null?void 0:g.entity)==null?void 0:_.type)===d.DefinitionEntity&&(($=l.getDataType(null))!=null&&$.isObject())){const L=xt(l.dataType,l,p.project),j=kA(r,l,p,i);return L==null||L.metaSync({value:j},null),{value:L,valueOwner:l,type:Me.DefaultValue,inheritanceLink:null}}return null}function iE(l,p,i=!1){var E,b,g,_,$;if((E=l.dataType)!=null&&E.isObject())return aVe(l,p,i);const r=ht(l),a=!!((b=p.execution)!=null&&b.entities.length),c=(g=p.execution)==null?void 0:g.hasEntity(r),e=l.readsValue;let f=null;if(e){const L=(_=p.execution)==null?void 0:_.hasEntity(e);(!a||a&&L&&c||a&&!L&&!c)&&(f=bm(l,p,i))}const h=l.defaultValue,m=p.getValueTypePreference(l.id);if(!f&&h){const L=h;if(L&&L.value===null&&L.autogeneration){const j=J1(L);L.metaSync({value:j},null)}(i||m===null||m!==Me.Testing)&&(f={value:L,valueOwner:l,type:Pn(L)?l.readsValue?Me.Inherited:Me.Empty:Me.DefaultValue,inheritanceLink:null})}if(!f||(f.type===Me.DefaultValue||f.type===Me.External)&&!i||m===null||m!==Me.DefaultValue){const L=($=p.localTestValues)==null?void 0:$.readValue(l.id);if(L)return{value:L,valueOwner:l,type:Me.Testing,inheritanceLink:null}}return Pn((f==null?void 0:f.value)||null)?{value:null,valueOwner:l,type:l.readsValue?Me.Inherited:Me.Empty,inheritanceLink:null}:f}function Cx(l,p,i=!1){var e,f,h;if((e=l.dataType)!=null&&e.isObject())return wx(l,p);if(p.execution&&p.execution.hasEntity(l)&&!i){const m=(f=p.lastExecutionResults)==null?void 0:f.readValue(l.id);if(m)return{value:m,valueOwner:l,type:Me.ExecutionResult,inheritanceLink:null}}const r=(h=p.localTestValues)==null?void 0:h.readValue(l.id),a=p.getValueTypePreference(l.id);return r&&!i&&(a===null||a!==Me.DefaultValue)?{value:r,valueOwner:l,type:Me.Testing,inheritanceLink:null}:iE(l,p,i)}function Ox(l,p,i=!1){var g,_,$,L;const r=!!((g=p.execution)!=null&&g.entities.length),a=(_=p.execution)==null?void 0:_.hasEntity(l);let c=null;const e=l.readsValue;if(e){const j=($=p.execution)==null?void 0:$.hasEntity(e);(!r||r&&j&&a||r&&!j&&!a)&&(c=bm(l,p,i))}const f=l.declaration;if(!c&&f){const j=iE(f,p);j&&j.value&&(c=j)}const h=p.getValueTypePreference(l.id);if(!c||(c.type===Me.DefaultValue||c.type===Me.External)&&!i||h===null||h!==Me.DefaultValue){const j=(L=p.localTestValues)==null?void 0:L.readValue(l.id);if(j)return{value:j,valueOwner:l,type:Me.Testing,inheritanceLink:null}}const m=ad(l),E=l.getDataType(null);return m&&a&&(!(c!=null&&c.value)||!_a(E)&&rd(c==null?void 0:c.value))?{value:null,valueOwner:l,type:Me.Missing,inheritanceLink:null}:a&&!m&&Pn((c==null?void 0:c.value)||null)?{value:null,valueOwner:l,type:l.readsValue?Me.Inherited:Me.Empty,inheritanceLink:null}:c||{value:null,valueOwner:l,type:Me.External,inheritanceLink:null}}function sVe(l,p,i=!1){return Cx(l.declaration,p,i)}function lVe(l,p,i=!1){var g,_,$,L;if(!i&&p.execution&&p.execution.hasEntity(l)){const j=(g=p.lastExecutionResults)==null?void 0:g.readValue(l.id);if(j)return{value:j,valueOwner:l,type:Me.ExecutionResult,inheritanceLink:null}}const r=ht(l),a=l.parent.type===d.FunctionDeclaration&&l.parent.parent.type===d.Loop?l.parent:null,c=!!((_=p.execution)!=null&&_.hasEntity(r))||!!a&&!!(($=p.execution)!=null&&$.hasEntity(a));let e=null;const f=l.defaultValue,h=p.getValueTypePreference(l.id);if(f){const j=f||null;if(j&&j.value===null&&j.autogeneration){const k=J1(j);j.metaSync({value:k},null)}(i||h===null||h!==Me.Testing)&&(e={value:j,valueOwner:l,type:Pn(j)?Me.Empty:Me.DefaultValue,inheritanceLink:null})}if(!e||(e.type===Me.DefaultValue||e.type===Me.External)&&!i||h===null||h!==Me.DefaultValue){const j=(L=p.localTestValues)==null?void 0:L.readValue(l.id),k=p.getValueTypePreference(l.id);if(j&&!i&&(k===null||k!==Me.DefaultValue))return{value:j,valueOwner:l,type:Me.Testing,inheritanceLink:null}}const m=ad(l),E=l.getDataType(null);let b=m&&c&&(!(e!=null&&e.value)||!_a(E)&&rd(e==null?void 0:e.value));return r.type===d.Loop&&c&&(b=!1),b?{value:null,valueOwner:l,type:Me.Missing,inheritanceLink:null}:c&&!m&&Pn((e==null?void 0:e.value)||null)?{value:null,valueOwner:l,type:Me.Empty,inheritanceLink:null}:e||{value:null,valueOwner:l,type:Me.External,inheritanceLink:null}}function _x(l,p,i=!1){var _,$,L,j,k,G;if((_=l.getDataType(null))!=null&&_.isObject())return wx(l,p);if(p.execution&&p.execution.hasEntity(l)&&!i){const H=($=p.lastExecutionResults)==null?void 0:$.readValue(l.id);if(H)return{value:H,valueOwner:l,type:Me.ExecutionResult,inheritanceLink:null}}const r=ht(l),a=!!((L=p.execution)!=null&&L.entities.length),c=(j=p.execution)==null?void 0:j.hasEntity(r),e=l.readsValue;let f=null;if(e){const H=(k=p.execution)==null?void 0:k.hasEntity(e);(!a||a&&H&&c||a&&!H&&!c)&&(f=bm(l,p,i))}const h=l.defaultValue,m=p.getValueTypePreference(l.id);if(!f&&h){const H=h;(i||m===null||m!==Me.Testing)&&(f={value:H,valueOwner:l,type:Me.DefaultValue,inheritanceLink:null})}if(!f||(f.type===Me.DefaultValue||f.type===Me.External)&&!i||m===null||m!==Me.DefaultValue){const H=(G=p.localTestValues)==null?void 0:G.readValue(l.id);if(H)return{value:H,valueOwner:l,type:Me.Testing,inheritanceLink:null}}const E=ad(l),b=l.getDataType(null);return E&&(!(f!=null&&f.value)||!_a(b)&&rd(f==null?void 0:f.value))?{value:null,valueOwner:l,type:Me.Missing,inheritanceLink:null}:!E&&Pn((f==null?void 0:f.value)||null)?{value:null,valueOwner:l,type:l.readsValue?Me.Inherited:Me.Empty,inheritanceLink:null}:f}function oVe(l,p,i=!1){var f,h,m,E,b,g,_,$,L,j,k,G,H;if(p.execution&&p.execution.hasEntity(l)&&!i){const ie=(f=p.lastExecutionResults)==null?void 0:f.readValue(l.id);if(ie)return{value:ie,valueOwner:l,type:Me.ExecutionResult,inheritanceLink:null}}const r=Ip(l);if(lp.includes(r.type)){const ie=lf(r,p,i),ee=l.codeName||((h=l.declaration)==null?void 0:h.codeName)||ir(se(l,p.project));if(ie!=null&&ie.value&&gr(ie.value.value)){const ue=ie.value.value[ee],ae=xt(l.getDataType(null),l,p.project);return ae==null||ae.metaSync({value:ue},null),{value:ae,valueOwner:l,type:!_t.includes(r.type)&&ie.type===Me.Empty?Me.QueuedAutocalculation:ie.type,inheritanceLink:{sources:[ie],target:l}}}return{value:null,valueOwner:l,type:_t.includes(r.type)?Me.Empty:Me.QueuedAutocalculation,inheritanceLink:null}}const a=(m=p.execution)==null?void 0:m.hasEntity(r),c=((E=p.execution)==null?void 0:E.state)===Sx.Running;if((b=p.persistedExecutionResults)!=null&&b.values[l.id]&&!a&&!c&&!i){const ie=(g=p.persistedExecutionResults)==null?void 0:g.readValue(l.id);if((ie==null?void 0:ie.value)!==null||(ie==null?void 0:ie.valueAsType)!==null)return{value:ie,valueOwner:l,type:Me.ExecutionResult,inheritanceLink:null}}const e=l.parent;if(!e)throw new Error(`Couldn't find the parent that generates the output ${l.id}`);switch(e.type){case d.VariableInstance:{const ee=Ox(e,p,i);if(ee&&ee.value){const ae=l.declaration;if(gr(ee.value.value)){const de=ee.value.value[ae.name],ce=xt(((_=l.declaration)==null?void 0:_.dataType)||null,l,p.project);return ce==null||ce.metaSync({value:de},null),{value:ce,valueOwner:l,type:Me.Inherited,inheritanceLink:{sources:[ee],target:l}}}}const ue=xt((($=l.declaration)==null?void 0:$.dataType)||null,l,p.project);return ue==null||ue.metaSync({value:null},null),{value:ue,valueOwner:l,type:Me.Inherited,inheritanceLink:{sources:ee?[ee]:[],target:l}}}case d.VariableDeclaration:{const ee=iE(e,p,i);if(ee&&ee.value){const ae=l.declaration;if(gr(ee.value.value)){const de=ee.value.value[ae.name],ce=xt(((L=l.declaration)==null?void 0:L.dataType)||null,l,p.project);return ce==null||ce.metaSync({value:de},null),{value:ce,valueOwner:l,type:Me.Inherited,inheritanceLink:{sources:[ee],target:l}}}}const ue=xt(((j=l.declaration)==null?void 0:j.dataType)||null,l,p.project);return ue==null||ue.metaSync({value:null},null),{value:ue,valueOwner:l,type:Me.Inherited,inheritanceLink:{sources:ee?[ee]:[],target:l}}}case d.Operation:{const ie=e.outputs.map(ue=>{var ae,de;if((ae=p.persistedExecutionResults)!=null&&ae.values[ue.id]){const ce=(de=p.persistedExecutionResults)==null?void 0:de.values[ue.id];if(ce.value!==null||ce.valueAsType!==null)return{value:ce,valueOwner:ue,type:Me.ExecutionResult,inheritanceLink:null}}}).filter(ue=>!!ue),ee=xt(((k=l.declaration)==null?void 0:k.dataType)||null,l,p.project);return ee==null||ee.metaSync({value:null},null),{value:ee,valueOwner:l,type:Me.QueuedAutocalculation,inheritanceLink:ie.length?{sources:ie,target:l}:null}}case d.FunctionCall:{const ie=e.inputs.map(ue=>ug(ue,p,i)).filter(ue=>!!ue),ee=xt(((G=l.declaration)==null?void 0:G.dataType)||null,l,p.project);return ee==null||ee.metaSync({value:null},null),{value:ee,valueOwner:l,type:Me.QueuedAutocalculation,inheritanceLink:ie.length?{sources:ie,target:l}:null}}case d.Loop:{const ie=e.inputs.map(ue=>ug(ue,p,i)).filter(ue=>!!ue),ee=xt(((H=l.declaration)==null?void 0:H.dataType)||null,l,p.project);return ee==null||ee.metaSync({value:null},null),{value:ee,valueOwner:l,type:Me.QueuedAutocalculation,inheritanceLink:ie.length?{sources:ie,target:l}:null}}case d.Search:return{value:null,valueOwner:l,type:Me.QueuedAutocalculation,inheritanceLink:null}}return null}function f_(l,p,i=!1){var b,g,_;if(![...Dt,..._t].includes(l.parent.type)||!xE(l))return null;if(((b=l.declaration)==null?void 0:b.type)===d.Property&&l.declaration.static)return lf(l.declaration,p);const r=rE(l,p,i);if(r&&r.type!==Me.Empty&&r.type!==Me.Missing)return r;const a=yr(l.parent),c=Fo(a,p,i),e=l.codeName||((g=l.declaration)==null?void 0:g.codeName)||ir(se(l,p.project)),f=xt(l.getDataType(null),l,p.project),h=ad(l),m=(_=c==null?void 0:c.value)==null?void 0:_.value;if(m&&gr(m)){let $=m[e];m[e]===void 0&&($=null),f==null||f.metaSync({value:$},null);const L=ad(l),j=l.getDataType(null);return L&&(!f||!_a(j)&&rd(f))?{value:null,valueOwner:l,type:Me.Missing,inheritanceLink:null}:{value:f,valueOwner:l,type:c.type,inheritanceLink:{sources:c?[c]:[],target:l}}}return h?{value:null,valueOwner:l,type:Me.Missing,inheritanceLink:null}:{value:null,valueOwner:l,type:l.readsValue?Me.Inherited:Me.Empty,inheritanceLink:null}}function y_(l,p,i=!1){var b,g,_,$,L,j,k,G;if(![...Dt,..._t].includes(l.parent.type)||!xE(l))return null;if(((b=l.declaration)==null?void 0:b.type)===d.Property&&l.declaration.static)return lf(l.declaration,p,i);const r=Dt.includes(l.parent.type)?l.parent:yr(l.parent),a=lf(r,p,i);let c=l;r.type===d.VariableDeclaration&&(c=(l.parent===r?l:r.inputs.find(ie=>{var ee,ue;return((ee=ie.declaration)==null?void 0:ee.id)===((ue=l.declaration)==null?void 0:ue.id)}))||l);const e=BT(c,p,i),f=l.codeName||((g=l.declaration)==null?void 0:g.codeName)||ir(se(l,p.project)),h=(r.type===d.VariableDeclaration,l.defaultValue||xt(l.getDataType(null),l,p.project)),m=(_=a==null?void 0:a.value)==null?void 0:_.value;if(((a==null?void 0:a.type)===Me.ExecutionResult||(a==null?void 0:a.type)===Me.Testing)&&!i&&m&&gr(m)){let H=m[f];return m[f]===void 0&&(H=null),h==null||h.metaSync({value:H},null),{value:h,valueOwner:l,type:a.type,inheritanceLink:{sources:a?[a]:[],target:l}}}if(e&&e.type!==Me.Empty&&e.type!==Me.Missing)return e;if(m&&gr(m)){let H=m[f];m[f]===void 0&&(H=null),h!=null&&h.standaloneParent&&(h==null||h.metaSync({value:H},null));const ie=ad(l),ee=l.getDataType(null),ue=ie&&(!h||!_a(ee)&&rd(h)),ae=!!(($=p.execution)!=null&&$.entities.length),de=(L=p.execution)==null?void 0:L.hasEntity(r),ce=r.readsValue;if(ce){const ne=(j=p.execution)==null?void 0:j.hasEntity(ce);if(ue&&(!ae||ae&&ne&&de||ae&&!ne&&!de))return{value:null,valueOwner:l,type:Me.Inherited,inheritanceLink:null}}if(l.readsValue){const ne=(k=p.execution)==null?void 0:k.hasEntity(l.readsValue);if(ue&&(!ae||ae&&ne&&de||ae&&!ne&&!de))return{value:null,valueOwner:l,type:Me.Inherited,inheritanceLink:null}}return ue?{value:null,valueOwner:l,type:Me.Missing,inheritanceLink:null}:{value:h,valueOwner:l,type:((G=h==null?void 0:h.parent)==null?void 0:G.id)===(l==null?void 0:l.id)?a.type:Me.Inherited,inheritanceLink:{sources:a?[a]:[],target:l}}}return BT(l,p,i)}function rE(l,p,i=!1){var _,$,L,j,k,G;const r=ht(l),a=!!((_=p.execution)!=null&&_.entities.length),c=($=p.execution)==null?void 0:$.hasEntity(r),e=l.readsValue;let f=null;if(e){const H=(L=p.execution)==null?void 0:L.hasEntity(e);(!a||a&&H&&c||a&&!H&&!c)&&(f=bm(l,p,i))}const h=l.defaultValue,m=p.getValueTypePreference(l.id);if(!f&&h&&(i||m===null||m!==Me.Testing)&&(f={value:h,valueOwner:l,type:rd(h)?Me.Empty:Me.DefaultValue,inheritanceLink:null}),!f||f.type===Me.DefaultValue||(f==null?void 0:f.type)===Me.Empty){const H=(j=p.persistedExecutionResults)==null?void 0:j.readValue(l.id);if(H&&!i)return{value:H,valueOwner:l,type:Me.Testing,inheritanceLink:null};const ie=(k=p.localTestValues)==null?void 0:k.readValue(l.id);if(ie&&!i&&(m===null||m!==Me.DefaultValue))return{value:ie,valueOwner:l,type:Me.Testing,inheritanceLink:null}}const E=ad(l),b=l.getDataType(null),g=E&&(!(f!=null&&f.value)||!_a(b)&&rd(f==null?void 0:f.value));if(l.readsValue){const H=(G=p.execution)==null?void 0:G.hasEntity(l.readsValue);if(g&&(!a||a&&H&&c||a&&!H&&!c))return{value:null,valueOwner:l,type:Me.Inherited,inheritanceLink:null}}return g?{value:null,valueOwner:l,type:Me.Missing,inheritanceLink:(f==null?void 0:f.inheritanceLink)||null}:!E&&(!f||f.type===Me.Inherited)&&!(f!=null&&f.inheritanceLink)?{value:null,valueOwner:l,type:l.readsValue||!(f!=null&&f.value)?Me.Inherited:Me.Empty,inheritanceLink:null}:f}function BT(l,p,i=!1){var e,f;if(p.execution&&p.execution.hasEntity(l)&&!i){const h=(e=p.lastExecutionResults)==null?void 0:e.readValue(l.id);if(h)return{value:h,valueOwner:l,type:Me.ExecutionResult,inheritanceLink:null}}const r=(f=p.localTestValues)==null?void 0:f.readValue(l.id),a=p.getValueTypePreference(l.id);return r&&!i&&(a===null||a!==Me.DefaultValue)?{value:r,valueOwner:l,type:Me.Testing,inheritanceLink:null}:rE(l,p,i)}function ug(l,p,i=!1){var r,a;return _t.includes(l.parent.type)&&(r=yr(l.parent).dataType)!=null&&r.isObject()||Dt.includes(l.parent.type)&&(a=l.parent.getDataType(null))!=null&&a.isObject()?f_(l,p,i):rE(l,p,i)}function dVe(l,p,i=!1){var r,a;return _t.includes(l.parent.type)&&(r=yr(l.parent).dataType)!=null&&r.isObject()||Dt.includes(l.parent.type)&&(a=l.parent.getDataType(null))!=null&&a.isObject()?y_(l,p,i):BT(l,p,i)}function uVe(l,p,i=!1){var E,b;if(!l.static)return null;if(p.execution){const g=(E=p.lastExecutionResults)==null?void 0:E.readValue(l.id);if(g&&!i)return{value:g,valueOwner:l,type:Me.ExecutionResult,inheritanceLink:null}}const r=(b=p.localTestValues)==null?void 0:b.readValue(l.id),a=p.getValueTypePreference(l.id);if(r&&!i&&(a===null||a!==Me.DefaultValue))return{value:r,valueOwner:l,type:Me.Testing,inheritanceLink:null};const c=l.defaultValue;let e=null;c&&(i||a===null||a!==Me.Testing)&&(e={value:c,valueOwner:l,type:Me.DefaultValue,inheritanceLink:null});const f=ad(l),h=l.getDataType(null);return f&&(!(e!=null&&e.value)||!_a(h)&&rd(e==null?void 0:e.value))?{value:null,valueOwner:l,type:Me.Missing,inheritanceLink:null}:Pn(e==null?void 0:e.value)?{value:null,valueOwner:l,type:Me.Empty,inheritanceLink:null}:e}function pVe(l,p,i=!1){var E,b;if(p.execution&&p.execution.hasEntity(l)&&!i){const g=(E=p.lastExecutionResults)==null?void 0:E.readValue(l.id);if(g)return{value:g,valueOwner:l,type:Me.ExecutionResult,inheritanceLink:null}}const r=(b=p.localTestValues)==null?void 0:b.readValue(l.id),a=p.getValueTypePreference(l.id);if(r&&!i&&(a===null||a!==Me.DefaultValue))return{value:r,valueOwner:l,type:Me.Testing,inheritanceLink:null};const c=l.defaultValue;let e=null;c&&(i||a===null||a!==Me.Testing)&&(e={value:c,valueOwner:l,type:Me.DefaultValue,inheritanceLink:null});const f=ad(l),h=l.getDataType(null);return f&&(!(e!=null&&e.value)||!_a(h)&&rd(e==null?void 0:e.value))?{value:null,valueOwner:l,type:Me.Missing,inheritanceLink:null}:Pn((e==null?void 0:e.value)||null)?{value:null,valueOwner:l,type:Me.Empty,inheritanceLink:null}:e}function lf(l,p,i=!1){switch(l.type){case d.ArgumentDeclaration:return lVe(l,p,i);case d.InputMap:return dVe(l,p,i);case d.VariableDeclaration:return Cx(l,p,i);case d.VariableInstance:return sVe(l,p,i);case d.OutputMap:return oVe(l,p,i);case d.ReturnStatement:case d.BreakStatement:case d.ContinueStatement:return _x(l,p,i);case d.Property:return uVe(l,p,i);case d.ValueDescriptor:return pVe(l,p,i);case d.Operation:case d.FunctionCall:case d.InternalCall:case d.Search:return nVe(l,p,i);default:return null}}function Fo(l,p,i=!1){switch(l.type){case d.InputMap:return ug(l,p,i);case d.VariableDeclaration:return iE(l,p,i);case d.VariableInstance:return Ox(l,p,i);case d.ReturnStatement:case d.BreakStatement:case d.ContinueStatement:return _x(l,p,i);default:return null}}function QAi(l){var p;if(l&&l.type===Me.DefaultValue&&l.value&&l.valueOwner&&(!Zg.includes(l.valueOwner.type)||((p=l.valueOwner.defaultValue)==null?void 0:p.id)===l.value.id)){const i=xt(l.valueOwner.getDataType(null),l.valueOwner,l.valueOwner.project);return{type:Me.DefaultValue,value:i,valueOwner:l.valueOwner,inheritanceLink:null}}return l}function tf(l,p,i,r){let a=!1,c=null,e=null;r instanceof q?(a=!0,c=r,e=null):(c=null,e=r);const f=l.parent;return p.getVariableDeclarations().forEach(m=>{var b,g,_,$,L,j;const E=m.getDataType(null);if(((b=E==null?void 0:E.entity)==null?void 0:b.id)===f.id){let k=a?m.defaultValue:e==null?void 0:e.readValue(m.id);k?!a&&k&&k.id===((g=m.defaultValue)==null?void 0:g.id)&&(k=xt(m.getDataType(null),m,p)):a?k=wu(m.getDataType(null),m,p,c):k=xt(m.getDataType(null),m,p);const G=se(l,p),H=l.codeName||((_=l.extends)==null?void 0:_.codeName)||(($=l.implements[0])==null?void 0:$.codeName)||ir(G);let ie={};((j=(L=m.dataType)==null?void 0:L.entity)==null?void 0:j.type)===d.DefinitionEntity&&(ie={...ie,...m.dataType.entity.getActiveRawDefaultValue()}),gr(k==null?void 0:k.value)&&(ie={...ie,...k.value}),ie[H]=i,k==null||k.metaSync({value:ie},c),a||e==null||e.writeValue(m,k);return}}),c}function MT(l,p,i,r){var _,$,L,j;let a=!1,c=null,e=null;r instanceof q?(a=!0,c=r,e=null):(c=null,e=r);const f=yr(l.parent),h=f.getDataType(null);if(!(h!=null&&h.isObject()))return c;let m=a?f.defaultValue:e==null?void 0:e.readValue(f.id);m?!a&&m&&m.id===((_=f.defaultValue)==null?void 0:_.id)&&(m=xt(f.getDataType(null),f,p)):a?m=wu(f.getDataType(null),f,p,c):m=xt(f.getDataType(null),f,p);const E=se(l,p),b=l.codeName||(($=l.declaration)==null?void 0:$.codeName)||ir(E);let g={};if(((j=(L=f.dataType)==null?void 0:L.entity)==null?void 0:j.type)===d.DefinitionEntity&&(g={...g,...f.dataType.entity.getActiveRawDefaultValue()}),gr(m==null?void 0:m.value)&&(g={...g,...m.value}),g[b]=i,m==null||m.metaSync({value:g},c),a||e==null||e.writeValue(f,m),(i===""||i===null||i===void 0)&&l.type===d.OutputMap){const k=f.inputs.find(G=>{var H,ie;return((H=G.declaration)==null?void 0:H.id)===((ie=l.declaration)==null?void 0:ie.id)||se(G,p)===E});if(k){let G=a?k.defaultValue:e==null?void 0:e.readValue(k.id);G&&G.metaSync({value:null},c),a||e==null||e.removeValue(k.id)}}return c}function cVe(l,p,i){var e,f,h,m,E;let r=!1,a=null,c=null;if(i instanceof q?(r=!0,a=i,c=null):(a=null,c=i),_t.includes(l.type)){const b=yr(l);(e=b.dataType)!=null&&e.isObject()&&b.inputs.forEach(g=>{var _,$,L,j,k,G;if(((_=g.declaration)==null?void 0:_.type)===d.Property&&g.declaration.static){let H=r?(($=g.getDefaultValue)==null?void 0:$.call(g))||null:c==null?void 0:c.readValue(g.declaration.id);H?!r&&H&&H.id===((L=g.declaration.defaultValue)==null?void 0:L.id)&&(H=xt(g.declaration.getDataType(null),g.declaration,p)):r?H=wu(g.declaration.getDataType(null),g.declaration,p,a):H=xt(g.declaration.getDataType(null),g.declaration,p),H==null||H.metaSync({value:null},a),r||c==null||c.removeValue((j=g.declaration)==null?void 0:j.id)}else if(((k=g.declaration)==null?void 0:k.type)===d.Property){let H=r?((G=g.getDefaultValue)==null?void 0:G.call(g))||null:c==null?void 0:c.readValue(g.id);H&&H.metaSync({value:null},a),r||c==null||c.removeValue(g.id)}})}else l.type===d.InputMap?((f=l.declaration)==null?void 0:f.type)===d.Property&&l.declaration.static?tf(l.declaration,p,null,i):_t.includes(l.parent.type)&&((h=l.declaration)==null?void 0:h.type)===d.Property&&MT(l,p,null,i):l.type===d.OutputMap?((m=l.declaration)==null?void 0:m.type)===d.Property&&l.declaration.static?tf(l.declaration,p,null,i):_t.includes(l.parent.type)&&((E=l.declaration)==null?void 0:E.type)===d.Property&&MT(l,p,null,i):l.type===d.Property&&l.static&&tf(l,p,null,i);return a}function fVe(l,p,i,r){var f,h,m,E,b,g,_;let a=!1,c=null,e=null;if(r instanceof q?(a=!0,c=r,e=null):(c=null,e=r),_t.includes(p.type)){const $=yr(p);if((f=$.dataType)!=null&&f.isObject()){let L={};((m=(h=$.dataType)==null?void 0:h.entity)==null?void 0:m.type)===d.DefinitionEntity&&(L={...L,...$.dataType.entity.getActiveRawDefaultValue()});const j=gr(l)?l:L;$.inputs.forEach(k=>{var G,H,ie,ee,ue,ae;if(((G=k.declaration)==null?void 0:G.type)===d.Property&&k.declaration.static){let de=a?((H=p.getDefaultValue)==null?void 0:H.call(p))||null:e==null?void 0:e.readValue(k.declaration.id);de?!a&&de&&de.id===((ie=k.declaration.defaultValue)==null?void 0:ie.id)&&(de=xt(k.declaration.getDataType(null),k.declaration,i)):a?de=wu(k.declaration.getDataType(null),k.declaration,i,c):de=xt(k.declaration.getDataType(null),k.declaration,i);const ce=se(k,i),ne=k.codeName||((ee=k.declaration)==null?void 0:ee.codeName)||ir(ce),le=j[ne];de==null||de.metaSync({value:le},c),a||e==null||e.writeValue(k.declaration,de)}else if(((ue=k.declaration)==null?void 0:ue.type)===d.Property){let de=a?((ae=p.getDefaultValue)==null?void 0:ae.call(p))||null:e==null?void 0:e.readValue(k.id);de&&de.metaSync({value:null},c),a||e==null||e.removeValue(k.id)}})}}else p.type===d.InputMap?((E=p.declaration)==null?void 0:E.type)===d.Property&&p.declaration.static?tf(p.declaration,i,l,r):_t.includes(p.parent.type)&&((b=p.declaration)==null?void 0:b.type)===d.Property&&MT(p,i,l,r):p.type===d.OutputMap?((g=p.declaration)==null?void 0:g.type)===d.Property&&p.declaration.static?tf(p.declaration,i,null,r):_t.includes(p.parent.type)&&((_=p.declaration)==null?void 0:_.type)===d.Property&&MT(p,i,null,r):p.type===d.Property&&p.static&&tf(p,i,l,r);return c}function egi(l,p,i){const r=Jo(l,p);let a=!1,c=null,e=null;return i instanceof q?(a=!0,c=i,e=null):(c=null,e=i),r.forEach(f=>{var m;let h=a?((m=f.getDefaultValue)==null?void 0:m.call(f))||null:e==null?void 0:e.readValue(f.id);a?h==null||h.remove({ignoreUpstream:!1},c):e==null||e.removeValue(f.id),cVe(f,p,i)}),c}function tgi(l,p,i,r){const a=Jo(p,i);let c=!1,e=null,f=null;return r instanceof q?(c=!0,e=r,f=null):(e=null,f=r),i.diggestedBuiltInBaseEntitiesIds.has(p.id)||a.forEach(h=>{var E,b,g,_;if(i.diggestedBuiltInBaseEntitiesIds.has(h.id))return;let m=null;if(c){const $=((E=h.getDefaultValue)==null?void 0:E.call(h))||null;$&&(i.diggestedBuiltInBaseEntitiesIds.has($.id)||((b=$.parent)==null?void 0:b.id)!==h.id?m=$.clone(e,h):m=$)}else m=f==null?void 0:f.readValue(h.id);m?!c&&m&&m.id===((_=(g=h.getDefaultValue)==null?void 0:g.call(h))==null?void 0:_.id)&&(m=xt(h.getDataType(null),h,i)):c?(m=wu(h.getDataType(null),h,i,e),e==null||e.add(m,W.Added)):m=xt(h.getDataType(null),h,i),m==null||m.setValueAsType(null,e),m==null||m.metaSync({value:l},e),c||f==null||f.writeValue(h,m),fVe(l,h,i,r)}),e}function rf(l,p,i,r){let a=!1,c=null,e=null;r instanceof q?(a=!0,c=r,e=null):(c=null,e=r);const f=l.parent;return p.getVariableDeclarations().forEach(m=>{var b,g,_,$,L,j;const E=m.getDataType(null);if(((b=E==null?void 0:E.entity)==null?void 0:b.id)===f.id){let k=a?m.defaultValue:e==null?void 0:e.readValue(m.id);k?!a&&k&&k.id===((g=m.defaultValue)==null?void 0:g.id)&&(k=xt(m.getDataType(null),m,p)):a?k=wu(m.getDataType(null),m,p,c):k=xt(m.getDataType(null),m,p);const G=se(l,p),H=l.codeName||((_=l.extends)==null?void 0:_.codeName)||(($=l.implements[0])==null?void 0:$.codeName)||ir(G);let ie={};((j=(L=m.dataType)==null?void 0:L.entity)==null?void 0:j.type)===d.DefinitionEntity&&(ie={...ie,...m.dataType.entity.getActiveRawDefaultValue()}),gr(k==null?void 0:k.value)&&(ie={...ie,...k.value}),Array.isArray(i)?ie[H]=(i==null?void 0:i.map(ee=>ee.toShallowJSON()))||null:ie[H]=(i==null?void 0:i.toShallowJSON())||null,k==null||k.metaSync({value:ie},c),a||e==null||e.writeValue(m,k);return}}),c}function GT(l,p,i,r){var _,$,L,j;let a=!1,c=null,e=null;r instanceof q?(a=!0,c=r,e=null):(c=null,e=r);const f=yr(l.parent),h=f.getDataType(null);if(!(h!=null&&h.isObject()))return c;let m=a?f.defaultValue:e==null?void 0:e.readValue(f.id);m?!a&&m&&m.id===((_=f.defaultValue)==null?void 0:_.id)&&(m=xt(f.getDataType(null),f,p)):a?m=wu(f.getDataType(null),f,p,c):m=xt(f.getDataType(null),f,p);const E=se(l,p),b=l.codeName||(($=l.declaration)==null?void 0:$.codeName)||ir(E);let g={};if(((j=(L=f.dataType)==null?void 0:L.entity)==null?void 0:j.type)===d.DefinitionEntity&&(g={...g,...f.dataType.entity.getActiveRawDefaultValue()}),gr(m==null?void 0:m.value)&&(g={...g,...m.value}),Array.isArray(i)?g[b]=(i==null?void 0:i.map(k=>k.toShallowJSON()))||null:g[b]=(i==null?void 0:i.toShallowJSON())||null,m==null||m.metaSync({value:g},c),a||e==null||e.writeValue(f,m),i==null&&l.type===d.OutputMap){const k=f.inputs.find(G=>{var H,ie;return((H=G.declaration)==null?void 0:H.id)===((ie=l.declaration)==null?void 0:ie.id)||se(G,p)===E});if(k){let G=a?k.defaultValue:e==null?void 0:e.readValue(k.id);G&&(Array.isArray(i)?G==null||G.setValueAsTypeList(i,c):G==null||G.setValueAsTypeSingle(i,c)),a||e==null||e.removeValue(k.id)}}return c}function yVe(l,p,i){var r,a,c,e;return l.type===d.InputMap?((r=l.declaration)==null?void 0:r.type)===d.Property&&l.declaration.static?rf(l.declaration,p,null,i):_t.includes(l.parent.type)&&((a=l.declaration)==null?void 0:a.type)===d.Property&>(l,p,null,i):l.type===d.OutputMap?((c=l.declaration)==null?void 0:c.type)===d.Property&&l.declaration.static?rf(l.declaration,p,null,i):_t.includes(l.parent.type)&&((e=l.declaration)==null?void 0:e.type)===d.Property&>(l,p,null,i):l.type===d.Property&&l.static&&rf(l,p,null,i),i}function hVe(l,p,i,r){var a,c,e,f;return p.type===d.InputMap?((a=p.declaration)==null?void 0:a.type)===d.Property&&p.declaration.static?rf(p.declaration,i,l,r):_t.includes(p.parent.type)&&((c=p.declaration)==null?void 0:c.type)===d.Property&>(p,i,l,r):p.type===d.OutputMap?((e=p.declaration)==null?void 0:e.type)===d.Property&&p.declaration.static?rf(p.declaration,i,null,r):_t.includes(p.parent.type)&&((f=p.declaration)==null?void 0:f.type)===d.Property&>(p,i,null,r):p.type===d.Property&&p.static&&rf(p,i,l,r),r}function igi(l,p,i){const r=Jo(l,p);let a=!1,c=null,e=null;return i instanceof q?(a=!0,c=i,e=null):(c=null,e=i),r.forEach(f=>{var m;let h=a?(m=f.getDefaultValue)==null?void 0:m.call(f):e==null?void 0:e.readValue(f.id);a?h==null||h.remove({ignoreUpstream:!1},c):e==null||e.removeValue(f.id),yVe(f,p,i)}),c}function rgi(l,p,i,r){const a=Jo(p,i);let c=!1,e=null,f=null;return r instanceof q?(c=!0,e=r,f=null):(e=null,f=r),a.forEach(h=>{var E,b,g;let m=c?(E=h.getDefaultValue)==null?void 0:E.call(h):f==null?void 0:f.readValue(h.id);m?!c&&m&&m.id===((g=(b=h.getDefaultValue)==null?void 0:b.call(h))==null?void 0:g.id)&&(m=xt(h.getDataType(null),h,h.project)):c?m=wu(h.getDataType(null),h,i,e):m=xt(h.getDataType(null),h,i),Array.isArray(l)?m==null||m.setValueAsTypeList(l,e):m==null||m.setValueAsTypeSingle(l,e),m==null||m.metaSync({value:null},e),c||f==null||f.writeValue(h,m),hVe(l,h,i,r)}),e}class QR{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 De=(l=>(l[l.High=1]="High",l[l.Normal=5]="Normal",l[l.Low=10]="Low",l))(De||{}),te=(l=>(l.Logic="logic",l.EditorGUI="editor-gui",l.GUI="gui",l.Editor="editor",l.Compile="compile",l.PublicationRun="publication-run",l))(te||{}),Ce=(l=>(l.All="*",l.OnAll="on:*",l.EmitAll="emit:*",l.ReadAll="read:*",l.WriteAll="write:*",l.UpdateAll="update:*",l.DoAll="do:*",l.OnLogicAll="on:logic:*",l.EmitLogicAll="emit:logic:*",l.ReadLogicAll="read:logic:*",l.WriteLogicAll="write:logic:*",l.UpdateLogicAll="update:logic:*",l.DoLogicAll="do:logic:*",l.OnGUIAll="on:gui:*",l.EmitGUIAll="emit:gui:*",l.ReadGUIAll="read:gui:*",l.WriteGUIAll="write:gui:*",l.UpdateGUIAll="update:gui:*",l.DoGUIAll="do:gui:*",l.OnEditorAll="on:editor:*",l.EmitEditorAll="emit:editor:*",l.ReadEditorAll="read:editor:*",l.WriteEditorAll="write:editor:*",l.UpdateEditorAll="update:editor:*",l.DoEditorAll="do:editor:*",l.OnCompileBefore="on:compile:before:DefinitionEntity",l.OnCompileDefault="on:compile:default:DefinitionEntity",l.OnCompileAfter="on:compile:after:DefinitionEntity",l.EmitCompile="emit:compile:DefinitionEntity",l.DoEditorPublish="do:editor:publish",l.PostGUICanvasSlotNewToolbarButton="write:gui:canvas:slot:toolbar-button",l.ReadGUICanvasSlotToolbarButtons="read:gui:canvas:slot:toolbar-buttons",l.UpdateGUIGlobalTheme="update:gui:global:theme",l))(Ce||{});class mVe{constructor(p){R(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 TVe extends mVe{constructor(p,i){super(i),this.parentExtension=p}}class _e{constructor(p,i){R(this,"manifest");R(this,"module");R(this,"state");this.extensionsRegistry=p,this.state=new TVe(this,i)}}class h_ extends QR{constructor(i,r){super(i,te.Logic);R(this,"id");this._project=r,this.id=r.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,r,a,c=!1,e="here-this"){return this._project.toLatestChangeSet(i,r,a,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,r,a){return this._project.onDetachedDependencyRemoved(i,r,a)}onDetachedDependencyRestored(i,r,a){return this._project.onDetachedDependencyRestored(i,r,a)}increaseVersion(i){return this._project.increaseVersion(i)}captureVersion(){return this._project.captureVersion()}restoreVersion(i){return this._project.restoreVersion(i)}updateWithShallowTransfer(i,r){return this._project.updateWithShallowTransfer(i,r)}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,r){return this._project.metaSync(i,r)}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(i){return this._project.toGenerationTarget(i)}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()}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,r=!1){return this._project.requestActiveDynamicValue(i,r)}undo(){return this._project.undo()}redo(){return this._project.redo()}applyExternalChangeSet(i){return this._project.applyExternalChangeSet(i)}toFullProjectTransfer(){return this._project.toFullProjectTransfer()}}function ngi(l,p){return p instanceof h_?p:new h_(l,p)}const Wy="built-in-function-implementations__",Ne="operations-implementations__",qa="conditions-implementations__",Oe={UUID:"uuid",SEARCH_NODE_IMPLEMENTATION:"search-node-implementation",BUILT_IN_FUNCTION_IMPLEMENTATIONS__ABORT_EXECUTION:Wy+Vr.AbortExecution,BUILT_IN_FUNCTION_IMPLEMENTATIONS__CREATE_PERSISTED_ENTITY:Wy+Vr.CreatePersistedEntity,BUILT_IN_FUNCTION_IMPLEMENTATIONS__UPDATE_PERSISTED_ENTITY:Wy+Vr.UpdatePersistedEntity,BUILT_IN_FUNCTION_IMPLEMENTATIONS__DELETE_PERSISTED_ENTITY:Wy+Vr.DeletePersistedEntity,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_EMPTY:Ne+Gt.Empty,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_NOT_EMPTY:Ne+Gt.NotEmpty,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_PRIMITIVE_EQUAL:Ne+Gt.PrimitiveEqual,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_PRIMITIVE_NOT_EQUAL:Ne+Gt.PrimitiveNotEqual,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__HTTP_REQUEST:Ne+na.HttpRequest,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__VALIDATE_ENTITY:Ne+xe.Validate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_SEQUENTIAL:Ne+Hi.Sequential,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_PARALLEL:Ne+Hi.Parallel,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_WAIT:Ne+Hi.Wait,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_JOIN:Ne+fe.Join,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SPLIT:Ne+fe.Split,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_LAST_N_ITEMS:Ne+fe.DeleteLastNItems,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_FIRST_N_ITEMS:Ne+fe.DeleteFirstNItems,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_AT_INDEX:Ne+fe.DeleteAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_ADD_AT_INDEX:Ne+fe.AddAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_FIRST_N_ITEMS:Ne+fe.ReplaceFirstNItems,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_LAST_N_ITEMS:Ne+fe.ReplaceLastNItems,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_ALL:Ne+fe.ReplaceAll,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_AT_INDEX:Ne+fe.ReplaceAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_INDEX_ITEM:Ne+fe.GetIndexItem,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_FIRST:Ne+fe.GetFirst,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST:Ne+fe.GetLast,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_APPEND:Ne+fe.Append,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PREPEND:Ne+fe.Prepend,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REVERSE:Ne+fe.Reverse,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LENGTH:Ne+fe.GetLength,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_FIRST_N_ITEMS:Ne+fe.GetFirstNItems,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST_N_ITEMS:Ne+fe.GetLastNItems,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SLICE:Ne+fe.Slice,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONCAT:Ne+fe.Concat,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_INDEX_OF:Ne+fe.GetIndexOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST_INDEX_OF:Ne+fe.GetLastIndexOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_UNIQUE:Ne+fe.Unique,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_FLATTEN:Ne+fe.Flatten,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SORT:Ne+fe.Sort,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SHUFFLE:Ne+fe.Shuffle,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CHUNK:Ne+fe.Chunk,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PAD_START:Ne+fe.PadStart,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PAD_END:Ne+fe.PadEnd,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPEAT:Ne+fe.Repeat,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LENGTH:Ne+Z.GetLength,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TO_LOWER_CASE:Ne+Z.ToLowerCase,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TO_UPPER_CASE:Ne+Z.ToUpperCase,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_JOIN:Ne+Z.Join,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONTAINS:Ne+fe.Contains,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONTAINS_ALL:Ne+fe.ContainsAll,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONTAINS_ANY:Ne+fe.ContainsAny,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT_AT_INDEX:Ne+Z.SplitAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT_AT_ALL_SEPARATORS:Ne+Z.SplitAtAllSeparators,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT_AT_FIRST_SEPARATOR:Ne+Z.SplitAtFirstSeparator,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT_AT_LAST_SEPARATOR:Ne+Z.SplitAtLastSeparator,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_LAST_N_CHARS:Ne+Z.DeleteLastNChars,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_FIRST_N_CHARS:Ne+Z.DeleteFirstNChars,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_AT_INDEX:Ne+Z.DeleteAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ADD_AT_INDEX:Ne+Z.AddAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_FIRST_N_CHARS:Ne+Z.ReplaceFirstNChars,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_LAST_N_CHARS:Ne+Z.ReplaceLastNChars,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_AT_INDEX:Ne+Z.ReplaceAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_FIRST_MATCH:Ne+Z.ReplaceFirstMatch,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_LAST_MATCH:Ne+Z.ReplaceLastMatch,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_ALL_MATCHES:Ne+Z.ReplaceAllMatches,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_INDEX_ITEM:Ne+Z.GetIndexItem,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_FIRST_N_CHARS:Ne+Z.GetFirstNChars,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LAST_N_CHARS:Ne+Z.GetLastNChars,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_INDEX_OF:Ne+Z.GetIndexOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_APPEND:Ne+Z.Append,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PREPEND:Ne+Z.Prepend,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REVERSE:Ne+Z.Reverse,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TRIM:Ne+Z.Trim,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TRIM_START:Ne+Z.TrimStart,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TRIM_END:Ne+Z.TrimEnd,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SUBSTRING:Ne+Z.Substring,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SLICE:Ne+Z.Slice,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PAD_START:Ne+Z.PadStart,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PAD_END:Ne+Z.PadEnd,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPEAT:Ne+Z.Repeat,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LAST_INDEX_OF:Ne+Z.GetLastIndexOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_MATCH_REGEX:Ne+Z.MatchRegex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_MATCH_ALL_REGEX:Ne+Z.MatchAllRegex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SEARCH_REGEX:Ne+Z.SearchRegex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_REGEX:Ne+Z.ReplaceRegex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_NORMALIZE_UNICODE:Ne+Z.NormalizeUnicode,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REMOVE_DIACRITICS:Ne+Z.RemoveDiacritics,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_COUNT_OCCURRENCES:Ne+Z.CountOccurrences,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ENSURE_PREFIX:Ne+Z.EnsurePrefix,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ENSURE_SUFFIX:Ne+Z.EnsureSuffix,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REMOVE_PREFIX:Ne+Z.RemovePrefix,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REMOVE_SUFFIX:Ne+Z.RemoveSuffix,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ADDITION:Ne+pe.Addition,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SUBTRACTION:Ne+pe.Subtraction,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MULTIPLICATION:Ne+pe.Multiplication,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_DIVISION:Ne+pe.Division,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_REMAINDER:Ne+pe.Remainder,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_EXPONENTIATION:Ne+pe.Exponentiation,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ABSOLUTE:Ne+pe.Absolute,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SIGN:Ne+pe.Sign,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ROUND:Ne+pe.Round,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_NEGATE:Ne+pe.Negate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_FLOOR:Ne+pe.Floor,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_CEIL:Ne+pe.Ceil,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_CLAMP:Ne+pe.Clamp,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TRUNC:Ne+pe.Trunc,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ROUND_TO_DECIMALS:Ne+pe.RoundToDecimals,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SNAP_TO_STEP:Ne+pe.SnapToStep,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MAP_RANGE:Ne+pe.MapRange,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_AVERAGE:Ne+pe.Average,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MEDIAN:Ne+pe.Median,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MIN_OF:Ne+pe.MinOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MAX_OF:Ne+pe.MaxOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SQUARE_ROOT:Ne+pe.SquareRoot,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_CUBE_ROOT:Ne+pe.CubeRoot,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_NTH_ROOT:Ne+pe.NthRoot,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_EXP:Ne+pe.Exp,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LOG_NATURAL:Ne+pe.LogNatural,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LOG10:Ne+pe.Log10,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SIN:Ne+pe.Sin,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_COS:Ne+pe.Cos,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TAN:Ne+pe.Tan,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ASIN:Ne+pe.Asin,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ACOS:Ne+pe.Acos,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ATAN:Ne+pe.Atan,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ATAN2:Ne+pe.Atan2,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TO_RADIANS:Ne+pe.ToRadians,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TO_DEGREES:Ne+pe.ToDegrees,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_PERCENT_OF:Ne+pe.PercentOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_PERCENTAGE_CHANGE:Ne+pe.PercentageChange,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MORE_THAN:Ne+pe.MoreThan,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LESS_THAN:Ne+pe.LessThan,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LESS_THAN_OR_EQUAL:Ne+pe.LessThanOrEqual,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MORE_THAN_OR_EQUAL:Ne+pe.MoreThanOrEqual,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_INTEGER:Ne+it.GenerateRandomInteger,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_FLOAT:Ne+it.GenerateRandomFloat,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_HEXADECIMAL:Ne+it.GenerateRandomHexadecimal,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE62:Ne+it.GenerateRandomBase62,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE64:Ne+it.GenerateRandomBase64,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_ALPHANUMERIC:Ne+it.GenerateRandomAlphanumeric,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_IDENTIFIER:Ne+it.GenerateIdentifier,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_UUIDV4:Ne+it.GenerateRandomUUIDv4,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_SHORT_IDENTIFIER:Ne+it.GenerateShortIdentifier,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_HEXADECIMAL_TOKEN:Ne+it.GenerateHexadecimalToken,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_STARTS_WITH:Ne+Z.StartsWith,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ENDS_WITH:Ne+Z.EndsWith,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_CONTAINS:Ne+Z.Contains,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_MATCHES_REGEX:Ne+Z.MatchesRegex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_CURRENT_TIMESTAMP:Ne+K.GetCurrentTimestamp,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_FORMAT_DATE:Ne+K.FormatDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_PARSE_DATE:Ne+K.ParseDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_ADD_TO_DATE:Ne+K.AddToDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SUBTRACT_FROM_DATE:Ne+K.SubtractFromDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_DIFFERENCE_BETWEEN_DATES:Ne+K.DifferenceBetweenDates,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_DATE:Ne+K.ToDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_UNIX:Ne+K.ToUnix,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_FROM_UNIX:Ne+K.FromUnix,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_ISO_STRING:Ne+K.ToISOString,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_YEAR:Ne+K.GetYear,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_MONTH:Ne+K.GetMonth,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_DATE:Ne+K.GetDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_HOUR:Ne+K.GetHour,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_MINUTE:Ne+K.GetMinute,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_SECOND:Ne+K.GetSecond,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_MILLISECOND:Ne+K.GetMillisecond,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_ISO_WEEKDAY:Ne+K.GetIsoWeekday,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_WEEK_OF_YEAR:Ne+K.GetWeekOfYear,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_QUARTER:Ne+K.GetQuarter,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_DAY_OF_YEAR:Ne+K.GetDayOfYear,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_DAYS_IN_MONTH:Ne+K.GetDaysInMonth,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_CURRENT_IANA_TIMEZONE:Ne+K.GetCurrentIanaTimeZone,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_YEAR:Ne+K.SetYear,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_MONTH:Ne+K.SetMonth,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_DATE:Ne+K.SetDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_HOUR:Ne+K.SetHour,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_MINUTE:Ne+K.SetMinute,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_SECOND:Ne+K.SetSecond,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_MILLISECOND:Ne+K.SetMillisecond,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_ISO_WEEKDAY:Ne+K.SetIsoWeekday,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_QUARTER:Ne+K.SetQuarter,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_START_OF:Ne+K.StartOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_END_OF:Ne+K.EndOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_ROUND_TO:Ne+K.RoundTo,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_BEFORE:qa+K.IsBefore,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_AFTER:qa+K.IsAfter,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_SAME:qa+K.IsSame,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_SAME_OR_BEFORE:qa+K.IsSameOrBefore,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_SAME_OR_AFTER:qa+K.IsSameOrAfter,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_BETWEEN:qa+K.IsBetween,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_VALID:qa+K.IsValid,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_LEAP_YEAR:qa+K.IsLeapYear,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_CLAMP_TO_RANGE:Ne+K.ClampToRange,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_MIN_OF:Ne+K.MinOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_MAX_OF:Ne+K.MaxOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_FROM_NOW:Ne+K.FromNow,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_NOW:Ne+K.ToNow,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_HUMANIZE_DIFF:Ne+K.HumanizeDiff,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_ADD_BUSINESS_DAYS:Ne+K.AddBusinessDays,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_NEXT_WEEKDAY:Ne+K.NextWeekday,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_PREVIOUS_WEEKDAY:Ne+K.PreviousWeekday,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_UTC:Ne+K.ToUTC,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_CONVERT_TIMEZONE:Ne+K.ConvertTimezone,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_TIMEZONE_OFFSET:Ne+K.GetTimezoneOffset,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_UTC_OFFSET:Ne+K.SetUTCOffset,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_READ_KEY:Ne+xe.ReadKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_WRITE_KEY:Ne+xe.WriteKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_DELETE_KEY:Ne+xe.DeleteKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_READ_NESTED_KEY:Ne+xe.ReadNestedKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_WRITE_NESTED_KEY:Ne+xe.WriteNestedKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_DELETE_NESTED_KEY:Ne+xe.DeleteNestedKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_WRITE_SAFE_NESTED_KEY_RECURSIVELY:Ne+xe.WriteSafeNestedKeyRecursively,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_HAS_KEY:qa+xe.HasKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_HAS_NESTED_KEY:qa+xe.HasNestedKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_KEY_VALUE_EQUALS:qa+xe.KeyValueEquals,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_NESTED_KEY_VALUE_EQUALS:qa+xe.NestedKeyValueEquals,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_IS_INSTANCE_OF_TYPE:qa+xe.IsInstanceOfType,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_MERGE:Ne+xe.Merge,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_KEYS:Ne+xe.Keys,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_VALUES:Ne+xe.Values,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_ENTRIES:Ne+xe.Entries,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_GET_TYPE_OF:Ne+Xe.GetTypeOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_HASH:Ne+yi.Hash,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_HMAC:Ne+yi.Hmac,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_GENERATE_RANDOM_BYTES:Ne+it.GenerateRandomBytes,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_CONSTANT_TIME_EQUAL:Ne+yi.ConstantTimeEqual,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_DERIVE_KEY_PBKDF2:Ne+yi.DeriveKeyPBKDF2,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__PASSWORD_HASH_PBKDF2:Ne+dn.HashPasswordPBKDF2,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__PASSWORD_VERIFY_PBKDF2:Ne+dn.VerifyPasswordPBKDF2,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_BUILD_HMAC:Ne+dr.BuildJwtHmac,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_VERIFY_HMAC:Ne+dr.VerifyJwtHmac,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_DECODE:Ne+dr.DecodeJwt,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_FROM_BYTES_TO_STRING:Ne+Xe.FromBytesToString,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_BYTES:Ne+Xe.ToBytes,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_NUMBER:Ne+Xe.ToNumber,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_STRING:Ne+Xe.ToString,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_BASE64:Ne+Xe.EncodeBase64,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_BASE64:Ne+Xe.DecodeBase64,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_BASE64URL:Ne+Xe.EncodeBase64Url,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_BASE64URL:Ne+Xe.DecodeBase64Url,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_HEX:Ne+Xe.EncodeHex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_HEX:Ne+Xe.DecodeHex,BUILT_IN_OPERATIONS_IMPLEMENTATIONS__JSON_PARSE:Ne+on.Parse,BUILT_IN_OPERATIONS_IMPLEMENTATIONS__JSON_STRINGIFY:Ne+on.Stringify};class vVe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.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:De.High,permissions:[Ce.All],contexts:[te.Editor]});R(this,"module",{main:async(i,r)=>({value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,entity:i,error:null,result:null})})}}class EVe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.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:De.High,permissions:[Ce.All],contexts:[te.Editor]});R(this,"module",{main:async(i,r)=>({value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,entity:i,error:null,result:null})})}}class bVe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.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:De.High,permissions:[Ce.All],contexts:[te.Editor]});R(this,"module",{main:async(i,r)=>({value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,entity:i,error:null,result:null})})}}class AVe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.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:De.High,permissions:[Ce.All],contexts:[te.Editor]});R(this,"module",{main:async(i,r)=>({value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,entity:i,error:null,result:null})})}}class gVe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.SEARCH_NODE_IMPLEMENTATION,version:"1.0.0",description:"Implementation for search nodes when they get executed and query data.",initPriority:De.High,permissions:[Ce.All],contexts:[te.Editor]});R(this,"module",{main:async(i,r)=>({error:"Search module not implemented",data:null})})}}class IVe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.UUID,version:"1.0.0",description:"UUID generation module, for all contexts and runtimes",initPriority:De.High,permissions:[Ce.All],contexts:[]});R(this,"module",X_)}}const RVe=l=>l.map(p=>{var i,r;return((i=p.value)==null?void 0:i.valueAsType)??((r=p.value)==null?void 0:r.value)});class DVe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_EMPTY,version:"1.0.0",description:"Comparison: Empty (!value)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic);if(!r)return;const a=r.get(Gt.Empty);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=RVe(r),c=!a;return{value:U.Success,error:null,result:c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class wVe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_NOT_EMPTY,version:"1.0.0",description:"Comparison: NotEmpty (!!value)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic);if(!r)return;const a=r.get(Gt.NotEmpty);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=RVe(r),c=!!a;return{value:U.Success,error:null,result:c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}const jg=class jg extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_PRIMITIVE_EQUAL,version:"1.0.0",description:"Comparison: PrimitiveEqual (typed equality / deep JSON equality)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic);if(!r)return;const a=r.get(Gt.PrimitiveEqual);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{var a,c,e,f,h,m;try{const E=(c=(a=r[0])==null?void 0:a.value)==null?void 0:c.name,b=(f=(e=r[0])==null?void 0:e.value)==null?void 0:f.value,g=(m=(h=r[1])==null?void 0:h.value)==null?void 0:m.value;let _=!1;return E&&jg.primitiveSet.has(E)?_=b===g:E===ye.Untyped||E===ye.KeyValue?_=JSON.stringify(b)===JSON.stringify(g):_=!1,{value:U.Success,error:null,result:_}}catch(E){return{value:U.UnhandledError,error:E,result:null}}}})}};R(jg,"primitiveSet",new Set([ye.String,ye.Number,ye.Boolean,ye.Null,ye.Enum,ye.Date,ye.UUID]));let pg=jg;const Ug=class Ug extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_PRIMITIVE_NOT_EQUAL,version:"1.0.0",description:"Comparison: PrimitiveNotEqual (typed inequality / deep JSON inequality)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic);if(!r)return;const a=r.get(Gt.PrimitiveNotEqual);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{var a,c,e,f,h,m;try{const E=(c=(a=r[0])==null?void 0:a.value)==null?void 0:c.name,b=(f=(e=r[0])==null?void 0:e.value)==null?void 0:f.value,g=(m=(h=r[1])==null?void 0:h.value)==null?void 0:m.value;let _=!1;return E&&Ug.primitiveSet.has(E)?_=b!==g:E===ye.Untyped||E===ye.KeyValue?_=JSON.stringify(b)!==JSON.stringify(g):_=!1,{value:U.Success,error:null,result:_}}catch(E){return{value:U.UnhandledError,error:E,result:null}}}})}};R(Ug,"primitiveSet",new Set([ye.String,ye.Number,ye.Boolean,ye.Null,ye.Enum,ye.Date,ye.UUID]));let cg=Ug;var CVe={exports:{}};(function(l,p){(function(i,r){l.exports=r()})(Sr,function(){var i="minute",r=/[+-]\d\d(?::?\d\d)?/g,a=/([+-]|\d\d)/g;return function(c,e,f){var h=e.prototype;f.utc=function(L){var j={date:L,utc:!0,args:arguments};return new e(j)},h.utc=function(L){var j=f(this.toDate(),{locale:this.$L,utc:!0});return L?j.add(this.utcOffset(),i):j},h.local=function(){return f(this.toDate(),{locale:this.$L,utc:!1})};var m=h.parse;h.parse=function(L){L.utc&&(this.$u=!0),this.$utils().u(L.$offset)||(this.$offset=L.$offset),m.call(this,L)};var E=h.init;h.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=h.utcOffset;h.utcOffset=function(L,j){var k=this.$utils().u;if(k(L))return this.$u?0:k(this.$offset)?b.call(this):this.$offset;if(typeof L=="string"&&(L=function(ee){ee===void 0&&(ee="");var ue=ee.match(r);if(!ue)return null;var ae=(""+ue[0]).match(a)||["-",0,0],de=ae[0],ce=60*+ae[1]+ +ae[2];return ce===0?0:de==="+"?ce:-ce}(L),L===null))return this;var G=Math.abs(L)<=16?60*L:L;if(G===0)return this.utc(j);var H=this.clone();if(j)return H.$offset=G,H.$u=!1,H;var ie=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(H=this.local().add(G+ie,i)).$offset=G,H.$x.$localOffset=ie,H};var g=h.format;h.format=function(L){var j=L||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return g.call(this,j)},h.valueOf=function(){var L=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*L},h.isUTC=function(){return!!this.$u},h.toISOString=function(){return this.toDate().toISOString()},h.toString=function(){return this.toDate().toUTCString()};var _=h.toDate;h.toDate=function(L){return L==="s"&&this.$offset?f(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():_.call(this)};var $=h.diff;h.diff=function(L,j,k){if(L&&this.$u===L.$u)return $.call(this,L,j,k);var G=this.local(),H=f(L).local();return $.call(G,H,j,k)}}})})(CVe);var agi=CVe.exports;const sgi=ds(agi);var OVe={exports:{}};(function(l,p){(function(i,r){l.exports=r()})(Sr,function(){var i={year:0,month:1,day:2,hour:3,minute:4,second:5},r={};return function(a,c,e){var f,h=function(g,_,$){$===void 0&&($={});var L=new Date(g),j=function(k,G){G===void 0&&(G={});var H=G.timeZoneName||"short",ie=k+"|"+H,ee=r[ie];return ee||(ee=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:k,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:H}),r[ie]=ee),ee}(_,$);return j.formatToParts(L)},m=function(g,_){for(var $=h(g,_),L=[],j=0;j<$.length;j+=1){var k=$[j],G=k.type,H=k.value,ie=i[G];ie>=0&&(L[ie]=parseInt(H,10))}var ee=L[3],ue=ee===24?0:ee,ae=L[0]+"-"+L[1]+"-"+L[2]+" "+ue+":"+L[4]+":"+L[5]+":000",de=+g;return(e.utc(ae).valueOf()-(de-=de%1e3))/6e4},E=c.prototype;E.tz=function(g,_){g===void 0&&(g=f);var $,L=this.utcOffset(),j=this.toDate(),k=j.toLocaleString("en-US",{timeZone:g}),G=Math.round((j-new Date(k))/1e3/60),H=15*-Math.round(j.getTimezoneOffset()/15)-G;if(!Number(H))$=this.utcOffset(0,_);else if($=e(k,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(H,!0),_){var ie=$.utcOffset();$=$.add(L-ie,"minute")}return $.$x.$timezone=g,$},E.offsetName=function(g){var _=this.$x.$timezone||e.tz.guess(),$=h(this.valueOf(),_,{timeZoneName:g}).find(function(L){return L.type.toLowerCase()==="timezonename"});return $&&$.value};var b=E.startOf;E.startOf=function(g,_){if(!this.$x||!this.$x.$timezone)return b.call(this,g,_);var $=e(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return b.call($,g,_).tz(this.$x.$timezone,!0)},e.tz=function(g,_,$){var L=$&&_,j=$||_||f,k=m(+e(),j);if(typeof g!="string")return e(g).tz(j);var G=function(ue,ae,de){var ce=ue-60*ae*1e3,ne=m(ce,de);if(ae===ne)return[ce,ae];var le=m(ce-=60*(ne-ae)*1e3,de);return ne===le?[ce,ne]:[ue-60*Math.min(ne,le)*1e3,Math.max(ne,le)]}(e.utc(g,L).valueOf(),k,j),H=G[0],ie=G[1],ee=e(H).utcOffset(ie);return ee.$x.$timezone=j,ee},e.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},e.tz.setDefault=function(g){f=g}}})})(OVe);var lgi=OVe.exports;const ogi=ds(lgi);var _Ve={exports:{}};(function(l,p){(function(i,r){l.exports=r()})(Sr,function(){return function(i,r,a){r.prototype.isBetween=function(c,e,f,h){var m=a(c),E=a(e),b=(h=h||"()")[0]==="(",g=h[1]===")";return(b?this.isAfter(m,f):!this.isBefore(m,f))&&(g?this.isBefore(E,f):!this.isAfter(E,f))||(b?this.isBefore(m,f):!this.isAfter(m,f))&&(g?this.isAfter(E,f):!this.isBefore(E,f))}}})})(_Ve);var dgi=_Ve.exports;const ugi=ds(dgi);var VVe={exports:{}};(function(l,p){(function(i,r){l.exports=r()})(Sr,function(){return function(i,r){r.prototype.isSameOrAfter=function(a,c){return this.isSame(a,c)||this.isAfter(a,c)}}})})(VVe);var pgi=VVe.exports;const cgi=ds(pgi);var PVe={exports:{}};(function(l,p){(function(i,r){l.exports=r()})(Sr,function(){return function(i,r){r.prototype.isSameOrBefore=function(a,c){return this.isSame(a,c)||this.isBefore(a,c)}}})})(PVe);var fgi=PVe.exports;const ygi=ds(fgi);var NVe={exports:{}};(function(l,p){(function(i,r){l.exports=r()})(Sr,function(){var i="week",r="year";return function(a,c,e){var f=c.prototype;f.week=function(h){if(h===void 0&&(h=null),h!==null)return this.add(7*(h-this.week()),"day");var m=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var E=e(this).startOf(r).add(1,r).date(m),b=e(this).endOf(i);if(E.isBefore(b))return 1}var g=e(this).startOf(r).date(m).startOf(i).subtract(1,"millisecond"),_=this.diff(g,i,!0);return _<0?e(this).startOf("week").week():Math.ceil(_)},f.weeks=function(h){return h===void 0&&(h=null),this.week(h)}}})})(NVe);var hgi=NVe.exports;const mgi=ds(hgi);var xVe={exports:{}};(function(l,p){(function(i,r){l.exports=r()})(Sr,function(){var i="day";return function(r,a,c){var e=function(m){return m.add(4-m.isoWeekday(),i)},f=a.prototype;f.isoWeekYear=function(){return e(this).year()},f.isoWeek=function(m){if(!this.$utils().u(m))return this.add(7*(m-this.isoWeek()),i);var E,b,g,_,$=e(this),L=(E=this.isoWeekYear(),b=this.$u,g=(b?c.utc:c)().year(E).startOf("year"),_=4-g.isoWeekday(),g.isoWeekday()>4&&(_+=7),g.add(_,i));return $.diff(L,"week")+1},f.isoWeekday=function(m){return this.$utils().u(m)?this.day()||7:this.day(this.day()%7?m:m-7)};var h=f.startOf;f.startOf=function(m,E){var b=this.$utils(),g=!!b.u(E)||E;return b.p(m)==="isoweek"?g?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):h.bind(this)(m,E)}}})})(xVe);var Tgi=xVe.exports;const vgi=ds(Tgi);var $Ve={exports:{}};(function(l,p){(function(i,r){l.exports=r()})(Sr,function(){var i="month",r="quarter";return function(a,c){var e=c.prototype;e.quarter=function(m){return this.$utils().u(m)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(m-1))};var f=e.add;e.add=function(m,E){return m=Number(m),this.$utils().p(E)===r?this.add(3*m,i):f.bind(this)(m,E)};var h=e.startOf;e.startOf=function(m,E){var b=this.$utils(),g=!!b.u(E)||E;if(b.p(m)===r){var _=this.quarter()-1;return g?this.month(3*_).startOf(i).startOf("day"):this.month(3*_+2).endOf(i).endOf("day")}return h.bind(this)(m,E)}}})})($Ve);var Egi=$Ve.exports;const bgi=ds(Egi);var LVe={exports:{}};(function(l,p){(function(i,r){l.exports=r()})(Sr,function(){return function(i,r,a){r.prototype.dayOfYear=function(c){var e=Math.round((a(this).startOf("day")-a(this).startOf("year"))/864e5)+1;return c==null?e:this.add(c-e,"day")}}})})(LVe);var Agi=LVe.exports;const ggi=ds(Agi);var BVe={exports:{}};(function(l,p){(function(i,r){l.exports=r()})(Sr,function(){return function(i,r,a){i=i||{};var c=r.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 f(m,E,b,g){return c.fromToBase(m,E,b,g)}a.en.relativeTime=e,c.fromToBase=function(m,E,b,g,_){for(var $,L,j,k=b.$locale().relativeTime||e,G=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"}],H=G.length,ie=0;ie<H;ie+=1){var ee=G[ie];ee.d&&($=g?a(m).diff(b,ee.d,!0):b.diff(m,ee.d,!0));var ue=(i.rounding||Math.round)(Math.abs($));if(j=$>0,ue<=ee.r||!ee.r){ue<=1&&ie>0&&(ee=G[ie-1]);var ae=k[ee.l];_&&(ue=_(""+ue)),L=typeof ae=="string"?ae.replace("%d",ue):ae(ue,E,ee.l,j);break}}if(E)return L;var de=j?k.future:k.past;return typeof de=="function"?de(L):de.replace("%s",L)},c.to=function(m,E){return f(m,E,this,!0)},c.from=function(m,E){return f(m,E,this)};var h=function(m){return m.$u?a.utc():a()};c.toNow=function(m){return this.to(h(this),m)},c.fromNow=function(m){return this.from(h(this),m)}}})})(BVe);var Igi=BVe.exports;const Rgi=ds(Igi);var MVe={exports:{}};(function(l,p){(function(i,r){l.exports=r()})(Sr,function(){var i,r,a=1e3,c=6e4,e=36e5,f=864e5,h=/\[([^\]]+)]|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,m=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)?)?$/,g={years:m,months:E,days:f,hours:e,minutes:c,seconds:a,milliseconds:1,weeks:6048e5},_=function(ue){return ue instanceof ie},$=function(ue,ae,de){return new ie(ue,de,ae.$l)},L=function(ue){return r.p(ue)+"s"},j=function(ue){return ue<0},k=function(ue){return j(ue)?Math.ceil(ue):Math.floor(ue)},G=function(ue){return Math.abs(ue)},H=function(ue,ae){return ue?j(ue)?{negative:!0,format:""+G(ue)+ae}:{negative:!1,format:""+ue+ae}:{negative:!1,format:""}},ie=function(){function ue(de,ce,ne){var le=this;if(this.$d={},this.$l=ne,de===void 0&&(this.$ms=0,this.parseFromMilliseconds()),ce)return $(de*g[L(ce)],this);if(typeof de=="number")return this.$ms=de,this.parseFromMilliseconds(),this;if(typeof de=="object")return Object.keys(de).forEach(function(Ee){le.$d[L(Ee)]=de[Ee]}),this.calMilliseconds(),this;if(typeof de=="string"){var Q=de.match(b);if(Q){var oe=Q.slice(2).map(function(Ee){return Ee!=null?Number(Ee):0});return this.$d.years=oe[0],this.$d.months=oe[1],this.$d.weeks=oe[2],this.$d.days=oe[3],this.$d.hours=oe[4],this.$d.minutes=oe[5],this.$d.seconds=oe[6],this.calMilliseconds(),this}}return this}var ae=ue.prototype;return ae.calMilliseconds=function(){var de=this;this.$ms=Object.keys(this.$d).reduce(function(ce,ne){return ce+(de.$d[ne]||0)*g[ne]},0)},ae.parseFromMilliseconds=function(){var de=this.$ms;this.$d.years=k(de/m),de%=m,this.$d.months=k(de/E),de%=E,this.$d.days=k(de/f),de%=f,this.$d.hours=k(de/e),de%=e,this.$d.minutes=k(de/c),de%=c,this.$d.seconds=k(de/a),de%=a,this.$d.milliseconds=de},ae.toISOString=function(){var de=H(this.$d.years,"Y"),ce=H(this.$d.months,"M"),ne=+this.$d.days||0;this.$d.weeks&&(ne+=7*this.$d.weeks);var le=H(ne,"D"),Q=H(this.$d.hours,"H"),oe=H(this.$d.minutes,"M"),Ee=this.$d.seconds||0;this.$d.milliseconds&&(Ee+=this.$d.milliseconds/1e3,Ee=Math.round(1e3*Ee)/1e3);var Te=H(Ee,"S"),Ve=de.negative||ce.negative||le.negative||Q.negative||oe.negative||Te.negative,Le=Q.format||oe.format||Te.format?"T":"",$e=(Ve?"-":"")+"P"+de.format+ce.format+le.format+Le+Q.format+oe.format+Te.format;return $e==="P"||$e==="-P"?"P0D":$e},ae.toJSON=function(){return this.toISOString()},ae.format=function(de){var ce=de||"YYYY-MM-DDTHH:mm:ss",ne={Y:this.$d.years,YY:r.s(this.$d.years,2,"0"),YYYY:r.s(this.$d.years,4,"0"),M:this.$d.months,MM:r.s(this.$d.months,2,"0"),D:this.$d.days,DD:r.s(this.$d.days,2,"0"),H:this.$d.hours,HH:r.s(this.$d.hours,2,"0"),m:this.$d.minutes,mm:r.s(this.$d.minutes,2,"0"),s:this.$d.seconds,ss:r.s(this.$d.seconds,2,"0"),SSS:r.s(this.$d.milliseconds,3,"0")};return ce.replace(h,function(le,Q){return Q||String(ne[le])})},ae.as=function(de){return this.$ms/g[L(de)]},ae.get=function(de){var ce=this.$ms,ne=L(de);return ne==="milliseconds"?ce%=1e3:ce=ne==="weeks"?k(ce/g[ne]):this.$d[ne],ce||0},ae.add=function(de,ce,ne){var le;return le=ce?de*g[L(ce)]:_(de)?de.$ms:$(de,this).$ms,$(this.$ms+le*(ne?-1:1),this)},ae.subtract=function(de,ce){return this.add(de,ce,!0)},ae.locale=function(de){var ce=this.clone();return ce.$l=de,ce},ae.clone=function(){return $(this.$ms,this)},ae.humanize=function(de){return i().add(this.$ms,"ms").locale(this.$l).fromNow(!de)},ae.valueOf=function(){return this.asMilliseconds()},ae.milliseconds=function(){return this.get("milliseconds")},ae.asMilliseconds=function(){return this.as("milliseconds")},ae.seconds=function(){return this.get("seconds")},ae.asSeconds=function(){return this.as("seconds")},ae.minutes=function(){return this.get("minutes")},ae.asMinutes=function(){return this.as("minutes")},ae.hours=function(){return this.get("hours")},ae.asHours=function(){return this.as("hours")},ae.days=function(){return this.get("days")},ae.asDays=function(){return this.as("days")},ae.weeks=function(){return this.get("weeks")},ae.asWeeks=function(){return this.as("weeks")},ae.months=function(){return this.get("months")},ae.asMonths=function(){return this.as("months")},ae.years=function(){return this.get("years")},ae.asYears=function(){return this.as("years")},ue}(),ee=function(ue,ae,de){return ue.add(ae.years()*de,"y").add(ae.months()*de,"M").add(ae.days()*de,"d").add(ae.hours()*de,"h").add(ae.minutes()*de,"m").add(ae.seconds()*de,"s").add(ae.milliseconds()*de,"ms")};return function(ue,ae,de){i=de,r=de().$utils(),de.duration=function(le,Q){var oe=de.locale();return $(le,{$l:oe},Q)},de.isDuration=_;var ce=ae.prototype.add,ne=ae.prototype.subtract;ae.prototype.add=function(le,Q){return _(le)?ee(this,le,1):ce.bind(this)(le,Q)},ae.prototype.subtract=function(le,Q){return _(le)?ee(this,le,-1):ne.bind(this)(le,Q)}}})})(MVe);var Dgi=MVe.exports;const wgi=ds(Dgi);var GVe={exports:{}};(function(l,p){(function(i,r){l.exports=r()})(Sr,function(){return function(i,r){r.prototype.isLeapYear=function(){return this.$y%4==0&&this.$y%100!=0||this.$y%400==0}}})})(GVe);var Cgi=GVe.exports;const Ogi=ds(Cgi);B.extend(sgi);B.extend(ogi);B.extend(ugi);B.extend(cgi);B.extend(ygi);B.extend(mgi);B.extend(vgi);B.extend(bgi);B.extend(ggi);B.extend(Rgi);B.extend(wgi);B.extend(Ogi);const Vt=l=>B(l),cr=l=>l.toISOString();function jVe(){return cr(B())}function UVe(l,p){return Vt(l).format(p)}function kVe(l){return cr(B(l))}function FVe(l){if(l==null)throw new TypeError("ToDate expects a non-null value.");if(typeof l=="string"){const p=B(l);if(!p.isValid())throw new TypeError("Invalid date string.");return p.toISOString()}if(typeof l=="number"&&Number.isFinite(l)){const p=Math.abs(l)<1e12?B.unix(l):B(l);if(!p.isValid())throw new TypeError("Invalid numeric timestamp.");return p.toISOString()}if(l instanceof Date){const p=B(l);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 KVe(l,p,i){return cr(Vt(l).add(p,i))}function SVe(l,p,i){return cr(Vt(l).subtract(p,i))}function qVe(l,p,i,r=!1){return Vt(l).diff(Vt(p),i,r)}function ZVe(l){return Vt(l).unix()}function HVe(l){return cr(B.unix(l))}function WVe(l){return cr(Vt(l))}function zVe(l){return Vt(l).year()}function YVe(l){return Vt(l).month()}function JVe(l){return Vt(l).date()}function XVe(l){return Vt(l).hour()}function QVe(l){return Vt(l).minute()}function ePe(l){return Vt(l).second()}function tPe(l){return Vt(l).millisecond()}function iPe(l){return Vt(l).isoWeekday()}function rPe(l){return Vt(l).week()}function nPe(l){return Vt(l).quarter()}function aPe(l){return Vt(l).dayOfYear()}function sPe(l){return Vt(l).daysInMonth()}function lPe(l,p){return cr(Vt(l).year(p))}function oPe(l,p){return cr(Vt(l).month(p))}function dPe(l,p){return cr(Vt(l).date(p))}function uPe(l,p){return cr(Vt(l).hour(p))}function pPe(l,p){return cr(Vt(l).minute(p))}function cPe(l,p){return cr(Vt(l).second(p))}function fPe(l,p){return cr(Vt(l).millisecond(p))}function yPe(l,p){return cr(Vt(l).isoWeekday(p))}function hPe(l,p){return cr(Vt(l).quarter(p))}function mPe(l,p){return cr(Vt(l).startOf(p))}function TPe(l,p){return cr(Vt(l).endOf(p))}function vPe(l,p){const i=Vt(l),r=i.startOf(p),a=i.endOf(p),c=r.valueOf()+(a.valueOf()-r.valueOf())/2;return cr(i.valueOf()<c?r:a)}function EPe(l,p,i){return Vt(l).isBefore(Vt(p),i)}function bPe(l,p,i){return Vt(l).isAfter(Vt(p),i)}function APe(l,p,i){return Vt(l).isSame(Vt(p),i)}function gPe(l,p,i){return Vt(l).isSameOrBefore(Vt(p),i)}function IPe(l,p,i){return Vt(l).isSameOrAfter(Vt(p),i)}function RPe(l,p,i,r,a="()"){return Vt(l).isBetween(Vt(p),Vt(i),r,a)}function DPe(l){return B(l).isValid()}function wPe(l){return Vt(l).isLeapYear()}function CPe(l,p,i){const r=Vt(l);return r.isBefore(p)?cr(Vt(p)):r.isAfter(i)?cr(Vt(i)):cr(r)}function OPe(l){if(l.length===0)throw new Error("minOf requires at least one date");let p=Vt(l[0]);for(let i=1;i<l.length;i++){const r=Vt(l[i]);r.isBefore(p)&&(p=r)}return cr(p)}function _Pe(l){if(l.length===0)throw new Error("maxOf requires at least one date");let p=Vt(l[0]);for(let i=1;i<l.length;i++){const r=Vt(l[i]);r.isAfter(p)&&(p=r)}return cr(p)}function VPe(l,p=!1){return Vt(l).fromNow(p)}function PPe(l,p=!1){return Vt(l).toNow(p)}function NPe(l,p,i=!0){const r=Vt(l).diff(Vt(p),"millisecond",!0),a=Math.abs(r),e=B.duration(a,"milliseconds").humanize();return i?r>=0?`in ${e}`:`${e} ago`:e}function xPe(l,p,i=["6","7"],r=[]){const a=m=>r.some(E=>Vt(E).isSame(m,"day")),c=m=>((m.day()+6)%7+1).toString();let e=Vt(l);const f=p>=0?1:-1;let h=Math.abs(p);for(;h>0;){e=e.add(f,"day");const m=c(e);!i.includes(m)&&!a(e)&&h--}return cr(e)}function $Pe(l,p){let i=Vt(l);const r=p;for(let a=0;a<7;a++)if(i=i.add(1,"day"),i.isoWeekday()===r)return cr(i);return cr(i)}function LPe(l,p){let i=Vt(l);const r=p;for(let a=0;a<7;a++)if(i=i.subtract(1,"day"),i.isoWeekday()===r)return cr(i);return cr(i)}const BPe="Local";function Vx(){try{const l=Intl.DateTimeFormat().resolvedOptions().timeZone;if(l&&typeof l=="string")return l}catch{}try{if(typeof process<"u"&&process.env&&process.env.TZ)return process.env.TZ}catch{}return null}function Px(){const l=Vx();if(l)return l;throw new Error("Unable to detect current IANA timezone from host environment.")}function MPe(l,p,i=!1){let r=p;if(r===BPe){const e=Vx();if(!e)throw new Error("Unable to detect current timezone from host environment.");r=e}const a=r?B.tz(l,r):Vt(l),c=i?a.utc(!0):a.utc();return cr(c)}function GPe(l,p,i=!1){const r=Vt(l);return cr(i?r.tz(p,!0):r.tz(p))}function jPe(l,p){const i=l===BPe?Px():l;return Vt(p).tz(i).utcOffset()}function UPe(l,p,i=!1){return cr(Vt(l).utcOffset(p,i))}class kPe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_CURRENT_TIMESTAMP,version:"1.0.0",description:"Date get current timestamp operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(K.GetCurrentTimestamp);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=jVe();return{value:U.Success,error:null,result:a}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class FPe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_FORMAT_DATE,version:"1.0.0",description:"Date format operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(K.FormatDate);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f=UVe(c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class KPe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_PARSE_DATE,version:"1.0.0",description:"Date parse operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(K.ParseDate);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)})[0],e=kVe(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class SPe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_ADD_TO_DATE,version:"1.0.0",description:"Date add-to-date operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(K.AddToDate);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],f=a[2],h=KVe(c,e,f);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class qPe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SUBTRACT_FROM_DATE,version:"1.0.0",description:"Date subtract-from-date operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(K.SubtractFromDate);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],f=a[2],h=SVe(c,e,f);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class ZPe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_DIFFERENCE_BETWEEN_DATES,version:"1.0.0",description:"Date difference-between-dates operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(K.DifferenceBetweenDates);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(E=>{var b,g;return((b=E.value)==null?void 0:b.valueAsType)||((g=E.value)==null?void 0:g.value)}),c=a[0],e=a[1],f=a[2],h=a[3]??!1,m=qVe(c,e,f,h);return{value:U.Success,error:null,result:m}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class _gi extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_DATE,version:"1.0.0",description:"Date to-date operation implementation module (coerce to ISO 8601 string)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(K.ToDate);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)}),c=FVe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class HPe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_UNIX,version:"1.0.0",description:"Date to-unix operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(K.ToUnix);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)})[0],e=ZVe(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class WPe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_FROM_UNIX,version:"1.0.0",description:"Date from-unix operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(K.FromUnix);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)})[0],e=HVe(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class zPe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_ISO_STRING,version:"1.0.0",description:"Date to-iso-string operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(K.ToISOString);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)})[0],e=WVe(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class YPe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_YEAR,version:"1.0.0",description:"Date get-year operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(K.GetYear);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)||((h=e.value)==null?void 0:h.value)}),c=zVe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class JPe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_MONTH,version:"1.0.0",description:"Date get-month (0-based) operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(K.GetMonth);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)||((h=e.value)==null?void 0:h.value)}),c=YVe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class XPe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_DATE,version:"1.0.0",description:"Date get-date (day of month) operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(K.GetDate);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)||((h=e.value)==null?void 0:h.value)}),c=JVe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class QPe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_HOUR,version:"1.0.0",description:"Date get-hour operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(K.GetHour);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)||((h=e.value)==null?void 0:h.value)}),c=XVe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class eNe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_MINUTE,version:"1.0.0",description:"Date get-minute operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(K.GetMinute);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)||((h=e.value)==null?void 0:h.value)}),c=QVe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class tNe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_SECOND,version:"1.0.0",description:"Date get-second operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(K.GetSecond);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)||((h=e.value)==null?void 0:h.value)}),c=ePe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class iNe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_MILLISECOND,version:"1.0.0",description:"Date get-millisecond operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(K.GetMillisecond);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)||((h=e.value)==null?void 0:h.value)}),c=tPe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class rNe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_ISO_WEEKDAY,version:"1.0.0",description:"Date get-iso-weekday operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(K.GetIsoWeekday);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)||((h=e.value)==null?void 0:h.value)}),c=iPe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class nNe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_WEEK_OF_YEAR,version:"1.0.0",description:"Date get-week-of-year operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(K.GetWeekOfYear);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)||((h=e.value)==null?void 0:h.value)}),c=rPe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class aNe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_QUARTER,version:"1.0.0",description:"Date get-quarter operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(K.GetQuarter);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)||((h=e.value)==null?void 0:h.value)}),c=nPe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class sNe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_DAY_OF_YEAR,version:"1.0.0",description:"Date get-day-of-year operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(K.GetDayOfYear);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)||((h=e.value)==null?void 0:h.value)}),c=aPe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class lNe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_DAYS_IN_MONTH,version:"1.0.0",description:"Date get-days-in-month operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(K.GetDaysInMonth);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)||((h=e.value)==null?void 0:h.value)}),c=sPe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class oNe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_CURRENT_IANA_TIMEZONE,version:"1.0.0",description:"Date get-current-iana-timezone operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(K.GetCurrentIanaTimeZone);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=Px();return{value:U.Success,error:null,result:a}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class dNe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_YEAR,version:"1.0.0",description:"Date set-year operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(K.SetYear);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f=lPe(c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class uNe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_MONTH,version:"1.0.0",description:"Date set-month operation implementation module (0-based month)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(K.SetMonth);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f=oPe(c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class pNe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_DATE,version:"1.0.0",description:"Date set-date (day of month) operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(K.SetDate);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f=dPe(c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class cNe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_HOUR,version:"1.0.0",description:"Date set-hour operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(K.SetHour);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f=uPe(c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class fNe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_MINUTE,version:"1.0.0",description:"Date set-minute operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(K.SetMinute);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f=pPe(c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class yNe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_SECOND,version:"1.0.0",description:"Date set-second operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(K.SetSecond);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f=cPe(c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class hNe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_MILLISECOND,version:"1.0.0",description:"Date set-millisecond operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(K.SetMillisecond);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f=fPe(c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class mNe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_ISO_WEEKDAY,version:"1.0.0",description:"Date set-iso-weekday operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(K.SetIsoWeekday);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f=yPe(c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class TNe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_QUARTER,version:"1.0.0",description:"Date set-quarter operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(K.SetQuarter);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f=hPe(c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class vNe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_START_OF,version:"1.0.0",description:"Date start-of operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(K.StartOf);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f=mPe(c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class ENe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_END_OF,version:"1.0.0",description:"Date end-of operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(K.EndOf);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f=TPe(c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class bNe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_ROUND_TO,version:"1.0.0",description:"Date round-to operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(K.RoundTo);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f=vPe(c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class ANe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_BEFORE,version:"1.0.0",description:"Date is-before operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(K.IsBefore);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],f=a[2],h=EPe(c,e,f);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class gNe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_AFTER,version:"1.0.0",description:"Date is-after operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(K.IsAfter);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],f=a[2],h=bPe(c,e,f);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class INe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_SAME,version:"1.0.0",description:"Date is-same operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(K.IsSame);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],f=a[2],h=APe(c,e,f);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class RNe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_SAME_OR_BEFORE,version:"1.0.0",description:"Date is-same-or-before operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(K.IsSameOrBefore);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],f=a[2],h=gPe(c,e,f);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class DNe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_SAME_OR_AFTER,version:"1.0.0",description:"Date is-same-or-after operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(K.IsSameOrAfter);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],f=a[2],h=IPe(c,e,f);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class wNe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_BETWEEN,version:"1.0.0",description:"Date is-between operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(K.IsBetween);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(b=>{var g,_;return((g=b.value)==null?void 0:g.valueAsType)||((_=b.value)==null?void 0:_.value)}),c=a[0],e=a[1],f=a[2],h=a[3],m=a[4],E=RPe(c,e,f,h,m??void 0);return{value:U.Success,error:null,result:E}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class CNe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_VALID,version:"1.0.0",description:"Date is-valid operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(K.IsValid);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)||((h=e.value)==null?void 0:h.value)}),c=DPe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class ONe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_LEAP_YEAR,version:"1.0.0",description:"Date is-leap-year operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(K.IsLeapYear);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)||((h=e.value)==null?void 0:h.value)}),c=wPe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class _Ne extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_CLAMP_TO_RANGE,version:"1.0.0",description:"Date clamp-to-range operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(K.ClampToRange);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],f=a[2],h=CPe(c,e,f);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class VNe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_MIN_OF,version:"1.0.0",description:"Date min-of operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(K.MinOf);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)}),c=a.length===1&&Array.isArray(a[0])?a[0]:a,e=OPe(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class PNe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_MAX_OF,version:"1.0.0",description:"Date max-of operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(K.MaxOf);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)}),c=a.length===1&&Array.isArray(a[0])?a[0]:a,e=_Pe(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class NNe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_FROM_NOW,version:"1.0.0",description:"Date from-now operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(K.FromNow);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c]=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),f=VPe(a,c??!1);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class xNe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_NOW,version:"1.0.0",description:"Date to-now operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(K.ToNow);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c]=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),f=PPe(a,c??!1);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class $Ne extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_HUMANIZE_DIFF,version:"1.0.0",description:"Date humanize-diff operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(K.HumanizeDiff);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c,e]=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),h=NPe(a,c,e??!0);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class LNe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_ADD_BUSINESS_DAYS,version:"1.1.0",description:"Date add-business-days operation implementation module (ISO-weekend strings)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(K.AddBusinessDays);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(E=>{var b,g;return((b=E.value)==null?void 0:b.valueAsType)??((g=E.value)==null?void 0:g.value)}),c=a[0],e=a[1],f=a[2]??void 0,h=a[3]??[],m=xPe(c,e,f,h);return{value:U.Success,error:null,result:m}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class BNe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_NEXT_WEEKDAY,version:"1.0.0",description:"Date next-weekday operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(K.NextWeekday);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)}),e=$Pe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class MNe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_PREVIOUS_WEEKDAY,version:"1.0.0",description:"Date previous-weekday operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(K.PreviousWeekday);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)}),e=LPe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class GNe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_UTC,version:"1.1.0",description:"Date to-utc operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(K.ToUTC);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1]||void 0,f=a[2]??!1,h=MPe(c,e,f);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class jNe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_CONVERT_TIMEZONE,version:"1.0.0",description:"Date convert-timezone operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(K.ConvertTimezone);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c,e]=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),h=GPe(a,c,e??!1);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class UNe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_TIMEZONE_OFFSET,version:"1.0.0",description:"Date get-timezone-offset operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(K.GetTimezoneOffset);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c]=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),h=jPe(a,c);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class kNe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_UTC_OFFSET,version:"1.0.0",description:"Date set-utc-offset operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(K.SetUTCOffset);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c,e]=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),h=UPe(a,c,e??!1);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class FNe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_PARALLEL,version:"1.0.0",description:"Execution parallel operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(Hi.Parallel);a&&(a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(b=>{var g,_;return((g=b.value)==null?void 0:g.valueAsType)||((_=b.value)==null?void 0:_.value)})[0];if(!c)return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No list of action entities provided",result:null};if(!Array.isArray(c))return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"Invalid input value. Expected a list of action entities",result:null};const f=this.extensionsRegistry.requestContexts(this,[te.Editor])[0],m=c.map(b=>{const g=new ip(f.logic,[b],b,null,this.extensionsRegistry);return g.inheritValuesFromContext(f),g}).map(b=>b.execute()),E=await Promise.all(m);return{value:U.Success,error:null,result:E}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class KNe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_SEQUENTIAL,version:"1.0.0",description:"Execution sequential operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(Hi.Sequential);a&&(a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)})[0];if(!c)return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No list of action entities provided",result:null};if(!Array.isArray(c))return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"Invalid input value. Expected a list of action entities",result:null};const e=[];for(let f=0;f<c.length;f++){const h=c[f],E=this.extensionsRegistry.requestContexts(this,[te.Editor])[0],b=new ip(E.logic,[h],h,null,this.extensionsRegistry);b.inheritValuesFromContext(E);const g=await b.execute();e.push(g)}return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class SNe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_WAIT,version:"1.0.0",description:"Execution wait operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(Hi.Wait);a&&(a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)||((h=e.value)==null?void 0:h.value)})[0];return typeof c!="number"||c<0?{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"Invalid wait time provided",result:null}:(await new Promise(e=>setTimeout(e,c)),{value:U.Success,error:null,result:null})}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}const Vgi=/^\d{4}-\d{2}-\d{2}(?:[T ]\d{2}:\d{2}(?::\d{2}(?:\.\d{1,3})?)?(?:Z|[+-]\d{2}:?\d{2})?)?$/,Nx=l=>l===null||["string","number","boolean"].includes(typeof l);function Gn(l,p="Input must be an array"){if(!Array.isArray(l))throw new TypeError(p);return l}function vo(l){const p=Gn(l,"Input must be an array");if(!p||p.length===0)throw new TypeError("No list provided or list is empty");return p}function xx(l){return Array.isArray(l)?l:[]}function Is(l){return Number(l)}function qNe(l){if(!l||l.length===0)throw new TypeError("No input lists provided");if(!l.every(r=>Array.isArray(r)))throw new TypeError("All inputs must be arrays");const[p,...i]=l;return i.reduce((r,a)=>r.concat(a),p)}function ZNe(l,...p){if(!Array.isArray(l))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 l.concat(...p)}function HNe(l,p){const i=vo(l),r=Is(p);return[i.slice(0,r),i.slice(r)]}function WNe(l){return vo(l).slice().reverse()}function zNe(l){return vo(l).slice(0,-1)}function YNe(l){return vo(l).slice(1)}function JNe(l,p,i){const r=Gn(l),a=Is(p);if(a<0||a>r.length)throw new TypeError("Index out of bounds");return[...r.slice(0,a),i,...r.slice(a)]}function XNe(l,p,i){const r=vo(l),a=Is(p);if(a<0||a>=r.length)throw new TypeError("Index out of bounds");const c=[...r];return c[a]=i,c}function QNe(l,p,i){const r=vo(l),a=r.indexOf(p);if(a===-1)return r;const c=[...r];return c[a]=i,c}function exe(l,p,i){const r=vo(l),a=r.lastIndexOf(p);if(a===-1)return r;const c=[...r];return c[a]=i,c}function txe(l,p,i){return vo(l).map(a=>a===p?i:a)}function ixe(l,p){const i=vo(l),r=Is(p);if(r<0||r>=i.length)throw new TypeError("Index out of bounds");return i[r]}function rxe(l){return vo(l)[0]}function nxe(l){const p=vo(l);return p[p.length-1]}function axe(l,p,...i){return[...Gn(l),p,...i]}function sxe(l,p){const i=Gn(l);return[p,...i]}function lxe(l){return Gn(l).length}function oxe(l,p){const i=Gn(l),r=Is(p);if(r<0||r>=i.length)throw new TypeError("Index out of bounds");return i.slice(0,r).concat(i.slice(r+1))}function dxe(l,p){const i=Gn(l),r=Math.max(0,Is(p)??0);return i.slice(0,r)}function uxe(l,p){const i=Gn(l),r=Math.max(0,Is(p)??0);return r===0?[]:i.slice(-r)}function pxe(l,p,i){const r=Gn(l),a=p==null?void 0:Is(p),c=i==null?void 0:Is(i);return r.slice(a,c)}function cxe(l,p){return Gn(l).indexOf(p)}function fxe(l,p){return Gn(l).lastIndexOf(p)}function yxe(l){const p=Gn(l),i=[],r=new Set;for(const a of p)r.has(a)||(r.add(a),i.push(a));return i}function hxe(l){return Gn(l).reduce((i,r)=>i.concat(r),[])}function mxe(l){const p=Gn(l);if(p.length<=1)return[...p];const i=p[0],r=typeof i=="number"&&p.every(e=>typeof e=="number"&&Number.isFinite(e)),a=typeof i=="string"&&p.every(e=>typeof e=="string");let c=null;if(r?c="number":a&&(c=p.every(f=>Vgi.test(f)&&B(f).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,f)=>e-f):c==="string"?[...p].sort((e,f)=>e.localeCompare(f)):[...p].sort((e,f)=>B(e).valueOf()-B(f).valueOf())}function Txe(l){const i=[...Gn(l)];for(let r=i.length-1;r>0;r--){const a=Math.floor(zR()*(r+1));[i[r],i[a]]=[i[a],i[r]]}return i}function vxe(l,p){const i=Gn(l),r=Math.max(1,Is(p)||1),a=[];for(let c=0;c<i.length;c+=r)a.push(i.slice(c,c+r));return a}function Exe(l,p,i){const r=Gn(l),a=Math.max(0,Is(p)||0);if(r.length>=a)return[...r];const c=a-r.length;return Array(c).fill(i).concat(r)}function bxe(l,p,i){const r=Gn(l),a=Math.max(0,Is(p)||0);if(r.length>=a)return[...r];const c=a-r.length,e=Array(c).fill(i);return r.concat(e)}function Axe(l,p){const i=Gn(l),r=Math.max(0,Is(p)||0),a=[];for(let c=0;c<r;c++)a.push(...i);return a}function gxe(l,p){if(!Nx(p))throw new TypeError("Contains expects the needle to be a primitive (string | number | boolean | null).");return xx(l).some(r=>r===p)}function Ixe(l,p){const i=xx(l),r=Array.isArray(p)?p:[p];if(r.length===0)return!1;if(!r.every(Nx))throw new TypeError("ContainsAll expects all needles to be primitives (string | number | boolean | null).");return r.every(a=>i.includes(a))}function Rxe(l,p){const i=xx(l),r=Array.isArray(p)?p:[p];if(r.length===0)return!1;if(!r.every(Nx))throw new TypeError("ContainsAny expects all needles to be primitives (string | number | boolean | null).");return r.some(a=>i.includes(a))}class Dxe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_JOIN,version:"1.0.0",description:"List join operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(fe.Join);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)}),c=qNe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class wxe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SPLIT,version:"1.0.0",description:"List split operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(fe.Split);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],[f,h]=HNe(c,e);return{value:U.Success,error:null,result:[f,h]}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Cxe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REVERSE,version:"1.0.0",description:"List reverse operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(fe.Reverse);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)})[0],e=WNe(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Oxe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_LAST_N_ITEMS,version:"1.0.0",description:"List delete last operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(fe.DeleteLastNItems);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)})[0],e=zNe(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class _xe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_FIRST_N_ITEMS,version:"1.0.0",description:"List delete first operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(fe.DeleteFirstNItems);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)})[0],e=YNe(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Vxe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_ADD_AT_INDEX,version:"1.0.0",description:"List add index operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(fe.AddAtIndex);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],f=a[2],h=JNe(c,e,f);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Pxe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_AT_INDEX,version:"1.0.0",description:"List replace index operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(fe.ReplaceAtIndex);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],f=a[2],h=XNe(c,e,f);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Nxe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_FIRST_N_ITEMS,version:"1.0.0",description:"List replace first operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(fe.ReplaceFirstNItems);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],f=a[2],h=QNe(c,e,f);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class xxe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_LAST_N_ITEMS,version:"1.0.0",description:"List replace last operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(fe.ReplaceLastNItems);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],f=a[2],h=exe(c,e,f);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class $xe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_ALL,version:"1.0.0",description:"List replace all operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(fe.ReplaceAll);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],f=a[2],h=txe(c,e,f);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Lxe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_INDEX_ITEM,version:"1.0.0",description:"List get index item operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(fe.GetIndexItem);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f=ixe(c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Bxe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_FIRST,version:"1.0.0",description:"List get first operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(fe.GetFirst);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)})[0],e=rxe(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Mxe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST,version:"1.0.0",description:"List get last operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(fe.GetLast);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)})[0],e=nxe(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Gxe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_APPEND,version:"1.0.0",description:"List append operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(fe.Append);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],f=a.slice(2),h=axe(c,e,...f);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class jxe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PREPEND,version:"1.0.0",description:"List prepend operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(fe.Prepend);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f=sxe(c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Uxe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LENGTH,version:"1.0.0",description:"List get length",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(fe.GetLength);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=r.map(c=>{var e,f;return((e=c.value)==null?void 0:e.valueAsType)??((f=c.value)==null?void 0:f.value)});return{value:U.Success,error:null,result:lxe(a)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class kxe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_AT_INDEX,version:"1.0.0",description:"List delete one item at index (non-mutating)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(fe.DeleteAtIndex);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)??((m=f.value)==null?void 0:m.value)}),e=oxe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Fxe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_FIRST_N_ITEMS,version:"1.0.0",description:"List get first N items",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(fe.GetFirstNItems);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)??((m=f.value)==null?void 0:m.value)}),e=dxe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Kxe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST_N_ITEMS,version:"1.0.0",description:"List get last N items",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(fe.GetLastNItems);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)??((m=f.value)==null?void 0:m.value)}),e=uxe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Sxe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SLICE,version:"1.0.0",description:"List slice(start, end)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(fe.Slice);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)??((E=h.value)==null?void 0:E.value)}),f=pxe(a,c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class qxe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONCAT,version:"1.0.0",description:"List concat(base, ...others)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(fe.Concat);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)??((E=h.value)==null?void 0:E.value)}),[c,...e]=a,f=ZNe(c,...e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Zxe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_INDEX_OF,version:"1.0.0",description:"List listGetIndexOf(value)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(fe.GetIndexOf);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)??((m=f.value)==null?void 0:m.value)}),e=cxe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Hxe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST_INDEX_OF,version:"1.0.0",description:"List listGetLastIndexOf(value)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(fe.GetLastIndexOf);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)??((m=f.value)==null?void 0:m.value)}),e=fxe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Wxe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_UNIQUE,version:"1.0.0",description:"List unique (stable, by reference/===)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(fe.Unique);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)}),c=yxe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class zxe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_FLATTEN,version:"1.0.0",description:"List flatten one level",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(fe.Flatten);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)}),c=hxe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Yxe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.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:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(fe.Sort);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)}),c=mxe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Jxe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SHUFFLE,version:"1.0.0",description:"List shuffle (Fisher–Yates, secure RNG helper)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(fe.Shuffle);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)}),c=Txe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Xxe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CHUNK,version:"1.0.0",description:"List chunk(size) -> list of lists",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(fe.Chunk);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)??((m=f.value)==null?void 0:m.value)}),e=vxe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Qxe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PAD_START,version:"1.0.0",description:"List padStart(targetLength, padValue)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(fe.PadStart);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)??((E=h.value)==null?void 0:E.value)}),f=Exe(a,c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class e$e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PAD_END,version:"1.0.0",description:"List padEnd(targetLength, padValue)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(fe.PadEnd);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)??((E=h.value)==null?void 0:E.value)}),f=bxe(a,c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class t$e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPEAT,version:"1.0.0",description:"List repeat(count)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(fe.Repeat);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)??((m=f.value)==null?void 0:m.value)}),e=Axe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class i$e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONTAINS,version:"1.0.0",description:"List contains (primitive needles)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(fe.Contains);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)??((m=f.value)==null?void 0:m.value)}),e=gxe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class r$e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONTAINS_ALL,version:"1.0.0",description:"List contains all (primitive needles)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(fe.ContainsAll);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)??((m=f.value)==null?void 0:m.value)}),e=Ixe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class n$e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONTAINS_ANY,version:"1.0.0",description:"List contains any (primitive needles)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(fe.ContainsAny);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)??((m=f.value)==null?void 0:m.value)}),e=Rxe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Pgi extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LENGTH,version:"1.0.0",description:"Returns the number of characters in a string",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(Z.GetLength);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)}),c=a.length;return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class a$e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_JOIN,version:"1.0.0",description:"String join operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(Z.Join);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{var a,c,e;try{const f=r.find(j=>{var k,G;return((G=(k=j.valueOwner)==null?void 0:k.declaration)==null?void 0:G.id)===re.operation[Z.Join].inputs.separator.id}),h=((a=f==null?void 0:f.value)==null?void 0:a.value)||"",m=r.find(j=>{var k,G;return((G=(k=j.valueOwner)==null?void 0:k.declaration)==null?void 0:G.id)===re.operation[Z.Join].inputs.first.id}),E=((c=m==null?void 0:m.value)==null?void 0:c.value)||"",b=r.find(j=>{var k,G;return((G=(k=j.valueOwner)==null?void 0:k.declaration)==null?void 0:G.id)===re.operation[Z.Join].inputs.second.id}),g=((e=b==null?void 0:b.value)==null?void 0:e.value)||"",$=r.filter(j=>{var k,G;return((G=(k=j.valueOwner)==null?void 0:k.declaration)==null?void 0:G.id)===re.operation[Z.Join].inputs.dynamicString.id}).map(j=>{var k,G;return((k=j.value)==null?void 0:k.valueAsType)||((G=j.value)==null?void 0:G.value)||""}),L=[E,g,...$].join(h);return{value:U.Success,error:null,result:L}}catch(f){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:f,result:null}}}})}}class s$e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT_AT_INDEX,version:"1.0.0",description:"String split at index operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(Z.SplitAtIndex);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f={firstPart:c.slice(0,e),secondPart:c.slice(e)};return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class l$e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.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:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(Z.SplitAtAllSeparators);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f=c.split(e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class o$e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.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:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(Z.SplitAtFirstSeparator);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],f=c.indexOf(e),h={firstPart:c.slice(0,f),secondPart:c.slice(f+e.length)};return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class d$e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.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:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(Z.SplitAtLastSeparator);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],f=c.lastIndexOf(e),h={firstPart:c.slice(0,f),secondPart:c.slice(f+e.length)};return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class u$e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_LAST_N_CHARS,version:"1.0.0",description:"String delete last number of characters operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(Z.DeleteLastNChars);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1]??1;if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No string provided",result:null};const f=c.slice(0,-e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class p$e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_FIRST_N_CHARS,version:"1.0.0",description:"String delete first number of characters operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(Z.DeleteFirstNChars);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1]??1;if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No string provided",result:null};const f=c.slice(0,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class c$e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REVERSE,version:"1.0.0",description:"String reverse operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(Z.Reverse);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)})[0];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No string provided",result:null};const e=c.split("").reverse().join("");return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class f$e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TO_LOWER_CASE,version:"1.0.0",description:"String to lower case operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(Z.ToLowerCase);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)})[0];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No string provided",result:null};const e=c.toLowerCase();return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class y$e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TO_UPPER_CASE,version:"1.0.0",description:"String to upper case operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(Z.ToUpperCase);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)})[0];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No string provided",result:null};const e=c.toUpperCase();return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class h$e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_AT_INDEX,version:"1.0.0",description:"String delete index operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(Z.DeleteAtIndex);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(E=>{var b,g;return((b=E.value)==null?void 0:b.valueAsType)||((g=E.value)==null?void 0:g.value)}),c=a[0],e=a[1],f=a[2]??1;if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No string provided",result:null};const h=Math.min(f,c.length-e),m=c.slice(0,e)+c.slice(e+h);return{value:U.Success,error:null,result:m}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class m$e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ADD_AT_INDEX,version:"1.0.0",description:"String add index operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(Z.AddAtIndex);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],f=a[2];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No string provided",result:null};const h=c.slice(0,e)+f+c.slice(e);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class T$e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_FIRST_N_CHARS,version:"1.0.0",description:"String replace first operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(Z.ReplaceFirstNChars);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1]??1,f=a[2];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No string provided",result:null};const h=f+c.slice(e);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class v$e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_LAST_N_CHARS,version:"1.0.0",description:"String replace last operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(Z.ReplaceLastNChars);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1]??1,f=a[2];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No string provided",result:null};const h=c.slice(0,-e)+f;return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class E$e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_AT_INDEX,version:"1.0.0",description:"String replace index operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(Z.ReplaceAtIndex);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(E=>{var b,g;return((b=E.value)==null?void 0:b.valueAsType)||((g=E.value)==null?void 0:g.value)}),c=a[0],e=a[1],f=a[2]??1,h=a[3];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No string provided",result:null};const m=(c.slice(0,e)||"")+h+(c.slice(e+f)||"");return{value:U.Success,error:null,result:m}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class b$e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_FIRST_MATCH,version:"1.0.0",description:"String replace single match operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(Z.ReplaceFirstMatch);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],f=a[2];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No string provided",result:null};const h=c.replace(e,f);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class A$e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_LAST_MATCH,version:"1.0.0",description:"String replace single match operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(Z.ReplaceLastMatch);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(E=>{var b,g;return((b=E.value)==null?void 0:b.valueAsType)||((g=E.value)==null?void 0:g.value)}),c=a[0],e=a[1],f=a[2];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No string provided",result:null};const h=c.lastIndexOf(e),m=h===-1?c:c.substring(0,h)+f+c.substring(h+e.length);return{value:U.Success,error:null,result:m}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class g$e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_ALL_MATCHES,version:"1.0.0",description:"String replace all matches operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(Z.ReplaceAllMatches);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],f=a[2];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No string provided",result:null};const h=c.split(e).join(f);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class I$e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_INDEX_ITEM,version:"1.0.0",description:"String get index operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(Z.GetIndexItem);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No string provided",result:null};const f=c.charAt(e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class R$e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LAST_N_CHARS,version:"1.0.0",description:"String get last N chars operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(Z.GetLastNChars);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No string provided",result:null};const f=c.slice(-e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class D$e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_FIRST_N_CHARS,version:"1.0.0",description:"String get first N chars operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(Z.GetFirstNChars);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No string provided",result:null};const f=c.slice(0,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class w$e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_INDEX_OF,version:"1.0.0",description:"String get index of operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(Z.GetIndexOf);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No string provided",result:null};if(typeof e!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No search value provided",result:null};const f=c.indexOf(e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class C$e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_APPEND,version:"1.0.0",description:"String append operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(Z.Append);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No string provided",result:null};if(typeof e!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No value to append provided",result:null};const f=a.slice(2);if(!f.every(m=>typeof m=="string"))return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"All values to append must be strings",result:null};const h=[c,e,...f].join("");return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class O$e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PREPEND,version:"1.0.0",description:"String prepend operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(Z.Prepend);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No string provided",result:null};const f=e+c;return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class _$e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TRIM,version:"1.0.0",description:"String trim implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(Z.Trim);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)}),c=a.trim();return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class V$e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TRIM_START,version:"1.0.0",description:"String trimStart implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(Z.TrimStart);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)}),c=a.trimStart();return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class P$e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TRIM_END,version:"1.0.0",description:"String trimEnd implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(Z.TrimEnd);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)}),c=a.trimEnd();return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class N$e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SUBSTRING,version:"1.0.0",description:"String substring(start, end?) implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(Z.Substring);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)??((E=h.value)==null?void 0:E.value)}),f=a.substring(c,e??void 0);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class x$e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SLICE,version:"1.0.0",description:"String slice(start, end?) implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(Z.Slice);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)??((E=h.value)==null?void 0:E.value)}),f=a.slice(c,e??void 0);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class $$e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LAST_INDEX_OF,version:"1.0.0",description:"String lastIndexOf(search, fromIndex?) implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(Z.GetLastIndexOf);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)??((E=h.value)==null?void 0:E.value)}),f=a.lastIndexOf(c,e??void 0);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class L$e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PAD_START,version:"1.0.0",description:"String padStart(targetLength, padString?) implementation",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(Z.PadStart);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)??((E=h.value)==null?void 0:E.value)}),f=a.padStart(c,e??void 0);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class B$e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PAD_END,version:"1.0.0",description:"String padEnd(targetLength, padString?) implementation",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(Z.PadEnd);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)??((E=h.value)==null?void 0:E.value)}),f=a.padEnd(c,e??void 0);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class M$e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPEAT,version:"1.0.0",description:"String repeat(count) implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(Z.Repeat);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)??((m=f.value)==null?void 0:m.value)}),e=a.repeat(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class G$e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_MATCH_REGEX,version:"1.0.0",description:"String match(regex) -> first match array or null",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(Z.MatchRegex);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)??((b=m.value)==null?void 0:b.value)}),f=new RegExp(String(c??""),e?String(e):void 0),h=String(a??"").match(f);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class j$e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_MATCH_ALL_REGEX,version:"1.0.0",description:"String matchAll(regex) -> array of matches",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(Z.MatchAllRegex);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=r.map(b=>{var g,_;return((g=b.value)==null?void 0:g.valueAsType)??((_=b.value)==null?void 0:_.value)}),f=e?String(e):"",h=f.includes("g")?f:f+"g",m=new RegExp(String(c??""),h),E=Array.from(String(a??"").matchAll(m),b=>Array.from(b));return{value:U.Success,error:null,result:E}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class U$e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SEARCH_REGEX,version:"1.0.0",description:"String search(regex) -> index or -1",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(Z.SearchRegex);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)??((E=h.value)==null?void 0:E.value)});let f=-1;try{const h=new RegExp(String(c??""),e?String(e):void 0);f=String(a??"").search(h)}catch{f=-1}return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class k$e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_REGEX,version:"1.0.0",description:"String replace using RegExp (pattern, replacement, flags?)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(Z.ReplaceRegex);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e,f]=r.map(E=>{var b,g;return((b=E.value)==null?void 0:b.valueAsType)??((g=E.value)==null?void 0:g.value)});let h=String(a??"");const m=new RegExp(String(c??""),f?String(f):void 0);return h=h.replace(m,String(e??"")),{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class F$e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_NORMALIZE_UNICODE,version:"1.0.0",description:"String normalize(form?) implementation module (NFC by default)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(Z.NormalizeUnicode);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)??((m=f.value)==null?void 0:m.value)}),e=a.normalize(c||"NFC");return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}const kg=class kg extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REMOVE_DIACRITICS,version:"1.0.0",description:"Remove diacritics via NFD decomposition + strip combining marks",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(Z.RemoveDiacritics);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)}),c=String(a??"").normalize("NFD").replace(kg.COMBINING_MARKS,"");return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}};R(kg,"COMBINING_MARKS",/[\u0300-\u036f]/g);let fg=kg;class K$e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_COUNT_OCCURRENCES,version:"1.0.0",description:"Count literal substring occurrences in a string",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(Z.CountOccurrences);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)??((b=m.value)==null?void 0:b.value)}),e=String(a??""),f=String(c??""),h=f===""?0:e.split(f).length-1;return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class S$e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ENSURE_PREFIX,version:"1.0.0",description:"Ensure string starts with given prefix (add if missing)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(Z.EnsurePrefix);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)??((b=m.value)==null?void 0:b.value)}),e=String(a??""),f=String(c??""),h=e.startsWith(f)?e:f+e;return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class q$e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ENSURE_SUFFIX,version:"1.0.0",description:"Ensure string ends with given suffix (add if missing)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(Z.EnsureSuffix);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)??((b=m.value)==null?void 0:b.value)}),e=String(a??""),f=String(c??""),h=e.endsWith(f)?e:e+f;return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Z$e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REMOVE_PREFIX,version:"1.0.0",description:"Remove prefix if present",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(Z.RemovePrefix);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)??((b=m.value)==null?void 0:b.value)}),e=String(a??""),f=String(c??""),h=e.startsWith(f)?e.slice(f.length):e;return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class H$e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REMOVE_SUFFIX,version:"1.0.0",description:"Remove suffix if present",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(Z.RemoveSuffix);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)??((b=m.value)==null?void 0:b.value)}),e=String(a??""),f=String(c??""),h=e.endsWith(f)?e.slice(0,-f.length):e;return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class W$e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_STARTS_WITH,version:"1.0.0",description:"String startsWith(needle) -> boolean",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(Z.StartsWith);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)??((m=f.value)==null?void 0:m.value)});if(typeof a!="string"||typeof c!="string")throw new TypeError("StartsWith expects two strings.");const e=a.startsWith(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class z$e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ENDS_WITH,version:"1.0.0",description:"String endsWith(needle) -> boolean",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(Z.EndsWith);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)??((m=f.value)==null?void 0:m.value)});if(typeof a!="string"||typeof c!="string")throw new TypeError("EndsWith expects two strings.");const e=a.endsWith(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Y$e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_CONTAINS,version:"1.0.0",description:"String includes(needle) -> boolean",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(Z.Contains);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)??((m=f.value)==null?void 0:m.value)});if(typeof a!="string"||typeof c!="string")throw new TypeError("Contains expects two strings.");const e=a.includes(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class J$e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_MATCHES_REGEX,version:"1.0.0",description:"Regex test: new RegExp(pattern, flags?).test(src) -> boolean",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(Z.MatchesRegex);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)??((b=m.value)==null?void 0:b.value)});if(typeof a!="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 f=!1;return f=new RegExp(c,e).test(a),{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}function X$e(l,p){const i=Number(l),a=10**Math.max(0,Number(p)||0);return Math.round(i*a)/a}function Q$e(l,p){const i=Number(l),r=Math.abs(Number(p)||0);return r===0?i:Math.round(i/r)*r}function eLe(l,p,i){const r=Number(l),a=Number(p),c=Number(i);return Math.min(Math.max(r,a),c)}function tLe(l,p,i,r,a){const c=Number(l),e=Number(p),f=Number(i),h=Number(r),m=Number(a);if(e===f)throw new Error("Input range cannot be zero");const E=(c-e)/(f-e);return h+E*(m-h)}function iLe(...l){const p=l.map(r=>Number(r));return p.length===0?0:p.reduce((r,a)=>r+a,0)/p.length}function rLe(...l){const p=l.map(r=>Number(r)).sort((r,a)=>r-a);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 nLe(l,p){const i=Number(l),r=Number(p);return r===0?NaN:i<0&&r%2===1?-Math.pow(-i,1/r):Math.pow(i,1/r)}function aLe(l,p){const i=Number(l),r=Number(p);return i===0?1/0:(r-i)/i*100}const hi=l=>l.map(p=>{var i,r;return((i=p.value)==null?void 0:i.valueAsType)??((r=p.value)==null?void 0:r.value)});class sLe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ADDITION,version:"1.0.0",description:"Number addition operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(pe.Addition);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=hi(r).reduce((e,f)=>e+f,0);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class lLe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SUBTRACTION,version:"1.0.0",description:"Number subtraction operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(pe.Subtraction);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=hi(r).reduce((e,f)=>e-f,0);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class oLe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MULTIPLICATION,version:"1.0.0",description:"Number multiplication operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(pe.Multiplication);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=hi(r).reduce((e,f)=>e*f,1);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class dLe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_DIVISION,version:"1.0.0",description:"Number division operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(pe.Division);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c]=hi(r);if(c===0)throw new Error("Division by zero is not allowed");const e=a/c;return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class uLe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_REMAINDER,version:"1.0.0",description:"Number remainder operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(pe.Remainder);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c]=hi(r);if(c===0)throw new Error("Division by zero is not allowed");const e=a%c;return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class pLe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_EXPONENTIATION,version:"1.0.0",description:"Number exponentiation operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(pe.Exponentiation);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c]=hi(r),e=Math.pow(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class cLe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_NEGATE,version:"1.0.0",description:"Number negate (unary -x)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(pe.Negate);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=hi(r);return{value:U.Success,error:null,result:-a}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class fLe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ABSOLUTE,version:"1.0.0",description:"Number absolute (|x|)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(pe.Absolute);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=hi(r);return{value:U.Success,error:null,result:Math.abs(Number(a))}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class yLe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SIGN,version:"1.0.0",description:"Number sign (-1 | 0 | 1)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(pe.Sign);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=hi(r);return{value:U.Success,error:null,result:Math.sign(Number(a))}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class hLe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ROUND,version:"1.0.0",description:"Number round to nearest integer",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(pe.Round);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=hi(r);return{value:U.Success,error:null,result:Math.round(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class mLe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_FLOOR,version:"1.0.0",description:"Number floor (⌊x⌋)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(pe.Floor);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=hi(r);return{value:U.Success,error:null,result:Math.floor(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class TLe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_CEIL,version:"1.0.0",description:"Number ceil (⌈x⌉)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(pe.Ceil);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=hi(r);return{value:U.Success,error:null,result:Math.ceil(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class vLe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TRUNC,version:"1.0.0",description:"Number truncation (drop fractional part)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(pe.Trunc);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=hi(r);return{value:U.Success,error:null,result:Math.trunc(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class ELe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ROUND_TO_DECIMALS,version:"1.0.0",description:"Round to N decimals",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(pe.RoundToDecimals);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=hi(r),e=X$e(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class bLe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.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:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(pe.SnapToStep);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=hi(r),e=Q$e(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class ALe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_CLAMP,version:"1.0.0",description:"Clamp value to [min, max]",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(pe.Clamp);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=hi(r),f=eLe(a,c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class gLe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MAP_RANGE,version:"1.0.0",description:"Map value from [inMin,inMax] to [outMin,outMax]",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(pe.MapRange);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e,f,h]=hi(r),m=tLe(a,c,e,f,h);return{value:U.Success,error:null,result:m}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class ILe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_AVERAGE,version:"1.0.0",description:"Average(numbers...)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(pe.Average);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const a=hi(r),c=iLe(...a);return{value:U.Success,error:null,result:c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class RLe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MEDIAN,version:"1.0.0",description:"Median(numbers...)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(pe.Median);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const a=hi(r),c=rLe(...a);return{value:U.Success,error:null,result:c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class DLe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MIN_OF,version:"1.0.0",description:"Min(numbers...)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(pe.MinOf);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const a=hi(r).map(Number),c=a.length?Math.min(...a):1/0;return{value:U.Success,error:null,result:c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class wLe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MAX_OF,version:"1.0.0",description:"Max(numbers...)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(pe.MaxOf);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const a=hi(r).map(Number),c=a.length?Math.max(...a):-1/0;return{value:U.Success,error:null,result:c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class CLe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SQUARE_ROOT,version:"1.0.0",description:"Square root",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(pe.SquareRoot);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=hi(r);return{value:U.Success,error:null,result:Math.sqrt(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class OLe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_CUBE_ROOT,version:"1.0.0",description:"Cube root",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(pe.CubeRoot);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=hi(r);return{value:U.Success,error:null,result:Math.cbrt(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class _Le extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_NTH_ROOT,version:"1.0.0",description:"Nth root (value, n)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(pe.NthRoot);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=hi(r),e=nLe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class VLe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_EXP,version:"1.0.0",description:"e^x",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(pe.Exp);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=hi(r);return{value:U.Success,error:null,result:Math.exp(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class PLe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LOG_NATURAL,version:"1.0.0",description:"Natural log ln(x)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(pe.LogNatural);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=hi(r);return{value:U.Success,error:null,result:Math.log(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class NLe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LOG10,version:"1.0.0",description:"Log base 10",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(pe.Log10);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=hi(r),c=Number(a),e=Math.log10?Math.log10(c):Math.log(c)/Math.LN10;return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class xLe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SIN,version:"1.0.0",description:"sin(x in radians)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(pe.Sin);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=hi(r);return{value:U.Success,error:null,result:Math.sin(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class $Le extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_COS,version:"1.0.0",description:"cos(x in radians)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(pe.Cos);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=hi(r);return{value:U.Success,error:null,result:Math.cos(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class LLe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TAN,version:"1.0.0",description:"tan(x in radians)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(pe.Tan);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=hi(r);return{value:U.Success,error:null,result:Math.tan(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class BLe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ASIN,version:"1.0.0",description:"asin(x)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(pe.Asin);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=hi(r);return{value:U.Success,error:null,result:Math.asin(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class MLe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ACOS,version:"1.0.0",description:"acos(x)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(pe.Acos);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=hi(r);return{value:U.Success,error:null,result:Math.acos(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class GLe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ATAN,version:"1.0.0",description:"atan(x)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(pe.Atan);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=hi(r);return{value:U.Success,error:null,result:Math.atan(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class jLe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ATAN2,version:"1.0.0",description:"atan2(y, x)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(pe.Atan2);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=hi(r);return{value:U.Success,error:null,result:Math.atan2(Number(a),Number(c))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class ULe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TO_RADIANS,version:"1.0.0",description:"deg → rad",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(pe.ToRadians);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=hi(r);return{value:U.Success,error:null,result:Number(a)*Math.PI/180}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class kLe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TO_DEGREES,version:"1.0.0",description:"rad → deg",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(pe.ToDegrees);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=hi(r);return{value:U.Success,error:null,result:Number(a)*180/Math.PI}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class FLe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_PERCENT_OF,version:"1.0.0",description:"x percent of y",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(pe.PercentOf);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=hi(r),e=Number(a)/100*Number(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class m_ extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_PERCENTAGE_CHANGE,version:"1.0.0",description:"((new-old)/old)*100",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(pe.PercentageChange);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=hi(r),e=aLe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class KLe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LESS_THAN,version:"1.0.0",description:"a < b",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(pe.LessThan);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=hi(r);return{value:U.Success,error:null,result:a<c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class SLe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MORE_THAN,version:"1.0.0",description:"a > b",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(pe.MoreThan);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=hi(r);return{value:U.Success,error:null,result:a>c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class qLe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LESS_THAN_OR_EQUAL,version:"1.0.0",description:"a <= b",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(pe.LessThanOrEqual);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=hi(r);return{value:U.Success,error:null,result:a<=c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class ZLe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MORE_THAN_OR_EQUAL,version:"1.0.0",description:"a >= b",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(pe.MoreThanOrEqual);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=hi(r);return{value:U.Success,error:null,result:a>=c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}function HLe(l,p){return function(){return l.apply(p,arguments)}}const{toString:Ngi}=Object.prototype,{getPrototypeOf:$x}=Object,{iterator:e1,toStringTag:WLe}=Symbol,t1=(l=>p=>{const i=Ngi.call(p);return l[i]||(l[i]=i.slice(8,-1).toLowerCase())})(Object.create(null)),Eo=l=>(l=l.toLowerCase(),p=>t1(p)===l),i1=l=>p=>typeof p===l,{isArray:Am}=Array,oh=i1("undefined");function nE(l){return l!==null&&!oh(l)&&l.constructor!==null&&!oh(l.constructor)&&Ja(l.constructor.isBuffer)&&l.constructor.isBuffer(l)}const zLe=Eo("ArrayBuffer");function xgi(l){let p;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?p=ArrayBuffer.isView(l):p=l&&l.buffer&&zLe(l.buffer),p}const $gi=i1("string"),Ja=i1("function"),YLe=i1("number"),aE=l=>l!==null&&typeof l=="object",Lgi=l=>l===!0||l===!1,FA=l=>{if(t1(l)!=="object")return!1;const p=$x(l);return(p===null||p===Object.prototype||Object.getPrototypeOf(p)===null)&&!(WLe in l)&&!(e1 in l)},Bgi=l=>{if(!aE(l)||nE(l))return!1;try{return Object.keys(l).length===0&&Object.getPrototypeOf(l)===Object.prototype}catch{return!1}},Mgi=Eo("Date"),Ggi=Eo("File"),jgi=Eo("Blob"),Ugi=Eo("FileList"),kgi=l=>aE(l)&&Ja(l.pipe),Fgi=l=>{let p;return l&&(typeof FormData=="function"&&l instanceof FormData||Ja(l.append)&&((p=t1(l))==="formdata"||p==="object"&&Ja(l.toString)&&l.toString()==="[object FormData]"))},Kgi=Eo("URLSearchParams"),[Sgi,qgi,Zgi,Hgi]=["ReadableStream","Request","Response","Headers"].map(Eo),Wgi=l=>l.trim?l.trim():l.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function sE(l,p,{allOwnKeys:i=!1}={}){if(l===null||typeof l>"u")return;let r,a;if(typeof l!="object"&&(l=[l]),Am(l))for(r=0,a=l.length;r<a;r++)p.call(null,l[r],r,l);else{if(nE(l))return;const c=i?Object.getOwnPropertyNames(l):Object.keys(l),e=c.length;let f;for(r=0;r<e;r++)f=c[r],p.call(null,l[f],f,l)}}function JLe(l,p){if(nE(l))return null;p=p.toLowerCase();const i=Object.keys(l);let r=i.length,a;for(;r-- >0;)if(a=i[r],p===a.toLowerCase())return a;return null}const Xc=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),XLe=l=>!oh(l)&&l!==Xc;function T_(){const{caseless:l,skipUndefined:p}=XLe(this)&&this||{},i={},r=(a,c)=>{const e=l&&JLe(i,c)||c;FA(i[e])&&FA(a)?i[e]=T_(i[e],a):FA(a)?i[e]=T_({},a):Am(a)?i[e]=a.slice():(!p||!oh(a))&&(i[e]=a)};for(let a=0,c=arguments.length;a<c;a++)arguments[a]&&sE(arguments[a],r);return i}const zgi=(l,p,i,{allOwnKeys:r}={})=>(sE(p,(a,c)=>{i&&Ja(a)?l[c]=HLe(a,i):l[c]=a},{allOwnKeys:r}),l),Ygi=l=>(l.charCodeAt(0)===65279&&(l=l.slice(1)),l),Jgi=(l,p,i,r)=>{l.prototype=Object.create(p.prototype,r),l.prototype.constructor=l,Object.defineProperty(l,"super",{value:p.prototype}),i&&Object.assign(l.prototype,i)},Xgi=(l,p,i,r)=>{let a,c,e;const f={};if(p=p||{},l==null)return p;do{for(a=Object.getOwnPropertyNames(l),c=a.length;c-- >0;)e=a[c],(!r||r(e,l,p))&&!f[e]&&(p[e]=l[e],f[e]=!0);l=i!==!1&&$x(l)}while(l&&(!i||i(l,p))&&l!==Object.prototype);return p},Qgi=(l,p,i)=>{l=String(l),(i===void 0||i>l.length)&&(i=l.length),i-=p.length;const r=l.indexOf(p,i);return r!==-1&&r===i},eIi=l=>{if(!l)return null;if(Am(l))return l;let p=l.length;if(!YLe(p))return null;const i=new Array(p);for(;p-- >0;)i[p]=l[p];return i},tIi=(l=>p=>l&&p instanceof l)(typeof Uint8Array<"u"&&$x(Uint8Array)),iIi=(l,p)=>{const r=(l&&l[e1]).call(l);let a;for(;(a=r.next())&&!a.done;){const c=a.value;p.call(l,c[0],c[1])}},rIi=(l,p)=>{let i;const r=[];for(;(i=l.exec(p))!==null;)r.push(i);return r},nIi=Eo("HTMLFormElement"),aIi=l=>l.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(i,r,a){return r.toUpperCase()+a}),gU=(({hasOwnProperty:l})=>(p,i)=>l.call(p,i))(Object.prototype),sIi=Eo("RegExp"),QLe=(l,p)=>{const i=Object.getOwnPropertyDescriptors(l),r={};sE(i,(a,c)=>{let e;(e=p(a,c,l))!==!1&&(r[c]=e||a)}),Object.defineProperties(l,r)},lIi=l=>{QLe(l,(p,i)=>{if(Ja(l)&&["arguments","caller","callee"].indexOf(i)!==-1)return!1;const r=l[i];if(Ja(r)){if(p.enumerable=!1,"writable"in p){p.writable=!1;return}p.set||(p.set=()=>{throw Error("Can not rewrite read-only method '"+i+"'")})}})},oIi=(l,p)=>{const i={},r=a=>{a.forEach(c=>{i[c]=!0})};return Am(l)?r(l):r(String(l).split(p)),i},dIi=()=>{},uIi=(l,p)=>l!=null&&Number.isFinite(l=+l)?l:p;function pIi(l){return!!(l&&Ja(l.append)&&l[WLe]==="FormData"&&l[e1])}const cIi=l=>{const p=new Array(10),i=(r,a)=>{if(aE(r)){if(p.indexOf(r)>=0)return;if(nE(r))return r;if(!("toJSON"in r)){p[a]=r;const c=Am(r)?[]:{};return sE(r,(e,f)=>{const h=i(e,a+1);!oh(h)&&(c[f]=h)}),p[a]=void 0,c}}return r};return i(l,0)},fIi=Eo("AsyncFunction"),yIi=l=>l&&(aE(l)||Ja(l))&&Ja(l.then)&&Ja(l.catch),e2e=((l,p)=>l?setImmediate:p?((i,r)=>(Xc.addEventListener("message",({source:a,data:c})=>{a===Xc&&c===i&&r.length&&r.shift()()},!1),a=>{r.push(a),Xc.postMessage(i,"*")}))(`axios@${Math.random()}`,[]):i=>setTimeout(i))(typeof setImmediate=="function",Ja(Xc.postMessage)),hIi=typeof queueMicrotask<"u"?queueMicrotask.bind(Xc):typeof process<"u"&&process.nextTick||e2e,mIi=l=>l!=null&&Ja(l[e1]),qe={isArray:Am,isArrayBuffer:zLe,isBuffer:nE,isFormData:Fgi,isArrayBufferView:xgi,isString:$gi,isNumber:YLe,isBoolean:Lgi,isObject:aE,isPlainObject:FA,isEmptyObject:Bgi,isReadableStream:Sgi,isRequest:qgi,isResponse:Zgi,isHeaders:Hgi,isUndefined:oh,isDate:Mgi,isFile:Ggi,isBlob:jgi,isRegExp:sIi,isFunction:Ja,isStream:kgi,isURLSearchParams:Kgi,isTypedArray:tIi,isFileList:Ugi,forEach:sE,merge:T_,extend:zgi,trim:Wgi,stripBOM:Ygi,inherits:Jgi,toFlatObject:Xgi,kindOf:t1,kindOfTest:Eo,endsWith:Qgi,toArray:eIi,forEachEntry:iIi,matchAll:rIi,isHTMLForm:nIi,hasOwnProperty:gU,hasOwnProp:gU,reduceDescriptors:QLe,freezeMethods:lIi,toObjectSet:oIi,toCamelCase:aIi,noop:dIi,toFiniteNumber:uIi,findKey:JLe,global:Xc,isContextDefined:XLe,isSpecCompliantForm:pIi,toJSONObject:cIi,isAsyncFn:fIi,isThenable:yIi,setImmediate:e2e,asap:hIi,isIterable:mIi};function fi(l,p,i,r,a){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=l,this.name="AxiosError",p&&(this.code=p),i&&(this.config=i),r&&(this.request=r),a&&(this.response=a,this.status=a.status?a.status:null)}qe.inherits(fi,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:qe.toJSONObject(this.config),code:this.code,status:this.status}}});const t2e=fi.prototype,i2e={};["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(l=>{i2e[l]={value:l}});Object.defineProperties(fi,i2e);Object.defineProperty(t2e,"isAxiosError",{value:!0});fi.from=(l,p,i,r,a,c)=>{const e=Object.create(t2e);qe.toFlatObject(l,e,function(E){return E!==Error.prototype},m=>m!=="isAxiosError");const f=l&&l.message?l.message:"Error",h=p==null&&l?l.code:p;return fi.call(e,f,h,i,r,a),l&&e.cause==null&&Object.defineProperty(e,"cause",{value:l,configurable:!0}),e.name=l&&l.name||"Error",c&&Object.assign(e,c),e};const TIi=null;function v_(l){return qe.isPlainObject(l)||qe.isArray(l)}function r2e(l){return qe.endsWith(l,"[]")?l.slice(0,-2):l}function IU(l,p,i){return l?l.concat(p).map(function(a,c){return a=r2e(a),!i&&c?"["+a+"]":a}).join(i?".":""):p}function vIi(l){return qe.isArray(l)&&!l.some(v_)}const EIi=qe.toFlatObject(qe,{},null,function(p){return/^is[A-Z]/.test(p)});function r1(l,p,i){if(!qe.isObject(l))throw new TypeError("target must be an object");p=p||new FormData,i=qe.toFlatObject(i,{metaTokens:!0,dots:!1,indexes:!1},!1,function(L,j){return!qe.isUndefined(j[L])});const r=i.metaTokens,a=i.visitor||E,c=i.dots,e=i.indexes,h=(i.Blob||typeof Blob<"u"&&Blob)&&qe.isSpecCompliantForm(p);if(!qe.isFunction(a))throw new TypeError("visitor must be a function");function m($){if($===null)return"";if(qe.isDate($))return $.toISOString();if(qe.isBoolean($))return $.toString();if(!h&&qe.isBlob($))throw new fi("Blob is not supported. Use a Buffer instead.");return qe.isArrayBuffer($)||qe.isTypedArray($)?h&&typeof Blob=="function"?new Blob([$]):Buffer.from($):$}function E($,L,j){let k=$;if($&&!j&&typeof $=="object"){if(qe.endsWith(L,"{}"))L=r?L:L.slice(0,-2),$=JSON.stringify($);else if(qe.isArray($)&&vIi($)||(qe.isFileList($)||qe.endsWith(L,"[]"))&&(k=qe.toArray($)))return L=r2e(L),k.forEach(function(H,ie){!(qe.isUndefined(H)||H===null)&&p.append(e===!0?IU([L],ie,c):e===null?L:L+"[]",m(H))}),!1}return v_($)?!0:(p.append(IU(j,L,c),m($)),!1)}const b=[],g=Object.assign(EIi,{defaultVisitor:E,convertValue:m,isVisitable:v_});function _($,L){if(!qe.isUndefined($)){if(b.indexOf($)!==-1)throw Error("Circular reference detected in "+L.join("."));b.push($),qe.forEach($,function(k,G){(!(qe.isUndefined(k)||k===null)&&a.call(p,k,qe.isString(G)?G.trim():G,L,g))===!0&&_(k,L?L.concat(G):[G])}),b.pop()}}if(!qe.isObject(l))throw new TypeError("data must be an object");return _(l),p}function RU(l){const p={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(l).replace(/[!'()~]|%20|%00/g,function(r){return p[r]})}function Lx(l,p){this._pairs=[],l&&r1(l,this,p)}const n2e=Lx.prototype;n2e.append=function(p,i){this._pairs.push([p,i])};n2e.toString=function(p){const i=p?function(r){return p.call(this,r,RU)}:RU;return this._pairs.map(function(a){return i(a[0])+"="+i(a[1])},"").join("&")};function bIi(l){return encodeURIComponent(l).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function a2e(l,p,i){if(!p)return l;const r=i&&i.encode||bIi;qe.isFunction(i)&&(i={serialize:i});const a=i&&i.serialize;let c;if(a?c=a(p,i):c=qe.isURLSearchParams(p)?p.toString():new Lx(p,i).toString(r),c){const e=l.indexOf("#");e!==-1&&(l=l.slice(0,e)),l+=(l.indexOf("?")===-1?"?":"&")+c}return l}class AIi{constructor(){this.handlers=[]}use(p,i,r){return this.handlers.push({fulfilled:p,rejected:i,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(p){this.handlers[p]&&(this.handlers[p]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(p){qe.forEach(this.handlers,function(r){r!==null&&p(r)})}}const DU=AIi,s2e={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},gIi=typeof URLSearchParams<"u"?URLSearchParams:Lx,IIi=typeof FormData<"u"?FormData:null,RIi=typeof Blob<"u"?Blob:null,DIi={isBrowser:!0,classes:{URLSearchParams:gIi,FormData:IIi,Blob:RIi},protocols:["http","https","file","blob","url","data"]},Bx=typeof window<"u"&&typeof document<"u",E_=typeof navigator=="object"&&navigator||void 0,wIi=Bx&&(!E_||["ReactNative","NativeScript","NS"].indexOf(E_.product)<0),CIi=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),OIi=Bx&&window.location.href||"http://localhost",_Ii=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Bx,hasStandardBrowserEnv:wIi,hasStandardBrowserWebWorkerEnv:CIi,navigator:E_,origin:OIi},Symbol.toStringTag,{value:"Module"})),ca={..._Ii,...DIi};function VIi(l,p){return r1(l,new ca.classes.URLSearchParams,{visitor:function(i,r,a,c){return ca.isNode&&qe.isBuffer(i)?(this.append(r,i.toString("base64")),!1):c.defaultVisitor.apply(this,arguments)},...p})}function PIi(l){return qe.matchAll(/\w+|\[(\w*)]/g,l).map(p=>p[0]==="[]"?"":p[1]||p[0])}function NIi(l){const p={},i=Object.keys(l);let r;const a=i.length;let c;for(r=0;r<a;r++)c=i[r],p[c]=l[c];return p}function l2e(l){function p(i,r,a,c){let e=i[c++];if(e==="__proto__")return!0;const f=Number.isFinite(+e),h=c>=i.length;return e=!e&&qe.isArray(a)?a.length:e,h?(qe.hasOwnProp(a,e)?a[e]=[a[e],r]:a[e]=r,!f):((!a[e]||!qe.isObject(a[e]))&&(a[e]=[]),p(i,r,a[e],c)&&qe.isArray(a[e])&&(a[e]=NIi(a[e])),!f)}if(qe.isFormData(l)&&qe.isFunction(l.entries)){const i={};return qe.forEachEntry(l,(r,a)=>{p(PIi(r),a,i,0)}),i}return null}function xIi(l,p,i){if(qe.isString(l))try{return(p||JSON.parse)(l),qe.trim(l)}catch(r){if(r.name!=="SyntaxError")throw r}return(i||JSON.stringify)(l)}const Mx={transitional:s2e,adapter:["xhr","http","fetch"],transformRequest:[function(p,i){const r=i.getContentType()||"",a=r.indexOf("application/json")>-1,c=qe.isObject(p);if(c&&qe.isHTMLForm(p)&&(p=new FormData(p)),qe.isFormData(p))return a?JSON.stringify(l2e(p)):p;if(qe.isArrayBuffer(p)||qe.isBuffer(p)||qe.isStream(p)||qe.isFile(p)||qe.isBlob(p)||qe.isReadableStream(p))return p;if(qe.isArrayBufferView(p))return p.buffer;if(qe.isURLSearchParams(p))return i.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),p.toString();let f;if(c){if(r.indexOf("application/x-www-form-urlencoded")>-1)return VIi(p,this.formSerializer).toString();if((f=qe.isFileList(p))||r.indexOf("multipart/form-data")>-1){const h=this.env&&this.env.FormData;return r1(f?{"files[]":p}:p,h&&new h,this.formSerializer)}}return c||a?(i.setContentType("application/json",!1),xIi(p)):p}],transformResponse:[function(p){const i=this.transitional||Mx.transitional,r=i&&i.forcedJSONParsing,a=this.responseType==="json";if(qe.isResponse(p)||qe.isReadableStream(p))return p;if(p&&qe.isString(p)&&(r&&!this.responseType||a)){const e=!(i&&i.silentJSONParsing)&&a;try{return JSON.parse(p,this.parseReviver)}catch(f){if(e)throw f.name==="SyntaxError"?fi.from(f,fi.ERR_BAD_RESPONSE,this,null,this.response):f}}return p}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ca.classes.FormData,Blob:ca.classes.Blob},validateStatus:function(p){return p>=200&&p<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};qe.forEach(["delete","get","head","post","put","patch"],l=>{Mx.headers[l]={}});const Gx=Mx,$Ii=qe.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"]),LIi=l=>{const p={};let i,r,a;return l&&l.split(`
|
|
50
50
|
`).forEach(function(e){a=e.indexOf(":"),i=e.substring(0,a).trim().toLowerCase(),r=e.substring(a+1).trim(),!(!i||p[i]&&$Ii[i])&&(i==="set-cookie"?p[i]?p[i].push(r):p[i]=[r]:p[i]=p[i]?p[i]+", "+r:r)}),p},wU=Symbol("internals");function w0(l){return l&&String(l).trim().toLowerCase()}function KA(l){return l===!1||l==null?l:qe.isArray(l)?l.map(KA):String(l)}function BIi(l){const p=Object.create(null),i=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=i.exec(l);)p[r[1]]=r[2];return p}const MIi=l=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(l.trim());function xO(l,p,i,r,a){if(qe.isFunction(r))return r.call(this,p,i);if(a&&(p=i),!!qe.isString(p)){if(qe.isString(r))return p.indexOf(r)!==-1;if(qe.isRegExp(r))return r.test(p)}}function GIi(l){return l.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(p,i,r)=>i.toUpperCase()+r)}function jIi(l,p){const i=qe.toCamelCase(" "+p);["get","set","has"].forEach(r=>{Object.defineProperty(l,r+i,{value:function(a,c,e){return this[r].call(this,p,a,c,e)},configurable:!0})})}class n1{constructor(p){p&&this.set(p)}set(p,i,r){const a=this;function c(f,h,m){const E=w0(h);if(!E)throw new Error("header name must be a non-empty string");const b=qe.findKey(a,E);(!b||a[b]===void 0||m===!0||m===void 0&&a[b]!==!1)&&(a[b||h]=KA(f))}const e=(f,h)=>qe.forEach(f,(m,E)=>c(m,E,h));if(qe.isPlainObject(p)||p instanceof this.constructor)e(p,i);else if(qe.isString(p)&&(p=p.trim())&&!MIi(p))e(LIi(p),i);else if(qe.isObject(p)&&qe.isIterable(p)){let f={},h,m;for(const E of p){if(!qe.isArray(E))throw TypeError("Object iterator must return a key-value pair");f[m=E[0]]=(h=f[m])?qe.isArray(h)?[...h,E[1]]:[h,E[1]]:E[1]}e(f,i)}else p!=null&&c(i,p,r);return this}get(p,i){if(p=w0(p),p){const r=qe.findKey(this,p);if(r){const a=this[r];if(!i)return a;if(i===!0)return BIi(a);if(qe.isFunction(i))return i.call(this,a,r);if(qe.isRegExp(i))return i.exec(a);throw new TypeError("parser must be boolean|regexp|function")}}}has(p,i){if(p=w0(p),p){const r=qe.findKey(this,p);return!!(r&&this[r]!==void 0&&(!i||xO(this,this[r],r,i)))}return!1}delete(p,i){const r=this;let a=!1;function c(e){if(e=w0(e),e){const f=qe.findKey(r,e);f&&(!i||xO(r,r[f],f,i))&&(delete r[f],a=!0)}}return qe.isArray(p)?p.forEach(c):c(p),a}clear(p){const i=Object.keys(this);let r=i.length,a=!1;for(;r--;){const c=i[r];(!p||xO(this,this[c],c,p,!0))&&(delete this[c],a=!0)}return a}normalize(p){const i=this,r={};return qe.forEach(this,(a,c)=>{const e=qe.findKey(r,c);if(e){i[e]=KA(a),delete i[c];return}const f=p?GIi(c):String(c).trim();f!==c&&delete i[c],i[f]=KA(a),r[f]=!0}),this}concat(...p){return this.constructor.concat(this,...p)}toJSON(p){const i=Object.create(null);return qe.forEach(this,(r,a)=>{r!=null&&r!==!1&&(i[a]=p&&qe.isArray(r)?r.join(", "):r)}),i}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([p,i])=>p+": "+i).join(`
|
|
51
51
|
`)}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 r=new this(p);return i.forEach(a=>r.set(a)),r}static accessor(p){const r=(this[wU]=this[wU]={accessors:{}}).accessors,a=this.prototype;function c(e){const f=w0(e);r[f]||(jIi(a,e),r[f]=!0)}return qe.isArray(p)?p.forEach(c):c(p),this}}n1.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);qe.reduceDescriptors(n1.prototype,({value:l},p)=>{let i=p[0].toUpperCase()+p.slice(1);return{get:()=>l,set(r){this[i]=r}}});qe.freezeMethods(n1);const Gl=n1;function $O(l,p){const i=this||Gx,r=p||i,a=Gl.from(r.headers);let c=r.data;return qe.forEach(l,function(f){c=f.call(i,c,a.normalize(),p?p.status:void 0)}),a.normalize(),c}function o2e(l){return!!(l&&l.__CANCEL__)}function gm(l,p,i){fi.call(this,l??"canceled",fi.ERR_CANCELED,p,i),this.name="CanceledError"}qe.inherits(gm,fi,{__CANCEL__:!0});function d2e(l,p,i){const r=i.config.validateStatus;!i.status||!r||r(i.status)?l(i):p(new fi("Request failed with status code "+i.status,[fi.ERR_BAD_REQUEST,fi.ERR_BAD_RESPONSE][Math.floor(i.status/100)-4],i.config,i.request,i))}function UIi(l){const p=/^([-+\w]{1,25})(:?\/\/|:)/.exec(l);return p&&p[1]||""}function kIi(l,p){l=l||10;const i=new Array(l),r=new Array(l);let a=0,c=0,e;return p=p!==void 0?p:1e3,function(h){const m=Date.now(),E=r[c];e||(e=m),i[a]=h,r[a]=m;let b=c,g=0;for(;b!==a;)g+=i[b++],b=b%l;if(a=(a+1)%l,a===c&&(c=(c+1)%l),m-e<p)return;const _=E&&m-E;return _?Math.round(g*1e3/_):void 0}}function FIi(l,p){let i=0,r=1e3/p,a,c;const e=(m,E=Date.now())=>{i=E,a=null,c&&(clearTimeout(c),c=null),l(...m)};return[(...m)=>{const E=Date.now(),b=E-i;b>=r?e(m,E):(a=m,c||(c=setTimeout(()=>{c=null,e(a)},r-b)))},()=>a&&e(a)]}const yg=(l,p,i=3)=>{let r=0;const a=kIi(50,250);return FIi(c=>{const e=c.loaded,f=c.lengthComputable?c.total:void 0,h=e-r,m=a(h),E=e<=f;r=e;const b={loaded:e,total:f,progress:f?e/f:void 0,bytes:h,rate:m||void 0,estimated:m&&f&&E?(f-e)/m:void 0,event:c,lengthComputable:f!=null,[p?"download":"upload"]:!0};l(b)},i)},CU=(l,p)=>{const i=l!=null;return[r=>p[0]({lengthComputable:i,total:l,loaded:r}),p[1]]},OU=l=>(...p)=>qe.asap(()=>l(...p)),KIi=ca.hasStandardBrowserEnv?((l,p)=>i=>(i=new URL(i,ca.origin),l.protocol===i.protocol&&l.host===i.host&&(p||l.port===i.port)))(new URL(ca.origin),ca.navigator&&/(msie|trident)/i.test(ca.navigator.userAgent)):()=>!0,SIi=ca.hasStandardBrowserEnv?{write(l,p,i,r,a,c,e){if(typeof document>"u")return;const f=[`${l}=${encodeURIComponent(p)}`];qe.isNumber(i)&&f.push(`expires=${new Date(i).toUTCString()}`),qe.isString(r)&&f.push(`path=${r}`),qe.isString(a)&&f.push(`domain=${a}`),c===!0&&f.push("secure"),qe.isString(e)&&f.push(`SameSite=${e}`),document.cookie=f.join("; ")},read(l){if(typeof document>"u")return null;const p=document.cookie.match(new RegExp("(?:^|; )"+l+"=([^;]*)"));return p?decodeURIComponent(p[1]):null},remove(l){this.write(l,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function qIi(l){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(l)}function ZIi(l,p){return p?l.replace(/\/?\/$/,"")+"/"+p.replace(/^\/+/,""):l}function u2e(l,p,i){let r=!qIi(p);return l&&(r||i==!1)?ZIi(l,p):p}const _U=l=>l instanceof Gl?{...l}:l;function of(l,p){p=p||{};const i={};function r(m,E,b,g){return qe.isPlainObject(m)&&qe.isPlainObject(E)?qe.merge.call({caseless:g},m,E):qe.isPlainObject(E)?qe.merge({},E):qe.isArray(E)?E.slice():E}function a(m,E,b,g){if(qe.isUndefined(E)){if(!qe.isUndefined(m))return r(void 0,m,b,g)}else return r(m,E,b,g)}function c(m,E){if(!qe.isUndefined(E))return r(void 0,E)}function e(m,E){if(qe.isUndefined(E)){if(!qe.isUndefined(m))return r(void 0,m)}else return r(void 0,E)}function f(m,E,b){if(b in p)return r(m,E);if(b in l)return r(void 0,m)}const h={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:f,headers:(m,E,b)=>a(_U(m),_U(E),b,!0)};return qe.forEach(Object.keys({...l,...p}),function(E){const b=h[E]||a,g=b(l[E],p[E],E);qe.isUndefined(g)&&b!==f||(i[E]=g)}),i}const p2e=l=>{const p=of({},l);let{data:i,withXSRFToken:r,xsrfHeaderName:a,xsrfCookieName:c,headers:e,auth:f}=p;if(p.headers=e=Gl.from(e),p.url=a2e(u2e(p.baseURL,p.url,p.allowAbsoluteUrls),l.params,l.paramsSerializer),f&&e.set("Authorization","Basic "+btoa((f.username||"")+":"+(f.password?unescape(encodeURIComponent(f.password)):""))),qe.isFormData(i)){if(ca.hasStandardBrowserEnv||ca.hasStandardBrowserWebWorkerEnv)e.setContentType(void 0);else if(qe.isFunction(i.getHeaders)){const h=i.getHeaders(),m=["content-type","content-length"];Object.entries(h).forEach(([E,b])=>{m.includes(E.toLowerCase())&&e.set(E,b)})}}if(ca.hasStandardBrowserEnv&&(r&&qe.isFunction(r)&&(r=r(p)),r||r!==!1&&KIi(p.url))){const h=a&&c&&SIi.read(c);h&&e.set(a,h)}return p},HIi=typeof XMLHttpRequest<"u",WIi=HIi&&function(l){return new Promise(function(i,r){const a=p2e(l);let c=a.data;const e=Gl.from(a.headers).normalize();let{responseType:f,onUploadProgress:h,onDownloadProgress:m}=a,E,b,g,_,$;function L(){_&&_(),$&&$(),a.cancelToken&&a.cancelToken.unsubscribe(E),a.signal&&a.signal.removeEventListener("abort",E)}let j=new XMLHttpRequest;j.open(a.method.toUpperCase(),a.url,!0),j.timeout=a.timeout;function k(){if(!j)return;const H=Gl.from("getAllResponseHeaders"in j&&j.getAllResponseHeaders()),ee={data:!f||f==="text"||f==="json"?j.responseText:j.response,status:j.status,statusText:j.statusText,headers:H,config:l,request:j};d2e(function(ae){i(ae),L()},function(ae){r(ae),L()},ee),j=null}"onloadend"in j?j.onloadend=k:j.onreadystatechange=function(){!j||j.readyState!==4||j.status===0&&!(j.responseURL&&j.responseURL.indexOf("file:")===0)||setTimeout(k)},j.onabort=function(){j&&(r(new fi("Request aborted",fi.ECONNABORTED,l,j)),j=null)},j.onerror=function(ie){const ee=ie&&ie.message?ie.message:"Network Error",ue=new fi(ee,fi.ERR_NETWORK,l,j);ue.event=ie||null,r(ue),j=null},j.ontimeout=function(){let ie=a.timeout?"timeout of "+a.timeout+"ms exceeded":"timeout exceeded";const ee=a.transitional||s2e;a.timeoutErrorMessage&&(ie=a.timeoutErrorMessage),r(new fi(ie,ee.clarifyTimeoutError?fi.ETIMEDOUT:fi.ECONNABORTED,l,j)),j=null},c===void 0&&e.setContentType(null),"setRequestHeader"in j&&qe.forEach(e.toJSON(),function(ie,ee){j.setRequestHeader(ee,ie)}),qe.isUndefined(a.withCredentials)||(j.withCredentials=!!a.withCredentials),f&&f!=="json"&&(j.responseType=a.responseType),m&&([g,$]=yg(m,!0),j.addEventListener("progress",g)),h&&j.upload&&([b,_]=yg(h),j.upload.addEventListener("progress",b),j.upload.addEventListener("loadend",_)),(a.cancelToken||a.signal)&&(E=H=>{j&&(r(!H||H.type?new gm(null,l,j):H),j.abort(),j=null)},a.cancelToken&&a.cancelToken.subscribe(E),a.signal&&(a.signal.aborted?E():a.signal.addEventListener("abort",E)));const G=UIi(a.url);if(G&&ca.protocols.indexOf(G)===-1){r(new fi("Unsupported protocol "+G+":",fi.ERR_BAD_REQUEST,l));return}j.send(c||null)})},zIi=(l,p)=>{const{length:i}=l=l?l.filter(Boolean):[];if(p||i){let r=new AbortController,a;const c=function(m){if(!a){a=!0,f();const E=m instanceof Error?m:this.reason;r.abort(E instanceof fi?E:new gm(E instanceof Error?E.message:E))}};let e=p&&setTimeout(()=>{e=null,c(new fi(`timeout ${p} of ms exceeded`,fi.ETIMEDOUT))},p);const f=()=>{l&&(e&&clearTimeout(e),e=null,l.forEach(m=>{m.unsubscribe?m.unsubscribe(c):m.removeEventListener("abort",c)}),l=null)};l.forEach(m=>m.addEventListener("abort",c));const{signal:h}=r;return h.unsubscribe=()=>qe.asap(f),h}},YIi=zIi,JIi=function*(l,p){let i=l.byteLength;if(!p||i<p){yield l;return}let r=0,a;for(;r<i;)a=r+p,yield l.slice(r,a),r=a},XIi=async function*(l,p){for await(const i of QIi(l))yield*JIi(i,p)},QIi=async function*(l){if(l[Symbol.asyncIterator]){yield*l;return}const p=l.getReader();try{for(;;){const{done:i,value:r}=await p.read();if(i)break;yield r}}finally{await p.cancel()}},VU=(l,p,i,r)=>{const a=XIi(l,p);let c=0,e,f=h=>{e||(e=!0,r&&r(h))};return new ReadableStream({async pull(h){try{const{done:m,value:E}=await a.next();if(m){f(),h.close();return}let b=E.byteLength;if(i){let g=c+=b;i(g)}h.enqueue(new Uint8Array(E))}catch(m){throw f(m),m}},cancel(h){return f(h),a.return()}},{highWaterMark:2})},PU=64*1024,{isFunction:$A}=qe,eRi=(({Request:l,Response:p})=>({Request:l,Response:p}))(qe.global),{ReadableStream:NU,TextEncoder:xU}=qe.global,$U=(l,...p)=>{try{return!!l(...p)}catch{return!1}},tRi=l=>{l=qe.merge.call({skipUndefined:!0},eRi,l);const{fetch:p,Request:i,Response:r}=l,a=p?$A(p):typeof fetch=="function",c=$A(i),e=$A(r);if(!a)return!1;const f=a&&$A(NU),h=a&&(typeof xU=="function"?($=>L=>$.encode(L))(new xU):async $=>new Uint8Array(await new i($).arrayBuffer())),m=c&&f&&$U(()=>{let $=!1;const L=new i(ca.origin,{body:new NU,method:"POST",get duplex(){return $=!0,"half"}}).headers.has("Content-Type");return $&&!L}),E=e&&f&&$U(()=>qe.isReadableStream(new r("").body)),b={stream:E&&($=>$.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach($=>{!b[$]&&(b[$]=(L,j)=>{let k=L&&L[$];if(k)return k.call(L);throw new fi(`Response type '${$}' is not supported`,fi.ERR_NOT_SUPPORT,j)})});const g=async $=>{if($==null)return 0;if(qe.isBlob($))return $.size;if(qe.isSpecCompliantForm($))return(await new i(ca.origin,{method:"POST",body:$}).arrayBuffer()).byteLength;if(qe.isArrayBufferView($)||qe.isArrayBuffer($))return $.byteLength;if(qe.isURLSearchParams($)&&($=$+""),qe.isString($))return(await h($)).byteLength},_=async($,L)=>{const j=qe.toFiniteNumber($.getContentLength());return j??g(L)};return async $=>{let{url:L,method:j,data:k,signal:G,cancelToken:H,timeout:ie,onDownloadProgress:ee,onUploadProgress:ue,responseType:ae,headers:de,withCredentials:ce="same-origin",fetchOptions:ne}=p2e($),le=p||fetch;ae=ae?(ae+"").toLowerCase():"text";let Q=YIi([G,H&&H.toAbortSignal()],ie),oe=null;const Ee=Q&&Q.unsubscribe&&(()=>{Q.unsubscribe()});let Te;try{if(ue&&m&&j!=="get"&&j!=="head"&&(Te=await _(de,k))!==0){let Je=new i(L,{method:"POST",body:k,duplex:"half"}),rt;if(qe.isFormData(k)&&(rt=Je.headers.get("content-type"))&&de.setContentType(rt),Je.body){const[Rt,Et]=CU(Te,yg(OU(ue)));k=VU(Je.body,PU,Rt,Et)}}qe.isString(ce)||(ce=ce?"include":"omit");const Ve=c&&"credentials"in i.prototype,Le={...ne,signal:Q,method:j.toUpperCase(),headers:de.normalize().toJSON(),body:k,duplex:"half",credentials:Ve?ce:void 0};oe=c&&new i(L,Le);let $e=await(c?le(oe,ne):le(L,Le));const ke=E&&(ae==="stream"||ae==="response");if(E&&(ee||ke&&Ee)){const Je={};["status","statusText","headers"].forEach(Xt=>{Je[Xt]=$e[Xt]});const rt=qe.toFiniteNumber($e.headers.get("content-length")),[Rt,Et]=ee&&CU(rt,yg(OU(ee),!0))||[];$e=new r(VU($e.body,PU,Rt,()=>{Et&&Et(),Ee&&Ee()}),Je)}ae=ae||"text";let Ke=await b[qe.findKey(b,ae)||"text"]($e,$);return!ke&&Ee&&Ee(),await new Promise((Je,rt)=>{d2e(Je,rt,{data:Ke,headers:Gl.from($e.headers),status:$e.status,statusText:$e.statusText,config:$,request:oe})})}catch(Ve){throw Ee&&Ee(),Ve&&Ve.name==="TypeError"&&/Load failed|fetch/i.test(Ve.message)?Object.assign(new fi("Network Error",fi.ERR_NETWORK,$,oe),{cause:Ve.cause||Ve}):fi.from(Ve,Ve&&Ve.code,$,oe)}}},iRi=new Map,c2e=l=>{let p=l&&l.env||{};const{fetch:i,Request:r,Response:a}=p,c=[r,a,i];let e=c.length,f=e,h,m,E=iRi;for(;f--;)h=c[f],m=E.get(h),m===void 0&&E.set(h,m=f?new Map:tRi(p)),E=m;return m};c2e();const jx={http:TIi,xhr:WIi,fetch:{get:c2e}};qe.forEach(jx,(l,p)=>{if(l){try{Object.defineProperty(l,"name",{value:p})}catch{}Object.defineProperty(l,"adapterName",{value:p})}});const LU=l=>`- ${l}`,rRi=l=>qe.isFunction(l)||l===null||l===!1;function nRi(l,p){l=qe.isArray(l)?l:[l];const{length:i}=l;let r,a;const c={};for(let e=0;e<i;e++){r=l[e];let f;if(a=r,!rRi(r)&&(a=jx[(f=String(r)).toLowerCase()],a===void 0))throw new fi(`Unknown adapter '${f}'`);if(a&&(qe.isFunction(a)||(a=a.get(p))))break;c[f||"#"+e]=a}if(!a){const e=Object.entries(c).map(([h,m])=>`adapter ${h} `+(m===!1?"is not supported by the environment":"is not available in the build"));let f=i?e.length>1?`since :
|