@elyx-code/project-logic-tree 0.0.6983 → 0.0.6985
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 +2 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.js +666 -196
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -46,7 +46,7 @@ This is likely an incorrect strategy, either the '${this.type}' entity doesn't n
|
|
|
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 S(this.project,x.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,A,_,P;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"}]),(P=(_=(A=this.body)==null?void 0:A.dataType)==null?void 0:_.unsubscribeDependents)==null||P.call(_,[{entity:this,field:"loop-body-data-type-field"}]),this}subscribeToDependencies(){var i,r,a,c,e,f,h,m,E,b,A,_,P;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"}]),(P=(_=(A=this.body)==null?void 0:A.dataType)==null?void 0:_.subscribeDependents)==null||P.call(_,[{entity:this,field:"loop-body-data-type-field"}]),this}increaseVersion(i){var r;if(this.project.diggestedBuiltInBaseEntitiesIds.has(this.id))return this;if(i&&!B(i).isValid())throw new Error(`The shared timestamp '${i}' is not a valid ISO 8601 date string.`);if(i&&B(i).isSame(B(this.createdAt)))return this;if(!((r=this.knownVersions)!=null&&r.has(this.version))&&this.project.initialized)throw new Error(`The current ${this.type} ${this.id} version '${this.version}' is not captured in the 'knownVersions' map. Capture the current version before increasing it to avoid losing data.`);if(!this.activeVersion)throw new Error(`Only active versions can be increased. Entity with id '${this.id}' and version '${this.version}' is not active.`);return this.previousVersion=this.version,this.version=x.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 ai(this,this.project);if(!this.activeVersion)throw new Error(`Only active versions can be captured. Entity of type ${this.type} with id '${this.id}' and version '${this.version}' is not active.`);if(this.version!==i.version)throw new Error(`Captured ${this.type} with id '${this.id}', version '${i.version}' does not match current entity version '${this.version}'.`);return this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,i):new Map().set(this.version,i),this.apply(i),this}snapshot(){const i=new ai(this,this.project);return this.apply(i)}apply(i){const r=this.toMeta();return i.metaSync(r,null),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.writesValues=[...this.writesValues],i.dataType=this.dataType,i.parent=this.parent,i}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,r){var m;const a=[],c=[],e=[],f=[];if(this.version===i&&(r!=null&&r.skipIfSameVersion))return{updated:C(a),added:C(c),removed:C(e),affected:C(f),self:this};if(!this.knownVersions){const E=new Map;for(const[b,A]of this.knownVersions||new Map){if(E.set(b,A),A.activeVersion=!1,A.knownVersions)for(const[_,P]of A.knownVersions)E.set(_,P);A.knownVersions=null}}let h=(m=this.knownVersions)==null?void 0:m.get(i);if(!h){const E=await this.APILoadVersion({},i);if(!E)throw new Error(`Version with id '${i}' for entity with id '${this.id}' not found.`);h=new ai(E,this.project)}return this.metaSync(h.toShallowJSON(),null),this.previousVersion=h.previousVersion,this.version=h.version,this.createdAt=h.createdAt,this.author=h.author,this.deleted=h.deleted,this.inputs=[...h.inputs],this.outputs=[...h.outputs],this.error=h.error,this.successCalls=[...h.successCalls],this.errorCalls=[...h.errorCalls],this.declaration=h.declaration,this.body=h.body,this.calledBySuccess=[...h.calledBySuccess],this.calledByError=[...h.calledByError],this.calledByEntry=[...h.calledByEntry],this.writesValues=[...h.writesValues],this.dataType=h.dataType,this.parent=h.parent,{updated:C(a),added:C(c),removed:C(e),affected:C(f),self:this}}updateWithShallowTransfer(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.UpdateWithShallowTransfer))){if(!this.checkCanEdit(this,r))return J.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=ie(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=ie(i.declaration),c=this.project.get(a);c&&this.setDeclaration(c)}if(i.calledByEntry.forEach(a=>{const c=ie(a),e=this.project.get(c);e&&(this.addEntryCaller(e,r),e.addCall(this,r))}),[...this.calledByEntry].forEach(a=>{i.calledByEntry.find(e=>ie(e)===a.id)||(this.removeCaller(a,r),a.removeCall(this,r))}),i.calledBySuccess.forEach(a=>{const c=ie(a),e=this.project.get(c);e&&(this.addSuccessCaller(e,r),e.addSuccessCall(this,r))}),[...this.calledBySuccess].forEach(a=>{i.calledBySuccess.find(e=>ie(e)===a.id)||(this.removeCaller(a,r),a.removeCall(this,r))}),i.calledByError.forEach(a=>{const c=ie(a),e=this.project.get(c);e&&(this.addErrorCaller(e,r),e.addErrorCall(this,r))}),[...this.calledByError].forEach(a=>{i.calledByError.find(e=>ie(e)===a.id)||(this.removeCaller(a,r),a.removeCall(this,r))}),i.dataType){const a=ie(i.dataType),c=this.project.get(a);c&&this.setDataType(c,r)}else this.setDataType(null,r);return i.outputs.forEach(a=>{const c=ie(a),e=this.project.get(c);e&&(this.addOutput(e,r),e.setParent(this,r))}),[...this.outputs].forEach(a=>{i.outputs.find(e=>ie(e)===a.id)||(this.removeOutput(a,r),a.removeFromParent(r))}),i.inputs.forEach(a=>{const c=ie(a),e=this.project.get(c);e&&(this.addInput(e,r),e.setParent(this,r))}),[...this.inputs].forEach(a=>{i.inputs.find(e=>ie(e)===a.id)||(this.removeInput(a,r),a.removeFromParent(r))}),i.writesValues.forEach(a=>{const c=ie(a),e=this.project.get(c);e&&(this.addValueReader(e,r),e.setValueWriter(this,r))}),[...this.writesValues].forEach(a=>{i.writesValues.find(e=>ie(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 S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.UpdateWithGenerationTarget))){var a,c,e;if(!this.checkCanEdit(this,r))return J.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=ie(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=ie(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=ie(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=>ie(E)===f.id))||(this.removeCaller(f,r),f.removeCall(this,r))}),(c=i.calledBySuccess)==null||c.forEach(f=>{const h=ie(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=>ie(E)===f.id))||(this.removeCaller(f,r),f.removeCall(this,r))}),(e=i.calledByError)==null||e.forEach(f=>{const h=ie(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=>ie(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=ie(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=ie(this.initialData.declaration),f=this.project.get(e);f&&(this.setDeclaration(f),i.push(f))}return this.initialData.calledByEntry.forEach(e=>{const f=ie(e),h=this.project.get(f);h&&this.addEntryCaller(h,null)}),this.initialData.calledBySuccess.forEach(e=>{const f=ie(e),h=this.project.get(f);h&&this.addSuccessCaller(h,null)}),this.initialData.calledByError.forEach(e=>{const f=ie(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 S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.AfterAllChildrenInitialized))){if(!this.checkCanEdit(this,i))return J.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 A,_;return(E.index??((A=E.declaration)==null?void 0:A.index))-(b.index??((_=b.declaration)==null?void 0:_.index))}),this.outputs.sort((E,b)=>{var A,_;return(E.index??((A=E.declaration)==null?void 0:A.index))-(b.index??((_=b.declaration)==null?void 0:_.index))}),this.errorCalls.length&&!this.catchesError&&this.metaSync({catchesError:!0},i),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 S(this.project,x.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 S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RemoveInput))){if(!this.checkCanEdit(this,r))return J.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,H.Affected))),r==null||r.attemptAutoclose(w.RemoveInput,this.id),this}addInput(i,r=this.project.addChangeSet(new S(this.project,x.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,H.Affected),r==null||r.attemptAutoclose(w.AddInput,this.id),this):(J.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 S(this.project,x.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,H.Affected),r==null||r.attemptAutoclose("add-output",this.id),this):(J.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 S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"remove-output"))){if(!this.checkCanEdit(this,r))return J.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,H.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 S(this.project,x.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}--${Me.CannotSuccessCallItself}`,action:w.AddSuccessCaller,owner:this,errorReason:Me.CannotSuccessCallItself,rootAction:((c=r==null?void 0:r.self)==null?void 0:c.id)===this.id&&(r==null?void 0:r.actionName)===w.AddSuccessCaller})),this.calledBySuccess.find(e=>e.id===i.id)||(this.calledBySuccess.push(i),r==null||r.add(this,H.Updated),a&>(this,r)),r==null||r.attemptAutoclose(w.AddSuccessCaller,this.id),this):this}addErrorCaller(i,r=this.project.addChangeSet(new S(this.project,x.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}--${Me.CannotErrorCallItself}`,action:w.AddErrorCaller,owner:this,errorReason:Me.CannotErrorCallItself,rootAction:((c=r==null?void 0:r.self)==null?void 0:c.id)===this.id&&(r==null?void 0:r.actionName)===w.AddErrorCaller})),this.calledByError.find(e=>e.id===i.id)||(this.calledByError.push(i),r==null||r.add(this,H.Updated),a&>(this,r)),r==null||r.attemptAutoclose(w.AddErrorCaller,this.id),this):this}addEntryCaller(i,r=this.project.addChangeSet(new S(this.project,x.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}--${Me.CannotEntryCallItself}`,action:w.AddEntryCaller,owner:this,errorReason:Me.CannotEntryCallItself,rootAction:((c=r==null?void 0:r.self)==null?void 0:c.id)===this.id&&(r==null?void 0:r.actionName)===w.AddEntryCaller})),this.calledByEntry.find(e=>e.id===i.id)||(this.calledByEntry.push(i),r==null||r.add(this,H.Updated),a&>(this,r)),r==null||r.attemptAutoclose(w.AddEntryCaller,this.id),this):this}addErrorCall(i,r=this.project.addChangeSet(new S(this.project,x.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}--${Me.CannotErrorCallItself}`,action:w.AddErrorCaller,owner:this,errorReason:Me.CannotErrorCallItself,rootAction:((c=r==null?void 0:r.self)==null?void 0:c.id)===this.id&&(r==null?void 0:r.actionName)===w.AddErrorCaller})),this.errorCalls.find(e=>e.id===i.id)||(this.errorCalls.push(i),this.catchesError||this.metaSync({catchesError:!0},r),a&>(this,r),r==null||r.add(this,H.Affected)),r==null||r.attemptAutoclose(w.AddErrorCall,this.id),this):this}addSuccessCall(i,r=this.project.addChangeSet(new S(this.project,x.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:Me.CannotSuccessCallItself,rootAction:((c=r==null?void 0:r.self)==null?void 0:c.id)===this.id&&(r==null?void 0:r.actionName)===w.AddSuccessCaller})),this.successCalls.find(e=>e.id===i.id)||(this.successCalls.push(i),a&>(this,r),r==null||r.add(this,H.Affected)),r==null||r.attemptAutoclose(w.AddSuccessCall,this.id),this):this}removeCall(i,r=this.project.addChangeSet(new S(this.project,x.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,H.Affected));const e=this.errorCalls.findIndex(f=>f.id===i.id);return e>-1&&(this.errorCalls.splice(e,1),r==null||r.add(this,H.Affected)),a&>(this,r),r==null||r.attemptAutoclose(w.RemoveCall,this.id),this}removeCaller(i,r=this.project.addChangeSet(new S(this.project,x.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,H.Updated),r==null||r.add(c,H.Affected),!1)),this.calledByError=this.calledByError.filter(c=>c.id!==i.id?!0:(r==null||r.add(this,H.Updated),r==null||r.add(c,H.Affected),!1)),this.calledByEntry=this.calledByEntry.filter(c=>c.id!==i.id?!0:(r==null||r.add(this,H.Updated),r==null||r.add(c,H.Affected),!1)),a&>(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 S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.SetErrorEntity))){if(!this.checkCanEdit(this,r))return J.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,H.Affected)),r==null||r.attemptAutoclose(w.SetErrorEntity,this.id),this}setParent(i,r=this.project.addChangeSet(new S(this.project,x.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,H.Updated))),r==null||r.attemptAutoclose(w.SetParent,this.id),this):this}setDeclaration(i){return this.declaration=i,this}initChildren(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"init-children"))){if(this.initialized||this.startedInitialization)return this;if(this.startedInitialization=!0,this.declaration=Ie(this.initialData.declaration,this.project),this.initialData.dataType){const r=Ie(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=Ie(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=In(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=Ie(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=In(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=Ie(r,this.project);return a.setParent(this,null),a.initChildren(i),a}),this.outputs=this.initialData.outputs.map(r=>{const a=Ie(r,this.project);return a.setParent(this,null),a.initChildren(i),a}),this.initialData.body&&(this.body=Ie(this.initialData.body,this.project),this.body.setParent(this,null),this.body.initChildren(i)),this.initialData.error&&(this.error=Ie(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(){var i;return this.activeVersion=!0,(i=this.knownVersions)==null||i.forEach(r=>{r.version!==this.version&&(r.activeVersion=!1)}),this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"meta-sync"))){const a=nn(this,i,r),c=rn(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,H.Removed):a.deleted===!1&&e.deleted?r==null||r.add(this,H.Added):c&&(r==null||r.add(this,H.Updated)),r==null||r.attemptAutoclose("meta-sync",this.id),this}async APILoad(i=Ze,...r){return await ai.repository.APILoad(this.id,...r),this}async APICreate(i=Ze,...r){return await ai.repository.APICreate(this.toShallowJSON(),...r),this}async APIUpdate(i=Ze,...r){return await ai.repository.APIUpdate(this.toShallowJSON(),...r),this}async APIDelete(i=Ze,...r){return await ai.repository.APIDelete(this.toShallowJSON(),...r),this}async APIClone(i=Ze,...r){return await ai.repository.APIClone(this.id,...r),this}async APILoadVersion(i=Ze,r,...a){return await ai.repository.APILoadVersion(this.id,r,...a)}removeFromParent(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RemoveFromParent))){if(!this.checkCanEdit(this,i))return J.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 S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RemoveEntity))){var h;if(!this.checkCanDelete(this,r))return J.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}--${Me.ActionOwnerEntityNonDeletable}`,action:w.RemoveEntity,owner:this,errorReason:Me.ActionOwnerEntityNonDeletable,rootAction:((h=r==null?void 0:r.self)==null?void 0:h.id)===this.id&&(r==null?void 0:r.actionName)===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:A}=m.entity.onDetachedDependencyRemoved(this,m.field,r);a.push(...E),c.push(...b),e.push(...A)}),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 S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RestoreEntity))){if(!this.checkCanEdit(this,i))return J.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=at){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||un(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:x.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=at){var a;let r=this.id;return(a=i.seenEntityMaps)!=null&&a.has(this.id)&&(r=i.seenEntityMaps.get(this.id)),{id:r+"--"+x.UUID.uuid()+"--ref",type:d.GenericReference,entityId:r,version:this.version,entityType:this.type}}toShallowJSON(i=at){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=at){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=Hx(this),{success:!0}}async validateAsync(i={}){const r=J.YieldTracker.from(i);return this.errors=await dVe(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=J.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 S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.CloneEntity)),r=null,a=null,c=!0){var P,V;const e=Kr(r,this),f=this.toJSON(),h=a||x.UUID.uuid();f.inputs=[];const m=h.split("-id"),E=m[m.length-1||0]||h;f.id=h,f.version=x.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=lr(f,e);r?b.setParent(r,i):b.setParent(this.parent,null),c&&b.subscribe(),b.initChildren(i),i==null||i.add(b,H.Added);const A=(P=this.inputs)==null?void 0:P.map((M,G)=>M.clone(i,b,E+"-input-map-"+G+"-id",c));b.inputs=A;const _=(V=this.outputs)==null?void 0:V.map((M,G)=>M.clone(i,b,E+"-output-map-"+G+"-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||b.captureVersion(),i==null||i.attemptAutoclose(w.CloneEntity,this.id),b}getVariableInstances(){return this.body?fr(this.body).filter(a=>a.type===d.VariableInstance):[]}addReturnStatement(i){return Ut.includes(this.parent.type)&&this.parent.addReturnStatement(i),this}removeReturnStatement(i){return Ut.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||pe(h,this.project)===pe(e,this.project)&&zt(h.dataType,e.dataType))||i.push(e)})}),C(i)}syncTerminationStatements(i=this.project.addChangeSet(new S(this.project,x.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(A=>{var _;return!A.deleted&&!((_=A.declaration)!=null&&_.deleted)}),b=f.filter(A=>!E.find(_=>pe(A,this.project)===pe(_,this.project)&&zt(A.dataType,_.dataType)));b.length&&(r.push(m),i==null||i.add(m,H.Updated)),b.forEach(A=>{const _=A.clone(i,m);i==null||i.add(_,H.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 S(this.project,x.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 S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"sync-body-arguments-declarations"))){var V,M,G,k,K,le;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((ne,de)=>ne.index-de.index),((G=(M=(V=this.body)==null?void 0:V.dataType)==null?void 0:M.entity)==null?void 0:G.id)!==re["primitive-entity"].void.id&&!b.find(de=>{var Y,te,oe,Q,z,se,ye;return de.id!==((Y=this.currentIterationNumberArgumentDeclaration)==null?void 0:Y.id)&&de.id!==((te=this.currentValueArgumentDeclaration)==null?void 0:te.id)&&((Q=(oe=de.dataType)==null?void 0:oe.entity)==null?void 0:Q.id)===((ye=(se=(z=this.body)==null?void 0:z.dataType)==null?void 0:se.entity)==null?void 0:ye.id)})){let de=0;this.currentIterationNumberArgumentDeclaration&&de++,this.currentValueArgumentDeclaration&&de++;const Y=Ha.new(i);Y.name="Aggregate result",Y.description="Aggretated list of all previously outputted values from each iteration",Y.constant=!0,Y.index=de,Y.required=!1,Y.parent=this.body.toReference();const te=Ie(Y,this.project);if(te.hydrateAncestors(),te.addSelfToProject(i),i==null||i.add(te,H.Added),a.push(te),te.setParent(this.body,i),te.initChildren(i),!te.dataType&&((k=this.body)!=null&&k.dataType)){const oe=Tr.new(i);oe.parent=te.toReference();const Q=Ie(oe,this.project);Q.hydrateAncestors(),Q.addSelfToProject(i),a.push(Q),Q.setParent(te,i),Q.initChildren(i),Q.merge((K=this.body)==null?void 0:K.dataType,i),Q.setEntity((le=this.body)==null?void 0:le.dataType.entity,i),i==null||i.add(Q,H.Added),i||Q.captureVersion()}i||te.captureVersion()}const{updated:A,added:_,removed:P}=this.removeExtraBodyArgumentDeclarations(i);return r.push(...A),a.push(..._),c.push(...P),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 S(this.project,x.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 M,G,k;const A=b.outputs.filter(K=>{var le;return!K.deleted&&!((le=K.declaration)!=null&&le.deleted)}),_=A.filter(K=>!K.declaration&&!!K.readsValue),P=A.filter(K=>!K.declaration&&!K.readsValue);let V=(((k=(G=(M=this.body)==null?void 0:M.dataType)==null?void 0:G.entity)==null?void 0:k.properties)||[]).filter(K=>!A.find(le=>{var ne,de;return!le.deleted&&!((ne=le.declaration)!=null&&ne.deleted)&&((de=le.declaration)==null?void 0:de.id)===K.id}));_.forEach(K=>{const le=K.getDataType(i);if(K.readsValue){const ne=pe(K.readsValue,this.project),de=V.find(Y=>pe(Y,this.project)===ne&&zt(Y.dataType,le));if(de){K.setDeclaration(de,i),r.push(K),V=V.filter(Y=>Y!==de);return}}}),P.forEach(K=>{const le=K.getDataType(i),ne=V.find(de=>zt(de.dataType,le));if(ne){K.setDeclaration(ne,i),r.push(K),V=V.filter(de=>de!==ne);return}}),A.forEach(K=>{const le=V.find(ne=>pe(ne,this.project)===pe(K,this.project));K.declaration&&!V.includes(K.declaration)&&le&&(K.setDeclaration(le,i),r.push(K),V=V.filter(ne=>ne!==le))})}),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 S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"sync-outputs-properties"))){var V,M,G,k,K,le,ne,de,Y,te,oe,Q,z,se,ye,ce,he,Ae,Re,Oe,Be,Ge,Se;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};let h=!1;if(!((V=this.body)!=null&&V.dataType)){const Ke=Tr.new(i);Ke.parent=this.body.toReference(),Ke.inferred=!0;const Xe=Ie(Ke,this.project);Xe.hydrateAncestors(),Xe.addSelfToProject(i),i==null||i.add(Xe,H.Added),Xe.initChildren(i),a.push(Xe),h=!0}const m=f.find(Ke=>!!Ke.readsValue);if(m){const Ke=(M=m.readsValue)==null?void 0:M.getDataType(i);Ke&&((k=(G=this.body)==null?void 0:G.dataType)==null||k.merge(Ke,i))}h&&(i||(le=(K=this.body)==null?void 0:K.dataType)==null||le.captureVersion());const E=this.getUniqueInputMaps();let b=(de=(ne=this.body)==null?void 0:ne.dataType)==null?void 0:de.entity;if(E.length&&(!b||b.id===re["primitive-entity"].void.id)){const Ke=qs.new(i);Ke.parent=((Y=this.body)==null?void 0:Y.dataType).toReference(),Ke.name=`${pe(this,this.project)} output definition`,Ke.description=`The definition of the output data type of the loop '${pe(this,this.project)}'`;const Xe=Ie(Ke,this.project);Xe.setParent((te=this.body)==null?void 0:te.dataType,i),Xe.hydrateAncestors(),i==null||i.add(Xe,H.Added),Xe.addSelfToProject(i),Xe.initChildren(i),a.push(Xe),b=Xe,(Q=(oe=this.body)==null?void 0:oe.dataType)==null||Q.metaSync({inferred:!0},i),i||Xe.captureVersion()}const A=(b==null?void 0:b.properties)||[];(se=(z=this.body)==null?void 0:z.dataType)!=null&&se.inferred&&((ce=(ye=this.body)==null?void 0:ye.dataType.entity)==null?void 0:ce.type)===d.DefinitionEntity&&(E.forEach(Ke=>{var zi,Mi,Xi,xr,Ia;const Xe=Ke.getDataType(i);let pt=A.find(Ir=>pe(Ir,this.project)===pe(Ke,this.project)&&zt(Ir.dataType,Ke.dataType));if(!pt){const Ir=qa.new(i);Ir.name=pe(Ke,this.project),Ir.description=`Aggretated list of all previously outputted values from each iteration by the output '${pe(Ke,this.project)}'`,Ir.index=Ke.index,Ir.required=((zi=Ke.declaration)==null?void 0:zi.required)||!1,Ir.parent=((Xi=(Mi=this.body)==null?void 0:Mi.dataType)==null?void 0:Xi.entity).toReference();const Gn=Ie(Ir,this.project);Gn.hydrateAncestors(),Gn.setParent((Ia=(xr=this.body)==null?void 0:xr.dataType)==null?void 0:Ia.entity,i),Gn.addSelfToProject(i),i==null||i.add(Gn,H.Added),Gn.initChildren(i),a.push(Gn),pt=Gn,i||Gn.captureVersion()}pt.index!==Ke.index&&(pt.metaSync({index:Ke.index},i),r.push(pt));let ii=pt.getDataType(i);if(Xe)if(!ii||!zt(ii,Xe)){if(!ii){const Ir=Xe.clone(i,pt);i==null||i.add(Ir,H.Added),Ir.addSelfToProject(i),ii=Ir,a.push(Ir),r.push(pt)}ii.merge(Xe,i),ii.metaSync({isList:!0},i)}else ii.isList||(ii.metaSync({isList:!0},i),r.push(ii));if(!Xe&&!ii){const Ir={id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:x.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:pt.toReference()},Gn=Ie(Ir,this.project);Gn.metaSync({isList:!0},i),Gn.hydrateAncestors(),Gn.setParent(pt,i),Gn.addSelfToProject(i),i==null||i.add(Gn,H.Added),Gn.initChildren(i),a.push(Gn),i||Gn.captureVersion()}}),this.reAttachAllTerminationInputMapsToDeclarations(i)),(Ae=(he=this.body)==null?void 0:he.dataType)!=null&&Ae.inferred&&((Oe=(Re=this.body)==null?void 0:Re.dataType.entity)==null?void 0:Oe.type)===d.DefinitionEntity&&A.filter(Xe=>!E.find(pt=>pe(Xe,this.project)===pe(pt,this.project))).forEach(Xe=>{if(!(i!=null&&i.hasRemoved(Xe.id))&&!Xe.deleted){const{updated:mt,removed:pt}=Xe.remove({ignoreUpstream:!1},i);r.push(...mt),c.push(...pt)}}),f.forEach(Ke=>{Ke.outputs.filter(mt=>{var pt;return!mt.deleted&&!((pt=mt.declaration)!=null&&pt.deleted)}).forEach(mt=>{var ti,ii,zi;if(!(((zi=(ii=(ti=this.body)==null?void 0:ti.dataType)==null?void 0:ii.entity)==null?void 0:zi.properties)||[]).find(Mi=>{var Xi;return((Xi=mt.declaration)==null?void 0:Xi.id)===Mi.id})&&!(i!=null&&i.hasRemoved(mt.id))&&!mt.deleted){const{updated:Mi,removed:Xi}=mt.remove({ignoreUpstream:!1},i);r.push(...Mi),c.push(...Xi)}})});const _=this.getUniqueInputMaps();if(f.every(Ke=>!Ke.readsValue)&&!_.length){const Ke=this.project.getBuiltIn(re["primitive-entity"].void.id);(Ge=(Be=this.body)==null?void 0:Be.dataType)==null||Ge.setEntity(Ke,i),r.push((Se=this.body)==null?void 0:Se.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 S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.SyncOutputs))){var E,b,A;const r=[],a=[],c=[],e=[],f=((A=(b=(E=this.body)==null?void 0:E.dataType)==null?void 0:b.entity)==null?void 0:A.properties)||[],h=this.outputs;return f.forEach(_=>{var M;let V=h.find(G=>{var k,K;return((k=G.declaration)==null?void 0:k.id)===_.id&&zt((K=G.declaration)==null?void 0:K.dataType,_.dataType)});if(V)((M=V.declaration)==null?void 0:M.id)!==_.id&&(V.setDeclaration(_,i),r.push(V));else{const G={dataType:null,id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.OutputMap,index:_.index,declaration:_.toJSON(),writesValues:[],parent:this.toReference()},k=Ie(G,this.project);k.hydrateAncestors(),k.setParent(this,i),k.addSelfToProject(i),i==null||i.add(k,H.Added),k.initChildren(i),a.push(k),i||k.captureVersion(),V=k}V.index!==_.index&&(V.metaSync({index:_.index},i),r.push(V))}),h.filter(_=>!f.find(V=>{var M;return((M=_.declaration)==null?void 0:M.id)===V.id})).forEach(_=>{const{updated:P,removed:V}=_.remove({ignoreUpstream:!1},i);r.push(...P),c.push(...V)}),this.outputs.forEach(_=>{const{updated:P,added:V,removed:M}=_.afterAllChildrenInitialized(i);r.push(...P),a.push(...V),c.push(...M)}),this.outputs.sort((_,P)=>_.index-P.index),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 S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"create-current-iteration-number-argument-declaration"))){const r=[],a=[],c=[],e=[];let h=this.body.inputs.find(A=>{var _;return A.name===ai.CURRENT_ITERATION_NUMBER_ARG_NAME||A.id===((_=this.currentIterationNumberArgumentDeclaration)==null?void 0:_.id)});const m=this.getCurrentIterationNumberBuiltInValueDescriptor();if(!h){const A={id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.ArgumentDeclaration,name:ai.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:[]},_=Ie(A,this.project);_.hydrateAncestors(),_.setParent(this.body,i),_.addSelfToProject(i),i==null||i.add(_,H.Added),_.initChildren(i),a.push(_),i||_.captureVersion(),h=_}!h.index&&h.index!==0&&(h.metaSync({index:0},i),r.push(h)),(!h.implements||!h.implements.find(A=>A.id===m.id))&&(h.addImplementation(m,i),r.push(h));let b=h.getDataType(i);if(!b){const A={id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:x.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()},_=Ie(A,this.project);_.hydrateAncestors(),_.setParent(h,i),_.addSelfToProject(i),i==null||i.add(_,H.Added),_.initChildren(i),a.push(_),i||_.captureVersion(),b=_}if(!b.entity||b.entity.type!==d.PrimitiveEntity||b.entity.name!==fe.Number||b.entity.id!==re["primitive-entity"].number.id){const A=this.project.getBuiltIn(re["primitive-entity"].number.id);b.setEntity(A,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 S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"remove-extra-body-argument-declarations"))){const r=[],a=[],c=[],e=[];return this.body.inputs.filter(m=>{var E,b,A,_,P,V,M,G;return m===this.currentIterationNumberArgumentDeclaration||m===this.currentValueArgumentDeclaration?!1:((A=(b=(E=this.body)==null?void 0:E.dataType)==null?void 0:b.entity)==null?void 0:A.id)===re["primitive-entity"].void.id?!0:((P=(_=m.dataType)==null?void 0:_.entity)==null?void 0:P.id)!==((G=(M=(V=this.body)==null?void 0:V.dataType)==null?void 0:M.entity)==null?void 0:G.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 S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"create-current-value-input-based-on-input-map"))){var E,b,A,_,P,V,M,G,k;const r=[],a=[],c=[],e=[];switch(this.declaration.id){case dt.List:{const K=this.body.inputs.find(de=>!!de.implements.find(Y=>Y.id===re[d.Loop][dt.List].body.inputs.currentValue.id)),le=this.inputs.find(de=>{var Y;return((Y=de.declaration)==null?void 0:Y.id)===re[d.Loop][dt.List].inputs.list.id});if(!le)break;const ne=this.getCurrentValueBuiltInValueDescriptor();if(K){ne&&!K.implements.find(oe=>oe.id===ne.id)&&(K.addImplementation(ne,i),r.push(K));let Y=K.getDataType(i);if(!Y){const oe={id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:x.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()},Q=Ie(oe,this.project);Q.hydrateAncestors(),Q.setParent(this.currentValueArgumentDeclaration,i),Q.addSelfToProject(i),i==null||i.add(Q,H.Added),Q.initChildren(i),a.push(Q),i||Q.captureVersion(),Y=Q}const te=le.getDataType(i);Y.merge(te,i),Y.metaSync({isList:!1},i)}else{const de={id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.ArgumentDeclaration,name:ai.CURRENT_VALUE_ARG_NAME,codeName:null,description:null,defaultValue:null,index:this.body.inputs.length,constant:!0,required:!0,implements:[ne],writesValues:[],dataType:null,parent:this.body.toReference()},Y=Ie(de,this.project);Y.hydrateAncestors(),Y.setParent(this.body,i),Y.addSelfToProject(i),i==null||i.add(Y,H.Added),Y.initChildren(i),ne&&!Y.implements.find(te=>te.id===ne.id)&&(Y.addImplementation(ne,i),r.push(Y)),a.push(Y),i||Y.captureVersion()}break}case dt.ManualFlow:break;case dt.Counted:break;case dt.ObjectKeys:{const K=this.body.inputs.find(de=>!!de.implements.find(Y=>Y.id===re[d.Loop][dt.ObjectKeys].body.inputs.currentValue.id));if(!this.inputs.find(de=>{var Y;return((Y=de.declaration)==null?void 0:Y.id)===re[d.Loop][dt.ObjectKeys].inputs.object.id}))break;const ne=this.getCurrentValueBuiltInValueDescriptor();if(K){ne&&!K.implements.find(te=>te.id===ne.id)&&(K.addImplementation(ne),r.push(K));let Y=K.getDataType(i);if(Y){const te=this.project.getBuiltIn(re["primitive-entity"].string.id);((A=Y.entity)==null?void 0:A.id)!==te.id&&(Y.setEntity(te,i),r.push(Y))}else{const te={id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:x.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()},oe=Ie(te,this.project);oe.hydrateAncestors(),oe.setParent(this.currentValueArgumentDeclaration,i),oe.addSelfToProject(i),i==null||i.add(oe,H.Added),oe.initChildren(i),i||oe.captureVersion(),Y=oe}}else{const de={id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.ArgumentDeclaration,name:ai.CURRENT_VALUE_ARG_NAME,codeName:null,description:null,defaultValue:null,index:this.body.inputs.length,constant:!0,required:!0,implements:[ne],writesValues:[],dataType:null,parent:this.body.toReference()},Y=Ie(de,this.project);Y.hydrateAncestors(),Y.setParent(this.body,i),Y.addSelfToProject(i),i==null||i.add(Y,H.Added),Y.initChildren(i),ne&&!Y.implements.find(te=>te.id===ne.id)&&(Y.addImplementation(ne,i),r.push(Y)),a.push(Y),i||Y.captureVersion()}break}case dt.ObjectValues:{const K=this.body.inputs.find(de=>!!de.implements.find(Y=>Y.id===re[d.Loop][dt.ObjectValues].body.inputs.currentValue.id)),le=this.inputs.find(de=>{var Y;return((Y=de.declaration)==null?void 0:Y.id)===re[d.Loop][dt.ObjectValues].inputs.object.id});if(!le)break;const ne=this.getCurrentValueBuiltInValueDescriptor();if(K){ne&&!K.implements.find(te=>te.id===ne.id)&&(K.addImplementation(ne,i),r.push(K));let Y=K.getDataType(i);if(Y){const te=le.getDataType(i),oe=((V=te==null?void 0:te.entity)==null?void 0:V.properties)||[];(M=Y.orChildrenGroup)==null||M.forEach(Q=>{const{updated:z,removed:se}=Q.remove({ignoreUpstream:!1},i);r.push(...z),c.push(...se)}),oe.forEach(Q=>{if(!Q.getDataType(i)){const se={id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:x.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:Ye.OrDataTypeGroup,parent:Y.toReference()},ye=Ie(se,this.project);ye.hydrateAncestors(),ye.setParent(Y,i),ye.addSelfToProject(i),i==null||i.add(ye,H.Added),ye.initChildren(i),i||ye.captureVersion(),a.push(ye)}})}else{const te={id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:x.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()},oe=Ie(te,this.project);oe.hydrateAncestors(),oe.setParent(this.currentValueArgumentDeclaration,i),oe.addSelfToProject(i),i==null||i.add(oe,H.Added),oe.initChildren(i),i||oe.captureVersion(),Y=oe;const Q=le.getDataType(i);(((P=Q==null?void 0:Q.entity)==null?void 0:P.properties)||[]).forEach(se=>{if(!se.getDataType(i)){const ce={id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:x.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:Ye.OrDataTypeGroup,parent:oe.toReference()},he=Ie(ce,this.project);he.hydrateAncestors(),he.setParent(oe,i),he.addSelfToProject(i),i==null||i.add(he,H.Added),he.initChildren(i),i||he.captureVersion(),a.push(he)}})}}else{const de={id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.ArgumentDeclaration,name:ai.CURRENT_VALUE_ARG_NAME,codeName:null,description:null,constant:!0,defaultValue:null,index:this.body.inputs.length,required:!0,implements:[ne],writesValues:[],dataType:null,parent:this.body.toReference()},Y=Ie(de,this.project);Y.hydrateAncestors(),Y.setParent(this.body,i),Y.addSelfToProject(i),i==null||i.add(Y,H.Added),Y.initChildren(i),ne&&!Y.implements.find(te=>te.id===ne.id)&&(Y.addImplementation(ne,i),r.push(Y)),a.push(Y),i||Y.captureVersion()}break}case dt.String:{const K=this.body.inputs.find(de=>!!de.implements.find(Y=>Y.id===re[d.Loop][dt.String].body.inputs.currentValue.id));if(!this.inputs.find(de=>{var Y;return((Y=de.declaration)==null?void 0:Y.id)===re[d.Loop][dt.String].inputs.string.id}))break;const ne=this.getCurrentValueBuiltInValueDescriptor();if(K){ne&&!K.implements.find(te=>te.id===ne.id)&&(K.addImplementation(ne,i),r.push(K));let Y=K.getDataType(i);if(Y){const te=this.project.getBuiltIn(re["primitive-entity"].string.id);((k=Y.entity)==null?void 0:k.id)!==te.id&&(Y.setEntity(te,i),r.push(Y))}else{const te={id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:x.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:(G=this.currentValueArgumentDeclaration)==null?void 0:G.toReference()},oe=Ie(te,this.project);oe.hydrateAncestors(),oe.setParent(this.currentValueArgumentDeclaration,i),oe.addSelfToProject(i),i==null||i.add(oe,H.Added),oe.initChildren(i),i||oe.captureVersion(),a.push(oe),Y=oe}}else{const de={id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.ArgumentDeclaration,name:ai.CURRENT_VALUE_ARG_NAME,codeName:null,description:null,index:this.body.inputs.length,required:!0,constant:!0,defaultValue:null,implements:[ne],writesValues:[],dataType:null,parent:this.body.toReference()},Y=Ie(de,this.project);Y.hydrateAncestors(),Y.setParent(this.body,i),Y.addSelfToProject(i),i==null||i.add(Y,H.Added),Y.initChildren(i),ne&&!Y.implements.find(te=>te.id===ne.id)&&(Y.addImplementation(ne,i),r.push(Y)),a.push(Y),i||Y.captureVersion()}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 S(this.project,x.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:A}=this.createCurrentValueInputBasedOnInputMap(i);return r.push(...E),a.push(...b),c.push(...A),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 S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"sync-input-maps"))){const r=[],a=[],c=[],e=[];switch(this.declaration.id){case dt.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:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:x.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=Ie(E,this.project);b.hydrateAncestors(),b.setParent(this,i),b.addSelfToProject(i),i==null||i.add(b,H.Added),b.initChildren(i),i||b.captureVersion(),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 dt.ManualFlow:{this.inputs.forEach(f=>{f.remove({ignoreUpstream:!1},i),c.push(f)});break}case dt.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:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:x.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=Ie(E,this.project);b.hydrateAncestors(),b.setParent(this,i),b.addSelfToProject(i),i==null||i.add(b,H.Added),b.initChildren(i),i||b.captureVersion(),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 dt.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:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:x.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=Ie(E,this.project);b.hydrateAncestors(),b.setParent(this,i),b.addSelfToProject(i),i==null||i.add(b,H.Added),b.initChildren(i),i||b.captureVersion(),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 dt.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:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:x.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=Ie(E,this.project);b.hydrateAncestors(),b.setParent(this,i),b.addSelfToProject(i),i==null||i.add(b,H.Added),b.initChildren(i),i||b.captureVersion(),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 dt.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:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:x.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=Ie(E,this.project);b.hydrateAncestors(),b.setParent(this,i),b.addSelfToProject(i),i==null||i.add(b,H.Added),b.initChildren(i),i||b.captureVersion(),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 this.inputs.forEach(f=>{const{updated:h,added:m,removed:E}=f.afterAllChildrenInitialized(i);r.push(...h),a.push(...m),c.push(...E)}),this.inputs.sort((f,h)=>f.index-h.index),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 dt.List:return re[d.Loop]["list-loop"].inputs.list.id;case dt.ObjectKeys:return re[d.Loop]["object-keys-loop"].inputs.object.id;case dt.ObjectValues:return re[d.Loop]["object-values-loop"].inputs.object.id;case dt.String:return re[d.Loop]["string-loop"].inputs.string.id;case dt.Counted:return re[d.Loop]["counted-loop"].inputs.number.id;default:return null}}getCurrentValueBuiltInValueDescriptor(){var r;if(this.declaration.id===dt.ManualFlow||this.declaration.id===dt.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 S(this.project,x.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=hd.new(i);E.implements=h.toJSON(),E.name=h.name,E.parent=this.toReference();const b=Ie(E,this.project);b.hydrateAncestors(),b.setParent(this,i),b.addSelfToProject(i),i==null||i.add(b,H.Added),b.initChildren(i),i||b.captureVersion(),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,A,_,P,V,M,G,k,K,le,ne,de,Y,te,oe,Q,z,se,ye,ce,he,Ae,Re,Oe,Be;if((!this.body||!((b=this.body)!=null&&b.dataType)||!((A=this.body)!=null&&A.dataType.entity))&&this.id)return!1;const i=[dt.List,dt.ObjectKeys,dt.ObjectValues,dt.String],r=this.body.inputs.find(Ge=>Ge.implements.find(Se=>Se.id===re[d.Loop][this.declaration.id].body.inputs.iterationNumber.id))||null,a=this.body.inputs.find(Ge=>Ge.implements.find(Se=>{var Ke;return Se.id===((Ke=re[d.Loop][this.declaration.id].body.inputs.currentValue)==null?void 0:Ke.id)}))||null;if(!r||i.includes(this.declaration.id)&&!a)return!1;if(this.declaration.id===dt.List){const Ge=this.inputs.find(Se=>{var Ke;return((Ke=Se.declaration)==null?void 0:Ke.id)===re[d.Loop]["list-loop"].inputs.list.id});if(Ge&&a){const Se=Ge.getDataType(null),Ke=a.getDataType(null),Xe=zt(Se,Ke,{ignoreTopListDif:!0});if(!Xe.compatible||!Xe.exact||(Ke==null?void 0:Ke.isList)!==!1)return!1}}const c=[...this.breakStatements,...this.continueStatements];if(((V=(P=(_=this.body)==null?void 0:_.dataType)==null?void 0:P.entity)==null?void 0:V.id)!==re["primitive-entity"].void.id){if(!this.body.inputs.find(Se=>{var Ke,Xe,mt,pt,ti;return((Xe=(Ke=Se.dataType)==null?void 0:Ke.entity)==null?void 0:Xe.id)===((ti=(pt=(mt=this.body)==null?void 0:mt.dataType)==null?void 0:pt.entity)==null?void 0:ti.id)})||((k=(G=(M=this.body)==null?void 0:M.dataType)==null?void 0:G.entity)==null?void 0:k.type)===d.DefinitionEntity&&(!((le=(K=this.body)==null?void 0:K.dataType)==null?void 0:le.entity).properties.every(Xe=>this.outputs.find(mt=>{var pt;return((pt=mt.declaration)==null?void 0:pt.id)===Xe.id}))||!c.every(Xe=>{var ii,zi;const mt=Xe.outputs.filter(Mi=>!Mi.deleted),pt=((zi=(ii=this.body)==null?void 0:ii.dataType)==null?void 0:zi.entity).properties.every(Mi=>mt.find(Xi=>{var xr;return((xr=Xi.declaration)==null?void 0:xr.id)===Mi.id})),ti=mt.every(Mi=>{var Xi,xr;return((xr=(Xi=this.body)==null?void 0:Xi.dataType)==null?void 0:xr.entity).properties.find(Ia=>{var Ir;return Ia.id===((Ir=Mi.declaration)==null?void 0:Ir.id)})});return pt&&ti})))return!1}else if(this.body.inputs.find(Ke=>{var Xe,mt,pt,ti,ii;return((mt=(Xe=Ke.dataType)==null?void 0:Xe.entity)==null?void 0:mt.id)===((ii=(ti=(pt=this.body)==null?void 0:pt.dataType)==null?void 0:ti.entity)==null?void 0:ii.id)})||this.outputs.length>0||![...this.breakStatements,...this.continueStatements].every(Ke=>Ke.outputs.filter(Xe=>!Xe.deleted).length===0))return!1;if([dt.List,dt.Counted,dt.ObjectKeys,dt.ObjectValues,dt.String].includes(this.declaration.id)){if(this.inputs.length!==1)return!1;const Ge=this.inputs[0],Se=this.getValueInputMapDeclarationId();if(((ne=Ge.declaration)==null?void 0:ne.id)!==Se)return!1}else if(this.inputs.length>0)return!1;if((Y=(de=this.body)==null?void 0:de.dataType)!=null&&Y.inferred){const Ge=this.getUniqueInputMaps();if(c.every(mt=>!mt.readsValue)&&!Ge.length&&((Q=(oe=(te=this.body)==null?void 0:te.dataType)==null?void 0:oe.entity)==null?void 0:Q.id)!==re["primitive-entity"].void.id)return!1;const Ke=c.find(mt=>mt.readsValue),Xe=(ye=(se=(z=Ke==null?void 0:Ke.readsValue)==null?void 0:z.getDataType(null))==null?void 0:se.entity)==null?void 0:ye.id;if(Xe&&Xe!==((Ae=(he=(ce=this.body)==null?void 0:ce.dataType)==null?void 0:he.entity)==null?void 0:Ae.id))return!1}const f=((Be=(Oe=(Re=this.body)==null?void 0:Re.dataType)==null?void 0:Oe.entity)==null?void 0:Be.properties)||[],h=this.outputs,m=f.every(Ge=>h.find(Se=>{var Ke;return((Ke=Se.declaration)==null?void 0:Ke.id)===Ge.id})),E=h.every(Ge=>f.find(Se=>{var Ke;return Se.id===((Ke=Ge.declaration)==null?void 0:Ke.id)}));return!(!m||!E)}syncFromDataType(i=this.project.addChangeSet(new S(this.project,x.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:A}=this.syncBodyArgumentsDeclarations(i);r.push(...E),a.push(...b),c.push(...A);const{updated:_,added:P,removed:V}=this.syncBodyInputIndexes(i);r.push(..._),a.push(...P),c.push(...V);const{updated:M,added:G,removed:k}=this.syncOutputMaps(i);return r.push(...M),a.push(...G),c.push(...k),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 S(this.project,x.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:A}=this.syncInputMaps(i);r.push(...E),a.push(...b),c.push(...A);const{updated:_,added:P,removed:V}=this.syncTerminationStatements(i);r.push(..._),a.push(...P),c.push(...V);const{updated:M,added:G,removed:k}=this.syncFromDataType(i);return r.push(...M),a.push(...G),c.push(...k),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 S(this.project,x.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:Me.CannotValueWriteItself,rootAction:((e=r==null?void 0:r.self)==null?void 0:e.id)===this.id&&(r==null?void 0:r.actionName)===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:Me.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,H.Affected),this)}setDataType(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.SetDataType))){if(!this.checkCanEdit(this,r))return J.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,H.Affected)),r==null||r.attemptAutoclose(w.SetDataType,this.id),this}removeValueReader(i,r=this.project.addChangeSet(new S(this.project,x.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,H.Affected),this):(r==null||r.attemptAutoclose(w.RemoveValueReader,this.id),this):this}removeDataType(i=this.project.addChangeSet(new S(this.project,x.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,H.Affected),this.dataType=null),i==null||i.attemptAutoclose(w.RemoveDataType,this.id),this):(J.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 S(this.project,x.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(ai,"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(ai,"type",d.Loop),R(ai,"USER_MANAGED_PARENT_TYPES",[...wr,d.Project]),R(ai,"PARENT_TYPES",[...er.USER_MANAGED_PARENT_TYPES]),R(ai,"CURRENT_ITERATION_NUMBER_ARG_NAME","Current iteration number"),R(ai,"CURRENT_VALUE_ARG_NAME","Current value"),R(ai,"MUTABLE_BASE_PROPERTIES",["catchesError"]),R(ai,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),R(ai,"BASE_PROPERTIES",[...ai.MUTABLE_BASE_PROPERTIES,...ai.INMUTABLE_BASE_PROPERTIES]),R(ai,"MUTABLE_META_PROPERTIES",[...ai.MUTABLE_BASE_PROPERTIES,"x","y"]),R(ai,"INMUTABLE_META_PROPERTIES",[...ai.INMUTABLE_BASE_PROPERTIES]),R(ai,"META_PROPERTIES",[...ai.MUTABLE_META_PROPERTIES,...ai.INMUTABLE_META_PROPERTIES]),R(ai,"MUTABLE_UPSTREAM_PROPERTIES",["calledBySuccess","calledByError","calledByEntry"]),R(ai,"INMUTABLE_UPSTREAM_PROPERTIES",["parent","declaration","dataType"]),R(ai,"UPSTREAM_PROPERTIES",[...ai.MUTABLE_UPSTREAM_PROPERTIES,...ai.INMUTABLE_UPSTREAM_PROPERTIES]),R(ai,"MUTABLE_DOWNSTREAM_PROPERTIES",["body","inputs","outputs","successCalls","errorCalls","error","breakStatements","continueStatements"]),R(ai,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),R(ai,"DOWNSTREAM_PROPERTIES",[...ai.MUTABLE_DOWNSTREAM_PROPERTIES,...ai.INMUTABLE_DOWNSTREAM_PROPERTIES]),R(ai,"PROPERTIES",[...ai.META_PROPERTIES,...ai.UPSTREAM_PROPERTIES,...ai.DOWNSTREAM_PROPERTIES]);let xp=ai;async function fVe(s,p={}){const i=J.YieldTracker.from(p),r=Aa(s),a=ga(s),c=hVe(s),e=[...r,...a,...c],f=qt(s.errors,e);await i.tick();for(const h of s.inputs)await h.validateAsync({tracker:i});for(const h of s.andChildrenGroup||[])await h.validateAsync({tracker:i});for(const h of s.orChildrenGroup||[])await h.validateAsync({tracker:i});return f}function yVe(s){s.inputs.forEach(c=>c.validate());const p=Aa(s),i=ga(s),r=hVe(s),a=[...p,...i,...r];return(s.andChildrenGroup||[]).forEach(c=>c.validate()),(s.orChildrenGroup||[]).forEach(c=>c.validate()),qt(s.errors,a)}function hVe(s){var i,r;const p=[];if(((i=s.declaration)==null?void 0:i.id)!==re.condition["condition-group-and"].id&&((r=s.declaration)==null?void 0:r.id)!==re.condition["condition-group-or"].id)return p;if(!s.andChildrenGroup&&!s.orChildrenGroup){const a=Rt({id:`${s.id}--${be.EmptyGroupCondition}`,message:`Condition "${pe(s,s.project)}" with id "${s.id}" does not have any nested conditions. So it doesn't do anything.`,severity:ve.Error,code:be.EmptyGroupCondition,entity:s});p.push(a.error)}return qt(s.errors,p)}const Wgi=Object.freeze(Object.defineProperty({__proto__:null,validate:yVe,validateAsync:fVe},Symbol.toStringTag,{value:"Module"}));var mVe=(s=>(s.Parent="parent",s))(mVe||{});const ji=class ji extends pn{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:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:(i==null?void 0:i.author)||x.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,a){var P,V;const c=a===void 0?r.addChangeSet(new S(r,x.sessionAuthor,B().toISOString(),r,!0,w.CreateFromGenerationTarget)):a;let e=r;if(i.parent){const M=ie(i.parent);e=r.get(M)}const f=(i.calledByEntry||[]).map(M=>{const G=ie(M);return r.get(G)}),h=(i.calledBySuccess||[]).map(M=>{const G=ie(M);return r.get(G)}),m=(i.calledByError||[]).map(M=>{const G=ie(M);return r.get(G)});let E;if(i.declaration){const M=ie(i.declaration);E=r.get(M)}let b=null;e&&e.type===d.Condition&&(((P=e.declaration)==null?void 0:P.id)===Vr.Or?b=(e.orChildrenGroup||[]).length:((V=e.declaration)==null?void 0:V.id)===Vr.And&&(b=(e.andChildrenGroup||[]).length));const A={id:i.id,version:x.UUID.uuid(),createdAt:(c==null?void 0:c.timestamp)||B().toISOString(),author:(c==null?void 0:c.author)||x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.Condition,index:b,declaration:E.toJSON(),andChildrenGroup:[],orChildrenGroup:[],calledByEntry:f.map(M=>M.toReference()),calledBySuccess:h.map(M=>M.toReference()),calledByError:m.map(M=>M.toReference()),errorCalls:[],successCalls:[],inputs:[],x:0,y:0,parent:e.toReference()},_=Ie(A,r);return _.hydrateAncestors(),_.setParent(e,c),_.addSelfToProject(c),c==null||c.add(_,H.Added),_.initChildren(c),c||_.captureVersion(),_}static validateGenerationTarget(i,r){let a=JSON.parse(JSON.stringify(i));const c=[],e=[],f=Mn(a,{parent:{list:!1,types:[...wr,d.Project],optional:!0}},r);c.push(...f.explanations),a=f.modifiedData;const h=tn(a);if(e.push(...f.errors,...h.errors),c.push(...h.explanations),!i.declaration)e.push(new we({id:`${i.id}--${Ce.InvalidObjectStructure}`,code:Ce.InvalidObjectStructure,severity:ve.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:Qi.AllConditionActionDescriptors,message:Qg(r)});else if(!r.get(i.declaration))e.push(new we({id:`${i.id}--${Te.ReferencedEntityNotFound}`,code:Te.ReferencedEntityNotFound,severity:ve.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:Qi.AllConditionActionDescriptors,message:Qg(r)});else{const E=Sje(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 we({id:`${this.id}--${Te.InvalidParentUpdate}`,code:Te.InvalidParentUpdate,severity:ve.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
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 S(this.project,x.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){var r;if(this.project.diggestedBuiltInBaseEntitiesIds.has(this.id))return this;if(i&&!B(i).isValid())throw new Error(`The shared timestamp '${i}' is not a valid ISO 8601 date string.`);if(i&&B(i).isSame(B(this.createdAt)))return this;if(!((r=this.knownVersions)!=null&&r.has(this.version))&&this.project.initialized)throw new Error(`The current ${this.type} ${this.id} version '${this.version}' is not captured in the 'knownVersions' map. Capture the current version before increasing it to avoid losing data.`);if(!this.activeVersion)throw new Error(`Only active versions can be increased. Entity with id '${this.id}' and version '${this.version}' is not active.`);return this.previousVersion=this.version,this.version=x.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 ji(this,this.project);if(!this.activeVersion)throw new Error(`Only active versions can be captured. Entity of type ${this.type} with id '${this.id}' and version '${this.version}' is not active.`);if(this.version!==i.version)throw new Error(`Captured ${this.type} with id '${this.id}', version '${i.version}' does not match current entity version '${this.version}'.`);return this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,i):new Map().set(this.version,i),this.apply(i),this}snapshot(){const i=new ji(this,this.project);return this.apply(i)}apply(i){const r=this.toMeta();return i.metaSync(r,null),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,i}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,r){var m;const a=[],c=[],e=[],f=[];if(this.version===i&&(r!=null&&r.skipIfSameVersion))return{updated:C(a),added:C(c),removed:C(e),affected:C(f),self:this};if(!this.knownVersions){const E=new Map;for(const[b,A]of this.knownVersions||new Map){if(E.set(b,A),A.activeVersion=!1,A.knownVersions)for(const[_,P]of A.knownVersions)E.set(_,P);A.knownVersions=null}}let h=(m=this.knownVersions)==null?void 0:m.get(i);if(!h){const E=await this.APILoadVersion({},i);if(!E)throw new Error(`Version with id '${i}' for entity with id '${this.id}' not found.`);h=new ji(E,this.project)}return this.metaSync(h.toShallowJSON(),null),this.previousVersion=h.previousVersion,this.version=h.version,this.createdAt=h.createdAt,this.author=h.author,this.deleted=h.deleted,this.inputs=[...h.inputs],this.declaration=h.declaration,this.andChildrenGroup=h.andChildrenGroup?[...h.andChildrenGroup]:null,this.orChildrenGroup=h.orChildrenGroup?[...h.orChildrenGroup]:null,this.successCalls=[...h.successCalls],this.errorCalls=[...h.errorCalls],this.calledBySuccess=[...h.calledBySuccess],this.calledByError=[...h.calledByError],this.calledByEntry=[...h.calledByEntry],this.parent=h.parent,{updated:C(a),added:C(c),removed:C(e),affected:C(f),self:this}}updateWithShallowTransfer(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.UpdateWithShallowTransfer))){var a,c;if(!this.checkCanEdit(this,r))return J.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=ie(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=ie(i.declaration),f=this.project.get(e);f&&this.setDeclaration(f)}return(a=i.andChildrenGroup)==null||a.forEach(e=>{const f=ie(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=>ie(m)===e.id))||(this.removeChildGroup(e,r),e.removeFromParent(r))}),(c=i.orChildrenGroup)==null||c.forEach(e=>{const f=ie(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=>ie(m)===e.id))||(this.removeChildGroup(e,r),e.removeFromParent(r))}),i.calledByEntry.forEach(e=>{const f=ie(e),h=this.project.get(f);h&&(this.addEntryCaller(h,r),h.addCall(this,r))}),[...this.calledByEntry].forEach(e=>{i.calledByEntry.find(h=>ie(h)===e.id)||(this.removeCaller(e,r),e.removeCall(this,r))}),i.calledBySuccess.forEach(e=>{const f=ie(e),h=this.project.get(f);h&&(this.addSuccessCaller(h,r),h.addSuccessCall(this,r))}),[...this.calledBySuccess].forEach(e=>{i.calledBySuccess.find(h=>ie(h)===e.id)||(this.removeCaller(e,r),e.removeCall(this,r))}),i.calledByError.forEach(e=>{const f=ie(e),h=this.project.get(f);h&&(this.addErrorCaller(h,r),h.addErrorCall(this,r))}),[...this.calledByError].forEach(e=>{i.calledByError.find(h=>ie(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 S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.UpdateWithGenerationTarget))){var a,c,e;if(!this.checkCanEdit(this,r))return J.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=ie(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=ie(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=ie(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=>ie(E)===f.id))||(this.removeCaller(f,r),f.removeCall(this,r))}),(c=i.calledBySuccess)==null||c.forEach(f=>{const h=ie(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=>ie(E)===f.id))||(this.removeCaller(f,r),f.removeCall(this,r))}),(e=i.calledByError)==null||e.forEach(f=>{const h=ie(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=>ie(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=ie(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=ie(this.initialData.declaration),f=this.project.get(e);f&&(this.setDeclaration(f),i.push(f))}return this.initialData.calledByEntry.forEach(e=>{const f=ie(e),h=this.project.get(f);h&&this.addEntryCaller(h,null)}),this.initialData.calledBySuccess.forEach(e=>{const f=ie(e),h=this.project.get(f);h&&this.addSuccessCaller(h,null)}),this.initialData.calledByError.forEach(e=>{const f=ie(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 S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.AfterAllChildrenInitialized))){var E,b;if(!this.checkCanEdit(this,i))return J.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 A=this.index||0;const _=(this.parent.declaration.id===Vr.And?this.parent.andChildrenGroup||[]:this.parent.orChildrenGroup||[]).filter(V=>!V.deleted&&V.id!==this.id);_.length&&(A>_.length+1?A=_.length:A<0&&(A=0)),_.find(V=>(V.index||0)===A&&!V.deleted)&&_.filter(V=>(V.index||0)>=A&&!V.deleted).forEach(V=>{V.metaSync({index:(V.index||0)+1},i),i==null||i.add(V,H.Updated),r.push(V)}),this.metaSync({index:A},i)}(E=this.andChildrenGroup)!=null&&E.length&&this.andChildrenGroup.sort((A,_)=>(A.index||0)-(_.index||0)),(b=this.orChildrenGroup)!=null&&b.length&&this.orChildrenGroup.sort((A,_)=>(A.index||0)-(_.index||0)),this.inputs.sort((A,_)=>{var P,V;return(A.index??((P=A.declaration)==null?void 0:P.index))-(_.index??((V=_.declaration)==null?void 0:V.index))});const{updated:f,added:h,removed:m}=this.syncInputs(i);return r.push(...f),a.push(...h),c.push(...m),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 S(this.project,x.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===Vr.And?this.parent.addToAndGroup(this,i):this.parent.declaration.id===Vr.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 S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RemoveInput))){if(!this.checkCanEdit(this,r))return J.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,H.Affected))),r==null||r.attemptAutoclose(w.RemoveInput,this.id),this}addInput(i,r=this.project.addChangeSet(new S(this.project,x.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,H.Affected),r==null||r.attemptAutoclose(w.AddInput,this.id),this):(J.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 S(this.project,x.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}--${Me.CannotSuccessCallItself}`,action:w.AddSuccessCaller,owner:this,errorReason:Me.CannotSuccessCallItself,rootAction:((c=r==null?void 0:r.self)==null?void 0:c.id)===this.id&&(r==null?void 0:r.actionName)===w.AddSuccessCaller})),this.calledBySuccess.find(e=>e.id===i.id)||(this.calledBySuccess.push(i),r==null||r.add(this,H.Updated),a&>(this,r)),r==null||r.attemptAutoclose(w.AddSuccessCaller,this.id),this):this}addErrorCaller(i,r=this.project.addChangeSet(new S(this.project,x.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}--${Me.CannotErrorCallItself}`,action:w.AddErrorCaller,owner:this,errorReason:Me.CannotErrorCallItself,rootAction:((c=r==null?void 0:r.self)==null?void 0:c.id)===this.id&&(r==null?void 0:r.actionName)===w.AddErrorCaller})),this.calledByError.find(e=>e.id===i.id)||(this.calledByError.push(i),r==null||r.add(this,H.Updated),a&>(this,r)),r==null||r.attemptAutoclose(w.AddErrorCaller,this.id),this):this}addEntryCaller(i,r=this.project.addChangeSet(new S(this.project,x.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}--${Me.CannotEntryCallItself}`,action:w.AddEntryCaller,owner:this,errorReason:Me.CannotEntryCallItself,rootAction:((c=r==null?void 0:r.self)==null?void 0:c.id)===this.id&&(r==null?void 0:r.actionName)===w.AddEntryCaller})),this.calledByEntry.find(e=>e.id===i.id)||(this.calledByEntry.push(i),r==null||r.add(this,H.Updated),a&>(this,r)),r==null||r.attemptAutoclose(w.AddEntryCaller,this.id),this):this}addErrorCall(i,r=this.project.addChangeSet(new S(this.project,x.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}--${Me.CannotErrorCallItself}`,action:w.AddErrorCaller,owner:this,errorReason:Me.CannotErrorCallItself,rootAction:((c=r==null?void 0:r.self)==null?void 0:c.id)===this.id&&(r==null?void 0:r.actionName)===w.AddErrorCaller})),this.errorCalls.find(e=>e.id===i.id)||(this.errorCalls.push(i),a&>(this,r),r==null||r.add(this,H.Affected)),r==null||r.attemptAutoclose(w.AddErrorCall,this.id),this):this}addSuccessCall(i,r=this.project.addChangeSet(new S(this.project,x.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:Me.CannotSuccessCallItself,rootAction:((c=r==null?void 0:r.self)==null?void 0:c.id)===this.id&&(r==null?void 0:r.actionName)===w.AddSuccessCaller})),this.successCalls.find(e=>e.id===i.id)||(this.successCalls.push(i),a&>(this,r),r==null||r.add(this,H.Affected)),r==null||r.attemptAutoclose(w.AddSuccessCall,this.id),this):this}removeCall(i,r=this.project.addChangeSet(new S(this.project,x.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,H.Affected));const e=this.errorCalls.findIndex(f=>f.id===i.id);return e>-1&&(this.errorCalls.splice(e,1),r==null||r.add(this,H.Affected)),a&>(this,r),r==null||r.attemptAutoclose(w.RemoveCall,this.id),this}removeCaller(i,r=this.project.addChangeSet(new S(this.project,x.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,H.Updated),r==null||r.add(c,H.Affected),!1)),this.calledByError=this.calledByError.filter(c=>c.id!==i.id?!0:(r==null||r.add(this,H.Updated),r==null||r.add(c,H.Affected),!1)),this.calledByEntry=this.calledByEntry.filter(c=>c.id!==i.id?!0:(r==null||r.add(this,H.Updated),r==null||r.add(c,H.Affected),!1)),a&>(this,r),r==null||r.attemptAutoclose(w.RemoveCaller,this.id),this):this}setParent(i,r=this.project.addChangeSet(new S(this.project,x.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,H.Updated))),r==null||r.attemptAutoclose(w.SetParent,this.id),this):this}removeChildGroup(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RemoveChildGroup))){if(!this.checkCanEdit(this,r))return J.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,H.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,H.Updated))}return r==null||r.attemptAutoclose(w.RemoveChildGroup,this.id),this}setDeclaration(i){return this.declaration=i,this}initChildren(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"init-children"))){return this.initialized||this.startedInitialization?this:(this.startedInitialization=!0,this.declaration=Ie(this.initialData.declaration,this.project),this.initialData.andChildrenGroup&&(this.andChildrenGroup=this.initialData.andChildrenGroup.map(r=>{const a=Ie(r,this.project);return a.setParent(this,null),a.initChildren(i),a})),this.initialData.orChildrenGroup&&(this.orChildrenGroup=this.initialData.orChildrenGroup.map(r=>{const a=Ie(r,this.project);return a.setParent(this,null),a.initChildren(i),a})),this.successCalls=this.initialData.successCalls.map(r=>{const a=Ie(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=In(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=Ie(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=In(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=Ie(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(){var i;return this.activeVersion=!0,(i=this.knownVersions)==null||i.forEach(r=>{r.version!==this.version&&(r.activeVersion=!1)}),this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"meta-sync"))){const a=nn(this,i,r),c=rn(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,H.Removed):a.deleted===!1&&e.deleted?r==null||r.add(this,H.Added):c&&(r==null||r.add(this,H.Updated)),r==null||r.attemptAutoclose("meta-sync",this.id),this}async APILoad(i=Ze,...r){return await ji.repository.APILoad(this.id,...r),this}async APICreate(i=Ze,...r){return await ji.repository.APICreate(this.toShallowJSON(),...r),this}async APIUpdate(i=Ze,...r){return await ji.repository.APIUpdate(this.toShallowJSON(),...r),this}async APIDelete(i=Ze,...r){return await ji.repository.APIDelete(this.toShallowJSON(),...r),this}async APIClone(i=Ze,...r){return await ji.repository.APIClone(this.id,...r),this}async APILoadVersion(i=Ze,r,...a){return await ji.repository.APILoadVersion(this.id,r,...a)}removeFromParent(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RemoveFromParent))){var f;if(!this.checkCanEdit(this,i))return J.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 S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RemoveEntity))){var h;if(!this.checkCanDelete(this,r))return J.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}--${Me.ActionOwnerEntityNonDeletable}`,action:w.RemoveEntity,owner:this,errorReason:Me.ActionOwnerEntityNonDeletable,rootAction:((h=r==null?void 0:r.self)==null?void 0:h.id)===this.id&&(r==null?void 0:r.actionName)===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:A}=m.entity.onDetachedDependencyRemoved(this,m.field,r);a.push(...E),c.push(...b),e.push(...A)}),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 S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RestoreEntity))){if(!this.checkCanEdit(this,i))return J.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=at){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||un(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:x.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=at){var a;let r=this.id;return(a=i.seenEntityMaps)!=null&&a.has(this.id)&&(r=i.seenEntityMaps.get(this.id)),{id:r+"--"+x.UUID.uuid()+"--ref",type:d.GenericReference,entityId:r,version:this.version,entityType:this.type}}toShallowJSON(i=at){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=at){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=yVe(this),{success:!0}}async validateAsync(i={}){const r=J.YieldTracker.from(i);return this.errors=await fVe(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=J.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 S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.CloneEntity)),r=null,a=null,c=!0){var V,M,G;const e=Kr(r,this),f=this.toJSON(),h=a||x.UUID.uuid();f.inputs=[];const m=h.split("-id"),E=m[m.length-1||0]||h;f.id=h,f.version=x.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=lr(f,e);r?b.setParent(r,i):b.setParent(this.parent,null),c&&b.subscribe(),b.initChildren(i),i==null||i.add(b,H.Added);const A=(V=this.andChildrenGroup)==null?void 0:V.map(k=>k.clone(i,b,x.UUID.uuid(),c)),_=(M=this.orChildrenGroup)==null?void 0:M.map(k=>k.clone(i,b,x.UUID.uuid(),c));b.andChildrenGroup=A||null,b.orChildrenGroup=_||null;const P=(G=this.inputs)==null?void 0:G.map((k,K)=>k.clone(i,b,E+"-input-map-"+K+"-id",c));return b.inputs=P,i||b.captureVersion(),i==null||i.attemptAutoclose(w.CloneEntity,this.id),b}addToAndGroup(i,r=this.project.addChangeSet(new S(this.project,x.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,H.Affected)),r==null||r.attemptAutoclose(w.AddToAndGroup,this.id),this):(J.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 S(this.project,x.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,H.Affected)),r==null||r.attemptAutoclose(w.AddToOrGroup,this.id),this):(J.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 S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RemoveUnrecognizedInputs))){if(!this.checkCanEdit(this,i))return J.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(A=>A.declaration===h.declaration&&A!==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 S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.SyncInputs))){if(!this.checkCanEdit(this,i))return J.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===j.FixedArguments&&!this.inputs.find(A=>A.declaration.id===b.id));this.inputs.sort((b,A)=>b.index-A.index),f.forEach(b=>{this.inputs.forEach(P=>{P.index>=b.index&&P.metaSync({index:P.index+1},i)});const A={id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:x.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()},_=Ie(A,this.project);_.setParent(this,i),_.addSelfToProject(i),i==null||i.add(_,H.Added),_.initChildren(i),i||_.captureVersion()}),this.inputs.sort((b,A)=>b.index-A.index);const{updated:h,added:m,removed:E}=this.removeUnrecognizedInputs(i);return r.push(...h),a.push(...m),c.push(...E),this.inputs.forEach(b=>{const{updated:A,added:_,removed:P}=b.afterAllChildrenInitialized(i);r.push(...A),a.push(..._),c.push(...P)}),this.inputs.sort((b,A)=>b.index-A.index),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 S(this.project,x.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(ji,"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(ji,"type",d.Condition),R(ji,"USER_MANAGED_PARENT_TYPES",[...wr,d.Project,d.Condition]),R(ji,"PARENT_TYPES",[...ji.USER_MANAGED_PARENT_TYPES]),R(ji,"MUTABLE_BASE_PROPERTIES",["operator"]),R(ji,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion","index"]),R(ji,"BASE_PROPERTIES",[...ji.MUTABLE_BASE_PROPERTIES,...ji.INMUTABLE_BASE_PROPERTIES]),R(ji,"MUTABLE_META_PROPERTIES",["x","y"]),R(ji,"INMUTABLE_META_PROPERTIES",[...ji.INMUTABLE_BASE_PROPERTIES]),R(ji,"META_PROPERTIES",[...ji.MUTABLE_META_PROPERTIES,...ji.INMUTABLE_META_PROPERTIES]),R(ji,"MUTABLE_UPSTREAM_PROPERTIES",["calledBySuccess","calledByError","calledByEntry","parent"]),R(ji,"INMUTABLE_UPSTREAM_PROPERTIES",[]),R(ji,"UPSTREAM_PROPERTIES",[...ji.MUTABLE_UPSTREAM_PROPERTIES,...ji.INMUTABLE_UPSTREAM_PROPERTIES]),R(ji,"MUTABLE_DOWNSTREAM_PROPERTIES",["andChildrenGroup","orChildrenGroup","successCalls","errorCalls","inputsDeclarations","inputs"]),R(ji,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),R(ji,"DOWNSTREAM_PROPERTIES",[...ji.MUTABLE_DOWNSTREAM_PROPERTIES,...ji.INMUTABLE_DOWNSTREAM_PROPERTIES]),R(ji,"PROPERTIES",[...ji.META_PROPERTIES,...ji.UPSTREAM_PROPERTIES,...ji.DOWNSTREAM_PROPERTIES]);let $p=ji;async function zgi(s,p={}){const i=J.YieldTracker.from(p),r=[],a=qt(s.errors,r);return await i.tick(),a}function Ygi(s){const p=[];return qt(s.errors,p)}async function TVe(s,p={}){const i=J.YieldTracker.from(p),r=[],a=qt(s.errors,r);return await i.tick(),a}function vVe(s){const p=[];return qt(s.errors,p)}const Jgi=Object.freeze(Object.defineProperty({__proto__:null,validate:vVe,validateAsync:TVe},Symbol.toStringTag,{value:"Module"}));function Qgi(s,p){const i=[],r=[];if(s.parent)if(s.parent){const a=p.get(s.parent);a?Br.USER_MANAGED_PARENT_TYPES.includes(a.type)||r.push(new we({id:`${s.id}--${s.parent}--${Te.InvalidParentReference}`,code:Te.InvalidParentReference,severity:ve.Error,message:`Entity of type "${s.type}" with id "${s.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: '${At(Br.USER_MANAGED_PARENT_TYPES,"', '","' or '")}'.`})):r.push(new we({id:`${s.id}--${s.parent}--${Te.ReferencedEntityNotFound}`,code:Te.ReferencedEntityNotFound,severity:ve.Error,message:`Entity of type "${s.type}" with id "${s.id}", is referencing an entity with id "${s.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 we({id:`${s.id}--${Ce.InvalidObjectStructure}`,code:Ce.InvalidObjectStructure,severity:ve.Error,message:`Entity of type "${s.type}" with id "${s.id}" is missing a 'parent' reference. The 'parent' of a literal value entity must be a reference to an entity of type '${At(Br.USER_MANAGED_PARENT_TYPES,"', '","', or '")}'.`}));else return r.push(new we({id:`${s.id}--${Ce.InvalidObjectStructure}`,code:Ce.InvalidObjectStructure,severity:ve.Error,message:`Entity of type "${s.type}" with id "${s.id}" is missing a 'parent' reference. The 'parent' of a literal value entity must be a reference to an entity of type '${At(Br.USER_MANAGED_PARENT_TYPES,"', '","', or '")}'.`})),{errors:r,explanations:i};if(s.valueAsTypeSingle){const a=[],c=[],e=s.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=aD(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 we({id:`${s.id}--${f}--${Te.InvalidImplementsReference}`,code:Te.InvalidImplementsReference,severity:ve.Error,message:`Entity of type "${s.type}" with id "${s.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 we({id:`${s.id}--${f}--${Te.ReferencedEntityNotFound}`,code:Te.ReferencedEntityNotFound,severity:ve.Error,message:`Entity of type "${s.type}" with id "${s.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 EVe=(s=>(s.ValueAsTypeSingle="value-as-type-single",s.ValueAsTypeList="value-as-type-list",s))(EVe||{});const yi=class yi extends pn{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:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:(i==null?void 0:i.author)||x.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,a){const c=a===void 0?r.addChangeSet(new S(r,x.sessionAuthor,B().toISOString(),r,!0,w.CreateFromGenerationTarget)):a,e=ie(i.parent),f=r.get(e);let h=null,m=null;i.valueAsTypeList?Array.isArray(i.valueAsTypeList)&&(m=i.valueAsTypeList.map(A=>r.get(A)||r.getBuiltIn(A))):i.valueAsTypeSingle&&(h=r.get(i.valueAsTypeSingle)||r.getBuiltIn(i.valueAsTypeSingle));const E={id:i.id,version:x.UUID.uuid(),createdAt:(c==null?void 0:c.timestamp)||B().toISOString(),author:(c==null?void 0:c.author)||x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.LiteralValue,standaloneParent:null,name:i.name,autogeneration:i.autogeneration,valueAsTypeSingle:h,valueAsTypeList:m,value:i.value||null,parent:f.toReference()},b=Ie(E,r);return b.hydrateAncestors(),b.setParent(f,c),b.addSelfToProject(c),c==null||c.add(b,H.Added),b.initChildren(c),c||b.captureVersion(),b}static validateGenerationTarget(i,r){let a=JSON.parse(JSON.stringify(i));(a.valueAsTypeList||a.valueAsTypeSingle)&&(a.name=fe.EntityTemplate);const c=[],e=[],f=Qgi(a,r),h=tn(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&&!Al(this.parent.parent))}validateGeneratedUpdate(i){const r=[],a=[];return i.parent&&r.push(new we({id:`${this.id}--${Te.InvalidParentUpdate}`,code:Te.InvalidParentUpdate,severity:ve.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
|
-
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 S(this.project,x.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,H.Updated)),r==="value-as-type-list"&&(this.valueAsTypeList=(this.valueAsTypeList||[]).filter(m=>m.id!==i.id),a==null||a.add(this,H.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,H.Updated)),r==="value-as-type-list"&&(this.valueAsTypeList=[...Array.isArray(this.valueAsTypeList||[])?this.valueAsTypeList:[],i],a==null||a.add(this,H.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){var r;if(this.project.diggestedBuiltInBaseEntitiesIds.has(this.id))return this;if(i&&!B(i).isValid())throw new Error(`The shared timestamp '${i}' is not a valid ISO 8601 date string.`);if(i&&B(i).isSame(B(this.createdAt)))return this;if(!((r=this.knownVersions)!=null&&r.has(this.version))&&this.project.initialized)throw new Error(`The current ${this.type} ${this.id} version '${this.version}' is not captured in the 'knownVersions' map. Capture the current version before increasing it to avoid losing data.`);if(!this.activeVersion)throw new Error(`Only active versions can be increased. Entity with id '${this.id}' and version '${this.version}' is not active.`);return this.previousVersion=this.version,this.version=x.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 yi(this,this.project);if(!this.activeVersion)throw new Error(`Only active versions can be captured. Entity of type ${this.type} with id '${this.id}' and version '${this.version}' is not active.`);if(this.version!==i.version)throw new Error(`Captured ${this.type} with id '${this.id}', version '${i.version}' does not match current entity version '${this.version}'.`);return this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,i):new Map().set(this.version,i),this.apply(i),this}snapshot(){const i=new yi(this,this.project);return this.apply(i)}apply(i){const r=this.toMeta();return i.metaSync(r,null),i.valueAsTypeSingle=this.valueAsTypeSingle,i.valueAsTypeList=this.valueAsTypeList?[...this.valueAsTypeList]:this.valueAsTypeList,i.parent=this.parent,i}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,r){var m;const a=[],c=[],e=[],f=[];if(this.version===i&&(r!=null&&r.skipIfSameVersion))return{updated:C(a),added:C(c),removed:C(e),affected:C(f),self:this};if(!this.knownVersions){const E=new Map;for(const[b,A]of this.knownVersions||new Map){if(E.set(b,A),A.activeVersion=!1,A.knownVersions)for(const[_,P]of A.knownVersions)E.set(_,P);A.knownVersions=null}}let h=(m=this.knownVersions)==null?void 0:m.get(i);if(!h){const E=await this.APILoadVersion({},i);if(!E)throw new Error(`Version with id '${i}' for entity with id '${this.id}' not found.`);h=new yi(E,this.project)}return this.metaSync(h.toShallowJSON(),null),this.previousVersion=h.previousVersion,this.version=h.version,this.createdAt=h.createdAt,this.author=h.author,this.deleted=h.deleted,this.valueAsTypeSingle=h.valueAsTypeSingle,this.parent=h.parent,{updated:C(a),added:C(c),removed:C(e),affected:C(f),self:this}}updateWithShallowTransfer(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.UpdateWithShallowTransfer))){if(!this.checkCanEdit(this,r))return J.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=ie(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=ie(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=ie(a),e=this.project.get(c);e&&this.addValueAsTypeToList(e,r)}),[...this.valueAsTypeList].forEach(a=>{(i.valueAsTypeList||[]).find(e=>ie(e)===a.id)||this.removeValueAsTypeFromList(a,r)}),this.setValueAsTypeSingle(null,r),this.metaSync({value:null},r);else if(i.valueAsTypeSingle){const a=ie(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 S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.UpdateWithGenerationTarget))){if(!this.checkCanEdit(this,r))return J.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=ie(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=ie(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=ie(a),e=this.project.get(c);e&&this.addValueAsTypeToList(e,r)}),[...this.valueAsTypeList].forEach(a=>{(i.valueAsTypeList||[]).find(e=>ie(e)===a.id)||this.removeValueAsTypeFromList(a,r)}),this.setValueAsTypeSingle(null,r),this.metaSync({value:null},r);else if(i.valueAsTypeSingle){const a=ie(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){const e=ie(this.initialData.parent),f=this.project.get(e),h=ie(this.initialData.standaloneParent),m=this.project.get(h);let E="";throw f?E+=` Parent -> ${f.type}: '${f.id}' "${Lt(f,this.project)}".`:E+=" Parent -> not-found.",m?E+=` Standalone Parent -> ${m.type}: '${m.id}' "${Lt(m,this.project)}".`:E+=" Standalone Parent -> not-found.",new Error(`Entity with id '${this.id}' cannot have both 'parent' and 'standaloneParent' properties set.${E}`)}if(this.initialData.parent){const e=ie(this.initialData.parent),f=this.project.get(e);if(J.Logger.log(`[LiteralValueState.hydrateAncestors] Hydrating parent reference '${e}' for entity with id '${this.id}'`),f)J.Logger.log(`[LiteralValueState.hydrateAncestors] Setting parent reference '${f.id}' for entity with id '${this.id}'`),this.setParent(f,null),i.push(f);else throw J.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=ie(this.initialData.standaloneParent),f=this.project.get(e);if(J.Logger.log(`[LiteralValueState.hydrateAncestors] Hydrating standalone parent reference '${e}' for entity with id '${this.id}'`),f)J.Logger.log(`[LiteralValueState.hydrateAncestors] Setting standalone parent reference '${f.id}' for entity with id '${this.id}'`),this.setStandaloneParent(f,null);else throw J.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 J.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=ie(e),h=this.project.get(f);h&&this.valueAsTypeList.push(h)});else if(this.initialData.valueAsTypeSingle){const e=ie(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 S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.AfterAllChildrenInitialized))){if(!this.checkCanEdit(this,i))return J.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,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 S(this.project,x.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 S(this.project,x.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,H.Updated))),r==null||r.attemptAutoclose(w.SetParent,this.id),this):this}setStandaloneParent(i,r=this.project.addChangeSet(new S(this.project,x.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,H.Updated))),r==null||r.attemptAutoclose(w.SetStandaloneParent,this.id),this):this}addValueAsTypeToList(i,r=this.project.addChangeSet(new S(this.project,x.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,H.Updated)),r==null||r.add(this,H.Updated)),r==null||r.attemptAutoclose(w.AddValueAsTypeToList,this.id),this):(J.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 S(this.project,x.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,H.Updated))),r==null||r.add(this,H.Updated)),r==null||r.attemptAutoclose(w.RemoveValueAsTypeFromList,this.id),this):(J.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 S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.SetValueAsTypeSingle))){return this.checkCanEdit(this,r)?(this.valueAsTypeSingle!==i&&(this.valueAsTypeSingle=i,r==null||r.add(this,H.Updated)),r==null||r.attemptAutoclose(w.SetValueAsTypeSingle,this.id),this):(J.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 S(this.project,x.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,H.Updated)):i&&!this.valueAsTypeList?(this.valueAsTypeList=i,r==null||r.add(this,H.Updated)):i&&this.valueAsTypeList&&((a=this.valueAsTypeList)==null?void 0:a.length)!==i.length?(this.valueAsTypeList=i,r==null||r.add(this,H.Updated)):i&&this.valueAsTypeList&&((c=this.valueAsTypeList)!=null&&c.every((e,f)=>e!==i[f]))&&(this.valueAsTypeList=i,r==null||r.add(this,H.Updated)),r==null||r.attemptAutoclose(w.SetValueAsTypeList,this.id),this):(J.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 S(this.project,x.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):(J.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 S(this.project,x.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=ie(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(){var i;return this.activeVersion=!0,(i=this.knownVersions)==null||i.forEach(r=>{r.version!==this.version&&(r.activeVersion=!1)}),this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"meta-sync"))){const a=nn(this,i,r),c=rn(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,H.Removed):a.deleted===!1&&e.deleted?r==null||r.add(this,H.Added):c&&(r==null||r.add(this,H.Updated)),r==null||r.attemptAutoclose("meta-sync",this.id),this}async APILoad(i=Ze,...r){return await yi.repository.APILoad(this.id,...r),this}async APICreate(i=Ze,...r){return await yi.repository.APICreate(this.toShallowJSON(),...r),this}async APIUpdate(i=Ze,...r){return await yi.repository.APIUpdate(this.toShallowJSON(),...r),this}async APIDelete(i=Ze,...r){return await yi.repository.APIDelete(this.toShallowJSON(),...r),this}async APIClone(i=Ze,...r){return await yi.repository.APIClone(this.id,...r),this}async APILoadVersion(i=Ze,r,...a){return await yi.repository.APILoadVersion(this.id,r,...a)}removeFromParent(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RemoveFromParent))){if(!this.checkCanEdit(this,i))return J.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):hI.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 S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RemoveEntity))){var h;if(!this.checkCanDelete(this,r))return J.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}--${Me.ActionOwnerEntityNonDeletable}`,action:w.RemoveEntity,owner:this,errorReason:Me.ActionOwnerEntityNonDeletable,rootAction:((h=r==null?void 0:r.self)==null?void 0:h.id)===this.id&&(r==null?void 0:r.actionName)===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:A}=m.entity.onDetachedDependencyRemoved(this,m.field,r);a.push(...E),c.push(...b),e.push(...A)}),!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 S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RestoreEntity))){if(!this.checkCanEdit(this,i))return J.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=at){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||un(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:x.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=at){var a;let r=this.id;return(a=i.seenEntityMaps)!=null&&a.has(this.id)&&(r=i.seenEntityMaps.get(this.id)),{id:r+"--"+x.UUID.uuid()+"--ref",type:d.GenericReference,entityId:r,version:this.version,entityType:this.type}}toShallowJSON(i=at){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=at){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=vVe(this),{success:!0}}async validateAsync(i={}){const r=J.YieldTracker.from(i);return this.errors=await TVe(this,{tracker:r}),{success:!0}}getErrors(){return[...this.errors]}async getErrorsAsync(i={}){const r=J.YieldTracker.from(i),a=[...this.errors];return await r.tick(),a}getShallowErrors(){return this.errors}clone(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.CloneEntity)),r=null,a=null,c=!0){const e=Kr(r,this),f=this.toJSON();r?(f.parent=r.toReference(),f.standaloneParent=null):(f.parent=null,this.standaloneParent?f.standaloneParent=this.standaloneParent.toReference():this.parent?f.standaloneParent=this.parent.toReference():f.standaloneParent=null);const h=a||x.UUID.uuid();f.id=h,f.version=x.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=lr(f,e);return m.hydrateAncestors(),r&&m.setParent(r,i),c&&(m.subscribe(),m.addSelfToProject(i)),i==null||i.add(m,H.Added),m.initChildren(i),i||m.captureVersion(),i==null||i.attemptAutoclose(w.CloneEntity,this.id),m}merge(i,r=this.project.addChangeSet(new S(this.project,x.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(yi,"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(yi,"type",d.LiteralValue),R(yi,"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(yi,"USER_MANAGED_STANDALONE_PARENT_TYPES",[...yI]),R(yi,"PARENT_TYPES",[...yi.USER_MANAGED_PARENT_TYPES]),R(yi,"MUTABLE_BASE_PROPERTIES",["name","autogeneration","value"]),R(yi,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),R(yi,"BASE_PROPERTIES",[...yi.MUTABLE_BASE_PROPERTIES,...yi.INMUTABLE_BASE_PROPERTIES]),R(yi,"MUTABLE_META_PROPERTIES",[...yi.MUTABLE_BASE_PROPERTIES]),R(yi,"INMUTABLE_META_PROPERTIES",[...yi.INMUTABLE_BASE_PROPERTIES]),R(yi,"META_PROPERTIES",[...yi.MUTABLE_META_PROPERTIES,...yi.INMUTABLE_META_PROPERTIES]),R(yi,"MUTABLE_UPSTREAM_PROPERTIES",["valueAsTypeSingle","valueAsTypeList"]),R(yi,"INMUTABLE_UPSTREAM_PROPERTIES",["parent"]),R(yi,"UPSTREAM_PROPERTIES",[...yi.MUTABLE_UPSTREAM_PROPERTIES,...yi.INMUTABLE_UPSTREAM_PROPERTIES]),R(yi,"MUTABLE_DOWNSTREAM_PROPERTIES",[]),R(yi,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),R(yi,"DOWNSTREAM_PROPERTIES",[...yi.MUTABLE_DOWNSTREAM_PROPERTIES,...yi.INMUTABLE_DOWNSTREAM_PROPERTIES]),R(yi,"PROPERTIES",[...yi.META_PROPERTIES,...yi.UPSTREAM_PROPERTIES,...yi.DOWNSTREAM_PROPERTIES]);let Br=yi;function ry(s){if(typeof crypto<"u"&&typeof crypto.getRandomValues=="function"){const i=new Uint8Array(s);return crypto.getRandomValues(i),i}const{randomBytes:p}=require("crypto");return p(s)}function bVe(s,p){const i=p-s+1,a=E1()*i;return Math.floor(a)+s}function AVe(){const s=ry(4);return(s[0]<<24|s[1]<<16|s[2]<<8|s[3])>>>0}function E1(){return AVe()/2**32}function Wx(s){const p=ry(s);return Array.from(p).map(i=>i.toString(16).padStart(2,"0")).join("")}const U_="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";function zx(s){let p="";const i=ry(s);for(let r=0;r<s;r++)p+=U_[i[r]%U_.length];return p}function gVe(s){const p=ry(s);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 Yx(s){return zx(s)}function Jx(s,p=U_){let i="";const r=ry(s);for(let a=0;a<s;a++)i+=p[r[a]%p.length];return i}function Ip(){const s=ry(16);s[6]=s[6]&15|64,s[8]=s[8]&63|128;const p=Array.from(s).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 IVe(){return Jx(6)}function RVe(){return Wx(32)}const Xgi=63,eIi=/^[a-z][a-z0-9-]*[a-z0-9]$/;function tIi(s){return s.length>=1&&s.length<=Xgi&&eIi.test(s)&&!s.includes("--")}function*iIi(){yield"";const s="abcdefghijklmnopqrstuvwxyz";for(let p=1;;p++){const i=new Array(p).fill(0);let r=!1;for(;!r;){yield i.map(a=>s[a]).join("");for(let a=p-1;a>=0&&(i[a]++,!(i[a]<s.length));a--)i[a]=0,a===0&&(r=!0)}}}function rIi(s,p){const i=new Set(s.map(a=>a.toLowerCase())),r=p>0?"secondary-db":"main";for(const a of iIi()){const c=a?`${r}-${a}`:r;if(tIi(c)&&!i.has(c))return c}throw new Error("Unable to generate identifier")}function DVe(s,p){switch(s.id){case re["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.id:{const i=s.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(A=>A.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(A=>A.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:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(p==null?void 0:p.timestamp)||new Date().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.LiteralValue,standaloneParent:null,name:fe.EntityTemplate,autogeneration:null,value:!0,valueAsTypeSingle:null,valueAsTypeList:null,parent:m==null?void 0:m.toReference()},A=Ie(b,s.project);return A.hydrateAncestors(),A.setParent(m,p),A.addSelfToProject(p),p==null||p.add(A,H.Added),A.initChildren(p),p||A.captureVersion(),{newEntities:[A]}}return{newEntities:[]}}else if(r)return{newEntities:[]};const a=s.project.get(re["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id),c=b1(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:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(p==null?void 0:p.timestamp)||new Date().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.LiteralValue,standaloneParent:null,name:fe.EntityTemplate,autogeneration:null,value:!0,valueAsTypeSingle:null,valueAsTypeList:null,parent:e==null?void 0:e.toReference()},m=Ie(h,s.project);m.hydrateAncestors(),m.setParent(e,p),m.addSelfToProject(p),p==null||p.add(m,H.Added),m.initChildren(p),p||m.captureVersion()}return{newEntities:[c]}}}return{newEntities:[]}}function wVe(s,p){const i=[],r=[],a=[],c=[];return s.implements.filter(f=>f.type===d.BuiltInBaseEntity).forEach(f=>{var h,m,E,b,A,_,P,V,M;switch(f.id){case re["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.id:{const G=s.project.entities.filter(Y=>Y.implements.find(te=>te.id===re["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id));let k=G.find(Y=>!!Y.properties.find(te=>{var oe;return te.implements.find(Q=>Q.id===re["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id)&&((oe=te.getDefaultValue())==null?void 0:oe.value)===!0}));if(!k&&G.length)k=G[0];else if(!k&&!G.length){k=s.project.getBuiltIn(re["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id).implement("Relational database",p);const te=k.properties.find(oe=>oe.implements.find(Q=>Q.id===re["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id));(h=te==null?void 0:te.defaultValue)==null||h.metaSync({value:!0},p),r.push(k)}const K=s.properties.find(Y=>Y.implements.find(te=>te.id===re["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.properties.database.id));if(K&&!(K!=null&&K.defaultValue)){const Y={id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(p==null?void 0:p.timestamp)||new Date().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.LiteralValue,standaloneParent:null,name:fe.EntityTemplate,autogeneration:null,value:null,valueAsTypeSingle:(k==null?void 0:k.toJSON())||null,valueAsTypeList:null,parent:K==null?void 0:K.toReference()},te=Ie(Y,s.project);te.hydrateAncestors(),te.setParent(K,p),te.addSelfToProject(p),p==null||p.add(te,H.Added),te.initChildren(p),(K==null?void 0:K.defaultValue).setValueAsTypeSingle(k||null,p),r.push(te),p||te.captureVersion();return}else K!=null&&K.defaultValue&&!(K!=null&&K.defaultValue.valueAsTypeSingle)&&(K==null||K.defaultValue.setValueAsTypeSingle(k||null,p));const le=s.properties.find(Y=>Y.implements.find(te=>te.id===re["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.properties.primaryKey.id));if(!le)throw new Error(`[handleAfterEntityImplementationSideEffects] Primary key property not found for implemented base entity ${re["built-in-base-entity"]}`);let ne=!1;if(!le.dataType){const Y=Tr.new(p);Y.parent=le.toReference();const te=Ie(Y,s.project);te.hydrateAncestors(),te.setParent(le,p),te.addSelfToProject(p),p==null||p.add(te,H.Added),te.initChildren(p),ne=!0}const de=s.project.getBuiltIn(re["primitive-entity"].number.id);(m=le.dataType)==null||m.setEntity(de,p),ne&&(p||(E=le.dataType)==null||E.captureVersion());return}case re["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id:{const G=s.project.entities.filter(Q=>Q.implements.find(z=>z.id===re["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id)&&Q.id!==s.id),k=G.map(Q=>{var ye;const z=Q.properties.find(ce=>ce.implements.find(he=>he.id===re["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.identifier.id));return(ye=z==null?void 0:z.getDefaultValue())==null?void 0:ye.value}).filter(Q=>!!Q),K=s.properties.find(Q=>Q.implements.find(z=>z.id===re["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.identifier.id));if(!G.find(Q=>!!Q.properties.find(z=>{var se;return z.implements.find(ye=>ye.id===re["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id)&&((se=z.getDefaultValue())==null?void 0:se.value)===!0}))){const Q=s.properties.find(se=>se.implements.find(ye=>ye.id===re["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id));if(!Q)throw new Error("Default boolean property not found for relational database entity with id: "+s.id);let z=!1;if(!(Q!=null&&Q.defaultValue)){const se=Br.new(p);se.parent=Q.toReference();const ye=Ie(se,s.project);ye.hydrateAncestors(),ye.setParent(Q,p),ye.addSelfToProject(p),p==null||p.add(ye,H.Added),ye.initChildren(p),z=!0}(b=Q==null?void 0:Q.defaultValue)==null||b.metaSync({value:!0},p),z&&(p||(A=Q==null?void 0:Q.defaultValue)==null||A.captureVersion())}if(!K)throw new Error("Identifier property not found for relational database entity with id: "+s.id);let ne=!1;if(!(K!=null&&K.defaultValue)){const Q=Br.new(p);Q.parent=K.toReference();const z=Ie(Q,s.project);z.hydrateAncestors(),z.setParent(K,p),z.addSelfToProject(p),p==null||p.add(z,H.Added),z.initChildren(p),ne=!0}const de=rIi(k,G.length);(_=K.defaultValue)==null||_.metaSync({value:de},p),ne&&(p||(P=K.defaultValue)==null||P.captureVersion());const Y=s.properties.find(Q=>Q.implements.find(z=>z.id===re["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.password.id));if(!Y)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 ${s.id}`);let te=!1;if(!Y.defaultValue){const Q=Br.new(p);Q.parent=Y.toReference();const z=Ie(Q,s.project);z.hydrateAncestors(),z.setParent(Y,p),z.addSelfToProject(p),p==null||p.add(z,H.Added),z.initChildren(p),r.push(z),te=!0}const oe=Yx(24);(V=Y.defaultValue)==null||V.metaSync({value:oe},p),te&&(p||(M=Y.defaultValue)==null||M.captureVersion());return}case re["built-in-base-entity"].BUILT_IN_SQL_ROW_TRANSFORMER_ENTITY.id:{const G=s.properties.find(ne=>ne.implements.find(de=>de.id===re["built-in-base-entity"].BUILT_IN_SQL_ROW_TRANSFORMER_ENTITY.properties.time.id));if(!G)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 ${s.id}`);let k=G.defaultValue||null;if(!k){const ne=Br.new(p);ne.parent=G.toReference(),ne.name=fe.Date,ne.id=x.UUID.uuid(),k=Ie(ne,s.project),k.hydrateAncestors(),k.setParent(G,p),k.addSelfToProject(p),k.initChildren(p),p==null||p.add(k,H.Added)}k.metaSync({value:new Date().toISOString()},p),k.metaSync({editable:!1,deletable:!1},p),G.metaSync({editable:!1,deletable:!1},p);const K=s.properties.find(ne=>ne.implements.find(de=>de.id===re["built-in-base-entity"].BUILT_IN_SQL_ROW_TRANSFORMER_ENTITY.properties.definition.id));if(!K)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 ${s.id}`);let le=K.defaultValue||null;if(!le){const ne=Br.new(p);ne.name=fe.EntityTemplate,ne.parent=K.toReference(),ne.id=x.UUID.uuid(),le=Ie(ne,s.project),le.hydrateAncestors(),le.setParent(K,p),le.addSelfToProject(p),le.initChildren(p),p==null||p.add(le,H.Added)}}}}),{self:s,updated:C(i),added:C(r),removed:C(a),affected:C(c)}}function b1(s,p,i,r){const a=r||x.UUID.uuid(),c=qs.new(i);c.id=a,c.name=p,c.static=s.static,c.implements=[s.toJSON()],c.parent=s.project.toReference(),c.static=s.static,DVe(s,i);const e=Ie(c,s.project);return e.hydrateAncestors(),i==null||i.add(e,H.Added),e.addSelfToProject(i),e.initChildren(i),i||e.captureVersion(),wVe(e,i),e.afterAllChildrenInitialized(i),e}function Qx(s,p){return p.entities.find(a=>{const c=a.properties,e=c.map(b=>b.name),f=s.every(b=>e.includes(b)),h=e.filter(b=>!s.includes(b)),m=c.every(b=>!h.includes(b.name)||!b.required);return f&&m})||null}function CVe(s,p,i,r=Ye.OrDataTypeGroup){const a=[],c=[],e=[],f=[],h=x.UUID.uuid(),m=Tr.new(i);m.id=h,m.parent=p.toReference(),m.like=!0,m.parentRelationType=r;const E=Ie(m,s.project);return c.push(E),E.setParent(p,i),E.addSelfToProject(i),i==null||i.add(E,H.Added),E.setEntity(s,i),E.initChildren(i),i||E.captureVersion(),{updated:C(a),added:C(c),removed:C(e),affected:C(f),self:E}}function Xx(s,p,i,r,a){var m,E,b,A,_,P,V,M;const c=[],e=[],f=[],h=[];switch(typeof s){case"string":let G=!1;const k=new Date(s);if(k instanceof Date&&!isNaN(k.valueOf())&&(G=!0),G){const K=p.project.getBuiltIn(re[d.PrimitiveEntity][fe.Date].id);p.setEntity(K,r);break}else{const K=p.project.getBuiltIn(re[d.PrimitiveEntity][fe.String].id);p.setEntity(K,r);break}case"number":p.setEntity(p.project.getBuiltIn(re[d.PrimitiveEntity][fe.Number].id),r);break;case"boolean":p.setEntity(p.project.getBuiltIn(re[d.PrimitiveEntity][fe.Boolean].id),r);break;case"object":if(s===null){p.setEntity(p.project.getBuiltIn(re[d.PrimitiveEntity][fe.Null].id),r);break}else if(Array.isArray(s))if(p.metaSync({isList:!0},r),s.length>0){const K=s.slice(0,5).filter(ne=>ne!==void 0);if(K.every(ne=>typeof ne==typeof K[0])&&(typeof K[0]!="object"||K[0]===null))switch(typeof K[0]){case"string":p.setEntity(p.project.getBuiltIn(re[d.PrimitiveEntity][fe.String].id),r);break;case"number":p.setEntity(p.project.getBuiltIn(re[d.PrimitiveEntity][fe.Number].id),r);break;case"boolean":p.setEntity(p.project.getBuiltIn(re[d.PrimitiveEntity][fe.Boolean].id),r);break;case"object":p.setEntity(p.project.getBuiltIn(re[d.PrimitiveEntity][fe.Null].id),r);break}else{const ne=[];let de=!1;K.forEach(te=>{var oe,Q,z,se;if(Array.isArray(te)&&(de=!0),typeof te=="object"&&!Array.isArray(te)&&te!==null){const ye=yg(te,p.project,{...i,id:x.UUID.uuid()},r,a);ye.hasCreated&&ne.push((oe=ye.changeSet)==null?void 0:oe.self),c.push(...(Q=ye.changeSet)==null?void 0:Q.updated),e.push(...(z=ye.changeSet)==null?void 0:z.added),f.push(...(se=ye.changeSet)==null?void 0:se.removed)}});const Y=C(ne);if(!Y.length&&!de){K.forEach(te=>{const oe=Tr.new(r);oe.parentRelationType=Ye.OrDataTypeGroup,oe.parent=p.toReference();const Q=Ie(oe,p.project);switch(Q.hydrateAncestors(),Q.setParent(p,r),Q.addSelfToProject(r),r==null||r.add(Q,H.Added),Q.initChildren(r),typeof te){case"string":Q.setEntity(Q.project.getBuiltIn(re[d.PrimitiveEntity][fe.String].id),r);break;case"number":Q.setEntity(Q.project.getBuiltIn(re[d.PrimitiveEntity][fe.Number].id),r);break;case"boolean":Q.setEntity(Q.project.getBuiltIn(re[d.PrimitiveEntity][fe.Boolean].id),r);break;case"object":Q.setEntity(Q.project.getBuiltIn(re[d.PrimitiveEntity][fe.Null].id),r);break}r||Q.captureVersion()});break}else Y.length===1&&!de?p.setEntity(Y[0],r):K.forEach(te=>{if(typeof te=="object"&&!Array.isArray(te)&&te!==null){const oe=Qx(Object.keys(te),p.project);if(oe){const Q=CVe(oe||Y[0],p,r,Ye.OrDataTypeGroup);c.push(...Q.updated),e.push(...Q.added),f.push(...Q.removed)}}else{const oe=Tr.new(r);oe.parentRelationType=Ye.OrDataTypeGroup,oe.parent=p.toReference();const Q=Ie(oe,p.project);Q.hydrateAncestors(),Q.setParent(p,r),Q.addSelfToProject(r),r==null||r.add(Q,H.Added),Q.initChildren(r);const z=Xx(te,Q,{...i,id:x.UUID.uuid()},r,a);c.push(...z.updated),e.push(...z.added),f.push(...z.removed),r||Q.captureVersion()}})}}else{const K=yg(s[0],p.project,{...i},r,a);p.setEntity((m=K.changeSet)==null?void 0:m.self,r),c.push(...(E=K.changeSet)==null?void 0:E.updated),e.push(...(b=K.changeSet)==null?void 0:b.added),f.push(...(A=K.changeSet)==null?void 0:A.removed);break}else{const K=yg(s,p.project,{...i},r,a);p.setEntity((_=K.changeSet)==null?void 0:_.self,r),c.push(...(P=K.changeSet)==null?void 0:P.updated),e.push(...(V=K.changeSet)==null?void 0:V.added),f.push(...(M=K.changeSet)==null?void 0:M.removed);break}}return{updated:C(c),added:C(e),removed:C(f),affected:C(h),self:p}}function yg(s,p,i,r,a){const c=[],e=[],f=[],h=[],m=Object.keys(s),E=Qx(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||x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(r==null?void 0:r.timestamp)||new Date().toISOString(),author:x.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()},P=Ie(_,p);return P.hydrateAncestors(),P.setParent(p,r),P.addSelfToProject(r),r==null||r.add(P,H.Added),P.initChildren(r),e.push(P),m.forEach((V,M)=>{const G=x.UUID.uuid(),k=qa.new(r);k.id=G,k.name=V,k.codeName=V,k.parent=P.toReference(),k.index=M,k.required=!0,k.interactive=!0;const K=Ie(k,p);K.hydrateAncestors(),K.setParent(P,r),K.addSelfToProject(r),r==null||r.add(K,H.Added),K.initChildren(r),e.push(K);const le=s[V],ne=x.UUID.uuid(),de=Tr.new(r);de.id=ne,de.parent=K.toReference(),de.like=!0,de.isList=!1;const Y=Ie(de,p);Y.hydrateAncestors(),Y.setParent(K,r),Y.addSelfToProject(r),r==null||r.add(Y,H.Added),Y.initChildren(r),e.push(Y);const te=Xx(le,Y,{...i,name:V,id:x.UUID.uuid()},r,a||P);c.push(...te.updated),e.push(...te.added),f.push(...te.removed),r||(K.captureVersion(),Y.captureVersion())}),r||P.captureVersion(),{hasCreated:!0,changeSet:{updated:C(c),added:C(e),removed:C(f),affected:C(h),self:P}}}function zd(s,p,i,r){const a=[];return!s.length||!p.length?{errors:a,overlap:!1}:(s.length>p.length?s.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(A=>A.id===b.id)):((m=h.implements)==null?void 0:m.id)===((E=c.implements)==null?void 0:E.id)});if(e){const h=new qi({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:ve.Error,code:r,entity:c,firstRelationship:e});a.push(h)}if(f){const h=new qi({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:ve.Error,code:i,entity:c,firstRelationship:f});a.push(h)}}):p.forEach(c=>{var h;const e=s.find(m=>m.name===c.name),f=s.find(m=>{var E,b;return m.implements&&Array.isArray(m.implements)?m.implements.some(A=>!!c.implements.find(_=>_.id===A.id)):((E=m.implements)==null?void 0:E.id)===((b=c.implements)==null?void 0:b.id)});if(e){const m=new qi({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:ve.Error,code:r,entity:e,firstRelationship:c});a.push(m)}if(f){const m=new qi({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)?At(f==null?void 0:f.implements.map(E=>E.type),"', '","' and '"):(h=f.implements)==null?void 0:h.id}`,severity:ve.Error,code:i,entity:f,firstRelationship:c});a.push(m)}}),{errors:a,overlap:!!a.length})}function nIi(s,p){return s.abstract||(s.properties.forEach(r=>{r.abstract||r.metaSync({abstract:!0},p)}),Object.values(s.detachedDependents).forEach(r=>{r.field===wL.EntityField&&r.entity.remove({ignoreUpstream:!1},p)}),s.metaSync({abstract:!0},p)),s}function aIi(s,p){return s.abstract&&(s.properties.forEach(r=>{r.abstract&&r.metaSync({abstract:!1},p)}),Object.values(s.detachedDependents).forEach(r=>{(r.field===Xg.Implements||r.field===Xg.Extends)&&r.entity.onDetachedDependencyRemoved(s,r.field,p)}),s.metaSync({abstract:!1},p)),s}function sIi(s,p){return s.static||(s.properties.forEach(r=>{r.static||r.metaSync({static:!0},p)}),s.metaSync({static:!0},p)),s}function lIi(s,p){return s.static&&s.metaSync({static:!1},p),s}const tv=class tv extends Kx{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=Ie(a,this.project);return c.setParent(this,null),c.initChildren(null),c}),this.methods=this.initialData.methods.map(a=>{const c=Ie(a,this.project);return c.setParent(this,null),c.initChildren(null),c}),this.abstractMethods=this.initialData.abstractMethods.map(a=>{const c=Ie(a,this.project);return c.setParent(this,null),c.initChildren(null),c}),this.initialData.allPropertiesImplement){const a=Ie(this.initialData.allPropertiesImplement,this.project);a.setParent(this,null),a.initChildren(null),this.allPropertiesImplement=a}if(this.initialData.additionalPropertiesDataType){const a=Ie(this.initialData.additionalPropertiesDataType,this.project);a.setParent(this,null),a.initChildren(null),this.additionalPropertiesDataType=a}this.initialData.extends&&(this.extends=Ie(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(A=>A.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=Ze,...r){return await tv.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=at){return{id:this.id+"--"+x.UUID.uuid()+"--ref",type:d.GenericReference,entityId:this.id,version:this.version,entityType:this.type}}toShallowJSON(i=at){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=at){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=Ygi(this),{success:!0}}async validateAsync(i={}){const r=J.YieldTracker.from(i);return this.errors=await zgi(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=J.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 S(this.project,x.sessionAuthor,B().toISOString(),null,!0,"implement-built-in-base-entity")),a){const c=b1(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 tv&&i.push(...this.extends.getAllInteractiveMethods())}return C(i)}getRawDefaultValue(){const i={};return this.properties.forEach(r=>{var e;if(!Iv(r)||!r.defaultValue)return;const a=pe(r,this.project),c=r.codeName||gp(r,this.project)||ys(ir(a));i[c]=((e=r.getDefaultValue())==null?void 0:e.value)||null}),i}};R(tv,"repository",{APILoad:async(i,...r)=>null});let md=tv;class OVe extends md{constructor(i){super(Vn,i);R(this,"initialData");R(this,"id",ge.PERSISTED_ENTITY);R(this,"version","1");R(this,"name",ge.PERSISTED_ENTITY);R(this,"description",Vn.description);R(this,"type",d.BuiltInBaseEntity);R(this,"abstract",Vn.abstract);R(this,"static",Vn.static);R(this,"properties",[]);R(this,"methods",[]);R(this,"abstractMethods",[]);R(this,"extends",null);R(this,"errors",[]);R(this,"project");this.initialData=Vn,this.project=i,this.id=Vn.id,this.version=Vn.version,this.name=Vn.name,this.static=Vn.static,this.abstract=Vn.abstract,this.properties=this.initialData.properties.map(r=>{const a=Ie(r,this.project);return a.setParent(this,null),a.initChildren(null),a}),this.methods=this.initialData.methods.map(r=>{const a=Ie(r,this.project);return a.parent=this,a}),this.abstractMethods=this.initialData.abstractMethods.map(r=>{const a=Ie(r,this.project);return a.parent=this,a}),this.initialData.extends&&(this.extends=Ie(this.initialData.extends,this.project))}}var xn=(s=>(s.ValueMustBeString="value-must-be-string",s.StringValueMustNotHaveSpaces="string-value-must-not-have-spaces",s.StringValueMustNotHaveDashes="string-value-must-not-have-dashes",s.MustBeUniqueAmongSameEntities="must-be-unique-among-same-entities",s))(xn||{});function e$(s,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 qi({id:s.id+"--string-value-must-not-have-spaces",message:`Entity of type ${s.type} with id "${s.id}" has an invalid value "${p}". The value cannot contain spaces.`,severity:ve.Error,code:"string-value-must-not-have-spaces",entity:s});i.push(a)}return{errors:i,override:r.replace(/\s/g,"-")}}function _Ve(s,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 qi({id:s.id+"--string-value-must-not-have-spaces",message:`Entity of type ${s.type} with id "${s.id}" has an invalid value "${p}". The value cannot contain spaces or dashes.`,severity:ve.Error,code:"string-value-must-not-have-spaces",entity:s});i.push(a)}if(r.includes("-")){const a=new qi({id:s.id+"--string-value-must-not-have-dashes",message:`Entity of type ${s.type} with id "${s.id}" has an invalid value "${p}". The value cannot contain spaces or dashes.`,severity:ve.Error,code:"string-value-must-not-have-dashes",entity:s});i.push(a)}return{errors:i,override:r.replace(/\s|-/g,"_")}}var Td=(s=>(s.StatusCodeMustBeNumber="status-code-must-be-number",s.StatusCodeMustBeBetween100And599="status-code-must-be-between-100-and-599",s))(Td||{});function VVe(s,p){const i=[];if(typeof p!="number"){const r=new qi({id:s.id+"--status-code-must-be-number",message:`Entity of type ${s.type} with id "${s.id}" has an invalid value "${p}". The value must be a number.`,severity:ve.Error,code:"status-code-must-be-number",entity:s});return i.push(r),{errors:i,override:p}}if(p<100||p>599){const r=new qi({id:s.id+"--status-code-must-be-between-100-and-599",message:`Entity of type ${s.type} with id "${s.id}" has an invalid value "${p}". The value must be a number between 100 and 599.`,severity:ve.Error,code:"status-code-must-be-between-100-and-599",entity:s});i.push(r)}return{errors:i,override:p}}class PVe extends md{constructor(i){var f,h;super(us,i);R(this,"initialData");R(this,"id",ge.HTTP_ENDPOINT);R(this,"version","1");R(this,"name",ge.HTTP_ENDPOINT);R(this,"description",us.description);R(this,"type",d.BuiltInBaseEntity);R(this,"abstract",us.abstract);R(this,"static",us.static);R(this,"properties",[]);R(this,"methods",[]);R(this,"abstractMethods",[]);R(this,"extends",null);R(this,"errors",[]);R(this,"project");this.initialData=us,this.project=i,this.id=us.id,this.version=us.version,this.name=us.name,this.static=us.static,this.abstract=us.abstract,this.properties=this.initialData.properties.map(m=>{const E=Ie(m,this.project);return E.setParent(this,null),E.initChildren(null),E}),this.methods=this.initialData.methods.map(m=>{const E=Ie(m,this.project);return E.parent=this,E}),this.abstractMethods=this.initialData.abstractMethods.map(m=>{const E=Ie(m,this.project);return E.parent=this,E}),this.initialData.extends&&(this.extends=Ie(this.initialData.extends,this.project));const r=this.properties.find(m=>m.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=(m,E)=>{var M;const b=e$(m,E),A=m.parent,_=A.properties.find(G=>G.implements.find(k=>k.id===re["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.properties.method.id)),P=(M=_==null?void 0:_.getDefaultValue())==null?void 0:M.value;if(m.project.entities.filter(G=>ui(G,ge.HTTP_ENDPOINT)&&G.id!==A.id).some(G=>{var le,ne;const k=G.properties.find(de=>de.implements.find(Y=>Y.id===re["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.properties.method.id));if(((le=k==null?void 0:k.getDefaultValue())==null?void 0:le.value)!==P)return!1;const K=G.properties.find(de=>de.implements.find(Y=>Y.id===re["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.properties.path.id));if(!K)throw new Error(`"Path" property not found in endpoint entity "${G.name}" (${G.id})`);return((ne=K.getDefaultValue())==null?void 0:ne.value)===E})){const G=new qi({id:m.id+"--"+xn.MustBeUniqueAmongSameEntities,message:`Path "${E}" is already in use by another endpoint with the ${P} method.`,severity:ve.Error,code:xn.MustBeUniqueAmongSameEntities,entity:m});b.errors.push(G)}return b};const a=this.properties.find(m=>m.id===re["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.properties.method.id);a&&(a._codeNativeValueValidation=(m,E)=>{var M;const b={errors:[],override:E},A=m.parent,_=A.properties.find(G=>G.implements.find(k=>k.id===re["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.properties.path.id)),P=(M=_==null?void 0:_.getDefaultValue())==null?void 0:M.value;if(m.project.entities.filter(G=>ui(G,ge.HTTP_ENDPOINT)&&G.id!==A.id).some(G=>{var le,ne;const k=G.properties.find(de=>de.implements.find(Y=>Y.id===re["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.properties.path.id));if(((le=k==null?void 0:k.getDefaultValue())==null?void 0:le.value)!==P)return!1;const K=G.properties.find(de=>de.implements.find(Y=>Y.id===re["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.properties.method.id));return((ne=K==null?void 0:K.getDefaultValue())==null?void 0:ne.value)===E})){const G=new qi({id:m.id+"--"+xn.MustBeUniqueAmongSameEntities,message:`Method "${E}" cannot be used because another endpoint is already using the ${E} method on path "${P}".`,severity:ve.Error,code:xn.MustBeUniqueAmongSameEntities,entity:m});b.errors.push(G)}return b});const c=this.abstractMethods.find(m=>m.id===re["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.methods.handler.id);if(!c)throw new Error("Handler method not found in endpoint entity");const e=(((h=(f=c.dataType)==null?void 0:f.entity)==null?void 0:h.properties)||[]).find(m=>m.id===re["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.methods.handler.dataType.entity.properties.statusCode.id);if(!e)throw new Error("Status code output not found in handler method");e._codeNativeValueValidation=(m,E)=>VVe(m,E)}}var HT=(s=>(s.InvalidCharacters="cron-invalid-characters",s.MustHaveSixFields="cron-must-have-six-fields",s.DayOfMonthAndWeekConflict="cron-day-of-month-and-week-conflict",s))(HT||{});function NVe(s,p){const i=[];let r=p;if(typeof p!="string"){const e=new qi({id:s.id+"--"+xn.ValueMustBeString,message:`Entity of type ${s.type} with id "${s.id}" has an invalid value. The cron expression must be a string.`,severity:ve.Error,code:xn.ValueMustBeString,entity:s});return i.push(e),{errors:i,override:""}}r=p.trimStart().replace(/\s{2,}/g," ");const a=/[^0-9A-Z *?\-/,LW#]/g;if(a.test(r)){const e=Array.from(new Set(r.match(a)));i.push(new qi({id:s.id+"--cron-invalid-characters",message:`Cron expression contains invalid characters: "${e.join(", ")}". Only alphanumeric characters and (* ? - / , L W #) are allowed.`,severity:ve.Error,code:"cron-invalid-characters",entity:s})),r=r.replace(a,"")}const c=r.split(" ").filter(Boolean);if(c.length!==6)i.push(new qi({id:s.id+"--cron-must-have-six-fields",message:`Elyx Cron expressions must have exactly 6 fields separated by spaces (Minutes, Hours, Day-of-month, Month, Day-of-week, Year). Currently has ${c.length}.`,severity:ve.Error,code:"cron-must-have-six-fields",entity:s}));else{const e=c[2],f=c[4];e!=="?"&&f!=="?"&&(i.push(new qi({id:s.id+"--cron-day-of-month-and-week-conflict",message:"Elyx restricts defining both Day-of-month and Day-of-week simultaneously. If you specify one, the other must be '?'",severity:ve.Error,code:"cron-day-of-month-and-week-conflict",entity:s})),e==="*"&&f==="*"&&(c[4]="?",r=c.join(" ")))}return{errors:i,override:r}}class xVe extends md{constructor(i){super(Gs,i);R(this,"initialData");R(this,"id",ge.CRON_JOB);R(this,"version","1");R(this,"name",ge.CRON_JOB);R(this,"description",Gs.description);R(this,"type",d.BuiltInBaseEntity);R(this,"abstract",Gs.abstract);R(this,"static",Gs.static);R(this,"properties",[]);R(this,"methods",[]);R(this,"abstractMethods",[]);R(this,"extends",null);R(this,"errors",[]);R(this,"project");this.initialData=Gs,this.project=i,this.id=Gs.id,this.version=Gs.version,this.name=Gs.name,this.static=Gs.static,this.abstract=Gs.abstract,this.properties=this.initialData.properties.map(a=>{const c=Ie(a,this.project);return c.setParent(this,null),c.initChildren(null),c}),this.methods=this.initialData.methods.map(a=>{const c=Ie(a,this.project);return c.parent=this,c}),this.abstractMethods=this.initialData.abstractMethods.map(a=>{const c=Ie(a,this.project);return c.parent=this,c}),this.initialData.extends&&(this.extends=Ie(this.initialData.extends,this.project));const r=this.properties.find(a=>a.id===re["built-in-base-entity"].BUILT_IN_CRON_JOB_ENTITY.properties.expression.id);if(!r)throw new Error("Expression property not found in cron job entity");r._codeNativeValueValidation=(a,c)=>NVe(a,c)}}class $Ve extends md{constructor(i){super(Sn,i);R(this,"initialData");R(this,"id",ge.RELATIONAL_DATABASE);R(this,"version","1");R(this,"name",ge.RELATIONAL_DATABASE);R(this,"description",Sn.description);R(this,"type",d.BuiltInBaseEntity);R(this,"abstract",Sn.abstract);R(this,"static",Sn.static);R(this,"properties",[]);R(this,"methods",[]);R(this,"abstractMethods",[]);R(this,"extends",null);R(this,"errors",[]);R(this,"project");this.initialData=Sn,this.project=i,this.id=Sn.id,this.version=Sn.version,this.name=Sn.name,this.static=Sn.static,this.abstract=Sn.abstract,this.properties=this.initialData.properties.map(a=>{const c=Ie(a,this.project);return c.setParent(this,null),c.initChildren(null),c}),this.methods=this.initialData.methods.map(a=>{const c=Ie(a,this.project);return c.parent=this,c}),this.abstractMethods=this.initialData.abstractMethods.map(a=>{const c=Ie(a,this.project);return c.parent=this,c}),this.initialData.extends&&(this.extends=Ie(this.initialData.extends,this.project));const r=this.properties.find(a=>a.id===re["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.identifier.id);if(!r)throw new Error("Path property not found in endpoint entity");r._codeNativeValueValidation=(a,c)=>_Ve(a,c)}}class LVe extends er{constructor(i){super(ha,i);R(this,"id",ha.id);R(this,"name",ha.name);R(this,"description",ha.description);R(this,"version",ha.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=ha.inputs.map(r=>{const a=Ie(r,this.project);return a.setParent(this,null),a.initChildren(null),a}),this.dataType=Ie(ha.dataType,this.project),this.dataType.setParent(this,null),this.dataType.initChildren(null),this.error=ha.error?Ie(ha.error,this.project):null}}var hs=(s=>(s.UUIDMustBeString="uuid-must-be-string",s.UUIDMustBeValidFormat="uuid-must-be-valid-format",s.UUIDMustNotContainSpaces="uuid-must-not-contain-spaces",s))(hs||{});function oIi(s,p){const i=[];if(typeof p!="string"){const a=new qi({id:s.id+"--uuid-must-be-string",message:`Entity of type ${s.type} with id "${s.id}" has an invalid value "${p}". The value must be text.`,severity:ve.Error,code:"uuid-must-be-string",entity:s});return i.push(a),{errors:i,override:p}}const r=e$(s,p);if(r.errors.length>0)return i.push(...r.errors),{errors:i,override:p};if(!Fx(p)){const a=new qi({id:s.id+"--uuid-must-be-valid-format",message:`Entity of type ${s.type} with id "${s.id}" has an invalid value "${p}". The value must be a valid UUID format. Eg: "123e4567-e89b-12d3-a456-426614174000".`,severity:ve.Error,code:"uuid-must-be-valid-format",entity:s});i.push(a)}return{errors:i,override:p}}var ke=(s=>(s.Inherited="inherited",s.DefaultValue="default-value",s.Missing="missing",s.Undefined="undefined",s.Empty="empty",s.AutoCalculated="auto-calculated",s.QueuedAutocalculation="queued-autocalculation",s.External="external",s.Testing="testing",s.ExecutionResult="execution-result",s))(ke||{});const BVe={initialized:!1,id:"",project:null,values:{},onWriteCallback:()=>{},onRemoveCallback:()=>{},onWrite:()=>{},onRemove:()=>{},init:()=>{},toJSON:()=>({}),writeValue:()=>{},readValue:()=>null,removeValue:()=>{},clear:()=>{}};function LT(s,p){return{...BVe,id:s,project:p}}class BT{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 Br(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=XVe(e,f,this.project);h?i[a]=h:delete p[a]}catch(f){J.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 Br)a=i;else if(i)a=lr(i,this.project);else{const c={id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:new Date().toISOString(),author:x.sessionAuthor,deleted:!1,previousVersion:null,value:null,deletable:!0,editable:!0,type:d.LiteralValue,standaloneParent:p.toReference(),parent:null,valueAsTypeSingle:null,valueAsTypeList:null,autogeneration:null,name:Jd(p.getDataType(null))};a=lr(c,this.project)}a.standalone=!0,a.initialData.standaloneParent||J.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 vr(s){return s!==null&&typeof s=="object"&&!Array.isArray(s)}function t$(s){if(Array.isArray(s))return s.map(h=>typeof h=="number"?h:e(h)?Number(h):String(h));const p=[];let i=0,r="",a=!1,c=null;for(;i<s.length;){const h=s[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<s.length){r+=s[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 A1(s,p,i){if(s==null)return i;const r=t$(p);let a=s;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 dIi=new Set(["__proto__","prototype","constructor"]);function MVe(s){return typeof s=="string"&&dIi.has(s)}function uIi(s,p,i,r){const{createMissing:a=!0,coerce:c=!0}=r??{};if(s==null||typeof s!="object")throw new TypeError("set(...) expects a non-null object as target.");const e=t$(p);if(e.length===0)throw new Error("set(...) path must not be empty.");let f=s;for(let h=0;h<e.length;h++){const m=e[h];if(MVe(m))throw new Error(`Refusing to set unsafe key "${String(m)}" on object.`);const E=h===e.length-1,A=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,s}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]=A?[]:{}}else{const P=f[m],V=P!==null&&typeof P=="object",M=Array.isArray(P);if(A){if(!M){if(!c)throw new Error(`set(...) expected an array at "${String(m)}" but found non-array (coerce=false).`);f[m]=[]}}else if(!V||M){if(!c)throw new Error(`set(...) expected an object at "${String(m)}" but found non-object (coerce=false).`);f[m]={}}}f=f[m]}}return s}function i$(s,p,i,r){const a=t$(p);if(a.length===0)return s;function c(e,f){const h=a[f],m=f===a.length-1;if(r==="strict-set"||r==="strict-delete"){if(MVe(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 A=typeof a[f+1]=="number",_=c(A?[]:{},f+1);return E[h]=_,E}return E[h]=c(b,f+1),E}if(s==null&&r==="safe-set"){const e=typeof a[0]=="number";return c(e?[]:{},0)}return c(s,0)}const Qj=Symbol("missing"),pIi=s=>s!=null&&typeof s=="object";function g1(s,p){if(typeof s!="string")throw new TypeError(`${p} expects the key to be a string.`);return s}function km(s,p){if(typeof s!="string"&&!Array.isArray(s))throw new TypeError(`${p} expects the path to be string or array.`);return s}function ny(s,p){if(!vr(s))throw new TypeError(`${p} expects the first argument to be an object.`);return s??{}}function GVe(s,p){const i=g1(p,"ReadKey");return(s??{})[i]}function kVe(s,p,i){const r=g1(p,"WriteKey");if(s&&typeof s=="object"){const a=Array.isArray(s)?[...s]:{...s};return a[r]=i,a}return{[r]:i}}function jVe(s,p){if(!s||typeof s!="object")return{};const i=String(p),{[i]:r,...a}=s;return a}function UVe(s,p,i){const r=ny(s,"ReadNestedKey"),a=km(p,"ReadNestedKey");return A1(r,a,i)}function FVe(s,p,i){const r=ny(s,"WriteNestedKey"),a=km(p,"WriteNestedKey");return i$(r,a,i,"strict-set")}function KVe(s,p,i){const r=ny(s,"WriteSafeNestedKeyRecursively"),a=km(p,"WriteSafeNestedKeyRecursively");return i$(r,a,i,"safe-set")}function qVe(s,p){const i=ny(s,"DeleteNestedKey"),r=km(p,"DeleteNestedKey");return i$(i,r,null,"strict-delete")}function SVe(s,p){const i=g1(p,"HasKey"),r=s;return r!=null&&pIi(r)&&Object.prototype.hasOwnProperty.call(r,i)}function ZVe(s,p,i){const r=g1(p,"KeyValueEquals");return s==null||typeof s!="object"?!1:s[r]===i}function HVe(s,p){const i=s,r=km(p,"HasNestedKey");return A1(i,r,Qj)!==Qj}function WVe(s,p,i){const r=km(p,"NestedKeyValueEquals");return A1(s,r)===i}function zVe(...s){const p={};for(let i=0;i<s.length;i++){const r=s[i];if(r!=null){if(!vr(r))throw new TypeError("MergeObjects expects every argument to be an object (or null/undefined).");Object.assign(p,r)}}return p}function YVe(s){const p=ny(s,"ObjectKeys");return Object.keys(p)}function JVe(s){const p=ny(s,"ObjectValues");return Object.values(p)}function QVe(s){const p=ny(s,"ObjectEntries");return Object.entries(p)}const Th=new Set;function cIi(s){return{execution:null,project:s,localTestValues:LT("local-test-values",s),resolvedValues:LT("resolved-values",s),persistedExecutionResults:LT("persisted-execution-results",s),lastExecutionResults:LT("last-execution-results",s),getValueTypePreference:()=>null,setValueTypePreference:()=>{}}}function Fu(s,p,i,r){var f;let a;if(((f=s==null?void 0:s.entity)==null?void 0:f.type)===d.PrimitiveEntity)switch(s.entity.name){case fe.EntityTemplate:a=fe.EntityTemplate;break;case fe.String:a=fe.String;break;case fe.Number:a=fe.Number;break;case fe.Boolean:a=fe.Boolean;break;case fe.Null:a=fe.Null;break;case fe.Enum:a=fe.Enum;break;case fe.KeyValue:a=fe.KeyValue;break;case fe.Untyped:a=fe.Untyped;break;case fe.KeyValue:a=fe.KeyValue;break;case fe.Date:a=fe.Date;break;case fe.UUID:a=fe.UUID;break;case fe.File:a=fe.File;break;case fe.Void:a=fe.Void;break;case fe.ActionDescriptor:a=fe.ActionDescriptor;break;case fe.Bytes:a=fe.Bytes;break;case fe.SqlProgram:a=fe.SqlProgram;break;default:throw new Error(`Primitive type ${Lt(s.entity,i)} is not supported`)}else a=fe.Untyped;const c=Br.new(r);c.name=a,c.parent=p.toReference();const e=Ie(c,i);return e.hydrateAncestors(),r==null||r.add(e,H.Added),e.addSelfToProject(r),e.initChildren(r),e}function ud(s,p,i=new Set){var r,a,c,e;if(i.has(s.id))return[];if(i.add(s.id),Mt.includes(s.type)){const f=Er(s);return C([f,...[f].flatMap(h=>ud(h,p,i))])}else if(s.type===d.OutputMap){if(Mt.includes(s.parent.type)&&((r=s.declaration)==null?void 0:r.type)===d.Property&&s.declaration.static)return C([s,s.declaration,...[s,s.declaration].flatMap(f=>ud(f,p,i))])}else if(s.type===d.InputMap){if(Mt.includes(s.parent.type)&&((a=s.declaration)==null?void 0:a.type)===d.Property&&((c=s.declaration)!=null&&c.static))return C([s.declaration,...[s.declaration].flatMap(f=>ud(f,p,i))])}else if(s.type===d.ValueDescriptor&&((e=s.parent)==null?void 0:e.type)===d.Search){const f=s.parent.inputs.find(h=>{var m;return((m=h.declaration)==null?void 0:m.id)===s.id});if(f)return[f]}return[s]}function XVe(s,p,i){return s}function jm(s,p,i=!1){const r=s.readsValue;let a=null;const c=iu(r,p,i);if(c){const e={sources:[c],target:s};a={value:c.value,valueOwner:s,type:ke.Inherited,inheritanceLink:e}}else a={value:null,valueOwner:s,type:ke.Inherited,inheritanceLink:null};return a}function Ht(s,p,i){var f;if(!p)return null;let r;if(((f=s==null?void 0:s.entity)==null?void 0:f.type)===d.PrimitiveEntity)switch(s.entity.name){case fe.EntityTemplate:r=fe.EntityTemplate;break;case fe.String:r=fe.String;break;case fe.Number:r=fe.Number;break;case fe.Boolean:r=fe.Boolean;break;case fe.Null:r=fe.Null;break;case fe.Enum:r=fe.Enum;break;case fe.KeyValue:r=fe.KeyValue;break;case fe.Untyped:r=fe.Untyped;break;case fe.KeyValue:r=fe.KeyValue;break;case fe.Date:r=fe.Date;break;case fe.UUID:r=fe.UUID;break;case fe.File:r=fe.File;break;case fe.Void:r=fe.Void;break;case fe.ActionDescriptor:r=fe.ActionDescriptor;break;case fe.Bytes:r=fe.Bytes;break;case fe.SqlProgram:r=fe.SqlProgram;break;default:throw new Error(`Primitive type ${Lt(s.entity,i)} is not supported`)}else r=fe.Untyped;if(!i.get(p.id))return null;const c=Br.new(null);c.name=r,c.standaloneParent=p.toReference();let e=new Br(c,i);return e.hydrateAncestors(),e.standalone=!0,e.setStandaloneParent(p,null),e.initChildren(null),e}function ePe(s,p,i=!1){var c,e;if(p.execution&&p.execution.hasEntity(s)&&!i){const f=(c=p.lastExecutionResults)==null?void 0:c.readValue(s.id);if(f)return{value:f,valueOwner:s,type:ke.ExecutionResult,inheritanceLink:null}}const r=(e=p.localTestValues)==null?void 0:e.readValue(s.id),a=p.getValueTypePreference(s.id);return r&&!i&&(a===null||a!==ke.DefaultValue)?{value:r,valueOwner:s,type:ke.Testing,inheritanceLink:null}:{value:null,valueOwner:s,type:ke.QueuedAutocalculation,inheritanceLink:null}}function hg(s,p,i,r=!1){var e,f;const a={...s},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(!ab(h))continue;const m=R1(h,i,r);if(m&&m.value)try{const E=pe(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}catch{}}return a}function MT(s,p,i,r=!1){var e,f;const a={...s},c=p.inputs;if(!c)return a;for(const h of c){if(!ab(h))continue;const m=wE(h,i,r);if(m&&m.value){const E=Lt(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 tPe(s,p,i=!1){var E,b,A,_,P,V,M,G;let r={};if(((b=(E=s.getDataType(null))==null?void 0:E.entity)==null?void 0:b.type)===d.DefinitionEntity&&(r={...r,...((A=s.getDataType(null))==null?void 0:A.entity).getActiveRawDefaultValue()}),p.execution&&p.execution.hasEntity(s)&&!i){const k=(_=p.lastExecutionResults)==null?void 0:_.readValue(s.id);if(k){if(vr(k.value)){const le={...r,...k.value},ne={...MT(le,s,p,i)};k.metaSync({value:ne},null)}return{value:k,valueOwner:s,type:ke.ExecutionResult,inheritanceLink:null}}}const a=!!((P=p.execution)!=null&&P.entities.length),c=(V=p.execution)==null?void 0:V.hasEntity(s),e=s.readsValue;let f=null;if(e){const k=(M=p.execution)==null?void 0:M.hasEntity(e);if((!a||a&&k&&c||a&&!k&&!c)&&(f=jm(s,p,i),f&&f.value&&vr(f.value.value))){const le={...r,...f.value.value},ne={...MT(le,s,p,i)};f.value.metaSync({value:ne},null)}}const h=s.defaultValue,m=p.getValueTypePreference(s.id);if(!f&&h){const k=h;if(k&&k.value===null&&k.autogeneration){const K=ID(k);if(k.metaSync({value:K},null),vr(K)){const le={...MT(K,s,p,i)};k.metaSync({value:le},null)}}(i||m===null||m!==ke.Testing)&&(f={value:k,valueOwner:s,type:Pn(k)?s.readsValue?ke.Inherited:ke.Empty:ke.DefaultValue,inheritanceLink:null})}if(!f||(f.type===ke.DefaultValue||f.type===ke.External)&&!i||m===ke.Testing){const k=(G=p.localTestValues)==null?void 0:G.readValue(s.id);if(k){if(vr(k.value)){const K={...r,...k.value},le={...MT(K,s,p,i)};k.metaSync({value:le},null)}return{value:k,valueOwner:s,type:ke.Testing,inheritanceLink:null}}}return Pn((f==null?void 0:f.value)||null)?{value:null,valueOwner:s,type:s.readsValue?ke.Inherited:ke.Empty,inheritanceLink:null}:f}function r$(s,p,i=!1){var f,h,m,E,b,A,_,P,V,M,G,k,K,le,ne,de,Y;let r={};if(((h=(f=s.getDataType(null))==null?void 0:f.entity)==null?void 0:h.type)===d.DefinitionEntity?r={...r,...((m=s.getDataType(null))==null?void 0:m.entity).getActiveRawDefaultValue()}:((b=(E=s.getDataType(null))==null?void 0:E.entity)==null?void 0:b.type)===d.BuiltInBaseEntity&&(r={...r,...((A=s.getDataType(null))==null?void 0:A.entity).getRawDefaultValue()}),p.execution&&p.execution.hasEntity(s)&&!i){const te=(_=p.lastExecutionResults)==null?void 0:_.readValue(s.id);if(te){if(vr(te.value)){const Q={...r,...te.value},z=hg(Q,s,p,i);te==null||te.metaSync({value:z},null)}return{value:te,valueOwner:s,type:ke.ExecutionResult,inheritanceLink:null}}}const a=(P=p.localTestValues)==null?void 0:P.readValue(s.id);let c=!1;if(s.type===d.VariableDeclaration){const te=s,oe=!!((V=p.execution)!=null&&V.entities.length),Q=(M=p.execution)==null?void 0:M.hasEntity(s),z=te.readsValue;if(z){const se=(G=p.execution)==null?void 0:G.hasEntity(z);c=!oe||oe&&se&&Q||oe&&!se&&!Q}}const e=p.getValueTypePreference(s.id);if(a&&!i&&(!c||e===ke.Testing)){if(vr(a.value)){const oe={...r,...a.value},Q=hg(oe,s,p,i);a.metaSync({value:Q},null)}return{value:a,valueOwner:s,type:ke.Testing,inheritanceLink:null}}if((k=s.getDataType(null))!=null&&k.entity&&(((le=(K=s.getDataType(null))==null?void 0:K.entity)==null?void 0:le.type)===d.DefinitionEntity||((de=(ne=s.getDataType(null))==null?void 0:ne.entity)==null?void 0:de.type)===d.BuiltInBaseEntity)&&((Y=s.getDataType(null))!=null&&Y.isObject())){const te=Ht(s.dataType,s,p.project),oe=hg(r,s,p,i);return te==null||te.metaSync({value:oe},null),{value:te,valueOwner:s,type:ke.DefaultValue,inheritanceLink:null}}return null}function I1(s,p,i=!1){var E,b,A,_,P;if((E=s.dataType)!=null&&E.isObject())return tPe(s,p,i);const r=Tt(s),a=!!((b=p.execution)!=null&&b.entities.length),c=(A=p.execution)==null?void 0:A.hasEntity(r),e=s.readsValue;let f=null;if(e){const V=(_=p.execution)==null?void 0:_.hasEntity(e);(!a||a&&V&&c||a&&!V&&!c)&&(f=jm(s,p,i))}const h=s.defaultValue,m=p.getValueTypePreference(s.id);if(!f&&h){const V=h;if(V&&V.value===null&&V.autogeneration){const M=ID(V);V.metaSync({value:M},null)}(i||m===null||m!==ke.Testing)&&(f={value:V,valueOwner:s,type:Pn(V)?s.readsValue?ke.Inherited:ke.Empty:ke.DefaultValue,inheritanceLink:null})}if(!f||(f.type===ke.DefaultValue||f.type===ke.External)&&!i||m===ke.Testing){const V=(P=p.localTestValues)==null?void 0:P.readValue(s.id);if(V)return{value:V,valueOwner:s,type:ke.Testing,inheritanceLink:null}}return Pn((f==null?void 0:f.value)||null)?{value:null,valueOwner:s,type:s.readsValue?ke.Inherited:ke.Empty,inheritanceLink:null}:f}function n$(s,p,i=!1){var a,c;if((a=s.dataType)!=null&&a.isObject()||s.outputs.length)return r$(s,p,i);if(p.execution&&p.execution.hasEntity(s)&&!i){const e=(c=p.lastExecutionResults)==null?void 0:c.readValue(s.id);if(e)return{value:e,valueOwner:s,type:ke.ExecutionResult,inheritanceLink:null}}return I1(s,p,i)}function iPe(s,p,i=!1){var A,_,P,V;const r=!!((A=p.execution)!=null&&A.entities.length),a=(_=p.execution)==null?void 0:_.hasEntity(s);let c=null;const e=s.readsValue;if(e){const M=(P=p.execution)==null?void 0:P.hasEntity(e);(!r||r&&M&&a||r&&!M&&!a)&&(c=jm(s,p,i))}const f=s.declaration;if(!c&&f){const M=I1(f,p,i);M&&M.value&&(c=M)}const h=p.getValueTypePreference(s.id);if(!c||(c.type===ke.DefaultValue||c.type===ke.External)&&!i||h===ke.Testing){const M=(V=p.localTestValues)==null?void 0:V.readValue(s.id);if(M)return{value:M,valueOwner:s,type:ke.Testing,inheritanceLink:null}}const m=fu(s),E=s.getDataType(null);return m&&a&&(!(c!=null&&c.value)||!Ka(E)&&pu(c==null?void 0:c.value))?{value:null,valueOwner:s,type:ke.Missing,inheritanceLink:null}:a&&!m&&Pn((c==null?void 0:c.value)||null)?{value:null,valueOwner:s,type:s.readsValue?ke.Inherited:ke.Empty,inheritanceLink:null}:c||{value:null,valueOwner:s,type:ke.External,inheritanceLink:null}}function rPe(s,p,i=!1){return n$(s.declaration,p,i)}function nPe(s,p,i=!1){var _,P,V,M;if(!i&&p.execution&&p.execution.hasEntity(s)){const G=(_=p.lastExecutionResults)==null?void 0:_.readValue(s.id);if(G)return{value:G,valueOwner:s,type:ke.ExecutionResult,inheritanceLink:null}}const r=!p.execution||!p.execution.parentExecution,a=p.getValueTypePreference(s.id);if(r){const G=(P=p.localTestValues)==null?void 0:P.readValue(s.id);if(G&&!i&&(a===null||a!==ke.DefaultValue))return{value:G,valueOwner:s,type:ke.Testing,inheritanceLink:null}}const c=Tt(s),e=s.parent.type===d.FunctionDeclaration&&s.parent.parent.type===d.Loop?s.parent:null,f=!!((V=p.execution)!=null&&V.hasEntity(c))||!!e&&!!((M=p.execution)!=null&&M.hasEntity(e));let h=null;const m=s.defaultValue;if(m){const G=m||null;if(G&&G.value===null&&G.autogeneration){const k=ID(G);G.metaSync({value:k},null)}(i||a===null||a!==ke.Testing)&&(h={value:G,valueOwner:s,type:Pn(G)?ke.Empty:ke.DefaultValue,inheritanceLink:null})}!h||(h.type===ke.DefaultValue||h.type===ke.External)&&!i||ke.Testing;const E=fu(s),b=s.getDataType(null);let A=E&&f&&(!(h!=null&&h.value)||!Ka(b)&&pu(h==null?void 0:h.value));return c.type===d.Loop&&f&&(A=!1),A?{value:null,valueOwner:s,type:ke.Missing,inheritanceLink:null}:f&&!E&&Pn((h==null?void 0:h.value)||null)?{value:null,valueOwner:s,type:ke.Empty,inheritanceLink:null}:h||{value:null,valueOwner:s,type:ke.External,inheritanceLink:null}}function a$(s,p,i=!1){var _,P,V,M,G,k;if((_=s.getDataType(null))!=null&&_.isObject()||s.outputs.length)return r$(s,p);if(p.execution&&p.execution.hasEntity(s)&&!i){const K=(P=p.lastExecutionResults)==null?void 0:P.readValue(s.id);if(K)return{value:K,valueOwner:s,type:ke.ExecutionResult,inheritanceLink:null}}const r=Tt(s),a=!!((V=p.execution)!=null&&V.entities.length),c=(M=p.execution)==null?void 0:M.hasEntity(r),e=s.readsValue;let f=null;if(e){const K=(G=p.execution)==null?void 0:G.hasEntity(e);(!a||a&&K&&c||a&&!K&&!c)&&(f=jm(s,p,i))}const h=s.defaultValue,m=p.getValueTypePreference(s.id);if(!f&&h){const K=h;(i||m===null||m!==ke.Testing)&&(f={value:K,valueOwner:s,type:ke.DefaultValue,inheritanceLink:null})}if(!f||(f.type===ke.DefaultValue||f.type===ke.External)&&!i||m===ke.Testing){const K=(k=p.localTestValues)==null?void 0:k.readValue(s.id);if(K)return{value:K,valueOwner:s,type:ke.Testing,inheritanceLink:null}}const E=fu(s),b=s.getDataType(null);return E&&(!(f!=null&&f.value)||!Ka(b)&&pu(f==null?void 0:f.value))?{value:null,valueOwner:s,type:ke.Missing,inheritanceLink:null}:!s.defaultValue&&!s.readsValue?{value:null,valueOwner:s,type:ke.Undefined,inheritanceLink:null}:!E&&Pn((f==null?void 0:f.value)||null)?{value:null,valueOwner:s,type:s.readsValue?ke.Inherited:ke.Empty,inheritanceLink:null}:f}function aPe(s,p,i=!1){var e,f,h,m,E,b;if(p.execution&&p.execution.hasEntity(s)&&!i){const A=(e=p.lastExecutionResults)==null?void 0:e.readValue(s.id);if(A)return{value:A,valueOwner:s,type:ke.ExecutionResult,inheritanceLink:null}}const r=Kp(s);if(Cp.includes(r.type)){const A=iu(r,p,i),_=s.codeName||((f=s.declaration)==null?void 0:f.codeName)||ir(Lt(s,p.project));if(A!=null&&A.value&&s.parentRelationType!==ks.Error){const P=(A.value.value||{})[_];if(P===void 0)return{value:null,valueOwner:s,type:ke.Undefined,inheritanceLink:null};const V=Ht(s.getDataType(null),s,p.project);return V==null||V.metaSync({value:P},null),{value:V,valueOwner:s,type:!Mt.includes(r.type)&&A.type===ke.Empty?ke.QueuedAutocalculation:A.type,inheritanceLink:{sources:[A],target:s}}}return{value:null,valueOwner:s,type:Mt.includes(r.type)?ke.Empty:ke.QueuedAutocalculation,inheritanceLink:null}}const a=(h=p.execution)==null?void 0:h.hasEntity(r),c=((m=p.execution)==null?void 0:m.state)===g$.Running;if((E=p.persistedExecutionResults)!=null&&E.values[s.id]&&!a&&!c&&!i){const A=(b=p.persistedExecutionResults)==null?void 0:b.readValue(s.id);if((A==null?void 0:A.value)!==null||(A==null?void 0:A.valueAsType)!==null)return{value:A,valueOwner:s,type:ke.ExecutionResult,inheritanceLink:null}}return null}function F_(s,p,i=!1){var b,A,_;if(![...Dt,...Mt].includes(s.parent.type)||!ab(s))return null;if(((b=s.declaration)==null?void 0:b.type)===d.Property&&s.declaration.static)return iu(s.declaration,p);const r=wE(s,p,i);if(r&&r.type!==ke.Empty&&r.type!==ke.Missing&&r.type!==ke.Undefined)return r;const a=Er(s.parent),c=to(a,p,i),e=s.codeName||((A=s.declaration)==null?void 0:A.codeName)||ir(Lt(s,p.project)),f=Ht(s.getDataType(null),s,p.project),h=fu(s),m=(_=c==null?void 0:c.value)==null?void 0:_.value;if(m){let P=(m||{})[e];if(m[e]===void 0)return{value:null,valueOwner:s,type:ke.Undefined,inheritanceLink:{sources:c?[c]:[],target:s}};f==null||f.metaSync({value:P},null);const V=fu(s),M=s.getDataType(null);return V&&(!f||!Ka(M)&&pu(f))?{value:null,valueOwner:s,type:ke.Missing,inheritanceLink:null}:{value:f,valueOwner:s,type:c.type,inheritanceLink:{sources:c?[c]:[],target:s}}}return c!=null&&c.type&&c.type!==ke.Missing&&c.type!==ke.Empty&&c.type!==ke.Undefined?{value:null,valueOwner:s,type:c.type,inheritanceLink:{sources:c?[c]:[],target:s}}:h?{value:null,valueOwner:s,type:ke.Missing,inheritanceLink:null}:{value:null,valueOwner:s,type:s.readsValue?ke.Inherited:ke.Empty,inheritanceLink:null}}function K_(s,p,i=!1){var E,b,A,_,P,V,M;if(![...Dt,...Mt].includes(s.parent.type)||!ab(s))return null;if(((E=s.declaration)==null?void 0:E.type)===d.Property&&s.declaration.static)return iu(s.declaration,p,i);const r=Dt.includes(s.parent.type)?s.parent:Er(s.parent),a=iu(r,p,i);let c=s;r.type===d.VariableDeclaration&&(c=(s.parent===r?s:r.inputs.find(k=>{var K,le;return((K=k.declaration)==null?void 0:K.id)===((le=s.declaration)==null?void 0:le.id)}))||s);const e=R1(c,p,i),f=s.codeName||((b=s.declaration)==null?void 0:b.codeName)||ir(Lt(s,p.project)),h=s.defaultValue||Ht(s.getDataType(null),s,p.project),m=(A=a==null?void 0:a.value)==null?void 0:A.value;if(((a==null?void 0:a.type)===ke.ExecutionResult||(a==null?void 0:a.type)===ke.Testing)&&!i&&m){let G=(m||{})[f];return m[f]===void 0&&!s.readsValue&&!s.defaultValue?{value:null,valueOwner:s,type:ke.Undefined,inheritanceLink:{sources:a?[a]:[],target:s}}:(h==null||h.metaSync({value:G},null),{value:h,valueOwner:s,type:a.type,inheritanceLink:{sources:a?[a]:[],target:s}})}if(e&&e.type!==ke.Empty&&e.type!==ke.Missing&&e.type!==ke.Undefined)return e;if(m){let G=(m||{})[f];m[f]!==void 0&&(h!=null&&h.standaloneParent)&&(h==null||h.metaSync({value:G},null));const k=fu(s),K=s.getDataType(null),le=k&&(!h||!Ka(K)&&pu(h)),ne=!!((_=p.execution)!=null&&_.entities.length),de=(P=p.execution)==null?void 0:P.hasEntity(r),Y=r.readsValue;if(Y){const te=(V=p.execution)==null?void 0:V.hasEntity(Y);if(le&&(!ne||ne&&te&&de||ne&&!te&&!de))return{value:null,valueOwner:s,type:ke.Inherited,inheritanceLink:null}}if(s.readsValue){const te=(M=p.execution)==null?void 0:M.hasEntity(s.readsValue);if(le&&(!ne||ne&&te&&de||ne&&!te&&!de))return{value:null,valueOwner:s,type:ke.Inherited,inheritanceLink:null}}return le?{value:null,valueOwner:s,type:ke.Missing,inheritanceLink:null}:m[f]===void 0&&!s.readsValue&&!s.defaultValue?{value:null,valueOwner:s,type:ke.Undefined,inheritanceLink:{sources:a?[a]:[],target:s}}:{value:h,valueOwner:s,type:Pn(h)&&!s.readsValue?ke.Empty:ke.Inherited,inheritanceLink:null}}return{value:null,valueOwner:s,type:ke.Undefined,inheritanceLink:null}}function wE(s,p,i=!1){var V,M,G,k,K;const r=Tt(s),a=!!((V=p.execution)!=null&&V.entities.length),c=(M=p.execution)==null?void 0:M.hasEntity(r),e=s.readsValue;let f=null,h=!1;if(e){const le=(G=p.execution)==null?void 0:G.hasEntity(e);h=!a||a&&le&&c||a&&!le&&!c,h&&(f=jm(s,p,i))}const m=!!e&&h,E=s.defaultValue,b=p.getValueTypePreference(s.id);if(!f&&E&&(i||b===null||b!==ke.Testing)&&(f={value:E,valueOwner:s,type:pu(E)?ke.Empty:ke.DefaultValue,inheritanceLink:null}),(!f||f.type===ke.DefaultValue||(f==null?void 0:f.type)===ke.Empty||b===ke.Testing)&&!m){const le=(k=p.persistedExecutionResults)==null?void 0:k.readValue(s.id);if(le&&!i)return{value:le,valueOwner:s,type:ke.Testing,inheritanceLink:null};const ne=(K=p.localTestValues)==null?void 0:K.readValue(s.id);if(ne&&!i&&(b===null||b===ke.Testing))return{value:ne,valueOwner:s,type:ke.Testing,inheritanceLink:null}}const A=fu(s),_=s.getDataType(null),P=A&&(!(f!=null&&f.value)||!Ka(_)&&pu(f==null?void 0:f.value));return m&&P?{value:null,valueOwner:s,type:ke.Inherited,inheritanceLink:null}:P?{value:null,valueOwner:s,type:ke.Missing,inheritanceLink:(f==null?void 0:f.inheritanceLink)||null}:!f&&!s.defaultValue&&!m?{value:null,valueOwner:s,type:ke.Undefined,inheritanceLink:null}:!A&&(!f||f.type===ke.Inherited)&&!(f!=null&&f.inheritanceLink)?{value:null,valueOwner:s,type:m?ke.Inherited:ke.Empty,inheritanceLink:null}:f}function R1(s,p,i=!1){var a;if(p.execution&&p.execution.hasEntity(s)&&!i){const c=(a=p.lastExecutionResults)==null?void 0:a.readValue(s.id);if(c)return{value:c,valueOwner:s,type:ke.ExecutionResult,inheritanceLink:null}}return wE(s,p,i)}function sPe(s,p,i=!1){var r,a;return Mt.includes(s.parent.type)&&(r=Er(s.parent).dataType)!=null&&r.isObject()||Dt.includes(s.parent.type)&&(a=s.parent.getDataType(null))!=null&&a.isObject()?F_(s,p,i):wE(s,p,i)}function s$(s,p,i=!1){var r,a;if(Mt.includes(s.parent.type)){const c=Er(s.parent);if((r=c.dataType)!=null&&r.isObject()||c.inputs.length)return K_(s,p,i)}return Dt.includes(s.parent.type)&&((a=s.parent.getDataType(null))!=null&&a.isObject()||s.parent.outputs.length)?K_(s,p,i):R1(s,p,i)}function lPe(s,p,i=!1){var E,b;if(!s.static)return null;if(p.execution){const A=(E=p.lastExecutionResults)==null?void 0:E.readValue(s.id);if(A&&!i)return{value:A,valueOwner:s,type:ke.ExecutionResult,inheritanceLink:null}}const r=!p.execution||!p.execution.parentExecution,a=p.getValueTypePreference(s.id);if(r){const A=(b=p.localTestValues)==null?void 0:b.readValue(s.id);if(A&&!i&&(a===null||a!==ke.DefaultValue))return{value:A,valueOwner:s,type:ke.Testing,inheritanceLink:null}}const c=s.defaultValue;let e=null;c&&(i||a===null||a!==ke.Testing)&&(e={value:c,valueOwner:s,type:ke.DefaultValue,inheritanceLink:null});const f=fu(s),h=s.getDataType(null);return f&&(!(e!=null&&e.value)||!Ka(h)&&pu(e==null?void 0:e.value))?{value:null,valueOwner:s,type:ke.Missing,inheritanceLink:null}:Pn(e==null?void 0:e.value)?{value:null,valueOwner:s,type:ke.Empty,inheritanceLink:null}:e}function oPe(s,p,i=!1){var f,h,m;if(p.execution&&p.execution.hasEntity(s)&&!i){const E=(f=p.lastExecutionResults)==null?void 0:f.readValue(s.id);if(E)return{value:E,valueOwner:s,type:ke.ExecutionResult,inheritanceLink:null}}const r=!p.execution||!p.execution.parentExecution,a=p.getValueTypePreference(s.id);if(r){const E=(h=p.localTestValues)==null?void 0:h.readValue(s.id);if(E&&!i&&(a===null||a!==ke.DefaultValue))return{value:E,valueOwner:s,type:ke.Testing,inheritanceLink:null}}const c=s.defaultValue;let e=null;if(c&&(i||a===null||a!==ke.Testing)&&(e={value:c,valueOwner:s,type:ke.DefaultValue,inheritanceLink:null}),((m=s.parent)==null?void 0:m.type)===d.Search){const E=s.parent.inputs.find(b=>{var A;return((A=b.declaration)==null?void 0:A.id)===s.id});if(E)return s$(E,p,i)}return Pn((e==null?void 0:e.value)||null)?{value:null,valueOwner:s,type:ke.Empty,inheritanceLink:null}:e}function iu(s,p,i=!1){if(Th.has(s.id))return{value:null,valueOwner:s,type:ke.Undefined,inheritanceLink:null};Th.add(s.id);try{switch(s.type){case d.ArgumentDeclaration:return nPe(s,p,i);case d.InputMap:return s$(s,p,i);case d.VariableDeclaration:return n$(s,p,i);case d.VariableInstance:return rPe(s,p,i);case d.OutputMap:return aPe(s,p,i);case d.ReturnStatement:case d.BreakStatement:case d.ContinueStatement:return a$(s,p,i);case d.Property:return lPe(s,p,i);case d.ValueDescriptor:return oPe(s,p,i);case d.Operation:case d.FunctionCall:case d.InternalCall:case d.Search:return ePe(s,p,i);default:return null}}finally{Th.delete(s.id)}}function to(s,p,i=!1){if(Th.has(s.id))return{value:null,valueOwner:s,type:ke.Undefined,inheritanceLink:null};Th.add(s.id);try{switch(s.type){case d.InputMap:return sPe(s,p,i);case d.VariableDeclaration:return I1(s,p,i);case d.VariableInstance:return iPe(s,p,i);case d.ReturnStatement:case d.BreakStatement:case d.ContinueStatement:return a$(s,p,i);default:return null}}finally{Th.delete(s.id)}}function fIi(s){var p;if(s&&s.type===ke.DefaultValue&&s.value&&s.valueOwner&&(!hI.includes(s.valueOwner.type)||((p=s.valueOwner.defaultValue)==null?void 0:p.id)===s.value.id)){const i=Ht(s.valueOwner.getDataType(null),s.valueOwner,s.valueOwner.project);return{type:ke.DefaultValue,value:i,valueOwner:s.valueOwner,inheritanceLink:null}}return s}function Rf(s,p,i,r){let a=!1,c=null,e=null;r instanceof S?(a=!0,c=r,e=null):(c=null,e=r);const f=s.parent;return p.getVariableDeclarations().forEach(m=>{var b,A,_,P,V,M;const E=m.getDataType(null);if(((b=E==null?void 0:E.entity)==null?void 0:b.id)===f.id){let G=a?m.defaultValue:e==null?void 0:e.readValue(m.id);G?!a&&G&&G.id===((A=m.defaultValue)==null?void 0:A.id)&&(G=Ht(m.getDataType(null),m,p)):a?G=Fu(m.getDataType(null),m,p,c):G=Ht(m.getDataType(null),m,p);const k=Lt(s,p),K=s.codeName||((_=s.extends)==null?void 0:_.codeName)||((P=s.implements[0])==null?void 0:P.codeName)||ir(k);let le={};((M=(V=m.dataType)==null?void 0:V.entity)==null?void 0:M.type)===d.DefinitionEntity&&(le={...le,...m.dataType.entity.getActiveRawDefaultValue()}),vr(G==null?void 0:G.value)&&(le={...le,...G.value}),le[K]=i,G==null||G.metaSync({value:le},c),a||e==null||e.writeValue(m,G);return}}),c}function nv(s,p,i,r){var _,P,V,M;let a=!1,c=null,e=null;r instanceof S?(a=!0,c=r,e=null):(c=null,e=r);const f=Er(s.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=Ht(f.getDataType(null),f,p)):a?m=Fu(f.getDataType(null),f,p,c):m=Ht(f.getDataType(null),f,p);const E=Lt(s,p),b=s.codeName||((P=s.declaration)==null?void 0:P.codeName)||ir(E);let A={};if(((M=(V=f.dataType)==null?void 0:V.entity)==null?void 0:M.type)===d.DefinitionEntity&&(A={...A,...f.dataType.entity.getActiveRawDefaultValue()}),vr(m==null?void 0:m.value)&&(A={...A,...m.value}),A[b]=i,m==null||m.metaSync({value:A},c),a||e==null||e.writeValue(f,m),(i===""||i===null||i===void 0)&&s.type===d.OutputMap){const G=f.inputs.find(k=>{var K,le;return((K=k.declaration)==null?void 0:K.id)===((le=s.declaration)==null?void 0:le.id)||Lt(k,p)===E});if(G){let k=a?G.defaultValue:e==null?void 0:e.readValue(G.id);k&&k.metaSync({value:null},c),a||e==null||e.removeValue(G.id)}}return c}function dPe(s,p,i){var e,f,h,m,E;let r=!1,a=null,c=null;if(i instanceof S?(r=!0,a=i,c=null):(a=null,c=i),Mt.includes(s.type)){const b=Er(s);(e=b.dataType)!=null&&e.isObject()&&b.inputs.forEach(A=>{var _,P,V,M,G,k;if(((_=A.declaration)==null?void 0:_.type)===d.Property&&A.declaration.static){let K=r?((P=A.getDefaultValue)==null?void 0:P.call(A))||null:c==null?void 0:c.readValue(A.declaration.id);K?!r&&K&&K.id===((V=A.declaration.defaultValue)==null?void 0:V.id)&&(K=Ht(A.declaration.getDataType(null),A.declaration,p)):r?K=Fu(A.declaration.getDataType(null),A.declaration,p,a):K=Ht(A.declaration.getDataType(null),A.declaration,p),K==null||K.metaSync({value:null},a),r||c==null||c.removeValue((M=A.declaration)==null?void 0:M.id)}else if(((G=A.declaration)==null?void 0:G.type)===d.Property){let K=r?((k=A.getDefaultValue)==null?void 0:k.call(A))||null:c==null?void 0:c.readValue(A.id);K&&K.metaSync({value:null},a),r||c==null||c.removeValue(A.id)}})}else s.type===d.InputMap?((f=s.declaration)==null?void 0:f.type)===d.Property&&s.declaration.static?Rf(s.declaration,p,null,i):Mt.includes(s.parent.type)&&((h=s.declaration)==null?void 0:h.type)===d.Property&&nv(s,p,null,i):s.type===d.OutputMap?((m=s.declaration)==null?void 0:m.type)===d.Property&&s.declaration.static?Rf(s.declaration,p,null,i):Mt.includes(s.parent.type)&&((E=s.declaration)==null?void 0:E.type)===d.Property&&nv(s,p,null,i):s.type===d.Property&&s.static&&Rf(s,p,null,i);return a}function uPe(s,p,i,r){var f,h,m,E,b,A,_;let a=!1,c=null,e=null;if(r instanceof S?(a=!0,c=r,e=null):(c=null,e=r),Mt.includes(p.type)){const P=Er(p);if((f=P.dataType)!=null&&f.isObject()){let V={};((m=(h=P.dataType)==null?void 0:h.entity)==null?void 0:m.type)===d.DefinitionEntity&&(V={...V,...P.dataType.entity.getActiveRawDefaultValue()});const M=vr(s)?s:V;P.inputs.forEach(G=>{var k,K,le,ne,de,Y;if(((k=G.declaration)==null?void 0:k.type)===d.Property&&G.declaration.static){let te=a?((K=p.getDefaultValue)==null?void 0:K.call(p))||null:e==null?void 0:e.readValue(G.declaration.id);te?!a&&te&&te.id===((le=G.declaration.defaultValue)==null?void 0:le.id)&&(te=Ht(G.declaration.getDataType(null),G.declaration,i)):a?te=Fu(G.declaration.getDataType(null),G.declaration,i,c):te=Ht(G.declaration.getDataType(null),G.declaration,i);const oe=Lt(G,i),Q=G.codeName||((ne=G.declaration)==null?void 0:ne.codeName)||ir(oe),z=M[Q];te==null||te.metaSync({value:z},c),a||e==null||e.writeValue(G.declaration,te)}else if(((de=G.declaration)==null?void 0:de.type)===d.Property){let te=a?((Y=p.getDefaultValue)==null?void 0:Y.call(p))||null:e==null?void 0:e.readValue(G.id);te&&te.metaSync({value:null},c),a||e==null||e.removeValue(G.id)}})}}else p.type===d.InputMap?((E=p.declaration)==null?void 0:E.type)===d.Property&&p.declaration.static?Rf(p.declaration,i,s,r):Mt.includes(p.parent.type)&&((b=p.declaration)==null?void 0:b.type)===d.Property&&nv(p,i,s,r):p.type===d.OutputMap?((A=p.declaration)==null?void 0:A.type)===d.Property&&p.declaration.static?Rf(p.declaration,i,null,r):Mt.includes(p.parent.type)&&((_=p.declaration)==null?void 0:_.type)===d.Property&&nv(p,i,null,r):p.type===d.Property&&p.static&&Rf(p,i,s,r);return c}function yIi(s,p,i){const r=ud(s,p);let a=!1,c=null,e=null;return i instanceof S?(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),dPe(f,p,i)}),c}function hIi(s,p,i,r,a){const c=ud(p,i);let e=!1,f=null,h=null;return r instanceof S?(e=!0,f=r,h=null):(f=null,h=r),i.diggestedBuiltInBaseEntitiesIds.has(p.id)||c.forEach(m=>{var A,_,P,V;if(i.diggestedBuiltInBaseEntitiesIds.has(m.id))return;let E=null;if(e){const M=((A=m.getDefaultValue)==null?void 0:A.call(m))||null;M&&(i.diggestedBuiltInBaseEntitiesIds.has(M.id)||((_=M.parent)==null?void 0:_.id)!==m.id?E=M.clone(f,m):E=M)}else E=h==null?void 0:h.readValue(m.id);E?!e&&E&&E.id===((V=(P=m.getDefaultValue)==null?void 0:P.call(m))==null?void 0:V.id)&&(E=Ht(m.getDataType(null),m,i)):e?(E=Fu(m.getDataType(null),m,i,f),f==null||f.add(E,H.Added)):E=Ht(m.getDataType(null),m,i),E==null||E.setValueAsType(null,f);let b=a||(E==null?void 0:E.name);(!(E!=null&&E.name)||(E==null?void 0:E.name)===fe.Untyped)&&!a&&(typeof s=="string"?b=fe.String:s===null?b=fe.Null:typeof s=="number"?b=fe.Number:typeof s=="boolean"&&(b=fe.Boolean)),E==null||E.metaSync({value:s,name:b},f),e||h==null||h.writeValue(m,E),uPe(s,m,i,r)}),f}function Df(s,p,i,r){let a=!1,c=null,e=null;r instanceof S?(a=!0,c=r,e=null):(c=null,e=r);const f=s.parent;return p.getVariableDeclarations().forEach(m=>{var b,A,_,P,V,M;const E=m.getDataType(null);if(((b=E==null?void 0:E.entity)==null?void 0:b.id)===f.id){let G=a?m.defaultValue:e==null?void 0:e.readValue(m.id);G?!a&&G&&G.id===((A=m.defaultValue)==null?void 0:A.id)&&(G=Ht(m.getDataType(null),m,p)):a?G=Fu(m.getDataType(null),m,p,c):G=Ht(m.getDataType(null),m,p);const k=Lt(s,p),K=s.codeName||((_=s.extends)==null?void 0:_.codeName)||((P=s.implements[0])==null?void 0:P.codeName)||ir(k);let le={};((M=(V=m.dataType)==null?void 0:V.entity)==null?void 0:M.type)===d.DefinitionEntity&&(le={...le,...m.dataType.entity.getActiveRawDefaultValue()}),vr(G==null?void 0:G.value)&&(le={...le,...G.value}),Array.isArray(i)?le[K]=(i==null?void 0:i.map(ne=>ne.toShallowJSON()))||null:le[K]=(i==null?void 0:i.toShallowJSON())||null,G==null||G.metaSync({value:le},c),a||e==null||e.writeValue(m,G);return}}),c}function av(s,p,i,r){var _,P,V,M;let a=!1,c=null,e=null;r instanceof S?(a=!0,c=r,e=null):(c=null,e=r);const f=Er(s.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=Ht(f.getDataType(null),f,p)):a?m=Fu(f.getDataType(null),f,p,c):m=Ht(f.getDataType(null),f,p);const E=Lt(s,p),b=s.codeName||((P=s.declaration)==null?void 0:P.codeName)||ir(E);let A={};if(((M=(V=f.dataType)==null?void 0:V.entity)==null?void 0:M.type)===d.DefinitionEntity&&(A={...A,...f.dataType.entity.getActiveRawDefaultValue()}),vr(m==null?void 0:m.value)&&(A={...A,...m.value}),Array.isArray(i)?A[b]=(i==null?void 0:i.map(G=>G.toShallowJSON()))||null:A[b]=(i==null?void 0:i.toShallowJSON())||null,m==null||m.metaSync({value:A},c),a||e==null||e.writeValue(f,m),i==null&&s.type===d.OutputMap){const G=f.inputs.find(k=>{var K,le;return((K=k.declaration)==null?void 0:K.id)===((le=s.declaration)==null?void 0:le.id)||Lt(k,p)===E});if(G){let k=a?G.defaultValue:e==null?void 0:e.readValue(G.id);k&&(Array.isArray(i)?k==null||k.setValueAsTypeList(i,c):k==null||k.setValueAsTypeSingle(i,c)),a||e==null||e.removeValue(G.id)}}return c}function pPe(s,p,i){var r,a,c,e;return s.type===d.InputMap?((r=s.declaration)==null?void 0:r.type)===d.Property&&s.declaration.static?Df(s.declaration,p,null,i):Mt.includes(s.parent.type)&&((a=s.declaration)==null?void 0:a.type)===d.Property&&av(s,p,null,i):s.type===d.OutputMap?((c=s.declaration)==null?void 0:c.type)===d.Property&&s.declaration.static?Df(s.declaration,p,null,i):Mt.includes(s.parent.type)&&((e=s.declaration)==null?void 0:e.type)===d.Property&&av(s,p,null,i):s.type===d.Property&&s.static&&Df(s,p,null,i),i}function cPe(s,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?Df(p.declaration,i,s,r):Mt.includes(p.parent.type)&&((c=p.declaration)==null?void 0:c.type)===d.Property&&av(p,i,s,r):p.type===d.OutputMap?((e=p.declaration)==null?void 0:e.type)===d.Property&&p.declaration.static?Df(p.declaration,i,null,r):Mt.includes(p.parent.type)&&((f=p.declaration)==null?void 0:f.type)===d.Property&&av(p,i,null,r):p.type===d.Property&&p.static&&Df(p,i,s,r),r}function mIi(s,p,i){const r=ud(s,p);let a=!1,c=null,e=null;return i instanceof S?(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),pPe(f,p,i)}),c}function TIi(s,p,i,r){const a=ud(p,i);let c=!1,e=null,f=null;return r instanceof S?(c=!0,e=r,f=null):(e=null,f=r),a.forEach(h=>{var E,b,A;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===((A=(b=h.getDefaultValue)==null?void 0:b.call(h))==null?void 0:A.id)&&(m=Ht(h.getDataType(null),h,h.project)):c?m=Fu(h.getDataType(null),h,i,e):m=Ht(h.getDataType(null),h,i),Array.isArray(s)?m==null||m.setValueAsTypeList(s,e):m==null||m.setValueAsTypeSingle(s,e),m==null||m.metaSync({value:null},e),c||f==null||f.writeValue(h,m),cPe(s,h,i,r)}),e}class D1{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 _e=(s=>(s[s.High=1]="High",s[s.Normal=5]="Normal",s[s.Low=10]="Low",s))(_e||{}),ae=(s=>(s.Logic="logic",s.EditorGUI="editor-gui",s.GUI="gui",s.Editor="editor",s.Compile="compile",s.PublicationRun="publication-run",s))(ae||{}),Ve=(s=>(s.All="*",s.OnAll="on:*",s.EmitAll="emit:*",s.ReadAll="read:*",s.WriteAll="write:*",s.UpdateAll="update:*",s.DoAll="do:*",s.OnLogicAll="on:logic:*",s.EmitLogicAll="emit:logic:*",s.ReadLogicAll="read:logic:*",s.WriteLogicAll="write:logic:*",s.UpdateLogicAll="update:logic:*",s.DoLogicAll="do:logic:*",s.OnGUIAll="on:gui:*",s.EmitGUIAll="emit:gui:*",s.ReadGUIAll="read:gui:*",s.WriteGUIAll="write:gui:*",s.UpdateGUIAll="update:gui:*",s.DoGUIAll="do:gui:*",s.OnEditorAll="on:editor:*",s.EmitEditorAll="emit:editor:*",s.ReadEditorAll="read:editor:*",s.WriteEditorAll="write:editor:*",s.UpdateEditorAll="update:editor:*",s.DoEditorAll="do:editor:*",s.OnCompileBefore="on:compile:before:DefinitionEntity",s.OnCompileDefault="on:compile:default:DefinitionEntity",s.OnCompileAfter="on:compile:after:DefinitionEntity",s.EmitCompile="emit:compile:DefinitionEntity",s.DoEditorPublish="do:editor:publish",s.PostGUICanvasSlotNewToolbarButton="write:gui:canvas:slot:toolbar-button",s.ReadGUICanvasSlotToolbarButtons="read:gui:canvas:slot:toolbar-buttons",s.UpdateGUIGlobalTheme="update:gui:global:theme",s))(Ve||{});class fPe{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 yPe extends fPe{constructor(p,i){super(i),this.parentExtension=p}}class Ne{constructor(p,i){R(this,"manifest");R(this,"module");R(this,"state");this.extensionsRegistry=p,this.state=new yPe(this,i)}}class q_ extends D1{constructor(i,r){super(i,ae.Logic);R(this,"id");this._project=r,this.id=r.id}get type(){return this._project.type}get name(){return this._project.name}get workspaceId(){return this._project.workspaceId}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 vIi(s,p){return p instanceof q_?p:new q_(s,p)}const fh="built-in-function-implementations__",Le="operations-implementations__",ds="conditions-implementations__",Pe={UUID:"uuid",SEARCH_NODE_IMPLEMENTATION:"search-node-implementation",BUILT_IN_FUNCTION_IMPLEMENTATIONS__ABORT_EXECUTION:fh+Gr.AbortExecution,BUILT_IN_FUNCTION_IMPLEMENTATIONS__CREATE_PERSISTED_ENTITY:fh+Gr.CreatePersistedEntity,BUILT_IN_FUNCTION_IMPLEMENTATIONS__UPDATE_PERSISTED_ENTITY:fh+Gr.UpdatePersistedEntity,BUILT_IN_FUNCTION_IMPLEMENTATIONS__DELETE_PERSISTED_ENTITY:fh+Gr.DeletePersistedEntity,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_EMPTY:Le+jt.Empty,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_NOT_EMPTY:Le+jt.NotEmpty,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_PRIMITIVE_EQUAL:Le+jt.PrimitiveEqual,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_PRIMITIVE_NOT_EQUAL:Le+jt.PrimitiveNotEqual,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__HTTP_REQUEST:Le+En.HttpRequest,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_SQL:Le+ao.ExecuteSQL,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__VALIDATE_ENTITY:Le+xe.Validate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_WAIT:Le+Ts.Wait,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_JOIN:Le+me.Join,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SPLIT:Le+me.Split,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_LAST_N_ITEMS:Le+me.DeleteLastNItems,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_FIRST_N_ITEMS:Le+me.DeleteFirstNItems,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_AT_INDEX:Le+me.DeleteAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_ADD_AT_INDEX:Le+me.AddAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_FIRST_N_ITEMS:Le+me.ReplaceFirstNItems,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_LAST_N_ITEMS:Le+me.ReplaceLastNItems,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_ALL:Le+me.ReplaceAll,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_AT_INDEX:Le+me.ReplaceAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_INDEX_ITEM:Le+me.GetIndexItem,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_FIRST:Le+me.GetFirst,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST:Le+me.GetLast,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_APPEND:Le+me.Append,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PREPEND:Le+me.Prepend,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REVERSE:Le+me.Reverse,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LENGTH:Le+me.GetLength,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_FIRST_N_ITEMS:Le+me.GetFirstNItems,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST_N_ITEMS:Le+me.GetLastNItems,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SLICE:Le+me.Slice,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONCAT:Le+me.Concat,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_INDEX_OF:Le+me.GetIndexOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST_INDEX_OF:Le+me.GetLastIndexOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_UNIQUE:Le+me.Unique,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_FLATTEN:Le+me.Flatten,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SORT:Le+me.Sort,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SHUFFLE:Le+me.Shuffle,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CHUNK:Le+me.Chunk,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PAD_START:Le+me.PadStart,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PAD_END:Le+me.PadEnd,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPEAT:Le+me.Repeat,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LENGTH:Le+W.GetLength,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TO_LOWER_CASE:Le+W.ToLowerCase,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TO_UPPER_CASE:Le+W.ToUpperCase,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_JOIN:Le+W.Join,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONTAINS:Le+me.Contains,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONTAINS_ALL:Le+me.ContainsAll,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONTAINS_ANY:Le+me.ContainsAny,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT_AT_INDEX:Le+W.SplitAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT_AT_ALL_SEPARATORS:Le+W.SplitAtAllSeparators,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT_AT_FIRST_SEPARATOR:Le+W.SplitAtFirstSeparator,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT_AT_LAST_SEPARATOR:Le+W.SplitAtLastSeparator,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_LAST_N_CHARS:Le+W.DeleteLastNChars,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_FIRST_N_CHARS:Le+W.DeleteFirstNChars,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_AT_INDEX:Le+W.DeleteAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ADD_AT_INDEX:Le+W.AddAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_FIRST_N_CHARS:Le+W.ReplaceFirstNChars,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_LAST_N_CHARS:Le+W.ReplaceLastNChars,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_AT_INDEX:Le+W.ReplaceAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_FIRST_MATCH:Le+W.ReplaceFirstMatch,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_LAST_MATCH:Le+W.ReplaceLastMatch,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_ALL_MATCHES:Le+W.ReplaceAllMatches,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_INDEX_ITEM:Le+W.GetIndexItem,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_FIRST_N_CHARS:Le+W.GetFirstNChars,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LAST_N_CHARS:Le+W.GetLastNChars,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_INDEX_OF:Le+W.GetIndexOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_APPEND:Le+W.Append,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PREPEND:Le+W.Prepend,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REVERSE:Le+W.Reverse,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TRIM:Le+W.Trim,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TRIM_START:Le+W.TrimStart,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TRIM_END:Le+W.TrimEnd,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SUBSTRING:Le+W.Substring,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SLICE:Le+W.Slice,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PAD_START:Le+W.PadStart,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PAD_END:Le+W.PadEnd,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPEAT:Le+W.Repeat,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LAST_INDEX_OF:Le+W.GetLastIndexOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_MATCH_REGEX:Le+W.MatchRegex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_MATCH_ALL_REGEX:Le+W.MatchAllRegex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SEARCH_REGEX:Le+W.SearchRegex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_REGEX:Le+W.ReplaceRegex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_NORMALIZE_UNICODE:Le+W.NormalizeUnicode,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REMOVE_DIACRITICS:Le+W.RemoveDiacritics,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_COUNT_OCCURRENCES:Le+W.CountOccurrences,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ENSURE_PREFIX:Le+W.EnsurePrefix,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ENSURE_SUFFIX:Le+W.EnsureSuffix,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REMOVE_PREFIX:Le+W.RemovePrefix,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REMOVE_SUFFIX:Le+W.RemoveSuffix,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ADDITION:Le+ue.Addition,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SUBTRACTION:Le+ue.Subtraction,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MULTIPLICATION:Le+ue.Multiplication,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_DIVISION:Le+ue.Division,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_REMAINDER:Le+ue.Remainder,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_EXPONENTIATION:Le+ue.Exponentiation,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ABSOLUTE:Le+ue.Absolute,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SIGN:Le+ue.Sign,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ROUND:Le+ue.Round,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_NEGATE:Le+ue.Negate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_FLOOR:Le+ue.Floor,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_CEIL:Le+ue.Ceil,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_CLAMP:Le+ue.Clamp,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TRUNC:Le+ue.Trunc,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ROUND_TO_DECIMALS:Le+ue.RoundToDecimals,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SNAP_TO_STEP:Le+ue.SnapToStep,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MAP_RANGE:Le+ue.MapRange,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_AVERAGE:Le+ue.Average,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MEDIAN:Le+ue.Median,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MIN_OF:Le+ue.MinOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MAX_OF:Le+ue.MaxOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SQUARE_ROOT:Le+ue.SquareRoot,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_CUBE_ROOT:Le+ue.CubeRoot,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_NTH_ROOT:Le+ue.NthRoot,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_EXP:Le+ue.Exp,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LOG_NATURAL:Le+ue.LogNatural,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LOG10:Le+ue.Log10,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SIN:Le+ue.Sin,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_COS:Le+ue.Cos,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TAN:Le+ue.Tan,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ASIN:Le+ue.Asin,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ACOS:Le+ue.Acos,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ATAN:Le+ue.Atan,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ATAN2:Le+ue.Atan2,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TO_RADIANS:Le+ue.ToRadians,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TO_DEGREES:Le+ue.ToDegrees,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_PERCENT_OF:Le+ue.PercentOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_PERCENTAGE_CHANGE:Le+ue.PercentageChange,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MORE_THAN:Le+ue.MoreThan,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LESS_THAN:Le+ue.LessThan,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LESS_THAN_OR_EQUAL:Le+ue.LessThanOrEqual,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MORE_THAN_OR_EQUAL:Le+ue.MoreThanOrEqual,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_INTEGER:Le+tt.GenerateRandomInteger,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_FLOAT:Le+tt.GenerateRandomFloat,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_HEXADECIMAL:Le+tt.GenerateRandomHexadecimal,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE62:Le+tt.GenerateRandomBase62,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE64:Le+tt.GenerateRandomBase64,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_ALPHANUMERIC:Le+tt.GenerateRandomAlphanumeric,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_IDENTIFIER:Le+tt.GenerateIdentifier,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_UUIDV4:Le+tt.GenerateRandomUUIDv4,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_SHORT_IDENTIFIER:Le+tt.GenerateShortIdentifier,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_HEXADECIMAL_TOKEN:Le+tt.GenerateHexadecimalToken,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_STARTS_WITH:Le+W.StartsWith,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ENDS_WITH:Le+W.EndsWith,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_CONTAINS:Le+W.Contains,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_MATCHES_REGEX:Le+W.MatchesRegex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_CURRENT_TIMESTAMP:Le+q.GetCurrentTimestamp,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_FORMAT_DATE:Le+q.FormatDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_PARSE_DATE:Le+q.ParseDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_ADD_TO_DATE:Le+q.AddToDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SUBTRACT_FROM_DATE:Le+q.SubtractFromDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_DIFFERENCE_BETWEEN_DATES:Le+q.DifferenceBetweenDates,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_DATE:Le+q.ToDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_UNIX:Le+q.ToUnix,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_FROM_UNIX:Le+q.FromUnix,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_ISO_STRING:Le+q.ToISOString,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_YEAR:Le+q.GetYear,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_MONTH:Le+q.GetMonth,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_DATE:Le+q.GetDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_HOUR:Le+q.GetHour,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_MINUTE:Le+q.GetMinute,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_SECOND:Le+q.GetSecond,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_MILLISECOND:Le+q.GetMillisecond,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_ISO_WEEKDAY:Le+q.GetIsoWeekday,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_WEEK_OF_YEAR:Le+q.GetWeekOfYear,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_QUARTER:Le+q.GetQuarter,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_DAY_OF_YEAR:Le+q.GetDayOfYear,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_DAYS_IN_MONTH:Le+q.GetDaysInMonth,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_CURRENT_IANA_TIMEZONE:Le+q.GetCurrentIanaTimeZone,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_YEAR:Le+q.SetYear,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_MONTH:Le+q.SetMonth,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_DATE:Le+q.SetDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_HOUR:Le+q.SetHour,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_MINUTE:Le+q.SetMinute,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_SECOND:Le+q.SetSecond,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_MILLISECOND:Le+q.SetMillisecond,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_ISO_WEEKDAY:Le+q.SetIsoWeekday,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_QUARTER:Le+q.SetQuarter,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_START_OF:Le+q.StartOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_END_OF:Le+q.EndOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_ROUND_TO:Le+q.RoundTo,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_BEFORE:ds+q.IsBefore,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_AFTER:ds+q.IsAfter,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_SAME:ds+q.IsSame,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_SAME_OR_BEFORE:ds+q.IsSameOrBefore,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_SAME_OR_AFTER:ds+q.IsSameOrAfter,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_BETWEEN:ds+q.IsBetween,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_VALID:ds+q.IsValid,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_LEAP_YEAR:ds+q.IsLeapYear,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_CLAMP_TO_RANGE:Le+q.ClampToRange,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_MIN_OF:Le+q.MinOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_MAX_OF:Le+q.MaxOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_FROM_NOW:Le+q.FromNow,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_NOW:Le+q.ToNow,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_HUMANIZE_DIFF:Le+q.HumanizeDiff,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_ADD_BUSINESS_DAYS:Le+q.AddBusinessDays,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_NEXT_WEEKDAY:Le+q.NextWeekday,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_PREVIOUS_WEEKDAY:Le+q.PreviousWeekday,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_UTC:Le+q.ToUTC,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_CONVERT_TIMEZONE:Le+q.ConvertTimezone,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_TIMEZONE_OFFSET:Le+q.GetTimezoneOffset,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_UTC_OFFSET:Le+q.SetUTCOffset,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_READ_KEY:Le+xe.ReadKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_WRITE_KEY:Le+xe.WriteKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_DELETE_KEY:Le+xe.DeleteKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_READ_NESTED_KEY:Le+xe.ReadNestedKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_WRITE_NESTED_KEY:Le+xe.WriteNestedKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_DELETE_NESTED_KEY:Le+xe.DeleteNestedKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_WRITE_SAFE_NESTED_KEY_RECURSIVELY:Le+xe.WriteSafeNestedKeyRecursively,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_HAS_KEY:ds+xe.HasKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_HAS_NESTED_KEY:ds+xe.HasNestedKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_KEY_VALUE_EQUALS:ds+xe.KeyValueEquals,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_NESTED_KEY_VALUE_EQUALS:ds+xe.NestedKeyValueEquals,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_IS_INSTANCE_OF_TYPE:ds+xe.IsInstanceOfType,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_MERGE:Le+xe.Merge,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_KEYS:Le+xe.Keys,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_VALUES:Le+xe.Values,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_ENTRIES:Le+xe.Entries,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_GET_TYPE_OF:Le+Qe.GetTypeOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_HASH:Le+Li.Hash,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_HMAC:Le+Li.Hmac,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_GENERATE_RANDOM_BYTES:Le+tt.GenerateRandomBytes,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_CONSTANT_TIME_EQUAL:Le+Li.ConstantTimeEqual,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_DERIVE_KEY_PBKDF2:Le+Li.DeriveKeyPBKDF2,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__PASSWORD_HASH_PBKDF2:Le+An.HashPasswordPBKDF2,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__PASSWORD_VERIFY_PBKDF2:Le+An.VerifyPasswordPBKDF2,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_BUILD_HMAC:Le+hr.BuildJwtHmac,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_VERIFY_HMAC:Le+hr.VerifyJwtHmac,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_DECODE:Le+hr.DecodeJwt,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_FROM_BYTES_TO_STRING:Le+Qe.FromBytesToString,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_BYTES:Le+Qe.ToBytes,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_NUMBER:Le+Qe.ToNumber,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_STRING:Le+Qe.ToString,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_BASE64:Le+Qe.EncodeBase64,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_BASE64:Le+Qe.DecodeBase64,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_BASE64URL:Le+Qe.EncodeBase64Url,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_BASE64URL:Le+Qe.DecodeBase64Url,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_HEX:Le+Qe.EncodeHex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_HEX:Le+Qe.DecodeHex,BUILT_IN_OPERATIONS_IMPLEMENTATIONS__JSON_PARSE:Le+bn.Parse,BUILT_IN_OPERATIONS_IMPLEMENTATIONS__JSON_STRINGIFY:Le+bn.Stringify};class hPe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.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:_e.High,permissions:[Ve.All],contexts:[ae.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 mPe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.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:_e.High,permissions:[Ve.All],contexts:[ae.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 TPe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.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:_e.High,permissions:[Ve.All],contexts:[ae.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 vPe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.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:_e.High,permissions:[Ve.All],contexts:[ae.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 EPe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.SEARCH_NODE_IMPLEMENTATION,version:"1.0.0",description:"Implementation for search nodes when they get executed and query data.",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Editor]});R(this,"module",{main:async(i,r)=>({error:"Search module not implemented",data:null})})}}class bPe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.UUID,version:"1.0.0",description:"UUID generation module, for all contexts and runtimes",initPriority:_e.High,permissions:[Ve.All],contexts:[]});R(this,"module",PV)}}const APe=s=>s.map(p=>{var i,r;return((i=p.value)==null?void 0:i.valueAsType)??((r=p.value)==null?void 0:r.value)});class gPe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_EMPTY,version:"1.0.0",description:"Comparison: Empty (!value)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(jt.Empty);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=APe(r),c=!a;return{value:U.Success,error:null,result:c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class IPe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_NOT_EMPTY,version:"1.0.0",description:"Comparison: NotEmpty (!!value)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(jt.NotEmpty);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=APe(r),c=!!a;return{value:U.Success,error:null,result:c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}const oI=class oI extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_PRIMITIVE_EQUAL,version:"1.0.0",description:"Comparison: PrimitiveEqual (typed equality / deep JSON equality)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(jt.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,A=(m=(h=r[1])==null?void 0:h.value)==null?void 0:m.value;let _=!1;return E&&oI.primitiveSet.has(E)?_=b===A:E===fe.Untyped||E===fe.KeyValue?_=JSON.stringify(b)===JSON.stringify(A):_=!1,{value:U.Success,error:null,result:_}}catch(E){return{value:U.UnhandledError,error:E,result:null}}}})}};R(oI,"primitiveSet",new Set([fe.String,fe.Number,fe.Boolean,fe.Null,fe.Enum,fe.Date,fe.UUID]));let Mg=oI;const dI=class dI extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_PRIMITIVE_NOT_EQUAL,version:"1.0.0",description:"Comparison: PrimitiveNotEqual (typed inequality / deep JSON inequality)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(jt.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,A=(m=(h=r[1])==null?void 0:h.value)==null?void 0:m.value;let _=!1;return E&&dI.primitiveSet.has(E)?_=b!==A:E===fe.Untyped||E===fe.KeyValue?_=JSON.stringify(b)!==JSON.stringify(A):_=!1,{value:U.Success,error:null,result:_}}catch(E){return{value:U.UnhandledError,error:E,result:null}}}})}};R(dI,"primitiveSet",new Set([fe.String,fe.Number,fe.Boolean,fe.Null,fe.Enum,fe.Date,fe.UUID]));let Gg=dI;var RPe={exports:{}};(function(s,p){(function(i,r){s.exports=r()})(Xr,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(V){var M={date:V,utc:!0,args:arguments};return new e(M)},h.utc=function(V){var M=f(this.toDate(),{locale:this.$L,utc:!0});return V?M.add(this.utcOffset(),i):M},h.local=function(){return f(this.toDate(),{locale:this.$L,utc:!1})};var m=h.parse;h.parse=function(V){V.utc&&(this.$u=!0),this.$utils().u(V.$offset)||(this.$offset=V.$offset),m.call(this,V)};var E=h.init;h.init=function(){if(this.$u){var V=this.$d;this.$y=V.getUTCFullYear(),this.$M=V.getUTCMonth(),this.$D=V.getUTCDate(),this.$W=V.getUTCDay(),this.$H=V.getUTCHours(),this.$m=V.getUTCMinutes(),this.$s=V.getUTCSeconds(),this.$ms=V.getUTCMilliseconds()}else E.call(this)};var b=h.utcOffset;h.utcOffset=function(V,M){var G=this.$utils().u;if(G(V))return this.$u?0:G(this.$offset)?b.call(this):this.$offset;if(typeof V=="string"&&(V=function(ne){ne===void 0&&(ne="");var de=ne.match(r);if(!de)return null;var Y=(""+de[0]).match(a)||["-",0,0],te=Y[0],oe=60*+Y[1]+ +Y[2];return oe===0?0:te==="+"?oe:-oe}(V),V===null))return this;var k=Math.abs(V)<=16?60*V:V;if(k===0)return this.utc(M);var K=this.clone();if(M)return K.$offset=k,K.$u=!1,K;var le=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(K=this.local().add(k+le,i)).$offset=k,K.$x.$localOffset=le,K};var A=h.format;h.format=function(V){var M=V||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return A.call(this,M)},h.valueOf=function(){var V=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*V},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(V){return V==="s"&&this.$offset?f(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():_.call(this)};var P=h.diff;h.diff=function(V,M,G){if(V&&this.$u===V.$u)return P.call(this,V,M,G);var k=this.local(),K=f(V).local();return P.call(k,K,M,G)}}})})(RPe);var EIi=RPe.exports;const bIi=Os(EIi);var DPe={exports:{}};(function(s,p){(function(i,r){s.exports=r()})(Xr,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(A,_,P){P===void 0&&(P={});var V=new Date(A),M=function(G,k){k===void 0&&(k={});var K=k.timeZoneName||"short",le=G+"|"+K,ne=r[le];return ne||(ne=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:G,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:K}),r[le]=ne),ne}(_,P);return M.formatToParts(V)},m=function(A,_){for(var P=h(A,_),V=[],M=0;M<P.length;M+=1){var G=P[M],k=G.type,K=G.value,le=i[k];le>=0&&(V[le]=parseInt(K,10))}var ne=V[3],de=ne===24?0:ne,Y=V[0]+"-"+V[1]+"-"+V[2]+" "+de+":"+V[4]+":"+V[5]+":000",te=+A;return(e.utc(Y).valueOf()-(te-=te%1e3))/6e4},E=c.prototype;E.tz=function(A,_){A===void 0&&(A=f);var P,V=this.utcOffset(),M=this.toDate(),G=M.toLocaleString("en-US",{timeZone:A}),k=Math.round((M-new Date(G))/1e3/60),K=15*-Math.round(M.getTimezoneOffset()/15)-k;if(!Number(K))P=this.utcOffset(0,_);else if(P=e(G,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(K,!0),_){var le=P.utcOffset();P=P.add(V-le,"minute")}return P.$x.$timezone=A,P},E.offsetName=function(A){var _=this.$x.$timezone||e.tz.guess(),P=h(this.valueOf(),_,{timeZoneName:A}).find(function(V){return V.type.toLowerCase()==="timezonename"});return P&&P.value};var b=E.startOf;E.startOf=function(A,_){if(!this.$x||!this.$x.$timezone)return b.call(this,A,_);var P=e(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return b.call(P,A,_).tz(this.$x.$timezone,!0)},e.tz=function(A,_,P){var V=P&&_,M=P||_||f,G=m(+e(),M);if(typeof A!="string")return e(A).tz(M);var k=function(de,Y,te){var oe=de-60*Y*1e3,Q=m(oe,te);if(Y===Q)return[oe,Y];var z=m(oe-=60*(Q-Y)*1e3,te);return Q===z?[oe,Q]:[de-60*Math.min(Q,z)*1e3,Math.max(Q,z)]}(e.utc(A,V).valueOf(),G,M),K=k[0],le=k[1],ne=e(K).utcOffset(le);return ne.$x.$timezone=M,ne},e.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},e.tz.setDefault=function(A){f=A}}})})(DPe);var AIi=DPe.exports;const gIi=Os(AIi);var wPe={exports:{}};(function(s,p){(function(i,r){s.exports=r()})(Xr,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]==="(",A=h[1]===")";return(b?this.isAfter(m,f):!this.isBefore(m,f))&&(A?this.isBefore(E,f):!this.isAfter(E,f))||(b?this.isBefore(m,f):!this.isAfter(m,f))&&(A?this.isAfter(E,f):!this.isBefore(E,f))}}})})(wPe);var IIi=wPe.exports;const RIi=Os(IIi);var CPe={exports:{}};(function(s,p){(function(i,r){s.exports=r()})(Xr,function(){return function(i,r){r.prototype.isSameOrAfter=function(a,c){return this.isSame(a,c)||this.isAfter(a,c)}}})})(CPe);var DIi=CPe.exports;const wIi=Os(DIi);var OPe={exports:{}};(function(s,p){(function(i,r){s.exports=r()})(Xr,function(){return function(i,r){r.prototype.isSameOrBefore=function(a,c){return this.isSame(a,c)||this.isBefore(a,c)}}})})(OPe);var CIi=OPe.exports;const OIi=Os(CIi);var _Pe={exports:{}};(function(s,p){(function(i,r){s.exports=r()})(Xr,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 A=e(this).startOf(r).date(m).startOf(i).subtract(1,"millisecond"),_=this.diff(A,i,!0);return _<0?e(this).startOf("week").week():Math.ceil(_)},f.weeks=function(h){return h===void 0&&(h=null),this.week(h)}}})})(_Pe);var _Ii=_Pe.exports;const VIi=Os(_Ii);var VPe={exports:{}};(function(s,p){(function(i,r){s.exports=r()})(Xr,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,A,_,P=e(this),V=(E=this.isoWeekYear(),b=this.$u,A=(b?c.utc:c)().year(E).startOf("year"),_=4-A.isoWeekday(),A.isoWeekday()>4&&(_+=7),A.add(_,i));return P.diff(V,"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(),A=!!b.u(E)||E;return b.p(m)==="isoweek"?A?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)}}})})(VPe);var PIi=VPe.exports;const NIi=Os(PIi);var PPe={exports:{}};(function(s,p){(function(i,r){s.exports=r()})(Xr,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(),A=!!b.u(E)||E;if(b.p(m)===r){var _=this.quarter()-1;return A?this.month(3*_).startOf(i).startOf("day"):this.month(3*_+2).endOf(i).endOf("day")}return h.bind(this)(m,E)}}})})(PPe);var xIi=PPe.exports;const $Ii=Os(xIi);var NPe={exports:{}};(function(s,p){(function(i,r){s.exports=r()})(Xr,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")}}})})(NPe);var LIi=NPe.exports;const BIi=Os(LIi);var xPe={exports:{}};(function(s,p){(function(i,r){s.exports=r()})(Xr,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,A){return c.fromToBase(m,E,b,A)}a.en.relativeTime=e,c.fromToBase=function(m,E,b,A,_){for(var P,V,M,G=b.$locale().relativeTime||e,k=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"}],K=k.length,le=0;le<K;le+=1){var ne=k[le];ne.d&&(P=A?a(m).diff(b,ne.d,!0):b.diff(m,ne.d,!0));var de=(i.rounding||Math.round)(Math.abs(P));if(M=P>0,de<=ne.r||!ne.r){de<=1&&le>0&&(ne=k[le-1]);var Y=G[ne.l];_&&(de=_(""+de)),V=typeof Y=="string"?Y.replace("%d",de):Y(de,E,ne.l,M);break}}if(E)return V;var te=M?G.future:G.past;return typeof te=="function"?te(V):te.replace("%s",V)},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)}}})})(xPe);var MIi=xPe.exports;const GIi=Os(MIi);var $Pe={exports:{}};(function(s,p){(function(i,r){s.exports=r()})(Xr,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)?)?$/,A={years:m,months:E,days:f,hours:e,minutes:c,seconds:a,milliseconds:1,weeks:6048e5},_=function(de){return de instanceof le},P=function(de,Y,te){return new le(de,te,Y.$l)},V=function(de){return r.p(de)+"s"},M=function(de){return de<0},G=function(de){return M(de)?Math.ceil(de):Math.floor(de)},k=function(de){return Math.abs(de)},K=function(de,Y){return de?M(de)?{negative:!0,format:""+k(de)+Y}:{negative:!1,format:""+de+Y}:{negative:!1,format:""}},le=function(){function de(te,oe,Q){var z=this;if(this.$d={},this.$l=Q,te===void 0&&(this.$ms=0,this.parseFromMilliseconds()),oe)return P(te*A[V(oe)],this);if(typeof te=="number")return this.$ms=te,this.parseFromMilliseconds(),this;if(typeof te=="object")return Object.keys(te).forEach(function(ce){z.$d[V(ce)]=te[ce]}),this.calMilliseconds(),this;if(typeof te=="string"){var se=te.match(b);if(se){var ye=se.slice(2).map(function(ce){return ce!=null?Number(ce):0});return this.$d.years=ye[0],this.$d.months=ye[1],this.$d.weeks=ye[2],this.$d.days=ye[3],this.$d.hours=ye[4],this.$d.minutes=ye[5],this.$d.seconds=ye[6],this.calMilliseconds(),this}}return this}var Y=de.prototype;return Y.calMilliseconds=function(){var te=this;this.$ms=Object.keys(this.$d).reduce(function(oe,Q){return oe+(te.$d[Q]||0)*A[Q]},0)},Y.parseFromMilliseconds=function(){var te=this.$ms;this.$d.years=G(te/m),te%=m,this.$d.months=G(te/E),te%=E,this.$d.days=G(te/f),te%=f,this.$d.hours=G(te/e),te%=e,this.$d.minutes=G(te/c),te%=c,this.$d.seconds=G(te/a),te%=a,this.$d.milliseconds=te},Y.toISOString=function(){var te=K(this.$d.years,"Y"),oe=K(this.$d.months,"M"),Q=+this.$d.days||0;this.$d.weeks&&(Q+=7*this.$d.weeks);var z=K(Q,"D"),se=K(this.$d.hours,"H"),ye=K(this.$d.minutes,"M"),ce=this.$d.seconds||0;this.$d.milliseconds&&(ce+=this.$d.milliseconds/1e3,ce=Math.round(1e3*ce)/1e3);var he=K(ce,"S"),Ae=te.negative||oe.negative||z.negative||se.negative||ye.negative||he.negative,Re=se.format||ye.format||he.format?"T":"",Oe=(Ae?"-":"")+"P"+te.format+oe.format+z.format+Re+se.format+ye.format+he.format;return Oe==="P"||Oe==="-P"?"P0D":Oe},Y.toJSON=function(){return this.toISOString()},Y.format=function(te){var oe=te||"YYYY-MM-DDTHH:mm:ss",Q={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 oe.replace(h,function(z,se){return se||String(Q[z])})},Y.as=function(te){return this.$ms/A[V(te)]},Y.get=function(te){var oe=this.$ms,Q=V(te);return Q==="milliseconds"?oe%=1e3:oe=Q==="weeks"?G(oe/A[Q]):this.$d[Q],oe||0},Y.add=function(te,oe,Q){var z;return z=oe?te*A[V(oe)]:_(te)?te.$ms:P(te,this).$ms,P(this.$ms+z*(Q?-1:1),this)},Y.subtract=function(te,oe){return this.add(te,oe,!0)},Y.locale=function(te){var oe=this.clone();return oe.$l=te,oe},Y.clone=function(){return P(this.$ms,this)},Y.humanize=function(te){return i().add(this.$ms,"ms").locale(this.$l).fromNow(!te)},Y.valueOf=function(){return this.asMilliseconds()},Y.milliseconds=function(){return this.get("milliseconds")},Y.asMilliseconds=function(){return this.as("milliseconds")},Y.seconds=function(){return this.get("seconds")},Y.asSeconds=function(){return this.as("seconds")},Y.minutes=function(){return this.get("minutes")},Y.asMinutes=function(){return this.as("minutes")},Y.hours=function(){return this.get("hours")},Y.asHours=function(){return this.as("hours")},Y.days=function(){return this.get("days")},Y.asDays=function(){return this.as("days")},Y.weeks=function(){return this.get("weeks")},Y.asWeeks=function(){return this.as("weeks")},Y.months=function(){return this.get("months")},Y.asMonths=function(){return this.as("months")},Y.years=function(){return this.get("years")},Y.asYears=function(){return this.as("years")},de}(),ne=function(de,Y,te){return de.add(Y.years()*te,"y").add(Y.months()*te,"M").add(Y.days()*te,"d").add(Y.hours()*te,"h").add(Y.minutes()*te,"m").add(Y.seconds()*te,"s").add(Y.milliseconds()*te,"ms")};return function(de,Y,te){i=te,r=te().$utils(),te.duration=function(z,se){var ye=te.locale();return P(z,{$l:ye},se)},te.isDuration=_;var oe=Y.prototype.add,Q=Y.prototype.subtract;Y.prototype.add=function(z,se){return _(z)?ne(this,z,1):oe.bind(this)(z,se)},Y.prototype.subtract=function(z,se){return _(z)?ne(this,z,-1):Q.bind(this)(z,se)}}})})($Pe);var kIi=$Pe.exports;const jIi=Os(kIi);var LPe={exports:{}};(function(s,p){(function(i,r){s.exports=r()})(Xr,function(){return function(i,r){r.prototype.isLeapYear=function(){return this.$y%4==0&&this.$y%100!=0||this.$y%400==0}}})})(LPe);var UIi=LPe.exports;const FIi=Os(UIi);B.extend(bIi);B.extend(gIi);B.extend(RIi);B.extend(wIi);B.extend(OIi);B.extend(VIi);B.extend(NIi);B.extend($Ii);B.extend(BIi);B.extend(GIi);B.extend(jIi);B.extend(FIi);const $t=s=>B(s),Ar=s=>s.toISOString();function BPe(){return Ar(B())}function MPe(s,p){return $t(s).format(p)}function GPe(s){return Ar(B(s))}function kPe(s){if(s==null)throw new TypeError("ToDate expects a non-null value.");if(typeof s=="string"){const p=B(s);if(!p.isValid())throw new TypeError("Invalid date string.");return p.toISOString()}if(typeof s=="number"&&Number.isFinite(s)){const p=Math.abs(s)<1e12?B.unix(s):B(s);if(!p.isValid())throw new TypeError("Invalid numeric timestamp.");return p.toISOString()}if(s instanceof Date){const p=B(s);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 jPe(s,p,i){return Ar($t(s).add(p,i))}function UPe(s,p,i){return Ar($t(s).subtract(p,i))}function FPe(s,p,i,r=!1){return $t(s).diff($t(p),i,r)}function KPe(s){return $t(s).unix()}function qPe(s){return Ar(B.unix(s))}function SPe(s){return Ar($t(s))}function ZPe(s){return $t(s).year()}function HPe(s){return $t(s).month()}function WPe(s){return $t(s).date()}function zPe(s){return $t(s).hour()}function YPe(s){return $t(s).minute()}function JPe(s){return $t(s).second()}function QPe(s){return $t(s).millisecond()}function XPe(s){return $t(s).isoWeekday()}function eNe(s){return $t(s).week()}function tNe(s){return $t(s).quarter()}function iNe(s){return $t(s).dayOfYear()}function rNe(s){return $t(s).daysInMonth()}function nNe(s,p){return Ar($t(s).year(p))}function aNe(s,p){return Ar($t(s).month(p))}function sNe(s,p){return Ar($t(s).date(p))}function lNe(s,p){return Ar($t(s).hour(p))}function oNe(s,p){return Ar($t(s).minute(p))}function dNe(s,p){return Ar($t(s).second(p))}function uNe(s,p){return Ar($t(s).millisecond(p))}function pNe(s,p){return Ar($t(s).isoWeekday(p))}function cNe(s,p){return Ar($t(s).quarter(p))}function fNe(s,p){return Ar($t(s).startOf(p))}function yNe(s,p){return Ar($t(s).endOf(p))}function hNe(s,p){const i=$t(s),r=i.startOf(p),a=i.endOf(p),c=r.valueOf()+(a.valueOf()-r.valueOf())/2;return Ar(i.valueOf()<c?r:a)}function mNe(s,p,i){return $t(s).isBefore($t(p),i)}function TNe(s,p,i){return $t(s).isAfter($t(p),i)}function vNe(s,p,i){return $t(s).isSame($t(p),i)}function ENe(s,p,i){return $t(s).isSameOrBefore($t(p),i)}function bNe(s,p,i){return $t(s).isSameOrAfter($t(p),i)}function ANe(s,p,i,r,a="()"){return $t(s).isBetween($t(p),$t(i),r,a)}function gNe(s){return B(s).isValid()}function INe(s){return $t(s).isLeapYear()}function RNe(s,p,i){const r=$t(s);return r.isBefore(p)?Ar($t(p)):r.isAfter(i)?Ar($t(i)):Ar(r)}function DNe(s){if(s.length===0)throw new Error("minOf requires at least one date");let p=$t(s[0]);for(let i=1;i<s.length;i++){const r=$t(s[i]);r.isBefore(p)&&(p=r)}return Ar(p)}function wNe(s){if(s.length===0)throw new Error("maxOf requires at least one date");let p=$t(s[0]);for(let i=1;i<s.length;i++){const r=$t(s[i]);r.isAfter(p)&&(p=r)}return Ar(p)}function CNe(s,p=!1){return $t(s).fromNow(p)}function ONe(s,p=!1){return $t(s).toNow(p)}function _Ne(s,p,i=!0){const r=$t(s).diff($t(p),"millisecond",!0),a=Math.abs(r),e=B.duration(a,"milliseconds").humanize();return i?r>=0?`in ${e}`:`${e} ago`:e}function VNe(s,p,i=["6","7"],r=[]){const a=m=>r.some(E=>$t(E).isSame(m,"day")),c=m=>((m.day()+6)%7+1).toString();let e=$t(s);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 Ar(e)}function PNe(s,p){let i=$t(s);const r=p;for(let a=0;a<7;a++)if(i=i.add(1,"day"),i.isoWeekday()===r)return Ar(i);return Ar(i)}function NNe(s,p){let i=$t(s);const r=p;for(let a=0;a<7;a++)if(i=i.subtract(1,"day"),i.isoWeekday()===r)return Ar(i);return Ar(i)}const xNe="Local";function l$(){try{const s=Intl.DateTimeFormat().resolvedOptions().timeZone;if(s&&typeof s=="string")return s}catch{}try{if(typeof process<"u"&&process.env&&process.env.TZ)return process.env.TZ}catch{}return null}function o$(){const s=l$();if(s)return s;throw new Error("Unable to detect current IANA timezone from host environment.")}function $Ne(s,p,i=!1){let r=p;if(r===xNe){const e=l$();if(!e)throw new Error("Unable to detect current timezone from host environment.");r=e}const a=r?B.tz(s,r):$t(s),c=i?a.utc(!0):a.utc();return Ar(c)}function LNe(s,p,i=!1){const r=$t(s);return Ar(i?r.tz(p,!0):r.tz(p))}function BNe(s,p){const i=s===xNe?o$():s;return $t(p).tz(i).utcOffset()}function MNe(s,p,i=!1){return Ar($t(s).utcOffset(p,i))}class GNe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_CURRENT_TIMESTAMP,version:"1.0.0",description:"Date get current timestamp operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.GetCurrentTimestamp);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=BPe();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 kNe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_FORMAT_DATE,version:"1.0.0",description:"Date format operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=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 jNe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_PARSE_DATE,version:"1.0.0",description:"Date parse operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=GPe(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 UNe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_ADD_TO_DATE,version:"1.0.0",description:"Date add-to-date operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=jPe(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 FNe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SUBTRACT_FROM_DATE,version:"1.0.0",description:"Date subtract-from-date operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=UPe(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 KNe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_DIFFERENCE_BETWEEN_DATES,version:"1.0.0",description:"Date difference-between-dates operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.DifferenceBetweenDates);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(E=>{var b,A;return((b=E.value)==null?void 0:b.valueAsType)||((A=E.value)==null?void 0:A.value)}),c=a[0],e=a[1],f=a[2],h=a[3]??!1,m=FPe(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 KIi extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_DATE,version:"1.0.0",description:"Date to-date operation implementation module (coerce to ISO 8601 string)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=kPe(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 qNe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_UNIX,version:"1.0.0",description:"Date to-unix operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=KPe(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 SNe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_FROM_UNIX,version:"1.0.0",description:"Date from-unix operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=qPe(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 ZNe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_ISO_STRING,version:"1.0.0",description:"Date to-iso-string operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=SPe(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 HNe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_YEAR,version:"1.0.0",description:"Date get-year operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=ZPe(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 WNe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_MONTH,version:"1.0.0",description:"Date get-month (0-based) operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=HPe(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 zNe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_DATE,version:"1.0.0",description:"Date get-date (day of month) operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=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 YNe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_HOUR,version:"1.0.0",description:"Date get-hour operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=zPe(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 JNe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_MINUTE,version:"1.0.0",description:"Date get-minute operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=YPe(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 QNe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_SECOND,version:"1.0.0",description:"Date get-second operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=JPe(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 XNe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_MILLISECOND,version:"1.0.0",description:"Date get-millisecond operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=QPe(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 exe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_ISO_WEEKDAY,version:"1.0.0",description:"Date get-iso-weekday operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=XPe(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 txe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_WEEK_OF_YEAR,version:"1.0.0",description:"Date get-week-of-year operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=eNe(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 ixe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_QUARTER,version:"1.0.0",description:"Date get-quarter operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=tNe(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 rxe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_DAY_OF_YEAR,version:"1.0.0",description:"Date get-day-of-year operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=iNe(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 nxe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_DAYS_IN_MONTH,version:"1.0.0",description:"Date get-days-in-month operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=rNe(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 axe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_CURRENT_IANA_TIMEZONE,version:"1.0.0",description:"Date get-current-iana-timezone operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.GetCurrentIanaTimeZone);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=o$();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 sxe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_YEAR,version:"1.0.0",description:"Date set-year operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=nNe(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 lxe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_MONTH,version:"1.0.0",description:"Date set-month operation implementation module (0-based month)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=aNe(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 oxe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_DATE,version:"1.0.0",description:"Date set-date (day of month) operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=sNe(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 dxe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_HOUR,version:"1.0.0",description:"Date set-hour operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=lNe(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 Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_MINUTE,version:"1.0.0",description:"Date set-minute operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=oNe(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 pxe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_SECOND,version:"1.0.0",description:"Date set-second operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=dNe(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 cxe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_MILLISECOND,version:"1.0.0",description:"Date set-millisecond operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=uNe(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 fxe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_ISO_WEEKDAY,version:"1.0.0",description:"Date set-iso-weekday operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=pNe(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 yxe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_QUARTER,version:"1.0.0",description:"Date set-quarter operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=cNe(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 hxe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_START_OF,version:"1.0.0",description:"Date start-of operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=fNe(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 mxe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_END_OF,version:"1.0.0",description:"Date end-of operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=yNe(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 Txe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_ROUND_TO,version:"1.0.0",description:"Date round-to operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=hNe(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 vxe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_BEFORE,version:"1.0.0",description:"Date is-before operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=mNe(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 Exe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_AFTER,version:"1.0.0",description:"Date is-after operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=TNe(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 bxe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_SAME,version:"1.0.0",description:"Date is-same operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=vNe(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 Axe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_SAME_OR_BEFORE,version:"1.0.0",description:"Date is-same-or-before operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=ENe(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 gxe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_SAME_OR_AFTER,version:"1.0.0",description:"Date is-same-or-after operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=bNe(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 Ixe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_BETWEEN,version:"1.0.0",description:"Date is-between operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.IsBetween);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(b=>{var A,_;return((A=b.value)==null?void 0:A.valueAsType)||((_=b.value)==null?void 0:_.value)}),c=a[0],e=a[1],f=a[2],h=a[3],m=a[4],E=ANe(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 Rxe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_VALID,version:"1.0.0",description:"Date is-valid operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=gNe(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 Dxe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_LEAP_YEAR,version:"1.0.0",description:"Date is-leap-year operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=INe(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 Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_CLAMP_TO_RANGE,version:"1.0.0",description:"Date clamp-to-range operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=RNe(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 Cxe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_MIN_OF,version:"1.0.0",description:"Date min-of operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=DNe(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 Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_MAX_OF,version:"1.0.0",description:"Date max-of operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=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 _xe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_FROM_NOW,version:"1.0.0",description:"Date from-now operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=CNe(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 Vxe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_NOW,version:"1.0.0",description:"Date to-now operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=ONe(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 Pxe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_HUMANIZE_DIFF,version:"1.0.0",description:"Date humanize-diff operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=_Ne(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 Nxe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_ADD_BUSINESS_DAYS,version:"1.1.0",description:"Date add-business-days operation implementation module (ISO-weekend strings)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.AddBusinessDays);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(E=>{var b,A;return((b=E.value)==null?void 0:b.valueAsType)??((A=E.value)==null?void 0:A.value)}),c=a[0],e=a[1],f=a[2]??void 0,h=a[3]??[],m=VNe(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 xxe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_NEXT_WEEKDAY,version:"1.0.0",description:"Date next-weekday operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=PNe(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 $xe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_PREVIOUS_WEEKDAY,version:"1.0.0",description:"Date previous-weekday operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=NNe(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 Lxe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_UTC,version:"1.1.0",description:"Date to-utc operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=$Ne(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 Bxe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_CONVERT_TIMEZONE,version:"1.0.0",description:"Date convert-timezone operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=LNe(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 Mxe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_TIMEZONE_OFFSET,version:"1.0.0",description:"Date get-timezone-offset operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=BNe(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 Gxe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_UTC_OFFSET,version:"1.0.0",description:"Date set-utc-offset operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=MNe(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 kxe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_WAIT,version:"1.0.0",description:"Execution wait operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(Ts.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 qIi=/^\d{4}-\d{2}-\d{2}(?:[T ]\d{2}:\d{2}(?::\d{2}(?:\.\d{1,3})?)?(?:Z|[+-]\d{2}:?\d{2})?)?$/,d$=s=>s===null||["string","number","boolean"].includes(typeof s);function zn(s,p="Input must be an array"){if(!Array.isArray(s))throw new TypeError(p);return s}function Go(s){const p=zn(s,"Input must be an array");if(!p||p.length===0)throw new TypeError("No list provided or list is empty");return p}function u$(s){return Array.isArray(s)?s:[]}function Ks(s){return Number(s)}function jxe(s){if(!s||s.length===0)throw new TypeError("No input lists provided");if(!s.every(r=>Array.isArray(r)))throw new TypeError("All inputs must be arrays");const[p,...i]=s;return i.reduce((r,a)=>r.concat(a),p)}function Uxe(s,...p){if(!Array.isArray(s))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 s.concat(...p)}function Fxe(s,p){const i=Go(s),r=Ks(p);return[i.slice(0,r),i.slice(r)]}function Kxe(s){return Go(s).slice().reverse()}function qxe(s){return Go(s).slice(0,-1)}function Sxe(s){return Go(s).slice(1)}function Zxe(s,p,i){const r=zn(s),a=Ks(p);if(a<0||a>r.length)throw new TypeError("Index out of bounds");return[...r.slice(0,a),i,...r.slice(a)]}function Hxe(s,p,i){const r=Go(s),a=Ks(p);if(a<0||a>=r.length)throw new TypeError("Index out of bounds");const c=[...r];return c[a]=i,c}function Wxe(s,p,i){const r=Go(s),a=r.indexOf(p);if(a===-1)return r;const c=[...r];return c[a]=i,c}function zxe(s,p,i){const r=Go(s),a=r.lastIndexOf(p);if(a===-1)return r;const c=[...r];return c[a]=i,c}function Yxe(s,p,i){return Go(s).map(a=>a===p?i:a)}function Jxe(s,p){const i=Go(s),r=Ks(p);if(r<0||r>=i.length)throw new TypeError("Index out of bounds");return i[r]}function Qxe(s){return Go(s)[0]}function Xxe(s){const p=Go(s);return p[p.length-1]}function e$e(s,p,...i){return[...zn(s),p,...i]}function t$e(s,p){const i=zn(s);return[p,...i]}function i$e(s){return zn(s).length}function r$e(s,p){const i=zn(s),r=Ks(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 n$e(s,p){const i=zn(s),r=Math.max(0,Ks(p)??0);return i.slice(0,r)}function a$e(s,p){const i=zn(s),r=Math.max(0,Ks(p)??0);return r===0?[]:i.slice(-r)}function s$e(s,p,i){const r=zn(s),a=p==null?void 0:Ks(p),c=i==null?void 0:Ks(i);return r.slice(a,c)}function l$e(s,p){return zn(s).indexOf(p)}function o$e(s,p){return zn(s).lastIndexOf(p)}function d$e(s){const p=zn(s),i=[],r=new Set;for(const a of p)r.has(a)||(r.add(a),i.push(a));return i}function u$e(s){return zn(s).reduce((i,r)=>i.concat(r),[])}function p$e(s){const p=zn(s);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=>qIi.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 c$e(s){const i=[...zn(s)];for(let r=i.length-1;r>0;r--){const a=Math.floor(E1()*(r+1));[i[r],i[a]]=[i[a],i[r]]}return i}function f$e(s,p){const i=zn(s),r=Math.max(1,Ks(p)||1),a=[];for(let c=0;c<i.length;c+=r)a.push(i.slice(c,c+r));return a}function y$e(s,p,i){const r=zn(s),a=Math.max(0,Ks(p)||0);if(r.length>=a)return[...r];const c=a-r.length;return Array(c).fill(i).concat(r)}function h$e(s,p,i){const r=zn(s),a=Math.max(0,Ks(p)||0);if(r.length>=a)return[...r];const c=a-r.length,e=Array(c).fill(i);return r.concat(e)}function m$e(s,p){const i=zn(s),r=Math.max(0,Ks(p)||0),a=[];for(let c=0;c<r;c++)a.push(...i);return a}function T$e(s,p){if(!d$(p))throw new TypeError("Contains expects the needle to be a primitive (string | number | boolean | null).");return u$(s).some(r=>r===p)}function v$e(s,p){const i=u$(s),r=Array.isArray(p)?p:[p];if(r.length===0)return!1;if(!r.every(d$))throw new TypeError("ContainsAll expects all needles to be primitives (string | number | boolean | null).");return r.every(a=>i.includes(a))}function E$e(s,p){const i=u$(s),r=Array.isArray(p)?p:[p];if(r.length===0)return!1;if(!r.every(d$))throw new TypeError("ContainsAny expects all needles to be primitives (string | number | boolean | null).");return r.some(a=>i.includes(a))}class b$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_JOIN,version:"1.0.0",description:"List join operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(me.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=jxe(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 A$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SPLIT,version:"1.0.0",description:"List split operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(me.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]=Fxe(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 g$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REVERSE,version:"1.0.0",description:"List reverse operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(me.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=Kxe(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 Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_LAST_N_ITEMS,version:"1.0.0",description:"List delete last operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(me.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=qxe(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 Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_FIRST_N_ITEMS,version:"1.0.0",description:"List delete first operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(me.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=Sxe(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 D$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_ADD_AT_INDEX,version:"1.0.0",description:"List add index operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(me.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=Zxe(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 w$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_AT_INDEX,version:"1.0.0",description:"List replace index operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(me.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=Hxe(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 C$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_FIRST_N_ITEMS,version:"1.0.0",description:"List replace first operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(me.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=Wxe(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 O$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_LAST_N_ITEMS,version:"1.0.0",description:"List replace last operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(me.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=zxe(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 _$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_ALL,version:"1.0.0",description:"List replace all operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(me.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=Yxe(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 V$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_INDEX_ITEM,version:"1.0.0",description:"List get index item operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(me.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=Jxe(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 P$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_FIRST,version:"1.0.0",description:"List get first operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(me.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=Qxe(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 Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST,version:"1.0.0",description:"List get last operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(me.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=Xxe(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 x$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_APPEND,version:"1.0.0",description:"List append operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(me.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=e$e(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 $$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PREPEND,version:"1.0.0",description:"List prepend operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(me.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=t$e(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 L$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LENGTH,version:"1.0.0",description:"List get length",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(me.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:i$e(a)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class B$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_AT_INDEX,version:"1.0.0",description:"List delete one item at index (non-mutating)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(me.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=r$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 M$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_FIRST_N_ITEMS,version:"1.0.0",description:"List get first N items",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(me.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=n$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 G$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST_N_ITEMS,version:"1.0.0",description:"List get last N items",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(me.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=a$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 k$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SLICE,version:"1.0.0",description:"List slice(start, end)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(me.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=s$e(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 j$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONCAT,version:"1.0.0",description:"List concat(base, ...others)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(me.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=Uxe(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 U$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_INDEX_OF,version:"1.0.0",description:"List listGetIndexOf(value)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(me.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=l$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 F$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST_INDEX_OF,version:"1.0.0",description:"List listGetLastIndexOf(value)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(me.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=o$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 K$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_UNIQUE,version:"1.0.0",description:"List unique (stable, by reference/===)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(me.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=d$e(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 q$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_FLATTEN,version:"1.0.0",description:"List flatten one level",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(me.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=u$e(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 S$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.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:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(me.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=p$e(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 Z$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SHUFFLE,version:"1.0.0",description:"List shuffle (Fisher–Yates, secure RNG helper)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(me.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=c$e(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 H$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CHUNK,version:"1.0.0",description:"List chunk(size) -> list of lists",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(me.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=f$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 W$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PAD_START,version:"1.0.0",description:"List padStart(targetLength, padValue)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(me.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=y$e(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 z$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PAD_END,version:"1.0.0",description:"List padEnd(targetLength, padValue)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(me.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=h$e(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 Y$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPEAT,version:"1.0.0",description:"List repeat(count)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(me.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=m$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 J$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONTAINS,version:"1.0.0",description:"List contains (primitive needles)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(me.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=T$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 Q$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONTAINS_ALL,version:"1.0.0",description:"List contains all (primitive needles)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(me.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=v$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 X$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONTAINS_ANY,version:"1.0.0",description:"List contains any (primitive needles)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(me.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=E$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 SIi extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LENGTH,version:"1.0.0",description:"Returns the number of characters in a string",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(W.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 eLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_JOIN,version:"1.0.0",description:"String join operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(W.Join);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{var a,c,e;try{const f=r.find(M=>{var G,k;return((k=(G=M.valueOwner)==null?void 0:G.declaration)==null?void 0:k.id)===re.operation[W.Join].inputs.separator.id}),h=((a=f==null?void 0:f.value)==null?void 0:a.value)||"",m=r.find(M=>{var G,k;return((k=(G=M.valueOwner)==null?void 0:G.declaration)==null?void 0:k.id)===re.operation[W.Join].inputs.first.id}),E=((c=m==null?void 0:m.value)==null?void 0:c.value)||"",b=r.find(M=>{var G,k;return((k=(G=M.valueOwner)==null?void 0:G.declaration)==null?void 0:k.id)===re.operation[W.Join].inputs.second.id}),A=((e=b==null?void 0:b.value)==null?void 0:e.value)||"",P=r.filter(M=>{var G,k;return((k=(G=M.valueOwner)==null?void 0:G.declaration)==null?void 0:k.id)===re.operation[W.Join].inputs.dynamicString.id}).map(M=>{var G,k;return((G=M.value)==null?void 0:G.valueAsType)||((k=M.value)==null?void 0:k.value)||""}),V=[E,A,...P].join(h);return{value:U.Success,error:null,result:V}}catch(f){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:f,result:null}}}})}}class tLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT_AT_INDEX,version:"1.0.0",description:"String split at index operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(W.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 iLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.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:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(W.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 rLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.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:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(W.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 nLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.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:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(W.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 aLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_LAST_N_CHARS,version:"1.0.0",description:"String delete last number of characters operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(W.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 sLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_FIRST_N_CHARS,version:"1.0.0",description:"String delete first number of characters operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(W.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 lLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REVERSE,version:"1.0.0",description:"String reverse operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(W.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 oLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TO_LOWER_CASE,version:"1.0.0",description:"String to lower case operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(W.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 dLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TO_UPPER_CASE,version:"1.0.0",description:"String to upper case operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(W.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 uLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_AT_INDEX,version:"1.0.0",description:"String delete index operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(W.DeleteAtIndex);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(E=>{var b,A;return((b=E.value)==null?void 0:b.valueAsType)||((A=E.value)==null?void 0:A.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 pLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ADD_AT_INDEX,version:"1.0.0",description:"String add index operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(W.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 cLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_FIRST_N_CHARS,version:"1.0.0",description:"String replace first operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(W.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 fLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_LAST_N_CHARS,version:"1.0.0",description:"String replace last operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(W.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 yLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_AT_INDEX,version:"1.0.0",description:"String replace index operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(W.ReplaceAtIndex);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(E=>{var b,A;return((b=E.value)==null?void 0:b.valueAsType)||((A=E.value)==null?void 0:A.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 hLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_FIRST_MATCH,version:"1.0.0",description:"String replace single match operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(W.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 mLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_LAST_MATCH,version:"1.0.0",description:"String replace single match operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(W.ReplaceLastMatch);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(E=>{var b,A;return((b=E.value)==null?void 0:b.valueAsType)||((A=E.value)==null?void 0:A.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 TLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_ALL_MATCHES,version:"1.0.0",description:"String replace all matches operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(W.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 vLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_INDEX_ITEM,version:"1.0.0",description:"String get index operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(W.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 ELe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LAST_N_CHARS,version:"1.0.0",description:"String get last N chars operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(W.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 bLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_FIRST_N_CHARS,version:"1.0.0",description:"String get first N chars operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(W.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 ALe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_INDEX_OF,version:"1.0.0",description:"String get index of operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(W.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 gLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_APPEND,version:"1.0.0",description:"String append operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(W.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 ILe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PREPEND,version:"1.0.0",description:"String prepend operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(W.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 RLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TRIM,version:"1.0.0",description:"String trim implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(W.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 DLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TRIM_START,version:"1.0.0",description:"String trimStart implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(W.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 wLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TRIM_END,version:"1.0.0",description:"String trimEnd implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(W.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 CLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SUBSTRING,version:"1.0.0",description:"String substring(start, end?) implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(W.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 OLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SLICE,version:"1.0.0",description:"String slice(start, end?) implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(W.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 _Le extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LAST_INDEX_OF,version:"1.0.0",description:"String lastIndexOf(search, fromIndex?) implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(W.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 VLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PAD_START,version:"1.0.0",description:"String padStart(targetLength, padString?) implementation",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(W.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 PLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PAD_END,version:"1.0.0",description:"String padEnd(targetLength, padString?) implementation",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(W.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 NLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPEAT,version:"1.0.0",description:"String repeat(count) implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(W.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 xLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_MATCH_REGEX,version:"1.0.0",description:"String match(regex) -> first match array or null",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(W.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 $Le extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_MATCH_ALL_REGEX,version:"1.0.0",description:"String matchAll(regex) -> array of matches",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(W.MatchAllRegex);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=r.map(b=>{var A,_;return((A=b.value)==null?void 0:A.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 LLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SEARCH_REGEX,version:"1.0.0",description:"String search(regex) -> index or -1",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(W.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 BLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_REGEX,version:"1.0.0",description:"String replace using RegExp (pattern, replacement, flags?)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(W.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,A;return((b=E.value)==null?void 0:b.valueAsType)??((A=E.value)==null?void 0:A.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 MLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_NORMALIZE_UNICODE,version:"1.0.0",description:"String normalize(form?) implementation module (NFC by default)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(W.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 uI=class uI extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REMOVE_DIACRITICS,version:"1.0.0",description:"Remove diacritics via NFD decomposition + strip combining marks",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(W.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(uI.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(uI,"COMBINING_MARKS",/[\u0300-\u036f]/g);let kg=uI;class GLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_COUNT_OCCURRENCES,version:"1.0.0",description:"Count literal substring occurrences in a string",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(W.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 kLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ENSURE_PREFIX,version:"1.0.0",description:"Ensure string starts with given prefix (add if missing)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(W.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 jLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ENSURE_SUFFIX,version:"1.0.0",description:"Ensure string ends with given suffix (add if missing)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(W.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 ULe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REMOVE_PREFIX,version:"1.0.0",description:"Remove prefix if present",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(W.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 FLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REMOVE_SUFFIX,version:"1.0.0",description:"Remove suffix if present",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(W.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 KLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_STARTS_WITH,version:"1.0.0",description:"String startsWith(needle) -> boolean",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(W.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 qLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ENDS_WITH,version:"1.0.0",description:"String endsWith(needle) -> boolean",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(W.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 SLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_CONTAINS,version:"1.0.0",description:"String includes(needle) -> boolean",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(W.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 ZLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_MATCHES_REGEX,version:"1.0.0",description:"Regex test: new RegExp(pattern, flags?).test(src) -> boolean",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(W.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 HLe(s,p){const i=Number(s),a=10**Math.max(0,Number(p)||0);return Math.round(i*a)/a}function WLe(s,p){const i=Number(s),r=Math.abs(Number(p)||0);return r===0?i:Math.round(i/r)*r}function zLe(s,p,i){const r=Number(s),a=Number(p),c=Number(i);return Math.min(Math.max(r,a),c)}function YLe(s,p,i,r,a){const c=Number(s),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 JLe(...s){const p=s.map(r=>Number(r));return p.length===0?0:p.reduce((r,a)=>r+a,0)/p.length}function QLe(...s){const p=s.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 XLe(s,p){const i=Number(s),r=Number(p);return r===0?NaN:i<0&&r%2===1?-Math.pow(-i,1/r):Math.pow(i,1/r)}function eBe(s,p){const i=Number(s),r=Number(p);return i===0?1/0:(r-i)/i*100}const Bi=s=>s.map(p=>{var i,r;return((i=p.value)==null?void 0:i.valueAsType)??((r=p.value)==null?void 0:r.value)});class tBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ADDITION,version:"1.0.0",description:"Number addition operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(ue.Addition);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=Bi(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 iBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SUBTRACTION,version:"1.0.0",description:"Number subtraction operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(ue.Subtraction);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=Bi(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 rBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MULTIPLICATION,version:"1.0.0",description:"Number multiplication operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(ue.Multiplication);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=Bi(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 nBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_DIVISION,version:"1.0.0",description:"Number division operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(ue.Division);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c]=Bi(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 aBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_REMAINDER,version:"1.0.0",description:"Number remainder operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(ue.Remainder);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c]=Bi(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 sBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_EXPONENTIATION,version:"1.0.0",description:"Number exponentiation operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(ue.Exponentiation);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c]=Bi(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 lBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_NEGATE,version:"1.0.0",description:"Number negate (unary -x)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.Negate);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Bi(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 oBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ABSOLUTE,version:"1.0.0",description:"Number absolute (|x|)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.Absolute);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Bi(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 dBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SIGN,version:"1.0.0",description:"Number sign (-1 | 0 | 1)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.Sign);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Bi(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 uBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ROUND,version:"1.0.0",description:"Number round to nearest integer",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.Round);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Bi(r);return{value:U.Success,error:null,result:Math.round(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class pBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_FLOOR,version:"1.0.0",description:"Number floor (⌊x⌋)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.Floor);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Bi(r);return{value:U.Success,error:null,result:Math.floor(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class cBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_CEIL,version:"1.0.0",description:"Number ceil (⌈x⌉)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.Ceil);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Bi(r);return{value:U.Success,error:null,result:Math.ceil(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class fBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TRUNC,version:"1.0.0",description:"Number truncation (drop fractional part)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.Trunc);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Bi(r);return{value:U.Success,error:null,result:Math.trunc(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class yBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ROUND_TO_DECIMALS,version:"1.0.0",description:"Round to N decimals",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.RoundToDecimals);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=Bi(r),e=HLe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class hBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.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:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.SnapToStep);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=Bi(r),e=WLe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class mBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_CLAMP,version:"1.0.0",description:"Clamp value to [min, max]",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.Clamp);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=Bi(r),f=zLe(a,c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class TBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MAP_RANGE,version:"1.0.0",description:"Map value from [inMin,inMax] to [outMin,outMax]",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.MapRange);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e,f,h]=Bi(r),m=YLe(a,c,e,f,h);return{value:U.Success,error:null,result:m}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class vBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_AVERAGE,version:"1.0.0",description:"Average(numbers...)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.Average);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const a=Bi(r),c=JLe(...a);return{value:U.Success,error:null,result:c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class EBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MEDIAN,version:"1.0.0",description:"Median(numbers...)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.Median);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const a=Bi(r),c=QLe(...a);return{value:U.Success,error:null,result:c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class bBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MIN_OF,version:"1.0.0",description:"Min(numbers...)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.MinOf);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const a=Bi(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 ABe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MAX_OF,version:"1.0.0",description:"Max(numbers...)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.MaxOf);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const a=Bi(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 gBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SQUARE_ROOT,version:"1.0.0",description:"Square root",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.SquareRoot);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Bi(r);return{value:U.Success,error:null,result:Math.sqrt(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class IBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_CUBE_ROOT,version:"1.0.0",description:"Cube root",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.CubeRoot);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Bi(r);return{value:U.Success,error:null,result:Math.cbrt(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class RBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_NTH_ROOT,version:"1.0.0",description:"Nth root (value, n)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.NthRoot);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=Bi(r),e=XLe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class DBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_EXP,version:"1.0.0",description:"e^x",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.Exp);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Bi(r);return{value:U.Success,error:null,result:Math.exp(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class wBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LOG_NATURAL,version:"1.0.0",description:"Natural log ln(x)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.LogNatural);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Bi(r);return{value:U.Success,error:null,result:Math.log(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class CBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LOG10,version:"1.0.0",description:"Log base 10",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.Log10);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Bi(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 OBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SIN,version:"1.0.0",description:"sin(x in radians)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.Sin);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Bi(r);return{value:U.Success,error:null,result:Math.sin(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class _Be extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_COS,version:"1.0.0",description:"cos(x in radians)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.Cos);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Bi(r);return{value:U.Success,error:null,result:Math.cos(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class VBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TAN,version:"1.0.0",description:"tan(x in radians)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.Tan);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Bi(r);return{value:U.Success,error:null,result:Math.tan(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class PBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ASIN,version:"1.0.0",description:"asin(x)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.Asin);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Bi(r);return{value:U.Success,error:null,result:Math.asin(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class NBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ACOS,version:"1.0.0",description:"acos(x)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.Acos);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Bi(r);return{value:U.Success,error:null,result:Math.acos(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class xBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ATAN,version:"1.0.0",description:"atan(x)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.Atan);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Bi(r);return{value:U.Success,error:null,result:Math.atan(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class $Be extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ATAN2,version:"1.0.0",description:"atan2(y, x)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.Atan2);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=Bi(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 LBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TO_RADIANS,version:"1.0.0",description:"deg → rad",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.ToRadians);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Bi(r);return{value:U.Success,error:null,result:Number(a)*Math.PI/180}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class BBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TO_DEGREES,version:"1.0.0",description:"rad → deg",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.ToDegrees);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Bi(r);return{value:U.Success,error:null,result:Number(a)*180/Math.PI}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class MBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_PERCENT_OF,version:"1.0.0",description:"x percent of y",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.PercentOf);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=Bi(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 S_ extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_PERCENTAGE_CHANGE,version:"1.0.0",description:"((new-old)/old)*100",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.PercentageChange);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=Bi(r),e=eBe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class GBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LESS_THAN,version:"1.0.0",description:"a < b",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.LessThan);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=Bi(r);return{value:U.Success,error:null,result:a<c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class kBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MORE_THAN,version:"1.0.0",description:"a > b",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.MoreThan);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=Bi(r);return{value:U.Success,error:null,result:a>c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class jBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LESS_THAN_OR_EQUAL,version:"1.0.0",description:"a <= b",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.LessThanOrEqual);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=Bi(r);return{value:U.Success,error:null,result:a<=c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class UBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MORE_THAN_OR_EQUAL,version:"1.0.0",description:"a >= b",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.MoreThanOrEqual);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=Bi(r);return{value:U.Success,error:null,result:a>=c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}function FBe(s,p){return function(){return s.apply(p,arguments)}}const{toString:ZIi}=Object.prototype,{getPrototypeOf:p$}=Object,{iterator:w1,toStringTag:KBe}=Symbol,C1=(s=>p=>{const i=ZIi.call(p);return s[i]||(s[i]=i.slice(8,-1).toLowerCase())})(Object.create(null)),ko=s=>(s=s.toLowerCase(),p=>C1(p)===s),O1=s=>p=>typeof p===s,{isArray:Um}=Array,_h=O1("undefined");function CE(s){return s!==null&&!_h(s)&&s.constructor!==null&&!_h(s.constructor)&&ms(s.constructor.isBuffer)&&s.constructor.isBuffer(s)}const qBe=ko("ArrayBuffer");function HIi(s){let p;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?p=ArrayBuffer.isView(s):p=s&&s.buffer&&qBe(s.buffer),p}const WIi=O1("string"),ms=O1("function"),SBe=O1("number"),OE=s=>s!==null&&typeof s=="object",zIi=s=>s===!0||s===!1,mg=s=>{if(C1(s)!=="object")return!1;const p=p$(s);return(p===null||p===Object.prototype||Object.getPrototypeOf(p)===null)&&!(KBe in s)&&!(w1 in s)},YIi=s=>{if(!OE(s)||CE(s))return!1;try{return Object.keys(s).length===0&&Object.getPrototypeOf(s)===Object.prototype}catch{return!1}},JIi=ko("Date"),QIi=ko("File"),XIi=s=>!!(s&&typeof s.uri<"u"),eRi=s=>s&&typeof s.getParts<"u",tRi=ko("Blob"),iRi=ko("FileList"),rRi=s=>OE(s)&&ms(s.pipe);function nRi(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const Xj=nRi(),eU=typeof Xj.FormData<"u"?Xj.FormData:void 0,aRi=s=>{let p;return s&&(eU&&s instanceof eU||ms(s.append)&&((p=C1(s))==="formdata"||p==="object"&&ms(s.toString)&&s.toString()==="[object FormData]"))},sRi=ko("URLSearchParams"),[lRi,oRi,dRi,uRi]=["ReadableStream","Request","Response","Headers"].map(ko),pRi=s=>s.trim?s.trim():s.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function _E(s,p,{allOwnKeys:i=!1}={}){if(s===null||typeof s>"u")return;let r,a;if(typeof s!="object"&&(s=[s]),Um(s))for(r=0,a=s.length;r<a;r++)p.call(null,s[r],r,s);else{if(CE(s))return;const c=i?Object.getOwnPropertyNames(s):Object.keys(s),e=c.length;let f;for(r=0;r<e;r++)f=c[r],p.call(null,s[f],f,s)}}function ZBe(s,p){if(CE(s))return null;p=p.toLowerCase();const i=Object.keys(s);let r=i.length,a;for(;r-- >0;)if(a=i[r],p===a.toLowerCase())return a;return null}const bf=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),HBe=s=>!_h(s)&&s!==bf;function Z_(){const{caseless:s,skipUndefined:p}=HBe(this)&&this||{},i={},r=(a,c)=>{if(c==="__proto__"||c==="constructor"||c==="prototype")return;const e=s&&ZBe(i,c)||c;mg(i[e])&&mg(a)?i[e]=Z_(i[e],a):mg(a)?i[e]=Z_({},a):Um(a)?i[e]=a.slice():(!p||!_h(a))&&(i[e]=a)};for(let a=0,c=arguments.length;a<c;a++)arguments[a]&&_E(arguments[a],r);return i}const cRi=(s,p,i,{allOwnKeys:r}={})=>(_E(p,(a,c)=>{i&&ms(a)?Object.defineProperty(s,c,{value:FBe(a,i),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(s,c,{value:a,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),s),fRi=s=>(s.charCodeAt(0)===65279&&(s=s.slice(1)),s),yRi=(s,p,i,r)=>{s.prototype=Object.create(p.prototype,r),Object.defineProperty(s.prototype,"constructor",{value:s,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(s,"super",{value:p.prototype}),i&&Object.assign(s.prototype,i)},hRi=(s,p,i,r)=>{let a,c,e;const f={};if(p=p||{},s==null)return p;do{for(a=Object.getOwnPropertyNames(s),c=a.length;c-- >0;)e=a[c],(!r||r(e,s,p))&&!f[e]&&(p[e]=s[e],f[e]=!0);s=i!==!1&&p$(s)}while(s&&(!i||i(s,p))&&s!==Object.prototype);return p},mRi=(s,p,i)=>{s=String(s),(i===void 0||i>s.length)&&(i=s.length),i-=p.length;const r=s.indexOf(p,i);return r!==-1&&r===i},TRi=s=>{if(!s)return null;if(Um(s))return s;let p=s.length;if(!SBe(p))return null;const i=new Array(p);for(;p-- >0;)i[p]=s[p];return i},vRi=(s=>p=>s&&p instanceof s)(typeof Uint8Array<"u"&&p$(Uint8Array)),ERi=(s,p)=>{const r=(s&&s[w1]).call(s);let a;for(;(a=r.next())&&!a.done;){const c=a.value;p.call(s,c[0],c[1])}},bRi=(s,p)=>{let i;const r=[];for(;(i=s.exec(p))!==null;)r.push(i);return r},ARi=ko("HTMLFormElement"),gRi=s=>s.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(i,r,a){return r.toUpperCase()+a}),tU=(({hasOwnProperty:s})=>(p,i)=>s.call(p,i))(Object.prototype),IRi=ko("RegExp"),WBe=(s,p)=>{const i=Object.getOwnPropertyDescriptors(s),r={};_E(i,(a,c)=>{let e;(e=p(a,c,s))!==!1&&(r[c]=e||a)}),Object.defineProperties(s,r)},RRi=s=>{WBe(s,(p,i)=>{if(ms(s)&&["arguments","caller","callee"].indexOf(i)!==-1)return!1;const r=s[i];if(ms(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+"'")})}})},DRi=(s,p)=>{const i={},r=a=>{a.forEach(c=>{i[c]=!0})};return Um(s)?r(s):r(String(s).split(p)),i},wRi=()=>{},CRi=(s,p)=>s!=null&&Number.isFinite(s=+s)?s:p;function ORi(s){return!!(s&&ms(s.append)&&s[KBe]==="FormData"&&s[w1])}const _Ri=s=>{const p=new Array(10),i=(r,a)=>{if(OE(r)){if(p.indexOf(r)>=0)return;if(CE(r))return r;if(!("toJSON"in r)){p[a]=r;const c=Um(r)?[]:{};return _E(r,(e,f)=>{const h=i(e,a+1);!_h(h)&&(c[f]=h)}),p[a]=void 0,c}}return r};return i(s,0)},VRi=ko("AsyncFunction"),PRi=s=>s&&(OE(s)||ms(s))&&ms(s.then)&&ms(s.catch),zBe=((s,p)=>s?setImmediate:p?((i,r)=>(bf.addEventListener("message",({source:a,data:c})=>{a===bf&&c===i&&r.length&&r.shift()()},!1),a=>{r.push(a),bf.postMessage(i,"*")}))(`axios@${Math.random()}`,[]):i=>setTimeout(i))(typeof setImmediate=="function",ms(bf.postMessage)),NRi=typeof queueMicrotask<"u"?queueMicrotask.bind(bf):typeof process<"u"&&process.nextTick||zBe,xRi=s=>s!=null&&ms(s[w1]),He={isArray:Um,isArrayBuffer:qBe,isBuffer:CE,isFormData:aRi,isArrayBufferView:HIi,isString:WIi,isNumber:SBe,isBoolean:zIi,isObject:OE,isPlainObject:mg,isEmptyObject:YIi,isReadableStream:lRi,isRequest:oRi,isResponse:dRi,isHeaders:uRi,isUndefined:_h,isDate:JIi,isFile:QIi,isReactNativeBlob:XIi,isReactNative:eRi,isBlob:tRi,isRegExp:IRi,isFunction:ms,isStream:rRi,isURLSearchParams:sRi,isTypedArray:vRi,isFileList:iRi,forEach:_E,merge:Z_,extend:cRi,trim:pRi,stripBOM:fRi,inherits:yRi,toFlatObject:hRi,kindOf:C1,kindOfTest:ko,endsWith:mRi,toArray:TRi,forEachEntry:ERi,matchAll:bRi,isHTMLForm:ARi,hasOwnProperty:tU,hasOwnProp:tU,reduceDescriptors:WBe,freezeMethods:RRi,toObjectSet:DRi,toCamelCase:gRi,noop:wRi,toFiniteNumber:CRi,findKey:ZBe,global:bf,isContextDefined:HBe,isSpecCompliantForm:ORi,toJSONObject:_Ri,isAsyncFn:VRi,isThenable:PRi,setImmediate:zBe,asap:NRi,isIterable:xRi};class Qa extends Error{static from(p,i,r,a,c,e){const f=new Qa(p.message,i||p.code,r,a,c);return f.cause=p,f.name=p.name,p.status!=null&&f.status==null&&(f.status=p.status),e&&Object.assign(f,e),f}constructor(p,i,r,a,c){super(p),Object.defineProperty(this,"message",{value:p,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,i&&(this.code=i),r&&(this.config=r),a&&(this.request=a),c&&(this.response=c,this.status=c.status)}toJSON(){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:He.toJSONObject(this.config),code:this.code,status:this.status}}}Qa.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";Qa.ERR_BAD_OPTION="ERR_BAD_OPTION";Qa.ECONNABORTED="ECONNABORTED";Qa.ETIMEDOUT="ETIMEDOUT";Qa.ERR_NETWORK="ERR_NETWORK";Qa.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";Qa.ERR_DEPRECATED="ERR_DEPRECATED";Qa.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";Qa.ERR_BAD_REQUEST="ERR_BAD_REQUEST";Qa.ERR_CANCELED="ERR_CANCELED";Qa.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";Qa.ERR_INVALID_URL="ERR_INVALID_URL";const ar=Qa,$Ri=null;function H_(s){return He.isPlainObject(s)||He.isArray(s)}function YBe(s){return He.endsWith(s,"[]")?s.slice(0,-2):s}function a_(s,p,i){return s?s.concat(p).map(function(a,c){return a=YBe(a),!i&&c?"["+a+"]":a}).join(i?".":""):p}function LRi(s){return He.isArray(s)&&!s.some(H_)}const BRi=He.toFlatObject(He,{},null,function(p){return/^is[A-Z]/.test(p)});function _1(s,p,i){if(!He.isObject(s))throw new TypeError("target must be an object");p=p||new FormData,i=He.toFlatObject(i,{metaTokens:!0,dots:!1,indexes:!1},!1,function(V,M){return!He.isUndefined(M[V])});const r=i.metaTokens,a=i.visitor||E,c=i.dots,e=i.indexes,h=(i.Blob||typeof Blob<"u"&&Blob)&&He.isSpecCompliantForm(p);if(!He.isFunction(a))throw new TypeError("visitor must be a function");function m(P){if(P===null)return"";if(He.isDate(P))return P.toISOString();if(He.isBoolean(P))return P.toString();if(!h&&He.isBlob(P))throw new ar("Blob is not supported. Use a Buffer instead.");return He.isArrayBuffer(P)||He.isTypedArray(P)?h&&typeof Blob=="function"?new Blob([P]):Buffer.from(P):P}function E(P,V,M){let G=P;if(He.isReactNative(p)&&He.isReactNativeBlob(P))return p.append(a_(M,V,c),m(P)),!1;if(P&&!M&&typeof P=="object"){if(He.endsWith(V,"{}"))V=r?V:V.slice(0,-2),P=JSON.stringify(P);else if(He.isArray(P)&&LRi(P)||(He.isFileList(P)||He.endsWith(V,"[]"))&&(G=He.toArray(P)))return V=YBe(V),G.forEach(function(K,le){!(He.isUndefined(K)||K===null)&&p.append(e===!0?a_([V],le,c):e===null?V:V+"[]",m(K))}),!1}return H_(P)?!0:(p.append(a_(M,V,c),m(P)),!1)}const b=[],A=Object.assign(BRi,{defaultVisitor:E,convertValue:m,isVisitable:H_});function _(P,V){if(!He.isUndefined(P)){if(b.indexOf(P)!==-1)throw Error("Circular reference detected in "+V.join("."));b.push(P),He.forEach(P,function(G,k){(!(He.isUndefined(G)||G===null)&&a.call(p,G,He.isString(k)?k.trim():k,V,A))===!0&&_(G,V?V.concat(k):[k])}),b.pop()}}if(!He.isObject(s))throw new TypeError("data must be an object");return _(s),p}function iU(s){const p={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(s).replace(/[!'()~]|%20|%00/g,function(r){return p[r]})}function c$(s,p){this._pairs=[],s&&_1(s,this,p)}const JBe=c$.prototype;JBe.append=function(p,i){this._pairs.push([p,i])};JBe.toString=function(p){const i=p?function(r){return p.call(this,r,iU)}:iU;return this._pairs.map(function(a){return i(a[0])+"="+i(a[1])},"").join("&")};function MRi(s){return encodeURIComponent(s).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function QBe(s,p,i){if(!p)return s;const r=i&&i.encode||MRi,a=He.isFunction(i)?{serialize:i}:i,c=a&&a.serialize;let e;if(c?e=c(p,a):e=He.isURLSearchParams(p)?p.toString():new c$(p,a).toString(r),e){const f=s.indexOf("#");f!==-1&&(s=s.slice(0,f)),s+=(s.indexOf("?")===-1?"?":"&")+e}return s}class GRi{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){He.forEach(this.handlers,function(r){r!==null&&p(r)})}}const rU=GRi,f$={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},kRi=typeof URLSearchParams<"u"?URLSearchParams:c$,jRi=typeof FormData<"u"?FormData:null,URi=typeof Blob<"u"?Blob:null,FRi={isBrowser:!0,classes:{URLSearchParams:kRi,FormData:jRi,Blob:URi},protocols:["http","https","file","blob","url","data"]},y$=typeof window<"u"&&typeof document<"u",W_=typeof navigator=="object"&&navigator||void 0,KRi=y$&&(!W_||["ReactNative","NativeScript","NS"].indexOf(W_.product)<0),qRi=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),SRi=y$&&window.location.href||"http://localhost",ZRi=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:y$,hasStandardBrowserEnv:KRi,hasStandardBrowserWebWorkerEnv:qRi,navigator:W_,origin:SRi},Symbol.toStringTag,{value:"Module"})),Da={...ZRi,...FRi};function HRi(s,p){return _1(s,new Da.classes.URLSearchParams,{visitor:function(i,r,a,c){return Da.isNode&&He.isBuffer(i)?(this.append(r,i.toString("base64")),!1):c.defaultVisitor.apply(this,arguments)},...p})}function WRi(s){return He.matchAll(/\w+|\[(\w*)]/g,s).map(p=>p[0]==="[]"?"":p[1]||p[0])}function zRi(s){const p={},i=Object.keys(s);let r;const a=i.length;let c;for(r=0;r<a;r++)c=i[r],p[c]=s[c];return p}function XBe(s){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&&He.isArray(a)?a.length:e,h?(He.hasOwnProp(a,e)?a[e]=[a[e],r]:a[e]=r,!f):((!a[e]||!He.isObject(a[e]))&&(a[e]=[]),p(i,r,a[e],c)&&He.isArray(a[e])&&(a[e]=zRi(a[e])),!f)}if(He.isFormData(s)&&He.isFunction(s.entries)){const i={};return He.forEachEntry(s,(r,a)=>{p(WRi(r),a,i,0)}),i}return null}function YRi(s,p,i){if(He.isString(s))try{return(p||JSON.parse)(s),He.trim(s)}catch(r){if(r.name!=="SyntaxError")throw r}return(i||JSON.stringify)(s)}const h$={transitional:f$,adapter:["xhr","http","fetch"],transformRequest:[function(p,i){const r=i.getContentType()||"",a=r.indexOf("application/json")>-1,c=He.isObject(p);if(c&&He.isHTMLForm(p)&&(p=new FormData(p)),He.isFormData(p))return a?JSON.stringify(XBe(p)):p;if(He.isArrayBuffer(p)||He.isBuffer(p)||He.isStream(p)||He.isFile(p)||He.isBlob(p)||He.isReadableStream(p))return p;if(He.isArrayBufferView(p))return p.buffer;if(He.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 HRi(p,this.formSerializer).toString();if((f=He.isFileList(p))||r.indexOf("multipart/form-data")>-1){const h=this.env&&this.env.FormData;return _1(f?{"files[]":p}:p,h&&new h,this.formSerializer)}}return c||a?(i.setContentType("application/json",!1),YRi(p)):p}],transformResponse:[function(p){const i=this.transitional||h$.transitional,r=i&&i.forcedJSONParsing,a=this.responseType==="json";if(He.isResponse(p)||He.isReadableStream(p))return p;if(p&&He.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"?ar.from(f,ar.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:Da.classes.FormData,Blob:Da.classes.Blob},validateStatus:function(p){return p>=200&&p<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};He.forEach(["delete","get","head","post","put","patch"],s=>{h$.headers[s]={}});const m$=h$,JRi=He.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"]),QRi=s=>{const p={};let i,r,a;return s&&s.split(`
|
|
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 S(this.project,x.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,H.Updated)),r==="value-as-type-list"&&(this.valueAsTypeList=(this.valueAsTypeList||[]).filter(m=>m.id!==i.id),a==null||a.add(this,H.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,H.Updated)),r==="value-as-type-list"&&(this.valueAsTypeList=[...Array.isArray(this.valueAsTypeList||[])?this.valueAsTypeList:[],i],a==null||a.add(this,H.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){var r;if(this.project.diggestedBuiltInBaseEntitiesIds.has(this.id))return this;if(i&&!B(i).isValid())throw new Error(`The shared timestamp '${i}' is not a valid ISO 8601 date string.`);if(i&&B(i).isSame(B(this.createdAt)))return this;if(!((r=this.knownVersions)!=null&&r.has(this.version))&&this.project.initialized)throw new Error(`The current ${this.type} ${this.id} version '${this.version}' is not captured in the 'knownVersions' map. Capture the current version before increasing it to avoid losing data.`);if(!this.activeVersion)throw new Error(`Only active versions can be increased. Entity with id '${this.id}' and version '${this.version}' is not active.`);return this.previousVersion=this.version,this.version=x.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 yi(this,this.project);if(!this.activeVersion)throw new Error(`Only active versions can be captured. Entity of type ${this.type} with id '${this.id}' and version '${this.version}' is not active.`);if(this.version!==i.version)throw new Error(`Captured ${this.type} with id '${this.id}', version '${i.version}' does not match current entity version '${this.version}'.`);return this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,i):new Map().set(this.version,i),this.apply(i),this}snapshot(){const i=new yi(this,this.project);return this.apply(i)}apply(i){const r=this.toMeta();return i.metaSync(r,null),i.valueAsTypeSingle=this.valueAsTypeSingle,i.valueAsTypeList=this.valueAsTypeList?[...this.valueAsTypeList]:this.valueAsTypeList,i.parent=this.parent,i}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,r){var m;const a=[],c=[],e=[],f=[];if(this.version===i&&(r!=null&&r.skipIfSameVersion))return{updated:C(a),added:C(c),removed:C(e),affected:C(f),self:this};if(!this.knownVersions){const E=new Map;for(const[b,A]of this.knownVersions||new Map){if(E.set(b,A),A.activeVersion=!1,A.knownVersions)for(const[_,P]of A.knownVersions)E.set(_,P);A.knownVersions=null}}let h=(m=this.knownVersions)==null?void 0:m.get(i);if(!h){const E=await this.APILoadVersion({},i);if(!E)throw new Error(`Version with id '${i}' for entity with id '${this.id}' not found.`);h=new yi(E,this.project)}return this.metaSync(h.toShallowJSON(),null),this.previousVersion=h.previousVersion,this.version=h.version,this.createdAt=h.createdAt,this.author=h.author,this.deleted=h.deleted,this.valueAsTypeSingle=h.valueAsTypeSingle,this.parent=h.parent,{updated:C(a),added:C(c),removed:C(e),affected:C(f),self:this}}updateWithShallowTransfer(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.UpdateWithShallowTransfer))){if(!this.checkCanEdit(this,r))return J.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=ie(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=ie(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=ie(a),e=this.project.get(c);e&&this.addValueAsTypeToList(e,r)}),[...this.valueAsTypeList].forEach(a=>{(i.valueAsTypeList||[]).find(e=>ie(e)===a.id)||this.removeValueAsTypeFromList(a,r)}),this.setValueAsTypeSingle(null,r),this.metaSync({value:null},r);else if(i.valueAsTypeSingle){const a=ie(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 S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.UpdateWithGenerationTarget))){if(!this.checkCanEdit(this,r))return J.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=ie(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=ie(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=ie(a),e=this.project.get(c);e&&this.addValueAsTypeToList(e,r)}),[...this.valueAsTypeList].forEach(a=>{(i.valueAsTypeList||[]).find(e=>ie(e)===a.id)||this.removeValueAsTypeFromList(a,r)}),this.setValueAsTypeSingle(null,r),this.metaSync({value:null},r);else if(i.valueAsTypeSingle){const a=ie(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){const e=ie(this.initialData.parent),f=this.project.get(e),h=ie(this.initialData.standaloneParent),m=this.project.get(h);let E="";throw f?E+=` Parent -> ${f.type}: '${f.id}' "${Lt(f,this.project)}".`:E+=" Parent -> not-found.",m?E+=` Standalone Parent -> ${m.type}: '${m.id}' "${Lt(m,this.project)}".`:E+=" Standalone Parent -> not-found.",new Error(`Entity with id '${this.id}' cannot have both 'parent' and 'standaloneParent' properties set.${E}`)}if(this.initialData.parent){const e=ie(this.initialData.parent),f=this.project.get(e);if(J.Logger.log(`[LiteralValueState.hydrateAncestors] Hydrating parent reference '${e}' for entity with id '${this.id}'`),f)J.Logger.log(`[LiteralValueState.hydrateAncestors] Setting parent reference '${f.id}' for entity with id '${this.id}'`),this.setParent(f,null),i.push(f);else throw J.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=ie(this.initialData.standaloneParent),f=this.project.get(e);if(J.Logger.log(`[LiteralValueState.hydrateAncestors] Hydrating standalone parent reference '${e}' for entity with id '${this.id}'`),f)J.Logger.log(`[LiteralValueState.hydrateAncestors] Setting standalone parent reference '${f.id}' for entity with id '${this.id}'`),this.setStandaloneParent(f,null);else throw J.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 J.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=ie(e),h=this.project.get(f);h&&this.valueAsTypeList.push(h)});else if(this.initialData.valueAsTypeSingle){const e=ie(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 S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.AfterAllChildrenInitialized))){if(!this.checkCanEdit(this,i))return J.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,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 S(this.project,x.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 S(this.project,x.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,H.Updated))),r==null||r.attemptAutoclose(w.SetParent,this.id),this):this}setStandaloneParent(i,r=this.project.addChangeSet(new S(this.project,x.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,H.Updated))),r==null||r.attemptAutoclose(w.SetStandaloneParent,this.id),this):this}addValueAsTypeToList(i,r=this.project.addChangeSet(new S(this.project,x.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,H.Updated)),r==null||r.add(this,H.Updated)),r==null||r.attemptAutoclose(w.AddValueAsTypeToList,this.id),this):(J.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 S(this.project,x.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,H.Updated))),r==null||r.add(this,H.Updated)),r==null||r.attemptAutoclose(w.RemoveValueAsTypeFromList,this.id),this):(J.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 S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.SetValueAsTypeSingle))){return this.checkCanEdit(this,r)?(this.valueAsTypeSingle!==i&&(this.valueAsTypeSingle=i,r==null||r.add(this,H.Updated)),r==null||r.attemptAutoclose(w.SetValueAsTypeSingle,this.id),this):(J.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 S(this.project,x.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,H.Updated)):i&&!this.valueAsTypeList?(this.valueAsTypeList=i,r==null||r.add(this,H.Updated)):i&&this.valueAsTypeList&&((a=this.valueAsTypeList)==null?void 0:a.length)!==i.length?(this.valueAsTypeList=i,r==null||r.add(this,H.Updated)):i&&this.valueAsTypeList&&((c=this.valueAsTypeList)!=null&&c.every((e,f)=>e!==i[f]))&&(this.valueAsTypeList=i,r==null||r.add(this,H.Updated)),r==null||r.attemptAutoclose(w.SetValueAsTypeList,this.id),this):(J.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 S(this.project,x.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):(J.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 S(this.project,x.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=ie(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(){var i;return this.activeVersion=!0,(i=this.knownVersions)==null||i.forEach(r=>{r.version!==this.version&&(r.activeVersion=!1)}),this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"meta-sync"))){const a=nn(this,i,r),c=rn(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,H.Removed):a.deleted===!1&&e.deleted?r==null||r.add(this,H.Added):c&&(r==null||r.add(this,H.Updated)),r==null||r.attemptAutoclose("meta-sync",this.id),this}async APILoad(i=Ze,...r){return await yi.repository.APILoad(this.id,...r),this}async APICreate(i=Ze,...r){return await yi.repository.APICreate(this.toShallowJSON(),...r),this}async APIUpdate(i=Ze,...r){return await yi.repository.APIUpdate(this.toShallowJSON(),...r),this}async APIDelete(i=Ze,...r){return await yi.repository.APIDelete(this.toShallowJSON(),...r),this}async APIClone(i=Ze,...r){return await yi.repository.APIClone(this.id,...r),this}async APILoadVersion(i=Ze,r,...a){return await yi.repository.APILoadVersion(this.id,r,...a)}removeFromParent(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RemoveFromParent))){if(!this.checkCanEdit(this,i))return J.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):hI.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 S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RemoveEntity))){var h;if(!this.checkCanDelete(this,r))return J.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}--${Me.ActionOwnerEntityNonDeletable}`,action:w.RemoveEntity,owner:this,errorReason:Me.ActionOwnerEntityNonDeletable,rootAction:((h=r==null?void 0:r.self)==null?void 0:h.id)===this.id&&(r==null?void 0:r.actionName)===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:A}=m.entity.onDetachedDependencyRemoved(this,m.field,r);a.push(...E),c.push(...b),e.push(...A)}),!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 S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RestoreEntity))){if(!this.checkCanEdit(this,i))return J.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=at){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||un(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:x.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=at){var a;let r=this.id;return(a=i.seenEntityMaps)!=null&&a.has(this.id)&&(r=i.seenEntityMaps.get(this.id)),{id:r+"--"+x.UUID.uuid()+"--ref",type:d.GenericReference,entityId:r,version:this.version,entityType:this.type}}toShallowJSON(i=at){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=at){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=vVe(this),{success:!0}}async validateAsync(i={}){const r=J.YieldTracker.from(i);return this.errors=await TVe(this,{tracker:r}),{success:!0}}getErrors(){return[...this.errors]}async getErrorsAsync(i={}){const r=J.YieldTracker.from(i),a=[...this.errors];return await r.tick(),a}getShallowErrors(){return this.errors}clone(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.CloneEntity)),r=null,a=null,c=!0){const e=Kr(r,this),f=this.toJSON();r?(f.parent=r.toReference(),f.standaloneParent=null):(f.parent=null,this.standaloneParent?f.standaloneParent=this.standaloneParent.toReference():this.parent?f.standaloneParent=this.parent.toReference():f.standaloneParent=null);const h=a||x.UUID.uuid();f.id=h,f.version=x.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=lr(f,e);return m.hydrateAncestors(),r&&m.setParent(r,i),c&&(m.subscribe(),m.addSelfToProject(i)),i==null||i.add(m,H.Added),m.initChildren(i),i||m.captureVersion(),i==null||i.attemptAutoclose(w.CloneEntity,this.id),m}merge(i,r=this.project.addChangeSet(new S(this.project,x.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(yi,"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(yi,"type",d.LiteralValue),R(yi,"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(yi,"USER_MANAGED_STANDALONE_PARENT_TYPES",[...yI]),R(yi,"PARENT_TYPES",[...yi.USER_MANAGED_PARENT_TYPES]),R(yi,"MUTABLE_BASE_PROPERTIES",["name","autogeneration","value"]),R(yi,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),R(yi,"BASE_PROPERTIES",[...yi.MUTABLE_BASE_PROPERTIES,...yi.INMUTABLE_BASE_PROPERTIES]),R(yi,"MUTABLE_META_PROPERTIES",[...yi.MUTABLE_BASE_PROPERTIES]),R(yi,"INMUTABLE_META_PROPERTIES",[...yi.INMUTABLE_BASE_PROPERTIES]),R(yi,"META_PROPERTIES",[...yi.MUTABLE_META_PROPERTIES,...yi.INMUTABLE_META_PROPERTIES]),R(yi,"MUTABLE_UPSTREAM_PROPERTIES",["valueAsTypeSingle","valueAsTypeList"]),R(yi,"INMUTABLE_UPSTREAM_PROPERTIES",["parent"]),R(yi,"UPSTREAM_PROPERTIES",[...yi.MUTABLE_UPSTREAM_PROPERTIES,...yi.INMUTABLE_UPSTREAM_PROPERTIES]),R(yi,"MUTABLE_DOWNSTREAM_PROPERTIES",[]),R(yi,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),R(yi,"DOWNSTREAM_PROPERTIES",[...yi.MUTABLE_DOWNSTREAM_PROPERTIES,...yi.INMUTABLE_DOWNSTREAM_PROPERTIES]),R(yi,"PROPERTIES",[...yi.META_PROPERTIES,...yi.UPSTREAM_PROPERTIES,...yi.DOWNSTREAM_PROPERTIES]);let Br=yi;function ry(s){if(typeof crypto<"u"&&typeof crypto.getRandomValues=="function"){const i=new Uint8Array(s);return crypto.getRandomValues(i),i}const{randomBytes:p}=require("crypto");return p(s)}function bVe(s,p){const i=p-s+1,a=E1()*i;return Math.floor(a)+s}function AVe(){const s=ry(4);return(s[0]<<24|s[1]<<16|s[2]<<8|s[3])>>>0}function E1(){return AVe()/2**32}function Wx(s){const p=ry(s);return Array.from(p).map(i=>i.toString(16).padStart(2,"0")).join("")}const U_="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";function zx(s){let p="";const i=ry(s);for(let r=0;r<s;r++)p+=U_[i[r]%U_.length];return p}function gVe(s){const p=ry(s);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 Yx(s){return zx(s)}function Jx(s,p=U_){let i="";const r=ry(s);for(let a=0;a<s;a++)i+=p[r[a]%p.length];return i}function Ip(){const s=ry(16);s[6]=s[6]&15|64,s[8]=s[8]&63|128;const p=Array.from(s).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 IVe(){return Jx(6)}function RVe(){return Wx(32)}const Xgi=63,eIi=/^[a-z][a-z0-9-]*[a-z0-9]$/;function tIi(s){return s.length>=1&&s.length<=Xgi&&eIi.test(s)&&!s.includes("--")}function*iIi(){yield"";const s="abcdefghijklmnopqrstuvwxyz";for(let p=1;;p++){const i=new Array(p).fill(0);let r=!1;for(;!r;){yield i.map(a=>s[a]).join("");for(let a=p-1;a>=0&&(i[a]++,!(i[a]<s.length));a--)i[a]=0,a===0&&(r=!0)}}}function rIi(s,p){const i=new Set(s.map(a=>a.toLowerCase())),r=p>0?"secondarydb":"main";for(const a of iIi()){const c=a?`${r}${a}`:r;if(tIi(c)&&!i.has(c))return c}throw new Error("Unable to generate identifier")}function DVe(s,p){switch(s.id){case re["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.id:{const i=s.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(A=>A.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(A=>A.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:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(p==null?void 0:p.timestamp)||new Date().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.LiteralValue,standaloneParent:null,name:fe.EntityTemplate,autogeneration:null,value:!0,valueAsTypeSingle:null,valueAsTypeList:null,parent:m==null?void 0:m.toReference()},A=Ie(b,s.project);return A.hydrateAncestors(),A.setParent(m,p),A.addSelfToProject(p),p==null||p.add(A,H.Added),A.initChildren(p),p||A.captureVersion(),{newEntities:[A]}}return{newEntities:[]}}else if(r)return{newEntities:[]};const a=s.project.get(re["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id),c=b1(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:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(p==null?void 0:p.timestamp)||new Date().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.LiteralValue,standaloneParent:null,name:fe.EntityTemplate,autogeneration:null,value:!0,valueAsTypeSingle:null,valueAsTypeList:null,parent:e==null?void 0:e.toReference()},m=Ie(h,s.project);m.hydrateAncestors(),m.setParent(e,p),m.addSelfToProject(p),p==null||p.add(m,H.Added),m.initChildren(p),p||m.captureVersion()}return{newEntities:[c]}}}return{newEntities:[]}}function wVe(s,p){const i=[],r=[],a=[],c=[];return s.implements.filter(f=>f.type===d.BuiltInBaseEntity).forEach(f=>{var h,m,E,b,A,_,P,V,M;switch(f.id){case re["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.id:{const G=s.project.entities.filter(Y=>Y.implements.find(te=>te.id===re["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id));let k=G.find(Y=>!!Y.properties.find(te=>{var oe;return te.implements.find(Q=>Q.id===re["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id)&&((oe=te.getDefaultValue())==null?void 0:oe.value)===!0}));if(!k&&G.length)k=G[0];else if(!k&&!G.length){k=s.project.getBuiltIn(re["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id).implement("Relational database",p);const te=k.properties.find(oe=>oe.implements.find(Q=>Q.id===re["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id));(h=te==null?void 0:te.defaultValue)==null||h.metaSync({value:!0},p),r.push(k)}const K=s.properties.find(Y=>Y.implements.find(te=>te.id===re["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.properties.database.id));if(K&&!(K!=null&&K.defaultValue)){const Y={id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(p==null?void 0:p.timestamp)||new Date().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.LiteralValue,standaloneParent:null,name:fe.EntityTemplate,autogeneration:null,value:null,valueAsTypeSingle:(k==null?void 0:k.toJSON())||null,valueAsTypeList:null,parent:K==null?void 0:K.toReference()},te=Ie(Y,s.project);te.hydrateAncestors(),te.setParent(K,p),te.addSelfToProject(p),p==null||p.add(te,H.Added),te.initChildren(p),(K==null?void 0:K.defaultValue).setValueAsTypeSingle(k||null,p),r.push(te),p||te.captureVersion();return}else K!=null&&K.defaultValue&&!(K!=null&&K.defaultValue.valueAsTypeSingle)&&(K==null||K.defaultValue.setValueAsTypeSingle(k||null,p));const le=s.properties.find(Y=>Y.implements.find(te=>te.id===re["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.properties.primaryKey.id));if(!le)throw new Error(`[handleAfterEntityImplementationSideEffects] Primary key property not found for implemented base entity ${re["built-in-base-entity"]}`);let ne=!1;if(!le.dataType){const Y=Tr.new(p);Y.parent=le.toReference();const te=Ie(Y,s.project);te.hydrateAncestors(),te.setParent(le,p),te.addSelfToProject(p),p==null||p.add(te,H.Added),te.initChildren(p),ne=!0}const de=s.project.getBuiltIn(re["primitive-entity"].number.id);(m=le.dataType)==null||m.setEntity(de,p),ne&&(p||(E=le.dataType)==null||E.captureVersion());return}case re["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id:{const G=s.project.entities.filter(Q=>Q.implements.find(z=>z.id===re["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id)&&Q.id!==s.id),k=G.map(Q=>{var ye;const z=Q.properties.find(ce=>ce.implements.find(he=>he.id===re["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.identifier.id));return(ye=z==null?void 0:z.getDefaultValue())==null?void 0:ye.value}).filter(Q=>!!Q),K=s.properties.find(Q=>Q.implements.find(z=>z.id===re["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.identifier.id));if(!G.find(Q=>!!Q.properties.find(z=>{var se;return z.implements.find(ye=>ye.id===re["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id)&&((se=z.getDefaultValue())==null?void 0:se.value)===!0}))){const Q=s.properties.find(se=>se.implements.find(ye=>ye.id===re["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id));if(!Q)throw new Error("Default boolean property not found for relational database entity with id: "+s.id);let z=!1;if(!(Q!=null&&Q.defaultValue)){const se=Br.new(p);se.parent=Q.toReference();const ye=Ie(se,s.project);ye.hydrateAncestors(),ye.setParent(Q,p),ye.addSelfToProject(p),p==null||p.add(ye,H.Added),ye.initChildren(p),z=!0}(b=Q==null?void 0:Q.defaultValue)==null||b.metaSync({value:!0},p),z&&(p||(A=Q==null?void 0:Q.defaultValue)==null||A.captureVersion())}if(!K)throw new Error("Identifier property not found for relational database entity with id: "+s.id);let ne=!1;if(!(K!=null&&K.defaultValue)){const Q=Br.new(p);Q.parent=K.toReference();const z=Ie(Q,s.project);z.hydrateAncestors(),z.setParent(K,p),z.addSelfToProject(p),p==null||p.add(z,H.Added),z.initChildren(p),ne=!0}const de=rIi(k,G.length);(_=K.defaultValue)==null||_.metaSync({value:de},p),ne&&(p||(P=K.defaultValue)==null||P.captureVersion());const Y=s.properties.find(Q=>Q.implements.find(z=>z.id===re["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.password.id));if(!Y)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 ${s.id}`);let te=!1;if(!Y.defaultValue){const Q=Br.new(p);Q.parent=Y.toReference();const z=Ie(Q,s.project);z.hydrateAncestors(),z.setParent(Y,p),z.addSelfToProject(p),p==null||p.add(z,H.Added),z.initChildren(p),r.push(z),te=!0}const oe=Yx(24);(V=Y.defaultValue)==null||V.metaSync({value:oe},p),te&&(p||(M=Y.defaultValue)==null||M.captureVersion());return}case re["built-in-base-entity"].BUILT_IN_SQL_ROW_TRANSFORMER_ENTITY.id:{const G=s.properties.find(ne=>ne.implements.find(de=>de.id===re["built-in-base-entity"].BUILT_IN_SQL_ROW_TRANSFORMER_ENTITY.properties.time.id));if(!G)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 ${s.id}`);let k=G.defaultValue||null;if(!k){const ne=Br.new(p);ne.parent=G.toReference(),ne.name=fe.Date,ne.id=x.UUID.uuid(),k=Ie(ne,s.project),k.hydrateAncestors(),k.setParent(G,p),k.addSelfToProject(p),k.initChildren(p),p==null||p.add(k,H.Added)}k.metaSync({value:new Date().toISOString()},p),k.metaSync({editable:!1,deletable:!1},p),G.metaSync({editable:!1,deletable:!1},p);const K=s.properties.find(ne=>ne.implements.find(de=>de.id===re["built-in-base-entity"].BUILT_IN_SQL_ROW_TRANSFORMER_ENTITY.properties.definition.id));if(!K)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 ${s.id}`);let le=K.defaultValue||null;if(!le){const ne=Br.new(p);ne.name=fe.EntityTemplate,ne.parent=K.toReference(),ne.id=x.UUID.uuid(),le=Ie(ne,s.project),le.hydrateAncestors(),le.setParent(K,p),le.addSelfToProject(p),le.initChildren(p),p==null||p.add(le,H.Added)}}}}),{self:s,updated:C(i),added:C(r),removed:C(a),affected:C(c)}}function b1(s,p,i,r){const a=r||x.UUID.uuid(),c=qs.new(i);c.id=a,c.name=p,c.static=s.static,c.implements=[s.toJSON()],c.parent=s.project.toReference(),c.static=s.static,DVe(s,i);const e=Ie(c,s.project);return e.hydrateAncestors(),i==null||i.add(e,H.Added),e.addSelfToProject(i),e.initChildren(i),i||e.captureVersion(),wVe(e,i),e.afterAllChildrenInitialized(i),e}function Qx(s,p){return p.entities.find(a=>{const c=a.properties,e=c.map(b=>b.name),f=s.every(b=>e.includes(b)),h=e.filter(b=>!s.includes(b)),m=c.every(b=>!h.includes(b.name)||!b.required);return f&&m})||null}function CVe(s,p,i,r=Ye.OrDataTypeGroup){const a=[],c=[],e=[],f=[],h=x.UUID.uuid(),m=Tr.new(i);m.id=h,m.parent=p.toReference(),m.like=!0,m.parentRelationType=r;const E=Ie(m,s.project);return c.push(E),E.setParent(p,i),E.addSelfToProject(i),i==null||i.add(E,H.Added),E.setEntity(s,i),E.initChildren(i),i||E.captureVersion(),{updated:C(a),added:C(c),removed:C(e),affected:C(f),self:E}}function Xx(s,p,i,r,a){var m,E,b,A,_,P,V,M;const c=[],e=[],f=[],h=[];switch(typeof s){case"string":let G=!1;const k=new Date(s);if(k instanceof Date&&!isNaN(k.valueOf())&&(G=!0),G){const K=p.project.getBuiltIn(re[d.PrimitiveEntity][fe.Date].id);p.setEntity(K,r);break}else{const K=p.project.getBuiltIn(re[d.PrimitiveEntity][fe.String].id);p.setEntity(K,r);break}case"number":p.setEntity(p.project.getBuiltIn(re[d.PrimitiveEntity][fe.Number].id),r);break;case"boolean":p.setEntity(p.project.getBuiltIn(re[d.PrimitiveEntity][fe.Boolean].id),r);break;case"object":if(s===null){p.setEntity(p.project.getBuiltIn(re[d.PrimitiveEntity][fe.Null].id),r);break}else if(Array.isArray(s))if(p.metaSync({isList:!0},r),s.length>0){const K=s.slice(0,5).filter(ne=>ne!==void 0);if(K.every(ne=>typeof ne==typeof K[0])&&(typeof K[0]!="object"||K[0]===null))switch(typeof K[0]){case"string":p.setEntity(p.project.getBuiltIn(re[d.PrimitiveEntity][fe.String].id),r);break;case"number":p.setEntity(p.project.getBuiltIn(re[d.PrimitiveEntity][fe.Number].id),r);break;case"boolean":p.setEntity(p.project.getBuiltIn(re[d.PrimitiveEntity][fe.Boolean].id),r);break;case"object":p.setEntity(p.project.getBuiltIn(re[d.PrimitiveEntity][fe.Null].id),r);break}else{const ne=[];let de=!1;K.forEach(te=>{var oe,Q,z,se;if(Array.isArray(te)&&(de=!0),typeof te=="object"&&!Array.isArray(te)&&te!==null){const ye=yg(te,p.project,{...i,id:x.UUID.uuid()},r,a);ye.hasCreated&&ne.push((oe=ye.changeSet)==null?void 0:oe.self),c.push(...(Q=ye.changeSet)==null?void 0:Q.updated),e.push(...(z=ye.changeSet)==null?void 0:z.added),f.push(...(se=ye.changeSet)==null?void 0:se.removed)}});const Y=C(ne);if(!Y.length&&!de){K.forEach(te=>{const oe=Tr.new(r);oe.parentRelationType=Ye.OrDataTypeGroup,oe.parent=p.toReference();const Q=Ie(oe,p.project);switch(Q.hydrateAncestors(),Q.setParent(p,r),Q.addSelfToProject(r),r==null||r.add(Q,H.Added),Q.initChildren(r),typeof te){case"string":Q.setEntity(Q.project.getBuiltIn(re[d.PrimitiveEntity][fe.String].id),r);break;case"number":Q.setEntity(Q.project.getBuiltIn(re[d.PrimitiveEntity][fe.Number].id),r);break;case"boolean":Q.setEntity(Q.project.getBuiltIn(re[d.PrimitiveEntity][fe.Boolean].id),r);break;case"object":Q.setEntity(Q.project.getBuiltIn(re[d.PrimitiveEntity][fe.Null].id),r);break}r||Q.captureVersion()});break}else Y.length===1&&!de?p.setEntity(Y[0],r):K.forEach(te=>{if(typeof te=="object"&&!Array.isArray(te)&&te!==null){const oe=Qx(Object.keys(te),p.project);if(oe){const Q=CVe(oe||Y[0],p,r,Ye.OrDataTypeGroup);c.push(...Q.updated),e.push(...Q.added),f.push(...Q.removed)}}else{const oe=Tr.new(r);oe.parentRelationType=Ye.OrDataTypeGroup,oe.parent=p.toReference();const Q=Ie(oe,p.project);Q.hydrateAncestors(),Q.setParent(p,r),Q.addSelfToProject(r),r==null||r.add(Q,H.Added),Q.initChildren(r);const z=Xx(te,Q,{...i,id:x.UUID.uuid()},r,a);c.push(...z.updated),e.push(...z.added),f.push(...z.removed),r||Q.captureVersion()}})}}else{const K=yg(s[0],p.project,{...i},r,a);p.setEntity((m=K.changeSet)==null?void 0:m.self,r),c.push(...(E=K.changeSet)==null?void 0:E.updated),e.push(...(b=K.changeSet)==null?void 0:b.added),f.push(...(A=K.changeSet)==null?void 0:A.removed);break}else{const K=yg(s,p.project,{...i},r,a);p.setEntity((_=K.changeSet)==null?void 0:_.self,r),c.push(...(P=K.changeSet)==null?void 0:P.updated),e.push(...(V=K.changeSet)==null?void 0:V.added),f.push(...(M=K.changeSet)==null?void 0:M.removed);break}}return{updated:C(c),added:C(e),removed:C(f),affected:C(h),self:p}}function yg(s,p,i,r,a){const c=[],e=[],f=[],h=[],m=Object.keys(s),E=Qx(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||x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(r==null?void 0:r.timestamp)||new Date().toISOString(),author:x.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()},P=Ie(_,p);return P.hydrateAncestors(),P.setParent(p,r),P.addSelfToProject(r),r==null||r.add(P,H.Added),P.initChildren(r),e.push(P),m.forEach((V,M)=>{const G=x.UUID.uuid(),k=qa.new(r);k.id=G,k.name=V,k.codeName=V,k.parent=P.toReference(),k.index=M,k.required=!0,k.interactive=!0;const K=Ie(k,p);K.hydrateAncestors(),K.setParent(P,r),K.addSelfToProject(r),r==null||r.add(K,H.Added),K.initChildren(r),e.push(K);const le=s[V],ne=x.UUID.uuid(),de=Tr.new(r);de.id=ne,de.parent=K.toReference(),de.like=!0,de.isList=!1;const Y=Ie(de,p);Y.hydrateAncestors(),Y.setParent(K,r),Y.addSelfToProject(r),r==null||r.add(Y,H.Added),Y.initChildren(r),e.push(Y);const te=Xx(le,Y,{...i,name:V,id:x.UUID.uuid()},r,a||P);c.push(...te.updated),e.push(...te.added),f.push(...te.removed),r||(K.captureVersion(),Y.captureVersion())}),r||P.captureVersion(),{hasCreated:!0,changeSet:{updated:C(c),added:C(e),removed:C(f),affected:C(h),self:P}}}function zd(s,p,i,r){const a=[];return!s.length||!p.length?{errors:a,overlap:!1}:(s.length>p.length?s.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(A=>A.id===b.id)):((m=h.implements)==null?void 0:m.id)===((E=c.implements)==null?void 0:E.id)});if(e){const h=new qi({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:ve.Error,code:r,entity:c,firstRelationship:e});a.push(h)}if(f){const h=new qi({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:ve.Error,code:i,entity:c,firstRelationship:f});a.push(h)}}):p.forEach(c=>{var h;const e=s.find(m=>m.name===c.name),f=s.find(m=>{var E,b;return m.implements&&Array.isArray(m.implements)?m.implements.some(A=>!!c.implements.find(_=>_.id===A.id)):((E=m.implements)==null?void 0:E.id)===((b=c.implements)==null?void 0:b.id)});if(e){const m=new qi({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:ve.Error,code:r,entity:e,firstRelationship:c});a.push(m)}if(f){const m=new qi({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)?At(f==null?void 0:f.implements.map(E=>E.type),"', '","' and '"):(h=f.implements)==null?void 0:h.id}`,severity:ve.Error,code:i,entity:f,firstRelationship:c});a.push(m)}}),{errors:a,overlap:!!a.length})}function nIi(s,p){return s.abstract||(s.properties.forEach(r=>{r.abstract||r.metaSync({abstract:!0},p)}),Object.values(s.detachedDependents).forEach(r=>{r.field===wL.EntityField&&r.entity.remove({ignoreUpstream:!1},p)}),s.metaSync({abstract:!0},p)),s}function aIi(s,p){return s.abstract&&(s.properties.forEach(r=>{r.abstract&&r.metaSync({abstract:!1},p)}),Object.values(s.detachedDependents).forEach(r=>{(r.field===Xg.Implements||r.field===Xg.Extends)&&r.entity.onDetachedDependencyRemoved(s,r.field,p)}),s.metaSync({abstract:!1},p)),s}function sIi(s,p){return s.static||(s.properties.forEach(r=>{r.static||r.metaSync({static:!0},p)}),s.metaSync({static:!0},p)),s}function lIi(s,p){return s.static&&s.metaSync({static:!1},p),s}const tv=class tv extends Kx{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=Ie(a,this.project);return c.setParent(this,null),c.initChildren(null),c}),this.methods=this.initialData.methods.map(a=>{const c=Ie(a,this.project);return c.setParent(this,null),c.initChildren(null),c}),this.abstractMethods=this.initialData.abstractMethods.map(a=>{const c=Ie(a,this.project);return c.setParent(this,null),c.initChildren(null),c}),this.initialData.allPropertiesImplement){const a=Ie(this.initialData.allPropertiesImplement,this.project);a.setParent(this,null),a.initChildren(null),this.allPropertiesImplement=a}if(this.initialData.additionalPropertiesDataType){const a=Ie(this.initialData.additionalPropertiesDataType,this.project);a.setParent(this,null),a.initChildren(null),this.additionalPropertiesDataType=a}this.initialData.extends&&(this.extends=Ie(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(A=>A.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=Ze,...r){return await tv.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=at){return{id:this.id+"--"+x.UUID.uuid()+"--ref",type:d.GenericReference,entityId:this.id,version:this.version,entityType:this.type}}toShallowJSON(i=at){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=at){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=Ygi(this),{success:!0}}async validateAsync(i={}){const r=J.YieldTracker.from(i);return this.errors=await zgi(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=J.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 S(this.project,x.sessionAuthor,B().toISOString(),null,!0,"implement-built-in-base-entity")),a){const c=b1(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 tv&&i.push(...this.extends.getAllInteractiveMethods())}return C(i)}getRawDefaultValue(){const i={};return this.properties.forEach(r=>{var e;if(!Iv(r)||!r.defaultValue)return;const a=pe(r,this.project),c=r.codeName||gp(r,this.project)||ys(ir(a));i[c]=((e=r.getDefaultValue())==null?void 0:e.value)||null}),i}};R(tv,"repository",{APILoad:async(i,...r)=>null});let md=tv;class OVe extends md{constructor(i){super(Vn,i);R(this,"initialData");R(this,"id",ge.PERSISTED_ENTITY);R(this,"version","1");R(this,"name",ge.PERSISTED_ENTITY);R(this,"description",Vn.description);R(this,"type",d.BuiltInBaseEntity);R(this,"abstract",Vn.abstract);R(this,"static",Vn.static);R(this,"properties",[]);R(this,"methods",[]);R(this,"abstractMethods",[]);R(this,"extends",null);R(this,"errors",[]);R(this,"project");this.initialData=Vn,this.project=i,this.id=Vn.id,this.version=Vn.version,this.name=Vn.name,this.static=Vn.static,this.abstract=Vn.abstract,this.properties=this.initialData.properties.map(r=>{const a=Ie(r,this.project);return a.setParent(this,null),a.initChildren(null),a}),this.methods=this.initialData.methods.map(r=>{const a=Ie(r,this.project);return a.parent=this,a}),this.abstractMethods=this.initialData.abstractMethods.map(r=>{const a=Ie(r,this.project);return a.parent=this,a}),this.initialData.extends&&(this.extends=Ie(this.initialData.extends,this.project))}}var xn=(s=>(s.ValueMustBeString="value-must-be-string",s.StringValueMustNotHaveSpaces="string-value-must-not-have-spaces",s.StringValueMustNotHaveDashes="string-value-must-not-have-dashes",s.MustBeUniqueAmongSameEntities="must-be-unique-among-same-entities",s))(xn||{});function e$(s,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 qi({id:s.id+"--string-value-must-not-have-spaces",message:`Entity of type ${s.type} with id "${s.id}" has an invalid value "${p}". The value cannot contain spaces.`,severity:ve.Error,code:"string-value-must-not-have-spaces",entity:s});i.push(a)}return{errors:i,override:r.replace(/\s/g,"-")}}function _Ve(s,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 qi({id:s.id+"--string-value-must-not-have-spaces",message:`Entity of type ${s.type} with id "${s.id}" has an invalid value "${p}". The value cannot contain spaces or dashes.`,severity:ve.Error,code:"string-value-must-not-have-spaces",entity:s});i.push(a)}if(r.includes("-")){const a=new qi({id:s.id+"--string-value-must-not-have-dashes",message:`Entity of type ${s.type} with id "${s.id}" has an invalid value "${p}". The value cannot contain spaces or dashes.`,severity:ve.Error,code:"string-value-must-not-have-dashes",entity:s});i.push(a)}return{errors:i,override:r.replace(/\s|-/g,"_")}}var Td=(s=>(s.StatusCodeMustBeNumber="status-code-must-be-number",s.StatusCodeMustBeBetween100And599="status-code-must-be-between-100-and-599",s))(Td||{});function VVe(s,p){const i=[];if(typeof p!="number"){const r=new qi({id:s.id+"--status-code-must-be-number",message:`Entity of type ${s.type} with id "${s.id}" has an invalid value "${p}". The value must be a number.`,severity:ve.Error,code:"status-code-must-be-number",entity:s});return i.push(r),{errors:i,override:p}}if(p<100||p>599){const r=new qi({id:s.id+"--status-code-must-be-between-100-and-599",message:`Entity of type ${s.type} with id "${s.id}" has an invalid value "${p}". The value must be a number between 100 and 599.`,severity:ve.Error,code:"status-code-must-be-between-100-and-599",entity:s});i.push(r)}return{errors:i,override:p}}class PVe extends md{constructor(i){var f,h;super(us,i);R(this,"initialData");R(this,"id",ge.HTTP_ENDPOINT);R(this,"version","1");R(this,"name",ge.HTTP_ENDPOINT);R(this,"description",us.description);R(this,"type",d.BuiltInBaseEntity);R(this,"abstract",us.abstract);R(this,"static",us.static);R(this,"properties",[]);R(this,"methods",[]);R(this,"abstractMethods",[]);R(this,"extends",null);R(this,"errors",[]);R(this,"project");this.initialData=us,this.project=i,this.id=us.id,this.version=us.version,this.name=us.name,this.static=us.static,this.abstract=us.abstract,this.properties=this.initialData.properties.map(m=>{const E=Ie(m,this.project);return E.setParent(this,null),E.initChildren(null),E}),this.methods=this.initialData.methods.map(m=>{const E=Ie(m,this.project);return E.parent=this,E}),this.abstractMethods=this.initialData.abstractMethods.map(m=>{const E=Ie(m,this.project);return E.parent=this,E}),this.initialData.extends&&(this.extends=Ie(this.initialData.extends,this.project));const r=this.properties.find(m=>m.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=(m,E)=>{var M;const b=e$(m,E),A=m.parent,_=A.properties.find(G=>G.implements.find(k=>k.id===re["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.properties.method.id)),P=(M=_==null?void 0:_.getDefaultValue())==null?void 0:M.value;if(m.project.entities.filter(G=>ui(G,ge.HTTP_ENDPOINT)&&G.id!==A.id).some(G=>{var le,ne;const k=G.properties.find(de=>de.implements.find(Y=>Y.id===re["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.properties.method.id));if(((le=k==null?void 0:k.getDefaultValue())==null?void 0:le.value)!==P)return!1;const K=G.properties.find(de=>de.implements.find(Y=>Y.id===re["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.properties.path.id));if(!K)throw new Error(`"Path" property not found in endpoint entity "${G.name}" (${G.id})`);return((ne=K.getDefaultValue())==null?void 0:ne.value)===E})){const G=new qi({id:m.id+"--"+xn.MustBeUniqueAmongSameEntities,message:`Path "${E}" is already in use by another endpoint with the ${P} method.`,severity:ve.Error,code:xn.MustBeUniqueAmongSameEntities,entity:m});b.errors.push(G)}return b};const a=this.properties.find(m=>m.id===re["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.properties.method.id);a&&(a._codeNativeValueValidation=(m,E)=>{var M;const b={errors:[],override:E},A=m.parent,_=A.properties.find(G=>G.implements.find(k=>k.id===re["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.properties.path.id)),P=(M=_==null?void 0:_.getDefaultValue())==null?void 0:M.value;if(m.project.entities.filter(G=>ui(G,ge.HTTP_ENDPOINT)&&G.id!==A.id).some(G=>{var le,ne;const k=G.properties.find(de=>de.implements.find(Y=>Y.id===re["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.properties.path.id));if(((le=k==null?void 0:k.getDefaultValue())==null?void 0:le.value)!==P)return!1;const K=G.properties.find(de=>de.implements.find(Y=>Y.id===re["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.properties.method.id));return((ne=K==null?void 0:K.getDefaultValue())==null?void 0:ne.value)===E})){const G=new qi({id:m.id+"--"+xn.MustBeUniqueAmongSameEntities,message:`Method "${E}" cannot be used because another endpoint is already using the ${E} method on path "${P}".`,severity:ve.Error,code:xn.MustBeUniqueAmongSameEntities,entity:m});b.errors.push(G)}return b});const c=this.abstractMethods.find(m=>m.id===re["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.methods.handler.id);if(!c)throw new Error("Handler method not found in endpoint entity");const e=(((h=(f=c.dataType)==null?void 0:f.entity)==null?void 0:h.properties)||[]).find(m=>m.id===re["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.methods.handler.dataType.entity.properties.statusCode.id);if(!e)throw new Error("Status code output not found in handler method");e._codeNativeValueValidation=(m,E)=>VVe(m,E)}}var HT=(s=>(s.InvalidCharacters="cron-invalid-characters",s.MustHaveSixFields="cron-must-have-six-fields",s.DayOfMonthAndWeekConflict="cron-day-of-month-and-week-conflict",s))(HT||{});function NVe(s,p){const i=[];let r=p;if(typeof p!="string"){const e=new qi({id:s.id+"--"+xn.ValueMustBeString,message:`Entity of type ${s.type} with id "${s.id}" has an invalid value. The cron expression must be a string.`,severity:ve.Error,code:xn.ValueMustBeString,entity:s});return i.push(e),{errors:i,override:""}}r=p.trimStart().replace(/\s{2,}/g," ");const a=/[^0-9A-Z *?\-/,LW#]/g;if(a.test(r)){const e=Array.from(new Set(r.match(a)));i.push(new qi({id:s.id+"--cron-invalid-characters",message:`Cron expression contains invalid characters: "${e.join(", ")}". Only alphanumeric characters and (* ? - / , L W #) are allowed.`,severity:ve.Error,code:"cron-invalid-characters",entity:s})),r=r.replace(a,"")}const c=r.split(" ").filter(Boolean);if(c.length!==6)i.push(new qi({id:s.id+"--cron-must-have-six-fields",message:`Elyx Cron expressions must have exactly 6 fields separated by spaces (Minutes, Hours, Day-of-month, Month, Day-of-week, Year). Currently has ${c.length}.`,severity:ve.Error,code:"cron-must-have-six-fields",entity:s}));else{const e=c[2],f=c[4];e!=="?"&&f!=="?"&&(i.push(new qi({id:s.id+"--cron-day-of-month-and-week-conflict",message:"Elyx restricts defining both Day-of-month and Day-of-week simultaneously. If you specify one, the other must be '?'",severity:ve.Error,code:"cron-day-of-month-and-week-conflict",entity:s})),e==="*"&&f==="*"&&(c[4]="?",r=c.join(" ")))}return{errors:i,override:r}}class xVe extends md{constructor(i){super(Gs,i);R(this,"initialData");R(this,"id",ge.CRON_JOB);R(this,"version","1");R(this,"name",ge.CRON_JOB);R(this,"description",Gs.description);R(this,"type",d.BuiltInBaseEntity);R(this,"abstract",Gs.abstract);R(this,"static",Gs.static);R(this,"properties",[]);R(this,"methods",[]);R(this,"abstractMethods",[]);R(this,"extends",null);R(this,"errors",[]);R(this,"project");this.initialData=Gs,this.project=i,this.id=Gs.id,this.version=Gs.version,this.name=Gs.name,this.static=Gs.static,this.abstract=Gs.abstract,this.properties=this.initialData.properties.map(a=>{const c=Ie(a,this.project);return c.setParent(this,null),c.initChildren(null),c}),this.methods=this.initialData.methods.map(a=>{const c=Ie(a,this.project);return c.parent=this,c}),this.abstractMethods=this.initialData.abstractMethods.map(a=>{const c=Ie(a,this.project);return c.parent=this,c}),this.initialData.extends&&(this.extends=Ie(this.initialData.extends,this.project));const r=this.properties.find(a=>a.id===re["built-in-base-entity"].BUILT_IN_CRON_JOB_ENTITY.properties.expression.id);if(!r)throw new Error("Expression property not found in cron job entity");r._codeNativeValueValidation=(a,c)=>NVe(a,c)}}class $Ve extends md{constructor(i){super(Sn,i);R(this,"initialData");R(this,"id",ge.RELATIONAL_DATABASE);R(this,"version","1");R(this,"name",ge.RELATIONAL_DATABASE);R(this,"description",Sn.description);R(this,"type",d.BuiltInBaseEntity);R(this,"abstract",Sn.abstract);R(this,"static",Sn.static);R(this,"properties",[]);R(this,"methods",[]);R(this,"abstractMethods",[]);R(this,"extends",null);R(this,"errors",[]);R(this,"project");this.initialData=Sn,this.project=i,this.id=Sn.id,this.version=Sn.version,this.name=Sn.name,this.static=Sn.static,this.abstract=Sn.abstract,this.properties=this.initialData.properties.map(a=>{const c=Ie(a,this.project);return c.setParent(this,null),c.initChildren(null),c}),this.methods=this.initialData.methods.map(a=>{const c=Ie(a,this.project);return c.parent=this,c}),this.abstractMethods=this.initialData.abstractMethods.map(a=>{const c=Ie(a,this.project);return c.parent=this,c}),this.initialData.extends&&(this.extends=Ie(this.initialData.extends,this.project));const r=this.properties.find(a=>a.id===re["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.identifier.id);if(!r)throw new Error("Path property not found in endpoint entity");r._codeNativeValueValidation=(a,c)=>_Ve(a,c)}}class LVe extends er{constructor(i){super(ha,i);R(this,"id",ha.id);R(this,"name",ha.name);R(this,"description",ha.description);R(this,"version",ha.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=ha.inputs.map(r=>{const a=Ie(r,this.project);return a.setParent(this,null),a.initChildren(null),a}),this.dataType=Ie(ha.dataType,this.project),this.dataType.setParent(this,null),this.dataType.initChildren(null),this.error=ha.error?Ie(ha.error,this.project):null}}var hs=(s=>(s.UUIDMustBeString="uuid-must-be-string",s.UUIDMustBeValidFormat="uuid-must-be-valid-format",s.UUIDMustNotContainSpaces="uuid-must-not-contain-spaces",s))(hs||{});function oIi(s,p){const i=[];if(typeof p!="string"){const a=new qi({id:s.id+"--uuid-must-be-string",message:`Entity of type ${s.type} with id "${s.id}" has an invalid value "${p}". The value must be text.`,severity:ve.Error,code:"uuid-must-be-string",entity:s});return i.push(a),{errors:i,override:p}}const r=e$(s,p);if(r.errors.length>0)return i.push(...r.errors),{errors:i,override:p};if(!Fx(p)){const a=new qi({id:s.id+"--uuid-must-be-valid-format",message:`Entity of type ${s.type} with id "${s.id}" has an invalid value "${p}". The value must be a valid UUID format. Eg: "123e4567-e89b-12d3-a456-426614174000".`,severity:ve.Error,code:"uuid-must-be-valid-format",entity:s});i.push(a)}return{errors:i,override:p}}var ke=(s=>(s.Inherited="inherited",s.DefaultValue="default-value",s.Missing="missing",s.Undefined="undefined",s.Empty="empty",s.AutoCalculated="auto-calculated",s.QueuedAutocalculation="queued-autocalculation",s.External="external",s.Testing="testing",s.ExecutionResult="execution-result",s))(ke||{});const BVe={initialized:!1,id:"",project:null,values:{},onWriteCallback:()=>{},onRemoveCallback:()=>{},onWrite:()=>{},onRemove:()=>{},init:()=>{},toJSON:()=>({}),writeValue:()=>{},readValue:()=>null,removeValue:()=>{},clear:()=>{}};function LT(s,p){return{...BVe,id:s,project:p}}class BT{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 Br(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=XVe(e,f,this.project);h?i[a]=h:delete p[a]}catch(f){J.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 Br)a=i;else if(i)a=lr(i,this.project);else{const c={id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:new Date().toISOString(),author:x.sessionAuthor,deleted:!1,previousVersion:null,value:null,deletable:!0,editable:!0,type:d.LiteralValue,standaloneParent:p.toReference(),parent:null,valueAsTypeSingle:null,valueAsTypeList:null,autogeneration:null,name:Jd(p.getDataType(null))};a=lr(c,this.project)}a.standalone=!0,a.initialData.standaloneParent||J.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 vr(s){return s!==null&&typeof s=="object"&&!Array.isArray(s)}function t$(s){if(Array.isArray(s))return s.map(h=>typeof h=="number"?h:e(h)?Number(h):String(h));const p=[];let i=0,r="",a=!1,c=null;for(;i<s.length;){const h=s[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<s.length){r+=s[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 A1(s,p,i){if(s==null)return i;const r=t$(p);let a=s;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 dIi=new Set(["__proto__","prototype","constructor"]);function MVe(s){return typeof s=="string"&&dIi.has(s)}function uIi(s,p,i,r){const{createMissing:a=!0,coerce:c=!0}=r??{};if(s==null||typeof s!="object")throw new TypeError("set(...) expects a non-null object as target.");const e=t$(p);if(e.length===0)throw new Error("set(...) path must not be empty.");let f=s;for(let h=0;h<e.length;h++){const m=e[h];if(MVe(m))throw new Error(`Refusing to set unsafe key "${String(m)}" on object.`);const E=h===e.length-1,A=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,s}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]=A?[]:{}}else{const P=f[m],V=P!==null&&typeof P=="object",M=Array.isArray(P);if(A){if(!M){if(!c)throw new Error(`set(...) expected an array at "${String(m)}" but found non-array (coerce=false).`);f[m]=[]}}else if(!V||M){if(!c)throw new Error(`set(...) expected an object at "${String(m)}" but found non-object (coerce=false).`);f[m]={}}}f=f[m]}}return s}function i$(s,p,i,r){const a=t$(p);if(a.length===0)return s;function c(e,f){const h=a[f],m=f===a.length-1;if(r==="strict-set"||r==="strict-delete"){if(MVe(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 A=typeof a[f+1]=="number",_=c(A?[]:{},f+1);return E[h]=_,E}return E[h]=c(b,f+1),E}if(s==null&&r==="safe-set"){const e=typeof a[0]=="number";return c(e?[]:{},0)}return c(s,0)}const Qj=Symbol("missing"),pIi=s=>s!=null&&typeof s=="object";function g1(s,p){if(typeof s!="string")throw new TypeError(`${p} expects the key to be a string.`);return s}function km(s,p){if(typeof s!="string"&&!Array.isArray(s))throw new TypeError(`${p} expects the path to be string or array.`);return s}function ny(s,p){if(!vr(s))throw new TypeError(`${p} expects the first argument to be an object.`);return s??{}}function GVe(s,p){const i=g1(p,"ReadKey");return(s??{})[i]}function kVe(s,p,i){const r=g1(p,"WriteKey");if(s&&typeof s=="object"){const a=Array.isArray(s)?[...s]:{...s};return a[r]=i,a}return{[r]:i}}function jVe(s,p){if(!s||typeof s!="object")return{};const i=String(p),{[i]:r,...a}=s;return a}function UVe(s,p,i){const r=ny(s,"ReadNestedKey"),a=km(p,"ReadNestedKey");return A1(r,a,i)}function FVe(s,p,i){const r=ny(s,"WriteNestedKey"),a=km(p,"WriteNestedKey");return i$(r,a,i,"strict-set")}function KVe(s,p,i){const r=ny(s,"WriteSafeNestedKeyRecursively"),a=km(p,"WriteSafeNestedKeyRecursively");return i$(r,a,i,"safe-set")}function qVe(s,p){const i=ny(s,"DeleteNestedKey"),r=km(p,"DeleteNestedKey");return i$(i,r,null,"strict-delete")}function SVe(s,p){const i=g1(p,"HasKey"),r=s;return r!=null&&pIi(r)&&Object.prototype.hasOwnProperty.call(r,i)}function ZVe(s,p,i){const r=g1(p,"KeyValueEquals");return s==null||typeof s!="object"?!1:s[r]===i}function HVe(s,p){const i=s,r=km(p,"HasNestedKey");return A1(i,r,Qj)!==Qj}function WVe(s,p,i){const r=km(p,"NestedKeyValueEquals");return A1(s,r)===i}function zVe(...s){const p={};for(let i=0;i<s.length;i++){const r=s[i];if(r!=null){if(!vr(r))throw new TypeError("MergeObjects expects every argument to be an object (or null/undefined).");Object.assign(p,r)}}return p}function YVe(s){const p=ny(s,"ObjectKeys");return Object.keys(p)}function JVe(s){const p=ny(s,"ObjectValues");return Object.values(p)}function QVe(s){const p=ny(s,"ObjectEntries");return Object.entries(p)}const Th=new Set;function cIi(s){return{execution:null,project:s,localTestValues:LT("local-test-values",s),resolvedValues:LT("resolved-values",s),persistedExecutionResults:LT("persisted-execution-results",s),lastExecutionResults:LT("last-execution-results",s),getValueTypePreference:()=>null,setValueTypePreference:()=>{}}}function Fu(s,p,i,r){var f;let a;if(((f=s==null?void 0:s.entity)==null?void 0:f.type)===d.PrimitiveEntity)switch(s.entity.name){case fe.EntityTemplate:a=fe.EntityTemplate;break;case fe.String:a=fe.String;break;case fe.Number:a=fe.Number;break;case fe.Boolean:a=fe.Boolean;break;case fe.Null:a=fe.Null;break;case fe.Enum:a=fe.Enum;break;case fe.KeyValue:a=fe.KeyValue;break;case fe.Untyped:a=fe.Untyped;break;case fe.KeyValue:a=fe.KeyValue;break;case fe.Date:a=fe.Date;break;case fe.UUID:a=fe.UUID;break;case fe.File:a=fe.File;break;case fe.Void:a=fe.Void;break;case fe.ActionDescriptor:a=fe.ActionDescriptor;break;case fe.Bytes:a=fe.Bytes;break;case fe.SqlProgram:a=fe.SqlProgram;break;default:throw new Error(`Primitive type ${Lt(s.entity,i)} is not supported`)}else a=fe.Untyped;const c=Br.new(r);c.name=a,c.parent=p.toReference();const e=Ie(c,i);return e.hydrateAncestors(),r==null||r.add(e,H.Added),e.addSelfToProject(r),e.initChildren(r),e}function ud(s,p,i=new Set){var r,a,c,e;if(i.has(s.id))return[];if(i.add(s.id),Mt.includes(s.type)){const f=Er(s);return C([f,...[f].flatMap(h=>ud(h,p,i))])}else if(s.type===d.OutputMap){if(Mt.includes(s.parent.type)&&((r=s.declaration)==null?void 0:r.type)===d.Property&&s.declaration.static)return C([s,s.declaration,...[s,s.declaration].flatMap(f=>ud(f,p,i))])}else if(s.type===d.InputMap){if(Mt.includes(s.parent.type)&&((a=s.declaration)==null?void 0:a.type)===d.Property&&((c=s.declaration)!=null&&c.static))return C([s.declaration,...[s.declaration].flatMap(f=>ud(f,p,i))])}else if(s.type===d.ValueDescriptor&&((e=s.parent)==null?void 0:e.type)===d.Search){const f=s.parent.inputs.find(h=>{var m;return((m=h.declaration)==null?void 0:m.id)===s.id});if(f)return[f]}return[s]}function XVe(s,p,i){return s}function jm(s,p,i=!1){const r=s.readsValue;let a=null;const c=iu(r,p,i);if(c){const e={sources:[c],target:s};a={value:c.value,valueOwner:s,type:ke.Inherited,inheritanceLink:e}}else a={value:null,valueOwner:s,type:ke.Inherited,inheritanceLink:null};return a}function Ht(s,p,i){var f;if(!p)return null;let r;if(((f=s==null?void 0:s.entity)==null?void 0:f.type)===d.PrimitiveEntity)switch(s.entity.name){case fe.EntityTemplate:r=fe.EntityTemplate;break;case fe.String:r=fe.String;break;case fe.Number:r=fe.Number;break;case fe.Boolean:r=fe.Boolean;break;case fe.Null:r=fe.Null;break;case fe.Enum:r=fe.Enum;break;case fe.KeyValue:r=fe.KeyValue;break;case fe.Untyped:r=fe.Untyped;break;case fe.KeyValue:r=fe.KeyValue;break;case fe.Date:r=fe.Date;break;case fe.UUID:r=fe.UUID;break;case fe.File:r=fe.File;break;case fe.Void:r=fe.Void;break;case fe.ActionDescriptor:r=fe.ActionDescriptor;break;case fe.Bytes:r=fe.Bytes;break;case fe.SqlProgram:r=fe.SqlProgram;break;default:throw new Error(`Primitive type ${Lt(s.entity,i)} is not supported`)}else r=fe.Untyped;if(!i.get(p.id))return null;const c=Br.new(null);c.name=r,c.standaloneParent=p.toReference();let e=new Br(c,i);return e.hydrateAncestors(),e.standalone=!0,e.setStandaloneParent(p,null),e.initChildren(null),e}function ePe(s,p,i=!1){var c,e;if(p.execution&&p.execution.hasEntity(s)&&!i){const f=(c=p.lastExecutionResults)==null?void 0:c.readValue(s.id);if(f)return{value:f,valueOwner:s,type:ke.ExecutionResult,inheritanceLink:null}}const r=(e=p.localTestValues)==null?void 0:e.readValue(s.id),a=p.getValueTypePreference(s.id);return r&&!i&&(a===null||a!==ke.DefaultValue)?{value:r,valueOwner:s,type:ke.Testing,inheritanceLink:null}:{value:null,valueOwner:s,type:ke.QueuedAutocalculation,inheritanceLink:null}}function hg(s,p,i,r=!1){var e,f;const a={...s},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(!ab(h))continue;const m=R1(h,i,r);if(m&&m.value)try{const E=pe(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}catch{}}return a}function MT(s,p,i,r=!1){var e,f;const a={...s},c=p.inputs;if(!c)return a;for(const h of c){if(!ab(h))continue;const m=wE(h,i,r);if(m&&m.value){const E=Lt(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 tPe(s,p,i=!1){var E,b,A,_,P,V,M,G;let r={};if(((b=(E=s.getDataType(null))==null?void 0:E.entity)==null?void 0:b.type)===d.DefinitionEntity&&(r={...r,...((A=s.getDataType(null))==null?void 0:A.entity).getActiveRawDefaultValue()}),p.execution&&p.execution.hasEntity(s)&&!i){const k=(_=p.lastExecutionResults)==null?void 0:_.readValue(s.id);if(k){if(vr(k.value)){const le={...r,...k.value},ne={...MT(le,s,p,i)};k.metaSync({value:ne},null)}return{value:k,valueOwner:s,type:ke.ExecutionResult,inheritanceLink:null}}}const a=!!((P=p.execution)!=null&&P.entities.length),c=(V=p.execution)==null?void 0:V.hasEntity(s),e=s.readsValue;let f=null;if(e){const k=(M=p.execution)==null?void 0:M.hasEntity(e);if((!a||a&&k&&c||a&&!k&&!c)&&(f=jm(s,p,i),f&&f.value&&vr(f.value.value))){const le={...r,...f.value.value},ne={...MT(le,s,p,i)};f.value.metaSync({value:ne},null)}}const h=s.defaultValue,m=p.getValueTypePreference(s.id);if(!f&&h){const k=h;if(k&&k.value===null&&k.autogeneration){const K=ID(k);if(k.metaSync({value:K},null),vr(K)){const le={...MT(K,s,p,i)};k.metaSync({value:le},null)}}(i||m===null||m!==ke.Testing)&&(f={value:k,valueOwner:s,type:Pn(k)?s.readsValue?ke.Inherited:ke.Empty:ke.DefaultValue,inheritanceLink:null})}if(!f||(f.type===ke.DefaultValue||f.type===ke.External)&&!i||m===ke.Testing){const k=(G=p.localTestValues)==null?void 0:G.readValue(s.id);if(k){if(vr(k.value)){const K={...r,...k.value},le={...MT(K,s,p,i)};k.metaSync({value:le},null)}return{value:k,valueOwner:s,type:ke.Testing,inheritanceLink:null}}}return Pn((f==null?void 0:f.value)||null)?{value:null,valueOwner:s,type:s.readsValue?ke.Inherited:ke.Empty,inheritanceLink:null}:f}function r$(s,p,i=!1){var f,h,m,E,b,A,_,P,V,M,G,k,K,le,ne,de,Y;let r={};if(((h=(f=s.getDataType(null))==null?void 0:f.entity)==null?void 0:h.type)===d.DefinitionEntity?r={...r,...((m=s.getDataType(null))==null?void 0:m.entity).getActiveRawDefaultValue()}:((b=(E=s.getDataType(null))==null?void 0:E.entity)==null?void 0:b.type)===d.BuiltInBaseEntity&&(r={...r,...((A=s.getDataType(null))==null?void 0:A.entity).getRawDefaultValue()}),p.execution&&p.execution.hasEntity(s)&&!i){const te=(_=p.lastExecutionResults)==null?void 0:_.readValue(s.id);if(te){if(vr(te.value)){const Q={...r,...te.value},z=hg(Q,s,p,i);te==null||te.metaSync({value:z},null)}return{value:te,valueOwner:s,type:ke.ExecutionResult,inheritanceLink:null}}}const a=(P=p.localTestValues)==null?void 0:P.readValue(s.id);let c=!1;if(s.type===d.VariableDeclaration){const te=s,oe=!!((V=p.execution)!=null&&V.entities.length),Q=(M=p.execution)==null?void 0:M.hasEntity(s),z=te.readsValue;if(z){const se=(G=p.execution)==null?void 0:G.hasEntity(z);c=!oe||oe&&se&&Q||oe&&!se&&!Q}}const e=p.getValueTypePreference(s.id);if(a&&!i&&(!c||e===ke.Testing)){if(vr(a.value)){const oe={...r,...a.value},Q=hg(oe,s,p,i);a.metaSync({value:Q},null)}return{value:a,valueOwner:s,type:ke.Testing,inheritanceLink:null}}if((k=s.getDataType(null))!=null&&k.entity&&(((le=(K=s.getDataType(null))==null?void 0:K.entity)==null?void 0:le.type)===d.DefinitionEntity||((de=(ne=s.getDataType(null))==null?void 0:ne.entity)==null?void 0:de.type)===d.BuiltInBaseEntity)&&((Y=s.getDataType(null))!=null&&Y.isObject())){const te=Ht(s.dataType,s,p.project),oe=hg(r,s,p,i);return te==null||te.metaSync({value:oe},null),{value:te,valueOwner:s,type:ke.DefaultValue,inheritanceLink:null}}return null}function I1(s,p,i=!1){var E,b,A,_,P;if((E=s.dataType)!=null&&E.isObject())return tPe(s,p,i);const r=Tt(s),a=!!((b=p.execution)!=null&&b.entities.length),c=(A=p.execution)==null?void 0:A.hasEntity(r),e=s.readsValue;let f=null;if(e){const V=(_=p.execution)==null?void 0:_.hasEntity(e);(!a||a&&V&&c||a&&!V&&!c)&&(f=jm(s,p,i))}const h=s.defaultValue,m=p.getValueTypePreference(s.id);if(!f&&h){const V=h;if(V&&V.value===null&&V.autogeneration){const M=ID(V);V.metaSync({value:M},null)}(i||m===null||m!==ke.Testing)&&(f={value:V,valueOwner:s,type:Pn(V)?s.readsValue?ke.Inherited:ke.Empty:ke.DefaultValue,inheritanceLink:null})}if(!f||(f.type===ke.DefaultValue||f.type===ke.External)&&!i||m===ke.Testing){const V=(P=p.localTestValues)==null?void 0:P.readValue(s.id);if(V)return{value:V,valueOwner:s,type:ke.Testing,inheritanceLink:null}}return Pn((f==null?void 0:f.value)||null)?{value:null,valueOwner:s,type:s.readsValue?ke.Inherited:ke.Empty,inheritanceLink:null}:f}function n$(s,p,i=!1){var a,c;if((a=s.dataType)!=null&&a.isObject()||s.outputs.length)return r$(s,p,i);if(p.execution&&p.execution.hasEntity(s)&&!i){const e=(c=p.lastExecutionResults)==null?void 0:c.readValue(s.id);if(e)return{value:e,valueOwner:s,type:ke.ExecutionResult,inheritanceLink:null}}return I1(s,p,i)}function iPe(s,p,i=!1){var A,_,P,V;const r=!!((A=p.execution)!=null&&A.entities.length),a=(_=p.execution)==null?void 0:_.hasEntity(s);let c=null;const e=s.readsValue;if(e){const M=(P=p.execution)==null?void 0:P.hasEntity(e);(!r||r&&M&&a||r&&!M&&!a)&&(c=jm(s,p,i))}const f=s.declaration;if(!c&&f){const M=I1(f,p,i);M&&M.value&&(c=M)}const h=p.getValueTypePreference(s.id);if(!c||(c.type===ke.DefaultValue||c.type===ke.External)&&!i||h===ke.Testing){const M=(V=p.localTestValues)==null?void 0:V.readValue(s.id);if(M)return{value:M,valueOwner:s,type:ke.Testing,inheritanceLink:null}}const m=fu(s),E=s.getDataType(null);return m&&a&&(!(c!=null&&c.value)||!Ka(E)&&pu(c==null?void 0:c.value))?{value:null,valueOwner:s,type:ke.Missing,inheritanceLink:null}:a&&!m&&Pn((c==null?void 0:c.value)||null)?{value:null,valueOwner:s,type:s.readsValue?ke.Inherited:ke.Empty,inheritanceLink:null}:c||{value:null,valueOwner:s,type:ke.External,inheritanceLink:null}}function rPe(s,p,i=!1){return n$(s.declaration,p,i)}function nPe(s,p,i=!1){var _,P,V,M;if(!i&&p.execution&&p.execution.hasEntity(s)){const G=(_=p.lastExecutionResults)==null?void 0:_.readValue(s.id);if(G)return{value:G,valueOwner:s,type:ke.ExecutionResult,inheritanceLink:null}}const r=!p.execution||!p.execution.parentExecution,a=p.getValueTypePreference(s.id);if(r){const G=(P=p.localTestValues)==null?void 0:P.readValue(s.id);if(G&&!i&&(a===null||a!==ke.DefaultValue))return{value:G,valueOwner:s,type:ke.Testing,inheritanceLink:null}}const c=Tt(s),e=s.parent.type===d.FunctionDeclaration&&s.parent.parent.type===d.Loop?s.parent:null,f=!!((V=p.execution)!=null&&V.hasEntity(c))||!!e&&!!((M=p.execution)!=null&&M.hasEntity(e));let h=null;const m=s.defaultValue;if(m){const G=m||null;if(G&&G.value===null&&G.autogeneration){const k=ID(G);G.metaSync({value:k},null)}(i||a===null||a!==ke.Testing)&&(h={value:G,valueOwner:s,type:Pn(G)?ke.Empty:ke.DefaultValue,inheritanceLink:null})}!h||(h.type===ke.DefaultValue||h.type===ke.External)&&!i||ke.Testing;const E=fu(s),b=s.getDataType(null);let A=E&&f&&(!(h!=null&&h.value)||!Ka(b)&&pu(h==null?void 0:h.value));return c.type===d.Loop&&f&&(A=!1),A?{value:null,valueOwner:s,type:ke.Missing,inheritanceLink:null}:f&&!E&&Pn((h==null?void 0:h.value)||null)?{value:null,valueOwner:s,type:ke.Empty,inheritanceLink:null}:h||{value:null,valueOwner:s,type:ke.External,inheritanceLink:null}}function a$(s,p,i=!1){var _,P,V,M,G,k;if((_=s.getDataType(null))!=null&&_.isObject()||s.outputs.length)return r$(s,p);if(p.execution&&p.execution.hasEntity(s)&&!i){const K=(P=p.lastExecutionResults)==null?void 0:P.readValue(s.id);if(K)return{value:K,valueOwner:s,type:ke.ExecutionResult,inheritanceLink:null}}const r=Tt(s),a=!!((V=p.execution)!=null&&V.entities.length),c=(M=p.execution)==null?void 0:M.hasEntity(r),e=s.readsValue;let f=null;if(e){const K=(G=p.execution)==null?void 0:G.hasEntity(e);(!a||a&&K&&c||a&&!K&&!c)&&(f=jm(s,p,i))}const h=s.defaultValue,m=p.getValueTypePreference(s.id);if(!f&&h){const K=h;(i||m===null||m!==ke.Testing)&&(f={value:K,valueOwner:s,type:ke.DefaultValue,inheritanceLink:null})}if(!f||(f.type===ke.DefaultValue||f.type===ke.External)&&!i||m===ke.Testing){const K=(k=p.localTestValues)==null?void 0:k.readValue(s.id);if(K)return{value:K,valueOwner:s,type:ke.Testing,inheritanceLink:null}}const E=fu(s),b=s.getDataType(null);return E&&(!(f!=null&&f.value)||!Ka(b)&&pu(f==null?void 0:f.value))?{value:null,valueOwner:s,type:ke.Missing,inheritanceLink:null}:!s.defaultValue&&!s.readsValue?{value:null,valueOwner:s,type:ke.Undefined,inheritanceLink:null}:!E&&Pn((f==null?void 0:f.value)||null)?{value:null,valueOwner:s,type:s.readsValue?ke.Inherited:ke.Empty,inheritanceLink:null}:f}function aPe(s,p,i=!1){var e,f,h,m,E,b;if(p.execution&&p.execution.hasEntity(s)&&!i){const A=(e=p.lastExecutionResults)==null?void 0:e.readValue(s.id);if(A)return{value:A,valueOwner:s,type:ke.ExecutionResult,inheritanceLink:null}}const r=Kp(s);if(Cp.includes(r.type)){const A=iu(r,p,i),_=s.codeName||((f=s.declaration)==null?void 0:f.codeName)||ir(Lt(s,p.project));if(A!=null&&A.value&&s.parentRelationType!==ks.Error){const P=(A.value.value||{})[_];if(P===void 0)return{value:null,valueOwner:s,type:ke.Undefined,inheritanceLink:null};const V=Ht(s.getDataType(null),s,p.project);return V==null||V.metaSync({value:P},null),{value:V,valueOwner:s,type:!Mt.includes(r.type)&&A.type===ke.Empty?ke.QueuedAutocalculation:A.type,inheritanceLink:{sources:[A],target:s}}}return{value:null,valueOwner:s,type:Mt.includes(r.type)?ke.Empty:ke.QueuedAutocalculation,inheritanceLink:null}}const a=(h=p.execution)==null?void 0:h.hasEntity(r),c=((m=p.execution)==null?void 0:m.state)===g$.Running;if((E=p.persistedExecutionResults)!=null&&E.values[s.id]&&!a&&!c&&!i){const A=(b=p.persistedExecutionResults)==null?void 0:b.readValue(s.id);if((A==null?void 0:A.value)!==null||(A==null?void 0:A.valueAsType)!==null)return{value:A,valueOwner:s,type:ke.ExecutionResult,inheritanceLink:null}}return null}function F_(s,p,i=!1){var b,A,_;if(![...Dt,...Mt].includes(s.parent.type)||!ab(s))return null;if(((b=s.declaration)==null?void 0:b.type)===d.Property&&s.declaration.static)return iu(s.declaration,p);const r=wE(s,p,i);if(r&&r.type!==ke.Empty&&r.type!==ke.Missing&&r.type!==ke.Undefined)return r;const a=Er(s.parent),c=to(a,p,i),e=s.codeName||((A=s.declaration)==null?void 0:A.codeName)||ir(Lt(s,p.project)),f=Ht(s.getDataType(null),s,p.project),h=fu(s),m=(_=c==null?void 0:c.value)==null?void 0:_.value;if(m){let P=(m||{})[e];if(m[e]===void 0)return{value:null,valueOwner:s,type:ke.Undefined,inheritanceLink:{sources:c?[c]:[],target:s}};f==null||f.metaSync({value:P},null);const V=fu(s),M=s.getDataType(null);return V&&(!f||!Ka(M)&&pu(f))?{value:null,valueOwner:s,type:ke.Missing,inheritanceLink:null}:{value:f,valueOwner:s,type:c.type,inheritanceLink:{sources:c?[c]:[],target:s}}}return c!=null&&c.type&&c.type!==ke.Missing&&c.type!==ke.Empty&&c.type!==ke.Undefined?{value:null,valueOwner:s,type:c.type,inheritanceLink:{sources:c?[c]:[],target:s}}:h?{value:null,valueOwner:s,type:ke.Missing,inheritanceLink:null}:{value:null,valueOwner:s,type:s.readsValue?ke.Inherited:ke.Empty,inheritanceLink:null}}function K_(s,p,i=!1){var E,b,A,_,P,V,M;if(![...Dt,...Mt].includes(s.parent.type)||!ab(s))return null;if(((E=s.declaration)==null?void 0:E.type)===d.Property&&s.declaration.static)return iu(s.declaration,p,i);const r=Dt.includes(s.parent.type)?s.parent:Er(s.parent),a=iu(r,p,i);let c=s;r.type===d.VariableDeclaration&&(c=(s.parent===r?s:r.inputs.find(k=>{var K,le;return((K=k.declaration)==null?void 0:K.id)===((le=s.declaration)==null?void 0:le.id)}))||s);const e=R1(c,p,i),f=s.codeName||((b=s.declaration)==null?void 0:b.codeName)||ir(Lt(s,p.project)),h=s.defaultValue||Ht(s.getDataType(null),s,p.project),m=(A=a==null?void 0:a.value)==null?void 0:A.value;if(((a==null?void 0:a.type)===ke.ExecutionResult||(a==null?void 0:a.type)===ke.Testing)&&!i&&m){let G=(m||{})[f];return m[f]===void 0&&!s.readsValue&&!s.defaultValue?{value:null,valueOwner:s,type:ke.Undefined,inheritanceLink:{sources:a?[a]:[],target:s}}:(h==null||h.metaSync({value:G},null),{value:h,valueOwner:s,type:a.type,inheritanceLink:{sources:a?[a]:[],target:s}})}if(e&&e.type!==ke.Empty&&e.type!==ke.Missing&&e.type!==ke.Undefined)return e;if(m){let G=(m||{})[f];m[f]!==void 0&&(h!=null&&h.standaloneParent)&&(h==null||h.metaSync({value:G},null));const k=fu(s),K=s.getDataType(null),le=k&&(!h||!Ka(K)&&pu(h)),ne=!!((_=p.execution)!=null&&_.entities.length),de=(P=p.execution)==null?void 0:P.hasEntity(r),Y=r.readsValue;if(Y){const te=(V=p.execution)==null?void 0:V.hasEntity(Y);if(le&&(!ne||ne&&te&&de||ne&&!te&&!de))return{value:null,valueOwner:s,type:ke.Inherited,inheritanceLink:null}}if(s.readsValue){const te=(M=p.execution)==null?void 0:M.hasEntity(s.readsValue);if(le&&(!ne||ne&&te&&de||ne&&!te&&!de))return{value:null,valueOwner:s,type:ke.Inherited,inheritanceLink:null}}return le?{value:null,valueOwner:s,type:ke.Missing,inheritanceLink:null}:m[f]===void 0&&!s.readsValue&&!s.defaultValue?{value:null,valueOwner:s,type:ke.Undefined,inheritanceLink:{sources:a?[a]:[],target:s}}:{value:h,valueOwner:s,type:Pn(h)&&!s.readsValue?ke.Empty:ke.Inherited,inheritanceLink:null}}return{value:null,valueOwner:s,type:ke.Undefined,inheritanceLink:null}}function wE(s,p,i=!1){var V,M,G,k,K;const r=Tt(s),a=!!((V=p.execution)!=null&&V.entities.length),c=(M=p.execution)==null?void 0:M.hasEntity(r),e=s.readsValue;let f=null,h=!1;if(e){const le=(G=p.execution)==null?void 0:G.hasEntity(e);h=!a||a&&le&&c||a&&!le&&!c,h&&(f=jm(s,p,i))}const m=!!e&&h,E=s.defaultValue,b=p.getValueTypePreference(s.id);if(!f&&E&&(i||b===null||b!==ke.Testing)&&(f={value:E,valueOwner:s,type:pu(E)?ke.Empty:ke.DefaultValue,inheritanceLink:null}),(!f||f.type===ke.DefaultValue||(f==null?void 0:f.type)===ke.Empty||b===ke.Testing)&&!m){const le=(k=p.persistedExecutionResults)==null?void 0:k.readValue(s.id);if(le&&!i)return{value:le,valueOwner:s,type:ke.Testing,inheritanceLink:null};const ne=(K=p.localTestValues)==null?void 0:K.readValue(s.id);if(ne&&!i&&(b===null||b===ke.Testing))return{value:ne,valueOwner:s,type:ke.Testing,inheritanceLink:null}}const A=fu(s),_=s.getDataType(null),P=A&&(!(f!=null&&f.value)||!Ka(_)&&pu(f==null?void 0:f.value));return m&&P?{value:null,valueOwner:s,type:ke.Inherited,inheritanceLink:null}:P?{value:null,valueOwner:s,type:ke.Missing,inheritanceLink:(f==null?void 0:f.inheritanceLink)||null}:!f&&!s.defaultValue&&!m?{value:null,valueOwner:s,type:ke.Undefined,inheritanceLink:null}:!A&&(!f||f.type===ke.Inherited)&&!(f!=null&&f.inheritanceLink)?{value:null,valueOwner:s,type:m?ke.Inherited:ke.Empty,inheritanceLink:null}:f}function R1(s,p,i=!1){var a;if(p.execution&&p.execution.hasEntity(s)&&!i){const c=(a=p.lastExecutionResults)==null?void 0:a.readValue(s.id);if(c)return{value:c,valueOwner:s,type:ke.ExecutionResult,inheritanceLink:null}}return wE(s,p,i)}function sPe(s,p,i=!1){var r,a;return Mt.includes(s.parent.type)&&(r=Er(s.parent).dataType)!=null&&r.isObject()||Dt.includes(s.parent.type)&&(a=s.parent.getDataType(null))!=null&&a.isObject()?F_(s,p,i):wE(s,p,i)}function s$(s,p,i=!1){var r,a;if(Mt.includes(s.parent.type)){const c=Er(s.parent);if((r=c.dataType)!=null&&r.isObject()||c.inputs.length)return K_(s,p,i)}return Dt.includes(s.parent.type)&&((a=s.parent.getDataType(null))!=null&&a.isObject()||s.parent.outputs.length)?K_(s,p,i):R1(s,p,i)}function lPe(s,p,i=!1){var E,b;if(!s.static)return null;if(p.execution){const A=(E=p.lastExecutionResults)==null?void 0:E.readValue(s.id);if(A&&!i)return{value:A,valueOwner:s,type:ke.ExecutionResult,inheritanceLink:null}}const r=!p.execution||!p.execution.parentExecution,a=p.getValueTypePreference(s.id);if(r){const A=(b=p.localTestValues)==null?void 0:b.readValue(s.id);if(A&&!i&&(a===null||a!==ke.DefaultValue))return{value:A,valueOwner:s,type:ke.Testing,inheritanceLink:null}}const c=s.defaultValue;let e=null;c&&(i||a===null||a!==ke.Testing)&&(e={value:c,valueOwner:s,type:ke.DefaultValue,inheritanceLink:null});const f=fu(s),h=s.getDataType(null);return f&&(!(e!=null&&e.value)||!Ka(h)&&pu(e==null?void 0:e.value))?{value:null,valueOwner:s,type:ke.Missing,inheritanceLink:null}:Pn(e==null?void 0:e.value)?{value:null,valueOwner:s,type:ke.Empty,inheritanceLink:null}:e}function oPe(s,p,i=!1){var f,h,m;if(p.execution&&p.execution.hasEntity(s)&&!i){const E=(f=p.lastExecutionResults)==null?void 0:f.readValue(s.id);if(E)return{value:E,valueOwner:s,type:ke.ExecutionResult,inheritanceLink:null}}const r=!p.execution||!p.execution.parentExecution,a=p.getValueTypePreference(s.id);if(r){const E=(h=p.localTestValues)==null?void 0:h.readValue(s.id);if(E&&!i&&(a===null||a!==ke.DefaultValue))return{value:E,valueOwner:s,type:ke.Testing,inheritanceLink:null}}const c=s.defaultValue;let e=null;if(c&&(i||a===null||a!==ke.Testing)&&(e={value:c,valueOwner:s,type:ke.DefaultValue,inheritanceLink:null}),((m=s.parent)==null?void 0:m.type)===d.Search){const E=s.parent.inputs.find(b=>{var A;return((A=b.declaration)==null?void 0:A.id)===s.id});if(E)return s$(E,p,i)}return Pn((e==null?void 0:e.value)||null)?{value:null,valueOwner:s,type:ke.Empty,inheritanceLink:null}:e}function iu(s,p,i=!1){if(Th.has(s.id))return{value:null,valueOwner:s,type:ke.Undefined,inheritanceLink:null};Th.add(s.id);try{switch(s.type){case d.ArgumentDeclaration:return nPe(s,p,i);case d.InputMap:return s$(s,p,i);case d.VariableDeclaration:return n$(s,p,i);case d.VariableInstance:return rPe(s,p,i);case d.OutputMap:return aPe(s,p,i);case d.ReturnStatement:case d.BreakStatement:case d.ContinueStatement:return a$(s,p,i);case d.Property:return lPe(s,p,i);case d.ValueDescriptor:return oPe(s,p,i);case d.Operation:case d.FunctionCall:case d.InternalCall:case d.Search:return ePe(s,p,i);default:return null}}finally{Th.delete(s.id)}}function to(s,p,i=!1){if(Th.has(s.id))return{value:null,valueOwner:s,type:ke.Undefined,inheritanceLink:null};Th.add(s.id);try{switch(s.type){case d.InputMap:return sPe(s,p,i);case d.VariableDeclaration:return I1(s,p,i);case d.VariableInstance:return iPe(s,p,i);case d.ReturnStatement:case d.BreakStatement:case d.ContinueStatement:return a$(s,p,i);default:return null}}finally{Th.delete(s.id)}}function fIi(s){var p;if(s&&s.type===ke.DefaultValue&&s.value&&s.valueOwner&&(!hI.includes(s.valueOwner.type)||((p=s.valueOwner.defaultValue)==null?void 0:p.id)===s.value.id)){const i=Ht(s.valueOwner.getDataType(null),s.valueOwner,s.valueOwner.project);return{type:ke.DefaultValue,value:i,valueOwner:s.valueOwner,inheritanceLink:null}}return s}function Rf(s,p,i,r){let a=!1,c=null,e=null;r instanceof S?(a=!0,c=r,e=null):(c=null,e=r);const f=s.parent;return p.getVariableDeclarations().forEach(m=>{var b,A,_,P,V,M;const E=m.getDataType(null);if(((b=E==null?void 0:E.entity)==null?void 0:b.id)===f.id){let G=a?m.defaultValue:e==null?void 0:e.readValue(m.id);G?!a&&G&&G.id===((A=m.defaultValue)==null?void 0:A.id)&&(G=Ht(m.getDataType(null),m,p)):a?G=Fu(m.getDataType(null),m,p,c):G=Ht(m.getDataType(null),m,p);const k=Lt(s,p),K=s.codeName||((_=s.extends)==null?void 0:_.codeName)||((P=s.implements[0])==null?void 0:P.codeName)||ir(k);let le={};((M=(V=m.dataType)==null?void 0:V.entity)==null?void 0:M.type)===d.DefinitionEntity&&(le={...le,...m.dataType.entity.getActiveRawDefaultValue()}),vr(G==null?void 0:G.value)&&(le={...le,...G.value}),le[K]=i,G==null||G.metaSync({value:le},c),a||e==null||e.writeValue(m,G);return}}),c}function nv(s,p,i,r){var _,P,V,M;let a=!1,c=null,e=null;r instanceof S?(a=!0,c=r,e=null):(c=null,e=r);const f=Er(s.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=Ht(f.getDataType(null),f,p)):a?m=Fu(f.getDataType(null),f,p,c):m=Ht(f.getDataType(null),f,p);const E=Lt(s,p),b=s.codeName||((P=s.declaration)==null?void 0:P.codeName)||ir(E);let A={};if(((M=(V=f.dataType)==null?void 0:V.entity)==null?void 0:M.type)===d.DefinitionEntity&&(A={...A,...f.dataType.entity.getActiveRawDefaultValue()}),vr(m==null?void 0:m.value)&&(A={...A,...m.value}),A[b]=i,m==null||m.metaSync({value:A},c),a||e==null||e.writeValue(f,m),(i===""||i===null||i===void 0)&&s.type===d.OutputMap){const G=f.inputs.find(k=>{var K,le;return((K=k.declaration)==null?void 0:K.id)===((le=s.declaration)==null?void 0:le.id)||Lt(k,p)===E});if(G){let k=a?G.defaultValue:e==null?void 0:e.readValue(G.id);k&&k.metaSync({value:null},c),a||e==null||e.removeValue(G.id)}}return c}function dPe(s,p,i){var e,f,h,m,E;let r=!1,a=null,c=null;if(i instanceof S?(r=!0,a=i,c=null):(a=null,c=i),Mt.includes(s.type)){const b=Er(s);(e=b.dataType)!=null&&e.isObject()&&b.inputs.forEach(A=>{var _,P,V,M,G,k;if(((_=A.declaration)==null?void 0:_.type)===d.Property&&A.declaration.static){let K=r?((P=A.getDefaultValue)==null?void 0:P.call(A))||null:c==null?void 0:c.readValue(A.declaration.id);K?!r&&K&&K.id===((V=A.declaration.defaultValue)==null?void 0:V.id)&&(K=Ht(A.declaration.getDataType(null),A.declaration,p)):r?K=Fu(A.declaration.getDataType(null),A.declaration,p,a):K=Ht(A.declaration.getDataType(null),A.declaration,p),K==null||K.metaSync({value:null},a),r||c==null||c.removeValue((M=A.declaration)==null?void 0:M.id)}else if(((G=A.declaration)==null?void 0:G.type)===d.Property){let K=r?((k=A.getDefaultValue)==null?void 0:k.call(A))||null:c==null?void 0:c.readValue(A.id);K&&K.metaSync({value:null},a),r||c==null||c.removeValue(A.id)}})}else s.type===d.InputMap?((f=s.declaration)==null?void 0:f.type)===d.Property&&s.declaration.static?Rf(s.declaration,p,null,i):Mt.includes(s.parent.type)&&((h=s.declaration)==null?void 0:h.type)===d.Property&&nv(s,p,null,i):s.type===d.OutputMap?((m=s.declaration)==null?void 0:m.type)===d.Property&&s.declaration.static?Rf(s.declaration,p,null,i):Mt.includes(s.parent.type)&&((E=s.declaration)==null?void 0:E.type)===d.Property&&nv(s,p,null,i):s.type===d.Property&&s.static&&Rf(s,p,null,i);return a}function uPe(s,p,i,r){var f,h,m,E,b,A,_;let a=!1,c=null,e=null;if(r instanceof S?(a=!0,c=r,e=null):(c=null,e=r),Mt.includes(p.type)){const P=Er(p);if((f=P.dataType)!=null&&f.isObject()){let V={};((m=(h=P.dataType)==null?void 0:h.entity)==null?void 0:m.type)===d.DefinitionEntity&&(V={...V,...P.dataType.entity.getActiveRawDefaultValue()});const M=vr(s)?s:V;P.inputs.forEach(G=>{var k,K,le,ne,de,Y;if(((k=G.declaration)==null?void 0:k.type)===d.Property&&G.declaration.static){let te=a?((K=p.getDefaultValue)==null?void 0:K.call(p))||null:e==null?void 0:e.readValue(G.declaration.id);te?!a&&te&&te.id===((le=G.declaration.defaultValue)==null?void 0:le.id)&&(te=Ht(G.declaration.getDataType(null),G.declaration,i)):a?te=Fu(G.declaration.getDataType(null),G.declaration,i,c):te=Ht(G.declaration.getDataType(null),G.declaration,i);const oe=Lt(G,i),Q=G.codeName||((ne=G.declaration)==null?void 0:ne.codeName)||ir(oe),z=M[Q];te==null||te.metaSync({value:z},c),a||e==null||e.writeValue(G.declaration,te)}else if(((de=G.declaration)==null?void 0:de.type)===d.Property){let te=a?((Y=p.getDefaultValue)==null?void 0:Y.call(p))||null:e==null?void 0:e.readValue(G.id);te&&te.metaSync({value:null},c),a||e==null||e.removeValue(G.id)}})}}else p.type===d.InputMap?((E=p.declaration)==null?void 0:E.type)===d.Property&&p.declaration.static?Rf(p.declaration,i,s,r):Mt.includes(p.parent.type)&&((b=p.declaration)==null?void 0:b.type)===d.Property&&nv(p,i,s,r):p.type===d.OutputMap?((A=p.declaration)==null?void 0:A.type)===d.Property&&p.declaration.static?Rf(p.declaration,i,null,r):Mt.includes(p.parent.type)&&((_=p.declaration)==null?void 0:_.type)===d.Property&&nv(p,i,null,r):p.type===d.Property&&p.static&&Rf(p,i,s,r);return c}function yIi(s,p,i){const r=ud(s,p);let a=!1,c=null,e=null;return i instanceof S?(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),dPe(f,p,i)}),c}function hIi(s,p,i,r,a){const c=ud(p,i);let e=!1,f=null,h=null;return r instanceof S?(e=!0,f=r,h=null):(f=null,h=r),i.diggestedBuiltInBaseEntitiesIds.has(p.id)||c.forEach(m=>{var A,_,P,V;if(i.diggestedBuiltInBaseEntitiesIds.has(m.id))return;let E=null;if(e){const M=((A=m.getDefaultValue)==null?void 0:A.call(m))||null;M&&(i.diggestedBuiltInBaseEntitiesIds.has(M.id)||((_=M.parent)==null?void 0:_.id)!==m.id?E=M.clone(f,m):E=M)}else E=h==null?void 0:h.readValue(m.id);E?!e&&E&&E.id===((V=(P=m.getDefaultValue)==null?void 0:P.call(m))==null?void 0:V.id)&&(E=Ht(m.getDataType(null),m,i)):e?(E=Fu(m.getDataType(null),m,i,f),f==null||f.add(E,H.Added)):E=Ht(m.getDataType(null),m,i),E==null||E.setValueAsType(null,f);let b=a||(E==null?void 0:E.name);(!(E!=null&&E.name)||(E==null?void 0:E.name)===fe.Untyped)&&!a&&(typeof s=="string"?b=fe.String:s===null?b=fe.Null:typeof s=="number"?b=fe.Number:typeof s=="boolean"&&(b=fe.Boolean)),E==null||E.metaSync({value:s,name:b},f),e||h==null||h.writeValue(m,E),uPe(s,m,i,r)}),f}function Df(s,p,i,r){let a=!1,c=null,e=null;r instanceof S?(a=!0,c=r,e=null):(c=null,e=r);const f=s.parent;return p.getVariableDeclarations().forEach(m=>{var b,A,_,P,V,M;const E=m.getDataType(null);if(((b=E==null?void 0:E.entity)==null?void 0:b.id)===f.id){let G=a?m.defaultValue:e==null?void 0:e.readValue(m.id);G?!a&&G&&G.id===((A=m.defaultValue)==null?void 0:A.id)&&(G=Ht(m.getDataType(null),m,p)):a?G=Fu(m.getDataType(null),m,p,c):G=Ht(m.getDataType(null),m,p);const k=Lt(s,p),K=s.codeName||((_=s.extends)==null?void 0:_.codeName)||((P=s.implements[0])==null?void 0:P.codeName)||ir(k);let le={};((M=(V=m.dataType)==null?void 0:V.entity)==null?void 0:M.type)===d.DefinitionEntity&&(le={...le,...m.dataType.entity.getActiveRawDefaultValue()}),vr(G==null?void 0:G.value)&&(le={...le,...G.value}),Array.isArray(i)?le[K]=(i==null?void 0:i.map(ne=>ne.toShallowJSON()))||null:le[K]=(i==null?void 0:i.toShallowJSON())||null,G==null||G.metaSync({value:le},c),a||e==null||e.writeValue(m,G);return}}),c}function av(s,p,i,r){var _,P,V,M;let a=!1,c=null,e=null;r instanceof S?(a=!0,c=r,e=null):(c=null,e=r);const f=Er(s.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=Ht(f.getDataType(null),f,p)):a?m=Fu(f.getDataType(null),f,p,c):m=Ht(f.getDataType(null),f,p);const E=Lt(s,p),b=s.codeName||((P=s.declaration)==null?void 0:P.codeName)||ir(E);let A={};if(((M=(V=f.dataType)==null?void 0:V.entity)==null?void 0:M.type)===d.DefinitionEntity&&(A={...A,...f.dataType.entity.getActiveRawDefaultValue()}),vr(m==null?void 0:m.value)&&(A={...A,...m.value}),Array.isArray(i)?A[b]=(i==null?void 0:i.map(G=>G.toShallowJSON()))||null:A[b]=(i==null?void 0:i.toShallowJSON())||null,m==null||m.metaSync({value:A},c),a||e==null||e.writeValue(f,m),i==null&&s.type===d.OutputMap){const G=f.inputs.find(k=>{var K,le;return((K=k.declaration)==null?void 0:K.id)===((le=s.declaration)==null?void 0:le.id)||Lt(k,p)===E});if(G){let k=a?G.defaultValue:e==null?void 0:e.readValue(G.id);k&&(Array.isArray(i)?k==null||k.setValueAsTypeList(i,c):k==null||k.setValueAsTypeSingle(i,c)),a||e==null||e.removeValue(G.id)}}return c}function pPe(s,p,i){var r,a,c,e;return s.type===d.InputMap?((r=s.declaration)==null?void 0:r.type)===d.Property&&s.declaration.static?Df(s.declaration,p,null,i):Mt.includes(s.parent.type)&&((a=s.declaration)==null?void 0:a.type)===d.Property&&av(s,p,null,i):s.type===d.OutputMap?((c=s.declaration)==null?void 0:c.type)===d.Property&&s.declaration.static?Df(s.declaration,p,null,i):Mt.includes(s.parent.type)&&((e=s.declaration)==null?void 0:e.type)===d.Property&&av(s,p,null,i):s.type===d.Property&&s.static&&Df(s,p,null,i),i}function cPe(s,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?Df(p.declaration,i,s,r):Mt.includes(p.parent.type)&&((c=p.declaration)==null?void 0:c.type)===d.Property&&av(p,i,s,r):p.type===d.OutputMap?((e=p.declaration)==null?void 0:e.type)===d.Property&&p.declaration.static?Df(p.declaration,i,null,r):Mt.includes(p.parent.type)&&((f=p.declaration)==null?void 0:f.type)===d.Property&&av(p,i,null,r):p.type===d.Property&&p.static&&Df(p,i,s,r),r}function mIi(s,p,i){const r=ud(s,p);let a=!1,c=null,e=null;return i instanceof S?(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),pPe(f,p,i)}),c}function TIi(s,p,i,r){const a=ud(p,i);let c=!1,e=null,f=null;return r instanceof S?(c=!0,e=r,f=null):(e=null,f=r),a.forEach(h=>{var E,b,A;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===((A=(b=h.getDefaultValue)==null?void 0:b.call(h))==null?void 0:A.id)&&(m=Ht(h.getDataType(null),h,h.project)):c?m=Fu(h.getDataType(null),h,i,e):m=Ht(h.getDataType(null),h,i),Array.isArray(s)?m==null||m.setValueAsTypeList(s,e):m==null||m.setValueAsTypeSingle(s,e),m==null||m.metaSync({value:null},e),c||f==null||f.writeValue(h,m),cPe(s,h,i,r)}),e}class D1{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 _e=(s=>(s[s.High=1]="High",s[s.Normal=5]="Normal",s[s.Low=10]="Low",s))(_e||{}),ae=(s=>(s.Logic="logic",s.EditorGUI="editor-gui",s.GUI="gui",s.Editor="editor",s.Compile="compile",s.PublicationRun="publication-run",s))(ae||{}),Ve=(s=>(s.All="*",s.OnAll="on:*",s.EmitAll="emit:*",s.ReadAll="read:*",s.WriteAll="write:*",s.UpdateAll="update:*",s.DoAll="do:*",s.OnLogicAll="on:logic:*",s.EmitLogicAll="emit:logic:*",s.ReadLogicAll="read:logic:*",s.WriteLogicAll="write:logic:*",s.UpdateLogicAll="update:logic:*",s.DoLogicAll="do:logic:*",s.OnGUIAll="on:gui:*",s.EmitGUIAll="emit:gui:*",s.ReadGUIAll="read:gui:*",s.WriteGUIAll="write:gui:*",s.UpdateGUIAll="update:gui:*",s.DoGUIAll="do:gui:*",s.OnEditorAll="on:editor:*",s.EmitEditorAll="emit:editor:*",s.ReadEditorAll="read:editor:*",s.WriteEditorAll="write:editor:*",s.UpdateEditorAll="update:editor:*",s.DoEditorAll="do:editor:*",s.OnCompileBefore="on:compile:before:DefinitionEntity",s.OnCompileDefault="on:compile:default:DefinitionEntity",s.OnCompileAfter="on:compile:after:DefinitionEntity",s.EmitCompile="emit:compile:DefinitionEntity",s.DoEditorPublish="do:editor:publish",s.PostGUICanvasSlotNewToolbarButton="write:gui:canvas:slot:toolbar-button",s.ReadGUICanvasSlotToolbarButtons="read:gui:canvas:slot:toolbar-buttons",s.UpdateGUIGlobalTheme="update:gui:global:theme",s))(Ve||{});class fPe{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 yPe extends fPe{constructor(p,i){super(i),this.parentExtension=p}}class Ne{constructor(p,i){R(this,"manifest");R(this,"module");R(this,"state");this.extensionsRegistry=p,this.state=new yPe(this,i)}}class q_ extends D1{constructor(i,r){super(i,ae.Logic);R(this,"id");this._project=r,this.id=r.id}get type(){return this._project.type}get name(){return this._project.name}get workspaceId(){return this._project.workspaceId}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 vIi(s,p){return p instanceof q_?p:new q_(s,p)}const fh="built-in-function-implementations__",Le="operations-implementations__",ds="conditions-implementations__",Pe={UUID:"uuid",SEARCH_NODE_IMPLEMENTATION:"search-node-implementation",BUILT_IN_FUNCTION_IMPLEMENTATIONS__ABORT_EXECUTION:fh+Gr.AbortExecution,BUILT_IN_FUNCTION_IMPLEMENTATIONS__CREATE_PERSISTED_ENTITY:fh+Gr.CreatePersistedEntity,BUILT_IN_FUNCTION_IMPLEMENTATIONS__UPDATE_PERSISTED_ENTITY:fh+Gr.UpdatePersistedEntity,BUILT_IN_FUNCTION_IMPLEMENTATIONS__DELETE_PERSISTED_ENTITY:fh+Gr.DeletePersistedEntity,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_EMPTY:Le+jt.Empty,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_NOT_EMPTY:Le+jt.NotEmpty,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_PRIMITIVE_EQUAL:Le+jt.PrimitiveEqual,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_PRIMITIVE_NOT_EQUAL:Le+jt.PrimitiveNotEqual,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__HTTP_REQUEST:Le+En.HttpRequest,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_SQL:Le+ao.ExecuteSQL,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__VALIDATE_ENTITY:Le+xe.Validate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_WAIT:Le+Ts.Wait,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_JOIN:Le+me.Join,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SPLIT:Le+me.Split,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_LAST_N_ITEMS:Le+me.DeleteLastNItems,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_FIRST_N_ITEMS:Le+me.DeleteFirstNItems,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_AT_INDEX:Le+me.DeleteAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_ADD_AT_INDEX:Le+me.AddAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_FIRST_N_ITEMS:Le+me.ReplaceFirstNItems,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_LAST_N_ITEMS:Le+me.ReplaceLastNItems,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_ALL:Le+me.ReplaceAll,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_AT_INDEX:Le+me.ReplaceAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_INDEX_ITEM:Le+me.GetIndexItem,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_FIRST:Le+me.GetFirst,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST:Le+me.GetLast,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_APPEND:Le+me.Append,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PREPEND:Le+me.Prepend,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REVERSE:Le+me.Reverse,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LENGTH:Le+me.GetLength,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_FIRST_N_ITEMS:Le+me.GetFirstNItems,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST_N_ITEMS:Le+me.GetLastNItems,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SLICE:Le+me.Slice,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONCAT:Le+me.Concat,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_INDEX_OF:Le+me.GetIndexOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST_INDEX_OF:Le+me.GetLastIndexOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_UNIQUE:Le+me.Unique,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_FLATTEN:Le+me.Flatten,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SORT:Le+me.Sort,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SHUFFLE:Le+me.Shuffle,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CHUNK:Le+me.Chunk,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PAD_START:Le+me.PadStart,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PAD_END:Le+me.PadEnd,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPEAT:Le+me.Repeat,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LENGTH:Le+W.GetLength,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TO_LOWER_CASE:Le+W.ToLowerCase,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TO_UPPER_CASE:Le+W.ToUpperCase,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_JOIN:Le+W.Join,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONTAINS:Le+me.Contains,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONTAINS_ALL:Le+me.ContainsAll,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONTAINS_ANY:Le+me.ContainsAny,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT_AT_INDEX:Le+W.SplitAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT_AT_ALL_SEPARATORS:Le+W.SplitAtAllSeparators,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT_AT_FIRST_SEPARATOR:Le+W.SplitAtFirstSeparator,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT_AT_LAST_SEPARATOR:Le+W.SplitAtLastSeparator,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_LAST_N_CHARS:Le+W.DeleteLastNChars,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_FIRST_N_CHARS:Le+W.DeleteFirstNChars,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_AT_INDEX:Le+W.DeleteAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ADD_AT_INDEX:Le+W.AddAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_FIRST_N_CHARS:Le+W.ReplaceFirstNChars,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_LAST_N_CHARS:Le+W.ReplaceLastNChars,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_AT_INDEX:Le+W.ReplaceAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_FIRST_MATCH:Le+W.ReplaceFirstMatch,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_LAST_MATCH:Le+W.ReplaceLastMatch,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_ALL_MATCHES:Le+W.ReplaceAllMatches,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_INDEX_ITEM:Le+W.GetIndexItem,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_FIRST_N_CHARS:Le+W.GetFirstNChars,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LAST_N_CHARS:Le+W.GetLastNChars,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_INDEX_OF:Le+W.GetIndexOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_APPEND:Le+W.Append,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PREPEND:Le+W.Prepend,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REVERSE:Le+W.Reverse,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TRIM:Le+W.Trim,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TRIM_START:Le+W.TrimStart,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TRIM_END:Le+W.TrimEnd,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SUBSTRING:Le+W.Substring,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SLICE:Le+W.Slice,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PAD_START:Le+W.PadStart,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PAD_END:Le+W.PadEnd,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPEAT:Le+W.Repeat,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LAST_INDEX_OF:Le+W.GetLastIndexOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_MATCH_REGEX:Le+W.MatchRegex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_MATCH_ALL_REGEX:Le+W.MatchAllRegex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SEARCH_REGEX:Le+W.SearchRegex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_REGEX:Le+W.ReplaceRegex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_NORMALIZE_UNICODE:Le+W.NormalizeUnicode,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REMOVE_DIACRITICS:Le+W.RemoveDiacritics,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_COUNT_OCCURRENCES:Le+W.CountOccurrences,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ENSURE_PREFIX:Le+W.EnsurePrefix,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ENSURE_SUFFIX:Le+W.EnsureSuffix,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REMOVE_PREFIX:Le+W.RemovePrefix,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REMOVE_SUFFIX:Le+W.RemoveSuffix,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ADDITION:Le+ue.Addition,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SUBTRACTION:Le+ue.Subtraction,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MULTIPLICATION:Le+ue.Multiplication,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_DIVISION:Le+ue.Division,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_REMAINDER:Le+ue.Remainder,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_EXPONENTIATION:Le+ue.Exponentiation,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ABSOLUTE:Le+ue.Absolute,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SIGN:Le+ue.Sign,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ROUND:Le+ue.Round,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_NEGATE:Le+ue.Negate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_FLOOR:Le+ue.Floor,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_CEIL:Le+ue.Ceil,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_CLAMP:Le+ue.Clamp,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TRUNC:Le+ue.Trunc,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ROUND_TO_DECIMALS:Le+ue.RoundToDecimals,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SNAP_TO_STEP:Le+ue.SnapToStep,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MAP_RANGE:Le+ue.MapRange,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_AVERAGE:Le+ue.Average,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MEDIAN:Le+ue.Median,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MIN_OF:Le+ue.MinOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MAX_OF:Le+ue.MaxOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SQUARE_ROOT:Le+ue.SquareRoot,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_CUBE_ROOT:Le+ue.CubeRoot,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_NTH_ROOT:Le+ue.NthRoot,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_EXP:Le+ue.Exp,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LOG_NATURAL:Le+ue.LogNatural,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LOG10:Le+ue.Log10,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SIN:Le+ue.Sin,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_COS:Le+ue.Cos,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TAN:Le+ue.Tan,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ASIN:Le+ue.Asin,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ACOS:Le+ue.Acos,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ATAN:Le+ue.Atan,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ATAN2:Le+ue.Atan2,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TO_RADIANS:Le+ue.ToRadians,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TO_DEGREES:Le+ue.ToDegrees,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_PERCENT_OF:Le+ue.PercentOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_PERCENTAGE_CHANGE:Le+ue.PercentageChange,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MORE_THAN:Le+ue.MoreThan,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LESS_THAN:Le+ue.LessThan,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LESS_THAN_OR_EQUAL:Le+ue.LessThanOrEqual,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MORE_THAN_OR_EQUAL:Le+ue.MoreThanOrEqual,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_INTEGER:Le+tt.GenerateRandomInteger,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_FLOAT:Le+tt.GenerateRandomFloat,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_HEXADECIMAL:Le+tt.GenerateRandomHexadecimal,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE62:Le+tt.GenerateRandomBase62,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE64:Le+tt.GenerateRandomBase64,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_ALPHANUMERIC:Le+tt.GenerateRandomAlphanumeric,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_IDENTIFIER:Le+tt.GenerateIdentifier,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_UUIDV4:Le+tt.GenerateRandomUUIDv4,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_SHORT_IDENTIFIER:Le+tt.GenerateShortIdentifier,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_HEXADECIMAL_TOKEN:Le+tt.GenerateHexadecimalToken,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_STARTS_WITH:Le+W.StartsWith,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ENDS_WITH:Le+W.EndsWith,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_CONTAINS:Le+W.Contains,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_MATCHES_REGEX:Le+W.MatchesRegex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_CURRENT_TIMESTAMP:Le+q.GetCurrentTimestamp,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_FORMAT_DATE:Le+q.FormatDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_PARSE_DATE:Le+q.ParseDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_ADD_TO_DATE:Le+q.AddToDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SUBTRACT_FROM_DATE:Le+q.SubtractFromDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_DIFFERENCE_BETWEEN_DATES:Le+q.DifferenceBetweenDates,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_DATE:Le+q.ToDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_UNIX:Le+q.ToUnix,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_FROM_UNIX:Le+q.FromUnix,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_ISO_STRING:Le+q.ToISOString,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_YEAR:Le+q.GetYear,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_MONTH:Le+q.GetMonth,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_DATE:Le+q.GetDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_HOUR:Le+q.GetHour,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_MINUTE:Le+q.GetMinute,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_SECOND:Le+q.GetSecond,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_MILLISECOND:Le+q.GetMillisecond,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_ISO_WEEKDAY:Le+q.GetIsoWeekday,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_WEEK_OF_YEAR:Le+q.GetWeekOfYear,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_QUARTER:Le+q.GetQuarter,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_DAY_OF_YEAR:Le+q.GetDayOfYear,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_DAYS_IN_MONTH:Le+q.GetDaysInMonth,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_CURRENT_IANA_TIMEZONE:Le+q.GetCurrentIanaTimeZone,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_YEAR:Le+q.SetYear,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_MONTH:Le+q.SetMonth,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_DATE:Le+q.SetDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_HOUR:Le+q.SetHour,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_MINUTE:Le+q.SetMinute,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_SECOND:Le+q.SetSecond,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_MILLISECOND:Le+q.SetMillisecond,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_ISO_WEEKDAY:Le+q.SetIsoWeekday,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_QUARTER:Le+q.SetQuarter,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_START_OF:Le+q.StartOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_END_OF:Le+q.EndOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_ROUND_TO:Le+q.RoundTo,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_BEFORE:ds+q.IsBefore,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_AFTER:ds+q.IsAfter,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_SAME:ds+q.IsSame,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_SAME_OR_BEFORE:ds+q.IsSameOrBefore,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_SAME_OR_AFTER:ds+q.IsSameOrAfter,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_BETWEEN:ds+q.IsBetween,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_VALID:ds+q.IsValid,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_LEAP_YEAR:ds+q.IsLeapYear,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_CLAMP_TO_RANGE:Le+q.ClampToRange,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_MIN_OF:Le+q.MinOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_MAX_OF:Le+q.MaxOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_FROM_NOW:Le+q.FromNow,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_NOW:Le+q.ToNow,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_HUMANIZE_DIFF:Le+q.HumanizeDiff,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_ADD_BUSINESS_DAYS:Le+q.AddBusinessDays,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_NEXT_WEEKDAY:Le+q.NextWeekday,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_PREVIOUS_WEEKDAY:Le+q.PreviousWeekday,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_UTC:Le+q.ToUTC,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_CONVERT_TIMEZONE:Le+q.ConvertTimezone,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_TIMEZONE_OFFSET:Le+q.GetTimezoneOffset,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_UTC_OFFSET:Le+q.SetUTCOffset,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_READ_KEY:Le+xe.ReadKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_WRITE_KEY:Le+xe.WriteKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_DELETE_KEY:Le+xe.DeleteKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_READ_NESTED_KEY:Le+xe.ReadNestedKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_WRITE_NESTED_KEY:Le+xe.WriteNestedKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_DELETE_NESTED_KEY:Le+xe.DeleteNestedKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_WRITE_SAFE_NESTED_KEY_RECURSIVELY:Le+xe.WriteSafeNestedKeyRecursively,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_HAS_KEY:ds+xe.HasKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_HAS_NESTED_KEY:ds+xe.HasNestedKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_KEY_VALUE_EQUALS:ds+xe.KeyValueEquals,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_NESTED_KEY_VALUE_EQUALS:ds+xe.NestedKeyValueEquals,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_IS_INSTANCE_OF_TYPE:ds+xe.IsInstanceOfType,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_MERGE:Le+xe.Merge,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_KEYS:Le+xe.Keys,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_VALUES:Le+xe.Values,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_ENTRIES:Le+xe.Entries,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_GET_TYPE_OF:Le+Qe.GetTypeOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_HASH:Le+Li.Hash,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_HMAC:Le+Li.Hmac,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_GENERATE_RANDOM_BYTES:Le+tt.GenerateRandomBytes,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_CONSTANT_TIME_EQUAL:Le+Li.ConstantTimeEqual,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_DERIVE_KEY_PBKDF2:Le+Li.DeriveKeyPBKDF2,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__PASSWORD_HASH_PBKDF2:Le+An.HashPasswordPBKDF2,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__PASSWORD_VERIFY_PBKDF2:Le+An.VerifyPasswordPBKDF2,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_BUILD_HMAC:Le+hr.BuildJwtHmac,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_VERIFY_HMAC:Le+hr.VerifyJwtHmac,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_DECODE:Le+hr.DecodeJwt,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_FROM_BYTES_TO_STRING:Le+Qe.FromBytesToString,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_BYTES:Le+Qe.ToBytes,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_NUMBER:Le+Qe.ToNumber,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_STRING:Le+Qe.ToString,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_BASE64:Le+Qe.EncodeBase64,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_BASE64:Le+Qe.DecodeBase64,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_BASE64URL:Le+Qe.EncodeBase64Url,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_BASE64URL:Le+Qe.DecodeBase64Url,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_HEX:Le+Qe.EncodeHex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_HEX:Le+Qe.DecodeHex,BUILT_IN_OPERATIONS_IMPLEMENTATIONS__JSON_PARSE:Le+bn.Parse,BUILT_IN_OPERATIONS_IMPLEMENTATIONS__JSON_STRINGIFY:Le+bn.Stringify};class hPe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.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:_e.High,permissions:[Ve.All],contexts:[ae.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 mPe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.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:_e.High,permissions:[Ve.All],contexts:[ae.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 TPe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.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:_e.High,permissions:[Ve.All],contexts:[ae.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 vPe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.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:_e.High,permissions:[Ve.All],contexts:[ae.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 EPe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.SEARCH_NODE_IMPLEMENTATION,version:"1.0.0",description:"Implementation for search nodes when they get executed and query data.",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Editor]});R(this,"module",{main:async(i,r)=>({error:"Search module not implemented",data:null})})}}class bPe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.UUID,version:"1.0.0",description:"UUID generation module, for all contexts and runtimes",initPriority:_e.High,permissions:[Ve.All],contexts:[]});R(this,"module",PV)}}const APe=s=>s.map(p=>{var i,r;return((i=p.value)==null?void 0:i.valueAsType)??((r=p.value)==null?void 0:r.value)});class gPe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_EMPTY,version:"1.0.0",description:"Comparison: Empty (!value)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(jt.Empty);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=APe(r),c=!a;return{value:U.Success,error:null,result:c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class IPe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_NOT_EMPTY,version:"1.0.0",description:"Comparison: NotEmpty (!!value)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(jt.NotEmpty);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=APe(r),c=!!a;return{value:U.Success,error:null,result:c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}const oI=class oI extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_PRIMITIVE_EQUAL,version:"1.0.0",description:"Comparison: PrimitiveEqual (typed equality / deep JSON equality)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(jt.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,A=(m=(h=r[1])==null?void 0:h.value)==null?void 0:m.value;let _=!1;return E&&oI.primitiveSet.has(E)?_=b===A:E===fe.Untyped||E===fe.KeyValue?_=JSON.stringify(b)===JSON.stringify(A):_=!1,{value:U.Success,error:null,result:_}}catch(E){return{value:U.UnhandledError,error:E,result:null}}}})}};R(oI,"primitiveSet",new Set([fe.String,fe.Number,fe.Boolean,fe.Null,fe.Enum,fe.Date,fe.UUID]));let Mg=oI;const dI=class dI extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_PRIMITIVE_NOT_EQUAL,version:"1.0.0",description:"Comparison: PrimitiveNotEqual (typed inequality / deep JSON inequality)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(jt.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,A=(m=(h=r[1])==null?void 0:h.value)==null?void 0:m.value;let _=!1;return E&&dI.primitiveSet.has(E)?_=b!==A:E===fe.Untyped||E===fe.KeyValue?_=JSON.stringify(b)!==JSON.stringify(A):_=!1,{value:U.Success,error:null,result:_}}catch(E){return{value:U.UnhandledError,error:E,result:null}}}})}};R(dI,"primitiveSet",new Set([fe.String,fe.Number,fe.Boolean,fe.Null,fe.Enum,fe.Date,fe.UUID]));let Gg=dI;var RPe={exports:{}};(function(s,p){(function(i,r){s.exports=r()})(Xr,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(V){var M={date:V,utc:!0,args:arguments};return new e(M)},h.utc=function(V){var M=f(this.toDate(),{locale:this.$L,utc:!0});return V?M.add(this.utcOffset(),i):M},h.local=function(){return f(this.toDate(),{locale:this.$L,utc:!1})};var m=h.parse;h.parse=function(V){V.utc&&(this.$u=!0),this.$utils().u(V.$offset)||(this.$offset=V.$offset),m.call(this,V)};var E=h.init;h.init=function(){if(this.$u){var V=this.$d;this.$y=V.getUTCFullYear(),this.$M=V.getUTCMonth(),this.$D=V.getUTCDate(),this.$W=V.getUTCDay(),this.$H=V.getUTCHours(),this.$m=V.getUTCMinutes(),this.$s=V.getUTCSeconds(),this.$ms=V.getUTCMilliseconds()}else E.call(this)};var b=h.utcOffset;h.utcOffset=function(V,M){var G=this.$utils().u;if(G(V))return this.$u?0:G(this.$offset)?b.call(this):this.$offset;if(typeof V=="string"&&(V=function(ne){ne===void 0&&(ne="");var de=ne.match(r);if(!de)return null;var Y=(""+de[0]).match(a)||["-",0,0],te=Y[0],oe=60*+Y[1]+ +Y[2];return oe===0?0:te==="+"?oe:-oe}(V),V===null))return this;var k=Math.abs(V)<=16?60*V:V;if(k===0)return this.utc(M);var K=this.clone();if(M)return K.$offset=k,K.$u=!1,K;var le=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(K=this.local().add(k+le,i)).$offset=k,K.$x.$localOffset=le,K};var A=h.format;h.format=function(V){var M=V||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return A.call(this,M)},h.valueOf=function(){var V=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*V},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(V){return V==="s"&&this.$offset?f(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():_.call(this)};var P=h.diff;h.diff=function(V,M,G){if(V&&this.$u===V.$u)return P.call(this,V,M,G);var k=this.local(),K=f(V).local();return P.call(k,K,M,G)}}})})(RPe);var EIi=RPe.exports;const bIi=Os(EIi);var DPe={exports:{}};(function(s,p){(function(i,r){s.exports=r()})(Xr,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(A,_,P){P===void 0&&(P={});var V=new Date(A),M=function(G,k){k===void 0&&(k={});var K=k.timeZoneName||"short",le=G+"|"+K,ne=r[le];return ne||(ne=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:G,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:K}),r[le]=ne),ne}(_,P);return M.formatToParts(V)},m=function(A,_){for(var P=h(A,_),V=[],M=0;M<P.length;M+=1){var G=P[M],k=G.type,K=G.value,le=i[k];le>=0&&(V[le]=parseInt(K,10))}var ne=V[3],de=ne===24?0:ne,Y=V[0]+"-"+V[1]+"-"+V[2]+" "+de+":"+V[4]+":"+V[5]+":000",te=+A;return(e.utc(Y).valueOf()-(te-=te%1e3))/6e4},E=c.prototype;E.tz=function(A,_){A===void 0&&(A=f);var P,V=this.utcOffset(),M=this.toDate(),G=M.toLocaleString("en-US",{timeZone:A}),k=Math.round((M-new Date(G))/1e3/60),K=15*-Math.round(M.getTimezoneOffset()/15)-k;if(!Number(K))P=this.utcOffset(0,_);else if(P=e(G,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(K,!0),_){var le=P.utcOffset();P=P.add(V-le,"minute")}return P.$x.$timezone=A,P},E.offsetName=function(A){var _=this.$x.$timezone||e.tz.guess(),P=h(this.valueOf(),_,{timeZoneName:A}).find(function(V){return V.type.toLowerCase()==="timezonename"});return P&&P.value};var b=E.startOf;E.startOf=function(A,_){if(!this.$x||!this.$x.$timezone)return b.call(this,A,_);var P=e(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return b.call(P,A,_).tz(this.$x.$timezone,!0)},e.tz=function(A,_,P){var V=P&&_,M=P||_||f,G=m(+e(),M);if(typeof A!="string")return e(A).tz(M);var k=function(de,Y,te){var oe=de-60*Y*1e3,Q=m(oe,te);if(Y===Q)return[oe,Y];var z=m(oe-=60*(Q-Y)*1e3,te);return Q===z?[oe,Q]:[de-60*Math.min(Q,z)*1e3,Math.max(Q,z)]}(e.utc(A,V).valueOf(),G,M),K=k[0],le=k[1],ne=e(K).utcOffset(le);return ne.$x.$timezone=M,ne},e.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},e.tz.setDefault=function(A){f=A}}})})(DPe);var AIi=DPe.exports;const gIi=Os(AIi);var wPe={exports:{}};(function(s,p){(function(i,r){s.exports=r()})(Xr,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]==="(",A=h[1]===")";return(b?this.isAfter(m,f):!this.isBefore(m,f))&&(A?this.isBefore(E,f):!this.isAfter(E,f))||(b?this.isBefore(m,f):!this.isAfter(m,f))&&(A?this.isAfter(E,f):!this.isBefore(E,f))}}})})(wPe);var IIi=wPe.exports;const RIi=Os(IIi);var CPe={exports:{}};(function(s,p){(function(i,r){s.exports=r()})(Xr,function(){return function(i,r){r.prototype.isSameOrAfter=function(a,c){return this.isSame(a,c)||this.isAfter(a,c)}}})})(CPe);var DIi=CPe.exports;const wIi=Os(DIi);var OPe={exports:{}};(function(s,p){(function(i,r){s.exports=r()})(Xr,function(){return function(i,r){r.prototype.isSameOrBefore=function(a,c){return this.isSame(a,c)||this.isBefore(a,c)}}})})(OPe);var CIi=OPe.exports;const OIi=Os(CIi);var _Pe={exports:{}};(function(s,p){(function(i,r){s.exports=r()})(Xr,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 A=e(this).startOf(r).date(m).startOf(i).subtract(1,"millisecond"),_=this.diff(A,i,!0);return _<0?e(this).startOf("week").week():Math.ceil(_)},f.weeks=function(h){return h===void 0&&(h=null),this.week(h)}}})})(_Pe);var _Ii=_Pe.exports;const VIi=Os(_Ii);var VPe={exports:{}};(function(s,p){(function(i,r){s.exports=r()})(Xr,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,A,_,P=e(this),V=(E=this.isoWeekYear(),b=this.$u,A=(b?c.utc:c)().year(E).startOf("year"),_=4-A.isoWeekday(),A.isoWeekday()>4&&(_+=7),A.add(_,i));return P.diff(V,"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(),A=!!b.u(E)||E;return b.p(m)==="isoweek"?A?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)}}})})(VPe);var PIi=VPe.exports;const NIi=Os(PIi);var PPe={exports:{}};(function(s,p){(function(i,r){s.exports=r()})(Xr,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(),A=!!b.u(E)||E;if(b.p(m)===r){var _=this.quarter()-1;return A?this.month(3*_).startOf(i).startOf("day"):this.month(3*_+2).endOf(i).endOf("day")}return h.bind(this)(m,E)}}})})(PPe);var xIi=PPe.exports;const $Ii=Os(xIi);var NPe={exports:{}};(function(s,p){(function(i,r){s.exports=r()})(Xr,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")}}})})(NPe);var LIi=NPe.exports;const BIi=Os(LIi);var xPe={exports:{}};(function(s,p){(function(i,r){s.exports=r()})(Xr,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,A){return c.fromToBase(m,E,b,A)}a.en.relativeTime=e,c.fromToBase=function(m,E,b,A,_){for(var P,V,M,G=b.$locale().relativeTime||e,k=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"}],K=k.length,le=0;le<K;le+=1){var ne=k[le];ne.d&&(P=A?a(m).diff(b,ne.d,!0):b.diff(m,ne.d,!0));var de=(i.rounding||Math.round)(Math.abs(P));if(M=P>0,de<=ne.r||!ne.r){de<=1&&le>0&&(ne=k[le-1]);var Y=G[ne.l];_&&(de=_(""+de)),V=typeof Y=="string"?Y.replace("%d",de):Y(de,E,ne.l,M);break}}if(E)return V;var te=M?G.future:G.past;return typeof te=="function"?te(V):te.replace("%s",V)},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)}}})})(xPe);var MIi=xPe.exports;const GIi=Os(MIi);var $Pe={exports:{}};(function(s,p){(function(i,r){s.exports=r()})(Xr,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)?)?$/,A={years:m,months:E,days:f,hours:e,minutes:c,seconds:a,milliseconds:1,weeks:6048e5},_=function(de){return de instanceof le},P=function(de,Y,te){return new le(de,te,Y.$l)},V=function(de){return r.p(de)+"s"},M=function(de){return de<0},G=function(de){return M(de)?Math.ceil(de):Math.floor(de)},k=function(de){return Math.abs(de)},K=function(de,Y){return de?M(de)?{negative:!0,format:""+k(de)+Y}:{negative:!1,format:""+de+Y}:{negative:!1,format:""}},le=function(){function de(te,oe,Q){var z=this;if(this.$d={},this.$l=Q,te===void 0&&(this.$ms=0,this.parseFromMilliseconds()),oe)return P(te*A[V(oe)],this);if(typeof te=="number")return this.$ms=te,this.parseFromMilliseconds(),this;if(typeof te=="object")return Object.keys(te).forEach(function(ce){z.$d[V(ce)]=te[ce]}),this.calMilliseconds(),this;if(typeof te=="string"){var se=te.match(b);if(se){var ye=se.slice(2).map(function(ce){return ce!=null?Number(ce):0});return this.$d.years=ye[0],this.$d.months=ye[1],this.$d.weeks=ye[2],this.$d.days=ye[3],this.$d.hours=ye[4],this.$d.minutes=ye[5],this.$d.seconds=ye[6],this.calMilliseconds(),this}}return this}var Y=de.prototype;return Y.calMilliseconds=function(){var te=this;this.$ms=Object.keys(this.$d).reduce(function(oe,Q){return oe+(te.$d[Q]||0)*A[Q]},0)},Y.parseFromMilliseconds=function(){var te=this.$ms;this.$d.years=G(te/m),te%=m,this.$d.months=G(te/E),te%=E,this.$d.days=G(te/f),te%=f,this.$d.hours=G(te/e),te%=e,this.$d.minutes=G(te/c),te%=c,this.$d.seconds=G(te/a),te%=a,this.$d.milliseconds=te},Y.toISOString=function(){var te=K(this.$d.years,"Y"),oe=K(this.$d.months,"M"),Q=+this.$d.days||0;this.$d.weeks&&(Q+=7*this.$d.weeks);var z=K(Q,"D"),se=K(this.$d.hours,"H"),ye=K(this.$d.minutes,"M"),ce=this.$d.seconds||0;this.$d.milliseconds&&(ce+=this.$d.milliseconds/1e3,ce=Math.round(1e3*ce)/1e3);var he=K(ce,"S"),Ae=te.negative||oe.negative||z.negative||se.negative||ye.negative||he.negative,Re=se.format||ye.format||he.format?"T":"",Oe=(Ae?"-":"")+"P"+te.format+oe.format+z.format+Re+se.format+ye.format+he.format;return Oe==="P"||Oe==="-P"?"P0D":Oe},Y.toJSON=function(){return this.toISOString()},Y.format=function(te){var oe=te||"YYYY-MM-DDTHH:mm:ss",Q={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 oe.replace(h,function(z,se){return se||String(Q[z])})},Y.as=function(te){return this.$ms/A[V(te)]},Y.get=function(te){var oe=this.$ms,Q=V(te);return Q==="milliseconds"?oe%=1e3:oe=Q==="weeks"?G(oe/A[Q]):this.$d[Q],oe||0},Y.add=function(te,oe,Q){var z;return z=oe?te*A[V(oe)]:_(te)?te.$ms:P(te,this).$ms,P(this.$ms+z*(Q?-1:1),this)},Y.subtract=function(te,oe){return this.add(te,oe,!0)},Y.locale=function(te){var oe=this.clone();return oe.$l=te,oe},Y.clone=function(){return P(this.$ms,this)},Y.humanize=function(te){return i().add(this.$ms,"ms").locale(this.$l).fromNow(!te)},Y.valueOf=function(){return this.asMilliseconds()},Y.milliseconds=function(){return this.get("milliseconds")},Y.asMilliseconds=function(){return this.as("milliseconds")},Y.seconds=function(){return this.get("seconds")},Y.asSeconds=function(){return this.as("seconds")},Y.minutes=function(){return this.get("minutes")},Y.asMinutes=function(){return this.as("minutes")},Y.hours=function(){return this.get("hours")},Y.asHours=function(){return this.as("hours")},Y.days=function(){return this.get("days")},Y.asDays=function(){return this.as("days")},Y.weeks=function(){return this.get("weeks")},Y.asWeeks=function(){return this.as("weeks")},Y.months=function(){return this.get("months")},Y.asMonths=function(){return this.as("months")},Y.years=function(){return this.get("years")},Y.asYears=function(){return this.as("years")},de}(),ne=function(de,Y,te){return de.add(Y.years()*te,"y").add(Y.months()*te,"M").add(Y.days()*te,"d").add(Y.hours()*te,"h").add(Y.minutes()*te,"m").add(Y.seconds()*te,"s").add(Y.milliseconds()*te,"ms")};return function(de,Y,te){i=te,r=te().$utils(),te.duration=function(z,se){var ye=te.locale();return P(z,{$l:ye},se)},te.isDuration=_;var oe=Y.prototype.add,Q=Y.prototype.subtract;Y.prototype.add=function(z,se){return _(z)?ne(this,z,1):oe.bind(this)(z,se)},Y.prototype.subtract=function(z,se){return _(z)?ne(this,z,-1):Q.bind(this)(z,se)}}})})($Pe);var kIi=$Pe.exports;const jIi=Os(kIi);var LPe={exports:{}};(function(s,p){(function(i,r){s.exports=r()})(Xr,function(){return function(i,r){r.prototype.isLeapYear=function(){return this.$y%4==0&&this.$y%100!=0||this.$y%400==0}}})})(LPe);var UIi=LPe.exports;const FIi=Os(UIi);B.extend(bIi);B.extend(gIi);B.extend(RIi);B.extend(wIi);B.extend(OIi);B.extend(VIi);B.extend(NIi);B.extend($Ii);B.extend(BIi);B.extend(GIi);B.extend(jIi);B.extend(FIi);const $t=s=>B(s),Ar=s=>s.toISOString();function BPe(){return Ar(B())}function MPe(s,p){return $t(s).format(p)}function GPe(s){return Ar(B(s))}function kPe(s){if(s==null)throw new TypeError("ToDate expects a non-null value.");if(typeof s=="string"){const p=B(s);if(!p.isValid())throw new TypeError("Invalid date string.");return p.toISOString()}if(typeof s=="number"&&Number.isFinite(s)){const p=Math.abs(s)<1e12?B.unix(s):B(s);if(!p.isValid())throw new TypeError("Invalid numeric timestamp.");return p.toISOString()}if(s instanceof Date){const p=B(s);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 jPe(s,p,i){return Ar($t(s).add(p,i))}function UPe(s,p,i){return Ar($t(s).subtract(p,i))}function FPe(s,p,i,r=!1){return $t(s).diff($t(p),i,r)}function KPe(s){return $t(s).unix()}function qPe(s){return Ar(B.unix(s))}function SPe(s){return Ar($t(s))}function ZPe(s){return $t(s).year()}function HPe(s){return $t(s).month()}function WPe(s){return $t(s).date()}function zPe(s){return $t(s).hour()}function YPe(s){return $t(s).minute()}function JPe(s){return $t(s).second()}function QPe(s){return $t(s).millisecond()}function XPe(s){return $t(s).isoWeekday()}function eNe(s){return $t(s).week()}function tNe(s){return $t(s).quarter()}function iNe(s){return $t(s).dayOfYear()}function rNe(s){return $t(s).daysInMonth()}function nNe(s,p){return Ar($t(s).year(p))}function aNe(s,p){return Ar($t(s).month(p))}function sNe(s,p){return Ar($t(s).date(p))}function lNe(s,p){return Ar($t(s).hour(p))}function oNe(s,p){return Ar($t(s).minute(p))}function dNe(s,p){return Ar($t(s).second(p))}function uNe(s,p){return Ar($t(s).millisecond(p))}function pNe(s,p){return Ar($t(s).isoWeekday(p))}function cNe(s,p){return Ar($t(s).quarter(p))}function fNe(s,p){return Ar($t(s).startOf(p))}function yNe(s,p){return Ar($t(s).endOf(p))}function hNe(s,p){const i=$t(s),r=i.startOf(p),a=i.endOf(p),c=r.valueOf()+(a.valueOf()-r.valueOf())/2;return Ar(i.valueOf()<c?r:a)}function mNe(s,p,i){return $t(s).isBefore($t(p),i)}function TNe(s,p,i){return $t(s).isAfter($t(p),i)}function vNe(s,p,i){return $t(s).isSame($t(p),i)}function ENe(s,p,i){return $t(s).isSameOrBefore($t(p),i)}function bNe(s,p,i){return $t(s).isSameOrAfter($t(p),i)}function ANe(s,p,i,r,a="()"){return $t(s).isBetween($t(p),$t(i),r,a)}function gNe(s){return B(s).isValid()}function INe(s){return $t(s).isLeapYear()}function RNe(s,p,i){const r=$t(s);return r.isBefore(p)?Ar($t(p)):r.isAfter(i)?Ar($t(i)):Ar(r)}function DNe(s){if(s.length===0)throw new Error("minOf requires at least one date");let p=$t(s[0]);for(let i=1;i<s.length;i++){const r=$t(s[i]);r.isBefore(p)&&(p=r)}return Ar(p)}function wNe(s){if(s.length===0)throw new Error("maxOf requires at least one date");let p=$t(s[0]);for(let i=1;i<s.length;i++){const r=$t(s[i]);r.isAfter(p)&&(p=r)}return Ar(p)}function CNe(s,p=!1){return $t(s).fromNow(p)}function ONe(s,p=!1){return $t(s).toNow(p)}function _Ne(s,p,i=!0){const r=$t(s).diff($t(p),"millisecond",!0),a=Math.abs(r),e=B.duration(a,"milliseconds").humanize();return i?r>=0?`in ${e}`:`${e} ago`:e}function VNe(s,p,i=["6","7"],r=[]){const a=m=>r.some(E=>$t(E).isSame(m,"day")),c=m=>((m.day()+6)%7+1).toString();let e=$t(s);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 Ar(e)}function PNe(s,p){let i=$t(s);const r=p;for(let a=0;a<7;a++)if(i=i.add(1,"day"),i.isoWeekday()===r)return Ar(i);return Ar(i)}function NNe(s,p){let i=$t(s);const r=p;for(let a=0;a<7;a++)if(i=i.subtract(1,"day"),i.isoWeekday()===r)return Ar(i);return Ar(i)}const xNe="Local";function l$(){try{const s=Intl.DateTimeFormat().resolvedOptions().timeZone;if(s&&typeof s=="string")return s}catch{}try{if(typeof process<"u"&&process.env&&process.env.TZ)return process.env.TZ}catch{}return null}function o$(){const s=l$();if(s)return s;throw new Error("Unable to detect current IANA timezone from host environment.")}function $Ne(s,p,i=!1){let r=p;if(r===xNe){const e=l$();if(!e)throw new Error("Unable to detect current timezone from host environment.");r=e}const a=r?B.tz(s,r):$t(s),c=i?a.utc(!0):a.utc();return Ar(c)}function LNe(s,p,i=!1){const r=$t(s);return Ar(i?r.tz(p,!0):r.tz(p))}function BNe(s,p){const i=s===xNe?o$():s;return $t(p).tz(i).utcOffset()}function MNe(s,p,i=!1){return Ar($t(s).utcOffset(p,i))}class GNe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_CURRENT_TIMESTAMP,version:"1.0.0",description:"Date get current timestamp operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.GetCurrentTimestamp);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=BPe();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 kNe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_FORMAT_DATE,version:"1.0.0",description:"Date format operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=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 jNe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_PARSE_DATE,version:"1.0.0",description:"Date parse operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=GPe(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 UNe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_ADD_TO_DATE,version:"1.0.0",description:"Date add-to-date operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=jPe(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 FNe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SUBTRACT_FROM_DATE,version:"1.0.0",description:"Date subtract-from-date operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=UPe(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 KNe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_DIFFERENCE_BETWEEN_DATES,version:"1.0.0",description:"Date difference-between-dates operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.DifferenceBetweenDates);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(E=>{var b,A;return((b=E.value)==null?void 0:b.valueAsType)||((A=E.value)==null?void 0:A.value)}),c=a[0],e=a[1],f=a[2],h=a[3]??!1,m=FPe(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 KIi extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_DATE,version:"1.0.0",description:"Date to-date operation implementation module (coerce to ISO 8601 string)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=kPe(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 qNe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_UNIX,version:"1.0.0",description:"Date to-unix operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=KPe(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 SNe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_FROM_UNIX,version:"1.0.0",description:"Date from-unix operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=qPe(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 ZNe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_ISO_STRING,version:"1.0.0",description:"Date to-iso-string operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=SPe(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 HNe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_YEAR,version:"1.0.0",description:"Date get-year operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=ZPe(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 WNe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_MONTH,version:"1.0.0",description:"Date get-month (0-based) operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=HPe(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 zNe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_DATE,version:"1.0.0",description:"Date get-date (day of month) operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=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 YNe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_HOUR,version:"1.0.0",description:"Date get-hour operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=zPe(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 JNe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_MINUTE,version:"1.0.0",description:"Date get-minute operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=YPe(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 QNe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_SECOND,version:"1.0.0",description:"Date get-second operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=JPe(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 XNe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_MILLISECOND,version:"1.0.0",description:"Date get-millisecond operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=QPe(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 exe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_ISO_WEEKDAY,version:"1.0.0",description:"Date get-iso-weekday operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=XPe(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 txe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_WEEK_OF_YEAR,version:"1.0.0",description:"Date get-week-of-year operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=eNe(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 ixe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_QUARTER,version:"1.0.0",description:"Date get-quarter operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=tNe(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 rxe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_DAY_OF_YEAR,version:"1.0.0",description:"Date get-day-of-year operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=iNe(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 nxe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_DAYS_IN_MONTH,version:"1.0.0",description:"Date get-days-in-month operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=rNe(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 axe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_CURRENT_IANA_TIMEZONE,version:"1.0.0",description:"Date get-current-iana-timezone operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.GetCurrentIanaTimeZone);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=o$();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 sxe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_YEAR,version:"1.0.0",description:"Date set-year operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=nNe(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 lxe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_MONTH,version:"1.0.0",description:"Date set-month operation implementation module (0-based month)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=aNe(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 oxe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_DATE,version:"1.0.0",description:"Date set-date (day of month) operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=sNe(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 dxe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_HOUR,version:"1.0.0",description:"Date set-hour operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=lNe(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 Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_MINUTE,version:"1.0.0",description:"Date set-minute operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=oNe(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 pxe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_SECOND,version:"1.0.0",description:"Date set-second operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=dNe(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 cxe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_MILLISECOND,version:"1.0.0",description:"Date set-millisecond operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=uNe(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 fxe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_ISO_WEEKDAY,version:"1.0.0",description:"Date set-iso-weekday operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=pNe(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 yxe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_QUARTER,version:"1.0.0",description:"Date set-quarter operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=cNe(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 hxe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_START_OF,version:"1.0.0",description:"Date start-of operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=fNe(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 mxe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_END_OF,version:"1.0.0",description:"Date end-of operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=yNe(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 Txe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_ROUND_TO,version:"1.0.0",description:"Date round-to operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=hNe(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 vxe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_BEFORE,version:"1.0.0",description:"Date is-before operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=mNe(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 Exe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_AFTER,version:"1.0.0",description:"Date is-after operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=TNe(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 bxe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_SAME,version:"1.0.0",description:"Date is-same operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=vNe(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 Axe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_SAME_OR_BEFORE,version:"1.0.0",description:"Date is-same-or-before operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=ENe(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 gxe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_SAME_OR_AFTER,version:"1.0.0",description:"Date is-same-or-after operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=bNe(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 Ixe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_BETWEEN,version:"1.0.0",description:"Date is-between operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.IsBetween);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(b=>{var A,_;return((A=b.value)==null?void 0:A.valueAsType)||((_=b.value)==null?void 0:_.value)}),c=a[0],e=a[1],f=a[2],h=a[3],m=a[4],E=ANe(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 Rxe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_VALID,version:"1.0.0",description:"Date is-valid operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=gNe(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 Dxe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_LEAP_YEAR,version:"1.0.0",description:"Date is-leap-year operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=INe(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 Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_CLAMP_TO_RANGE,version:"1.0.0",description:"Date clamp-to-range operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=RNe(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 Cxe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_MIN_OF,version:"1.0.0",description:"Date min-of operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=DNe(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 Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_MAX_OF,version:"1.0.0",description:"Date max-of operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=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 _xe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_FROM_NOW,version:"1.0.0",description:"Date from-now operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=CNe(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 Vxe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_NOW,version:"1.0.0",description:"Date to-now operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=ONe(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 Pxe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_HUMANIZE_DIFF,version:"1.0.0",description:"Date humanize-diff operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=_Ne(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 Nxe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_ADD_BUSINESS_DAYS,version:"1.1.0",description:"Date add-business-days operation implementation module (ISO-weekend strings)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.AddBusinessDays);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(E=>{var b,A;return((b=E.value)==null?void 0:b.valueAsType)??((A=E.value)==null?void 0:A.value)}),c=a[0],e=a[1],f=a[2]??void 0,h=a[3]??[],m=VNe(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 xxe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_NEXT_WEEKDAY,version:"1.0.0",description:"Date next-weekday operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=PNe(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 $xe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_PREVIOUS_WEEKDAY,version:"1.0.0",description:"Date previous-weekday operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=NNe(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 Lxe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_UTC,version:"1.1.0",description:"Date to-utc operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=$Ne(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 Bxe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_CONVERT_TIMEZONE,version:"1.0.0",description:"Date convert-timezone operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=LNe(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 Mxe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_TIMEZONE_OFFSET,version:"1.0.0",description:"Date get-timezone-offset operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=BNe(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 Gxe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_UTC_OFFSET,version:"1.0.0",description:"Date set-utc-offset operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(q.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=MNe(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 kxe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_WAIT,version:"1.0.0",description:"Execution wait operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(Ts.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 qIi=/^\d{4}-\d{2}-\d{2}(?:[T ]\d{2}:\d{2}(?::\d{2}(?:\.\d{1,3})?)?(?:Z|[+-]\d{2}:?\d{2})?)?$/,d$=s=>s===null||["string","number","boolean"].includes(typeof s);function zn(s,p="Input must be an array"){if(!Array.isArray(s))throw new TypeError(p);return s}function Go(s){const p=zn(s,"Input must be an array");if(!p||p.length===0)throw new TypeError("No list provided or list is empty");return p}function u$(s){return Array.isArray(s)?s:[]}function Ks(s){return Number(s)}function jxe(s){if(!s||s.length===0)throw new TypeError("No input lists provided");if(!s.every(r=>Array.isArray(r)))throw new TypeError("All inputs must be arrays");const[p,...i]=s;return i.reduce((r,a)=>r.concat(a),p)}function Uxe(s,...p){if(!Array.isArray(s))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 s.concat(...p)}function Fxe(s,p){const i=Go(s),r=Ks(p);return[i.slice(0,r),i.slice(r)]}function Kxe(s){return Go(s).slice().reverse()}function qxe(s){return Go(s).slice(0,-1)}function Sxe(s){return Go(s).slice(1)}function Zxe(s,p,i){const r=zn(s),a=Ks(p);if(a<0||a>r.length)throw new TypeError("Index out of bounds");return[...r.slice(0,a),i,...r.slice(a)]}function Hxe(s,p,i){const r=Go(s),a=Ks(p);if(a<0||a>=r.length)throw new TypeError("Index out of bounds");const c=[...r];return c[a]=i,c}function Wxe(s,p,i){const r=Go(s),a=r.indexOf(p);if(a===-1)return r;const c=[...r];return c[a]=i,c}function zxe(s,p,i){const r=Go(s),a=r.lastIndexOf(p);if(a===-1)return r;const c=[...r];return c[a]=i,c}function Yxe(s,p,i){return Go(s).map(a=>a===p?i:a)}function Jxe(s,p){const i=Go(s),r=Ks(p);if(r<0||r>=i.length)throw new TypeError("Index out of bounds");return i[r]}function Qxe(s){return Go(s)[0]}function Xxe(s){const p=Go(s);return p[p.length-1]}function e$e(s,p,...i){return[...zn(s),p,...i]}function t$e(s,p){const i=zn(s);return[p,...i]}function i$e(s){return zn(s).length}function r$e(s,p){const i=zn(s),r=Ks(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 n$e(s,p){const i=zn(s),r=Math.max(0,Ks(p)??0);return i.slice(0,r)}function a$e(s,p){const i=zn(s),r=Math.max(0,Ks(p)??0);return r===0?[]:i.slice(-r)}function s$e(s,p,i){const r=zn(s),a=p==null?void 0:Ks(p),c=i==null?void 0:Ks(i);return r.slice(a,c)}function l$e(s,p){return zn(s).indexOf(p)}function o$e(s,p){return zn(s).lastIndexOf(p)}function d$e(s){const p=zn(s),i=[],r=new Set;for(const a of p)r.has(a)||(r.add(a),i.push(a));return i}function u$e(s){return zn(s).reduce((i,r)=>i.concat(r),[])}function p$e(s){const p=zn(s);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=>qIi.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 c$e(s){const i=[...zn(s)];for(let r=i.length-1;r>0;r--){const a=Math.floor(E1()*(r+1));[i[r],i[a]]=[i[a],i[r]]}return i}function f$e(s,p){const i=zn(s),r=Math.max(1,Ks(p)||1),a=[];for(let c=0;c<i.length;c+=r)a.push(i.slice(c,c+r));return a}function y$e(s,p,i){const r=zn(s),a=Math.max(0,Ks(p)||0);if(r.length>=a)return[...r];const c=a-r.length;return Array(c).fill(i).concat(r)}function h$e(s,p,i){const r=zn(s),a=Math.max(0,Ks(p)||0);if(r.length>=a)return[...r];const c=a-r.length,e=Array(c).fill(i);return r.concat(e)}function m$e(s,p){const i=zn(s),r=Math.max(0,Ks(p)||0),a=[];for(let c=0;c<r;c++)a.push(...i);return a}function T$e(s,p){if(!d$(p))throw new TypeError("Contains expects the needle to be a primitive (string | number | boolean | null).");return u$(s).some(r=>r===p)}function v$e(s,p){const i=u$(s),r=Array.isArray(p)?p:[p];if(r.length===0)return!1;if(!r.every(d$))throw new TypeError("ContainsAll expects all needles to be primitives (string | number | boolean | null).");return r.every(a=>i.includes(a))}function E$e(s,p){const i=u$(s),r=Array.isArray(p)?p:[p];if(r.length===0)return!1;if(!r.every(d$))throw new TypeError("ContainsAny expects all needles to be primitives (string | number | boolean | null).");return r.some(a=>i.includes(a))}class b$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_JOIN,version:"1.0.0",description:"List join operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(me.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=jxe(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 A$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SPLIT,version:"1.0.0",description:"List split operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(me.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]=Fxe(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 g$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REVERSE,version:"1.0.0",description:"List reverse operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(me.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=Kxe(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 Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_LAST_N_ITEMS,version:"1.0.0",description:"List delete last operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(me.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=qxe(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 Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_FIRST_N_ITEMS,version:"1.0.0",description:"List delete first operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(me.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=Sxe(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 D$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_ADD_AT_INDEX,version:"1.0.0",description:"List add index operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(me.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=Zxe(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 w$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_AT_INDEX,version:"1.0.0",description:"List replace index operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(me.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=Hxe(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 C$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_FIRST_N_ITEMS,version:"1.0.0",description:"List replace first operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(me.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=Wxe(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 O$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_LAST_N_ITEMS,version:"1.0.0",description:"List replace last operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(me.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=zxe(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 _$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_ALL,version:"1.0.0",description:"List replace all operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(me.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=Yxe(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 V$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_INDEX_ITEM,version:"1.0.0",description:"List get index item operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(me.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=Jxe(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 P$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_FIRST,version:"1.0.0",description:"List get first operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(me.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=Qxe(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 Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST,version:"1.0.0",description:"List get last operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(me.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=Xxe(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 x$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_APPEND,version:"1.0.0",description:"List append operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(me.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=e$e(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 $$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PREPEND,version:"1.0.0",description:"List prepend operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(me.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=t$e(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 L$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LENGTH,version:"1.0.0",description:"List get length",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(me.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:i$e(a)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class B$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_AT_INDEX,version:"1.0.0",description:"List delete one item at index (non-mutating)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(me.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=r$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 M$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_FIRST_N_ITEMS,version:"1.0.0",description:"List get first N items",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(me.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=n$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 G$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST_N_ITEMS,version:"1.0.0",description:"List get last N items",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(me.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=a$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 k$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SLICE,version:"1.0.0",description:"List slice(start, end)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(me.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=s$e(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 j$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONCAT,version:"1.0.0",description:"List concat(base, ...others)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(me.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=Uxe(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 U$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_INDEX_OF,version:"1.0.0",description:"List listGetIndexOf(value)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(me.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=l$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 F$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST_INDEX_OF,version:"1.0.0",description:"List listGetLastIndexOf(value)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(me.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=o$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 K$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_UNIQUE,version:"1.0.0",description:"List unique (stable, by reference/===)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(me.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=d$e(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 q$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_FLATTEN,version:"1.0.0",description:"List flatten one level",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(me.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=u$e(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 S$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.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:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(me.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=p$e(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 Z$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SHUFFLE,version:"1.0.0",description:"List shuffle (Fisher–Yates, secure RNG helper)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(me.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=c$e(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 H$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CHUNK,version:"1.0.0",description:"List chunk(size) -> list of lists",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(me.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=f$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 W$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PAD_START,version:"1.0.0",description:"List padStart(targetLength, padValue)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(me.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=y$e(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 z$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PAD_END,version:"1.0.0",description:"List padEnd(targetLength, padValue)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(me.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=h$e(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 Y$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPEAT,version:"1.0.0",description:"List repeat(count)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(me.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=m$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 J$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONTAINS,version:"1.0.0",description:"List contains (primitive needles)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(me.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=T$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 Q$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONTAINS_ALL,version:"1.0.0",description:"List contains all (primitive needles)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(me.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=v$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 X$e extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONTAINS_ANY,version:"1.0.0",description:"List contains any (primitive needles)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(me.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=E$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 SIi extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LENGTH,version:"1.0.0",description:"Returns the number of characters in a string",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(W.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 eLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_JOIN,version:"1.0.0",description:"String join operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(W.Join);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{var a,c,e;try{const f=r.find(M=>{var G,k;return((k=(G=M.valueOwner)==null?void 0:G.declaration)==null?void 0:k.id)===re.operation[W.Join].inputs.separator.id}),h=((a=f==null?void 0:f.value)==null?void 0:a.value)||"",m=r.find(M=>{var G,k;return((k=(G=M.valueOwner)==null?void 0:G.declaration)==null?void 0:k.id)===re.operation[W.Join].inputs.first.id}),E=((c=m==null?void 0:m.value)==null?void 0:c.value)||"",b=r.find(M=>{var G,k;return((k=(G=M.valueOwner)==null?void 0:G.declaration)==null?void 0:k.id)===re.operation[W.Join].inputs.second.id}),A=((e=b==null?void 0:b.value)==null?void 0:e.value)||"",P=r.filter(M=>{var G,k;return((k=(G=M.valueOwner)==null?void 0:G.declaration)==null?void 0:k.id)===re.operation[W.Join].inputs.dynamicString.id}).map(M=>{var G,k;return((G=M.value)==null?void 0:G.valueAsType)||((k=M.value)==null?void 0:k.value)||""}),V=[E,A,...P].join(h);return{value:U.Success,error:null,result:V}}catch(f){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:f,result:null}}}})}}class tLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT_AT_INDEX,version:"1.0.0",description:"String split at index operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(W.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 iLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.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:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(W.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 rLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.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:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(W.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 nLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.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:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(W.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 aLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_LAST_N_CHARS,version:"1.0.0",description:"String delete last number of characters operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(W.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 sLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_FIRST_N_CHARS,version:"1.0.0",description:"String delete first number of characters operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(W.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 lLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REVERSE,version:"1.0.0",description:"String reverse operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(W.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 oLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TO_LOWER_CASE,version:"1.0.0",description:"String to lower case operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(W.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 dLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TO_UPPER_CASE,version:"1.0.0",description:"String to upper case operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(W.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 uLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_AT_INDEX,version:"1.0.0",description:"String delete index operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(W.DeleteAtIndex);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(E=>{var b,A;return((b=E.value)==null?void 0:b.valueAsType)||((A=E.value)==null?void 0:A.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 pLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ADD_AT_INDEX,version:"1.0.0",description:"String add index operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(W.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 cLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_FIRST_N_CHARS,version:"1.0.0",description:"String replace first operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(W.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 fLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_LAST_N_CHARS,version:"1.0.0",description:"String replace last operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(W.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 yLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_AT_INDEX,version:"1.0.0",description:"String replace index operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(W.ReplaceAtIndex);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(E=>{var b,A;return((b=E.value)==null?void 0:b.valueAsType)||((A=E.value)==null?void 0:A.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 hLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_FIRST_MATCH,version:"1.0.0",description:"String replace single match operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(W.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 mLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_LAST_MATCH,version:"1.0.0",description:"String replace single match operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(W.ReplaceLastMatch);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(E=>{var b,A;return((b=E.value)==null?void 0:b.valueAsType)||((A=E.value)==null?void 0:A.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 TLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_ALL_MATCHES,version:"1.0.0",description:"String replace all matches operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(W.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 vLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_INDEX_ITEM,version:"1.0.0",description:"String get index operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(W.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 ELe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LAST_N_CHARS,version:"1.0.0",description:"String get last N chars operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(W.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 bLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_FIRST_N_CHARS,version:"1.0.0",description:"String get first N chars operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(W.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 ALe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_INDEX_OF,version:"1.0.0",description:"String get index of operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(W.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 gLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_APPEND,version:"1.0.0",description:"String append operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(W.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 ILe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PREPEND,version:"1.0.0",description:"String prepend operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(W.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 RLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TRIM,version:"1.0.0",description:"String trim implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(W.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 DLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TRIM_START,version:"1.0.0",description:"String trimStart implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(W.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 wLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TRIM_END,version:"1.0.0",description:"String trimEnd implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(W.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 CLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SUBSTRING,version:"1.0.0",description:"String substring(start, end?) implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(W.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 OLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SLICE,version:"1.0.0",description:"String slice(start, end?) implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(W.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 _Le extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LAST_INDEX_OF,version:"1.0.0",description:"String lastIndexOf(search, fromIndex?) implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(W.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 VLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PAD_START,version:"1.0.0",description:"String padStart(targetLength, padString?) implementation",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(W.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 PLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PAD_END,version:"1.0.0",description:"String padEnd(targetLength, padString?) implementation",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(W.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 NLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPEAT,version:"1.0.0",description:"String repeat(count) implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(W.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 xLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_MATCH_REGEX,version:"1.0.0",description:"String match(regex) -> first match array or null",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(W.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 $Le extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_MATCH_ALL_REGEX,version:"1.0.0",description:"String matchAll(regex) -> array of matches",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(W.MatchAllRegex);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=r.map(b=>{var A,_;return((A=b.value)==null?void 0:A.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 LLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SEARCH_REGEX,version:"1.0.0",description:"String search(regex) -> index or -1",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(W.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 BLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_REGEX,version:"1.0.0",description:"String replace using RegExp (pattern, replacement, flags?)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(W.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,A;return((b=E.value)==null?void 0:b.valueAsType)??((A=E.value)==null?void 0:A.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 MLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_NORMALIZE_UNICODE,version:"1.0.0",description:"String normalize(form?) implementation module (NFC by default)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(W.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 uI=class uI extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REMOVE_DIACRITICS,version:"1.0.0",description:"Remove diacritics via NFD decomposition + strip combining marks",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(W.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(uI.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(uI,"COMBINING_MARKS",/[\u0300-\u036f]/g);let kg=uI;class GLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_COUNT_OCCURRENCES,version:"1.0.0",description:"Count literal substring occurrences in a string",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(W.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 kLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ENSURE_PREFIX,version:"1.0.0",description:"Ensure string starts with given prefix (add if missing)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(W.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 jLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ENSURE_SUFFIX,version:"1.0.0",description:"Ensure string ends with given suffix (add if missing)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(W.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 ULe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REMOVE_PREFIX,version:"1.0.0",description:"Remove prefix if present",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(W.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 FLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REMOVE_SUFFIX,version:"1.0.0",description:"Remove suffix if present",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(W.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 KLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_STARTS_WITH,version:"1.0.0",description:"String startsWith(needle) -> boolean",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(W.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 qLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ENDS_WITH,version:"1.0.0",description:"String endsWith(needle) -> boolean",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(W.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 SLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_CONTAINS,version:"1.0.0",description:"String includes(needle) -> boolean",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(W.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 ZLe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_MATCHES_REGEX,version:"1.0.0",description:"Regex test: new RegExp(pattern, flags?).test(src) -> boolean",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(W.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 HLe(s,p){const i=Number(s),a=10**Math.max(0,Number(p)||0);return Math.round(i*a)/a}function WLe(s,p){const i=Number(s),r=Math.abs(Number(p)||0);return r===0?i:Math.round(i/r)*r}function zLe(s,p,i){const r=Number(s),a=Number(p),c=Number(i);return Math.min(Math.max(r,a),c)}function YLe(s,p,i,r,a){const c=Number(s),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 JLe(...s){const p=s.map(r=>Number(r));return p.length===0?0:p.reduce((r,a)=>r+a,0)/p.length}function QLe(...s){const p=s.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 XLe(s,p){const i=Number(s),r=Number(p);return r===0?NaN:i<0&&r%2===1?-Math.pow(-i,1/r):Math.pow(i,1/r)}function eBe(s,p){const i=Number(s),r=Number(p);return i===0?1/0:(r-i)/i*100}const Bi=s=>s.map(p=>{var i,r;return((i=p.value)==null?void 0:i.valueAsType)??((r=p.value)==null?void 0:r.value)});class tBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ADDITION,version:"1.0.0",description:"Number addition operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(ue.Addition);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=Bi(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 iBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SUBTRACTION,version:"1.0.0",description:"Number subtraction operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(ue.Subtraction);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=Bi(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 rBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MULTIPLICATION,version:"1.0.0",description:"Number multiplication operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(ue.Multiplication);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=Bi(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 nBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_DIVISION,version:"1.0.0",description:"Number division operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(ue.Division);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c]=Bi(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 aBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_REMAINDER,version:"1.0.0",description:"Number remainder operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(ue.Remainder);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c]=Bi(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 sBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_EXPONENTIATION,version:"1.0.0",description:"Number exponentiation operation implementation module",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(ue.Exponentiation);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c]=Bi(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 lBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_NEGATE,version:"1.0.0",description:"Number negate (unary -x)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.Negate);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Bi(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 oBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ABSOLUTE,version:"1.0.0",description:"Number absolute (|x|)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.Absolute);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Bi(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 dBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SIGN,version:"1.0.0",description:"Number sign (-1 | 0 | 1)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.Sign);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Bi(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 uBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ROUND,version:"1.0.0",description:"Number round to nearest integer",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.Round);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Bi(r);return{value:U.Success,error:null,result:Math.round(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class pBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_FLOOR,version:"1.0.0",description:"Number floor (⌊x⌋)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.Floor);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Bi(r);return{value:U.Success,error:null,result:Math.floor(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class cBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_CEIL,version:"1.0.0",description:"Number ceil (⌈x⌉)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.Ceil);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Bi(r);return{value:U.Success,error:null,result:Math.ceil(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class fBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TRUNC,version:"1.0.0",description:"Number truncation (drop fractional part)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.Trunc);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Bi(r);return{value:U.Success,error:null,result:Math.trunc(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class yBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ROUND_TO_DECIMALS,version:"1.0.0",description:"Round to N decimals",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.RoundToDecimals);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=Bi(r),e=HLe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class hBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.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:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.SnapToStep);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=Bi(r),e=WLe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class mBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_CLAMP,version:"1.0.0",description:"Clamp value to [min, max]",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.Clamp);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=Bi(r),f=zLe(a,c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class TBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MAP_RANGE,version:"1.0.0",description:"Map value from [inMin,inMax] to [outMin,outMax]",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.MapRange);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e,f,h]=Bi(r),m=YLe(a,c,e,f,h);return{value:U.Success,error:null,result:m}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class vBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_AVERAGE,version:"1.0.0",description:"Average(numbers...)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.Average);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const a=Bi(r),c=JLe(...a);return{value:U.Success,error:null,result:c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class EBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MEDIAN,version:"1.0.0",description:"Median(numbers...)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.Median);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const a=Bi(r),c=QLe(...a);return{value:U.Success,error:null,result:c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class bBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MIN_OF,version:"1.0.0",description:"Min(numbers...)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.MinOf);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const a=Bi(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 ABe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MAX_OF,version:"1.0.0",description:"Max(numbers...)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.MaxOf);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const a=Bi(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 gBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SQUARE_ROOT,version:"1.0.0",description:"Square root",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.SquareRoot);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Bi(r);return{value:U.Success,error:null,result:Math.sqrt(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class IBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_CUBE_ROOT,version:"1.0.0",description:"Cube root",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.CubeRoot);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Bi(r);return{value:U.Success,error:null,result:Math.cbrt(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class RBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_NTH_ROOT,version:"1.0.0",description:"Nth root (value, n)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.NthRoot);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=Bi(r),e=XLe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class DBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_EXP,version:"1.0.0",description:"e^x",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.Exp);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Bi(r);return{value:U.Success,error:null,result:Math.exp(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class wBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LOG_NATURAL,version:"1.0.0",description:"Natural log ln(x)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.LogNatural);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Bi(r);return{value:U.Success,error:null,result:Math.log(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class CBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LOG10,version:"1.0.0",description:"Log base 10",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.Log10);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Bi(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 OBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SIN,version:"1.0.0",description:"sin(x in radians)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.Sin);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Bi(r);return{value:U.Success,error:null,result:Math.sin(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class _Be extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_COS,version:"1.0.0",description:"cos(x in radians)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.Cos);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Bi(r);return{value:U.Success,error:null,result:Math.cos(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class VBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TAN,version:"1.0.0",description:"tan(x in radians)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.Tan);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Bi(r);return{value:U.Success,error:null,result:Math.tan(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class PBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ASIN,version:"1.0.0",description:"asin(x)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.Asin);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Bi(r);return{value:U.Success,error:null,result:Math.asin(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class NBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ACOS,version:"1.0.0",description:"acos(x)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.Acos);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Bi(r);return{value:U.Success,error:null,result:Math.acos(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class xBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ATAN,version:"1.0.0",description:"atan(x)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.Atan);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Bi(r);return{value:U.Success,error:null,result:Math.atan(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class $Be extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ATAN2,version:"1.0.0",description:"atan2(y, x)",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.Atan2);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=Bi(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 LBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TO_RADIANS,version:"1.0.0",description:"deg → rad",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.ToRadians);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Bi(r);return{value:U.Success,error:null,result:Number(a)*Math.PI/180}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class BBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TO_DEGREES,version:"1.0.0",description:"rad → deg",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.ToDegrees);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Bi(r);return{value:U.Success,error:null,result:Number(a)*180/Math.PI}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class MBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_PERCENT_OF,version:"1.0.0",description:"x percent of y",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.PercentOf);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=Bi(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 S_ extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_PERCENTAGE_CHANGE,version:"1.0.0",description:"((new-old)/old)*100",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.PercentageChange);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=Bi(r),e=eBe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class GBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LESS_THAN,version:"1.0.0",description:"a < b",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.LessThan);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=Bi(r);return{value:U.Success,error:null,result:a<c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class kBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MORE_THAN,version:"1.0.0",description:"a > b",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.MoreThan);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=Bi(r);return{value:U.Success,error:null,result:a>c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class jBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LESS_THAN_OR_EQUAL,version:"1.0.0",description:"a <= b",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.LessThanOrEqual);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=Bi(r);return{value:U.Success,error:null,result:a<=c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class UBe extends Ne{constructor(){super(...arguments);R(this,"manifest",{id:Pe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MORE_THAN_OR_EQUAL,version:"1.0.0",description:"a >= b",initPriority:_e.High,permissions:[Ve.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ue.MoreThanOrEqual);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=Bi(r);return{value:U.Success,error:null,result:a>=c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}function FBe(s,p){return function(){return s.apply(p,arguments)}}const{toString:ZIi}=Object.prototype,{getPrototypeOf:p$}=Object,{iterator:w1,toStringTag:KBe}=Symbol,C1=(s=>p=>{const i=ZIi.call(p);return s[i]||(s[i]=i.slice(8,-1).toLowerCase())})(Object.create(null)),ko=s=>(s=s.toLowerCase(),p=>C1(p)===s),O1=s=>p=>typeof p===s,{isArray:Um}=Array,_h=O1("undefined");function CE(s){return s!==null&&!_h(s)&&s.constructor!==null&&!_h(s.constructor)&&ms(s.constructor.isBuffer)&&s.constructor.isBuffer(s)}const qBe=ko("ArrayBuffer");function HIi(s){let p;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?p=ArrayBuffer.isView(s):p=s&&s.buffer&&qBe(s.buffer),p}const WIi=O1("string"),ms=O1("function"),SBe=O1("number"),OE=s=>s!==null&&typeof s=="object",zIi=s=>s===!0||s===!1,mg=s=>{if(C1(s)!=="object")return!1;const p=p$(s);return(p===null||p===Object.prototype||Object.getPrototypeOf(p)===null)&&!(KBe in s)&&!(w1 in s)},YIi=s=>{if(!OE(s)||CE(s))return!1;try{return Object.keys(s).length===0&&Object.getPrototypeOf(s)===Object.prototype}catch{return!1}},JIi=ko("Date"),QIi=ko("File"),XIi=s=>!!(s&&typeof s.uri<"u"),eRi=s=>s&&typeof s.getParts<"u",tRi=ko("Blob"),iRi=ko("FileList"),rRi=s=>OE(s)&&ms(s.pipe);function nRi(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const Xj=nRi(),eU=typeof Xj.FormData<"u"?Xj.FormData:void 0,aRi=s=>{let p;return s&&(eU&&s instanceof eU||ms(s.append)&&((p=C1(s))==="formdata"||p==="object"&&ms(s.toString)&&s.toString()==="[object FormData]"))},sRi=ko("URLSearchParams"),[lRi,oRi,dRi,uRi]=["ReadableStream","Request","Response","Headers"].map(ko),pRi=s=>s.trim?s.trim():s.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function _E(s,p,{allOwnKeys:i=!1}={}){if(s===null||typeof s>"u")return;let r,a;if(typeof s!="object"&&(s=[s]),Um(s))for(r=0,a=s.length;r<a;r++)p.call(null,s[r],r,s);else{if(CE(s))return;const c=i?Object.getOwnPropertyNames(s):Object.keys(s),e=c.length;let f;for(r=0;r<e;r++)f=c[r],p.call(null,s[f],f,s)}}function ZBe(s,p){if(CE(s))return null;p=p.toLowerCase();const i=Object.keys(s);let r=i.length,a;for(;r-- >0;)if(a=i[r],p===a.toLowerCase())return a;return null}const bf=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),HBe=s=>!_h(s)&&s!==bf;function Z_(){const{caseless:s,skipUndefined:p}=HBe(this)&&this||{},i={},r=(a,c)=>{if(c==="__proto__"||c==="constructor"||c==="prototype")return;const e=s&&ZBe(i,c)||c;mg(i[e])&&mg(a)?i[e]=Z_(i[e],a):mg(a)?i[e]=Z_({},a):Um(a)?i[e]=a.slice():(!p||!_h(a))&&(i[e]=a)};for(let a=0,c=arguments.length;a<c;a++)arguments[a]&&_E(arguments[a],r);return i}const cRi=(s,p,i,{allOwnKeys:r}={})=>(_E(p,(a,c)=>{i&&ms(a)?Object.defineProperty(s,c,{value:FBe(a,i),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(s,c,{value:a,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),s),fRi=s=>(s.charCodeAt(0)===65279&&(s=s.slice(1)),s),yRi=(s,p,i,r)=>{s.prototype=Object.create(p.prototype,r),Object.defineProperty(s.prototype,"constructor",{value:s,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(s,"super",{value:p.prototype}),i&&Object.assign(s.prototype,i)},hRi=(s,p,i,r)=>{let a,c,e;const f={};if(p=p||{},s==null)return p;do{for(a=Object.getOwnPropertyNames(s),c=a.length;c-- >0;)e=a[c],(!r||r(e,s,p))&&!f[e]&&(p[e]=s[e],f[e]=!0);s=i!==!1&&p$(s)}while(s&&(!i||i(s,p))&&s!==Object.prototype);return p},mRi=(s,p,i)=>{s=String(s),(i===void 0||i>s.length)&&(i=s.length),i-=p.length;const r=s.indexOf(p,i);return r!==-1&&r===i},TRi=s=>{if(!s)return null;if(Um(s))return s;let p=s.length;if(!SBe(p))return null;const i=new Array(p);for(;p-- >0;)i[p]=s[p];return i},vRi=(s=>p=>s&&p instanceof s)(typeof Uint8Array<"u"&&p$(Uint8Array)),ERi=(s,p)=>{const r=(s&&s[w1]).call(s);let a;for(;(a=r.next())&&!a.done;){const c=a.value;p.call(s,c[0],c[1])}},bRi=(s,p)=>{let i;const r=[];for(;(i=s.exec(p))!==null;)r.push(i);return r},ARi=ko("HTMLFormElement"),gRi=s=>s.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(i,r,a){return r.toUpperCase()+a}),tU=(({hasOwnProperty:s})=>(p,i)=>s.call(p,i))(Object.prototype),IRi=ko("RegExp"),WBe=(s,p)=>{const i=Object.getOwnPropertyDescriptors(s),r={};_E(i,(a,c)=>{let e;(e=p(a,c,s))!==!1&&(r[c]=e||a)}),Object.defineProperties(s,r)},RRi=s=>{WBe(s,(p,i)=>{if(ms(s)&&["arguments","caller","callee"].indexOf(i)!==-1)return!1;const r=s[i];if(ms(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+"'")})}})},DRi=(s,p)=>{const i={},r=a=>{a.forEach(c=>{i[c]=!0})};return Um(s)?r(s):r(String(s).split(p)),i},wRi=()=>{},CRi=(s,p)=>s!=null&&Number.isFinite(s=+s)?s:p;function ORi(s){return!!(s&&ms(s.append)&&s[KBe]==="FormData"&&s[w1])}const _Ri=s=>{const p=new Array(10),i=(r,a)=>{if(OE(r)){if(p.indexOf(r)>=0)return;if(CE(r))return r;if(!("toJSON"in r)){p[a]=r;const c=Um(r)?[]:{};return _E(r,(e,f)=>{const h=i(e,a+1);!_h(h)&&(c[f]=h)}),p[a]=void 0,c}}return r};return i(s,0)},VRi=ko("AsyncFunction"),PRi=s=>s&&(OE(s)||ms(s))&&ms(s.then)&&ms(s.catch),zBe=((s,p)=>s?setImmediate:p?((i,r)=>(bf.addEventListener("message",({source:a,data:c})=>{a===bf&&c===i&&r.length&&r.shift()()},!1),a=>{r.push(a),bf.postMessage(i,"*")}))(`axios@${Math.random()}`,[]):i=>setTimeout(i))(typeof setImmediate=="function",ms(bf.postMessage)),NRi=typeof queueMicrotask<"u"?queueMicrotask.bind(bf):typeof process<"u"&&process.nextTick||zBe,xRi=s=>s!=null&&ms(s[w1]),He={isArray:Um,isArrayBuffer:qBe,isBuffer:CE,isFormData:aRi,isArrayBufferView:HIi,isString:WIi,isNumber:SBe,isBoolean:zIi,isObject:OE,isPlainObject:mg,isEmptyObject:YIi,isReadableStream:lRi,isRequest:oRi,isResponse:dRi,isHeaders:uRi,isUndefined:_h,isDate:JIi,isFile:QIi,isReactNativeBlob:XIi,isReactNative:eRi,isBlob:tRi,isRegExp:IRi,isFunction:ms,isStream:rRi,isURLSearchParams:sRi,isTypedArray:vRi,isFileList:iRi,forEach:_E,merge:Z_,extend:cRi,trim:pRi,stripBOM:fRi,inherits:yRi,toFlatObject:hRi,kindOf:C1,kindOfTest:ko,endsWith:mRi,toArray:TRi,forEachEntry:ERi,matchAll:bRi,isHTMLForm:ARi,hasOwnProperty:tU,hasOwnProp:tU,reduceDescriptors:WBe,freezeMethods:RRi,toObjectSet:DRi,toCamelCase:gRi,noop:wRi,toFiniteNumber:CRi,findKey:ZBe,global:bf,isContextDefined:HBe,isSpecCompliantForm:ORi,toJSONObject:_Ri,isAsyncFn:VRi,isThenable:PRi,setImmediate:zBe,asap:NRi,isIterable:xRi};class Qa extends Error{static from(p,i,r,a,c,e){const f=new Qa(p.message,i||p.code,r,a,c);return f.cause=p,f.name=p.name,p.status!=null&&f.status==null&&(f.status=p.status),e&&Object.assign(f,e),f}constructor(p,i,r,a,c){super(p),Object.defineProperty(this,"message",{value:p,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,i&&(this.code=i),r&&(this.config=r),a&&(this.request=a),c&&(this.response=c,this.status=c.status)}toJSON(){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:He.toJSONObject(this.config),code:this.code,status:this.status}}}Qa.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";Qa.ERR_BAD_OPTION="ERR_BAD_OPTION";Qa.ECONNABORTED="ECONNABORTED";Qa.ETIMEDOUT="ETIMEDOUT";Qa.ERR_NETWORK="ERR_NETWORK";Qa.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";Qa.ERR_DEPRECATED="ERR_DEPRECATED";Qa.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";Qa.ERR_BAD_REQUEST="ERR_BAD_REQUEST";Qa.ERR_CANCELED="ERR_CANCELED";Qa.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";Qa.ERR_INVALID_URL="ERR_INVALID_URL";const ar=Qa,$Ri=null;function H_(s){return He.isPlainObject(s)||He.isArray(s)}function YBe(s){return He.endsWith(s,"[]")?s.slice(0,-2):s}function a_(s,p,i){return s?s.concat(p).map(function(a,c){return a=YBe(a),!i&&c?"["+a+"]":a}).join(i?".":""):p}function LRi(s){return He.isArray(s)&&!s.some(H_)}const BRi=He.toFlatObject(He,{},null,function(p){return/^is[A-Z]/.test(p)});function _1(s,p,i){if(!He.isObject(s))throw new TypeError("target must be an object");p=p||new FormData,i=He.toFlatObject(i,{metaTokens:!0,dots:!1,indexes:!1},!1,function(V,M){return!He.isUndefined(M[V])});const r=i.metaTokens,a=i.visitor||E,c=i.dots,e=i.indexes,h=(i.Blob||typeof Blob<"u"&&Blob)&&He.isSpecCompliantForm(p);if(!He.isFunction(a))throw new TypeError("visitor must be a function");function m(P){if(P===null)return"";if(He.isDate(P))return P.toISOString();if(He.isBoolean(P))return P.toString();if(!h&&He.isBlob(P))throw new ar("Blob is not supported. Use a Buffer instead.");return He.isArrayBuffer(P)||He.isTypedArray(P)?h&&typeof Blob=="function"?new Blob([P]):Buffer.from(P):P}function E(P,V,M){let G=P;if(He.isReactNative(p)&&He.isReactNativeBlob(P))return p.append(a_(M,V,c),m(P)),!1;if(P&&!M&&typeof P=="object"){if(He.endsWith(V,"{}"))V=r?V:V.slice(0,-2),P=JSON.stringify(P);else if(He.isArray(P)&&LRi(P)||(He.isFileList(P)||He.endsWith(V,"[]"))&&(G=He.toArray(P)))return V=YBe(V),G.forEach(function(K,le){!(He.isUndefined(K)||K===null)&&p.append(e===!0?a_([V],le,c):e===null?V:V+"[]",m(K))}),!1}return H_(P)?!0:(p.append(a_(M,V,c),m(P)),!1)}const b=[],A=Object.assign(BRi,{defaultVisitor:E,convertValue:m,isVisitable:H_});function _(P,V){if(!He.isUndefined(P)){if(b.indexOf(P)!==-1)throw Error("Circular reference detected in "+V.join("."));b.push(P),He.forEach(P,function(G,k){(!(He.isUndefined(G)||G===null)&&a.call(p,G,He.isString(k)?k.trim():k,V,A))===!0&&_(G,V?V.concat(k):[k])}),b.pop()}}if(!He.isObject(s))throw new TypeError("data must be an object");return _(s),p}function iU(s){const p={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(s).replace(/[!'()~]|%20|%00/g,function(r){return p[r]})}function c$(s,p){this._pairs=[],s&&_1(s,this,p)}const JBe=c$.prototype;JBe.append=function(p,i){this._pairs.push([p,i])};JBe.toString=function(p){const i=p?function(r){return p.call(this,r,iU)}:iU;return this._pairs.map(function(a){return i(a[0])+"="+i(a[1])},"").join("&")};function MRi(s){return encodeURIComponent(s).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function QBe(s,p,i){if(!p)return s;const r=i&&i.encode||MRi,a=He.isFunction(i)?{serialize:i}:i,c=a&&a.serialize;let e;if(c?e=c(p,a):e=He.isURLSearchParams(p)?p.toString():new c$(p,a).toString(r),e){const f=s.indexOf("#");f!==-1&&(s=s.slice(0,f)),s+=(s.indexOf("?")===-1?"?":"&")+e}return s}class GRi{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){He.forEach(this.handlers,function(r){r!==null&&p(r)})}}const rU=GRi,f$={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},kRi=typeof URLSearchParams<"u"?URLSearchParams:c$,jRi=typeof FormData<"u"?FormData:null,URi=typeof Blob<"u"?Blob:null,FRi={isBrowser:!0,classes:{URLSearchParams:kRi,FormData:jRi,Blob:URi},protocols:["http","https","file","blob","url","data"]},y$=typeof window<"u"&&typeof document<"u",W_=typeof navigator=="object"&&navigator||void 0,KRi=y$&&(!W_||["ReactNative","NativeScript","NS"].indexOf(W_.product)<0),qRi=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),SRi=y$&&window.location.href||"http://localhost",ZRi=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:y$,hasStandardBrowserEnv:KRi,hasStandardBrowserWebWorkerEnv:qRi,navigator:W_,origin:SRi},Symbol.toStringTag,{value:"Module"})),Da={...ZRi,...FRi};function HRi(s,p){return _1(s,new Da.classes.URLSearchParams,{visitor:function(i,r,a,c){return Da.isNode&&He.isBuffer(i)?(this.append(r,i.toString("base64")),!1):c.defaultVisitor.apply(this,arguments)},...p})}function WRi(s){return He.matchAll(/\w+|\[(\w*)]/g,s).map(p=>p[0]==="[]"?"":p[1]||p[0])}function zRi(s){const p={},i=Object.keys(s);let r;const a=i.length;let c;for(r=0;r<a;r++)c=i[r],p[c]=s[c];return p}function XBe(s){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&&He.isArray(a)?a.length:e,h?(He.hasOwnProp(a,e)?a[e]=[a[e],r]:a[e]=r,!f):((!a[e]||!He.isObject(a[e]))&&(a[e]=[]),p(i,r,a[e],c)&&He.isArray(a[e])&&(a[e]=zRi(a[e])),!f)}if(He.isFormData(s)&&He.isFunction(s.entries)){const i={};return He.forEachEntry(s,(r,a)=>{p(WRi(r),a,i,0)}),i}return null}function YRi(s,p,i){if(He.isString(s))try{return(p||JSON.parse)(s),He.trim(s)}catch(r){if(r.name!=="SyntaxError")throw r}return(i||JSON.stringify)(s)}const h$={transitional:f$,adapter:["xhr","http","fetch"],transformRequest:[function(p,i){const r=i.getContentType()||"",a=r.indexOf("application/json")>-1,c=He.isObject(p);if(c&&He.isHTMLForm(p)&&(p=new FormData(p)),He.isFormData(p))return a?JSON.stringify(XBe(p)):p;if(He.isArrayBuffer(p)||He.isBuffer(p)||He.isStream(p)||He.isFile(p)||He.isBlob(p)||He.isReadableStream(p))return p;if(He.isArrayBufferView(p))return p.buffer;if(He.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 HRi(p,this.formSerializer).toString();if((f=He.isFileList(p))||r.indexOf("multipart/form-data")>-1){const h=this.env&&this.env.FormData;return _1(f?{"files[]":p}:p,h&&new h,this.formSerializer)}}return c||a?(i.setContentType("application/json",!1),YRi(p)):p}],transformResponse:[function(p){const i=this.transitional||h$.transitional,r=i&&i.forcedJSONParsing,a=this.responseType==="json";if(He.isResponse(p)||He.isReadableStream(p))return p;if(p&&He.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"?ar.from(f,ar.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:Da.classes.FormData,Blob:Da.classes.Blob},validateStatus:function(p){return p>=200&&p<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};He.forEach(["delete","get","head","post","put","patch"],s=>{h$.headers[s]={}});const m$=h$,JRi=He.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"]),QRi=s=>{const p={};let i,r,a;return s&&s.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]&&JRi[i])&&(i==="set-cookie"?p[i]?p[i].push(r):p[i]=[r]:p[i]=p[i]?p[i]+", "+r:r)}),p},nU=Symbol("internals");function Z0(s){return s&&String(s).trim().toLowerCase()}function Tg(s){return s===!1||s==null?s:He.isArray(s)?s.map(Tg):String(s)}function XRi(s){const p=Object.create(null),i=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=i.exec(s);)p[r[1]]=r[2];return p}const e1i=s=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(s.trim());function s_(s,p,i,r,a){if(He.isFunction(r))return r.call(this,p,i);if(a&&(p=i),!!He.isString(p)){if(He.isString(r))return p.indexOf(r)!==-1;if(He.isRegExp(r))return r.test(p)}}function t1i(s){return s.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(p,i,r)=>i.toUpperCase()+r)}function i1i(s,p){const i=He.toCamelCase(" "+p);["get","set","has"].forEach(r=>{Object.defineProperty(s,r+i,{value:function(a,c,e){return this[r].call(this,p,a,c,e)},configurable:!0})})}class V1{constructor(p){p&&this.set(p)}set(p,i,r){const a=this;function c(f,h,m){const E=Z0(h);if(!E)throw new Error("header name must be a non-empty string");const b=He.findKey(a,E);(!b||a[b]===void 0||m===!0||m===void 0&&a[b]!==!1)&&(a[b||h]=Tg(f))}const e=(f,h)=>He.forEach(f,(m,E)=>c(m,E,h));if(He.isPlainObject(p)||p instanceof this.constructor)e(p,i);else if(He.isString(p)&&(p=p.trim())&&!e1i(p))e(QRi(p),i);else if(He.isObject(p)&&He.isIterable(p)){let f={},h,m;for(const E of p){if(!He.isArray(E))throw TypeError("Object iterator must return a key-value pair");f[m=E[0]]=(h=f[m])?He.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=Z0(p),p){const r=He.findKey(this,p);if(r){const a=this[r];if(!i)return a;if(i===!0)return XRi(a);if(He.isFunction(i))return i.call(this,a,r);if(He.isRegExp(i))return i.exec(a);throw new TypeError("parser must be boolean|regexp|function")}}}has(p,i){if(p=Z0(p),p){const r=He.findKey(this,p);return!!(r&&this[r]!==void 0&&(!i||s_(this,this[r],r,i)))}return!1}delete(p,i){const r=this;let a=!1;function c(e){if(e=Z0(e),e){const f=He.findKey(r,e);f&&(!i||s_(r,r[f],f,i))&&(delete r[f],a=!0)}}return He.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||s_(this,this[c],c,p,!0))&&(delete this[c],a=!0)}return a}normalize(p){const i=this,r={};return He.forEach(this,(a,c)=>{const e=He.findKey(r,c);if(e){i[e]=Tg(a),delete i[c];return}const f=p?t1i(c):String(c).trim();f!==c&&delete i[c],i[f]=Tg(a),r[f]=!0}),this}concat(...p){return this.constructor.concat(this,...p)}toJSON(p){const i=Object.create(null);return He.forEach(this,(r,a)=>{r!=null&&r!==!1&&(i[a]=p&&He.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[nU]=this[nU]={accessors:{}}).accessors,a=this.prototype;function c(e){const f=Z0(e);r[f]||(i1i(a,e),r[f]=!0)}return He.isArray(p)?p.forEach(c):c(p),this}}V1.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);He.reduceDescriptors(V1.prototype,({value:s},p)=>{let i=p[0].toUpperCase()+p.slice(1);return{get:()=>s,set(r){this[i]=r}}});He.freezeMethods(V1);const so=V1;function l_(s,p){const i=this||m$,r=p||i,a=so.from(r.headers);let c=r.data;return He.forEach(s,function(f){c=f.call(i,c,a.normalize(),p?p.status:void 0)}),a.normalize(),c}function e2e(s){return!!(s&&s.__CANCEL__)}class r1i extends ar{constructor(p,i,r){super(p??"canceled",ar.ERR_CANCELED,i,r),this.name="CanceledError",this.__CANCEL__=!0}}const VE=r1i;function t2e(s,p,i){const r=i.config.validateStatus;!i.status||!r||r(i.status)?s(i):p(new ar("Request failed with status code "+i.status,[ar.ERR_BAD_REQUEST,ar.ERR_BAD_RESPONSE][Math.floor(i.status/100)-4],i.config,i.request,i))}function n1i(s){const p=/^([-+\w]{1,25})(:?\/\/|:)/.exec(s);return p&&p[1]||""}function a1i(s,p){s=s||10;const i=new Array(s),r=new Array(s);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,A=0;for(;b!==a;)A+=i[b++],b=b%s;if(a=(a+1)%s,a===c&&(c=(c+1)%s),m-e<p)return;const _=E&&m-E;return _?Math.round(A*1e3/_):void 0}}function s1i(s,p){let i=0,r=1e3/p,a,c;const e=(m,E=Date.now())=>{i=E,a=null,c&&(clearTimeout(c),c=null),s(...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 jg=(s,p,i=3)=>{let r=0;const a=a1i(50,250);return s1i(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};s(b)},i)},aU=(s,p)=>{const i=s!=null;return[r=>p[0]({lengthComputable:i,total:s,loaded:r}),p[1]]},sU=s=>(...p)=>He.asap(()=>s(...p)),l1i=Da.hasStandardBrowserEnv?((s,p)=>i=>(i=new URL(i,Da.origin),s.protocol===i.protocol&&s.host===i.host&&(p||s.port===i.port)))(new URL(Da.origin),Da.navigator&&/(msie|trident)/i.test(Da.navigator.userAgent)):()=>!0,o1i=Da.hasStandardBrowserEnv?{write(s,p,i,r,a,c,e){if(typeof document>"u")return;const f=[`${s}=${encodeURIComponent(p)}`];He.isNumber(i)&&f.push(`expires=${new Date(i).toUTCString()}`),He.isString(r)&&f.push(`path=${r}`),He.isString(a)&&f.push(`domain=${a}`),c===!0&&f.push("secure"),He.isString(e)&&f.push(`SameSite=${e}`),document.cookie=f.join("; ")},read(s){if(typeof document>"u")return null;const p=document.cookie.match(new RegExp("(?:^|; )"+s+"=([^;]*)"));return p?decodeURIComponent(p[1]):null},remove(s){this.write(s,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function d1i(s){return typeof s!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(s)}function u1i(s,p){return p?s.replace(/\/?\/$/,"")+"/"+p.replace(/^\/+/,""):s}function i2e(s,p,i){let r=!d1i(p);return s&&(r||i==!1)?u1i(s,p):p}const lU=s=>s instanceof so?{...s}:s;function Of(s,p){p=p||{};const i={};function r(m,E,b,A){return He.isPlainObject(m)&&He.isPlainObject(E)?He.merge.call({caseless:A},m,E):He.isPlainObject(E)?He.merge({},E):He.isArray(E)?E.slice():E}function a(m,E,b,A){if(He.isUndefined(E)){if(!He.isUndefined(m))return r(void 0,m,b,A)}else return r(m,E,b,A)}function c(m,E){if(!He.isUndefined(E))return r(void 0,E)}function e(m,E){if(He.isUndefined(E)){if(!He.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 s)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(lU(m),lU(E),b,!0)};return He.forEach(Object.keys({...s,...p}),function(E){if(E==="__proto__"||E==="constructor"||E==="prototype")return;const b=He.hasOwnProp(h,E)?h[E]:a,A=b(s[E],p[E],E);He.isUndefined(A)&&b!==f||(i[E]=A)}),i}const r2e=s=>{const p=Of({},s);let{data:i,withXSRFToken:r,xsrfHeaderName:a,xsrfCookieName:c,headers:e,auth:f}=p;if(p.headers=e=so.from(e),p.url=QBe(i2e(p.baseURL,p.url,p.allowAbsoluteUrls),s.params,s.paramsSerializer),f&&e.set("Authorization","Basic "+btoa((f.username||"")+":"+(f.password?unescape(encodeURIComponent(f.password)):""))),He.isFormData(i)){if(Da.hasStandardBrowserEnv||Da.hasStandardBrowserWebWorkerEnv)e.setContentType(void 0);else if(He.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(Da.hasStandardBrowserEnv&&(r&&He.isFunction(r)&&(r=r(p)),r||r!==!1&&l1i(p.url))){const h=a&&c&&o1i.read(c);h&&e.set(a,h)}return p},p1i=typeof XMLHttpRequest<"u",c1i=p1i&&function(s){return new Promise(function(i,r){const a=r2e(s);let c=a.data;const e=so.from(a.headers).normalize();let{responseType:f,onUploadProgress:h,onDownloadProgress:m}=a,E,b,A,_,P;function V(){_&&_(),P&&P(),a.cancelToken&&a.cancelToken.unsubscribe(E),a.signal&&a.signal.removeEventListener("abort",E)}let M=new XMLHttpRequest;M.open(a.method.toUpperCase(),a.url,!0),M.timeout=a.timeout;function G(){if(!M)return;const K=so.from("getAllResponseHeaders"in M&&M.getAllResponseHeaders()),ne={data:!f||f==="text"||f==="json"?M.responseText:M.response,status:M.status,statusText:M.statusText,headers:K,config:s,request:M};t2e(function(Y){i(Y),V()},function(Y){r(Y),V()},ne),M=null}"onloadend"in M?M.onloadend=G:M.onreadystatechange=function(){!M||M.readyState!==4||M.status===0&&!(M.responseURL&&M.responseURL.indexOf("file:")===0)||setTimeout(G)},M.onabort=function(){M&&(r(new ar("Request aborted",ar.ECONNABORTED,s,M)),M=null)},M.onerror=function(le){const ne=le&&le.message?le.message:"Network Error",de=new ar(ne,ar.ERR_NETWORK,s,M);de.event=le||null,r(de),M=null},M.ontimeout=function(){let le=a.timeout?"timeout of "+a.timeout+"ms exceeded":"timeout exceeded";const ne=a.transitional||f$;a.timeoutErrorMessage&&(le=a.timeoutErrorMessage),r(new ar(le,ne.clarifyTimeoutError?ar.ETIMEDOUT:ar.ECONNABORTED,s,M)),M=null},c===void 0&&e.setContentType(null),"setRequestHeader"in M&&He.forEach(e.toJSON(),function(le,ne){M.setRequestHeader(ne,le)}),He.isUndefined(a.withCredentials)||(M.withCredentials=!!a.withCredentials),f&&f!=="json"&&(M.responseType=a.responseType),m&&([A,P]=jg(m,!0),M.addEventListener("progress",A)),h&&M.upload&&([b,_]=jg(h),M.upload.addEventListener("progress",b),M.upload.addEventListener("loadend",_)),(a.cancelToken||a.signal)&&(E=K=>{M&&(r(!K||K.type?new VE(null,s,M):K),M.abort(),M=null)},a.cancelToken&&a.cancelToken.subscribe(E),a.signal&&(a.signal.aborted?E():a.signal.addEventListener("abort",E)));const k=n1i(a.url);if(k&&Da.protocols.indexOf(k)===-1){r(new ar("Unsupported protocol "+k+":",ar.ERR_BAD_REQUEST,s));return}M.send(c||null)})},f1i=(s,p)=>{const{length:i}=s=s?s.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 ar?E:new VE(E instanceof Error?E.message:E))}};let e=p&&setTimeout(()=>{e=null,c(new ar(`timeout of ${p}ms exceeded`,ar.ETIMEDOUT))},p);const f=()=>{s&&(e&&clearTimeout(e),e=null,s.forEach(m=>{m.unsubscribe?m.unsubscribe(c):m.removeEventListener("abort",c)}),s=null)};s.forEach(m=>m.addEventListener("abort",c));const{signal:h}=r;return h.unsubscribe=()=>He.asap(f),h}},y1i=f1i,h1i=function*(s,p){let i=s.byteLength;if(!p||i<p){yield s;return}let r=0,a;for(;r<i;)a=r+p,yield s.slice(r,a),r=a},m1i=async function*(s,p){for await(const i of T1i(s))yield*h1i(i,p)},T1i=async function*(s){if(s[Symbol.asyncIterator]){yield*s;return}const p=s.getReader();try{for(;;){const{done:i,value:r}=await p.read();if(i)break;yield r}}finally{await p.cancel()}},oU=(s,p,i,r)=>{const a=m1i(s,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 A=c+=b;i(A)}h.enqueue(new Uint8Array(E))}catch(m){throw f(m),m}},cancel(h){return f(h),a.return()}},{highWaterMark:2})},dU=64*1024,{isFunction:lg}=He,v1i=(({Request:s,Response:p})=>({Request:s,Response:p}))(He.global),{ReadableStream:uU,TextEncoder:pU}=He.global,cU=(s,...p)=>{try{return!!s(...p)}catch{return!1}},E1i=s=>{s=He.merge.call({skipUndefined:!0},v1i,s);const{fetch:p,Request:i,Response:r}=s,a=p?lg(p):typeof fetch=="function",c=lg(i),e=lg(r);if(!a)return!1;const f=a&&lg(uU),h=a&&(typeof pU=="function"?(P=>V=>P.encode(V))(new pU):async P=>new Uint8Array(await new i(P).arrayBuffer())),m=c&&f&&cU(()=>{let P=!1;const V=new i(Da.origin,{body:new uU,method:"POST",get duplex(){return P=!0,"half"}}).headers.has("Content-Type");return P&&!V}),E=e&&f&&cU(()=>He.isReadableStream(new r("").body)),b={stream:E&&(P=>P.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(P=>{!b[P]&&(b[P]=(V,M)=>{let G=V&&V[P];if(G)return G.call(V);throw new ar(`Response type '${P}' is not supported`,ar.ERR_NOT_SUPPORT,M)})});const A=async P=>{if(P==null)return 0;if(He.isBlob(P))return P.size;if(He.isSpecCompliantForm(P))return(await new i(Da.origin,{method:"POST",body:P}).arrayBuffer()).byteLength;if(He.isArrayBufferView(P)||He.isArrayBuffer(P))return P.byteLength;if(He.isURLSearchParams(P)&&(P=P+""),He.isString(P))return(await h(P)).byteLength},_=async(P,V)=>{const M=He.toFiniteNumber(P.getContentLength());return M??A(V)};return async P=>{let{url:V,method:M,data:G,signal:k,cancelToken:K,timeout:le,onDownloadProgress:ne,onUploadProgress:de,responseType:Y,headers:te,withCredentials:oe="same-origin",fetchOptions:Q}=r2e(P),z=p||fetch;Y=Y?(Y+"").toLowerCase():"text";let se=y1i([k,K&&K.toAbortSignal()],le),ye=null;const ce=se&&se.unsubscribe&&(()=>{se.unsubscribe()});let he;try{if(de&&m&&M!=="get"&&M!=="head"&&(he=await _(te,G))!==0){let Se=new i(V,{method:"POST",body:G,duplex:"half"}),Ke;if(He.isFormData(G)&&(Ke=Se.headers.get("content-type"))&&te.setContentType(Ke),Se.body){const[Xe,mt]=aU(he,jg(sU(de)));G=oU(Se.body,dU,Xe,mt)}}He.isString(oe)||(oe=oe?"include":"omit");const Ae=c&&"credentials"in i.prototype,Re={...Q,signal:se,method:M.toUpperCase(),headers:te.normalize().toJSON(),body:G,duplex:"half",credentials:Ae?oe:void 0};ye=c&&new i(V,Re);let Oe=await(c?z(ye,Q):z(V,Re));const Be=E&&(Y==="stream"||Y==="response");if(E&&(ne||Be&&ce)){const Se={};["status","statusText","headers"].forEach(pt=>{Se[pt]=Oe[pt]});const Ke=He.toFiniteNumber(Oe.headers.get("content-length")),[Xe,mt]=ne&&aU(Ke,jg(sU(ne),!0))||[];Oe=new r(oU(Oe.body,dU,Xe,()=>{mt&&mt(),ce&&ce()}),Se)}Y=Y||"text";let Ge=await b[He.findKey(b,Y)||"text"](Oe,P);return!Be&&ce&&ce(),await new Promise((Se,Ke)=>{t2e(Se,Ke,{data:Ge,headers:so.from(Oe.headers),status:Oe.status,statusText:Oe.statusText,config:P,request:ye})})}catch(Ae){throw ce&&ce(),Ae&&Ae.name==="TypeError"&&/Load failed|fetch/i.test(Ae.message)?Object.assign(new ar("Network Error",ar.ERR_NETWORK,P,ye,Ae&&Ae.response),{cause:Ae.cause||Ae}):ar.from(Ae,Ae&&Ae.code,P,ye,Ae&&Ae.response)}}},b1i=new Map,n2e=s=>{let p=s&&s.env||{};const{fetch:i,Request:r,Response:a}=p,c=[r,a,i];let e=c.length,f=e,h,m,E=b1i;for(;f--;)h=c[f],m=E.get(h),m===void 0&&E.set(h,m=f?new Map:E1i(p)),E=m;return m};n2e();const T$={http:$Ri,xhr:c1i,fetch:{get:n2e}};He.forEach(T$,(s,p)=>{if(s){try{Object.defineProperty(s,"name",{value:p})}catch{}Object.defineProperty(s,"adapterName",{value:p})}});const fU=s=>`- ${s}`,A1i=s=>He.isFunction(s)||s===null||s===!1;function g1i(s,p){s=He.isArray(s)?s:[s];const{length:i}=s;let r,a;const c={};for(let e=0;e<i;e++){r=s[e];let f;if(a=r,!A1i(r)&&(a=T$[(f=String(r)).toLowerCase()],a===void 0))throw new ar(`Unknown adapter '${f}'`);if(a&&(He.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 :
|
|
52
52
|
`+e.map(fU).join(`
|
|
@@ -118,7 +118,7 @@ The parent ${h.type} has a data-type that references an entity with `;le.length?
|
|
|
118
118
|
The entity is ${si(k,{nested:!1}).lines[0].text}.`,ne+=`Technically, an implemented ${V.type} will be generated with all `,e.push(new we({id:`${a.id}--${Ce.NoOverlapWithImplementedSignature}`,code:Ce.NoOverlapWithImplementedSignature,severity:ve.Error,message:`Entity of type '${d.InputMap}' with id '${a.id}' cannot be added to the parent entity of type '${h.type}' with id '${h.id}'. The 'declaration' with '${m.id}' of the 'input-map' does not exist in 'entity' field implemented the parent ${h.type}'s 'data-type'.${ne}`}))}}else if(_t.filter(V=>Mt.includes(V)).includes(h.type)){const M=ML(h),G=M.find(K=>K.id===a.declaration),k=`The parent entity has the following argument declarations that can be referenced by input-maps, ids: '${At(M.map(K=>K.id),"', '","' and '")}'`;G||e.push(new we({id:`${a.id}--${Ce.NoOverlapWithImplementedSignature}`,code:Ce.NoOverlapWithImplementedSignature,severity:ve.Error,message:`Entity of type '${d.InputMap}' with id '${a.id}' cannot be added to the parent entity of type '${h.type}' with id '${h.id}'. The parent entity does not have an 'argument-declaration' with id '${a.declaration}'.
|
|
119
119
|
You can't add an input-map to an entity that doesn't have a matching 'argument-declaration'.
|
|
120
120
|
${k}`}))}}const b=tn(a);return e.push(...f.errors,...b.errors),c.push(...b.explanations),{errors:e,explanations:c,modifiedData:a}}get codeNativeValueValidation(){var i;return this._codeNativeValueValidation||((i=this.declaration)==null?void 0:i.codeNativeValueValidation)||null}validateGeneratedUpdate(i){const r=[],a=[];let c=JSON.parse(JSON.stringify(i));const e=dy(c,this);return c=e.modifiedData,r.push(...e.errors),c.parent&&r.push(new we({id:`${this.id}--${Te.InvalidParentUpdate}`,code:Te.InvalidParentUpdate,severity:ve.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.
|
|
121
|
-
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:c}}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 S(this.project,x.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==="declaration"){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==="declaration"){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;return(r=(i=this.declaration)==null?void 0:i.unsubscribeDependents)==null||r.call(i,[{entity:this,field:"declaration"}]),(e=(c=(a=this.dataType)==null?void 0:a.entity)==null?void 0:c.unsubscribeDependents)==null||e.call(c,[{entity:this,field:"data-type-entity"}]),this}subscribeToDependencies(){var i,r,a,c,e;return(r=(i=this.declaration)==null?void 0:i.subscribeDependents)==null||r.call(i,[{entity:this,field:"declaration"}]),(e=(c=(a=this.dataType)==null?void 0:a.entity)==null?void 0:c.subscribeDependents)==null||e.call(c,[{entity:this,field:"data-type-entity"}]),this}increaseVersion(i){var r;if(this.project.diggestedBuiltInBaseEntitiesIds.has(this.id))return this;if(i&&!B(i).isValid())throw new Error(`The shared timestamp '${i}' is not a valid ISO 8601 date string.`);if(i&&B(i).isSame(B(this.createdAt)))return this;if(!((r=this.knownVersions)!=null&&r.has(this.version))&&this.project.initialized)throw new Error(`The current ${this.type} ${this.id} version '${this.version}' is not captured in the 'knownVersions' map. Capture the current version before increasing it to avoid losing data.`);if(!this.activeVersion)throw new Error(`Only active versions can be increased. Entity with id '${this.id}' and version '${this.version}' is not active.`);return this.previousVersion=this.version,this.version=x.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 Ci(this,this.project);if(!this.activeVersion)throw new Error(`Only active versions can be captured. Entity of type ${this.type} with id '${this.id}' and version '${this.version}' is not active.`);if(this.version!==i.version)throw new Error(`Captured ${this.type} with id '${this.id}', version '${i.version}' does not match current entity version '${this.version}'.`);return this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,i):new Map().set(this.version,i),this.apply(i),this}snapshot(){const i=new Ci(this,this.project);return this.apply(i)}apply(i){const r=this.toMeta();return i.metaSync(r,null),i.declaration=this.declaration,i.defaultValue=this.defaultValue,i.readsValue=this.readsValue,i.dataType=this.dataType,i.parent=this.parent,i}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,r){var m;const a=[],c=[],e=[],f=[];if(this.version===i&&(r!=null&&r.skipIfSameVersion))return{updated:C(a),added:C(c),removed:C(e),affected:C(f),self:this};if(!this.knownVersions){const E=new Map;for(const[b,A]of this.knownVersions||new Map){if(E.set(b,A),A.activeVersion=!1,A.knownVersions)for(const[_,P]of A.knownVersions)E.set(_,P);A.knownVersions=null}}let h=(m=this.knownVersions)==null?void 0:m.get(i);if(!h){const E=await this.APILoadVersion({},i);if(!E)throw new Error(`Version with id '${i}' for entity with id '${this.id}' not found.`);h=new Ci(E,this.project)}return this.metaSync(h.toShallowJSON(),null),this.previousVersion=h.previousVersion,this.version=h.version,this.createdAt=h.createdAt,this.author=h.author,this.deleted=h.deleted,this.declaration=h.declaration,this.defaultValue=h.defaultValue,this.readsValue=h.readsValue,this.dataType=h.dataType,this.parent=h.parent,{updated:C(a),added:C(c),removed:C(e),affected:C(f),self:this}}updateWithShallowTransfer(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.UpdateWithShallowTransfer))){if(!this.checkCanEdit(this,r))return J.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=ie(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.readsValue){const a=ie(i.readsValue),c=this.project.get(a),e=this.readsValue;e&&e.id!==(c==null?void 0:c.id)&&this.removeValueWriter(r),c&&this.setValueWriter(c,r)}else this.removeValueWriter(r);if(i.declaration){const a=ie(i.declaration),c=this.project.get(a);c&&this.setDeclaration(c,r)}else this.setDeclaration(null,r);if(i.dataType){const a=ie(i.dataType),c=this.project.get(a);c&&this.setDataType(c,r)}else this.setDataType(null,r);if(i.defaultValue){const a=ie(i.defaultValue),c=this.project.get(a);c&&this.setDefaultValue(c,r)}else this.setDefaultValue(null,r);return this.captureVersion(),this.subscribeToDependencies(),r==null||r.attemptAutoclose(w.UpdateWithShallowTransfer,this.id),this}updateWithGenerationTarget(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.UpdateWithGenerationTarget))){if(!this.checkCanEdit(this,r))return J.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=ie(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.UpdateWithGenerationTarget,this.id),new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${a}' that isn't found in the project`)}if(i.readsValue){const a=ie(i.readsValue),c=this.project.get(a),e=this.readsValue;if(e&&e.id!==(c==null?void 0:c.id)&&this.removeValueWriter(r),c)this.setValueWriter(c,r);else throw new Error(`${this.type} with id '${this.id}' has a 'readsValue' reference '${a}' that isn't found in the project`)}else i.readsValue===null&&this.removeValueWriter(r);if(i.declaration){const a=ie(i.declaration),c=this.project.get(a);if(c)this.setDeclaration(c,r);else throw new Error(`${this.type} with id '${this.id}' has a 'declaration' reference '${a}' that isn't found in the project`)}else i.declaration===null&&this.setDeclaration(null,r);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=ie(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.readsValue){const e=ie(this.initialData.readsValue),f=this.project.get(e);f&&(this.setValueWriter(f,null),i.push(f))}if(this.initialData.declaration){const e=ie(this.initialData.declaration),f=this.project.get(e);f&&(this.setDeclaration(f,null),i.push(f))}return{updated:C(i),added:C(r),removed:C(a),affected:C(c),self:this}}afterAllChildrenInitialized(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.AfterAllChildrenInitialized))){var b,A,_,P;if(!this.checkCanEdit(this,i))return J.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=[];this.initialized=!0;let f=((b=this.declaration)==null?void 0:b.index)??this.index??0;const h=(Dt.includes(this.parent.type)?this.parent.outputs:this.parent.inputs).filter(V=>!V.deleted&&V.id!==this.id);h.length&&(f>h.length+1?f=h.length:f<0&&(f=0)),h.find(V=>(V.index||0)===f&&!V.deleted)&&h.filter(V=>(V.index||0)>=f&&!V.deleted).forEach(V=>{V.metaSync({index:(V.index||0)+1},i),i==null||i.add(V,H.Updated),r.push(V)});const E=this.parent.type===d.VariableInstance&&((A=this.declaration)==null?void 0:A.type)===d.Property&&((_=this.declaration)==null?void 0:_.constant);if(E&&this.readsValue&&(this.readsValue.removeValueReader(this,i),this.removeValueWriter(i)),E&&this.defaultValue&&this.defaultValue.remove({ignoreUpstream:!1},i),this.readsValue&&this.defaultValue&&(this.project.diggestedBuiltInBaseEntitiesIds.has(this.defaultValue.id)||this.defaultValue.remove({ignoreUpstream:!1},i),this.setDefaultValue(null,i)),this.defaultValue&&!this.readsValue&&!this.project.diggestedBuiltInBaseEntitiesIds.has(this.id)&&this.project.diggestedBuiltInBaseEntitiesIds.has(this.defaultValue.id)){const V=this.defaultValue.clone(i,this);this.setDefaultValue(V,i)}return this.readsValue&&this.parent.type===d.VariableDeclaration&&((P=this.parent.parent)==null?void 0:P.type)===d.Project&&(i==null||i.event({id:`${w.RemoveValueWriter}-${this.id}--${Me.InputsInGlobalVariableDeclarationsCannotReadValues}`,action:w.RemoveValueWriter,owner:this,errorReason:Me.InputsInGlobalVariableDeclarationsCannotReadValues,rootAction:!1}),this.readsValue.removeValueReader(this,i),this.removeValueWriter(i)),this.metaSync({index:f},i),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 S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"add-self-to-project"))){var f;const r=[this],a=[],c=[],e=[];return Dt.includes(this.parent.type)?this.parentRelationType===od.Error?this.parent.setThrows(this,i):this.parent.addOutput(this,i):this.parent.addInput(this,i),e.push(this.parent),(f=this.readsValue)==null||f.addValueReader(this,i),this.readsValue&&r.push(this.readsValue),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 S(this.project,x.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,H.Updated))),r==null||r.attemptAutoclose(w.SetParent,this.id),this):this}setDataType(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.SetDataType))){if(!this.checkCanEdit(this,r))return J.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,H.Affected)),r==null||r.attemptAutoclose(w.SetDataType,this.id),this}removeDataType(i=this.project.addChangeSet(new S(this.project,x.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,H.Affected),this.dataType=null),i==null||i.attemptAutoclose(w.RemoveDataType,this.id),this):(J.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)}setDeclaration(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"set-declaration"))){var a;return((a=this.declaration)==null?void 0:a.id)!==(i==null?void 0:i.id)&&(this.declaration=i,this.subscribeToDependencies(),r&&(r==null||r.add(this,H.Updated))),r==null||r.attemptAutoclose("set-declaration",this.id),this}initChildren(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"init-children"))){return this.initialized||this.startedInitialization?this:(this.startedInitialization=!0,this.initialData.defaultValue&&(this.defaultValue=Ie(this.initialData.defaultValue,this.project),this.defaultValue.setParent(this,null),this.defaultValue.initChildren(i)),this.initialData.declaration&&(this.declaration=Ie(this.initialData.declaration,this.project)),uy.initReadsValue(this),this.subscribeToDependencies(),this.afterAllChildrenInitialized(i),i==null||i.attemptAutoclose("init-children",this.id),this)}setValueWriter(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.SetValueWriter))){var c,e,f,h,m,E,b;return this.checkCanEditFromScopeOwnerWithSideEffects(this,w.SetValueWriter,r)?((i==null?void 0:i.id)===this.id&&(r==null||r.event({id:`${w.SetValueWriter}-${this.id}`,action:w.SetValueWriter,owner:this,errorReason:Me.CannotValueWriteItself,rootAction:((c=r==null?void 0:r.self)==null?void 0:c.id)===this.id&&(r==null?void 0:r.actionName)===w.SetValueWriter})),this.parent.type===d.VariableInstance&&((e=this.declaration)==null?void 0:e.type)===d.Property&&((f=this.declaration)==null?void 0:f.constant)&&i?(r==null||r.event({id:`${w.SetValueWriter}-${this.id}--${i.id}`,action:w.SetValueWriter,owner:this,counterpart:i,errorReason:Me.ValueReadingOverridesConstantVariable,rootAction:((h=r==null?void 0:r.self)==null?void 0:h.id)===this.id&&(r==null?void 0:r.actionName)===w.SetValueWriter}),r==null||r.attemptAutoclose(w.SetValueWriter,this.id),this):(((m=this.readsValue)==null?void 0:m.id)!==(i==null?void 0:i.id)&&(this.readsValue=i,this.readsValue&&((E=this.defaultValue)==null||E.remove({ignoreUpstream:!1},r),this.parent.type===d.Search&&((b=this.declaration)==null||b.setDefaultValue(null,r))),r==null||r.add(this,H.Updated)),r==null||r.attemptAutoclose(w.SetValueWriter,this.id),this)):this}removeValueWriter(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RemoveValueWriter))){return this.readsValue&&!this.checkCanEditFromScopeOwnerWithSideEffects(this,w.RemoveValueWriter,i)?this:(this.readsValue&&(this.readsValue=null,i==null||i.add(this,H.Updated)),i==null||i.attemptAutoclose(w.RemoveValueWriter,this.id),this)}subscribe(){var i;return this.activeVersion=!0,(i=this.knownVersions)==null||i.forEach(r=>{r.version!==this.version&&(r.activeVersion=!1)}),this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"meta-sync"))){const a=nn(this,i,r),c=rn(this,a),e=this.toMeta();return this.index=a.index||(a.index!==0?e.index:0),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,this.parentRelationType=a.parentRelationType!==void 0?a.parentRelationType:this.parentRelationType,super.baseMetaSync(a,this,r),a.deleted===!0&&!e.deleted?r==null||r.add(this,H.Removed):a.deleted===!1&&e.deleted?r==null||r.add(this,H.Added):c&&(r==null||r.add(this,H.Updated)),r==null||r.attemptAutoclose("meta-sync",this.id),this}async APILoad(i=Ze,...r){return await Ci.repository.APILoad(this.id,...r),this}async APICreate(i=Ze,...r){return await Ci.repository.APICreate(this.toShallowJSON(),...r),this}async APIUpdate(i=Ze,...r){return await Ci.repository.APIUpdate(this.toShallowJSON(),...r),this}async APIDelete(i=Ze,...r){return await Ci.repository.APIDelete(this.toShallowJSON(),...r),this}async APIClone(i=Ze,...r){return await Ci.repository.APIClone(this.id,...r),this}async APILoadVersion(i=Ze,r,...a){return await Ci.repository.APILoadVersion(this.id,r,...a)}removeFromParent(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RemoveFromParent))){var f;if(!this.checkCanEdit(this,i))return J.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 Dt.includes((f=this.parent)==null?void 0:f.type)?this.parentRelationType===od.Error?(this.parent.setThrows(null,i),e.push(this.parent)):(this.parent.removeOutput(this,i),e.push(this.parent)):(this.parent.removeInput(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 S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RemoveEntity))){var h,m,E,b,A;if(this.deleted)return r==null||r.attemptAutoclose(w.RemoveEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(!this.checkCanDelete(this,r))return J.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}--${Me.ActionOwnerEntityNonDeletable}`,action:w.RemoveEntity,owner:this,errorReason:Me.ActionOwnerEntityNonDeletable,rootAction:((h=r==null?void 0:r.self)==null?void 0:h.id)===this.id&&(r==null?void 0:r.actionName)===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.metaSync({deleted:!0},r),r!=null&&r.hasAdded(this.id)||this.project.subscribeDeletedInstance(this),Object.values(this.detachedDependents).forEach(_=>{const{updated:P,removed:V,added:M}=_.entity.onDetachedDependencyRemoved(this,_.field,r);a.push(...P),c.push(...V),e.push(...M)}),this.defaultValue){const{updated:_,removed:P}=this.defaultValue.remove({ignoreUpstream:!0},r);a.push(..._),c.push(...P)}if(this.readsValue&&(a.push(this.readsValue),this.readsValue.removeValueReader(this,r)),this.defaultValue&&(a.push(this.defaultValue),this.defaultValue.remove({ignoreUpstream:!0},r)),this.declaration){if(this.declaration.type===d.Property&&((m=this.declaration.parent)==null?void 0:m.type)===d.DefinitionEntity&&((b=(E=this.declaration.parent)==null?void 0:E.parent)==null?void 0:b.type)===d.DataType&&!(r!=null&&r.hasRemoved(this.declaration.id))&&!this.declaration.deleted){const{updated:_,removed:P}=this.declaration.remove({ignoreUpstream:!1},r);a.push(..._),c.push(...P)}else if(this.declaration.type===d.ValueDescriptor&&((A=this.declaration.parent)==null?void 0:A.type)===d.Search&&!(r!=null&&r.hasRemoved(this.declaration.id))&&!this.declaration.deleted){const{updated:_,removed:P}=this.declaration.remove({ignoreUpstream:!1},r);a.push(..._),c.push(...P)}}if(!i){const _=this.removeFromParent(r);e.push(..._.added),a.push(..._.updated),c.push(..._.removed),f.push(..._.affected)}if(!i&&this.parent&&[d.BreakStatement,d.ContinueStatement].includes(this.parent.type)&&this.parent.parent&&this.parent.parent.type===d.Loop&&this.parent.initialized&&this.parent.parent.syncFromDataType(r),this.parentRelationType===od.Error&&this.parent.type===d.ReturnStatement){const{updated:_,added:P,removed:V,affected:M}=this.parent.syncInputs(r);a.push(..._),e.push(...P),c.push(...V),f.push(...M)}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 S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RestoreEntity))){if(!this.checkCanEdit(this,i))return J.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.defaultValue){const{updated:f}=this.defaultValue.restore({},i);a.push(...f)}return this.readsValue&&(a.push(this.readsValue),this.readsValue.addValueReader(this,i)),this.defaultValue&&(a.push(this.defaultValue),this.defaultValue.restore({},i)),e.push(this.parent),this.parent.addInput(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.defaultValue?this.defaultValue.toFlat(i):[],...this.dataType?this.dataType.toFlat(i):[],...this.declaration?this.declaration.toFlat(i):[],...this.readsValue?this.readsValue.toFlat(i):[]])}toFlatIds(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this.id,...this.defaultValue?this.defaultValue.toFlatIds(i):[],...this.dataType?this.dataType.toFlatIds(i):[],...this.declaration?this.declaration.toFlatIds(i):[],...this.readsValue?this.readsValue.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,parentRelationType:this.parentRelationType,index:this.index,type:this.type,editable:this.editable,deletable:this.deletable,name:this.name}}toJSON(i=new Set){var r,a,c,e;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,name:this.name,codeName:this.codeName,description:this.description,parentRelationType:this.parentRelationType,defaultValue:((r=this.defaultValue)==null?void 0:r.toJSON(i))||null,dataType:((a=this.dataType)==null?void 0:a.toJSON(i))||null,declaration:((c=this.declaration)==null?void 0:c.toJSON(i))||null,readsValue:((e=this.readsValue)==null?void 0:e.toReference())||null,parent:this.parent.toReference()})}toJSONClone(i=at){var a,c,e,f,h,m,E,b,A,_,P,V;let r;return(a=i.seenEntityMaps)!=null&&a.has(this.id)?r=i.seenEntityMaps.get(this.id):(r=i.newId||un(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:x.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,name:this.name,codeName:this.codeName,description:this.description,parentRelationType:this.parentRelationType,defaultValue:((m=this.defaultValue)==null?void 0:m.toJSONClone({...i,newId:null}))||null,dataType:((E=this.dataType)==null?void 0:E.toJSONClone({...i,newId:null}))||null,declaration:(b=this.declaration)!=null&&b.id&&this.project.getBuiltIn((A=this.declaration)==null?void 0:A.id)?(_=this.declaration)==null?void 0:_.toJSON(i.seenEntities):((P=this.declaration)==null?void 0:P.toJSONClone({...i,newId:null}))||null,readsValue:((V=this.readsValue)==null?void 0:V.toReference({seenEntityMaps:i.seenEntityMaps}))||null,parent:this.parent.toReference({seenEntityMaps:i.seenEntityMaps})})}toReference(i=at){var a;let r=this.id;return(a=i.seenEntityMaps)!=null&&a.has(this.id)&&(r=i.seenEntityMaps.get(this.id)),{id:r+"--"+x.UUID.uuid()+"--ref",type:d.GenericReference,entityId:r,version:this.version,entityType:this.type}}toShallowJSON(i=at){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,name:this.name,codeName:this.codeName,description:this.description,parentRelationType:this.parentRelationType,index:this.index,dataType:((c=this.dataType)==null?void 0:c.toReference(i))||null,defaultValue:((e=this.defaultValue)==null?void 0:e.toReference(i))||null,declaration:((f=this.declaration)==null?void 0:f.toReference(i))||null,readsValue:((h=this.readsValue)==null?void 0:h.toReference(i))||null,parent:this.parent.toReference(i)}}toFlatJSON(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this.toShallowJSON(),...this.defaultValue?this.defaultValue.toFlatJSON(i):[],...this.dataType?this.dataType.toFlatJSON(i):[],...this.declaration?this.declaration.toFlatJSON(i):[],...this.readsValue?this.readsValue.toFlatJSON(i):[]])}toGenerationTarget(i=at){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||void 0,description:this.description||void 0,type:this.type,declaration:((c=this.declaration)==null?void 0:c.id)||null,parent:this.parent.id}}toFlatGenerationTarget(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this.toGenerationTarget(),...this.defaultValue?this.defaultValue.toFlatGenerationTarget(i):[],...this.dataType?this.dataType.toFlatGenerationTarget(i):[],...this.readsValue?this.readsValue.toFlatGenerationTarget(i):[],...this.declaration?this.declaration.toFlatGenerationTarget(i):[]])}clearErrors(){var i;return this.errors=[],(i=this.defaultValue)==null||i.clearErrors(),this}validate(){return this.errors=QMe(this),{success:!0}}async validateAsync(i={}){const r=J.YieldTracker.from(i);return this.errors=await JMe(this,{tracker:r}),{success:!0}}getErrors(){var r;return[...this.errors,...((r=this.defaultValue)==null?void 0:r.getErrors())||[]]}async getErrorsAsync(i={}){var e;const r=J.YieldTracker.from(i),a=[...this.errors];await r.tick();const c=await((e=this.defaultValue)==null?void 0:e.getErrorsAsync({tracker:r}));return c&&a.push(...c),a}getShallowErrors(){return this.errors}getDefaultValue(){var i;return this.defaultValue||((i=this.declaration)==null?void 0:i.getDefaultValue())||null}setDefaultValue(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"set-default-value"))){if(!this.checkCanEdit(this,r))return J.Logger.warn(`[setDefaultValue] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose("set-default-value",this.id),this;const a=this.defaultValue;if((a==null?void 0:a.id)!==(i==null?void 0:i.id)){if(a==null||a.remove({ignoreUpstream:!0},r),this.defaultValue=i,this.defaultValue){const c=this.readsValue;this.removeValueWriter(r),c==null||c.removeValueReader(this,r)}r==null||r.add(this,H.Affected)}return r==null||r.attemptAutoclose("set-default-value",this.id),this}clone(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.CloneEntity)),r=null,a=null,c=!0){var b;const e=Kr(r,this),f=this.toJSON(),h=a||x.UUID.uuid();f.defaultValue=null,f.id=h,f.version=x.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 m=lr(f,e);m.hydrateAncestors(),r&&m.setParent(r,i),c&&(m.subscribe(),m.addSelfToProject(i)),m.initChildren(i),i==null||i.add(m,H.Added);const E=(b=this.defaultValue)==null?void 0:b.clone(i,m,x.UUID.uuid(),c);return m.defaultValue=E||null,i||m.captureVersion(),i==null||i.attemptAutoclose(w.CloneEntity,this.id),m}getDataType(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"get-data-type"))){var c;if(this.parent.type===d.Operation){const e=this.parent.declaration.inferInputMapDataType(this,i);return i==null||i.attemptAutoclose("get-data-type",this.id),e.self}else Mt.includes(this.parent.type)&&Er(this.parent).getDataType(i);const r=(c=this.declaration)==null?void 0:c.getDataType(i);if(!r||!r.entity&&!r.orChildrenGroup&&!r.andChildrenGroup&&!r.foreignKeyRef&&!r.foreignKeyAllowed){const e=tu(this,i);if(e)return i==null||i.attemptAutoclose("get-data-type",this.id),e}return i==null||i.attemptAutoclose("get-data-type",this.id),r||null}getCounterparts(){let i=[];if([d.BreakStatement,d.ContinueStatement].includes(this.parent.type)){const r=this.parent.parent;i=[...r.breakStatements,...r.continueStatements].flatMap(e=>e.outputs).filter(e=>pe(e,this.project)===pe(this,this.project)&&e.id!==this.id)}else if(this.parent.type===d.ReturnStatement&&[d.FunctionDeclaration,d.GlobalEvent].includes(this.parent.parent.type)&&this.parent.parent.implements){const a=this.parent.parent.returnStatements.flatMap(c=>c.outputs);this.declaration?i=a.filter(e=>{var f;return this.declaration.id===((f=e.declaration)==null?void 0:f.id)&&e.id!==this.id}):i=a.filter(e=>pe(e,this.project)===pe(this,this.project)&&e.id!==this.id)}return i}};R(Ci,"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(Ci,"type",d.InputMap),R(Ci,"USER_MANAGED_PARENT_TYPES",[..._t,...Dt]),R(Ci,"PARENT_TYPES",[...Ci.USER_MANAGED_PARENT_TYPES]),R(Ci,"MUTABLE_BASE_PROPERTIES",["name","codeName","description"]),R(Ci,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion","parentRelationType"]),R(Ci,"BASE_PROPERTIES",[...Ci.MUTABLE_BASE_PROPERTIES,...Ci.INMUTABLE_BASE_PROPERTIES]),R(Ci,"MUTABLE_META_PROPERTIES",[...Ci.MUTABLE_BASE_PROPERTIES,"index"]),R(Ci,"INMUTABLE_META_PROPERTIES",[...Ci.INMUTABLE_BASE_PROPERTIES]),R(Ci,"META_PROPERTIES",[...Ci.MUTABLE_META_PROPERTIES,...Ci.INMUTABLE_META_PROPERTIES]),R(Ci,"MUTABLE_UPSTREAM_PROPERTIES",["readsValue"]),R(Ci,"INMUTABLE_UPSTREAM_PROPERTIES",["parent","declaration"]),R(Ci,"UPSTREAM_PROPERTIES",[...Ci.MUTABLE_UPSTREAM_PROPERTIES,...Ci.INMUTABLE_UPSTREAM_PROPERTIES]),R(Ci,"MUTABLE_DOWNSTREAM_PROPERTIES",["defaultValue"]),R(Ci,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),R(Ci,"DOWNSTREAM_PROPERTIES",[...Ci.MUTABLE_DOWNSTREAM_PROPERTIES,...Ci.INMUTABLE_DOWNSTREAM_PROPERTIES]),R(Ci,"PROPERTIES",[...Ci.META_PROPERTIES,...Ci.UPSTREAM_PROPERTIES,...Ci.DOWNSTREAM_PROPERTIES]);let Es=Ci;class pDi extends Es{constructor(i,r){super(i,r);R(this,"parentRelationType",null);R(this,"errors",[])}toJSON(i=new Set){return super.toJSON(i)}}class cDi extends Es{constructor(i,r){super(i,r);R(this,"parentRelationType",null);R(this,"errors",[])}toJSON(i=new Set){return super.toJSON(i)}}class fDi extends Es{constructor(i,r){super(i,r);R(this,"parentRelationType",null);R(this,"name",null);R(this,"description",null);R(this,"errors",[])}toJSON(i=new Set){return super.toJSON(i)}}async function iGe(s,p={}){var f,h;const i=J.YieldTracker.from(p),r=Aa(s),a=ga(s),c=[...r,...a],e=qt(s.errors,c);await i.tick();for(const m of s.inputsDeclarations)await m.validateAsync({tracker:i});for(const m of s.inputs)await m.validateAsync({tracker:i});for(const m of s.outputs)await m.validateAsync({tracker:i});return await((f=s.error)==null?void 0:f.validateAsync({tracker:i})),await((h=s.dataType)==null?void 0:h.validateAsync({tracker:i})),e}function rGe(s){var r,a;s.inputsDeclarations.forEach(c=>c.validate()),s.inputs.forEach(c=>c.validate()),s.outputs.forEach(c=>c.validate()),(r=s.error)==null||r.validate(),(a=s.dataType)==null||a.validate();const i=[...Aa(s),...ga(s)];return qt(s.errors,i)}const yDi=Object.freeze(Object.defineProperty({__proto__:null,validate:rGe,validateAsync:iGe},Symbol.toStringTag,{value:"Module"}));async function nGe(s,p={}){var a;const i=J.YieldTracker.from(p),r=[...Dn(s),...es(s)];return await i.tick(),await((a=s.dataType)==null?void 0:a.validateAsync({tracker:i})),qt(s.errors,r)}function aGe(s){var i;(i=s.dataType)==null||i.validate();const p=[...Dn(s),...es(s)];return qt(s.errors,p)}const hDi=Object.freeze(Object.defineProperty({__proto__:null,validate:aGe,validateAsync:nGe},Symbol.toStringTag,{value:"Module"}));var sGe=(s=>(s.DataTypeEntity="data-type-entity",s))(sGe||{});const hi=class hi extends pn{constructor(i,r){super(i);R(this,"initialData");R(this,"id");R(this,"name");R(this,"codeName",null);R(this,"description",null);R(this,"index");R(this,"required");R(this,"parentRelationType");R(this,"type",d.ValueDescriptor);R(this,"defaultValue",null);R(this,"dataType",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);R(this,"_codeNativeValueValidation",null);this.initialData=i,this.project=r,this.id=i.id,this.name=i.name,this.description=i.description,this.index=i.index,this.codeName=i.codeName,this.required=i.required,this.parentRelationType=i.parentRelationType}static new(i=null){return{id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:(i==null?void 0:i.author)||x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.ValueDescriptor,name:"",codeName:null,description:"",dataType:null,index:0,required:!1,parentRelationType:j.FixedArguments,defaultValue:null,parent:null}}static fromGenerationTarget(i,r,a){const c=a===void 0?r.addChangeSet(new S(r,x.sessionAuthor,B().toISOString(),r,!0,w.CreateFromGenerationTarget)):a,e=i.parent?ie(i.parent):null,f=e?r.get(e):null,h=i.parentRelationType===j.FixedArguments?f==null?void 0:f.inputs.length:null,m={id:i.id,version:x.UUID.uuid(),createdAt:(c==null?void 0:c.timestamp)||B().toISOString(),author:(c==null?void 0:c.author)||x.sessionAuthor,previousVersion:null,deleted:!1,name:i.name,deletable:!0,editable:!0,type:d.ValueDescriptor,index:h||0,codeName:i.codeName,description:i.description,required:i.required,defaultValue:null,parentRelationType:i.parentRelationType,dataType:null,parent:(f==null?void 0:f.toReference())||null},E=Ie(m,r);return E.hydrateAncestors(),f&&E.setParent(f,null),E.addSelfToProject(c),c==null||c.add(E,H.Added),E.initChildren(c),c||E.captureVersion(),E}static validateGenerationTarget(i,r){let a=JSON.parse(JSON.stringify(i));const c=[],e=[],f=Mn(a,{parent:{list:!1,types:hi.USER_MANAGED_PARENT_TYPES}},r);c.push(...f.explanations),a=f.modifiedData;const h=tn(a);e.push(...f.errors,...h.errors),c.push(...h.explanations);const m=a.parent&&r.get(a.parent),E=m&&cu(m);return E&&E.type===d.ActionDescriptor&&e.push(new we({id:`${i.id}--${Te.BuiltInEntityParent}`,code:Te.BuiltInEntityParent,severity:ve.Error,message:`Entity of type "${i.type}" with id "${i.id}", has a parent that is a built-in entity "${E.name}" of type '${E.type}' with id '${E.id}'.
|
|
121
|
+
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:c}}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 S(this.project,x.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==="declaration"){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==="declaration"){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;return(r=(i=this.declaration)==null?void 0:i.unsubscribeDependents)==null||r.call(i,[{entity:this,field:"declaration"}]),(e=(c=(a=this.dataType)==null?void 0:a.entity)==null?void 0:c.unsubscribeDependents)==null||e.call(c,[{entity:this,field:"data-type-entity"}]),this}subscribeToDependencies(){var i,r,a,c,e;return(r=(i=this.declaration)==null?void 0:i.subscribeDependents)==null||r.call(i,[{entity:this,field:"declaration"}]),(e=(c=(a=this.dataType)==null?void 0:a.entity)==null?void 0:c.subscribeDependents)==null||e.call(c,[{entity:this,field:"data-type-entity"}]),this}increaseVersion(i){var r;if(this.project.diggestedBuiltInBaseEntitiesIds.has(this.id))return this;if(i&&!B(i).isValid())throw new Error(`The shared timestamp '${i}' is not a valid ISO 8601 date string.`);if(i&&B(i).isSame(B(this.createdAt)))return this;if(!((r=this.knownVersions)!=null&&r.has(this.version))&&this.project.initialized)throw new Error(`The current ${this.type} ${this.id} version '${this.version}' is not captured in the 'knownVersions' map. Capture the current version before increasing it to avoid losing data.`);if(!this.activeVersion)throw new Error(`Only active versions can be increased. Entity with id '${this.id}' and version '${this.version}' is not active.`);return this.previousVersion=this.version,this.version=x.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 Ci(this,this.project);if(!this.activeVersion)throw new Error(`Only active versions can be captured. Entity of type ${this.type} with id '${this.id}' and version '${this.version}' is not active.`);if(this.version!==i.version)throw new Error(`Captured ${this.type} with id '${this.id}', version '${i.version}' does not match current entity version '${this.version}'.`);return this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,i):new Map().set(this.version,i),this.apply(i),this}snapshot(){const i=new Ci(this,this.project);return this.apply(i)}apply(i){const r=this.toMeta();return i.metaSync(r,null),i.declaration=this.declaration,i.defaultValue=this.defaultValue,i.readsValue=this.readsValue,i.dataType=this.dataType,i.parent=this.parent,i}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,r){var m;const a=[],c=[],e=[],f=[];if(this.version===i&&(r!=null&&r.skipIfSameVersion))return{updated:C(a),added:C(c),removed:C(e),affected:C(f),self:this};if(!this.knownVersions){const E=new Map;for(const[b,A]of this.knownVersions||new Map){if(E.set(b,A),A.activeVersion=!1,A.knownVersions)for(const[_,P]of A.knownVersions)E.set(_,P);A.knownVersions=null}}let h=(m=this.knownVersions)==null?void 0:m.get(i);if(!h){const E=await this.APILoadVersion({},i);if(!E)throw new Error(`Version with id '${i}' for entity with id '${this.id}' not found.`);h=new Ci(E,this.project)}return this.metaSync(h.toShallowJSON(),null),this.previousVersion=h.previousVersion,this.version=h.version,this.createdAt=h.createdAt,this.author=h.author,this.deleted=h.deleted,this.declaration=h.declaration,this.defaultValue=h.defaultValue,this.readsValue=h.readsValue,this.dataType=h.dataType,this.parent=h.parent,{updated:C(a),added:C(c),removed:C(e),affected:C(f),self:this}}updateWithShallowTransfer(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.UpdateWithShallowTransfer))){if(!this.checkCanEdit(this,r))return J.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=ie(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.readsValue){const a=ie(i.readsValue),c=this.project.get(a),e=this.readsValue;e&&e.id!==(c==null?void 0:c.id)&&this.removeValueWriter(r),c&&this.setValueWriter(c,r)}else this.removeValueWriter(r);if(i.declaration){const a=ie(i.declaration),c=this.project.get(a);c&&this.setDeclaration(c,r)}else this.setDeclaration(null,r);if(i.dataType){const a=ie(i.dataType),c=this.project.get(a);c&&this.setDataType(c,r)}else this.setDataType(null,r);if(i.defaultValue){const a=ie(i.defaultValue),c=this.project.get(a);c&&this.setDefaultValue(c,r)}else this.setDefaultValue(null,r);return this.captureVersion(),this.subscribeToDependencies(),r==null||r.attemptAutoclose(w.UpdateWithShallowTransfer,this.id),this}updateWithGenerationTarget(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.UpdateWithGenerationTarget))){if(!this.checkCanEdit(this,r))return J.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=ie(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.UpdateWithGenerationTarget,this.id),new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${a}' that isn't found in the project`)}if(i.readsValue){const a=ie(i.readsValue),c=this.project.get(a),e=this.readsValue;if(e&&e.id!==(c==null?void 0:c.id)&&this.removeValueWriter(r),c)this.setValueWriter(c,r);else throw new Error(`${this.type} with id '${this.id}' has a 'readsValue' reference '${a}' that isn't found in the project`)}else i.readsValue===null&&this.removeValueWriter(r);if(i.declaration){const a=ie(i.declaration),c=this.project.get(a);if(c)this.setDeclaration(c,r);else throw new Error(`${this.type} with id '${this.id}' has a 'declaration' reference '${a}' that isn't found in the project`)}else i.declaration===null&&this.setDeclaration(null,r);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=ie(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.readsValue){const e=ie(this.initialData.readsValue),f=this.project.get(e);f&&(this.setValueWriter(f,null),i.push(f))}if(this.initialData.declaration){const e=ie(this.initialData.declaration),f=this.project.get(e);f&&(this.setDeclaration(f,null),i.push(f))}return{updated:C(i),added:C(r),removed:C(a),affected:C(c),self:this}}afterAllChildrenInitialized(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.AfterAllChildrenInitialized))){var b,A,_,P;if(!this.checkCanEdit(this,i))return J.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=[];this.initialized=!0;let f=((b=this.declaration)==null?void 0:b.index)??this.index??0;const h=(Dt.includes(this.parent.type)?this.parent.outputs:this.parent.inputs).filter(V=>!V.deleted&&V.id!==this.id);h.length&&(f>h.length+1?f=h.length:f<0&&(f=0)),h.find(V=>(V.index||0)===f&&!V.deleted)&&h.filter(V=>(V.index||0)>=f&&!V.deleted).forEach(V=>{V.metaSync({index:(V.index||0)+1},i),i==null||i.add(V,H.Updated),r.push(V)});const E=this.parent.type===d.VariableInstance&&((A=this.declaration)==null?void 0:A.type)===d.Property&&((_=this.declaration)==null?void 0:_.constant);if(E&&this.readsValue&&(this.readsValue.removeValueReader(this,i),this.removeValueWriter(i)),E&&this.defaultValue&&this.defaultValue.remove({ignoreUpstream:!1},i),this.readsValue&&this.defaultValue&&(this.project.diggestedBuiltInBaseEntitiesIds.has(this.defaultValue.id)||this.defaultValue.remove({ignoreUpstream:!1},i),this.setDefaultValue(null,i)),this.defaultValue&&!this.readsValue&&!this.project.diggestedBuiltInBaseEntitiesIds.has(this.id)&&this.project.diggestedBuiltInBaseEntitiesIds.has(this.defaultValue.id)){const V=this.defaultValue.clone(i,this);this.setDefaultValue(V,i)}return this.readsValue&&this.parent.type===d.VariableDeclaration&&((P=this.parent.parent)==null?void 0:P.type)===d.Project&&(i==null||i.event({id:`${w.RemoveValueWriter}-${this.id}--${Me.InputsInGlobalVariableDeclarationsCannotReadValues}`,action:w.RemoveValueWriter,owner:this,errorReason:Me.InputsInGlobalVariableDeclarationsCannotReadValues,rootAction:!1}),this.readsValue.removeValueReader(this,i),this.removeValueWriter(i)),this.metaSync({index:f},i),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 S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"add-self-to-project"))){var f;const r=[this],a=[],c=[],e=[];return Dt.includes(this.parent.type)?this.parentRelationType===od.Error?this.parent.setThrows(this,i):this.parent.addOutput(this,i):this.parent.addInput(this,i),e.push(this.parent),(f=this.readsValue)==null||f.addValueReader(this,i),this.readsValue&&r.push(this.readsValue),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 S(this.project,x.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,H.Updated))),r==null||r.attemptAutoclose(w.SetParent,this.id),this):this}setDataType(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.SetDataType))){if(!this.checkCanEdit(this,r))return J.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,H.Affected)),r==null||r.attemptAutoclose(w.SetDataType,this.id),this}removeDataType(i=this.project.addChangeSet(new S(this.project,x.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,H.Affected),this.dataType=null),i==null||i.attemptAutoclose(w.RemoveDataType,this.id),this):(J.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)}setDeclaration(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"set-declaration"))){var a;return((a=this.declaration)==null?void 0:a.id)!==(i==null?void 0:i.id)&&(this.declaration=i,this.subscribeToDependencies(),r&&(r==null||r.add(this,H.Updated))),r==null||r.attemptAutoclose("set-declaration",this.id),this}initChildren(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"init-children"))){return this.initialized||this.startedInitialization?this:(this.startedInitialization=!0,this.initialData.defaultValue&&(this.defaultValue=Ie(this.initialData.defaultValue,this.project),this.defaultValue.setParent(this,null),this.defaultValue.initChildren(i)),this.initialData.declaration&&(this.declaration=Ie(this.initialData.declaration,this.project)),uy.initReadsValue(this),this.subscribeToDependencies(),this.afterAllChildrenInitialized(i),i==null||i.attemptAutoclose("init-children",this.id),this)}setValueWriter(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.SetValueWriter))){var c,e,f,h,m,E,b;return this.checkCanEditFromScopeOwnerWithSideEffects(this,w.SetValueWriter,r)?((i==null?void 0:i.id)===this.id&&(r==null||r.event({id:`${w.SetValueWriter}-${this.id}`,action:w.SetValueWriter,owner:this,errorReason:Me.CannotValueWriteItself,rootAction:((c=r==null?void 0:r.self)==null?void 0:c.id)===this.id&&(r==null?void 0:r.actionName)===w.SetValueWriter})),this.parent.type===d.VariableInstance&&((e=this.declaration)==null?void 0:e.type)===d.Property&&((f=this.declaration)==null?void 0:f.constant)&&i?(r==null||r.event({id:`${w.SetValueWriter}-${this.id}--${i.id}`,action:w.SetValueWriter,owner:this,counterpart:i,errorReason:Me.ValueReadingOverridesConstantVariable,rootAction:((h=r==null?void 0:r.self)==null?void 0:h.id)===this.id&&(r==null?void 0:r.actionName)===w.SetValueWriter}),r==null||r.attemptAutoclose(w.SetValueWriter,this.id),this):(((m=this.readsValue)==null?void 0:m.id)!==(i==null?void 0:i.id)&&(this.readsValue=i,this.readsValue&&((E=this.defaultValue)==null||E.remove({ignoreUpstream:!1},r),this.parent.type===d.Search&&((b=this.declaration)==null||b.setDefaultValue(null,r))),r==null||r.add(this,H.Updated)),r==null||r.attemptAutoclose(w.SetValueWriter,this.id),this)):this}removeValueWriter(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RemoveValueWriter))){return this.readsValue&&!this.checkCanEditFromScopeOwnerWithSideEffects(this,w.RemoveValueWriter,i)?this:(this.readsValue&&(this.readsValue=null,i==null||i.add(this,H.Updated)),i==null||i.attemptAutoclose(w.RemoveValueWriter,this.id),this)}subscribe(){var i;return this.activeVersion=!0,(i=this.knownVersions)==null||i.forEach(r=>{r.version!==this.version&&(r.activeVersion=!1)}),this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"meta-sync"))){const a=nn(this,i,r),c=rn(this,a),e=this.toMeta();return this.index=a.index||(a.index!==0?e.index:0),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,this.parentRelationType=a.parentRelationType!==void 0?a.parentRelationType:this.parentRelationType,super.baseMetaSync(a,this,r),a.deleted===!0&&!e.deleted?r==null||r.add(this,H.Removed):a.deleted===!1&&e.deleted?r==null||r.add(this,H.Added):c&&(r==null||r.add(this,H.Updated)),r==null||r.attemptAutoclose("meta-sync",this.id),this}async APILoad(i=Ze,...r){return await Ci.repository.APILoad(this.id,...r),this}async APICreate(i=Ze,...r){return await Ci.repository.APICreate(this.toShallowJSON(),...r),this}async APIUpdate(i=Ze,...r){return await Ci.repository.APIUpdate(this.toShallowJSON(),...r),this}async APIDelete(i=Ze,...r){return await Ci.repository.APIDelete(this.toShallowJSON(),...r),this}async APIClone(i=Ze,...r){return await Ci.repository.APIClone(this.id,...r),this}async APILoadVersion(i=Ze,r,...a){return await Ci.repository.APILoadVersion(this.id,r,...a)}removeFromParent(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RemoveFromParent))){var f;if(!this.checkCanEdit(this,i))return J.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 Dt.includes((f=this.parent)==null?void 0:f.type)?this.parentRelationType===od.Error?(this.parent.setThrows(null,i),e.push(this.parent)):(this.parent.removeOutput(this,i),e.push(this.parent)):(this.parent.removeInput(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 S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RemoveEntity))){var h,m,E,b,A;if(this.deleted)return r==null||r.attemptAutoclose(w.RemoveEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(!this.checkCanDelete(this,r))return J.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}--${Me.ActionOwnerEntityNonDeletable}`,action:w.RemoveEntity,owner:this,errorReason:Me.ActionOwnerEntityNonDeletable,rootAction:((h=r==null?void 0:r.self)==null?void 0:h.id)===this.id&&(r==null?void 0:r.actionName)===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.metaSync({deleted:!0},r),r!=null&&r.hasAdded(this.id)||this.project.subscribeDeletedInstance(this),Object.values(this.detachedDependents).forEach(_=>{const{updated:P,removed:V,added:M}=_.entity.onDetachedDependencyRemoved(this,_.field,r);a.push(...P),c.push(...V),e.push(...M)}),this.defaultValue){const{updated:_,removed:P}=this.defaultValue.remove({ignoreUpstream:!0},r);a.push(..._),c.push(...P)}if(this.readsValue&&(a.push(this.readsValue),this.readsValue.removeValueReader(this,r)),this.defaultValue&&(a.push(this.defaultValue),this.defaultValue.remove({ignoreUpstream:!0},r)),this.declaration){if(this.declaration.type===d.Property&&((m=this.declaration.parent)==null?void 0:m.type)===d.DefinitionEntity&&((b=(E=this.declaration.parent)==null?void 0:E.parent)==null?void 0:b.type)===d.DataType&&!(r!=null&&r.hasRemoved(this.declaration.id))&&!this.declaration.deleted&&!this.project.diggestedBuiltInBaseEntitiesIds.has(this.declaration.id)){const{updated:_,removed:P}=this.declaration.remove({ignoreUpstream:!1},r);a.push(..._),c.push(...P)}else if(this.declaration.type===d.ValueDescriptor&&((A=this.declaration.parent)==null?void 0:A.type)===d.Search&&!(r!=null&&r.hasRemoved(this.declaration.id))&&!this.declaration.deleted&&!this.project.diggestedBuiltInBaseEntitiesIds.has(this.declaration.id)){const{updated:_,removed:P}=this.declaration.remove({ignoreUpstream:!1},r);a.push(..._),c.push(...P)}}if(!i){const _=this.removeFromParent(r);e.push(..._.added),a.push(..._.updated),c.push(..._.removed),f.push(..._.affected)}if(!i&&this.parent&&[d.BreakStatement,d.ContinueStatement].includes(this.parent.type)&&this.parent.parent&&this.parent.parent.type===d.Loop&&this.parent.initialized&&this.parent.parent.syncFromDataType(r),this.parentRelationType===od.Error&&this.parent.type===d.ReturnStatement){const{updated:_,added:P,removed:V,affected:M}=this.parent.syncInputs(r);a.push(..._),e.push(...P),c.push(...V),f.push(...M)}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 S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RestoreEntity))){if(!this.checkCanEdit(this,i))return J.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.defaultValue){const{updated:f}=this.defaultValue.restore({},i);a.push(...f)}return this.readsValue&&(a.push(this.readsValue),this.readsValue.addValueReader(this,i)),this.defaultValue&&(a.push(this.defaultValue),this.defaultValue.restore({},i)),e.push(this.parent),this.parent.addInput(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.defaultValue?this.defaultValue.toFlat(i):[],...this.dataType?this.dataType.toFlat(i):[],...this.declaration?this.declaration.toFlat(i):[],...this.readsValue?this.readsValue.toFlat(i):[]])}toFlatIds(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this.id,...this.defaultValue?this.defaultValue.toFlatIds(i):[],...this.dataType?this.dataType.toFlatIds(i):[],...this.declaration?this.declaration.toFlatIds(i):[],...this.readsValue?this.readsValue.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,parentRelationType:this.parentRelationType,index:this.index,type:this.type,editable:this.editable,deletable:this.deletable,name:this.name}}toJSON(i=new Set){var r,a,c,e;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,name:this.name,codeName:this.codeName,description:this.description,parentRelationType:this.parentRelationType,defaultValue:((r=this.defaultValue)==null?void 0:r.toJSON(i))||null,dataType:((a=this.dataType)==null?void 0:a.toJSON(i))||null,declaration:((c=this.declaration)==null?void 0:c.toJSON(i))||null,readsValue:((e=this.readsValue)==null?void 0:e.toReference())||null,parent:this.parent.toReference()})}toJSONClone(i=at){var a,c,e,f,h,m,E,b,A,_,P,V;let r;return(a=i.seenEntityMaps)!=null&&a.has(this.id)?r=i.seenEntityMaps.get(this.id):(r=i.newId||un(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:x.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,name:this.name,codeName:this.codeName,description:this.description,parentRelationType:this.parentRelationType,defaultValue:((m=this.defaultValue)==null?void 0:m.toJSONClone({...i,newId:null}))||null,dataType:((E=this.dataType)==null?void 0:E.toJSONClone({...i,newId:null}))||null,declaration:(b=this.declaration)!=null&&b.id&&this.project.getBuiltIn((A=this.declaration)==null?void 0:A.id)?(_=this.declaration)==null?void 0:_.toJSON(i.seenEntities):((P=this.declaration)==null?void 0:P.toJSONClone({...i,newId:null}))||null,readsValue:((V=this.readsValue)==null?void 0:V.toReference({seenEntityMaps:i.seenEntityMaps}))||null,parent:this.parent.toReference({seenEntityMaps:i.seenEntityMaps})})}toReference(i=at){var a;let r=this.id;return(a=i.seenEntityMaps)!=null&&a.has(this.id)&&(r=i.seenEntityMaps.get(this.id)),{id:r+"--"+x.UUID.uuid()+"--ref",type:d.GenericReference,entityId:r,version:this.version,entityType:this.type}}toShallowJSON(i=at){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,name:this.name,codeName:this.codeName,description:this.description,parentRelationType:this.parentRelationType,index:this.index,dataType:((c=this.dataType)==null?void 0:c.toReference(i))||null,defaultValue:((e=this.defaultValue)==null?void 0:e.toReference(i))||null,declaration:((f=this.declaration)==null?void 0:f.toReference(i))||null,readsValue:((h=this.readsValue)==null?void 0:h.toReference(i))||null,parent:this.parent.toReference(i)}}toFlatJSON(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this.toShallowJSON(),...this.defaultValue?this.defaultValue.toFlatJSON(i):[],...this.dataType?this.dataType.toFlatJSON(i):[],...this.declaration?this.declaration.toFlatJSON(i):[],...this.readsValue?this.readsValue.toFlatJSON(i):[]])}toGenerationTarget(i=at){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||void 0,description:this.description||void 0,type:this.type,declaration:((c=this.declaration)==null?void 0:c.id)||null,parent:this.parent.id}}toFlatGenerationTarget(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this.toGenerationTarget(),...this.defaultValue?this.defaultValue.toFlatGenerationTarget(i):[],...this.dataType?this.dataType.toFlatGenerationTarget(i):[],...this.readsValue?this.readsValue.toFlatGenerationTarget(i):[],...this.declaration?this.declaration.toFlatGenerationTarget(i):[]])}clearErrors(){var i;return this.errors=[],(i=this.defaultValue)==null||i.clearErrors(),this}validate(){return this.errors=QMe(this),{success:!0}}async validateAsync(i={}){const r=J.YieldTracker.from(i);return this.errors=await JMe(this,{tracker:r}),{success:!0}}getErrors(){var r;return[...this.errors,...((r=this.defaultValue)==null?void 0:r.getErrors())||[]]}async getErrorsAsync(i={}){var e;const r=J.YieldTracker.from(i),a=[...this.errors];await r.tick();const c=await((e=this.defaultValue)==null?void 0:e.getErrorsAsync({tracker:r}));return c&&a.push(...c),a}getShallowErrors(){return this.errors}getDefaultValue(){var i;return this.defaultValue||((i=this.declaration)==null?void 0:i.getDefaultValue())||null}setDefaultValue(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"set-default-value"))){if(!this.checkCanEdit(this,r))return J.Logger.warn(`[setDefaultValue] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose("set-default-value",this.id),this;const a=this.defaultValue;if((a==null?void 0:a.id)!==(i==null?void 0:i.id)){if(a==null||a.remove({ignoreUpstream:!0},r),this.defaultValue=i,this.defaultValue){const c=this.readsValue;this.removeValueWriter(r),c==null||c.removeValueReader(this,r)}r==null||r.add(this,H.Affected)}return r==null||r.attemptAutoclose("set-default-value",this.id),this}clone(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.CloneEntity)),r=null,a=null,c=!0){var b;const e=Kr(r,this),f=this.toJSON(),h=a||x.UUID.uuid();f.defaultValue=null,f.id=h,f.version=x.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 m=lr(f,e);m.hydrateAncestors(),r&&m.setParent(r,i),c&&(m.subscribe(),m.addSelfToProject(i)),m.initChildren(i),i==null||i.add(m,H.Added);const E=(b=this.defaultValue)==null?void 0:b.clone(i,m,x.UUID.uuid(),c);return m.defaultValue=E||null,i||m.captureVersion(),i==null||i.attemptAutoclose(w.CloneEntity,this.id),m}getDataType(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"get-data-type"))){var c;if(this.parent.type===d.Operation){const e=this.parent.declaration.inferInputMapDataType(this,i);return i==null||i.attemptAutoclose("get-data-type",this.id),e.self}else Mt.includes(this.parent.type)&&Er(this.parent).getDataType(i);const r=(c=this.declaration)==null?void 0:c.getDataType(i);if(!r||!r.entity&&!r.orChildrenGroup&&!r.andChildrenGroup&&!r.foreignKeyRef&&!r.foreignKeyAllowed){const e=tu(this,i);if(e)return i==null||i.attemptAutoclose("get-data-type",this.id),e}return i==null||i.attemptAutoclose("get-data-type",this.id),r||null}getCounterparts(){let i=[];if([d.BreakStatement,d.ContinueStatement].includes(this.parent.type)){const r=this.parent.parent;i=[...r.breakStatements,...r.continueStatements].flatMap(e=>e.outputs).filter(e=>pe(e,this.project)===pe(this,this.project)&&e.id!==this.id)}else if(this.parent.type===d.ReturnStatement&&[d.FunctionDeclaration,d.GlobalEvent].includes(this.parent.parent.type)&&this.parent.parent.implements){const a=this.parent.parent.returnStatements.flatMap(c=>c.outputs);this.declaration?i=a.filter(e=>{var f;return this.declaration.id===((f=e.declaration)==null?void 0:f.id)&&e.id!==this.id}):i=a.filter(e=>pe(e,this.project)===pe(this,this.project)&&e.id!==this.id)}return i}};R(Ci,"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(Ci,"type",d.InputMap),R(Ci,"USER_MANAGED_PARENT_TYPES",[..._t,...Dt]),R(Ci,"PARENT_TYPES",[...Ci.USER_MANAGED_PARENT_TYPES]),R(Ci,"MUTABLE_BASE_PROPERTIES",["name","codeName","description"]),R(Ci,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion","parentRelationType"]),R(Ci,"BASE_PROPERTIES",[...Ci.MUTABLE_BASE_PROPERTIES,...Ci.INMUTABLE_BASE_PROPERTIES]),R(Ci,"MUTABLE_META_PROPERTIES",[...Ci.MUTABLE_BASE_PROPERTIES,"index"]),R(Ci,"INMUTABLE_META_PROPERTIES",[...Ci.INMUTABLE_BASE_PROPERTIES]),R(Ci,"META_PROPERTIES",[...Ci.MUTABLE_META_PROPERTIES,...Ci.INMUTABLE_META_PROPERTIES]),R(Ci,"MUTABLE_UPSTREAM_PROPERTIES",["readsValue"]),R(Ci,"INMUTABLE_UPSTREAM_PROPERTIES",["parent","declaration"]),R(Ci,"UPSTREAM_PROPERTIES",[...Ci.MUTABLE_UPSTREAM_PROPERTIES,...Ci.INMUTABLE_UPSTREAM_PROPERTIES]),R(Ci,"MUTABLE_DOWNSTREAM_PROPERTIES",["defaultValue"]),R(Ci,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),R(Ci,"DOWNSTREAM_PROPERTIES",[...Ci.MUTABLE_DOWNSTREAM_PROPERTIES,...Ci.INMUTABLE_DOWNSTREAM_PROPERTIES]),R(Ci,"PROPERTIES",[...Ci.META_PROPERTIES,...Ci.UPSTREAM_PROPERTIES,...Ci.DOWNSTREAM_PROPERTIES]);let Es=Ci;class pDi extends Es{constructor(i,r){super(i,r);R(this,"parentRelationType",null);R(this,"errors",[])}toJSON(i=new Set){return super.toJSON(i)}}class cDi extends Es{constructor(i,r){super(i,r);R(this,"parentRelationType",null);R(this,"errors",[])}toJSON(i=new Set){return super.toJSON(i)}}class fDi extends Es{constructor(i,r){super(i,r);R(this,"parentRelationType",null);R(this,"name",null);R(this,"description",null);R(this,"errors",[])}toJSON(i=new Set){return super.toJSON(i)}}async function iGe(s,p={}){var f,h;const i=J.YieldTracker.from(p),r=Aa(s),a=ga(s),c=[...r,...a],e=qt(s.errors,c);await i.tick();for(const m of s.inputsDeclarations)await m.validateAsync({tracker:i});for(const m of s.inputs)await m.validateAsync({tracker:i});for(const m of s.outputs)await m.validateAsync({tracker:i});return await((f=s.error)==null?void 0:f.validateAsync({tracker:i})),await((h=s.dataType)==null?void 0:h.validateAsync({tracker:i})),e}function rGe(s){var r,a;s.inputsDeclarations.forEach(c=>c.validate()),s.inputs.forEach(c=>c.validate()),s.outputs.forEach(c=>c.validate()),(r=s.error)==null||r.validate(),(a=s.dataType)==null||a.validate();const i=[...Aa(s),...ga(s)];return qt(s.errors,i)}const yDi=Object.freeze(Object.defineProperty({__proto__:null,validate:rGe,validateAsync:iGe},Symbol.toStringTag,{value:"Module"}));async function nGe(s,p={}){var a;const i=J.YieldTracker.from(p),r=[...Dn(s),...es(s)];return await i.tick(),await((a=s.dataType)==null?void 0:a.validateAsync({tracker:i})),qt(s.errors,r)}function aGe(s){var i;(i=s.dataType)==null||i.validate();const p=[...Dn(s),...es(s)];return qt(s.errors,p)}const hDi=Object.freeze(Object.defineProperty({__proto__:null,validate:aGe,validateAsync:nGe},Symbol.toStringTag,{value:"Module"}));var sGe=(s=>(s.DataTypeEntity="data-type-entity",s))(sGe||{});const hi=class hi extends pn{constructor(i,r){super(i);R(this,"initialData");R(this,"id");R(this,"name");R(this,"codeName",null);R(this,"description",null);R(this,"index");R(this,"required");R(this,"parentRelationType");R(this,"type",d.ValueDescriptor);R(this,"defaultValue",null);R(this,"dataType",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);R(this,"_codeNativeValueValidation",null);this.initialData=i,this.project=r,this.id=i.id,this.name=i.name,this.description=i.description,this.index=i.index,this.codeName=i.codeName,this.required=i.required,this.parentRelationType=i.parentRelationType}static new(i=null){return{id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:(i==null?void 0:i.author)||x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.ValueDescriptor,name:"",codeName:null,description:"",dataType:null,index:0,required:!1,parentRelationType:j.FixedArguments,defaultValue:null,parent:null}}static fromGenerationTarget(i,r,a){const c=a===void 0?r.addChangeSet(new S(r,x.sessionAuthor,B().toISOString(),r,!0,w.CreateFromGenerationTarget)):a,e=i.parent?ie(i.parent):null,f=e?r.get(e):null,h=i.parentRelationType===j.FixedArguments?f==null?void 0:f.inputs.length:null,m={id:i.id,version:x.UUID.uuid(),createdAt:(c==null?void 0:c.timestamp)||B().toISOString(),author:(c==null?void 0:c.author)||x.sessionAuthor,previousVersion:null,deleted:!1,name:i.name,deletable:!0,editable:!0,type:d.ValueDescriptor,index:h||0,codeName:i.codeName,description:i.description,required:i.required,defaultValue:null,parentRelationType:i.parentRelationType,dataType:null,parent:(f==null?void 0:f.toReference())||null},E=Ie(m,r);return E.hydrateAncestors(),f&&E.setParent(f,null),E.addSelfToProject(c),c==null||c.add(E,H.Added),E.initChildren(c),c||E.captureVersion(),E}static validateGenerationTarget(i,r){let a=JSON.parse(JSON.stringify(i));const c=[],e=[],f=Mn(a,{parent:{list:!1,types:hi.USER_MANAGED_PARENT_TYPES}},r);c.push(...f.explanations),a=f.modifiedData;const h=tn(a);e.push(...f.errors,...h.errors),c.push(...h.explanations);const m=a.parent&&r.get(a.parent),E=m&&cu(m);return E&&E.type===d.ActionDescriptor&&e.push(new we({id:`${i.id}--${Te.BuiltInEntityParent}`,code:Te.BuiltInEntityParent,severity:ve.Error,message:`Entity of type "${i.type}" with id "${i.id}", has a parent that is a built-in entity "${E.name}" of type '${E.type}' with id '${E.id}'.
|
|
122
122
|
You can't modify system entities that are built-in.`})),m&&m.type===d.ActionDescriptor&&(!a.parentRelationType||!(a.parentRelationType===j.FixedArguments||a.parentRelationType===j.ReturnedError||a.parentRelationType===j.DynamicArgument))&&e.push(new we({id:`${i.id}--${Te.InvalidParentRelationType}`,code:Te.InvalidParentRelationType,severity:ve.Error,message:`The entity with id '${i.id}' and type '${i.type}', must have a 'parentRelationType' property set to either '${j.FixedArguments}' or '${j.ReturnedError}' when being added as a child to an entity of type 'action-descriptor'.`})),{errors:e,explanations:c,modifiedData:a}}get codeNativeValueValidation(){return this._codeNativeValueValidation||null}validateGeneratedUpdate(i){return{errors:[],explanations:[],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 S(this.project,x.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(){var i,r,a;return(a=(r=(i=this.dataType)==null?void 0:i.entity)==null?void 0:r.unsubscribeDependents)==null||a.call(r,[{entity:this,field:"data-type-entity"}]),this}subscribeToDependencies(){var i,r,a;return(a=(r=(i=this.dataType)==null?void 0:i.entity)==null?void 0:r.subscribeDependents)==null||a.call(r,[{entity:this,field:"data-type-entity"}]),this}increaseVersion(i){var r;if(this.project.diggestedBuiltInBaseEntitiesIds.has(this.id))return this;if(i&&!B(i).isValid())throw new Error(`The shared timestamp '${i}' is not a valid ISO 8601 date string.`);if(i&&B(i).isSame(B(this.createdAt)))return this;if(!((r=this.knownVersions)!=null&&r.has(this.version))&&this.project.initialized)throw new Error(`The current ${this.type} ${this.id} version '${this.version}' is not captured in the 'knownVersions' map. Capture the current version before increasing it to avoid losing data.`);if(!this.activeVersion)throw new Error(`Only active versions can be increased. Entity with id '${this.id}' and version '${this.version}' is not active.`);return this.previousVersion=this.version,this.version=x.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 hi(this,this.project);if(!this.activeVersion)throw new Error(`Only active versions can be captured. Entity of type ${this.type} with id '${this.id}' and version '${this.version}' is not active.`);if(this.version!==i.version)throw new Error(`Captured ${this.type} with id '${this.id}', version '${i.version}' does not match current entity version '${this.version}'.`);return this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,i):new Map().set(this.version,i),this.apply(i),this}snapshot(){const i=new hi(this,this.project);return this.apply(i)}apply(i){const r=this.toMeta();return i.metaSync(r,null),i.defaultValue=this.defaultValue,i.dataType=this.dataType,i.parent=this.parent,i}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,r){var m;const a=[],c=[],e=[],f=[];if(this.version===i&&(r!=null&&r.skipIfSameVersion))return{updated:C(a),added:C(c),removed:C(e),affected:C(f),self:this};if(!this.knownVersions){const E=new Map;for(const[b,A]of this.knownVersions||new Map){if(E.set(b,A),A.activeVersion=!1,A.knownVersions)for(const[_,P]of A.knownVersions)E.set(_,P);A.knownVersions=null}}let h=(m=this.knownVersions)==null?void 0:m.get(i);if(!h){const E=await this.APILoadVersion({},i);if(!E)throw new Error(`Version with id '${i}' for entity with id '${this.id}' not found.`);h=new hi(E,this.project)}return this.metaSync(h.toShallowJSON(),null),this.previousVersion=h.previousVersion,this.version=h.version,this.createdAt=h.createdAt,this.author=h.author,this.deleted=h.deleted,this.defaultValue=h.defaultValue,this.dataType=h.dataType,this.parent=h.parent,{updated:C(a),added:C(c),removed:C(e),affected:C(f),self:this}}updateWithShallowTransfer(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.UpdateWithShallowTransfer))){if(!this.checkCanEdit(this,r))return J.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=ie(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.dataType){const a=ie(i.dataType),c=this.project.get(a);c&&this.setDataType(c,r)}else this.setDataType(null,r);if(i.defaultValue){const a=ie(i.defaultValue),c=this.project.get(a);c&&this.setDefaultValue(c,r)}else this.setDefaultValue(null,r);return this.captureVersion(),this.subscribeToDependencies(),r==null||r.attemptAutoclose(w.UpdateWithShallowTransfer,this.id),this}updateWithGenerationTarget(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.UpdateWithGenerationTarget))){if(!this.checkCanEdit(this,r))return J.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=ie(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.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=ie(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 S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.AfterAllChildrenInitialized))){var f;if(!this.checkCanEdit(this,i))return J.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.defaultValue&&!this.project.diggestedBuiltInBaseEntitiesIds.has(this.id)&&this.project.diggestedBuiltInBaseEntitiesIds.has(this.defaultValue.id)){const h=this.defaultValue.clone(i,this);this.setDefaultValue(h,i)}if(((f=this.parent)==null?void 0:f.type)===d.Search){const h=this.parent.inputs.find(m=>{var E;return((E=m.declaration)==null?void 0:E.id)===this.id});h!=null&&h.readsValue&&this.setDefaultValue(null,i)}return this.initialized=!0,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 S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"add-self-to-project"))){var f,h,m;const r=[this],a=[],c=[],e=[];return this.parentRelationType===j.FixedArguments||this.parentRelationType===j.DynamicArgument?((f=this.parent)==null?void 0:f.type)===d.Search?(this.parent.addInputDeclaration(this,i),e.push(this.parent)):((m=(h=this.parent)==null?void 0:h.addInput)==null||m.call(h,this,i),r.push(this.parent)):this.parentRelationType===j.ReturnedError&&this.parent&&(this.parent.error=this,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 S(this.project,x.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,H.Updated))),r==null||r.attemptAutoclose(w.SetParent,this.id),this):this}initChildren(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"init-children"))){return this.initialized||this.startedInitialization?this:(this.startedInitialization=!0,this.initialData.defaultValue&&(this.defaultValue=Ie(this.initialData.defaultValue,this.project),this.defaultValue.setParent(this,null),this.defaultValue.initChildren(i)),this.initialData.dataType&&(this.dataType=Ie(this.initialData.dataType,this.project),this.dataType.setParent(this,null),this.dataType.initChildren(i)),this.subscribeToDependencies(),this.afterAllChildrenInitialized(i),i==null||i.attemptAutoclose("init-children",this.id),this)}subscribe(){var i;return this.activeVersion=!0,(i=this.knownVersions)==null||i.forEach(r=>{r.version!==this.version&&(r.activeVersion=!1)}),this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"meta-sync"))){const a=nn(this,i,r),c=rn(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,this.index=a.index||(a.index!==0?e.index:0),this.required=a.required!==void 0?a.required:this.required,this.parentRelationType=a.parentRelationType!==void 0?a.parentRelationType:this.parentRelationType,super.baseMetaSync(a,this,r),a.deleted===!0&&!e.deleted?r==null||r.add(this,H.Removed):a.deleted===!1&&e.deleted?r==null||r.add(this,H.Added):c&&(r==null||r.add(this,H.Updated)),r==null||r.attemptAutoclose("meta-sync",this.id),this}async APILoad(i=Ze,...r){return await hi.repository.APILoad(this.id,...r),this}async APICreate(i=Ze,...r){return await hi.repository.APICreate(this.toShallowJSON(),...r),this}async APIUpdate(i=Ze,...r){return await hi.repository.APIUpdate(this.toShallowJSON(),...r),this}async APIDelete(i=Ze,...r){return await hi.repository.APIDelete(this.toShallowJSON(),...r),this}async APIClone(i=Ze,...r){return await hi.repository.APIClone(this.id,...r),this}async APILoadVersion(i=Ze,r,...a){return await hi.repository.APILoadVersion(this.id,r,...a)}removeFromParent(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RemoveFromParent))){var f,h,m;if(!this.checkCanEdit(this,i))return J.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&&(((f=this.parent)==null?void 0:f.type)===d.Search?this.parentRelationType===j.FixedArguments||this.parentRelationType===j.DynamicArgument?((h=this.parent)==null||h.removeInputDeclaration(this,i),e.push(this.parent)):this.parentRelationType===j.ReturnedError&&(this.parent.error=null,e.push(this.parent)):(this.parentRelationType===j.FixedArguments||this.parentRelationType===j.DynamicArgument)&&((m=this.parent)==null||m.removeInput(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 S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RemoveEntity))){var h;if(!this.checkCanDelete(this,r))return J.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}--${Me.ActionOwnerEntityNonDeletable}`,action:w.RemoveEntity,owner:this,errorReason:Me.ActionOwnerEntityNonDeletable,rootAction:((h=r==null?void 0:r.self)==null?void 0:h.id)===this.id&&(r==null?void 0:r.actionName)===w.RemoveEntity}),r==null||r.attemptAutoclose(w.RemoveEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const a=[],c=[],e=[],f=[];if(this.project.diggestedBuiltInBaseEntitiesIds.has(this.id))return r==null||r.attemptAutoclose(w.RemoveEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};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:A}=m.entity.onDetachedDependencyRemoved(this,m.field,r);a.push(...E),c.push(...b),e.push(...A)}),this.defaultValue){const{updated:m,removed:E}=this.defaultValue.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(!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 S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RestoreEntity))){var f,h,m;if(!this.checkCanEdit(this,i))return J.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(E=>{const{updated:b,removed:A,added:_}=E.entity.onDetachedDependencyRestored(this,E.field,i);a.push(...b),c.push(...A),r.push(..._)}),this.defaultValue){const{updated:E}=this.defaultValue.restore({},i);a.push(...E)}if(this.dataType){const{updated:E}=this.dataType.restore({},i);a.push(...E)}return((f=this.parent)==null?void 0:f.type)===d.Search?(this.parentRelationType===j.FixedArguments||this.parentRelationType===j.DynamicArgument)&&((h=this.parent)==null||h.addInputDeclaration(this,i)):(this.parentRelationType===j.FixedArguments||this.parentRelationType===j.DynamicArgument)&&((m=this.parent)==null||m.addInput(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){var a;return i.has(this.id)?[]:(i.add(this.id),[this,...((a=this.defaultValue)==null?void 0:a.toFlat(i))||[],...this.dataType?this.dataType.toFlat(i):[]])}toFlatIds(i=new Set){var a;return i.has(this.id)?[]:(i.add(this.id),[this.id,...((a=this.defaultValue)==null?void 0:a.toFlatIds(i))||[],...this.dataType?this.dataType.toFlatIds(i):[]])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,codeName:this.codeName,description:this.description,index:this.index,required:this.required,parentRelationType:this.parentRelationType,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,index:this.index,required:this.required,defaultValue:((r=this.defaultValue)==null?void 0:r.toJSON(i))||null,parentRelationType:this.parentRelationType,dataType:((a=this.dataType)==null?void 0:a.toJSON(i))||null,parent:((c=this.parent)==null?void 0:c.toReference())||null})}toJSONClone(i=at){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||un(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:x.UUID.uuid(),createdAt:i.timestamp||B().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,type:this.type,editable:this.editable,deletable:this.deletable,name:this.name,codeName:this.codeName,description:this.description,index:this.index,required:this.required,defaultValue:((m=this.defaultValue)==null?void 0:m.toJSONClone({...i,newId:null}))||null,parentRelationType:this.parentRelationType,dataType:((E=this.dataType)==null?void 0:E.toJSONClone({...i,newId:null}))||null,parent:((b=this.parent)==null?void 0:b.toReference({seenEntityMaps:i.seenEntityMaps}))||null})}toReference(i=at){var a;let r=this.id;return(a=i.seenEntityMaps)!=null&&a.has(this.id)&&(r=i.seenEntityMaps.get(this.id)),{id:r+"--"+x.UUID.uuid()+"--ref",type:d.GenericReference,entityId:r,version:this.version,entityType:this.type}}toShallowJSON(i=at){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,index:this.index,required:this.required,parentRelationType:this.parentRelationType,defaultValue:((c=this.defaultValue)==null?void 0:c.toReference(i))||null,dataType:((e=this.dataType)==null?void 0:e.toReference(i))||null,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.defaultValue)==null?void 0:a.toFlatJSON(i))||[],...this.dataType?this.dataType.toFlatJSON(i):[]])}toGenerationTarget(i=at){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,required:this.required,parentRelationType:this.parentRelationType,parent:(c=this.parent)==null?void 0:c.id}}toFlatGenerationTarget(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this.toGenerationTarget(),...this.defaultValue?this.defaultValue.toFlatGenerationTarget(i):[],...this.dataType?this.dataType.toFlatGenerationTarget(i):[]])}clearErrors(){var i,r;return this.errors=[],(i=this.defaultValue)==null||i.clearErrors(),(r=this.dataType)==null||r.clearErrors(),this}validate(){return this.errors=aGe(this),{success:!0}}async validateAsync(i={}){const r=J.YieldTracker.from(i);return this.errors=await nGe(this,{tracker:r}),{success:!0}}getErrors(){return[...this.errors,...this.dataType?this.dataType.getErrors():[]]}async getErrorsAsync(i={}){const r=J.YieldTracker.from(i),a=[...this.errors];if(await r.tick(),this.dataType){const c=await this.dataType.getErrorsAsync({tracker:r});a.push(...c)}return a}getShallowErrors(){return this.errors}clone(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.CloneEntity)),r=null,a=null,c=!0){var A,_;if(this.project.diggestedBuiltInBaseEntitiesIds.has(this.id))return this;const e=Kr(r,this),f=a||x.UUID.uuid(),h=this.toJSON();h.id=f,h.version=x.UUID.uuid(),h.createdAt=(i==null?void 0:i.timestamp)||B().toISOString(),h.author=(i==null?void 0:i.author)||"1",h.previousVersion=null,h.deleted=!1,h.deletable=!0,h.editable=!0;const m=lr(h,e);r&&m.setParent(r,i),i==null||i.add(m,H.Added),c&&m.subscribe();const E=((A=this.dataType)==null?void 0:A.clone(i,m,x.UUID.uuid(),c))||null;E&&m.setDataType(E,i);const b=(_=this.defaultValue)==null?void 0:_.clone(i,m,x.UUID.uuid(),c);return m.defaultValue=b||null,i||m.captureVersion(),i==null||i.attemptAutoclose(w.CloneEntity,this.id),m}getDataType(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"get-data-type"))){return i==null||i.attemptAutoclose("get-data-type",this.id),this.dataType||null}setDataType(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.SetDataType))){if(!this.checkCanEdit(this,r))return J.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,H.Affected)),r==null||r.attemptAutoclose(w.SetDataType,this.id),this}getDefaultValue(){return this.defaultValue||null}setDefaultValue(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"set-default-value"))){var c;if(!this.checkCanEdit(this,r))return J.Logger.warn(`[setDefaultValue] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose("set-default-value",this.id),this;const a=this.defaultValue;if((a==null?void 0:a.id)!==(i==null?void 0:i.id)){if(a==null||a.remove({ignoreUpstream:!0},r),this.defaultValue=i,this.defaultValue&&((c=this.parent)==null?void 0:c.type)===d.Search){const e=this.parent.inputs.find(f=>f.declaration.id===this.id);if(e!=null&&e.readsValue){const f=e.readsValue;e.removeValueWriter(r),f==null||f.removeValueReader(e,r)}}r==null||r.add(this,H.Affected)}return r==null||r.attemptAutoclose("set-default-value",this.id),this}removeDataType(i=this.project.addChangeSet(new S(this.project,x.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,H.Affected),this.dataType=null),i==null||i.attemptAutoclose(w.RemoveDataType,this.id),this):(J.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)}implementAsInputMap(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"implement-as-input-map")),r,a){const c=Es.new(i);c.id=a||c.id,c.name=this.name,c.description=this.description,c.parent=r.toReference(),c.declaration=this.toJSON(),c.parentRelationType=this.parentRelationType===j.ReturnedError?od.Error:null;const e=lr(c,this.project);if(e.hydrateAncestors(),e.addSelfToProject(i),i==null||i.add(e,H.Added),e.initChildren(i),this.dataType){const f=this.dataType.clone(i,e);e.setDataType(f,i)}if(this.defaultValue){const f=this.defaultValue.clone(i,e);e.setDefaultValue(f,i)}return i||e.captureVersion(),i==null||i.attemptAutoclose("implement-as-input-map",this.id),e}implementAsArgumentDeclaration(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"implement-as-argument-declaration")),r,a){const c=Ha.new(i);c.id=a||c.id,c.name=this.name,c.description=this.description,c.parent=r.toReference(),c.implements=[this.toJSON()];const e=lr(c,this.project);if(e.hydrateAncestors(),e.addSelfToProject(i),i==null||i.add(e,H.Added),e.initChildren(i),this.dataType){const f=this.dataType.clone(i,e);e.setDataType(f,i)}if(this.defaultValue){const f=this.defaultValue.clone(i,e);e.setDefaultValue(f,i)}return i||e.captureVersion(),i==null||i.attemptAutoclose("implement-as-argument-declaration",this.id),e}};R(hi,"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(hi,"type",d.ValueDescriptor),R(hi,"USER_MANAGED_PARENT_TYPES",[d.ActionDescriptor,d.Search]),R(hi,"PARENT_TYPES",[...hi.USER_MANAGED_PARENT_TYPES]),R(hi,"MUTABLE_BASE_PROPERTIES",["name","codeName","description","required"]),R(hi,"INMUTABLE_BASE_PROPERTIES",["id","version","type","parentRelationType","createdAt","author","previousVersion"]),R(hi,"BASE_PROPERTIES",[...hi.MUTABLE_BASE_PROPERTIES,...hi.INMUTABLE_BASE_PROPERTIES]),R(hi,"MUTABLE_META_PROPERTIES",[...hi.MUTABLE_BASE_PROPERTIES,"index"]),R(hi,"INMUTABLE_META_PROPERTIES",[...hi.INMUTABLE_BASE_PROPERTIES]),R(hi,"META_PROPERTIES",[...hi.MUTABLE_META_PROPERTIES,...hi.INMUTABLE_META_PROPERTIES]),R(hi,"MUTABLE_UPSTREAM_PROPERTIES",[]),R(hi,"INMUTABLE_UPSTREAM_PROPERTIES",["parent"]),R(hi,"UPSTREAM_PROPERTIES",[...hi.MUTABLE_UPSTREAM_PROPERTIES,...hi.INMUTABLE_UPSTREAM_PROPERTIES]),R(hi,"MUTABLE_DOWNSTREAM_PROPERTIES",["dataType","defaultValue"]),R(hi,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),R(hi,"DOWNSTREAM_PROPERTIES",[...hi.MUTABLE_DOWNSTREAM_PROPERTIES,...hi.INMUTABLE_DOWNSTREAM_PROPERTIES]),R(hi,"PROPERTIES",[...hi.META_PROPERTIES,...hi.UPSTREAM_PROPERTIES,...hi.DOWNSTREAM_PROPERTIES]);let vd=hi;var Ep={},lGe={},oGe={};Object.defineProperty(oGe,"__esModule",{value:!0});var dGe={};Object.defineProperty(dGe,"__esModule",{value:!0});var uGe={};Object.defineProperty(uGe,"__esModule",{value:!0});var pGe={};Object.defineProperty(pGe,"__esModule",{value:!0});var cGe={};Object.defineProperty(cGe,"__esModule",{value:!0});var fGe={};Object.defineProperty(fGe,"__esModule",{value:!0});var yGe={};Object.defineProperty(yGe,"__esModule",{value:!0});var hGe={};Object.defineProperty(hGe,"__esModule",{value:!0});var mGe={};Object.defineProperty(mGe,"__esModule",{value:!0});var TGe={};Object.defineProperty(TGe,"__esModule",{value:!0});var vGe={};Object.defineProperty(vGe,"__esModule",{value:!0});var EGe={};Object.defineProperty(EGe,"__esModule",{value:!0});var bGe={};Object.defineProperty(bGe,"__esModule",{value:!0});var AGe={};Object.defineProperty(AGe,"__esModule",{value:!0});var gGe={};Object.defineProperty(gGe,"__esModule",{value:!0});var IGe={};Object.defineProperty(IGe,"__esModule",{value:!0});var RGe={};Object.defineProperty(RGe,"__esModule",{value:!0});var DGe={};Object.defineProperty(DGe,"__esModule",{value:!0});var wGe={};Object.defineProperty(wGe,"__esModule",{value:!0});var CGe={};Object.defineProperty(CGe,"__esModule",{value:!0});var OGe={};Object.defineProperty(OGe,"__esModule",{value:!0});var _Ge={};Object.defineProperty(_Ge,"__esModule",{value:!0});var VGe={};Object.defineProperty(VGe,"__esModule",{value:!0});var PGe={};Object.defineProperty(PGe,"__esModule",{value:!0});var NGe={};Object.defineProperty(NGe,"__esModule",{value:!0});var xGe={};Object.defineProperty(xGe,"__esModule",{value:!0});var $Ge={};Object.defineProperty($Ge,"__esModule",{value:!0});var LGe={};Object.defineProperty(LGe,"__esModule",{value:!0});var BGe={};Object.defineProperty(BGe,"__esModule",{value:!0});var MGe={};Object.defineProperty(MGe,"__esModule",{value:!0});var GGe={};Object.defineProperty(GGe,"__esModule",{value:!0});var kGe={};Object.defineProperty(kGe,"__esModule",{value:!0});var jGe={};Object.defineProperty(jGe,"__esModule",{value:!0});var UGe={};Object.defineProperty(UGe,"__esModule",{value:!0});var FGe={};Object.defineProperty(FGe,"__esModule",{value:!0});var KGe={};Object.defineProperty(KGe,"__esModule",{value:!0});var qGe={};Object.defineProperty(qGe,"__esModule",{value:!0});var SGe={};Object.defineProperty(SGe,"__esModule",{value:!0});var ZGe={};Object.defineProperty(ZGe,"__esModule",{value:!0});var HGe={};Object.defineProperty(HGe,"__esModule",{value:!0});var WGe={};Object.defineProperty(WGe,"__esModule",{value:!0});var zGe={};Object.defineProperty(zGe,"__esModule",{value:!0});var YGe={};Object.defineProperty(YGe,"__esModule",{value:!0});(function(s){var p=Xr&&Xr.__createBinding||(Object.create?function(r,a,c,e){e===void 0&&(e=c);var f=Object.getOwnPropertyDescriptor(a,c);(!f||("get"in f?!a.__esModule:f.writable||f.configurable))&&(f={enumerable:!0,get:function(){return a[c]}}),Object.defineProperty(r,e,f)}:function(r,a,c,e){e===void 0&&(e=c),r[e]=a[c]}),i=Xr&&Xr.__exportStar||function(r,a){for(var c in r)c!=="default"&&!Object.prototype.hasOwnProperty.call(a,c)&&p(a,r,c)};Object.defineProperty(s,"__esModule",{value:!0}),i(oGe,s),i(dGe,s),i(uGe,s),i(pGe,s),i(cGe,s),i(fGe,s),i(yGe,s),i(hGe,s),i(mGe,s),i(TGe,s),i(vGe,s),i(EGe,s),i(bGe,s),i(AGe,s),i(gGe,s),i(IGe,s),i(RGe,s),i(DGe,s),i(wGe,s),i(CGe,s),i(OGe,s),i(_Ge,s),i(VGe,s),i(PGe,s),i(NGe,s),i(xGe,s),i($Ge,s),i(LGe,s),i(BGe,s),i(MGe,s),i(GGe,s),i(kGe,s),i(jGe,s),i(UGe,s),i(FGe,s),i(KGe,s),i(qGe,s),i(SGe,s),i(ZGe,s),i(HGe,s),i(WGe,s),i(zGe,s),i(YGe,s)})(lGe);var JGe={},wa={};Object.defineProperty(wa,"__esModule",{value:!0});wa.isObject=wa.isString=wa.isDefined=wa.last=wa.identity=void 0;const mDi=s=>s;wa.identity=mDi;const TDi=s=>s[s.length-1];wa.last=TDi;const vDi=s=>s!==void 0;wa.isDefined=vDi;const EDi=s=>typeof s=="string";wa.isString=EDi;const bDi=s=>typeof s=="object"&&s!==null&&!(s instanceof Array);wa.isObject=bDi;(function(s){Object.defineProperty(s,"__esModule",{value:!0}),s.cstVisitor=s.VisitorAction=void 0;const p=wa;var i;(function(c){c[c.SKIP=1]="SKIP"})(i=s.VisitorAction||(s.VisitorAction={}));function r(c){const e=f=>{const h=c[f.type];if((h==null?void 0:h(f))!==i.SKIP)for(const E of Object.values(f))a(E)?e(E):E instanceof Array&&E.filter(a).forEach(b=>e(b))};return e}s.cstVisitor=r;const a=c=>(0,p.isObject)(c)&&(0,p.isString)(c.type)})(JGe);var xE={};Object.defineProperty(xE,"__esModule",{value:!0});xE.cstTransformer=void 0;function ADi(s){return p=>{const i=s[p.type];if(!i)throw p.type?new Error(`No transform map entry for ${p.type}`):new Error(`No type field on node: ${JSON.stringify(p)}`);return i(p)}}xE.cstTransformer=ADi;var QGe={},$E={};Object.defineProperty($E,"__esModule",{value:!0});$E.bigqueryKeywords=void 0;$E.bigqueryKeywords={ALL:!0,AND:!0,ANY:!0,ARRAY:!0,AS:!0,ASC:!0,ASSERT_ROWS_MODIFIED:!0,AT:!0,BETWEEN:!0,BY:!0,CASE:!0,CAST:!0,COLLATE:!0,CONTAINS:!0,CREATE:!0,CROSS:!0,CUBE:!0,CURRENT:!0,DEFAULT:!0,DEFINE:!0,DESC:!0,DISTINCT:!0,ELSE:!0,END:!0,ENUM:!0,ESCAPE:!0,EXCEPT:!0,EXCLUDE:!0,EXISTS:!0,EXTRACT:!0,FALSE:!0,FETCH:!0,FOLLOWING:!0,FOR:!0,FROM:!0,FULL:!0,GROUP:!0,GROUPING:!0,GROUPS:!0,HASH:!0,HAVING:!0,IF:!0,IGNORE:!0,IN:!0,INNER:!0,INTERSECT:!0,INTERVAL:!0,INTO:!0,IS:!0,JOIN:!0,LATERAL:!0,LEFT:!0,LIKE:!0,LIMIT:!0,LOOKUP:!0,MERGE:!0,NATURAL:!0,NEW:!0,NO:!0,NOT:!0,NULL:!0,NULLS:!0,OF:!0,ON:!0,OR:!0,ORDER:!0,OUTER:!0,OVER:!0,PARTITION:!0,PRECEDING:!0,PROTO:!0,QUALIFY:!0,RANGE:!0,RECURSIVE:!0,RESPECT:!0,RIGHT:!0,ROLLUP:!0,ROWS:!0,SELECT:!0,SET:!0,SOME:!0,STRUCT:!0,TABLESAMPLE:!0,THEN:!0,TO:!0,TREAT:!0,TRUE:!0,UNBOUNDED:!0,UNION:!0,UNNEST:!0,USING:!0,WHEN:!0,WHERE:!0,WINDOW:!0,WITH:!0,WITHIN:!0};var LE={};Object.defineProperty(LE,"__esModule",{value:!0});LE.mariadbKeywords=void 0;LE.mariadbKeywords={ACCESSIBLE:!0,ADD:!0,ALL:!0,ALTER:!0,ANALYZE:!0,AND:!0,AS:!0,ASC:!0,ASENSITIVE:!0,BEFORE:!0,BETWEEN:!0,BIGINT:!0,BINARY:!0,BLOB:!0,BOTH:!0,BY:!0,CALL:!0,CASCADE:!0,CASE:!0,CHANGE:!0,CHAR:!0,CHARACTER:!0,CHECK:!0,COLLATE:!0,COLUMN:!0,CONDITION:!0,CONSTRAINT:!0,CONTINUE:!0,CONVERT:!0,CREATE:!0,CROSS:!0,CURRENT_DATE:!0,CURRENT_ROLE:!0,CURRENT_TIME:!0,CURRENT_TIMESTAMP:!0,CURRENT_USER:!0,CURSOR:!0,DATABASE:!0,DATABASES:!0,DAY_HOUR:!0,DAY_MICROSECOND:!0,DAY_MINUTE:!0,DAY_SECOND:!0,DEC:!0,DECIMAL:!0,DECLARE:!0,DEFAULT:!0,DELAYED:!0,DELETE:!0,DELETE_DOMAIN_ID:!0,DESC:!0,DESCRIBE:!0,DETERMINISTIC:!0,DISTINCT:!0,DISTINCTROW:!0,DIV:!0,DO_DOMAIN_IDS:!0,DOUBLE:!0,DROP:!0,DUAL:!0,EACH:!0,ELSE:!0,ELSEIF:!0,ENCLOSED:!0,ESCAPED:!0,EXCEPT:!0,EXISTS:!0,EXIT:!0,EXPLAIN:!0,FALSE:!0,FETCH:!0,FLOAT:!0,FLOAT4:!0,FLOAT8:!0,FOR:!0,FORCE:!0,FOREIGN:!0,FROM:!0,FULLTEXT:!0,GENERAL:!0,GRANT:!0,GROUP:!0,HAVING:!0,HIGH_PRIORITY:!0,HOUR_MICROSECOND:!0,HOUR_MINUTE:!0,HOUR_SECOND:!0,IF:!0,IGNORE:!0,IGNORE_DOMAIN_IDS:!0,IGNORE_SERVER_IDS:!0,IN:!0,INDEX:!0,INFILE:!0,INNER:!0,INOUT:!0,INSENSITIVE:!0,INSERT:!0,INT:!0,INT1:!0,INT2:!0,INT3:!0,INT4:!0,INT8:!0,INTEGER:!0,INTERSECT:!0,INTERVAL:!0,INTO:!0,IS:!0,ITERATE:!0,JOIN:!0,KEY:!0,KEYS:!0,KILL:!0,LEADING:!0,LEAVE:!0,LEFT:!0,LIKE:!0,LIMIT:!0,LINEAR:!0,LINES:!0,LOAD:!0,LOCALTIME:!0,LOCALTIMESTAMP:!0,LOCK:!0,LONG:!0,LONGBLOB:!0,LONGTEXT:!0,LOOP:!0,LOW_PRIORITY:!0,MASTER_HEARTBEAT_PERIOD:!0,MASTER_SSL_VERIFY_SERVER_CERT:!0,MATCH:!0,MAXVALUE:!0,MEDIUMBLOB:!0,MEDIUMINT:!0,MEDIUMTEXT:!0,MIDDLEINT:!0,MINUTE_MICROSECOND:!0,MINUTE_SECOND:!0,MOD:!0,MODIFIES:!0,NATURAL:!0,NOT:!0,NO_WRITE_TO_BINLOG:!0,NULL:!0,NUMERIC:!0,OFFSET:!0,ON:!0,OPTIMIZE:!0,OPTION:!0,OPTIONALLY:!0,OR:!0,ORDER:!0,OUT:!0,OUTER:!0,OUTFILE:!0,OVER:!0,PAGE_CHECKSUM:!0,PARSE_VCOL_EXPR:!0,PARTITION:!0,POSITION:!0,PRECISION:!0,PRIMARY:!0,PROCEDURE:!0,PURGE:!0,RANGE:!0,READ:!0,READS:!0,READ_WRITE:!0,REAL:!0,RECURSIVE:!0,REF_SYSTEM_ID:!0,REFERENCES:!0,REGEXP:!0,RELEASE:!0,RENAME:!0,REPEAT:!0,REPLACE:!0,REQUIRE:!0,RESIGNAL:!0,RESTRICT:!0,RETURN:!0,RETURNING:!0,REVOKE:!0,RIGHT:!0,RLIKE:!0,ROWS:!0,SCHEMA:!0,SCHEMAS:!0,SECOND_MICROSECOND:!0,SELECT:!0,SENSITIVE:!0,SEPARATOR:!0,SET:!0,SHOW:!0,SIGNAL:!0,SLOW:!0,SMALLINT:!0,SPATIAL:!0,SPECIFIC:!0,SQL:!0,SQLEXCEPTION:!0,SQLSTATE:!0,SQLWARNING:!0,SQL_BIG_RESULT:!0,SQL_CALC_FOUND_ROWS:!0,SQL_SMALL_RESULT:!0,SSL:!0,STARTING:!0,STATS_AUTO_RECALC:!0,STATS_PERSISTENT:!0,STATS_SAMPLE_PAGES:!0,STRAIGHT_JOIN:!0,TABLE:!0,TERMINATED:!0,THEN:!0,TINYBLOB:!0,TINYINT:!0,TINYTEXT:!0,TO:!0,TRAILING:!0,TRIGGER:!0,TRUE:!0,UNDO:!0,UNION:!0,UNIQUE:!0,UNLOCK:!0,UNSIGNED:!0,UPDATE:!0,USAGE:!0,USE:!0,USING:!0,UTC_DATE:!0,UTC_TIME:!0,UTC_TIMESTAMP:!0,VALUES:!0,VARBINARY:!0,VARCHAR:!0,VARCHARACTER:!0,VARYING:!0,WHEN:!0,WHERE:!0,WHILE:!0,WINDOW:!0,WITH:!0,WRITE:!0,XOR:!0,YEAR_MONTH:!0,ZEROFILL:!0};var BE={};Object.defineProperty(BE,"__esModule",{value:!0});BE.mysqlKeywords=void 0;BE.mysqlKeywords={ACCESSIBLE:!0,ADD:!0,ALL:!0,ALTER:!0,ANALYZE:!0,AND:!0,AS:!0,ASC:!0,ASENSITIVE:!0,BEFORE:!0,BETWEEN:!0,BIGINT:!0,BINARY:!0,BLOB:!0,BOTH:!0,BY:!0,CALL:!0,CASCADE:!0,CASE:!0,CHANGE:!0,CHAR:!0,CHARACTER:!0,CHECK:!0,COLLATE:!0,COLUMN:!0,CONDITION:!0,CONSTRAINT:!0,CONTINUE:!0,CONVERT:!0,CREATE:!0,CROSS:!0,CUBE:!0,CUME_DIST:!0,CURRENT_DATE:!0,CURRENT_TIME:!0,CURRENT_TIMESTAMP:!0,CURRENT_USER:!0,CURSOR:!0,DATABASE:!0,DATABASES:!0,DAY_HOUR:!0,DAY_MICROSECOND:!0,DAY_MINUTE:!0,DAY_SECOND:!0,DEC:!0,DECIMAL:!0,DECLARE:!0,DEFAULT:!0,DELAYED:!0,DELETE:!0,DENSE_RANK:!0,DESC:!0,DESCRIBE:!0,DETERMINISTIC:!0,DISTINCT:!0,DISTINCTROW:!0,DIV:!0,DOUBLE:!0,DROP:!0,DUAL:!0,EACH:!0,ELSE:!0,ELSEIF:!0,EMPTY:!0,ENCLOSED:!0,ESCAPED:!0,EXCEPT:!0,EXISTS:!0,EXIT:!0,EXPLAIN:!0,FALSE:!0,FETCH:!0,FIRST_VALUE:!0,FLOAT:!0,FLOAT4:!0,FLOAT8:!0,FOR:!0,FORCE:!0,FOREIGN:!0,FROM:!0,FULLTEXT:!0,FUNCTION:!0,GENERATED:!0,GET:!0,GRANT:!0,GROUP:!0,GROUPING:!0,GROUPS:!0,HAVING:!0,HIGH_PRIORITY:!0,HOUR_MICROSECOND:!0,HOUR_MINUTE:!0,HOUR_SECOND:!0,IF:!0,IGNORE:!0,IN:!0,INDEX:!0,INFILE:!0,INNER:!0,INOUT:!0,INSENSITIVE:!0,INSERT:!0,INT:!0,INT1:!0,INT2:!0,INT3:!0,INT4:!0,INT8:!0,INTEGER:!0,INTERSECT:!0,INTERVAL:!0,INTO:!0,IO_AFTER_GTIDS:!0,IO_BEFORE_GTIDS:!0,IS:!0,ITERATE:!0,JOIN:!0,JSON_TABLE:!0,KEY:!0,KEYS:!0,KILL:!0,LAG:!0,LAST_VALUE:!0,LATERAL:!0,LEAD:!0,LEADING:!0,LEAVE:!0,LEFT:!0,LIKE:!0,LIMIT:!0,LINEAR:!0,LINES:!0,LOAD:!0,LOCALTIME:!0,LOCALTIMESTAMP:!0,LOCK:!0,LONG:!0,LONGBLOB:!0,LONGTEXT:!0,LOOP:!0,LOW_PRIORITY:!0,MASTER_BIND:!0,MASTER_SSL_VERIFY_SERVER_CERT:!0,MATCH:!0,MAXVALUE:!0,MEDIUMBLOB:!0,MEDIUMINT:!0,MEDIUMTEXT:!0,MIDDLEINT:!0,MINUTE_MICROSECOND:!0,MINUTE_SECOND:!0,MOD:!0,MODIFIES:!0,NATURAL:!0,NOT:!0,NO_WRITE_TO_BINLOG:!0,NTH_VALUE:!0,NTILE:!0,NULL:!0,NUMERIC:!0,OF:!0,ON:!0,OPTIMIZE:!0,OPTIMIZER_COSTS:!0,OPTION:!0,OPTIONALLY:!0,OR:!0,ORDER:!0,OUT:!0,OUTER:!0,OUTFILE:!0,OVER:!0,PARTITION:!0,PERCENT_RANK:!0,PRECISION:!0,PRIMARY:!0,PROCEDURE:!0,PURGE:!0,RANGE:!0,RANK:!0,READ:!0,READS:!0,READ_WRITE:!0,REAL:!0,RECURSIVE:!0,REFERENCES:!0,REGEXP:!0,RELEASE:!0,RENAME:!0,REPEAT:!0,REPLACE:!0,REQUIRE:!0,RESIGNAL:!0,RESTRICT:!0,RETURN:!0,REVOKE:!0,RIGHT:!0,RLIKE:!0,ROW:!0,ROWS:!0,ROW_NUMBER:!0,SCHEMA:!0,SCHEMAS:!0,SECOND_MICROSECOND:!0,SELECT:!0,SENSITIVE:!0,SEPARATOR:!0,SET:!0,SHOW:!0,SIGNAL:!0,SMALLINT:!0,SPATIAL:!0,SPECIFIC:!0,SQL:!0,SQLEXCEPTION:!0,SQLSTATE:!0,SQLWARNING:!0,SQL_BIG_RESULT:!0,SQL_CALC_FOUND_ROWS:!0,SQL_SMALL_RESULT:!0,SSL:!0,STARTING:!0,STORED:!0,STRAIGHT_JOIN:!0,SYSTEM:!0,TABLE:!0,TERMINATED:!0,THEN:!0,TINYBLOB:!0,TINYINT:!0,TINYTEXT:!0,TO:!0,TRAILING:!0,TRIGGER:!0,TRUE:!0,UNDO:!0,UNION:!0,UNIQUE:!0,UNLOCK:!0,UNSIGNED:!0,UPDATE:!0,USAGE:!0,USE:!0,USING:!0,UTC_DATE:!0,UTC_TIME:!0,UTC_TIMESTAMP:!0,VALUES:!0,VARBINARY:!0,VARCHAR:!0,VARCHARACTER:!0,VARYING:!0,VIRTUAL:!0,WHEN:!0,WHERE:!0,WHILE:!0,WINDOW:!0,WITH:!0,WRITE:!0,XOR:!0,YEAR_MONTH:!0,ZEROFILL:!0};var ME={};Object.defineProperty(ME,"__esModule",{value:!0});ME.sqliteKeywords=void 0;ME.sqliteKeywords={ABORT:!0,ACTION:!0,ADD:!0,AFTER:!0,ALL:!0,ALTER:!0,ALWAYS:!0,ANALYZE:!0,AND:!0,AS:!0,ASC:!0,ATTACH:!0,AUTOINCREMENT:!0,BEFORE:!0,BEGIN:!0,BETWEEN:!0,BY:!0,CASCADE:!0,CASE:!0,CAST:!0,CHECK:!0,COLLATE:!0,COMMIT:!0,CONFLICT:!0,CONSTRAINT:!0,CREATE:!0,CROSS:!0,CURRENT:!0,CURRENT_DATE:!0,CURRENT_TIME:!0,CURRENT_TIMESTAMP:!0,DATABASE:!0,DEFAULT:!0,DEFERRABLE:!0,DEFERRED:!0,DELETE:!0,DESC:!0,DETACH:!0,DISTINCT:!0,DO:!0,DROP:!0,EACH:!0,ELSE:!0,END:!0,ESCAPE:!0,EXCEPT:!0,EXCLUDE:!0,EXCLUSIVE:!0,EXISTS:!0,EXPLAIN:!0,FAIL:!0,FILTER:!0,FIRST:!0,FOLLOWING:!0,FOR:!0,FOREIGN:!0,FROM:!0,FULL:!0,GENERATED:!0,GLOB:!0,GROUP:!0,GROUPS:!0,HAVING:!0,IF:!0,IGNORE:!0,IMMEDIATE:!0,IN:!0,INDEX:!0,INDEXED:!0,INITIALLY:!0,INNER:!0,INSERT:!0,INSTEAD:!0,INTERSECT:!0,INTO:!0,IS:!0,ISNULL:!0,JOIN:!0,LAST:!0,LEFT:!0,LIKE:!0,LIMIT:!0,MATCH:!0,MATERIALIZED:!0,NATURAL:!0,NO:!0,NOT:!0,NOTHING:!0,NOTNULL:!0,NULL:!0,NULLS:!0,OF:!0,OFFSET:!0,ON:!0,OR:!0,ORDER:!0,OTHERS:!0,OUTER:!0,OVER:!0,PARTITION:!0,PLAN:!0,PRAGMA:!0,PRECEDING:!0,PRIMARY:!0,QUERY:!0,RAISE:!0,RANGE:!0,RECURSIVE:!0,REFERENCES:!0,REGEXP:!0,REINDEX:!0,RELEASE:!0,RENAME:!0,REPLACE:!0,RESTRICT:!0,RETURNING:!0,RIGHT:!0,ROLLBACK:!0,ROW:!0,ROWS:!0,SAVEPOINT:!0,SELECT:!0,SET:!0,TABLE:!0,TEMP:!0,TEMPORARY:!0,THEN:!0,TIES:!0,TO:!0,TRANSACTION:!0,TRIGGER:!0,UNBOUNDED:!0,UNION:!0,UNIQUE:!0,UPDATE:!0,USING:!0,VACUUM:!0,VALUES:!0,VIEW:!0,VIRTUAL:!0,WHEN:!0,WHERE:!0,WINDOW:!0,WITH:!0,WITHOUT:!0};var GE={};Object.defineProperty(GE,"__esModule",{value:!0});GE.postgresqlKeywords=void 0;GE.postgresqlKeywords={ALL:!0,ANALYSE:!0,ANALYZE:!0,AND:!0,ANY:!0,ARRAY:!0,AS:!0,ASC:!0,ASYMMETRIC:!0,AUTHORIZATION:!0,BOTH:!0,CASE:!0,CAST:!0,CHECK:!0,COLLATE:!0,COLUMN:!0,CONSTRAINT:!0,CREATE:!0,CROSS:!0,CURRENT_CATALOG:!0,CURRENT_DATE:!0,CURRENT_ROLE:!0,CURRENT_SCHEMA:!0,CURRENT_TIME:!0,CURRENT_TIMESTAMP:!0,CURRENT_USER:!0,DAY:!0,DEFAULT:!0,DEFERRABLE:!0,DESC:!0,DISTINCT:!0,DO:!0,ELSE:!0,END:!0,EXCEPT:!0,FALSE:!0,FETCH:!0,FILTER:!0,FOR:!0,FOREIGN:!0,FREEZE:!0,FROM:!0,FULL:!0,GRANT:!0,GROUP:!0,HAVING:!0,HOUR:!0,ILIKE:!0,IN:!0,INITIALLY:!0,INNER:!0,INTERSECT:!0,INTO:!0,IS:!0,ISNULL:!0,JOIN:!0,LATERAL:!0,LEADING:!0,LEFT:!0,LIKE:!0,LIMIT:!0,LOCALTIME:!0,LOCALTIMESTAMP:!0,MINUTE:!0,MONTH:!0,NATURAL:!0,NOT:!0,NOTNULL:!0,NULL:!0,OFFSET:!0,ON:!0,ONLY:!0,OR:!0,ORDER:!0,OUTER:!0,OVER:!0,OVERLAPS:!0,PLACING:!0,PRECISION:!0,PRIMARY:!0,REFERENCES:!0,RETURNING:!0,RIGHT:!0,SECOND:!0,SELECT:!0,SESSION_USER:!0,SIMILAR:!0,SOME:!0,SYMMETRIC:!0,SYSTEM_USER:!0,TABLE:!0,TABLESAMPLE:!0,THEN:!0,TO:!0,TRAILING:!0,TRUE:!0,UNION:!0,UNIQUE:!0,USER:!0,USING:!0,VARIADIC:!0,VARYING:!0,VERBOSE:!0,WHEN:!0,WHERE:!0,WINDOW:!0,WITH:!0,WITHIN:!0,WITHOUT:!0,YEAR:!0,SET:!0};(function(s){var p=Xr&&Xr.__createBinding||(Object.create?function(r,a,c,e){e===void 0&&(e=c);var f=Object.getOwnPropertyDescriptor(a,c);(!f||("get"in f?!a.__esModule:f.writable||f.configurable))&&(f={enumerable:!0,get:function(){return a[c]}}),Object.defineProperty(r,e,f)}:function(r,a,c,e){e===void 0&&(e=c),r[e]=a[c]}),i=Xr&&Xr.__exportStar||function(r,a){for(var c in r)c!=="default"&&!Object.prototype.hasOwnProperty.call(a,c)&&p(a,r,c)};Object.defineProperty(s,"__esModule",{value:!0}),i($E,s),i(LE,s),i(BE,s),i(ME,s),i(GE,s)})(QGe);var uv={};Object.defineProperty(uv,"__esModule",{value:!0});uv.FormattedSyntaxError=void 0;class gDi extends Error{constructor(p,i,r){super(IDi(p,i,r))}}uv.FormattedSyntaxError=gDi;function IDi(s,p,i){const r=s.location.start.line,a=s.location.start.column,c=p.split(/\r\n|\n|\r/)[r-1],e="".padStart(String(r).length),f=DDi(RDi(s.found,a,c)),h=wDi(s.expected);return`Syntax Error: Unexpected ${f}
|
|
123
123
|
Was expecting to see: ${h}
|
|
124
124
|
--> ${i||"undefined"}:${r}:${a}
|