@elyx-code/project-logic-tree 0.0.7220 → 0.0.7221

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -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:n,explanations:s,modifiedData:t}}subscribeDependents(t){return t.forEach(n=>{this.detachedDependents[n.entity.id]||(this.detachedDependents[n.entity.id]=n)}),this}unsubscribeDependents(t){return t.forEach(n=>{this.detachedDependents[n.entity.id]&&delete this.detachedDependents[n.entity.id]}),this}syncDependents(t=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,"sync-dependents"))){const n=[],s=[],u=[],e=[];return Object.values(this.detachedDependents).forEach(f=>{const y=f.entity.afterAllChildrenInitialized(t);n.push(...y.updated),s.push(...y.added),u.push(...y.removed),e.push(...y.affected)}),t==null||t.attemptAutoclose("sync-dependents",this.id),{updated:_(n),added:_(s),removed:_(u),affected:_(e),self:this}}onDetachedDependencyRemoved(t,n,s){const u=[],e=[],f=[],y=[];if(n==="loop-parent-field"){const{updated:m,added:T,removed:g}=this.remove({ignoreUpstream:!1},s);u.push(...m),e.push(...T),f.push(...g)}return{updated:_(u),added:_(e),removed:_(f),affected:_(y),self:this}}onDetachedDependencyRestored(t,n,s){const u=[],e=[],f=[],y=[];if(n==="loop-parent-field"){const{updated:m,added:T,removed:g}=this.restore({},s);u.push(...m),e.push(...T),f.push(...g)}return{updated:_(u),added:_(e),removed:_(f),affected:_(y),self:this}}unsubscribeFromDependencies(){var t,n,s,u,e,f,y,m,T,g,b,R,I;return(t=this.parent)==null||t.unsubscribeDependents([{entity:this,field:"loop-parent-field"}]),(u=(s=(n=this.dataType)==null?void 0:n.entity)==null?void 0:s.unsubscribeDependents)==null||u.call(s,[{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"}]),(g=(T=(m=(y=this.body)==null?void 0:y.dataType)==null?void 0:m.entity)==null?void 0:T.unsubscribeDependents)==null||g.call(T,[{entity:this,field:"loop-body-data-type-entity-field"}]),(I=(R=(b=this.body)==null?void 0:b.dataType)==null?void 0:R.unsubscribeDependents)==null||I.call(R,[{entity:this,field:"loop-body-data-type-field"}]),this}subscribeToDependencies(){var t,n,s,u,e,f,y,m,T,g,b,R,I;return(t=this.parent)==null||t.subscribeDependents([{entity:this,field:"loop-parent-field"}]),(u=(s=(n=this.dataType)==null?void 0:n.entity)==null?void 0:s.subscribeDependents)==null||u.call(s,[{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"}]),(g=(T=(m=(y=this.body)==null?void 0:y.dataType)==null?void 0:m.entity)==null?void 0:T.subscribeDependents)==null||g.call(T,[{entity:this,field:"loop-body-data-type-entity-field"}]),(I=(R=(b=this.body)==null?void 0:b.dataType)==null?void 0:R.subscribeDependents)==null||I.call(R,[{entity:this,field:"loop-body-data-type-field"}]),this}increaseVersion(t){var n;if(this.project.diggestedBuiltInBaseEntitiesIds.has(this.id))return this;if(t&&!j(t).isValid())throw new Error(`The shared timestamp '${t}' is not a valid ISO 8601 date string.`);if(t&&j(t).isSame(j(this.createdAt)))return this;if(!((n=this.knownVersions)!=null&&n.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=M.UUID.uuid(),this.createdAt=j(t).toISOString()||j().toISOString(),this}captureVersion(){var n;const t=((n=this.knownVersions)==null?void 0:n.get(this.version))||new Rn(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!==t.version)throw new Error(`Captured ${this.type} with id '${this.id}', version '${t.version}' does not match current entity version '${this.version}'.`);return this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,t):new Map().set(this.version,t),this.apply(t),this}snapshot(){const t=new Rn(this,this.project);return this.apply(t)}apply(t){const n=this.toMeta();return t.metaSync(n,null),t.inputs=[...this.inputs],t.outputs=[...this.outputs],t.error=this.error,t.successCalls=[...this.successCalls],t.errorCalls=[...this.errorCalls],t.declaration=this.declaration,t.body=this.body,t.calledByEntry=[...this.calledByEntry],t.calledBySuccess=[...this.calledBySuccess],t.calledByError=[...this.calledByError],t.writesValues=[...this.writesValues],t.dataType=this.dataType,t.parent=this.parent,t}recursiveCaptureUpstreamVersions(t){const n=[],s=[],u=[],e=[];if(this.parent){this.parent.increaseVersion(t);const f=this.parent.recursiveCaptureUpstreamVersions(t);n.push(this.parent,...f.updated),s.push(...f.added),u.push(...f.removed)}return{updated:_(n),added:_(s),removed:_(u),affected:_(e),self:this}}async restoreVersion(t,n){var m;const s=[],u=[],e=[],f=[];if(this.version===t&&(n!=null&&n.skipIfSameVersion))return{updated:_(s),added:_(u),removed:_(e),affected:_(f),self:this};if(!this.knownVersions){const T=new Map;for(const[g,b]of this.knownVersions||new Map){if(T.set(g,b),b.activeVersion=!1,b.knownVersions)for(const[R,I]of b.knownVersions)T.set(R,I);b.knownVersions=null}}let y=(m=this.knownVersions)==null?void 0:m.get(t);if(!y){const T=await this.APILoadVersion({},t);if(!T)throw new Error(`Version with id '${t}' for entity with id '${this.id}' not found.`);y=new Rn(T,this.project)}return this.metaSync(y.toShallowJSON(),null),this.previousVersion=y.previousVersion,this.version=y.version,this.createdAt=y.createdAt,this.author=y.author,this.deleted=y.deleted,this.inputs=[...y.inputs],this.outputs=[...y.outputs],this.error=y.error,this.successCalls=[...y.successCalls],this.errorCalls=[...y.errorCalls],this.declaration=y.declaration,this.body=y.body,this.calledBySuccess=[...y.calledBySuccess],this.calledByError=[...y.calledByError],this.calledByEntry=[...y.calledByEntry],this.writesValues=[...y.writesValues],this.dataType=y.dataType,this.parent=y.parent,{updated:_(s),added:_(u),removed:_(e),affected:_(f),self:this}}updateWithShallowTransfer(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.UpdateWithShallowTransfer))){if(!this.checkCanEdit(this,n))return pe.Logger.warn(`[updateWithShallowTransfer] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(N.UpdateWithShallowTransfer,this.id),this;if(this.metaSync(t,n),this.version=t.version,this.createdAt=t.createdAt,this.author=t.author,this.deleted=t.deleted,this.previousVersion=t.previousVersion,this.unsubscribeFromDependencies(),t.parent){const s=ge(t.parent),u=this.project.get(s),e=this.parent;if(e&&e.id!==(u==null?void 0:u.id)&&this.removeFromParent(n),u)this.setParent(u,n),this.addSelfToProject(n);else throw n==null||n.attemptAutoclose(N.UpdateWithShallowTransfer,this.id),new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${s}' that isn't found in the project`)}else throw n==null||n.attemptAutoclose(N.UpdateWithShallowTransfer,this.id),new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(t.declaration){const s=ge(t.declaration),u=this.project.get(s);u&&this.setDeclaration(u)}if(t.calledByEntry.forEach(s=>{const u=ge(s),e=this.project.get(u);e&&(this.addEntryCaller(e,n),e.addCall(this,n))}),[...this.calledByEntry].forEach(s=>{t.calledByEntry.find(e=>ge(e)===s.id)||(this.removeCaller(s,n),s.removeCall(this,n))}),t.calledBySuccess.forEach(s=>{const u=ge(s),e=this.project.get(u);e&&(this.addSuccessCaller(e,n),e.addSuccessCall(this,n))}),[...this.calledBySuccess].forEach(s=>{t.calledBySuccess.find(e=>ge(e)===s.id)||(this.removeCaller(s,n),s.removeCall(this,n))}),t.calledByError.forEach(s=>{const u=ge(s),e=this.project.get(u);e&&(this.addErrorCaller(e,n),e.addErrorCall(this,n))}),[...this.calledByError].forEach(s=>{t.calledByError.find(e=>ge(e)===s.id)||(this.removeCaller(s,n),s.removeCall(this,n))}),t.dataType){const s=ge(t.dataType),u=this.project.get(s);u&&this.setDataType(u,n)}else this.setDataType(null,n);return t.outputs.forEach(s=>{const u=ge(s),e=this.project.get(u);e&&(this.addOutput(e,n),e.setParent(this,n))}),[...this.outputs].forEach(s=>{t.outputs.find(e=>ge(e)===s.id)||(this.removeOutput(s,n),s.removeFromParent(n))}),t.inputs.forEach(s=>{const u=ge(s),e=this.project.get(u);e&&(this.addInput(e,n),e.setParent(this,n))}),[...this.inputs].forEach(s=>{t.inputs.find(e=>ge(e)===s.id)||(this.removeInput(s,n),s.removeFromParent(n))}),t.writesValues.forEach(s=>{const u=ge(s),e=this.project.get(u);e&&(this.addValueReader(e,n),e.setValueWriter(this,n))}),[...this.writesValues].forEach(s=>{t.writesValues.find(e=>ge(e)===s.id)||(this.removeValueReader(s,n),s.setValueWriter(null,n))}),this.captureVersion(),this.subscribeToDependencies(),n==null||n.attemptAutoclose(N.UpdateWithShallowTransfer,this.id),this}updateWithGenerationTarget(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.UpdateWithGenerationTarget))){var s,u,e;if(!this.checkCanEdit(this,n))return pe.Logger.warn(`[updateWithGenerationTarget] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(N.UpdateWithGenerationTarget,this.id),this;if(this.metaSync(t,n),t.parent){const f=ge(t.parent),y=this.project.get(f),m=this.parent;if(m&&m.id!==(y==null?void 0:y.id)&&this.removeFromParent(n),y)this.setParent(y,n),this.addSelfToProject(n);else throw n==null||n.attemptAutoclose(N.UpdateWithGenerationTarget,this.id),new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${f}' that isn't found in the project`)}if(t.declaration){const f=ge(t.declaration),y=this.project.get(f);if(y)this.setDeclaration(y);else throw new Error(`${this.type} with id '${this.id}' has a 'declaration' reference '${f}' that isn't found in the project`)}return(s=t.calledByEntry)==null||s.forEach(f=>{const y=ge(f),m=this.project.get(y);if(m)this.addEntryCaller(m,n),m.addCall(this,n);else throw new Error(`${this.type} with id '${this.id}' has a 'calledByEntry' reference '${y}' that isn't found in the project`)}),t.calledByEntry&&[...this.calledByEntry].forEach(f=>{var m;((m=t.calledByEntry)==null?void 0:m.find(T=>ge(T)===f.id))||(this.removeCaller(f,n),f.removeCall(this,n))}),(u=t.calledBySuccess)==null||u.forEach(f=>{const y=ge(f),m=this.project.get(y);if(m)this.addSuccessCaller(m,n),m.addSuccessCall(this,n);else throw new Error(`${this.type} with id '${this.id}' has a 'calledBySuccess' reference '${y}' that isn't found in the project`)}),t.calledBySuccess&&[...this.calledBySuccess].forEach(f=>{var m;((m=t.calledBySuccess)==null?void 0:m.find(T=>ge(T)===f.id))||(this.removeCaller(f,n),f.removeCall(this,n))}),(e=t.calledByError)==null||e.forEach(f=>{const y=ge(f),m=this.project.get(y);if(m)this.addErrorCaller(m,n),m.addErrorCall(this,n);else throw new Error(`${this.type} with id '${this.id}' has a 'calledByError' reference '${y}' that isn't found in the project`)}),t.calledByError&&[...this.calledByError].forEach(f=>{var m;((m=t.calledByError)==null?void 0:m.find(T=>ge(T)===f.id))||(this.removeCaller(f,n),f.removeCall(this,n))}),this.captureVersion(),this.subscribeToDependencies(),n==null||n.attemptAutoclose(N.UpdateWithGenerationTarget,this.id),this}hydrateAncestors(){const t=[],n=[],s=[],u=[];if(this.initialData.parent){const e=ge(this.initialData.parent),f=this.project.get(e);if(f)this.setParent(f,null),t.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=ge(this.initialData.declaration),f=this.project.get(e);f&&(this.setDeclaration(f),t.push(f))}return this.initialData.calledByEntry.forEach(e=>{const f=ge(e),y=this.project.get(f);y&&this.addEntryCaller(y,null)}),this.initialData.calledBySuccess.forEach(e=>{const f=ge(e),y=this.project.get(f);y&&this.addSuccessCaller(y,null)}),this.initialData.calledByError.forEach(e=>{const f=ge(e),y=this.project.get(f);y&&this.addErrorCaller(y,null)}),{updated:_(t),added:_(n),removed:_(s),affected:_(u),self:this}}afterAllChildrenInitialized(t=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.AfterAllChildrenInitialized))){if(!this.checkCanEdit(this,t))return pe.Logger.warn(`[afterAllChildrenInitialized] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),t==null||t.attemptAutoclose(N.AfterAllChildrenInitialized,this.id),{updated:[],added:[],removed:[],affected:[],self:this};const n=[],s=[],u=[],e=[];if(this.initialized=!0,this.checkIsSynced())return t==null||t.attemptAutoclose(N.AfterAllChildrenInitialized,this.id),{updated:_(n),added:_(s),removed:_(u),affected:_(e),self:this};const{updated:f,added:y,removed:m}=this.syncChildren(t);return n.push(...f),s.push(...y),u.push(...m),this.inputs.sort((T,g)=>{var b,R;return(T.index??((b=T.declaration)==null?void 0:b.index))-(g.index??((R=g.declaration)==null?void 0:R.index))}),this.outputs.sort((T,g)=>{var b,R;return(T.index??((b=T.declaration)==null?void 0:b.index))-(g.index??((R=g.declaration)==null?void 0:R.index))}),this.errorCalls.length&&!this.catchesError&&this.metaSync({catchesError:!0},t),t==null||t.attemptAutoclose(N.AfterAllChildrenInitialized,this.id),{updated:_(n),added:_(s),removed:_(u),affected:_(e),self:this}}addSelfToProject(t=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,"add-self-to-project"))){const n=[this],s=[],u=[],e=[];return this.parent===this.project&&this.project.addLoop(this),this.successCalls.forEach(f=>{f.addSuccessCaller(this,t),n.push(f)}),this.errorCalls.forEach(f=>{f.addErrorCaller(this,t),n.push(f)}),this.calledByEntry.forEach(f=>{f.addCall(this,t),n.push(f)}),this.calledBySuccess.forEach(f=>{f.addSuccessCall(this,t),n.push(f)}),this.calledByError.forEach(f=>{f.addErrorCall(this,t),n.push(f)}),this.subscribe(),this.subscribeToDependencies(),t==null||t.attemptAutoclose("add-self-to-project",this.id),{updated:_(n),added:_(s),removed:_(u),affected:_(e),self:this}}get calledBy(){return[...this.calledByEntry,...this.calledBySuccess,...this.calledByError]}removeInput(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.RemoveInput))){if(!this.checkCanEdit(this,n))return pe.Logger.warn(`[removeInput] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(N.RemoveInput,this.id),this;const s=this.inputs.findIndex(u=>u.id===t.id);return s>-1&&(this.inputs.splice(s,1),n&&(n==null||n.add(this,ye.Affected))),n==null||n.attemptAutoclose(N.RemoveInput,this.id),this}addInput(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.AddInput))){return this.checkCanEdit(this,n)?this.inputs.includes(t)?(n==null||n.attemptAutoclose(N.AddInput,this.id),this):(this.inputs.push(t),n==null||n.add(this,ye.Affected),n==null||n.attemptAutoclose(N.AddInput,this.id),this):(pe.Logger.warn(`[addInput] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(N.AddInput,this.id),this)}addOutput(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,"add-output"))){return this.checkCanEdit(this,n)?this.outputs.includes(t)?(n==null||n.attemptAutoclose("add-output",this.id),this):(this.outputs.push(t),n==null||n.add(this,ye.Affected),n==null||n.attemptAutoclose("add-output",this.id),this):(pe.Logger.warn(`[addOutput] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose("add-output",this.id),this)}removeOutput(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,"remove-output"))){if(!this.checkCanEdit(this,n))return pe.Logger.warn(`[removeOutput] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose("remove-output",this.id),this;const s=this.outputs.findIndex(u=>u.id===t.id);return s>-1&&(this.outputs.splice(s,1),n&&(n==null||n.add(this,ye.Affected))),n==null||n.attemptAutoclose("remove-output",this.id),this}setBody(t){return this.body=t,this}detachBody(){return this.body=null,this}addSuccessCaller(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.AddSuccessCaller)),s=!1){var u;return this.checkCanEditWithCounterpartAndSideEffects(this,t,N.AddSuccessCaller,n)?((t==null?void 0:t.id)===this.id&&(n==null||n.event({id:`${N.AddSuccessCaller}-${this.id}--${at.CannotSuccessCallItself}`,action:N.AddSuccessCaller,owner:this,errorReason:at.CannotSuccessCallItself,rootAction:((u=n==null?void 0:n.self)==null?void 0:u.id)===this.id&&(n==null?void 0:n.actionName)===N.AddSuccessCaller})),this.calledBySuccess.find(e=>e.id===t.id)||(this.calledBySuccess.push(t),n==null||n.add(this,ye.Updated),s&&Oi(this,n)),n==null||n.attemptAutoclose(N.AddSuccessCaller,this.id),this):this}addErrorCaller(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.AddErrorCaller)),s=!1){var u;return this.checkCanEditWithCounterpartAndSideEffects(this,t,N.AddErrorCaller,n)?((t==null?void 0:t.id)===this.id&&(n==null||n.event({id:`${N.AddErrorCaller}-${this.id}--${at.CannotErrorCallItself}`,action:N.AddErrorCaller,owner:this,errorReason:at.CannotErrorCallItself,rootAction:((u=n==null?void 0:n.self)==null?void 0:u.id)===this.id&&(n==null?void 0:n.actionName)===N.AddErrorCaller})),this.calledByError.find(e=>e.id===t.id)||(this.calledByError.push(t),n==null||n.add(this,ye.Updated),s&&Oi(this,n)),n==null||n.attemptAutoclose(N.AddErrorCaller,this.id),this):this}addEntryCaller(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.AddEntryCaller)),s=!1){var u;return this.checkCanEditWithCounterpartAndSideEffects(this,t,N.AddEntryCaller,n)?((t==null?void 0:t.id)===this.id&&(n==null||n.event({id:`${N.AddEntryCaller}-${this.id}--${at.CannotEntryCallItself}`,action:N.AddEntryCaller,owner:this,errorReason:at.CannotEntryCallItself,rootAction:((u=n==null?void 0:n.self)==null?void 0:u.id)===this.id&&(n==null?void 0:n.actionName)===N.AddEntryCaller})),this.calledByEntry.find(e=>e.id===t.id)||(this.calledByEntry.push(t),n==null||n.add(this,ye.Updated),s&&Oi(this,n)),n==null||n.attemptAutoclose(N.AddEntryCaller,this.id),this):this}addErrorCall(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.AddErrorCall)),s=!1){var u;return this.checkCanEditWithCounterpartAndSideEffects(this,t,N.AddErrorCall,n)?((t==null?void 0:t.id)===this.id&&(n==null||n.event({id:`${N.AddErrorCaller}-${this.id}--${at.CannotErrorCallItself}`,action:N.AddErrorCaller,owner:this,errorReason:at.CannotErrorCallItself,rootAction:((u=n==null?void 0:n.self)==null?void 0:u.id)===this.id&&(n==null?void 0:n.actionName)===N.AddErrorCaller})),this.errorCalls.find(e=>e.id===t.id)||(this.errorCalls.push(t),this.catchesError||this.metaSync({catchesError:!0},n),s&&Oi(this,n),n==null||n.add(this,ye.Affected)),n==null||n.attemptAutoclose(N.AddErrorCall,this.id),this):this}addSuccessCall(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.AddSuccessCall)),s=!1){var u;return this.checkCanEditWithCounterpartAndSideEffects(this,t,N.AddSuccessCall,n)?((t==null?void 0:t.id)===this.id&&(n==null||n.event({id:`${N.AddSuccessCaller}-${this.id}`,action:N.AddSuccessCaller,owner:this,errorReason:at.CannotSuccessCallItself,rootAction:((u=n==null?void 0:n.self)==null?void 0:u.id)===this.id&&(n==null?void 0:n.actionName)===N.AddSuccessCaller})),this.successCalls.find(e=>e.id===t.id)||(this.successCalls.push(t),s&&Oi(this,n),n==null||n.add(this,ye.Affected)),n==null||n.attemptAutoclose(N.AddSuccessCall,this.id),this):this}removeCall(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.RemoveCall)),s=!1){if(!this.checkCanEditWithCounterpartAndSideEffects(this,t,N.RemoveCall,n))return this;const u=this.successCalls.findIndex(f=>f.id===t.id);u>-1&&(this.successCalls.splice(u,1),n==null||n.add(this,ye.Affected));const e=this.errorCalls.findIndex(f=>f.id===t.id);return e>-1&&(this.errorCalls.splice(e,1),n==null||n.add(this,ye.Affected)),s&&Oi(this,n),n==null||n.attemptAutoclose(N.RemoveCall,this.id),this}removeCaller(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,"remove-caller")),s=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,t,N.RemoveCaller,n)?(this.calledBySuccess=this.calledBySuccess.filter(u=>u.id!==t.id?!0:(n==null||n.add(this,ye.Updated),n==null||n.add(u,ye.Affected),!1)),this.calledByError=this.calledByError.filter(u=>u.id!==t.id?!0:(n==null||n.add(this,ye.Updated),n==null||n.add(u,ye.Affected),!1)),this.calledByEntry=this.calledByEntry.filter(u=>u.id!==t.id?!0:(n==null||n.add(this,ye.Updated),n==null||n.add(u,ye.Affected),!1)),s&&Oi(this,n),n==null||n.attemptAutoclose(N.RemoveCaller,this.id),this):this}replaceDetachedChild(t,n){const s=this.detachedChildren.indexOf(t);return s!==-1&&(this.detachedChildren[s]=n),this}subscribeDetachedChild(t){return this.detachedChildren.includes(t)||this.detachedChildren.push(t),this}unsubscribeDetachedChild(t){const n=this.detachedChildren.indexOf(t);return n!==-1&&this.detachedChildren.splice(n,1),this}setError(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.SetErrorEntity))){if(!this.checkCanEdit(this,n))return pe.Logger.warn(`[setError] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(N.SetErrorEntity,this.id),this;const s=this.error;return(s==null?void 0:s.id)!==(t==null?void 0:t.id)&&(s==null||s.remove({ignoreUpstream:!0},n),this.error=t,this.subscribeToDependencies(),n==null||n.add(this,ye.Affected)),n==null||n.attemptAutoclose(N.SetErrorEntity,this.id),this}setParent(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.SetParent))){var s;return this.checkCanEditWithCounterpartAndSideEffects(this,t,N.SetParent,n)?(((s=this.parent)==null?void 0:s.id)!==(t==null?void 0:t.id)&&(this.parent=t,n&&(n==null||n.add(this,ye.Updated))),n==null||n.attemptAutoclose(N.SetParent,this.id),this):this}setDeclaration(t){return this.declaration=t,this}initChildren(t=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,"init-children"))){if(this.initialized||this.startedInitialization)return this;if(this.startedInitialization=!0,this.declaration=Se(this.initialData.declaration,this.project),this.initialData.dataType){const n=Se(this.initialData.dataType,this.project);this.setDataType(n,null),this.dataType.setParent(this,null),this.dataType.initChildren(t)}return this.successCalls=this.initialData.successCalls.map(n=>{const s=Se(n,this.project);if(s.addSuccessCaller(this,null),[r.BreakStatement,r.ContinueStatement].includes(s.type))s.setParent(this.parent.parent,null),s.initChildren(t);else if(s.type===r.ReturnStatement){const u=zs(this,this.project);s.setParent(u,null),s.initChildren(t)}else s.type!==r.InternalCall&&(s.setParent(this.parent,null),s.initChildren(t));return s}),this.errorCalls=this.initialData.errorCalls.map(n=>{const s=Se(n,this.project);if(s.addErrorCaller(this,null),[r.BreakStatement,r.ContinueStatement].includes(s.type))s.setParent(this.parent.parent,null),s.initChildren(t);else if(s.type===r.ReturnStatement){const u=zs(this,this.project);s.setParent(u,null),s.initChildren(t)}else s.type!==r.InternalCall&&(s.setParent(this.parent,null),s.initChildren(t));return s}),this.inputs=this.initialData.inputs.map(n=>{const s=Se(n,this.project);return s.setParent(this,null),s.initChildren(t),s}),this.outputs=this.initialData.outputs.map(n=>{const s=Se(n,this.project);return s.setParent(this,null),s.initChildren(t),s}),this.initialData.body&&(this.body=Se(this.initialData.body,this.project),this.body.setParent(this,null),this.body.initChildren(t)),this.initialData.error&&(this.error=Se(this.initialData.error,this.project),this.error.setParent(this,null),this.error.initChildren(t)),this.subscribeToDependencies(),this.afterAllChildrenInitialized(t),t==null||t.attemptAutoclose("init-children",this.id),this}subscribe(){var t;return this.activeVersion=!0,(t=this.knownVersions)==null||t.forEach(n=>{n.version!==this.version&&(n.activeVersion=!1)}),this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,"meta-sync"))){const s=ys(this,t,n),u=fs(this,s),e=this.toMeta();return this.x=s.x||e.x,this.y=s.y||e.y,this.catchesError=s.catchesError!==void 0?s.catchesError:this.catchesError,super.baseMetaSync(s,this,n),s.deleted===!0&&!e.deleted?n==null||n.add(this,ye.Removed):s.deleted===!1&&e.deleted?n==null||n.add(this,ye.Added):u&&(n==null||n.add(this,ye.Updated)),n==null||n.attemptAutoclose("meta-sync",this.id),this}async APILoad(t=gt,...n){return await Rn.repository.APILoad(this.id,...n),this}async APICreate(t=gt,...n){return await Rn.repository.APICreate(this.toShallowJSON(),...n),this}async APIUpdate(t=gt,...n){return await Rn.repository.APIUpdate(this.toShallowJSON(),...n),this}async APIDelete(t=gt,...n){return await Rn.repository.APIDelete(this.toShallowJSON(),...n),this}async APIClone(t=gt,...n){return await Rn.repository.APIClone(this.id,...n),this}async APILoadVersion(t=gt,n,...s){return await Rn.repository.APILoadVersion(this.id,n,...s)}removeFromParent(t=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.RemoveFromParent))){if(!this.checkCanEdit(this,t))return pe.Logger.warn(`[removeFromParent] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),t==null||t.attemptAutoclose(N.RemoveFromParent,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const n=[],s=[],u=[],e=[];return this.parent.type===r.Project?(this.parent.removeLoop(this),e.push(this.parent)):this.parent.detachedChildren.includes(this)&&this.parent.unsubscribeDetachedChild(this),t==null||t.attemptAutoclose(N.RemoveFromParent,this.id),{added:_(u),updated:_(n),removed:_(s),affected:_(e),self:this}}remove({ignoreUpstream:t}={ignoreUpstream:!1},n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.RemoveEntity))){var y;if(!this.checkCanDelete(this,n))return pe.Logger.warn(`[remove] User is not allowed to delete or edit this ${this.type} entity with id: ${this.id}`),n==null||n.event({id:`${N.RemoveEntity}-${this.id}--${at.ActionOwnerEntityNonDeletable}`,action:N.RemoveEntity,owner:this,errorReason:at.ActionOwnerEntityNonDeletable,rootAction:((y=n==null?void 0:n.self)==null?void 0:y.id)===this.id&&(n==null?void 0:n.actionName)===N.RemoveEntity}),n==null||n.attemptAutoclose(N.RemoveEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const s=[],u=[],e=[],f=[];if(n!=null&&n.hasRemoved(this.id))return n==null||n.attemptAutoclose(N.RemoveEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(u.push(this),this.unsubscribe(),this.unsubscribeFromDependencies(),this.project.subscribeDeletedInstance(this),this.metaSync({deleted:!0},n),Object.values(this.detachedDependents).forEach(m=>{const{updated:T,removed:g,added:b}=m.entity.onDetachedDependencyRemoved(this,m.field,n);s.push(...T),u.push(...g),e.push(...b)}),this.inputs.forEach(m=>{const{updated:T,removed:g}=m.remove({ignoreUpstream:!0},n);s.push(...T),u.push(...g)}),this.outputs.forEach(m=>{const{updated:T,removed:g}=m.remove({ignoreUpstream:!0},n);s.push(...T),u.push(...g)}),this.body.remove({ignoreUpstream:!0},n),this.error){const{updated:m,removed:T}=this.error.remove({ignoreUpstream:!0},n);s.push(...m),u.push(...T)}if(this.dataType){const{updated:m,removed:T}=this.dataType.remove({ignoreUpstream:!0},n);s.push(...m),u.push(...T)}if(this.successCalls.forEach(m=>{s.push(m),m.removeCaller(this,n)}),this.errorCalls.forEach(m=>{s.push(m),m.removeCaller(this,n)}),!t){const m=this.removeFromParent(n);e.push(...m.added),s.push(...m.updated),u.push(...m.removed),f.push(...m.affected),this.calledBy.forEach(T=>{s.push(T),T.removeCall(this,n)})}return n==null||n.attemptAutoclose(N.RemoveEntity,this.id),{added:_(e),updated:_(s),removed:_(u),affected:_(f),self:this}}restore({}={},t=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.RestoreEntity))){if(!this.checkCanEdit(this,t))return pe.Logger.warn(`[restore] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),t==null||t.attemptAutoclose(N.RestoreEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const n=[],s=[],u=[],e=[];if(t!=null&&t.hasAdded(this.id))return t==null||t.attemptAutoclose(N.RestoreEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(this.subscribe(),this.project.unsubscribeDeletedInstance(this),this.metaSync({deleted:!1},t),this.inputs.forEach(f=>{const{updated:y}=f.restore({},t);s.push(...y)}),this.outputs.forEach(f=>{const{updated:y}=f.restore({},t);s.push(...y)}),this.body.restore({},t),this.successCalls.forEach(f=>{s.push(f),f.addSuccessCaller(this,t)}),this.errorCalls.forEach(f=>{s.push(f),f.addErrorCaller(this,t)}),this.error){const{updated:f}=this.error.restore({},t);s.push(...f)}if(this.dataType){const{updated:f}=this.dataType.restore({},t);s.push(...f)}return this.calledBySuccess.forEach(f=>{s.push(f),f.addSuccessCall(this,t)}),this.calledByError.forEach(f=>{s.push(f),f.addErrorCall(this,t)}),this.calledByEntry.forEach(f=>{s.push(f),f.addCall(this,t)}),t==null||t.attemptAutoclose(N.RestoreEntity,this.id),{added:_(n),updated:_(s),removed:_(u),affected:_(e),self:this}}toFlat(t=new Set){return t.has(this.id)?[]:(t.add(this.id),[this,...this.inputs.flatMap(s=>s.toFlat(t)),...this.outputs.flatMap(s=>s.toFlat(t)),...this.successCalls.flatMap(s=>s.toFlat(t)),...this.errorCalls.flatMap(s=>s.toFlat(t)),...this.error?this.error.toFlat(t):[],...this.body?this.body.toFlat(t):[],...this.dataType?this.dataType.toFlat(t):[],...this.continueStatements.flatMap(s=>s.toFlat(t)),...this.breakStatements.flatMap(s=>s.toFlat(t))])}toFlatIds(t=new Set){return t.has(this.id)?[]:(t.add(this.id),[this.id,...this.inputs.flatMap(s=>s.toFlatIds(t)),...this.outputs.flatMap(s=>s.toFlatIds(t)),...this.successCalls.flatMap(s=>s.toFlatIds(t)),...this.errorCalls.flatMap(s=>s.toFlatIds(t)),...this.error?this.error.toFlatIds(t):[],...this.body?this.body.toFlatIds(t):[],...this.dataType?this.dataType.toFlatIds(t):[],...this.continueStatements.flatMap(s=>s.toFlatIds(t)),...this.breakStatements.flatMap(s=>s.toFlatIds(t))])}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(t=new Set){var n,s;return t.has(this.id)?this.toReference():(t.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:((n=this.dataType)==null?void 0:n.toJSON(t))||null,calledBySuccess:this.calledBySuccess.map(u=>u.toReference()),calledByError:this.calledByError.map(u=>u.toReference()),calledByEntry:this.calledByEntry.map(u=>u.toReference()),writesValues:this.writesValues.map(u=>u.toJSON(t)),declaration:this.declaration.toJSON(t),inputs:this.inputs.map(u=>u.toJSON(t)),outputs:this.outputs.map(u=>u.toJSON(t)),successCalls:this.successCalls.map(u=>u.toJSON(t)),errorCalls:this.errorCalls.map(u=>u.toJSON(t)),error:((s=this.error)==null?void 0:s.toJSON(t))||null,body:this.body.toJSON(t),parent:this.parent.toReference()})}toJSONClone(t=Kt){var s,u,e,f,y,m,T;let n;return(s=t.seenEntityMaps)!=null&&s.has(this.id)?n=t.seenEntityMaps.get(this.id):(n=t.newId||xs(this,this.project,t.uuidStrategy),t.seenEntityMaps&&t.seenEntityMaps.set(this.id,n)),(u=t.seenEntities)!=null&&u.has(n)||(e=t.seenEntities)!=null&&e.has(this.id)?this.toReference({seenEntityMaps:t.seenEntityMaps}):((f=t.seenEntities)==null||f.add(n),(y=t.seenEntities)==null||y.add(this.id),{id:n,version:M.UUID.uuid(),createdAt:t.timestamp||j().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({...t,newId:null}))||null,calledBySuccess:this.calledBySuccess.map(g=>g.toReference({seenEntityMaps:t.seenEntityMaps})),calledByError:this.calledByError.map(g=>g.toReference({seenEntityMaps:t.seenEntityMaps})),calledByEntry:this.calledByEntry.map(g=>g.toReference({seenEntityMaps:t.seenEntityMaps})),declaration:this.declaration.toJSON(),inputs:this.inputs.map(g=>g.toJSONClone({...t,newId:null})),outputs:this.outputs.map(g=>g.toJSONClone({...t,newId:null})),writesValues:this.writesValues.map(g=>g.toJSONClone({...t,newId:null})),successCalls:this.successCalls.map(g=>g.toJSONClone({...t,newId:null})),errorCalls:this.errorCalls.map(g=>g.toJSONClone({...t,newId:null})),error:((T=this.error)==null?void 0:T.toJSONClone({...t,newId:null}))||null,body:this.body.toJSONClone({...t,newId:null}),parent:this.parent.toReference({seenEntityMaps:t.seenEntityMaps})})}toReference(t=Kt){var s;let n=this.id;return(s=t.seenEntityMaps)!=null&&s.has(this.id)&&(n=t.seenEntityMaps.get(this.id)),{id:n+"--"+M.UUID.uuid()+"--ref",type:r.GenericReference,entityId:n,version:this.version,entityType:this.type}}toShallowJSON(t=Kt){var s,u,e,f,y;let n=this.id;return(s=t.seenEntityMaps)!=null&&s.has(this.id)&&(n=t.seenEntityMaps.get(this.id)),{id:n,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,editable:this.editable,deletable:this.deletable,catchesError:this.catchesError,x:this.x,y:this.y,dataType:((u=this.dataType)==null?void 0:u.toReference(t))||null,declaration:((e=this.declaration)==null?void 0:e.toReference(t))||null,body:((f=this.body)==null?void 0:f.toReference(t))||null,inputs:this.inputs.map(m=>m.toReference(t)),outputs:this.outputs.map(m=>m.toReference(t)),writesValues:this.writesValues.map(m=>m.toReference(t)),successCalls:this.successCalls.map(m=>m.toReference(t)),errorCalls:this.errorCalls.map(m=>m.toReference(t)),calledBySuccess:this.calledBySuccess.map(m=>m.toReference(t)),calledByError:this.calledByError.map(m=>m.toReference(t)),calledByEntry:this.calledByEntry.map(m=>m.toReference(t)),error:((y=this.error)==null?void 0:y.toReference(t))||null,parent:this.parent.toReference(t)}}toFlatJSON(t=new Set){var s;return t.has(this.id)?[]:(t.add(this.id),[this.toShallowJSON(),...((s=this.body)==null?void 0:s.toFlatJSON(t))||[],...this.successCalls.flatMap(u=>u.toFlatJSON(t)),...this.errorCalls.flatMap(u=>u.toFlatJSON(t)),...this.inputs.flatMap(u=>u.toFlatJSON(t)),...this.outputs.flatMap(u=>u.toFlatJSON(t)),...this.continueStatements.flatMap(u=>u.toFlatJSON(t)),...this.breakStatements.flatMap(u=>u.toFlatJSON(t)),...this.error?this.error.toFlatJSON(t):[],...this.dataType?this.dataType.toFlatJSON(t):[]])}toGenerationTarget(t=Kt){var u,e;const n=this.parent.type===r.Project?void 0:(u=t.seenEntityMaps)!=null&&u.has(this.parent.id)?t.seenEntityMaps.get(this.parent.id):this.parent.id;let s=this.id;return(e=t.seenEntityMaps)!=null&&e.has(this.id)&&(s=t.seenEntityMaps.get(this.id)),{id:s,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:n}}toFlatGenerationTarget(t=new Set){var s;return t.has(this.id)?[]:(t.add(this.id),[this.toGenerationTarget(),...((s=this.body)==null?void 0:s.toFlatGenerationTarget(t))||[],...this.successCalls.flatMap(u=>u.toFlatGenerationTarget(t)),...this.errorCalls.flatMap(u=>u.toFlatGenerationTarget(t)),...this.inputs.flatMap(u=>u.toFlatGenerationTarget(t)),...this.outputs.flatMap(u=>u.toFlatGenerationTarget(t)),...this.continueStatements.flatMap(u=>u.toFlatGenerationTarget(t)),...this.breakStatements.flatMap(u=>u.toFlatGenerationTarget(t)),...this.error?this.error.toFlatGenerationTarget(t):[],...this.dataType?this.dataType.toFlatGenerationTarget(t):[]])}clearErrors(){var t,n;return this.errors=[],this.inputs.forEach(s=>s.clearErrors()),this.outputs.forEach(s=>s.clearErrors()),this.successCalls.forEach(s=>s.clearErrors()),this.errorCalls.forEach(s=>s.clearErrors()),this.continueStatements.forEach(s=>s.clearErrors()),this.breakStatements.forEach(s=>s.clearErrors()),(t=this.error)==null||t.clearErrors(),(n=this.dataType)==null||n.clearErrors(),this}validate(){return this.errors=u4(this),{success:!0}}async validateAsync(t={}){const n=pe.YieldTracker.from(t);return this.errors=await z0t(this,{tracker:n}),{success:!0}}getErrors(){return[...this.errors,...this.inputs.flatMap(n=>n.getErrors()),...this.outputs.flatMap(n=>n.getErrors()),...this.body?this.body.getErrors():[],...this.error?this.error.getErrors():[],...this.dataType?this.dataType.getErrors():[]]}async getErrorsAsync(t={}){const n=pe.YieldTracker.from(t),s=[...this.errors];await n.tick();for(const u of this.inputs)s.push(...await u.getErrorsAsync({tracker:n}));for(const u of this.outputs)s.push(...await u.getErrorsAsync({tracker:n}));return this.body&&s.push(...await this.body.getErrorsAsync({tracker:n})),this.error&&s.push(...await this.error.getErrorsAsync({tracker:n})),this.dataType&&s.push(...await this.dataType.getErrorsAsync({tracker:n})),s}getShallowErrors(){return this.errors}clone(t=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.CloneEntity)),n=null,s=null,u=!0){var I,A;const e=Qa(n,this),f=this.toJSON(),y=s||M.UUID.uuid();f.inputs=[];const m=y.split("-id"),T=m[m.length-1||0]||y;f.id=y,f.version=M.UUID.uuid(),f.createdAt=(t==null?void 0:t.timestamp)||j().toISOString(),f.author=(t==null?void 0:t.author)||"1",f.previousVersion=null,f.deleted=!1,f.deletable=!0,f.editable=!0;const g=Zr(f,e);n?g.setParent(n,t):g.setParent(this.parent,null),u&&g.subscribe(),g.initChildren(t),t==null||t.add(g,ye.Added);const b=(I=this.inputs)==null?void 0:I.map((O,P)=>O.clone(t,g,T+"-input-map-"+P+"-id",u));g.inputs=b;const R=(A=this.outputs)==null?void 0:A.map((O,P)=>O.clone(t,g,T+"-output-map-"+P+"-id",u));return g.outputs=R,this.body&&(g.body=this.body.clone(t,g,T+"-body-id",u,!0)),this.error&&(g.error=this.error.clone(t,g,T+"-error-map-id",u)),this.dataType&&(g.dataType=this.dataType.clone(t,g,T+"-data-type-id",u)),t||g.captureVersion(),t==null||t.attemptAutoclose(N.CloneEntity,this.id),g}getVariableInstances(){return this.body?la(this.body).filter(s=>s.type===r.VariableInstance):[]}addReturnStatement(t){return Xi.includes(this.parent.type)&&this.parent.addReturnStatement(t),this}removeReturnStatement(t){return Xi.includes(this.parent.type)&&this.parent.removeReturnStatement(t),this}addBreakStatement(t){return this.breakStatements.includes(t)||this.breakStatements.push(t),this}removeBreakStatement(t){const n=this.breakStatements.indexOf(t);return n!==-1&&this.breakStatements.splice(n,1),this}addContinueStatement(t){return this.continueStatements.includes(t)||this.continueStatements.push(t),this}removeContinueStatement(t){const n=this.continueStatements.indexOf(t);return n!==-1&&this.continueStatements.splice(n,1),this}getUniqueInputMaps(){const t=[];return[...this.breakStatements,...this.continueStatements].forEach(s=>{s.outputs.filter(e=>{var f;return!e.deleted&&!((f=e.declaration)!=null&&f.deleted)}).forEach(e=>{t.find(y=>y===e||De(y,this.project)===De(e,this.project)&&mn(y.dataType,e.dataType))||t.push(e)})}),_(t)}syncTerminationStatements(t=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,"sync-termination-statements"))){const n=[],s=[],u=[],e=[],f=this.getUniqueInputMaps();return[...this.breakStatements,...this.continueStatements].forEach(m=>{const T=m.outputs.filter(b=>{var R;return!b.deleted&&!((R=b.declaration)!=null&&R.deleted)}),g=f.filter(b=>!T.find(R=>De(b,this.project)===De(R,this.project)&&mn(b.dataType,R.dataType)));g.length&&(n.push(m),t==null||t.add(m,ye.Updated)),g.forEach(b=>{const R=b.clone(t,m);t==null||t.add(R,ye.Added),R.addSelfToProject(t),s.push(R)})}),t==null||t.attemptAutoclose("sync-termination-statements",this.id),{updated:_(n),added:_(s),removed:_(u),affected:_(e),self:this}}syncBodyInputIndexes(t=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,"sync-body-input-indexes"))){const n=[],s=[],u=[],e=[];return this.body.inputs.sort((f,y)=>f.index-y.index),t==null||t.attemptAutoclose("sync-body-input-indexes",this.id),{updated:_(n),added:_(s),removed:_(u),affected:_(e),self:this}}syncBodyArgumentsDeclarations(t=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,"sync-body-arguments-declarations"))){var O;const n=[],s=[],u=[],e=[],{updated:f,added:y,removed:m}=this.syncFixedBodyArgumentDeclarations(t);n.push(...f),s.push(...y),u.push(...m);const T=this.getUniqueInputMaps(),g=this.body.inputs;T.sort((P,x)=>P.index-x.index);const b=this.getDataType();if(((O=b==null?void 0:b.entity)==null?void 0:O.id)!==G["primitive-entity"].void.id&&(b!=null&&b.entity||b!=null&&b.isGroup||b!=null&&b.foreignKeyRef)&&!g.find(x=>{var $,U,Z,q,H;return x.id!==(($=this.currentIterationNumberArgumentDeclaration)==null?void 0:$.id)&&x.id!==((U=this.currentValueArgumentDeclaration)==null?void 0:U.id)&&((q=(Z=x.dataType)==null?void 0:Z.entity)==null?void 0:q.id)===((H=b==null?void 0:b.entity)==null?void 0:H.id)})){let x=0;this.currentIterationNumberArgumentDeclaration&&x++,this.currentValueArgumentDeclaration&&x++;const $=hd.new(t);$.name="Aggregate result",$.description="Aggretated list of all previously outputted values from each iteration",$.constant=!0,$.index=x,$.required=!1,$.parent=this.body.toReference();const U=Se($,this.project);if(U.hydrateAncestors(),U.addSelfToProject(t),t==null||t.add(U,ye.Added),s.push(U),U.setParent(this.body,t),U.initChildren(t),!U.dataType&&b){const Z=pa.new(t);Z.parent=U.toReference();const q=Se(Z,this.project);q.hydrateAncestors(),q.addSelfToProject(t),s.push(q),q.setParent(U,t),q.initChildren(t),q.merge(b,t),q.setEntity(b.entity,t),t==null||t.add(q,ye.Added),U.dataType=q,t||q.captureVersion()}t||U.captureVersion()}const{updated:R,added:I,removed:A}=this.removeExtraBodyArgumentDeclarations(t);return n.push(...R),s.push(...I),u.push(...A),t==null||t.attemptAutoclose("sync-body-arguments-declarations",this.id),{updated:_(n),added:_(s),removed:_(u),affected:_(e),self:this}}reAttachAllTerminationInputMapsToDeclarations(t=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,"reattach-termination-input-maps-to-declarations"))){var y,m,T;const n=[],s=[],u=[],e=[];return!((y=this.body)!=null&&y.dataType)||!((m=this.body)!=null&&m.dataType.entity)||((T=this.body)==null?void 0:T.dataType.entity.type)!==r.DefinitionEntity?(t==null||t.attemptAutoclose("reattach-termination-input-maps-to-declarations",this.id),{updated:_(n),added:_(s),removed:_(u),affected:_(e),self:this}):([...this.breakStatements,...this.continueStatements].forEach(g=>{var O,P,x;const b=g.outputs.filter($=>{var U;return!$.deleted&&!((U=$.declaration)!=null&&U.deleted)}),R=b.filter($=>!$.declaration&&!!$.readsValue),I=b.filter($=>!$.declaration&&!$.readsValue);let A=(((x=(P=(O=this.body)==null?void 0:O.dataType)==null?void 0:P.entity)==null?void 0:x.properties)||[]).filter($=>!b.find(U=>{var Z,q;return!U.deleted&&!((Z=U.declaration)!=null&&Z.deleted)&&((q=U.declaration)==null?void 0:q.id)===$.id}));R.forEach($=>{const U=$.getDataType(t);if($.readsValue){const Z=De($.readsValue,this.project),q=A.find(H=>De(H,this.project)===Z&&mn(H.dataType,U));if(q){$.setDeclaration(q,t),n.push($),A=A.filter(H=>H!==q);return}}}),I.forEach($=>{const U=$.getDataType(t),Z=A.find(q=>mn(q.dataType,U));if(Z){$.setDeclaration(Z,t),n.push($),A=A.filter(q=>q!==Z);return}}),b.forEach($=>{const U=A.find(Z=>De(Z,this.project)===De($,this.project));$.declaration&&!A.includes($.declaration)&&U&&($.setDeclaration(U,t),n.push($),A=A.filter(Z=>Z!==U))})}),t==null||t.attemptAutoclose("reattach-termination-input-maps-to-declarations",this.id),{updated:_(n),added:_(s),removed:_(u),affected:_(e),self:this})}syncOutputDataType(t=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,"sync-outputs-properties"))){var A,O,P,x,$,U,Z,q,H,Y,ie,z,W,ee,te,X,re,ae,le,oe,ce,be,Ce;const n=[],s=[],u=[],e=[],f=[...this.breakStatements,...this.continueStatements];if(!f.every(Ee=>Ee.initialized))return t==null||t.attemptAutoclose("sync-outputs-properties",this.id),{updated:_(n),added:_(s),removed:_(u),affected:_(e),self:this};let y=!1;if(!((A=this.body)!=null&&A.dataType)){const Ee=pa.new(t);Ee.parent=this.body.toReference(),Ee.inferred=!0;const Oe=Se(Ee,this.project);Oe.hydrateAncestors(),Oe.addSelfToProject(t),t==null||t.add(Oe,ye.Added),Oe.initChildren(t),s.push(Oe),y=!0}const m=f.find(Ee=>!!Ee.readsValue);if(m){const Ee=(O=m.readsValue)==null?void 0:O.getDataType(t);Ee&&((x=(P=this.body)==null?void 0:P.dataType)==null||x.merge(Ee,t))}y&&(t||(U=($=this.body)==null?void 0:$.dataType)==null||U.captureVersion());const T=this.getUniqueInputMaps();let g=(q=(Z=this.body)==null?void 0:Z.dataType)==null?void 0:q.entity;if(T.length&&(!g||g.id===G["primitive-entity"].void.id)){const Ee=Rp.new(t);Ee.parent=((H=this.body)==null?void 0:H.dataType).toReference(),Ee.name=`${De(this,this.project)} output definition`,Ee.description=`The definition of the output data type of the loop '${De(this,this.project)}'`;const Oe=Se(Ee,this.project);Oe.setParent((Y=this.body)==null?void 0:Y.dataType,t),Oe.hydrateAncestors(),t==null||t.add(Oe,ye.Added),Oe.addSelfToProject(t),Oe.initChildren(t),s.push(Oe),g=Oe,(z=(ie=this.body)==null?void 0:ie.dataType)==null||z.metaSync({inferred:!0},t),t||Oe.captureVersion()}const b=(g==null?void 0:g.properties)||[];(ee=(W=this.body)==null?void 0:W.dataType)!=null&&ee.inferred&&((X=(te=this.body)==null?void 0:te.dataType.entity)==null?void 0:X.type)===r.DefinitionEntity&&(T.forEach(Ee=>{var et,qe,ot,st,ft;const Oe=Ee.getDataType(t);let Fe=b.find(Et=>De(Et,this.project)===De(Ee,this.project)&&mn(Et.dataType,Ee.dataType));if(!Fe){const Et=sd.new(t);Et.name=De(Ee,this.project),Et.description=`Aggretated list of all previously outputted values from each iteration by the output '${De(Ee,this.project)}'`,Et.index=Ee.index,Et.required=((et=Ee.declaration)==null?void 0:et.required)||!1,Et.parent=((ot=(qe=this.body)==null?void 0:qe.dataType)==null?void 0:ot.entity).toReference();const pt=Se(Et,this.project);pt.hydrateAncestors(),pt.setParent((ft=(st=this.body)==null?void 0:st.dataType)==null?void 0:ft.entity,t),pt.addSelfToProject(t),t==null||t.add(pt,ye.Added),pt.initChildren(t),s.push(pt),Fe=pt,t||pt.captureVersion()}Fe.index!==Ee.index&&(Fe.metaSync({index:Ee.index},t),n.push(Fe));let We=Fe.getDataType(t);if(Oe&&(!We||!mn(We,Oe))){if(!We){const Et=Oe.clone(t,Fe);t==null||t.add(Et,ye.Added),Et.addSelfToProject(t),We=Et,s.push(Et),n.push(Fe)}We.merge(Oe,t)}if(!Oe&&!We){const Et={id:M.UUID.uuid(),version:M.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||j().toISOString(),author:M.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:r.DataType,foreignKeyRef:null,foreignKeyAllowed:null,options:[],implementationChooseOne:!1,staticEntities:null,interactiveEntities:null,index:null,actionEntities:null,parentRelationType:null,isList:!1,entity:null,asType:!1,like:!1,inferred:!1,andChildrenGroup:null,orChildrenGroup:null,parent:Fe.toReference()},pt=Se(Et,this.project);pt.hydrateAncestors(),pt.setParent(Fe,t),pt.addSelfToProject(t),t==null||t.add(pt,ye.Added),pt.initChildren(t),s.push(pt),t||pt.captureVersion()}}),this.reAttachAllTerminationInputMapsToDeclarations(t)),(ae=(re=this.body)==null?void 0:re.dataType)!=null&&ae.inferred&&((oe=(le=this.body)==null?void 0:le.dataType.entity)==null?void 0:oe.type)===r.DefinitionEntity&&b.filter(Oe=>!T.find(Fe=>De(Oe,this.project)===De(Fe,this.project))).forEach(Oe=>{if(!(t!=null&&t.hasRemoved(Oe.id))&&!Oe.deleted){const{updated:Le,removed:Fe}=Oe.remove({ignoreUpstream:!1},t);n.push(...Le),u.push(...Fe)}}),f.forEach(Ee=>{Ee.outputs.filter(Le=>{var Fe;return!Le.deleted&&!((Fe=Le.declaration)!=null&&Fe.deleted)}).forEach(Le=>{var tt,We,et;if(!(((et=(We=(tt=this.body)==null?void 0:tt.dataType)==null?void 0:We.entity)==null?void 0:et.properties)||[]).find(qe=>{var ot;return((ot=Le.declaration)==null?void 0:ot.id)===qe.id})&&!(t!=null&&t.hasRemoved(Le.id))&&!Le.deleted){const{updated:qe,removed:ot}=Le.remove({ignoreUpstream:!1},t);n.push(...qe),u.push(...ot)}})});const R=this.getUniqueInputMaps();if(f.every(Ee=>!Ee.readsValue)&&!R.length){const Ee=this.project.getBuiltIn(G["primitive-entity"].void.id);(be=(ce=this.body)==null?void 0:ce.dataType)==null||be.setEntity(Ee,t),n.push((Ce=this.body)==null?void 0:Ce.dataType)}return t==null||t.attemptAutoclose("sync-outputs-properties",this.id),{updated:_(n),added:_(s),removed:_(u),affected:_(e),self:this}}syncOutputMaps(t=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.SyncOutputs))){var T,g,b;const n=[],s=[],u=[],e=[],f=((b=(g=(T=this.body)==null?void 0:T.dataType)==null?void 0:g.entity)==null?void 0:b.properties)||[],y=this.outputs;return f.forEach(R=>{var O;let A=y.find(P=>{var x,$;return((x=P.declaration)==null?void 0:x.id)===R.id&&mn(($=P.declaration)==null?void 0:$.dataType,R.dataType)});if(A)((O=A.declaration)==null?void 0:O.id)!==R.id&&(A.setDeclaration(R,t),n.push(A));else{const P={dataType:null,id:M.UUID.uuid(),version:M.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||j().toISOString(),author:M.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:r.OutputMap,index:R.index,declaration:R.toJSON(),writesValues:[],parent:this.toReference()},x=Se(P,this.project);x.hydrateAncestors(),x.setParent(this,t),x.addSelfToProject(t),t==null||t.add(x,ye.Added),x.initChildren(t),s.push(x),t||x.captureVersion(),A=x}A.index!==R.index&&(A.metaSync({index:R.index},t),n.push(A))}),y.filter(R=>!f.find(A=>{var O;return((O=R.declaration)==null?void 0:O.id)===A.id})).forEach(R=>{const{updated:I,removed:A}=R.remove({ignoreUpstream:!1},t);n.push(...I),u.push(...A)}),this.outputs.forEach(R=>{const{updated:I,added:A,removed:O}=R.afterAllChildrenInitialized(t);n.push(...I),s.push(...A),u.push(...O)}),this.outputs.sort((R,I)=>R.index-I.index),t==null||t.attemptAutoclose(N.SyncOutputs,this.id),{updated:_(n),added:_(s),removed:_(u),affected:_(e),self:this}}createCurrentIterationNumberArgumentDeclaration(t=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,"create-current-iteration-number-argument-declaration"))){const n=[],s=[],u=[],e=[];let y=this.body.inputs.find(b=>{var R;return b.name===Rn.CURRENT_ITERATION_NUMBER_ARG_NAME||b.id===((R=this.currentIterationNumberArgumentDeclaration)==null?void 0:R.id)});const m=this.getCurrentIterationNumberBuiltInValueDescriptor();if(!y){const b={id:M.UUID.uuid(),version:M.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||j().toISOString(),author:M.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:r.ArgumentDeclaration,name:Rn.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:[]},R=Se(b,this.project);R.hydrateAncestors(),R.setParent(this.body,t),R.addSelfToProject(t),t==null||t.add(R,ye.Added),R.initChildren(t),s.push(R),t||R.captureVersion(),y=R}!y.index&&y.index!==0&&(y.metaSync({index:0},t),n.push(y)),(!y.implements||!y.implements.find(b=>b.id===m.id))&&(y.addImplementation(m,t),n.push(y));let g=y.getDataType(t);if(!g){const b={id:M.UUID.uuid(),version:M.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||j().toISOString(),author:M.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:r.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:y.toReference()},R=Se(b,this.project);R.hydrateAncestors(),R.setParent(y,t),R.addSelfToProject(t),t==null||t.add(R,ye.Added),R.initChildren(t),s.push(R),t||R.captureVersion(),g=R}if(!g.entity||g.entity.type!==r.PrimitiveEntity||g.entity.name!==me.Number||g.entity.id!==G["primitive-entity"].number.id){const b=this.project.getBuiltIn(G["primitive-entity"].number.id);g.setEntity(b,t),n.push(g)}return t==null||t.attemptAutoclose("create-current-iteration-number-argument-declaration",this.id),{updated:_(n),added:_(s),removed:_(u),affected:_(e),self:this}}removeExtraBodyArgumentDeclarations(t=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,"remove-extra-body-argument-declarations"))){const n=[],s=[],u=[],e=[],f=this.body.inputs,y=this.getDataType();return f.filter(T=>{var g,b,R,I,A;return T===this.currentIterationNumberArgumentDeclaration||T===this.currentValueArgumentDeclaration?!1:((g=y==null?void 0:y.entity)==null?void 0:g.id)===G["primitive-entity"].void.id||((b=y==null?void 0:y.entity)==null?void 0:b.id)===void 0?!0:((I=(R=T.dataType)==null?void 0:R.entity)==null?void 0:I.id)!==((A=y==null?void 0:y.entity)==null?void 0:A.id)}).forEach(T=>{const{updated:g,removed:b}=T.remove({ignoreUpstream:!1},t);n.push(...g),u.push(...b)}),t==null||t.attemptAutoclose("remove-extra-body-argument-declarations",this.id),{updated:_(n),added:_(s),removed:_(u),affected:_(e),self:this}}createCurrentValueInputBasedOnInputMap(t=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,"create-current-value-input-based-on-input-map"))){var T,g,b,R,I,A,O,P,x;const n=[],s=[],u=[],e=[];switch(this.declaration.id){case ei.List:{const $=this.body.inputs.find(q=>!!q.implements.find(H=>H.id===G[r.Loop][ei.List].body.inputs.currentValue.id)),U=this.inputs.find(q=>{var H;return((H=q.declaration)==null?void 0:H.id)===G[r.Loop][ei.List].inputs.list.id});if(!U)break;const Z=this.getCurrentValueBuiltInValueDescriptor();if($){Z&&!$.implements.find(ie=>ie.id===Z.id)&&($.addImplementation(Z,t),n.push($));let H=$.getDataType(t);if(!H){const ie={id:M.UUID.uuid(),version:M.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||j().toISOString(),author:M.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:r.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:(T=this.currentValueArgumentDeclaration)==null?void 0:T.toReference()},z=Se(ie,this.project);z.hydrateAncestors(),z.setParent(this.currentValueArgumentDeclaration,t),z.addSelfToProject(t),t==null||t.add(z,ye.Added),z.initChildren(t),s.push(z),t||z.captureVersion(),H=z}const Y=U.getDataType(t);H.merge(Y,t),H.metaSync({isList:!1},t)}else{const q={id:M.UUID.uuid(),version:M.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||j().toISOString(),author:M.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:r.ArgumentDeclaration,name:Rn.CURRENT_VALUE_ARG_NAME,codeName:null,description:null,defaultValue:null,index:this.body.inputs.length,constant:!0,required:!0,implements:[Z],writesValues:[],dataType:null,parent:this.body.toReference()},H=Se(q,this.project);H.hydrateAncestors(),H.setParent(this.body,t),H.addSelfToProject(t),t==null||t.add(H,ye.Added),H.initChildren(t),Z&&!H.implements.find(Y=>Y.id===Z.id)&&(H.addImplementation(Z,t),n.push(H)),s.push(H),t||H.captureVersion()}break}case ei.ManualFlow:break;case ei.Counted:break;case ei.ObjectKeys:{const $=this.body.inputs.find(q=>!!q.implements.find(H=>H.id===G[r.Loop][ei.ObjectKeys].body.inputs.currentValue.id));if(!this.inputs.find(q=>{var H;return((H=q.declaration)==null?void 0:H.id)===G[r.Loop][ei.ObjectKeys].inputs.object.id}))break;const Z=this.getCurrentValueBuiltInValueDescriptor();if($){Z&&!$.implements.find(Y=>Y.id===Z.id)&&($.addImplementation(Z),n.push($));let H=$.getDataType(t);if(H){const Y=this.project.getBuiltIn(G["primitive-entity"].string.id);((b=H.entity)==null?void 0:b.id)!==Y.id&&(H.setEntity(Y,t),n.push(H))}else{const Y={id:M.UUID.uuid(),version:M.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||j().toISOString(),author:M.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:r.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()},ie=Se(Y,this.project);ie.hydrateAncestors(),ie.setParent(this.currentValueArgumentDeclaration,t),ie.addSelfToProject(t),t==null||t.add(ie,ye.Added),ie.initChildren(t),t||ie.captureVersion(),H=ie}}else{const q={id:M.UUID.uuid(),version:M.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||j().toISOString(),author:M.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:r.ArgumentDeclaration,name:Rn.CURRENT_VALUE_ARG_NAME,codeName:null,description:null,defaultValue:null,index:this.body.inputs.length,constant:!0,required:!0,implements:[Z],writesValues:[],dataType:null,parent:this.body.toReference()},H=Se(q,this.project);H.hydrateAncestors(),H.setParent(this.body,t),H.addSelfToProject(t),t==null||t.add(H,ye.Added),H.initChildren(t),Z&&!H.implements.find(Y=>Y.id===Z.id)&&(H.addImplementation(Z,t),n.push(H)),s.push(H),t||H.captureVersion()}break}case ei.ObjectValues:{const $=this.body.inputs.find(q=>!!q.implements.find(H=>H.id===G[r.Loop][ei.ObjectValues].body.inputs.currentValue.id)),U=this.inputs.find(q=>{var H;return((H=q.declaration)==null?void 0:H.id)===G[r.Loop][ei.ObjectValues].inputs.object.id});if(!U)break;const Z=this.getCurrentValueBuiltInValueDescriptor();if($){Z&&!$.implements.find(Y=>Y.id===Z.id)&&($.addImplementation(Z,t),n.push($));let H=$.getDataType(t);if(H){const Y=U.getDataType(t),ie=((A=Y==null?void 0:Y.entity)==null?void 0:A.properties)||[];(O=H.orChildrenGroup)==null||O.forEach(z=>{const{updated:W,removed:ee}=z.remove({ignoreUpstream:!1},t);n.push(...W),u.push(...ee)}),ie.forEach(z=>{if(!z.getDataType(t)){const ee={id:M.UUID.uuid(),version:M.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||j().toISOString(),author:M.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:r.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:vt.OrDataTypeGroup,parent:H.toReference()},te=Se(ee,this.project);te.hydrateAncestors(),te.setParent(H,t),te.addSelfToProject(t),t==null||t.add(te,ye.Added),te.initChildren(t),t||te.captureVersion(),s.push(te)}})}else{const Y={id:M.UUID.uuid(),version:M.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||j().toISOString(),author:M.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:r.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:(R=this.currentValueArgumentDeclaration)==null?void 0:R.toReference()},ie=Se(Y,this.project);ie.hydrateAncestors(),ie.setParent(this.currentValueArgumentDeclaration,t),ie.addSelfToProject(t),t==null||t.add(ie,ye.Added),ie.initChildren(t),t||ie.captureVersion(),H=ie;const z=U.getDataType(t);(((I=z==null?void 0:z.entity)==null?void 0:I.properties)||[]).forEach(ee=>{if(!ee.getDataType(t)){const X={id:M.UUID.uuid(),version:M.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||j().toISOString(),author:M.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:r.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:vt.OrDataTypeGroup,parent:ie.toReference()},re=Se(X,this.project);re.hydrateAncestors(),re.setParent(ie,t),re.addSelfToProject(t),t==null||t.add(re,ye.Added),re.initChildren(t),t||re.captureVersion(),s.push(re)}})}}else{const q={id:M.UUID.uuid(),version:M.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||j().toISOString(),author:M.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:r.ArgumentDeclaration,name:Rn.CURRENT_VALUE_ARG_NAME,codeName:null,description:null,constant:!0,defaultValue:null,index:this.body.inputs.length,required:!0,implements:[Z],writesValues:[],dataType:null,parent:this.body.toReference()},H=Se(q,this.project);H.hydrateAncestors(),H.setParent(this.body,t),H.addSelfToProject(t),t==null||t.add(H,ye.Added),H.initChildren(t),Z&&!H.implements.find(Y=>Y.id===Z.id)&&(H.addImplementation(Z,t),n.push(H)),s.push(H),t||H.captureVersion()}break}case ei.String:{const $=this.body.inputs.find(q=>!!q.implements.find(H=>H.id===G[r.Loop][ei.String].body.inputs.currentValue.id));if(!this.inputs.find(q=>{var H;return((H=q.declaration)==null?void 0:H.id)===G[r.Loop][ei.String].inputs.string.id}))break;const Z=this.getCurrentValueBuiltInValueDescriptor();if($){Z&&!$.implements.find(Y=>Y.id===Z.id)&&($.addImplementation(Z,t),n.push($));let H=$.getDataType(t);if(H){const Y=this.project.getBuiltIn(G["primitive-entity"].string.id);((x=H.entity)==null?void 0:x.id)!==Y.id&&(H.setEntity(Y,t),n.push(H))}else{const Y={id:M.UUID.uuid(),version:M.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||j().toISOString(),author:M.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:r.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:(P=this.currentValueArgumentDeclaration)==null?void 0:P.toReference()},ie=Se(Y,this.project);ie.hydrateAncestors(),ie.setParent(this.currentValueArgumentDeclaration,t),ie.addSelfToProject(t),t==null||t.add(ie,ye.Added),ie.initChildren(t),t||ie.captureVersion(),s.push(ie),H=ie}}else{const q={id:M.UUID.uuid(),version:M.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||j().toISOString(),author:M.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:r.ArgumentDeclaration,name:Rn.CURRENT_VALUE_ARG_NAME,codeName:null,description:null,index:this.body.inputs.length,required:!0,constant:!0,defaultValue:null,implements:[Z],writesValues:[],dataType:null,parent:this.body.toReference()},H=Se(q,this.project);H.hydrateAncestors(),H.setParent(this.body,t),H.addSelfToProject(t),t==null||t.add(H,ye.Added),H.initChildren(t),Z&&!H.implements.find(Y=>Y.id===Z.id)&&(H.addImplementation(Z,t),n.push(H)),s.push(H),t||H.captureVersion()}break}}const{updated:f,added:y,removed:m}=this.removeExtraBodyArgumentDeclarations(t);return n.push(...f),s.push(...y),u.push(...m),t==null||t.attemptAutoclose("create-current-value-input-based-on-input-map",this.id),{updated:_(n),added:_(s),removed:_(u),affected:_(e),self:this}}syncFixedBodyArgumentDeclarations(t=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,"sync-fixed-body-argument-declarations"))){const n=[],s=[],u=[],e=[],{updated:f,added:y,removed:m}=this.createCurrentIterationNumberArgumentDeclaration(t);n.push(...f),s.push(...y),u.push(...m);const{updated:T,added:g,removed:b}=this.createCurrentValueInputBasedOnInputMap(t);return n.push(...T),s.push(...g),u.push(...b),t==null||t.attemptAutoclose("sync-fixed-body-argument-declarations",this.id),{updated:_(n),added:_(s),removed:_(u),affected:_(e),self:this}}syncInputMaps(t=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,"sync-input-maps"))){const n=[],s=[],u=[],e=[];switch(this.declaration.id){case ei.List:{let f=null;if(this.inputs.forEach(m=>{var T;((T=m.declaration)==null?void 0:T.id)===G[r.Loop]["list-loop"].inputs.list.id?f=m:(m.remove({ignoreUpstream:!1},t),u.push(m))}),f){if(f.declaration.id!==G[r.Loop]["list-loop"].inputs.list.id){const m=this.project.get(G[r.Loop]["list-loop"].inputs.list.id);f.setDeclaration(m,t),n.push(f)}}else{const m=this.project.get(G[r.Loop]["list-loop"].inputs.list.id),T={dataType:null,id:M.UUID.uuid(),version:M.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||j().toISOString(),author:M.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:r.InputMap,parentRelationType:null,name:null,codeName:null,description:null,index:0,declaration:m.toJSON(),readsValue:null,defaultValue:null,parent:this.toReference()},g=Se(T,this.project);g.hydrateAncestors(),g.setParent(this,t),g.addSelfToProject(t),t==null||t.add(g,ye.Added),g.initChildren(t),t||g.captureVersion(),s.push(g)}[...this.inputs].forEach(m=>{var T;((T=m.declaration)==null?void 0:T.id)!==G[r.Loop]["list-loop"].inputs.list.id&&(m.remove({ignoreUpstream:!1},t),u.push(m))}),this.inputs.sort((m,T)=>j(m.createdAt).isBefore(j(T.createdAt))?-1:1).forEach((m,T)=>{T!==0&&(m.remove({ignoreUpstream:!1},t),u.push(m))});break}case ei.ManualFlow:{this.inputs.forEach(f=>{f.remove({ignoreUpstream:!1},t),u.push(f)});break}case ei.Counted:{let f=null;if(this.inputs.forEach(m=>{var T;((T=m.declaration)==null?void 0:T.id)===G[r.Loop]["counted-loop"].inputs.number.id?f=m:(m.remove({ignoreUpstream:!1},t),u.push(m))}),f){if(f.declaration.id!==G[r.Loop]["counted-loop"].inputs.number.id){const m=this.project.get(G[r.Loop]["counted-loop"].inputs.number.id);f.setDeclaration(m,t),n.push(f)}}else{const m=this.project.get(G[r.Loop]["counted-loop"].inputs.number.id),T={dataType:null,id:M.UUID.uuid(),version:M.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||j().toISOString(),author:M.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:r.InputMap,parentRelationType:null,name:null,codeName:null,description:null,index:0,declaration:m.toJSON(),readsValue:null,defaultValue:null,parent:this.toReference()},g=Se(T,this.project);g.hydrateAncestors(),g.setParent(this,t),g.addSelfToProject(t),t==null||t.add(g,ye.Added),g.initChildren(t),t||g.captureVersion(),s.push(g)}[...this.inputs].forEach(m=>{var T;((T=m.declaration)==null?void 0:T.id)!==G[r.Loop]["counted-loop"].inputs.number.id&&(m.remove({ignoreUpstream:!1},t),u.push(m))}),this.inputs.sort((m,T)=>j(m.createdAt).isBefore(j(T.createdAt))?-1:1).forEach((m,T)=>{T!==0&&(m.remove({ignoreUpstream:!1},t),u.push(m))});break}case ei.ObjectKeys:{let f=null;if(this.inputs.forEach(m=>{var T;((T=m.declaration)==null?void 0:T.id)===G[r.Loop]["object-keys-loop"].inputs.object.id?f=m:(m.remove({ignoreUpstream:!1},t),u.push(m))}),f){if(f.declaration.id!==G[r.Loop]["object-keys-loop"].inputs.object.id){const m=this.project.get(G[r.Loop]["object-keys-loop"].inputs.object.id);f.setDeclaration(m,t),n.push(f)}}else{const m=this.project.get(G[r.Loop]["object-keys-loop"].inputs.object.id),T={dataType:null,id:M.UUID.uuid(),version:M.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||j().toISOString(),author:M.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:r.InputMap,parentRelationType:null,name:null,codeName:null,description:null,index:0,declaration:m.toJSON(),readsValue:null,defaultValue:null,parent:this.toReference()},g=Se(T,this.project);g.hydrateAncestors(),g.setParent(this,t),g.addSelfToProject(t),t==null||t.add(g,ye.Added),g.initChildren(t),t||g.captureVersion(),s.push(g)}[...this.inputs].forEach(m=>{var T;((T=m.declaration)==null?void 0:T.id)!==G[r.Loop]["object-keys-loop"].inputs.object.id&&(m.remove({ignoreUpstream:!1},t),u.push(m))}),this.inputs.sort((m,T)=>j(m.createdAt).isBefore(j(T.createdAt))?-1:1).forEach((m,T)=>{T!==0&&(m.remove({ignoreUpstream:!1},t),u.push(m))});break}case ei.ObjectValues:{let f=null;if(this.inputs.forEach(m=>{var T;((T=m.declaration)==null?void 0:T.id)===G[r.Loop]["object-values-loop"].inputs.object.id?f=m:(m.remove({ignoreUpstream:!1},t),u.push(m))}),f){if(f.declaration.id!==G[r.Loop]["object-values-loop"].inputs.object.id){const m=this.project.get(G[r.Loop]["object-values-loop"].inputs.object.id);f.setDeclaration(m,t),n.push(f)}}else{const m=this.project.get(G[r.Loop]["object-values-loop"].inputs.object.id),T={dataType:null,id:M.UUID.uuid(),version:M.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||j().toISOString(),author:M.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:r.InputMap,parentRelationType:null,name:null,codeName:null,description:null,index:0,declaration:m.toJSON(),readsValue:null,defaultValue:null,parent:this.toReference()},g=Se(T,this.project);g.hydrateAncestors(),g.setParent(this,t),g.addSelfToProject(t),t==null||t.add(g,ye.Added),g.initChildren(t),t||g.captureVersion(),s.push(g)}[...this.inputs].forEach(m=>{var T;((T=m.declaration)==null?void 0:T.id)!==G[r.Loop]["object-values-loop"].inputs.object.id&&(m.remove({ignoreUpstream:!1},t),u.push(m))}),this.inputs.sort((m,T)=>j(m.createdAt).isBefore(j(T.createdAt))?-1:1).forEach((m,T)=>{T!==0&&(m.remove({ignoreUpstream:!1},t),u.push(m))});break}case ei.String:{let f=null;if(this.inputs.forEach(m=>{var T;((T=m.declaration)==null?void 0:T.id)===G[r.Loop]["string-loop"].inputs.string.id?f=m:(m.remove({ignoreUpstream:!1},t),u.push(m))}),f){if(f.declaration.id!==G[r.Loop]["string-loop"].inputs.string.id){const m=this.project.get(G[r.Loop]["string-loop"].inputs.string.id);f.setDeclaration(m,t),n.push(f)}}else{const m=this.project.get(G[r.Loop]["string-loop"].inputs.string.id),T={dataType:null,id:M.UUID.uuid(),version:M.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||j().toISOString(),author:M.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:r.InputMap,parentRelationType:null,name:null,codeName:null,description:null,index:0,declaration:m.toJSON(),readsValue:null,defaultValue:null,parent:this.toReference()},g=Se(T,this.project);g.hydrateAncestors(),g.setParent(this,t),g.addSelfToProject(t),t==null||t.add(g,ye.Added),g.initChildren(t),t||g.captureVersion(),s.push(g)}[...this.inputs].forEach(m=>{var T;((T=m.declaration)==null?void 0:T.id)!==G[r.Loop]["string-loop"].inputs.string.id&&(m.remove({ignoreUpstream:!1},t),u.push(m))}),this.inputs.sort((m,T)=>j(m.createdAt).isBefore(j(T.createdAt))?-1:1).forEach((m,T)=>{T!==0&&(m.remove({ignoreUpstream:!1},t),u.push(m))});break}}return this.inputs.forEach(f=>{const{updated:y,added:m,removed:T}=f.afterAllChildrenInitialized(t);n.push(...y),s.push(...m),u.push(...T)}),this.inputs.sort((f,y)=>f.index-y.index),t==null||t.attemptAutoclose("sync-input-maps",this.id),{updated:_(n),added:_(s),removed:_(u),affected:_(e),self:this}}getValueInputMapDeclarationId(){switch(this.declaration.id){case ei.List:return G[r.Loop]["list-loop"].inputs.list.id;case ei.ObjectKeys:return G[r.Loop]["object-keys-loop"].inputs.object.id;case ei.ObjectValues:return G[r.Loop]["object-values-loop"].inputs.object.id;case ei.String:return G[r.Loop]["string-loop"].inputs.string.id;case ei.Counted:return G[r.Loop]["counted-loop"].inputs.number.id;default:return null}}getCurrentValueBuiltInValueDescriptor(){var n;if(this.declaration.id===ei.ManualFlow||this.declaration.id===ei.Counted)return null;const t=(n=G[r.Loop][this.declaration.id].body.inputs.currentValue)==null?void 0:n.id;return t?this.project.get(t):null}getCurrentIterationNumberBuiltInValueDescriptor(){const t=G[r.Loop][this.declaration.id].body.inputs.iterationNumber.id;return this.project.get(t)}syncBody(t=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,"sync-body"))){var m;const n=[],s=[],u=[],e=[],f=G[r.Loop][this.declaration.id].body.id,y=this.project.getBuiltIn(f);if(this.body)((m=this.body.implements)==null?void 0:m.id)!==y.id&&(this.body.setImplements(y,t),this.body.setParent(this,t),n.push(this.body));else{const T=bf.new(t);T.implements=y.toJSON(),T.name=y.name,T.parent=this.toReference();const g=Se(T,this.project);g.hydrateAncestors(),g.setParent(this,t),g.addSelfToProject(t),t==null||t.add(g,ye.Added),g.initChildren(t),t||g.captureVersion(),s.push(g)}return t==null||t.attemptAutoclose("sync-body",this.id),{self:this,updated:_(n),added:_(s),removed:_(u),affected:_(e)}}checkIsSynced(){var b,R,I,A,O,P,x,$,U,Z,q,H,Y,ie,z,W,ee,te,X;if((!this.body||!((b=this.body)!=null&&b.dataType)||!((R=this.body)!=null&&R.dataType.entity))&&this.id)return!1;const t=[ei.List,ei.ObjectKeys,ei.ObjectValues,ei.String],n=this.body.inputs.find(re=>re.implements.find(ae=>ae.id===G[r.Loop][this.declaration.id].body.inputs.iterationNumber.id))||null,s=this.body.inputs.find(re=>re.implements.find(ae=>{var le;return ae.id===((le=G[r.Loop][this.declaration.id].body.inputs.currentValue)==null?void 0:le.id)}))||null;if(!n||t.includes(this.declaration.id)&&!s)return!1;if(this.declaration.id===ei.List){const re=this.inputs.find(ae=>{var le;return((le=ae.declaration)==null?void 0:le.id)===G[r.Loop]["list-loop"].inputs.list.id});if(re&&s){const ae=re.getDataType(null),le=s.getDataType(null),oe=mn(ae,le,{ignoreTopListDif:!0});if(!oe.compatible||!oe.exact||(le==null?void 0:le.isList)!==!1)return!1}}const u=[...this.breakStatements,...this.continueStatements],e=this.getDataType();if(((I=e==null?void 0:e.entity)==null?void 0:I.id)!==G["primitive-entity"].void.id&&(e!=null&&e.entity||e!=null&&e.isGroup||e!=null&&e.foreignKeyRef)){if(!this.body.inputs.find(ae=>{var le,oe,ce;return((oe=(le=ae.dataType)==null?void 0:le.entity)==null?void 0:oe.id)===((ce=e==null?void 0:e.entity)==null?void 0:ce.id)})||((A=e==null?void 0:e.entity)==null?void 0:A.type)===r.DefinitionEntity&&(!(e==null?void 0:e.entity).properties.every(oe=>this.outputs.find(ce=>{var be;return((be=ce.declaration)==null?void 0:be.id)===oe.id}))||!u.every(oe=>{const ce=oe.outputs.filter(Ee=>!Ee.deleted),be=(e==null?void 0:e.entity).properties.every(Ee=>ce.find(Oe=>{var Le;return((Le=Oe.declaration)==null?void 0:Le.id)===Ee.id})),Ce=ce.every(Ee=>(e==null?void 0:e.entity).properties.find(Oe=>{var Le;return Oe.id===((Le=Ee.declaration)==null?void 0:Le.id)}));return be&&Ce})))return!1}else if(this.body.inputs.find(le=>{var oe,ce,be;return((ce=(oe=le.dataType)==null?void 0:oe.entity)==null?void 0:ce.id)===((be=e==null?void 0:e.entity)==null?void 0:be.id)})||this.outputs.length>0||![...this.breakStatements,...this.continueStatements].every(le=>le.outputs.filter(oe=>!oe.deleted).length===0))return!1;if([ei.List,ei.Counted,ei.ObjectKeys,ei.ObjectValues,ei.String].includes(this.declaration.id)){if(this.inputs.length!==1)return!1;const re=this.inputs[0],ae=this.getValueInputMapDeclarationId();if(((O=re.declaration)==null?void 0:O.id)!==ae)return!1}else if(this.inputs.length>0)return!1;if((x=(P=this.body)==null?void 0:P.dataType)!=null&&x.inferred){const re=this.getUniqueInputMaps();if(u.every(ce=>!ce.readsValue)&&!re.length&&((Z=(U=($=this.body)==null?void 0:$.dataType)==null?void 0:U.entity)==null?void 0:Z.id)!==G["primitive-entity"].void.id)return!1;const le=u.find(ce=>ce.readsValue),oe=(Y=(H=(q=le==null?void 0:le.readsValue)==null?void 0:q.getDataType(null))==null?void 0:H.entity)==null?void 0:Y.id;if(oe&&oe!==((W=(z=(ie=this.body)==null?void 0:ie.dataType)==null?void 0:z.entity)==null?void 0:W.id))return!1}const y=((X=(te=(ee=this.body)==null?void 0:ee.dataType)==null?void 0:te.entity)==null?void 0:X.properties)||[],m=this.outputs,T=y.every(re=>m.find(ae=>{var le;return((le=ae.declaration)==null?void 0:le.id)===re.id})),g=m.every(re=>y.find(ae=>{var le;return ae.id===((le=re.declaration)==null?void 0:le.id)}));return!(!T||!g)}syncFromDataType(t=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,"sync-from-data-type"))){const n=[],s=[],u=[],e=[],{updated:f,added:y,removed:m}=this.syncOutputDataType(t);n.push(...f),s.push(...y),u.push(...m);const{updated:T,added:g,removed:b}=this.syncBodyArgumentsDeclarations(t);n.push(...T),s.push(...g),u.push(...b);const{updated:R,added:I,removed:A}=this.syncBodyInputIndexes(t);n.push(...R),s.push(...I),u.push(...A);const{updated:O,added:P,removed:x}=this.syncOutputMaps(t);return n.push(...O),s.push(...P),u.push(...x),t==null||t.attemptAutoclose("sync-from-data-type",this.id),{self:this,updated:_(n),added:_(s),removed:_(u),affected:_(e)}}syncChildren(t=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,"sync-children"))){const n=[],s=[],u=[],e=[],{updated:f,added:y,removed:m}=this.syncBody(t);n.push(...f),s.push(...y),u.push(...m);const{updated:T,added:g,removed:b}=this.syncInputMaps(t);n.push(...T),s.push(...g),u.push(...b);const{updated:R,added:I,removed:A}=this.syncTerminationStatements(t);n.push(...R),s.push(...I),u.push(...A);const{updated:O,added:P,removed:x}=this.syncFromDataType(t);return n.push(...O),s.push(...P),u.push(...x),t==null||t.attemptAutoclose("sync-children",this.id),{self:this,updated:_(n),added:_(s),removed:_(u),affected:_(e)}}getUnusedInputs(){return this.inputs.filter(t=>t.suggestion||!t.readsValue&&!t.defaultValue)}getUnusedOutputs(){return this.outputs.filter(t=>t.suggestion||!t.writesValues.length)}getUsedInputs(){return this.inputs.filter(t=>!t.suggestion&&(t.readsValue||t.defaultValue))}getUsedOutputs(){return this.outputs.filter(t=>!t.suggestion&&t.writesValues.length)}addValueReader(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.AddValueReader))){var e,f,y,m;if(!this.checkCanEditFromScopeOwnerWithSideEffects(this,N.AddValueReader,n))return this;(t==null?void 0:t.id)===this.id&&(n==null||n.event({id:`${N.SetValueWriter}-${this.id}`,action:N.SetValueWriter,owner:this,errorReason:at.CannotValueWriteItself,rootAction:((e=n==null?void 0:n.self)==null?void 0:e.id)===this.id&&(n==null?void 0:n.actionName)===N.SetValueWriter}));const s=t.type===r.InputMap&&t.parent.type===r.VariableInstance&&((f=t.declaration)==null?void 0:f.type)===r.Property&&((y=t.declaration)==null?void 0:y.constant),u=t.type===r.VariableInstance&&((m=t.declaration)==null?void 0:m.constant);return(s||u)&&t?(n==null||n.event({id:`${N.SetValueWriter}-${this.id}--${t.id}`,action:N.SetValueWriter,owner:t,counterpart:this,errorReason:at.ValueReadingOverridesConstantVariable,rootAction:!1}),n==null||n.attemptAutoclose(N.AddValueReader,this.id),this):this.writesValues.includes(t)?(n==null||n.attemptAutoclose(N.AddValueReader,this.id),this):(this.writesValues.push(t),n==null||n.add(this,ye.Affected),this)}setDataType(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.SetDataType))){if(!this.checkCanEdit(this,n))return pe.Logger.warn(`[setDataType] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(N.SetDataType,this.id),this;const s=this.dataType;return(s==null?void 0:s.id)!==(t==null?void 0:t.id)&&(s==null||s.remove({ignoreUpstream:!0},n),this.dataType=t,this.subscribeToDependencies(),n==null||n.add(this,ye.Affected)),n==null||n.attemptAutoclose(N.SetDataType,this.id),this}removeValueReader(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.RemoveValueReader))){return this.checkCanEditFromScopeOwnerWithSideEffects(this,N.RemoveValueReader,n)?this.writesValues.includes(t)?(this.writesValues=this.writesValues.filter(s=>s.id!==t.id),n==null||n.add(this,ye.Affected),this):(n==null||n.attemptAutoclose(N.RemoveValueReader,this.id),this):this}removeDataType(t=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.RemoveDataType))){return this.checkCanEdit(this,t)?(this.dataType&&(this.dataType.remove({ignoreUpstream:!0},t),t==null||t.add(this,ye.Affected),this.dataType=null),t==null||t.attemptAutoclose(N.RemoveDataType,this.id),this):(pe.Logger.warn(`[removeDataType] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),t==null||t.attemptAutoclose(N.RemoveDataType,this.id),this)}getDataType(t=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,"get-data-type"))){var n;return t==null||t.attemptAutoclose("get-data-type",this.id),this.dataType||((n=this.body)==null?void 0:n.dataType)||null}};C(Rn,"repository",{APICreate:async(t,...n)=>t,APIUpdate:async(t,...n)=>t,APIDelete:async(t,...n)=>t,APIClone:async(t,...n)=>{},APILoad:async(t,...n)=>null,APILoadVersion:async(t,n,...s)=>null}),C(Rn,"type",r.Loop),C(Rn,"USER_MANAGED_PARENT_TYPES",[...xa,r.Project]),C(Rn,"PARENT_TYPES",[...Jt.USER_MANAGED_PARENT_TYPES]),C(Rn,"CURRENT_ITERATION_NUMBER_ARG_NAME","Current iteration number"),C(Rn,"CURRENT_VALUE_ARG_NAME","Current value"),C(Rn,"MUTABLE_BASE_PROPERTIES",["catchesError"]),C(Rn,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),C(Rn,"BASE_PROPERTIES",[...Rn.MUTABLE_BASE_PROPERTIES,...Rn.INMUTABLE_BASE_PROPERTIES]),C(Rn,"MUTABLE_META_PROPERTIES",[...Rn.MUTABLE_BASE_PROPERTIES,"x","y"]),C(Rn,"INMUTABLE_META_PROPERTIES",[...Rn.INMUTABLE_BASE_PROPERTIES]),C(Rn,"META_PROPERTIES",[...Rn.MUTABLE_META_PROPERTIES,...Rn.INMUTABLE_META_PROPERTIES]),C(Rn,"MUTABLE_UPSTREAM_PROPERTIES",["calledBySuccess","calledByError","calledByEntry"]),C(Rn,"INMUTABLE_UPSTREAM_PROPERTIES",["parent","declaration","dataType"]),C(Rn,"UPSTREAM_PROPERTIES",[...Rn.MUTABLE_UPSTREAM_PROPERTIES,...Rn.INMUTABLE_UPSTREAM_PROPERTIES]),C(Rn,"MUTABLE_DOWNSTREAM_PROPERTIES",["body","inputs","outputs","successCalls","errorCalls","error","breakStatements","continueStatements"]),C(Rn,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),C(Rn,"DOWNSTREAM_PROPERTIES",[...Rn.MUTABLE_DOWNSTREAM_PROPERTIES,...Rn.INMUTABLE_DOWNSTREAM_PROPERTIES]),C(Rn,"PROPERTIES",[...Rn.META_PROPERTIES,...Rn.UPSTREAM_PROPERTIES,...Rn.DOWNSTREAM_PROPERTIES]);let n0=Rn;async function X0t(a,p={}){const t=pe.YieldTracker.from(p),n=Io(a),s=Ro(a),u=Ao(a),e=tmt(a),f=[...n,...s,...u,...e],y=tn(a.errors,f);await t.tick();for(const m of a.inputs)await m.validateAsync({tracker:t});for(const m of a.andChildrenGroup||[])await m.validateAsync({tracker:t});for(const m of a.orChildrenGroup||[])await m.validateAsync({tracker:t});return y}function emt(a){a.inputs.forEach(e=>e.validate());const p=Io(a),t=Ro(a),n=Ao(a),s=tmt(a),u=[...p,...t,...n,...s];return(a.andChildrenGroup||[]).forEach(e=>e.validate()),(a.orChildrenGroup||[]).forEach(e=>e.validate()),tn(a.errors,u)}function tmt(a){var t,n;const p=[];if(((t=a.declaration)==null?void 0:t.id)!==G.condition["condition-group-and"].id&&((n=a.declaration)==null?void 0:n.id)!==G.condition["condition-group-or"].id)return p;if(!a.andChildrenGroup&&!a.orChildrenGroup){const s=bi({id:`${a.id}--${Ne.EmptyGroupCondition}`,message:`Condition "${De(a,a.project)}" with id "${a.id}" does not have any nested conditions. So it doesn't do anything.`,severity:Ie.Error,code:Ne.EmptyGroupCondition,entity:a});p.push(s.error)}return tn(a.errors,p)}const qgn=Object.freeze(Object.defineProperty({__proto__:null,validate:emt,validateAsync:X0t},Symbol.toStringTag,{value:"Module"}));var imt=(a=>(a.Parent="parent",a))(imt||{});const Er=class Er extends Ps{constructor(t,n){super(t);C(this,"initialData");C(this,"id");C(this,"x");C(this,"y");C(this,"type",r.Condition);C(this,"index",null);C(this,"successCalls",[]);C(this,"errorCalls",[]);C(this,"declaration");C(this,"inputs",[]);C(this,"calledBySuccess",[]);C(this,"calledByError",[]);C(this,"calledByEntry",[]);C(this,"andChildrenGroup",null);C(this,"orChildrenGroup",null);C(this,"project");C(this,"errors",[]);C(this,"parent");C(this,"detachedDependents",{});C(this,"knownVersions",null);C(this,"activeVersion",!1);C(this,"initialized",!1);C(this,"startedInitialization",!1);this.initialData=t,this.project=n,this.id=t.id,this.x=t.x,this.y=t.y,this.index=t.index??null}static new(t=null){return{id:M.UUID.uuid(),version:M.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||j().toISOString(),author:(t==null?void 0:t.author)||M.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:r.Condition,declaration:null,index:null,inputs:[],parent:null,andChildrenGroup:null,orChildrenGroup:null,calledByEntry:[],calledBySuccess:[],calledByError:[],errorCalls:[],successCalls:[],x:0,y:0}}static fromGenerationTarget(t,n,s){var I,A;const u=s===void 0?n.addChangeSet(new de(n,M.sessionAuthor,j().toISOString(),n,!0,N.CreateFromGenerationTarget)):s;let e=n;if(t.parent){const O=ge(t.parent);e=n.get(O)}const f=(t.calledByEntry||[]).map(O=>{const P=ge(O);return n.get(P)}),y=(t.calledBySuccess||[]).map(O=>{const P=ge(O);return n.get(P)}),m=(t.calledByError||[]).map(O=>{const P=ge(O);return n.get(P)});let T;if(t.declaration){const O=ge(t.declaration);T=n.get(O)}let g=null;e&&e.type===r.Condition&&(((I=e.declaration)==null?void 0:I.id)===$a.Or?g=(e.orChildrenGroup||[]).length:((A=e.declaration)==null?void 0:A.id)===$a.And&&(g=(e.andChildrenGroup||[]).length));const b={id:t.id,version:M.UUID.uuid(),createdAt:(u==null?void 0:u.timestamp)||j().toISOString(),author:(u==null?void 0:u.author)||M.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:r.Condition,index:g,declaration:T.toJSON(),andChildrenGroup:[],orChildrenGroup:[],calledByEntry:f.map(O=>O.toReference()),calledBySuccess:y.map(O=>O.toReference()),calledByError:m.map(O=>O.toReference()),errorCalls:[],successCalls:[],inputs:[],x:0,y:0,parent:e.toReference()},R=Se(b,n);return R.hydrateAncestors(),R.setParent(e,u),R.addSelfToProject(u),u==null||u.add(R,ye.Added),R.initChildren(u),u||R.captureVersion(),R}static validateGenerationTarget(t,n){let s=JSON.parse(JSON.stringify(t));const u=[],e=[],f=yl(s,{parent:{list:!1,types:[...xa,r.Project],optional:!0}},n);u.push(...f.explanations),s=f.modifiedData;const y=cs(s);if(e.push(...f.errors,...y.errors),u.push(...y.explanations),!t.declaration)e.push(new He({id:`${t.id}--${Ze.InvalidObjectStructure}`,code:Ze.InvalidObjectStructure,severity:Ie.Error,message:`Entity of type '${t.type}' with id '${t.id}' is missing the 'declaration' property. This property is required for a '${t.type}' entity and must point to one of the built-in action descriptors reserved for '${r.Condition}' entities.`})),u.push({id:Br.AllConditionActionDescriptors,message:fO(n)});else if(!n.get(t.declaration))e.push(new He({id:`${t.id}--${we.ReferencedEntityNotFound}`,code:we.ReferencedEntityNotFound,severity:Ie.Error,message:`Entity of type '${t.type}' with id '${t.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 '${r.Condition}' entities.`})),u.push({id:Br.AllConditionActionDescriptors,message:fO(n)});else{const T=wxt(t.declaration,n);e.push(...T.errors),u.push(...T.explanations)}return{errors:e,explanations:u,modifiedData:s}}validateGeneratedUpdate(t){const n=[],s=[];return t.parent&&n.push(new He({id:`${this.id}--${we.InvalidParentUpdate}`,code:we.InvalidParentUpdate,severity:Ie.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:n,explanations:s,modifiedData:t}}subscribeDependents(t){return t.forEach(n=>{this.detachedDependents[n.entity.id]||(this.detachedDependents[n.entity.id]=n)}),this}unsubscribeDependents(t){return t.forEach(n=>{this.detachedDependents[n.entity.id]&&delete this.detachedDependents[n.entity.id]}),this}syncDependents(t=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,"sync-dependents"))){const n=[],s=[],u=[],e=[];return Object.values(this.detachedDependents).forEach(f=>{const y=f.entity.afterAllChildrenInitialized(t);n.push(...y.updated),s.push(...y.added),u.push(...y.removed),e.push(...y.affected)}),t==null||t.attemptAutoclose("sync-dependents",this.id),{updated:_(n),added:_(s),removed:_(u),affected:_(e),self:this}}onDetachedDependencyRemoved(t,n,s){const u=[],e=[],f=[],y=[];if(n==="parent"){const{updated:m,added:T,removed:g}=this.remove({ignoreUpstream:!1},s);u.push(...m),e.push(...T),f.push(...g)}return{updated:_(u),added:_(e),removed:_(f),affected:_(y),self:this}}onDetachedDependencyRestored(t,n,s){const u=[],e=[],f=[],y=[];if(n==="parent"){const{updated:m,added:T,removed:g}=this.restore({},s);u.push(...m),e.push(...T),f.push(...g)}return{updated:_(u),added:_(e),removed:_(f),affected:_(y),self:this}}unsubscribeFromDependencies(){return this.parent.unsubscribeDependents([{entity:this,field:"parent"}]),this}subscribeToDependencies(){var t;return(t=this.parent)==null||t.subscribeDependents([{entity:this,field:"parent"}]),this}increaseVersion(t){var n;if(this.project.diggestedBuiltInBaseEntitiesIds.has(this.id))return this;if(t&&!j(t).isValid())throw new Error(`The shared timestamp '${t}' is not a valid ISO 8601 date string.`);if(t&&j(t).isSame(j(this.createdAt)))return this;if(!((n=this.knownVersions)!=null&&n.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=M.UUID.uuid(),this.createdAt=j(t).toISOString()||j().toISOString(),this}captureVersion(){var n;const t=((n=this.knownVersions)==null?void 0:n.get(this.version))||new Er(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!==t.version)throw new Error(`Captured ${this.type} with id '${this.id}', version '${t.version}' does not match current entity version '${this.version}'.`);return this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,t):new Map().set(this.version,t),this.apply(t),this}snapshot(){const t=new Er(this,this.project);return this.apply(t)}apply(t){const n=this.toMeta();return t.metaSync(n,null),t.inputs=[...this.inputs],t.declaration=this.declaration,t.andChildrenGroup=this.andChildrenGroup?[...this.andChildrenGroup]:this.andChildrenGroup,t.orChildrenGroup=this.orChildrenGroup?[...this.orChildrenGroup]:this.orChildrenGroup,t.successCalls=[...this.successCalls],t.errorCalls=[...this.errorCalls],t.calledBySuccess=[...this.calledBySuccess],t.calledByError=[...this.calledByError],t.calledByEntry=[...this.calledByEntry],t.parent=this.parent,t}recursiveCaptureUpstreamVersions(t){const n=[],s=[],u=[],e=[];if(this.parent){this.parent.increaseVersion(t);const f=this.parent.recursiveCaptureUpstreamVersions(t);n.push(this.parent,...f.updated),s.push(...f.added),u.push(...f.removed)}return{updated:_(n),added:_(s),removed:_(u),affected:_(e),self:this}}async restoreVersion(t,n){var m;const s=[],u=[],e=[],f=[];if(this.version===t&&(n!=null&&n.skipIfSameVersion))return{updated:_(s),added:_(u),removed:_(e),affected:_(f),self:this};if(!this.knownVersions){const T=new Map;for(const[g,b]of this.knownVersions||new Map){if(T.set(g,b),b.activeVersion=!1,b.knownVersions)for(const[R,I]of b.knownVersions)T.set(R,I);b.knownVersions=null}}let y=(m=this.knownVersions)==null?void 0:m.get(t);if(!y){const T=await this.APILoadVersion({},t);if(!T)throw new Error(`Version with id '${t}' for entity with id '${this.id}' not found.`);y=new Er(T,this.project)}return this.metaSync(y.toShallowJSON(),null),this.previousVersion=y.previousVersion,this.version=y.version,this.createdAt=y.createdAt,this.author=y.author,this.deleted=y.deleted,this.inputs=[...y.inputs],this.declaration=y.declaration,this.andChildrenGroup=y.andChildrenGroup?[...y.andChildrenGroup]:null,this.orChildrenGroup=y.orChildrenGroup?[...y.orChildrenGroup]:null,this.successCalls=[...y.successCalls],this.errorCalls=[...y.errorCalls],this.calledBySuccess=[...y.calledBySuccess],this.calledByError=[...y.calledByError],this.calledByEntry=[...y.calledByEntry],this.parent=y.parent,{updated:_(s),added:_(u),removed:_(e),affected:_(f),self:this}}updateWithShallowTransfer(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.UpdateWithShallowTransfer))){var s,u;if(!this.checkCanEdit(this,n))return pe.Logger.warn(`[updateWithShallowTransfer] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(N.UpdateWithShallowTransfer,this.id),this;if(this.metaSync(t,n),this.version=t.version,this.createdAt=t.createdAt,this.author=t.author,this.deleted=t.deleted,this.previousVersion=t.previousVersion,t.parent){const e=ge(t.parent),f=this.project.get(e),y=this.parent;if(y&&y.id!==(f==null?void 0:f.id)&&this.removeFromParent(n),f)this.setParent(f,n),this.addSelfToProject(n);else throw n==null||n.attemptAutoclose(N.UpdateWithShallowTransfer,this.id),new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${e}' that isn't found in the project`)}else throw n==null||n.attemptAutoclose(N.UpdateWithShallowTransfer,this.id),new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(t.declaration){const e=ge(t.declaration),f=this.project.get(e);f&&this.setDeclaration(f)}return(s=t.andChildrenGroup)==null||s.forEach(e=>{const f=ge(e),y=this.project.get(f);y&&(this.addToAndGroup(y,n),y.setParent(this,n))}),[...this.andChildrenGroup||[]].forEach(e=>{var y;((y=t.andChildrenGroup)==null?void 0:y.find(m=>ge(m)===e.id))||(this.removeChildGroup(e,n),e.removeFromParent(n))}),(u=t.orChildrenGroup)==null||u.forEach(e=>{const f=ge(e),y=this.project.get(f);y&&(this.addToOrGroup(y,n),y.setParent(this,n))}),[...this.orChildrenGroup||[]].forEach(e=>{var y;((y=t.orChildrenGroup)==null?void 0:y.find(m=>ge(m)===e.id))||(this.removeChildGroup(e,n),e.removeFromParent(n))}),t.calledByEntry.forEach(e=>{const f=ge(e),y=this.project.get(f);y&&(this.addEntryCaller(y,n),y.addCall(this,n))}),[...this.calledByEntry].forEach(e=>{t.calledByEntry.find(y=>ge(y)===e.id)||(this.removeCaller(e,n),e.removeCall(this,n))}),t.calledBySuccess.forEach(e=>{const f=ge(e),y=this.project.get(f);y&&(this.addSuccessCaller(y,n),y.addSuccessCall(this,n))}),[...this.calledBySuccess].forEach(e=>{t.calledBySuccess.find(y=>ge(y)===e.id)||(this.removeCaller(e,n),e.removeCall(this,n))}),t.calledByError.forEach(e=>{const f=ge(e),y=this.project.get(f);y&&(this.addErrorCaller(y,n),y.addErrorCall(this,n))}),[...this.calledByError].forEach(e=>{t.calledByError.find(y=>ge(y)===e.id)||(this.removeCaller(e,n),e.removeCall(this,n))}),this.captureVersion(),this.subscribeToDependencies(),n==null||n.attemptAutoclose(N.UpdateWithShallowTransfer,this.id),this}updateWithGenerationTarget(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.UpdateWithGenerationTarget))){var s,u,e;if(!this.checkCanEdit(this,n))return pe.Logger.warn(`[updateWithGenerationTarget] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(N.UpdateWithGenerationTarget,this.id),this;if(this.metaSync(t,n),t.parent){const f=ge(t.parent),y=this.project.get(f),m=this.parent;if(m&&m.id!==(y==null?void 0:y.id)&&this.removeFromParent(n),y)this.setParent(y,n),this.addSelfToProject(n);else throw n==null||n.attemptAutoclose(N.UpdateWithGenerationTarget,this.id),new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${f}' that isn't found in the project`)}if(t.declaration){const f=ge(t.declaration),y=this.project.get(f);if(y)this.setDeclaration(y);else throw new Error(`${this.type} with id '${this.id}' has a 'declaration' reference '${f}' that isn't found in the project`)}return(s=t.calledByEntry)==null||s.forEach(f=>{const y=ge(f),m=this.project.get(y);if(m)this.addEntryCaller(m,n),m.addCall(this,n);else throw new Error(`${this.type} with id '${this.id}' has a 'calledByEntry' reference '${y}' that isn't found in the project`)}),t.calledByEntry&&[...this.calledByEntry].forEach(f=>{var m;((m=t.calledByEntry)==null?void 0:m.find(T=>ge(T)===f.id))||(this.removeCaller(f,n),f.removeCall(this,n))}),(u=t.calledBySuccess)==null||u.forEach(f=>{const y=ge(f),m=this.project.get(y);if(m)this.addSuccessCaller(m,n),m.addSuccessCall(this,n);else throw new Error(`${this.type} with id '${this.id}' has a 'calledBySuccess' reference '${y}' that isn't found in the project`)}),t.calledBySuccess&&[...this.calledBySuccess].forEach(f=>{var m;((m=t.calledBySuccess)==null?void 0:m.find(T=>ge(T)===f.id))||(this.removeCaller(f,n),f.removeCall(this,n))}),(e=t.calledByError)==null||e.forEach(f=>{const y=ge(f),m=this.project.get(y);if(m)this.addErrorCaller(m,n),m.addErrorCall(this,n);else throw new Error(`${this.type} with id '${this.id}' has a 'calledByError' reference '${y}' that isn't found in the project`)}),t.calledByError&&[...this.calledByError].forEach(f=>{var m;((m=t.calledByError)==null?void 0:m.find(T=>ge(T)===f.id))||(this.removeCaller(f,n),f.removeCall(this,n))}),this.captureVersion(),this.subscribeToDependencies(),n==null||n.attemptAutoclose(N.UpdateWithGenerationTarget,this.id),this}hydrateAncestors(){const t=[],n=[],s=[],u=[];if(this.initialData.parent){const e=ge(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=ge(this.initialData.declaration),f=this.project.get(e);f&&(this.setDeclaration(f),t.push(f))}return this.initialData.calledByEntry.forEach(e=>{const f=ge(e),y=this.project.get(f);y&&this.addEntryCaller(y,null)}),this.initialData.calledBySuccess.forEach(e=>{const f=ge(e),y=this.project.get(f);y&&this.addSuccessCaller(y,null)}),this.initialData.calledByError.forEach(e=>{const f=ge(e),y=this.project.get(f);y&&this.addErrorCaller(y,null)}),{updated:_(t),added:_(n),removed:_(s),affected:_(u),self:this}}afterAllChildrenInitialized(t=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.AfterAllChildrenInitialized))){var T,g;if(!this.checkCanEdit(this,t))return pe.Logger.warn(`[afterAllChildrenInitialized] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),t==null||t.attemptAutoclose(N.AfterAllChildrenInitialized,this.id),{updated:[],added:[],removed:[],affected:[],self:this};const n=[],s=[],u=[],e=[];if(this.initialized=!0,this.parent.type===r.Condition){let b=this.index||0;const R=(this.parent.declaration.id===$a.And?this.parent.andChildrenGroup||[]:this.parent.orChildrenGroup||[]).filter(A=>!A.deleted&&A.id!==this.id);R.length&&(b>R.length+1?b=R.length:b<0&&(b=0)),R.find(A=>(A.index||0)===b&&!A.deleted)&&R.filter(A=>(A.index||0)>=b&&!A.deleted).forEach(A=>{A.metaSync({index:(A.index||0)+1},t),t==null||t.add(A,ye.Updated),n.push(A)}),this.metaSync({index:b},t)}(T=this.andChildrenGroup)!=null&&T.length&&this.andChildrenGroup.sort((b,R)=>(b.index||0)-(R.index||0)),(g=this.orChildrenGroup)!=null&&g.length&&this.orChildrenGroup.sort((b,R)=>(b.index||0)-(R.index||0)),this.inputs.sort((b,R)=>{var I,A;return(b.index??((I=b.declaration)==null?void 0:I.index))-(R.index??((A=R.declaration)==null?void 0:A.index))});const{updated:f,added:y,removed:m}=this.syncInputs(t);return n.push(...f),s.push(...y),u.push(...m),t==null||t.attemptAutoclose(N.AfterAllChildrenInitialized,this.id),{updated:_(n),added:_(s),removed:_(u),affected:_(e),self:this}}addSelfToProject(t=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,"add-self-to-project"))){const n=[this],s=[],u=[],e=[];return this.parent===this.project?this.project.addCondition(this):this.parent.type===r.Condition&&(this.parent.declaration.id===$a.And?this.parent.addToAndGroup(this,t):this.parent.declaration.id===$a.Or&&this.parent.addToOrGroup(this,t)),this.successCalls.forEach(f=>{f.addSuccessCaller(this,t),n.push(f)}),this.errorCalls.forEach(f=>{f.addErrorCaller(this,t),n.push(f)}),this.calledByEntry.forEach(f=>{f.addCall(this,t),n.push(f)}),this.calledBySuccess.forEach(f=>{f.addSuccessCall(this,t),n.push(f)}),this.calledByError.forEach(f=>{f.addErrorCall(this,t),n.push(f)}),this.subscribe(),this.subscribeToDependencies(),t==null||t.attemptAutoclose("add-self-to-project",this.id),{updated:_(n),added:_(s),removed:_(u),affected:_(e),self:this}}get calledBy(){return[...this.calledByEntry,...this.calledBySuccess,...this.calledByError]}removeInput(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.RemoveInput))){if(!this.checkCanEdit(this,n))return pe.Logger.warn(`[removeInput] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(N.RemoveInput,this.id),this;const s=this.inputs.findIndex(u=>u.id===t.id);return s>-1&&(this.inputs.splice(s,1),n&&(n==null||n.add(this,ye.Affected))),n==null||n.attemptAutoclose(N.RemoveInput,this.id),this}addInput(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.AddInput))){return this.checkCanEdit(this,n)?this.inputs.includes(t)?(n==null||n.attemptAutoclose(N.AddInput,this.id),this):(this.inputs.push(t),n==null||n.add(this,ye.Affected),n==null||n.attemptAutoclose(N.AddInput,this.id),this):(pe.Logger.warn(`[addInput] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(N.AddInput,this.id),this)}addOutput(t){return this}removeOutput(t){return this}addSuccessCaller(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.AddSuccessCaller)),s=!1){var u;return this.checkCanEditWithCounterpartAndSideEffects(this,t,N.AddSuccessCaller,n)?((t==null?void 0:t.id)===this.id&&(n==null||n.event({id:`${N.AddSuccessCaller}-${this.id}--${at.CannotSuccessCallItself}`,action:N.AddSuccessCaller,owner:this,errorReason:at.CannotSuccessCallItself,rootAction:((u=n==null?void 0:n.self)==null?void 0:u.id)===this.id&&(n==null?void 0:n.actionName)===N.AddSuccessCaller})),this.calledBySuccess.find(e=>e.id===t.id)||(this.calledBySuccess.push(t),n==null||n.add(this,ye.Updated),s&&Oi(this,n)),n==null||n.attemptAutoclose(N.AddSuccessCaller,this.id),this):this}addErrorCaller(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.AddErrorCaller)),s=!1){var u;return this.checkCanEditWithCounterpartAndSideEffects(this,t,N.AddErrorCaller,n)?((t==null?void 0:t.id)===this.id&&(n==null||n.event({id:`${N.AddErrorCaller}-${this.id}--${at.CannotErrorCallItself}`,action:N.AddErrorCaller,owner:this,errorReason:at.CannotErrorCallItself,rootAction:((u=n==null?void 0:n.self)==null?void 0:u.id)===this.id&&(n==null?void 0:n.actionName)===N.AddErrorCaller})),this.calledByError.find(e=>e.id===t.id)||(this.calledByError.push(t),n==null||n.add(this,ye.Updated),s&&Oi(this,n)),n==null||n.attemptAutoclose(N.AddErrorCaller,this.id),this):this}addEntryCaller(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.AddEntryCaller)),s=!1){var u;return this.checkCanEditWithCounterpartAndSideEffects(this,t,N.AddEntryCaller,n)?((t==null?void 0:t.id)===this.id&&(n==null||n.event({id:`${N.AddEntryCaller}-${this.id}--${at.CannotEntryCallItself}`,action:N.AddEntryCaller,owner:this,errorReason:at.CannotEntryCallItself,rootAction:((u=n==null?void 0:n.self)==null?void 0:u.id)===this.id&&(n==null?void 0:n.actionName)===N.AddEntryCaller})),this.calledByEntry.find(e=>e.id===t.id)||(this.calledByEntry.push(t),n==null||n.add(this,ye.Updated),s&&Oi(this,n)),n==null||n.attemptAutoclose(N.AddEntryCaller,this.id),this):this}addErrorCall(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.AddErrorCall)),s=!1){var u;return this.checkCanEditWithCounterpartAndSideEffects(this,t,N.AddErrorCall,n)?((t==null?void 0:t.id)===this.id&&(n==null||n.event({id:`${N.AddErrorCaller}-${this.id}--${at.CannotErrorCallItself}`,action:N.AddErrorCaller,owner:this,errorReason:at.CannotErrorCallItself,rootAction:((u=n==null?void 0:n.self)==null?void 0:u.id)===this.id&&(n==null?void 0:n.actionName)===N.AddErrorCaller})),this.errorCalls.find(e=>e.id===t.id)||(this.errorCalls.push(t),s&&Oi(this,n),n==null||n.add(this,ye.Affected)),n==null||n.attemptAutoclose(N.AddErrorCall,this.id),this):this}addSuccessCall(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.AddSuccessCall)),s=!1){var u;return this.checkCanEditWithCounterpartAndSideEffects(this,t,N.AddSuccessCall,n)?((t==null?void 0:t.id)===this.id&&(n==null||n.event({id:`${N.AddSuccessCaller}-${this.id}`,action:N.AddSuccessCaller,owner:this,errorReason:at.CannotSuccessCallItself,rootAction:((u=n==null?void 0:n.self)==null?void 0:u.id)===this.id&&(n==null?void 0:n.actionName)===N.AddSuccessCaller})),this.successCalls.find(e=>e.id===t.id)||(this.successCalls.push(t),s&&Oi(this,n),n==null||n.add(this,ye.Affected)),n==null||n.attemptAutoclose(N.AddSuccessCall,this.id),this):this}removeCall(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.RemoveCall)),s=!1){if(!this.checkCanEditWithCounterpartAndSideEffects(this,t,N.RemoveCall,n))return this;const u=this.successCalls.findIndex(f=>f.id===t.id);u>-1&&(this.successCalls.splice(u,1),n==null||n.add(this,ye.Affected));const e=this.errorCalls.findIndex(f=>f.id===t.id);return e>-1&&(this.errorCalls.splice(e,1),n==null||n.add(this,ye.Affected)),s&&Oi(this,n),n==null||n.attemptAutoclose(N.RemoveCall,this.id),this}removeCaller(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.RemoveCaller)),s=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,t,N.RemoveCaller,n)?(this.calledBySuccess=this.calledBySuccess.filter(u=>u.id!==t.id?!0:(n==null||n.add(this,ye.Updated),n==null||n.add(u,ye.Affected),!1)),this.calledByError=this.calledByError.filter(u=>u.id!==t.id?!0:(n==null||n.add(this,ye.Updated),n==null||n.add(u,ye.Affected),!1)),this.calledByEntry=this.calledByEntry.filter(u=>u.id!==t.id?!0:(n==null||n.add(this,ye.Updated),n==null||n.add(u,ye.Affected),!1)),s&&Oi(this,n),n==null||n.attemptAutoclose(N.RemoveCaller,this.id),this):this}setParent(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.SetParent))){var s;return this.checkCanEditWithCounterpartAndSideEffects(this,t,N.SetParent,n)?(((s=this.parent)==null?void 0:s.id)!==(t==null?void 0:t.id)&&(this.parent=t,n&&(n==null||n.add(this,ye.Updated))),n==null||n.attemptAutoclose(N.SetParent,this.id),this):this}removeChildGroup(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.RemoveChildGroup))){if(!this.checkCanEdit(this,n))return pe.Logger.warn(`[removeChildGroup] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(N.RemoveChildGroup,this.id),this;if(this.andChildrenGroup){const s=this.andChildrenGroup.findIndex(u=>u.id===t.id);s!==-1&&(this.andChildrenGroup.splice(s,1),n==null||n.add(this,ye.Updated))}if(this.orChildrenGroup){const s=this.orChildrenGroup.findIndex(u=>u.id===t.id);s!==-1&&(this.orChildrenGroup.splice(s,1),n==null||n.add(this,ye.Updated))}return n==null||n.attemptAutoclose(N.RemoveChildGroup,this.id),this}setDeclaration(t){return this.declaration=t,this}initChildren(t=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,"init-children"))){return this.initialized||this.startedInitialization?this:(this.startedInitialization=!0,this.declaration=Se(this.initialData.declaration,this.project),this.initialData.andChildrenGroup&&(this.andChildrenGroup=this.initialData.andChildrenGroup.map(n=>{const s=Se(n,this.project);return s.setParent(this,null),s.initChildren(t),s})),this.initialData.orChildrenGroup&&(this.orChildrenGroup=this.initialData.orChildrenGroup.map(n=>{const s=Se(n,this.project);return s.setParent(this,null),s.initChildren(t),s})),this.successCalls=this.initialData.successCalls.map(n=>{const s=Se(n,this.project);if(s.addSuccessCaller(this,null),[r.BreakStatement,r.ContinueStatement].includes(s.type))s.setParent(this.parent.parent,null),s.initChildren(t);else if(s.type===r.ReturnStatement){const u=zs(this,this.project);s.setParent(u,null),s.initChildren(t)}else s.type!==r.InternalCall&&(s.setParent(this.parent,null),s.initChildren(t));return s}),this.errorCalls=this.initialData.errorCalls.map(n=>{const s=Se(n,this.project);if(s.addErrorCaller(this,null),[r.BreakStatement,r.ContinueStatement].includes(s.type))s.setParent(this.parent.parent,null),s.initChildren(t);else if(s.type===r.ReturnStatement){const u=zs(this,this.project);s.setParent(u,null),s.initChildren(t)}else s.type!==r.InternalCall&&(s.setParent(this.parent,null),s.initChildren(t));return s}),this.inputs=this.initialData.inputs.map(n=>{const s=Se(n,this.project);return s.setParent(this,null),s.initChildren(t),s}),this.subscribeToDependencies(),this.afterAllChildrenInitialized(t),t==null||t.attemptAutoclose("init-children",this.id),this)}subscribe(){var t;return this.activeVersion=!0,(t=this.knownVersions)==null||t.forEach(n=>{n.version!==this.version&&(n.activeVersion=!1)}),this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,"meta-sync"))){const s=ys(this,t,n),u=fs(this,s),e=this.toMeta();return this.x=s.x!==void 0?s.x:e.x,this.y=s.y!==void 0?s.y:e.y,this.index=s.index!==void 0?s.index:e.index,super.baseMetaSync(s,this,n),s.deleted===!0&&!e.deleted?n==null||n.add(this,ye.Removed):s.deleted===!1&&e.deleted?n==null||n.add(this,ye.Added):u&&(n==null||n.add(this,ye.Updated)),n==null||n.attemptAutoclose("meta-sync",this.id),this}async APILoad(t=gt,...n){return await Er.repository.APILoad(this.id,...n),this}async APICreate(t=gt,...n){return await Er.repository.APICreate(this.toShallowJSON(),...n),this}async APIUpdate(t=gt,...n){return await Er.repository.APIUpdate(this.toShallowJSON(),...n),this}async APIDelete(t=gt,...n){return await Er.repository.APIDelete(this.toShallowJSON(),...n),this}async APIClone(t=gt,...n){return await Er.repository.APIClone(this.id,...n),this}async APILoadVersion(t=gt,n,...s){return await Er.repository.APILoadVersion(this.id,n,...s)}removeFromParent(t=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.RemoveFromParent))){var f;if(!this.checkCanEdit(this,t))return pe.Logger.warn(`[removeFromParent] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),t==null||t.attemptAutoclose(N.RemoveFromParent,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const n=[],s=[],u=[],e=[];return this.parent.type===r.Project?(this.parent.removeCondition(this),e.push(this.parent)):((f=this.parent)==null?void 0:f.type)===r.Condition?this.parent.removeChildGroup(this,t):this.parent.detachedChildren.includes(this)&&this.parent.unsubscribeDetachedChild(this),t==null||t.attemptAutoclose(N.RemoveFromParent,this.id),{added:_(u),updated:_(n),removed:_(s),affected:_(e),self:this}}remove({ignoreUpstream:t}={ignoreUpstream:!1},n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.RemoveEntity))){var y;if(!this.checkCanDelete(this,n))return pe.Logger.warn(`[remove] User is not allowed to delete or edit this ${this.type} entity with id: ${this.id}`),n==null||n.event({id:`${N.RemoveEntity}-${this.id}--${at.ActionOwnerEntityNonDeletable}`,action:N.RemoveEntity,owner:this,errorReason:at.ActionOwnerEntityNonDeletable,rootAction:((y=n==null?void 0:n.self)==null?void 0:y.id)===this.id&&(n==null?void 0:n.actionName)===N.RemoveEntity}),n==null||n.attemptAutoclose(N.RemoveEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const s=[],u=[],e=[],f=[];if(n!=null&&n.hasRemoved(this.id))return n==null||n.attemptAutoclose(N.RemoveEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(u.push(this),this.unsubscribe(),this.unsubscribeFromDependencies(),this.project.subscribeDeletedInstance(this),this.metaSync({deleted:!0},n),Object.values(this.detachedDependents).forEach(m=>{const{updated:T,removed:g,added:b}=m.entity.onDetachedDependencyRemoved(this,m.field,n);s.push(...T),u.push(...g),e.push(...b)}),this.andChildrenGroup&&this.andChildrenGroup.forEach(m=>{const{removed:T,updated:g}=m.remove({ignoreUpstream:!0},n);u.push(...T),s.push(...g)}),this.orChildrenGroup&&this.orChildrenGroup.forEach(m=>{const{removed:T,updated:g}=m.remove({ignoreUpstream:!0},n);u.push(...T),s.push(...g)}),this.inputs.forEach(m=>{const{updated:T,removed:g}=m.remove({ignoreUpstream:!0},n);s.push(...T),u.push(...g)}),this.successCalls.forEach(m=>{s.push(m),m.removeCaller(this,n)}),this.errorCalls.forEach(m=>{s.push(m),m.removeCaller(this,n)}),!t){const m=this.removeFromParent(n);e.push(...m.added),s.push(...m.updated),u.push(...m.removed),f.push(...m.affected),this.calledBy.forEach(T=>{s.push(T),T.removeCall(this,n)})}return n==null||n.attemptAutoclose(N.RemoveEntity,this.id),{added:_(e),updated:_(s),removed:_(u),affected:_(f),self:this}}restore({}={},t=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.RestoreEntity))){if(!this.checkCanEdit(this,t))return pe.Logger.warn(`[restore] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),t==null||t.attemptAutoclose(N.RestoreEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const n=[],s=[],u=[],e=[];return t!=null&&t.hasAdded(this.id)?(t==null||t.attemptAutoclose(N.RestoreEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this}):(this.subscribe(),this.project.unsubscribeDeletedInstance(this),this.metaSync({deleted:!1},t),Object.values(this.detachedDependents).forEach(f=>{const{updated:y,removed:m,added:T}=f.entity.onDetachedDependencyRestored(this,f.field,t);s.push(...y),u.push(...m),n.push(...T)}),this.andChildrenGroup&&this.andChildrenGroup.forEach(f=>{const{updated:y,added:m}=f.restore({},t);s.push(...y),n.push(...m)}),this.orChildrenGroup&&this.orChildrenGroup.forEach(f=>{const{updated:y,added:m}=f.restore({},t);s.push(...y),n.push(...m)}),this.inputs.forEach(f=>{const{updated:y}=f.restore({},t);s.push(...y)}),this.successCalls.forEach(f=>{s.push(f),f.addSuccessCaller(this,t)}),this.errorCalls.forEach(f=>{s.push(f),f.addErrorCaller(this,t)}),this.calledBySuccess.forEach(f=>{s.push(f),f.addSuccessCall(this,t)}),this.calledByError.forEach(f=>{s.push(f),f.addErrorCall(this,t)}),this.calledByEntry.forEach(f=>{s.push(f),f.addCall(this,t)}),this.parent.type===r.Project&&this.project.addCondition(this),t==null||t.attemptAutoclose(N.RestoreEntity,this.id),{added:_(n),updated:_(s),removed:_(u),affected:_(e),self:this})}toFlat(t=new Set){var s,u;return t.has(this.id)?[]:(t.add(this.id),[this,...((s=this.andChildrenGroup)==null?void 0:s.flatMap(e=>e.toFlat(t)))||[],...((u=this.orChildrenGroup)==null?void 0:u.flatMap(e=>e.toFlat(t)))||[],...this.inputs.flatMap(e=>e.toFlat(t)),...this.successCalls.flatMap(e=>e.toFlat(t)),...this.errorCalls.flatMap(e=>e.toFlat(t)),...this.calledBy.flatMap(e=>e.toFlat(t))])}toFlatIds(t=new Set){var s,u;return t.has(this.id)?[]:(t.add(this.id),[this.id,...((s=this.andChildrenGroup)==null?void 0:s.flatMap(e=>e.toFlatIds(t)))||[],...((u=this.orChildrenGroup)==null?void 0:u.flatMap(e=>e.toFlatIds(t)))||[],...this.inputs.flatMap(e=>e.toFlatIds(t)),...this.successCalls.flatMap(e=>e.toFlatIds(t)),...this.errorCalls.flatMap(e=>e.toFlatIds(t)),...this.calledBy.flatMap(e=>e.toFlatIds(t))])}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(t=new Set){var n,s;return t.has(this.id)?this.toReference():(t.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(t),andChildrenGroup:((n=this.andChildrenGroup)==null?void 0:n.map(u=>u.toJSON(t)))||null,orChildrenGroup:((s=this.orChildrenGroup)==null?void 0:s.map(u=>u.toJSON(t)))||null,successCalls:this.successCalls.map(u=>u.toJSON(t)),errorCalls:this.errorCalls.map(u=>u.toJSON(t)),calledBySuccess:this.calledBySuccess.map(u=>u.toReference()),calledByError:this.calledByError.map(u=>u.toReference()),calledByEntry:this.calledByEntry.map(u=>u.toReference()),inputs:this.inputs.map(u=>u.toJSON(t)),parent:this.parent.toReference()})}toJSONClone(t=Kt){var s,u,e,f,y,m,T;let n;return(s=t.seenEntityMaps)!=null&&s.has(this.id)?n=t.seenEntityMaps.get(this.id):(n=t.newId||xs(this,this.project,t.uuidStrategy),t.seenEntityMaps&&t.seenEntityMaps.set(this.id,n)),(u=t.seenEntities)!=null&&u.has(n)||(e=t.seenEntities)!=null&&e.has(this.id)?this.toReference({seenEntityMaps:t.seenEntityMaps}):((f=t.seenEntities)==null||f.add(n),(y=t.seenEntities)==null||y.add(this.id),{id:n,version:M.UUID.uuid(),createdAt:t.timestamp||j().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(g=>g.toJSONClone({...t,newId:null})))||null,orChildrenGroup:((T=this.orChildrenGroup)==null?void 0:T.map(g=>g.toJSONClone({...t,newId:null})))||null,successCalls:this.successCalls.map(g=>g.toJSONClone({...t,newId:null})),errorCalls:this.errorCalls.map(g=>g.toJSONClone({...t,newId:null})),calledBySuccess:this.calledBySuccess.map(g=>g.toReference({seenEntityMaps:t.seenEntityMaps})),calledByError:this.calledByError.map(g=>g.toReference({seenEntityMaps:t.seenEntityMaps})),calledByEntry:this.calledByEntry.map(g=>g.toReference({seenEntityMaps:t.seenEntityMaps})),inputs:this.inputs.map(g=>g.toJSONClone({...t,newId:null})),parent:this.parent.toReference({seenEntityMaps:t.seenEntityMaps})})}toReference(t=Kt){var s;let n=this.id;return(s=t.seenEntityMaps)!=null&&s.has(this.id)&&(n=t.seenEntityMaps.get(this.id)),{id:n+"--"+M.UUID.uuid()+"--ref",type:r.GenericReference,entityId:n,version:this.version,entityType:this.type}}toShallowJSON(t=Kt){var s,u,e;let n=this.id;return(s=t.seenEntityMaps)!=null&&s.has(this.id)&&(n=t.seenEntityMaps.get(this.id)),{id:n,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,editable:this.editable,deletable:this.deletable,index:this.index,x:this.x,y:this.y,declaration:this.declaration.toReference(t),andChildrenGroup:((u=this.andChildrenGroup)==null?void 0:u.map(f=>f.toReference(t)))||null,orChildrenGroup:((e=this.orChildrenGroup)==null?void 0:e.map(f=>f.toReference(t)))||null,inputs:this.inputs.map(f=>f.toReference(t)),successCalls:this.successCalls.map(f=>f.toReference(t)),errorCalls:this.errorCalls.map(f=>f.toReference(t)),calledBySuccess:this.calledBySuccess.map(f=>f.toReference(t)),calledByError:this.calledByError.map(f=>f.toReference(t)),calledByEntry:this.calledByEntry.map(f=>f.toReference(t)),parent:this.parent.toReference(t)}}toFlatJSON(t=new Set){var s,u;return t.has(this.id)?[]:(t.add(this.id),[this.toShallowJSON(),...((s=this.andChildrenGroup)==null?void 0:s.flatMap(e=>e.toFlatJSON(t)))||[],...((u=this.orChildrenGroup)==null?void 0:u.flatMap(e=>e.toFlatJSON(t)))||[],...this.inputs.flatMap(e=>e.toFlatJSON(t)),...this.successCalls.flatMap(e=>e.toFlatJSON(t)),...this.errorCalls.flatMap(e=>e.toFlatJSON(t)),...this.calledBy.flatMap(e=>e.toFlatJSON(t))])}toGenerationTarget(t=Kt){var u,e;const n=this.parent.type===r.Project?void 0:(u=t.seenEntityMaps)!=null&&u.has(this.parent.id)?t.seenEntityMaps.get(this.parent.id):this.parent.id;let s=this.id;return(e=t.seenEntityMaps)!=null&&e.has(this.id)&&(s=t.seenEntityMaps.get(this.id)),{id:s,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:n}}toFlatGenerationTarget(t=new Set){var s,u;return t.has(this.id)?[]:(t.add(this.id),[this.toGenerationTarget(),...((s=this.andChildrenGroup)==null?void 0:s.flatMap(e=>e.toFlatGenerationTarget(t)))||[],...((u=this.orChildrenGroup)==null?void 0:u.flatMap(e=>e.toFlatGenerationTarget(t)))||[],...this.inputs.flatMap(e=>e.toFlatGenerationTarget(t)),...this.successCalls.flatMap(e=>e.toFlatGenerationTarget(t)),...this.errorCalls.flatMap(e=>e.toFlatGenerationTarget(t))])}clearErrors(){var t,n;return this.errors=[],(t=this.andChildrenGroup)==null||t.forEach(s=>s.clearErrors()),(n=this.orChildrenGroup)==null||n.forEach(s=>s.clearErrors()),this.inputs.forEach(s=>s.clearErrors()),this.successCalls.forEach(s=>s.clearErrors()),this.errorCalls.forEach(s=>s.clearErrors()),this}validate(){return this.errors=emt(this),{success:!0}}async validateAsync(t={}){const n=pe.YieldTracker.from(t);return this.errors=await X0t(this,{tracker:n}),{success:!0}}getErrors(){return[...this.errors,...this.inputs.flatMap(n=>n.getErrors()),...this.andChildrenGroup?this.andChildrenGroup.flatMap(n=>n.getErrors()):[],...this.orChildrenGroup?this.orChildrenGroup.flatMap(n=>n.getErrors()):[]]}async getErrorsAsync(t={}){const n=pe.YieldTracker.from(t),s=[...this.errors];await n.tick();for(const u of this.inputs){const e=await u.getErrorsAsync({tracker:n});s.push(...e)}if(await n.tick(),this.andChildrenGroup)for(const u of this.andChildrenGroup){const e=await u.getErrorsAsync({tracker:n});s.push(...e)}if(this.orChildrenGroup)for(const u of this.orChildrenGroup){const e=await u.getErrorsAsync({tracker:n});s.push(...e)}return s}getShallowErrors(){return this.errors}clone(t=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.CloneEntity)),n=null,s=null,u=!0){var A,O,P;const e=Qa(n,this),f=this.toJSON(),y=s||M.UUID.uuid();f.inputs=[];const m=y.split("-id"),T=m[m.length-1||0]||y;f.id=y,f.version=M.UUID.uuid(),f.createdAt=(t==null?void 0:t.timestamp)||j().toISOString(),f.author=(t==null?void 0:t.author)||"1",f.previousVersion=null,f.deleted=!1,f.deletable=!0,f.editable=!0;const g=Zr(f,e);n?g.setParent(n,t):g.setParent(this.parent,null),u&&g.subscribe(),g.initChildren(t),t==null||t.add(g,ye.Added);const b=(A=this.andChildrenGroup)==null?void 0:A.map(x=>x.clone(t,g,M.UUID.uuid(),u)),R=(O=this.orChildrenGroup)==null?void 0:O.map(x=>x.clone(t,g,M.UUID.uuid(),u));g.andChildrenGroup=b||null,g.orChildrenGroup=R||null;const I=(P=this.inputs)==null?void 0:P.map((x,$)=>x.clone(t,g,T+"-input-map-"+$+"-id",u));return g.inputs=I,t||g.captureVersion(),t==null||t.attemptAutoclose(N.CloneEntity,this.id),g}addToAndGroup(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.AddToAndGroup))){return this.checkCanEdit(this,n)?(this.andChildrenGroup||(this.andChildrenGroup=[]),this.andChildrenGroup.includes(t)||(this.andChildrenGroup.push(t),n==null||n.add(t,ye.Affected)),n==null||n.attemptAutoclose(N.AddToAndGroup,this.id),this):(pe.Logger.warn(`[addToAndGroup] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(N.AddToAndGroup,this.id),this)}addToOrGroup(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.AddToOrGroup))){return this.checkCanEdit(this,n)?(this.orChildrenGroup||(this.orChildrenGroup=[]),this.orChildrenGroup.includes(t)||(this.orChildrenGroup.push(t),n==null||n.add(t,ye.Affected)),n==null||n.attemptAutoclose(N.AddToOrGroup,this.id),this):(pe.Logger.warn(`[addToOrGroup] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(N.AddToOrGroup,this.id),this)}removeUnrecognizedInputs(t=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.RemoveUnrecognizedInputs))){if(!this.checkCanEdit(this,t))return pe.Logger.warn(`[removeUnrecognizedInputs] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),t==null||t.attemptAutoclose(N.RemoveUnrecognizedInputs,this.id),{updated:[],added:[],removed:[],affected:[],self:this};const n=[],s=[],u=[],e=[];return this.inputs.forEach(y=>{if(!this.declaration.inputs.find(T=>{var g;return T.id===((g=y.declaration)==null?void 0:g.id)})){const T=y.remove({ignoreUpstream:!1},t);u.push(...T.removed),n.push(...T.updated)}}),this.inputs.filter((y,m)=>{const T=this.inputs.findIndex(b=>b.declaration===y.declaration&&b!==y);if(T===-1)return!1;const g=this.inputs[T];return j(g==null?void 0:g.createdAt).isSame(j(y.createdAt))?m>T:!!j(g==null?void 0:g.createdAt).isAfter(y.createdAt)}).forEach(y=>{const m=y.remove({ignoreUpstream:!1},t);u.push(...m.removed),n.push(...m.updated)}),t==null||t.attemptAutoclose(N.RemoveUnrecognizedInputs,this.id),{updated:_(n),added:_(s),removed:_(u),affected:_(e),self:this}}syncInputs(t=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.SyncInputs))){if(!this.checkCanEdit(this,t))return pe.Logger.warn(`[syncInputs] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),t==null||t.attemptAutoclose(N.SyncInputs,this.id),{updated:[],added:[],removed:[],affected:[],self:this};const n=[],s=[],u=[],e=[],f=this.declaration.inputs.filter(g=>g.parentRelationType===S.FixedArguments&&!this.inputs.find(b=>b.declaration.id===g.id));this.inputs.sort((g,b)=>g.index-b.index),f.forEach(g=>{this.inputs.forEach(I=>{I.index>=g.index&&I.metaSync({index:I.index+1},t)});const b={id:M.UUID.uuid(),version:M.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||j().toISOString(),author:M.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:r.InputMap,dataType:null,parentRelationType:null,declaration:g.toJSON(),readsValue:null,defaultValue:null,index:g.index,name:null,codeName:null,description:null,parent:this.toReference()},R=Se(b,this.project);R.setParent(this,t),R.addSelfToProject(t),t==null||t.add(R,ye.Added),R.initChildren(t),t||R.captureVersion()}),this.inputs.sort((g,b)=>g.index-b.index);const{updated:y,added:m,removed:T}=this.removeUnrecognizedInputs(t);return n.push(...y),s.push(...m),u.push(...T),this.inputs.forEach(g=>{const{updated:b,added:R,removed:I}=g.afterAllChildrenInitialized(t);n.push(...b),s.push(...R),u.push(...I)}),this.inputs.sort((g,b)=>g.index-b.index),t==null||t.attemptAutoclose(N.SyncInputs,this.id),{updated:_(n),added:_(s),removed:_(u),affected:_(e),self:this}}getUnusedInputs(){return this.inputs.filter(t=>t.suggestion||!t.readsValue&&!t.defaultValue)}getUnusedOutputs(){return[]}getUsedInputs(){return this.inputs.filter(t=>!t.suggestion&&(t.readsValue||t.defaultValue))}getUsedOutputs(){return[]}getDataType(t=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,"get-data-type"))){var s;const n=((s=this.declaration)==null?void 0:s.getDataType(t))||null;return t==null||t.attemptAutoclose("get-data-type",this.id),n}};C(Er,"repository",{APICreate:async(t,...n)=>t,APIUpdate:async(t,...n)=>t,APIDelete:async(t,...n)=>t,APIClone:async(t,...n)=>{},APILoad:async(t,...n)=>null,APILoadVersion:async(t,n,...s)=>null}),C(Er,"type",r.Condition),C(Er,"USER_MANAGED_PARENT_TYPES",[...xa,r.Project,r.Condition]),C(Er,"PARENT_TYPES",[...Er.USER_MANAGED_PARENT_TYPES]),C(Er,"MUTABLE_BASE_PROPERTIES",["operator"]),C(Er,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion","index"]),C(Er,"BASE_PROPERTIES",[...Er.MUTABLE_BASE_PROPERTIES,...Er.INMUTABLE_BASE_PROPERTIES]),C(Er,"MUTABLE_META_PROPERTIES",["x","y"]),C(Er,"INMUTABLE_META_PROPERTIES",[...Er.INMUTABLE_BASE_PROPERTIES]),C(Er,"META_PROPERTIES",[...Er.MUTABLE_META_PROPERTIES,...Er.INMUTABLE_META_PROPERTIES]),C(Er,"MUTABLE_UPSTREAM_PROPERTIES",["calledBySuccess","calledByError","calledByEntry","parent"]),C(Er,"INMUTABLE_UPSTREAM_PROPERTIES",[]),C(Er,"UPSTREAM_PROPERTIES",[...Er.MUTABLE_UPSTREAM_PROPERTIES,...Er.INMUTABLE_UPSTREAM_PROPERTIES]),C(Er,"MUTABLE_DOWNSTREAM_PROPERTIES",["andChildrenGroup","orChildrenGroup","successCalls","errorCalls","inputsDeclarations","inputs"]),C(Er,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),C(Er,"DOWNSTREAM_PROPERTIES",[...Er.MUTABLE_DOWNSTREAM_PROPERTIES,...Er.INMUTABLE_DOWNSTREAM_PROPERTIES]),C(Er,"PROPERTIES",[...Er.META_PROPERTIES,...Er.UPSTREAM_PROPERTIES,...Er.DOWNSTREAM_PROPERTIES]);let r0=Er;async function Zgn(a,p={}){const t=pe.YieldTracker.from(p),n=[],s=tn(a.errors,n);return await t.tick(),s}function Hgn(a){const p=[];return tn(a.errors,p)}async function nmt(a,p={}){const t=pe.YieldTracker.from(p),n=[],s=tn(a.errors,n);return await t.tick(),s}function rmt(a){const p=[];return tn(a.errors,p)}const Wgn=Object.freeze(Object.defineProperty({__proto__:null,validate:rmt,validateAsync:nmt},Symbol.toStringTag,{value:"Module"}));function zgn(a,p){const t=[],n=[];if(a.parent)if(a.parent){const s=p.get(a.parent);s?ya.USER_MANAGED_PARENT_TYPES.includes(s.type)||n.push(new He({id:`${a.id}--${a.parent}--${we.InvalidParentReference}`,code:we.InvalidParentReference,severity:Ie.Error,message:`Entity of type "${a.type}" with id "${a.id}", has a parent reference which is of type ${s.type}, and therefore that isn't pointing to the following valid types for this reference: '${Di(ya.USER_MANAGED_PARENT_TYPES,"', '","' or '")}'.`})):n.push(new He({id:`${a.id}--${a.parent}--${we.ReferencedEntityNotFound}`,code:we.ReferencedEntityNotFound,severity:Ie.Error,message:`Entity of type "${a.type}" with id "${a.id}", is referencing an entity with id "${a.parent}" at 'parent' that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`}))}else n.push(new He({id:`${a.id}--${Ze.InvalidObjectStructure}`,code:Ze.InvalidObjectStructure,severity:Ie.Error,message:`Entity of type "${a.type}" with id "${a.id}" is missing a 'parent' reference. The 'parent' of a literal value entity must be a reference to an entity of type '${Di(ya.USER_MANAGED_PARENT_TYPES,"', '","', or '")}'.`}));else return n.push(new He({id:`${a.id}--${Ze.InvalidObjectStructure}`,code:Ze.InvalidObjectStructure,severity:Ie.Error,message:`Entity of type "${a.type}" with id "${a.id}" is missing a 'parent' reference. The 'parent' of a literal value entity must be a reference to an entity of type '${Di(ya.USER_MANAGED_PARENT_TYPES,"', '","', or '")}'.`})),{errors:n,explanations:t};if(a.valueAsTypeSingle){const s=[],u=[],e=a.valueAsTypeSingle;Array.isArray(e)?e.forEach(f=>{typeof f=="string"?u.push(f):s.push(f)}):typeof e=="string"?u.push(e):s.push(e),s.forEach(f=>{const y=WV(f);n.push(...y),y.length===0&&u.push(f.entityId)}),u.forEach(f=>{const y=p.get(f);y?[r.DefinitionEntity,r.BuiltInBaseEntity].includes(y.type)||n.push(new He({id:`${a.id}--${f}--${we.InvalidImplementsReference}`,code:we.InvalidImplementsReference,severity:Ie.Error,message:`Entity of type "${a.type}" with id "${a.id}", has an 'valueAsTypeSingle' reference which is of type ${y.type}, and therefore that isn't pointing to the following valid types for this reference: 'definition-entity', 'function-declaration' or 'operation'.`})):n.push(new He({id:`${a.id}--${f}--${we.ReferencedEntityNotFound}`,code:we.ReferencedEntityNotFound,severity:Ie.Error,message:`Entity of type "${a.type}" with id "${a.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:n,explanations:t}}var amt=(a=>(a.ValueAsTypeSingle="value-as-type-single",a.ValueAsTypeList="value-as-type-list",a))(amt||{});const Wn=class Wn extends Ps{constructor(t,n){super(t);C(this,"initialData");C(this,"type",r.LiteralValue);C(this,"id");C(this,"name");C(this,"autogeneration",null);C(this,"value",null);C(this,"rawString",null);C(this,"valueAsTypeSingle",null);C(this,"valueAsTypeList",null);C(this,"errors",[]);C(this,"parent",null);C(this,"standaloneParent",null);C(this,"project");C(this,"detachedDependents",{});C(this,"knownVersions",null);C(this,"activeVersion",!1);C(this,"initialized",!1);C(this,"startedInitialization",!1);C(this,"standalone",!1);if(this.initialData=t,this.project=n,this.id=t.id,this.name=t.name,this.autogeneration=t.autogeneration,this.value=t.value,this.rawString=t.rawString!==void 0?t.rawString:typeof t.value=="string"?t.value:null,!this.name)throw new Error("[LiteralValueState.constructor] Must have a name in the initial data passed to the constructor")}static new(t=null){return{id:M.UUID.uuid(),version:M.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||j().toISOString(),author:(t==null?void 0:t.author)||M.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:r.LiteralValue,standaloneParent:null,name:"",autogeneration:null,value:null,rawString:null,valueAsTypeSingle:null,valueAsTypeList:null,parent:null}}static fromGenerationTarget(t,n,s){const u=s===void 0?n.addChangeSet(new de(n,M.sessionAuthor,j().toISOString(),n,!0,N.CreateFromGenerationTarget)):s,e=ge(t.parent),f=n.get(e);let y=null,m=null;t.valueAsTypeList?Array.isArray(t.valueAsTypeList)&&(m=t.valueAsTypeList.map(b=>n.get(b)||n.getBuiltIn(b))):t.valueAsTypeSingle&&(y=n.get(t.valueAsTypeSingle)||n.getBuiltIn(t.valueAsTypeSingle));const T={id:t.id,version:M.UUID.uuid(),createdAt:(u==null?void 0:u.timestamp)||j().toISOString(),author:(u==null?void 0:u.author)||M.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:r.LiteralValue,standaloneParent:null,name:t.name,autogeneration:t.autogeneration,valueAsTypeSingle:y,valueAsTypeList:m,value:t.value||null,rawString:t.rawString!==void 0?t.rawString:typeof t.value=="string"?t.value:null,parent:f.toReference()},g=Se(T,n);return g.hydrateAncestors(),g.setParent(f,u),g.addSelfToProject(u),u==null||u.add(g,ye.Added),g.initChildren(u),u||g.captureVersion(),g}static validateGenerationTarget(t,n){let s=JSON.parse(JSON.stringify(t));(s.valueAsTypeList||s.valueAsTypeSingle)&&(s.name=me.EntityTemplate);const u=[],e=[],f=zgn(s,n),y=cs(s);return e.push(...f.errors,...y.errors),u.push(...f.explanations,...y.explanations),{errors:e,explanations:u,modifiedData:s}}get valueAsType(){return this.valueAsTypeSingle?this.valueAsTypeSingle:this.valueAsTypeList?this.valueAsTypeList:null}get isFinal(){var t,n;return!!(((t=this.parent)==null?void 0:t.type)===r.Property&&(this.parent.constant||this.parent.implements.some(s=>s.constant))||((n=this.parent)==null?void 0:n.type)===r.Property&&this.parent.parent.type===r.DefinitionEntity&&!lu(this.parent.parent))}validateGeneratedUpdate(t){const n=[],s=[];return t.parent&&n.push(new He({id:`${this.id}--${we.InvalidParentUpdate}`,code:we.InvalidParentUpdate,severity:Ie.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:n,explanations:s,modifiedData:t}}subscribeDependents(t){return t.forEach(n=>{this.detachedDependents[n.entity.id]||(this.detachedDependents[n.entity.id]=n)}),this}unsubscribeDependents(t){return t.forEach(n=>{this.detachedDependents[n.entity.id]&&delete this.detachedDependents[n.entity.id]}),this}syncDependents(t=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,"sync-dependents"))){const n=[],s=[],u=[],e=[];return Object.values(this.detachedDependents).forEach(f=>{const y=f.entity.afterAllChildrenInitialized(t);n.push(...y.updated),s.push(...y.added),u.push(...y.removed),e.push(...y.affected)}),t==null||t.attemptAutoclose("sync-dependents",this.id),{updated:_(n),added:_(s),removed:_(u),affected:_(e),self:this}}onDetachedDependencyRemoved(t,n,s){const u=[],e=[],f=[],y=[];return n==="value-as-type-single"&&(this.valueAsTypeSingle=null,s==null||s.add(this,ye.Updated)),n==="value-as-type-list"&&(this.valueAsTypeList=(this.valueAsTypeList||[]).filter(m=>m.id!==t.id),s==null||s.add(this,ye.Updated)),{updated:_(u),added:_(e),removed:_(f),affected:_(y),self:this}}onDetachedDependencyRestored(t,n,s){const u=[],e=[],f=[],y=[];return n==="value-as-type-single"&&(this.valueAsTypeSingle=t,s==null||s.add(this,ye.Updated)),n==="value-as-type-list"&&(this.valueAsTypeList=[...Array.isArray(this.valueAsTypeList||[])?this.valueAsTypeList:[],t],s==null||s.add(this,ye.Updated)),{updated:_(u),added:_(e),removed:_(f),affected:_(y),self:this}}unsubscribeFromDependencies(){return this.valueAsTypeSingle&&this.valueAsTypeSingle.type!==r.BuiltInBaseEntity&&this.valueAsTypeSingle.unsubscribeDependents([{entity:this,field:"value-as-type-single"}]),this.valueAsTypeList&&Array.isArray(this.valueAsTypeList)&&this.valueAsTypeList.forEach(t=>{t.type!==r.BuiltInBaseEntity&&t.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(t=>{t.type!==r.BuiltInBaseEntity&&t.subscribeDependents([{entity:this,field:"value-as-type-list"}])}):this.valueAsTypeSingle&&this.valueAsTypeSingle.type!==r.BuiltInBaseEntity&&this.valueAsTypeSingle.subscribeDependents([{entity:this,field:"value-as-type-single"}]),this)}increaseVersion(t){var n;if(this.project.diggestedBuiltInBaseEntitiesIds.has(this.id))return this;if(t&&!j(t).isValid())throw new Error(`The shared timestamp '${t}' is not a valid ISO 8601 date string.`);if(t&&j(t).isSame(j(this.createdAt)))return this;if(!((n=this.knownVersions)!=null&&n.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=M.UUID.uuid(),this.createdAt=j(t).toISOString()||j().toISOString(),this}captureVersion(){var n;const t=((n=this.knownVersions)==null?void 0:n.get(this.version))||new Wn(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!==t.version)throw new Error(`Captured ${this.type} with id '${this.id}', version '${t.version}' does not match current entity version '${this.version}'.`);return this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,t):new Map().set(this.version,t),this.apply(t),this}snapshot(){const t=new Wn(this,this.project);return this.apply(t)}apply(t){const n=this.toMeta();return t.metaSync(n,null),t.valueAsTypeSingle=this.valueAsTypeSingle,t.valueAsTypeList=this.valueAsTypeList?[...this.valueAsTypeList]:this.valueAsTypeList,t.parent=this.parent,t}recursiveCaptureUpstreamVersions(t){const n=[],s=[],u=[],e=[];if(this.parent){this.parent.increaseVersion(t);const f=this.parent.recursiveCaptureUpstreamVersions(t);n.push(this.parent,...f.updated),s.push(...f.added),u.push(...f.removed)}return{updated:_(n),added:_(s),removed:_(u),affected:_(e),self:this}}async restoreVersion(t,n){var m;const s=[],u=[],e=[],f=[];if(this.version===t&&(n!=null&&n.skipIfSameVersion))return{updated:_(s),added:_(u),removed:_(e),affected:_(f),self:this};if(!this.knownVersions){const T=new Map;for(const[g,b]of this.knownVersions||new Map){if(T.set(g,b),b.activeVersion=!1,b.knownVersions)for(const[R,I]of b.knownVersions)T.set(R,I);b.knownVersions=null}}let y=(m=this.knownVersions)==null?void 0:m.get(t);if(!y){const T=await this.APILoadVersion({},t);if(!T)throw new Error(`Version with id '${t}' for entity with id '${this.id}' not found.`);y=new Wn(T,this.project)}return this.metaSync(y.toShallowJSON(),null),this.previousVersion=y.previousVersion,this.version=y.version,this.createdAt=y.createdAt,this.author=y.author,this.deleted=y.deleted,this.valueAsTypeSingle=y.valueAsTypeSingle,this.parent=y.parent,{updated:_(s),added:_(u),removed:_(e),affected:_(f),self:this}}updateWithShallowTransfer(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.UpdateWithShallowTransfer))){if(!this.checkCanEdit(this,n))return pe.Logger.warn(`[updateWithShallowTransfer] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(N.UpdateWithShallowTransfer,this.id),this;if(this.metaSync(t,n),this.version=t.version,this.createdAt=t.createdAt,this.author=t.author,this.deleted=t.deleted,this.previousVersion=t.previousVersion,this.unsubscribeFromDependencies(),t.parent&&t.standaloneParent)throw new Error(`Entity with id '${this.id}' cannot have both 'parent' and 'standaloneParent' properties set.`);if(t.parent){const s=ge(t.parent),u=this.project.get(s),e=this.parent;if(e&&e.id!==(u==null?void 0:u.id)&&this.removeFromParent(n),u)this.setParent(u,n),this.addSelfToProject(n);else throw new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${s}' that isn't found in the project`)}else if(t.standaloneParent){const s=ge(t.standaloneParent),u=this.project.get(s);if(u)this.setStandaloneParent(u,n);else throw new Error(`${this.type} with id '${this.id}' has a 'standaloneParent' reference '${s}' that isn't found in the project`)}else throw new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(t.valueAsTypeList&&Array.isArray(t.valueAsTypeList))this.valueAsTypeList=this.valueAsTypeList||[],t.valueAsTypeList.forEach(s=>{const u=ge(s),e=this.project.get(u);e&&this.addValueAsTypeToList(e,n)}),[...this.valueAsTypeList].forEach(s=>{(t.valueAsTypeList||[]).find(e=>ge(e)===s.id)||this.removeValueAsTypeFromList(s,n)}),this.setValueAsTypeSingle(null,n),this.metaSync({value:null},n);else if(t.valueAsTypeSingle){const s=ge(t.valueAsTypeSingle),u=this.project.get(s);u&&(this.setValueAsTypeSingle(u,n),this.setValueAsTypeList(null,n),this.metaSync({value:null},n))}else this.setValueAsTypeSingle(null,n),this.setValueAsTypeList(null,n);return this.captureVersion(),this.subscribeToDependencies(),n==null||n.attemptAutoclose(N.UpdateWithShallowTransfer,this.id),this}updateWithGenerationTarget(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.UpdateWithGenerationTarget))){if(!this.checkCanEdit(this,n))return pe.Logger.warn(`[updateWithGenerationTarget] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(N.UpdateWithGenerationTarget,this.id),this;if(this.metaSync(t,n),t.parent&&t.standaloneParent)throw new Error(`Entity with id '${this.id}' cannot have both 'parent' and 'standaloneParent' properties set.`);if(t.parent){const s=ge(t.parent),u=this.project.get(s),e=this.parent;if(e&&e.id!==(u==null?void 0:u.id)&&this.removeFromParent(n),u)this.setParent(u,n),this.addSelfToProject(n);else throw new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${s}' that isn't found in the project`)}else if(t.standaloneParent){const s=ge(t.standaloneParent),u=this.project.get(s);if(u)this.setStandaloneParent(u,n);else throw new Error(`${this.type} with id '${this.id}' has a 'standaloneParent' reference '${s}' that isn't found in the project`)}if(t.valueAsTypeList&&Array.isArray(t.valueAsTypeList))this.valueAsTypeList=this.valueAsTypeList||[],t.valueAsTypeList.forEach(s=>{const u=ge(s),e=this.project.get(u);e&&this.addValueAsTypeToList(e,n)}),[...this.valueAsTypeList].forEach(s=>{(t.valueAsTypeList||[]).find(e=>ge(e)===s.id)||this.removeValueAsTypeFromList(s,n)}),this.setValueAsTypeSingle(null,n),this.metaSync({value:null},n);else if(t.valueAsTypeSingle){const s=ge(t.valueAsTypeSingle),u=this.project.get(s);u&&(this.setValueAsTypeSingle(u,n),this.setValueAsTypeList(null,n),this.metaSync({value:null},n))}return(t.valueAsTypeSingle===null||t.valueAsTypeList||t.value!==null&&t.value!==void 0)&&this.setValueAsTypeSingle(null,n),(t.valueAsTypeList===null||t.valueAsTypeSingle||t.value!==null&&t.value!==void 0)&&this.setValueAsTypeList(null,n),this.captureVersion(),this.subscribeToDependencies(),n==null||n.attemptAutoclose(N.UpdateWithGenerationTarget,this.id),this}hydrateAncestors(){const t=[],n=[],s=[],u=[];if(this.initialData.parent&&this.initialData.standaloneParent){const e=ge(this.initialData.parent),f=this.project.get(e),y=ge(this.initialData.standaloneParent),m=this.project.get(y);let T="";throw f?T+=` Parent -> ${f.type}: '${f.id}' "${Ve(f,this.project)}".`:T+=" Parent -> not-found.",m?T+=` Standalone Parent -> ${m.type}: '${m.id}' "${Ve(m,this.project)}".`:T+=" Standalone Parent -> not-found.",new Error(`Entity with id '${this.id}' cannot have both 'parent' and 'standaloneParent' properties set.${T}`)}if(this.initialData.parent){const e=ge(this.initialData.parent),f=this.project.get(e);if(pe.Logger.log(`[LiteralValueState.hydrateAncestors] Hydrating parent reference '${e}' for entity with id '${this.id}'`),f)pe.Logger.log(`[LiteralValueState.hydrateAncestors] Setting parent reference '${f.id}' for entity with id '${this.id}'`),this.setParent(f,null),t.push(f);else throw pe.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=ge(this.initialData.standaloneParent),f=this.project.get(e);if(pe.Logger.log(`[LiteralValueState.hydrateAncestors] Hydrating standalone parent reference '${e}' for entity with id '${this.id}'`),f)pe.Logger.log(`[LiteralValueState.hydrateAncestors] Setting standalone parent reference '${f.id}' for entity with id '${this.id}'`),this.setStandaloneParent(f,null);else throw pe.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 pe.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=ge(e),y=this.project.get(f);y&&this.valueAsTypeList.push(y)});else if(this.initialData.valueAsTypeSingle){const e=ge(this.initialData.valueAsTypeSingle),f=this.project.get(e);f&&(this.valueAsTypeSingle=f)}return{updated:_(t),added:_(n),removed:_(s),affected:_(u),self:this}}afterAllChildrenInitialized(t=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.AfterAllChildrenInitialized))){if(!this.checkCanEdit(this,t))return pe.Logger.warn(`[afterAllChildrenInitialized] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),t==null||t.attemptAutoclose(N.AfterAllChildrenInitialized,this.id),{updated:[],added:[],removed:[],affected:[],self:this};const n=[],s=[],u=[],e=[];return this.initialized=!0,t==null||t.attemptAutoclose(N.AfterAllChildrenInitialized,this.id),{updated:_(n),added:_(s),removed:_(u),affected:_(e),self:this}}addSelfToProject(t=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,"add-self-to-project"))){var f,y;const n=[this],s=[],u=[],e=[];return((f=this.parent)==null?void 0:f.type)===r.DataType?this.parent.setEntity(this,t):(y=this.parent)==null||y.setDefaultValue(this,t),e.push(this.parent),this.subscribe(),this.subscribeToDependencies(),t==null||t.attemptAutoclose("add-self-to-project",this.id),{updated:_(n),added:_(s),removed:_(u),affected:_(e),self:this}}setParent(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.SetParent))){var s;return this.checkCanEditWithCounterpartAndSideEffects(this,t,N.SetParent,n)?(((s=this.parent)==null?void 0:s.id)!==(t==null?void 0:t.id)&&(this.parent=t,this.standaloneParent&&(this.standaloneParent=null,this.standalone=!1),n&&(n==null||n.add(this,ye.Updated))),n==null||n.attemptAutoclose(N.SetParent,this.id),this):this}setStandaloneParent(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.SetStandaloneParent))){var s;if(!this.checkCanEditWithCounterpartAndSideEffects(this,t,N.SetStandaloneParent,n))return this;if(this.project.get(this.id)&&this.parent)throw new Error("[LiteralValueState.setStandaloneParent] This literal-value belongs to the project AST and setting a standalone parent is not possible. Clone the instance, or create a separate one to be standalone.");return((s=this.standaloneParent)==null?void 0:s.id)!==(t==null?void 0:t.id)&&(this.parent&&(this.removeFromParent(n),this.parent=null),this.standaloneParent=t,this.standalone=!0,n&&(n==null||n.add(this,ye.Updated))),n==null||n.attemptAutoclose(N.SetStandaloneParent,this.id),this}addValueAsTypeToList(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.AddValueAsTypeToList))){return this.checkCanEdit(this,n)?((this.valueAsTypeList||[]).includes(t)||(this.valueAsTypeList=this.valueAsTypeList||[],this.valueAsTypeList.push(t),this.value!==null&&this.metaSync({value:null},n),this.valueAsTypeSingle!==null&&(this.valueAsTypeSingle=null,n==null||n.add(this,ye.Updated)),n==null||n.add(this,ye.Updated)),n==null||n.attemptAutoclose(N.AddValueAsTypeToList,this.id),this):(pe.Logger.warn(`[addValueAsTypeToList] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(N.AddValueAsTypeToList,this.id),this)}removeValueAsTypeFromList(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.RemoveValueAsTypeFromList))){return this.checkCanEdit(this,n)?(this.valueAsTypeList&&Array.isArray(this.valueAsTypeList)&&(this.valueAsTypeList||[]).includes(t)&&(this.valueAsTypeList=this.valueAsTypeList.filter(s=>s.id!==t.id),this.valueAsTypeList.length===0?this.valueAsTypeList=null:(this.value!==null&&this.metaSync({value:null},n),this.valueAsTypeSingle!==null&&(this.valueAsTypeSingle=null,n==null||n.add(this,ye.Updated))),n==null||n.add(this,ye.Updated)),n==null||n.attemptAutoclose(N.RemoveValueAsTypeFromList,this.id),this):(pe.Logger.warn(`[removeValueAsTypeFromList] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(N.RemoveValueAsTypeFromList,this.id),this)}setValueAsTypeSingle(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.SetValueAsTypeSingle))){return this.checkCanEdit(this,n)?(this.valueAsTypeSingle!==t&&(this.valueAsTypeSingle=t,n==null||n.add(this,ye.Updated)),n==null||n.attemptAutoclose(N.SetValueAsTypeSingle,this.id),this):(pe.Logger.warn(`[setValueAsTypeSingle] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(N.SetValueAsTypeSingle,this.id),this)}setValueAsTypeList(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.SetValueAsTypeList))){var s,u;return this.checkCanEdit(this,n)?(!t&&this.valueAsTypeList?(this.valueAsTypeList=null,n==null||n.add(this,ye.Updated)):t&&!this.valueAsTypeList?(this.valueAsTypeList=t,n==null||n.add(this,ye.Updated)):t&&this.valueAsTypeList&&((s=this.valueAsTypeList)==null?void 0:s.length)!==t.length?(this.valueAsTypeList=t,n==null||n.add(this,ye.Updated)):t&&this.valueAsTypeList&&((u=this.valueAsTypeList)!=null&&u.every((e,f)=>e!==t[f]))&&(this.valueAsTypeList=t,n==null||n.add(this,ye.Updated)),n==null||n.attemptAutoclose(N.SetValueAsTypeList,this.id),this):(pe.Logger.warn(`[setValueAsTypeList] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(N.SetValueAsTypeList,this.id),this)}setValueAsType(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.SetValueAsType))){return this.checkCanEdit(this,n)?t?(Array.isArray(t)?this.setValueAsTypeList(t,n):this.setValueAsTypeSingle(t,n),n==null||n.attemptAutoclose(N.SetValueAsType,this.id),this):(this.setValueAsTypeSingle(null,n),this.setValueAsTypeList(null,n),this):(pe.Logger.warn(`[setValueAsType] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(N.SetValueAsType,this.id),this)}initChildren(t=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,"init-children"))){if(this.initialized||this.startedInitialization)return this;if(this.startedInitialization=!0,this.standalone){if(this.initialData.valueAsTypeList&&Array.isArray(this.initialData.valueAsTypeList))this.valueAsTypeList=this.initialData.valueAsTypeList.map(n=>{if(n.type===r.GenericReference){const u=this.project.findSubscribedBuiltInInstanceFromReference(n);if(!u)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${n.entityType}' with id '${n.entityId}' that is not part of the project state.`);return u}const s=this.project.get(n.id);if(!s)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${n.type}' with id '${n.id}' that is not part of the project state.`);return s});else if(this.initialData.valueAsTypeSingle){if(this.initialData.valueAsTypeSingle.type===r.GenericReference){const s=this.project.findSubscribedBuiltInInstanceFromReference(this.initialData.valueAsTypeSingle);if(!s)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=s,this}const n=this.project.get(this.initialData.valueAsTypeSingle.id);if(!n)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${this.initialData.valueAsTypeSingle.type}' with id '${this.initialData.valueAsTypeSingle.id}' that is not part of the project state.`);this.valueAsTypeSingle=n}return this}if(this.initialData.valueAsTypeList&&Array.isArray(this.initialData.valueAsTypeList))this.valueAsTypeList=this.initialData.valueAsTypeList.map(n=>{if(n.type===r.GenericReference){const u=this.project.findSubscribedBuiltInInstanceFromReference(n);if(!u)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${n.entityType}' with id '${n.entityId}' that is not part of the project state.`);return u}const s=this.project.get(n.id);if(!s)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${n.type}' with id '${n.id}' that is not part of the project state.`);return s});else if(this.initialData.valueAsTypeSingle){if(this.initialData.valueAsTypeSingle.type===r.GenericReference){const s=ge(this.initialData.valueAsTypeSingle),u=s?this.project.get(s):null;if(!u)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=u,this}const n=this.project.get(this.initialData.valueAsTypeSingle.id);if(!n)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${this.initialData.valueAsTypeSingle.type}' with id '${this.initialData.valueAsTypeSingle.id}' that is not part of the project state.`);this.valueAsTypeSingle=n}return this.subscribeToDependencies(),this.afterAllChildrenInitialized(t),t==null||t.attemptAutoclose("init-children",this.id),this}subscribe(){var t;return this.activeVersion=!0,(t=this.knownVersions)==null||t.forEach(n=>{n.version!==this.version&&(n.activeVersion=!1)}),this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,"meta-sync"))){const s=ys(this,t,n);this.id==="3a497c83-1410-4ab0-8478-1e9c4f0c1935"&&t.value===!1&&console.trace("[LiteralValueState.metaSync] Test error");const u=fs(this,s),e=this.toMeta();this.name=s.name!==void 0?s.name:e.name,this.autogeneration=s.autogeneration!==void 0?s.autogeneration:e.autogeneration,this.value=s.value!==void 0?s.value:e.value,s.rawString!==void 0?this.rawString=s.rawString:s.value!==void 0&&typeof s.value=="string"?this.rawString=s.value:this.rawString=e.rawString;const f=t.valueAsTypeSingle!==void 0?t.valueAsTypeSingle:this.valueAsTypeSingle??null,y=t.valueAsTypeList!==void 0?t.valueAsTypeList:this.valueAsTypeList??null;return(this.name!==me.String||f!==null||y!==null&&y.length>0)&&(this.rawString=null,s.rawString=null),super.baseMetaSync(s,this,n),s.deleted===!0&&!e.deleted?n==null||n.add(this,ye.Removed):s.deleted===!1&&e.deleted?n==null||n.add(this,ye.Added):u&&(n==null||n.add(this,ye.Updated)),n==null||n.attemptAutoclose("meta-sync",this.id),this}async APILoad(t=gt,...n){return await Wn.repository.APILoad(this.id,...n),this}async APICreate(t=gt,...n){return await Wn.repository.APICreate(this.toShallowJSON(),...n),this}async APIUpdate(t=gt,...n){return await Wn.repository.APIUpdate(this.toShallowJSON(),...n),this}async APIDelete(t=gt,...n){return await Wn.repository.APIDelete(this.toShallowJSON(),...n),this}async APIClone(t=gt,...n){return await Wn.repository.APIClone(this.id,...n),this}async APILoadVersion(t=gt,n,...s){return await Wn.repository.APILoadVersion(this.id,n,...s)}removeFromParent(t=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.RemoveFromParent))){if(!this.checkCanEdit(this,t))return pe.Logger.warn(`[removeFromParent] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),t==null||t.attemptAutoclose(N.RemoveFromParent,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const n=[],s=[],u=[],e=[];return this.parent&&(this.parent.type===r.DataType?this.parent.setEntity(null,t):xO.includes(this.parent.type)&&this.parent.setDefaultValue(null,t),e.push(this.parent)),t==null||t.attemptAutoclose(N.RemoveFromParent,this.id),{added:_(u),updated:_(n),removed:_(s),affected:_(e),self:this}}remove({ignoreUpstream:t}={ignoreUpstream:!1},n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.RemoveEntity))){var y;if(!this.checkCanDelete(this,n))return pe.Logger.warn(`[remove] User is not allowed to delete or edit this ${this.type} entity with id: ${this.id}`),n==null||n.event({id:`${N.RemoveEntity}-${this.id}--${at.ActionOwnerEntityNonDeletable}`,action:N.RemoveEntity,owner:this,errorReason:at.ActionOwnerEntityNonDeletable,rootAction:((y=n==null?void 0:n.self)==null?void 0:y.id)===this.id&&(n==null?void 0:n.actionName)===N.RemoveEntity}),n==null||n.attemptAutoclose(N.RemoveEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const s=[],u=[],e=[],f=[];if(n!=null&&n.hasRemoved(this.id))return n==null||n.attemptAutoclose(N.RemoveEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(u.push(this),this.unsubscribe(),this.unsubscribeFromDependencies(),this.project.subscribeDeletedInstance(this),this.metaSync({deleted:!0},n),Object.values(this.detachedDependents).forEach(m=>{const{updated:T,removed:g,added:b}=m.entity.onDetachedDependencyRemoved(this,m.field,n);s.push(...T),u.push(...g),e.push(...b)}),!t){const m=this.removeFromParent(n);e.push(...m.added),s.push(...m.updated),u.push(...m.removed),f.push(...m.affected)}return n==null||n.attemptAutoclose(N.RemoveEntity,this.id),{added:_(e),updated:_(s),removed:_(u),affected:_(f),self:this}}restore({}={},t=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.RestoreEntity))){if(!this.checkCanEdit(this,t))return pe.Logger.warn(`[restore] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),t==null||t.attemptAutoclose(N.RestoreEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const n=[],s=[],u=[],e=[];return t!=null&&t.hasAdded(this.id)?(t==null||t.attemptAutoclose(N.RestoreEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this}):(this.subscribe(),this.project.unsubscribeDeletedInstance(this),this.metaSync({deleted:!1},t),Object.values(this.detachedDependents).forEach(f=>{const{updated:y,removed:m,added:T}=f.entity.onDetachedDependencyRestored(this,f.field,t);s.push(...y),u.push(...m),n.push(...T)}),t==null||t.attemptAutoclose(N.RestoreEntity,this.id),{added:_(n),updated:_(s),removed:_(u),affected:_(e),self:this})}toFlat(t=new Set){return t.has(this.id)?[]:(t.add(this.id),[this,...this.valueAsTypeSingle?this.valueAsTypeSingle.toFlat(t):[],...this.valueAsTypeList&&Array.isArray(this.valueAsTypeList)?this.valueAsTypeList.flatMap(s=>s.toFlat(t)):[]])}toFlatIds(t=new Set){return t.has(this.id)?[]:(t.add(this.id),[this.id,...this.valueAsTypeSingle?this.valueAsTypeSingle.toFlatIds(t):[],...this.valueAsTypeList&&Array.isArray(this.valueAsTypeList)?this.valueAsTypeList.flatMap(s=>s.toFlatIds(t)):[]])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,value:this.value,rawString:this.rawString,autogeneration:this.autogeneration,type:this.type,editable:this.editable,deletable:this.deletable,name:this.name}}toJSON(t=new Set){var n,s,u;return t.has(this.id)?this.toReference():(t.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,rawString:this.rawString,valueAsTypeSingle:((n=this.valueAsTypeSingle)==null?void 0:n.toJSON(t))||null,valueAsTypeList:Array.isArray(this.valueAsTypeList)?this.valueAsTypeList.map(e=>e.toJSON(t)):null,parent:((s=this.parent)==null?void 0:s.toReference())||null,standaloneParent:((u=this.standaloneParent)==null?void 0:u.toReference())||null})}toJSONClone(t=Kt){var s,u,e,f,y,m,T;let n;return(s=t.seenEntityMaps)!=null&&s.has(this.id)?n=t.seenEntityMaps.get(this.id):(n=t.newId||xs(this,this.project,t.uuidStrategy),t.seenEntityMaps&&t.seenEntityMaps.set(this.id,n)),(u=t.seenEntities)!=null&&u.has(n)||(e=t.seenEntities)!=null&&e.has(this.id)?this.toReference({seenEntityMaps:t.seenEntityMaps}):((f=t.seenEntities)==null||f.add(n),(y=t.seenEntities)==null||y.add(this.id),{id:n,version:M.UUID.uuid(),createdAt:t.timestamp||j().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,rawString:this.rawString,valueAsTypeSingle:this.valueAsTypeSingle?this.project.getBuiltIn(this.valueAsTypeSingle.id)?this.valueAsTypeSingle.toJSON():this.valueAsTypeSingle.toJSONClone({...t,newId:null}):null,valueAsTypeList:this.valueAsTypeList&&Array.isArray(this.valueAsTypeList)?this.valueAsTypeList.map(g=>{var b;return this.project.getBuiltIn(g.id)?g.toJSON(t.seenEntities):(b=g.toJSONClone)==null?void 0:b.call(g,{...t,newId:null})}):null,parent:((m=this.parent)==null?void 0:m.toReference({seenEntityMaps:t.seenEntityMaps}))||null,standaloneParent:((T=this.standaloneParent)==null?void 0:T.toReference({seenEntityMaps:t.seenEntityMaps}))||null})}toReference(t=Kt){var s;let n=this.id;return(s=t.seenEntityMaps)!=null&&s.has(this.id)&&(n=t.seenEntityMaps.get(this.id)),{id:n+"--"+M.UUID.uuid()+"--ref",type:r.GenericReference,entityId:n,version:this.version,entityType:this.type}}toShallowJSON(t=Kt){var s,u,e,f;let n=this.id;return(s=t.seenEntityMaps)!=null&&s.has(this.id)&&(n=t.seenEntityMaps.get(this.id)),{id:n,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,editable:this.editable,deletable:this.deletable,name:this.name,valueAsTypeSingle:((u=this.valueAsTypeSingle)==null?void 0:u.toReference(t))||null,valueAsTypeList:Array.isArray(this.valueAsTypeList)?this.valueAsTypeList.map(y=>y.toReference(t)):null,value:this.value,rawString:this.rawString,autogeneration:this.autogeneration,parent:((e=this.parent)==null?void 0:e.toReference(t))||null,standaloneParent:(f=this.standaloneParent)==null?void 0:f.toReference(t)}}toFlatJSON(t=new Set){return t.has(this.id)?[]:(t.add(this.id),[this.toShallowJSON(),...this.valueAsTypeSingle?this.valueAsTypeSingle.toFlatJSON(t):[],...this.valueAsTypeList&&Array.isArray(this.valueAsTypeList)?this.valueAsTypeList.flatMap(s=>s.toFlatJSON(t)):[]])}toGenerationTarget(t=Kt){var s,u,e,f;let n=this.id;return(s=t.seenEntityMaps)!=null&&s.has(this.id)&&(n=t.seenEntityMaps.get(this.id)),{id:n,type:this.type,name:this.name,valueAsTypeSingle:((u=this.valueAsTypeSingle)==null?void 0:u.id)||null,valueAsTypeList:Array.isArray(this.valueAsTypeList)?this.valueAsTypeList.map(y=>y.id):null,value:this.value,rawString:this.rawString,autogeneration:this.autogeneration,parent:(e=this.parent)==null?void 0:e.id,standaloneParent:(f=this.standaloneParent)==null?void 0:f.id}}toFlatGenerationTarget(t=new Set){return t.has(this.id)?[]:(t.add(this.id),[this.toGenerationTarget(),...this.valueAsTypeSingle?this.valueAsTypeSingle.toFlatGenerationTarget(t):[],...this.valueAsTypeList&&Array.isArray(this.valueAsTypeList)?this.valueAsTypeList.flatMap(s=>s.toFlatGenerationTarget(t)):[]])}clearErrors(){return this.errors=[],this}validate(){return this.errors=rmt(this),{success:!0}}async validateAsync(t={}){const n=pe.YieldTracker.from(t);return this.errors=await nmt(this,{tracker:n}),{success:!0}}getErrors(){return[...this.errors]}async getErrorsAsync(t={}){const n=pe.YieldTracker.from(t),s=[...this.errors];return await n.tick(),s}getShallowErrors(){return this.errors}clone(t=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.CloneEntity)),n=null,s=null,u=!0){const e=Qa(n,this),f=this.toJSON();n?(f.parent=n.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 y=s||M.UUID.uuid();f.id=y,f.version=M.UUID.uuid(),f.createdAt=(t==null?void 0:t.timestamp)||j().toISOString(),f.author=(t==null?void 0:t.author)||"1",f.previousVersion=null,f.deleted=!1,f.editable=!0,f.deletable=!0;const m=Zr(f,e);return m.hydrateAncestors(),n&&m.setParent(n,t),u&&(m.subscribe(),m.addSelfToProject(t)),t==null||t.add(m,ye.Added),m.initChildren(t),!t&&u&&m.captureVersion(),t==null||t.attemptAutoclose(N.CloneEntity,this.id),m}merge(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,"merge-literal-value"))){const s=[],u=[],e=[],f=[];return this.valueAsTypeSingle!==(t==null?void 0:t.valueAsTypeSingle)&&(this.setValueAsType(t.valueAsTypeSingle,n),s.push(this)),this.valueAsTypeList!==t.valueAsTypeList&&(this.setValueAsTypeList(t.valueAsTypeList,n),s.push(this)),this.value!==t.value&&(this.metaSync({value:t.value},n),s.push(this)),this.autogeneration!==t.autogeneration&&(this.metaSync({autogeneration:t.autogeneration},n),s.push(this)),this.name!==t.name&&(this.metaSync({name:t.name},n),s.push(this)),n==null||n.attemptAutoclose("merge-literal-value",this.id),{updated:_(s),added:_(u),removed:_(e),affected:_(f),self:this}}};C(Wn,"repository",{APICreate:async(t,...n)=>t,APIUpdate:async(t,...n)=>t,APIDelete:async(t,...n)=>t,APIClone:async(t,...n)=>{},APILoad:async(t,...n)=>null,APILoadVersion:async(t,n,...s)=>null}),C(Wn,"type",r.LiteralValue),C(Wn,"USER_MANAGED_PARENT_TYPES",[r.DataType,r.InputMap,r.Property,r.ArgumentDeclaration,r.ReturnStatement,r.BreakStatement,r.ContinueStatement,r.VariableDeclaration,r.VariableInstance,r.ValueDescriptor]),C(Wn,"USER_MANAGED_STANDALONE_PARENT_TYPES",[...OO]),C(Wn,"PARENT_TYPES",[...Wn.USER_MANAGED_PARENT_TYPES]),C(Wn,"MUTABLE_BASE_PROPERTIES",["name","autogeneration","value","rawString"]),C(Wn,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),C(Wn,"BASE_PROPERTIES",[...Wn.MUTABLE_BASE_PROPERTIES,...Wn.INMUTABLE_BASE_PROPERTIES]),C(Wn,"MUTABLE_META_PROPERTIES",[...Wn.MUTABLE_BASE_PROPERTIES]),C(Wn,"INMUTABLE_META_PROPERTIES",[...Wn.INMUTABLE_BASE_PROPERTIES]),C(Wn,"META_PROPERTIES",[...Wn.MUTABLE_META_PROPERTIES,...Wn.INMUTABLE_META_PROPERTIES]),C(Wn,"MUTABLE_UPSTREAM_PROPERTIES",["valueAsTypeSingle","valueAsTypeList"]),C(Wn,"INMUTABLE_UPSTREAM_PROPERTIES",["parent"]),C(Wn,"UPSTREAM_PROPERTIES",[...Wn.MUTABLE_UPSTREAM_PROPERTIES,...Wn.INMUTABLE_UPSTREAM_PROPERTIES]),C(Wn,"MUTABLE_DOWNSTREAM_PROPERTIES",[]),C(Wn,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),C(Wn,"DOWNSTREAM_PROPERTIES",[...Wn.MUTABLE_DOWNSTREAM_PROPERTIES,...Wn.INMUTABLE_DOWNSTREAM_PROPERTIES]),C(Wn,"PROPERTIES",[...Wn.META_PROPERTIES,...Wn.UPSTREAM_PROPERTIES,...Wn.DOWNSTREAM_PROPERTIES]);let ya=Wn;function av(a){if(typeof crypto<"u"&&typeof crypto.getRandomValues=="function"){const t=new Uint8Array(a);return crypto.getRandomValues(t),t}const{randomBytes:p}=require("crypto");return p(a)}function smt(a,p){const t=p-a+1,s=sV()*t;return Math.floor(s)+a}function lmt(){const a=av(4);return(a[0]<<24|a[1]<<16|a[2]<<8|a[3])>>>0}function sV(){return lmt()/2**32}function c4(a){const p=av(a);return Array.from(p).map(t=>t.toString(16).padStart(2,"0")).join("")}const SL="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";function f4(a){let p="";const t=av(a);for(let n=0;n<a;n++)p+=SL[t[n]%SL.length];return p}function omt(a){const p=av(a);let t;if(typeof Buffer<"u")t=Buffer.from(p).toString("base64");else{const n=String.fromCharCode(...p);t=btoa(n)}return t.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function y4(a){return f4(a)}function h4(a,p=SL){let t="";const n=av(a);for(let s=0;s<a;s++)t+=p[n[s]%p.length];return t}function Bh(){const a=av(16);a[6]=a[6]&15|64,a[8]=a[8]&63|128;const p=Array.from(a).map(t=>t.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 dmt(){return h4(6)}function pmt(){return c4(32)}const Ygn=63,Jgn=/^[a-z][a-z0-9-]*[a-z0-9]$/;function Qgn(a){return a.length>=1&&a.length<=Ygn&&Jgn.test(a)&&!a.includes("--")}function*Xgn(){yield"";const a="abcdefghijklmnopqrstuvwxyz";for(let p=1;;p++){const t=new Array(p).fill(0);let n=!1;for(;!n;){yield t.map(s=>a[s]).join("");for(let s=p-1;s>=0&&(t[s]++,!(t[s]<a.length));s--)t[s]=0,s===0&&(n=!0)}}}function ebn(a,p){const t=new Set(a.map(s=>s.toLowerCase())),n=p>0?"secondarydb":"main";for(const s of Xgn()){const u=s?`${n}${s}`:n;if(Qgn(u)&&!t.has(u))return u}throw new Error("Unable to generate identifier")}function umt(a,p){switch(a.id){case G["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.id:{const t=a.project.entities.filter(y=>!!y.implements.find(m=>m.id===G["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id)),n=t.find(y=>{const m=y.properties.find(b=>b.implements.find(R=>R.id===G["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id)),T=m==null?void 0:m.getDefaultValue();return(T==null?void 0:T.value)===!0});if(!n&&t.length){const m=t[0].properties.find(g=>g.implements.find(b=>b.id===G["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id)),T=m==null?void 0:m.defaultValue;if(T)T.metaSync({value:!0},p);else if(m!=null&&m.dataType){const g={id:M.UUID.uuid(),version:M.UUID.uuid(),createdAt:(p==null?void 0:p.timestamp)||new Date().toISOString(),author:M.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:r.LiteralValue,standaloneParent:null,name:me.EntityTemplate,autogeneration:null,value:!0,valueAsTypeSingle:null,valueAsTypeList:null,parent:m==null?void 0:m.toReference()},b=Se(g,a.project);return b.hydrateAncestors(),b.setParent(m,p),b.addSelfToProject(p),p==null||p.add(b,ye.Added),b.initChildren(p),p||b.captureVersion(),{newEntities:[b]}}return{newEntities:[]}}else if(n)return{newEntities:[]};const s=a.project.get(G["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id),u=lV(s,"Main database",p);if(u.errors.length>0)return{newEntities:[]};const e=u.properties.find(y=>y.implements.find(m=>m.id===G["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 y={id:M.UUID.uuid(),version:M.UUID.uuid(),createdAt:(p==null?void 0:p.timestamp)||new Date().toISOString(),author:M.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:r.LiteralValue,standaloneParent:null,name:me.EntityTemplate,autogeneration:null,value:!0,valueAsTypeSingle:null,valueAsTypeList:null,parent:e==null?void 0:e.toReference()},m=Se(y,a.project);m.hydrateAncestors(),m.setParent(e,p),m.addSelfToProject(p),p==null||p.add(m,ye.Added),m.initChildren(p),p||m.captureVersion()}return{newEntities:[u]}}}return{newEntities:[]}}function cmt(a,p){const t=[],n=[],s=[],u=[];return BE(a).filter(f=>f.type===r.BuiltInBaseEntity).forEach(f=>{var y,m,T,g,b,R,I,A,O;switch(f.id){case G["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.id:{const P=a.project.entities.filter(H=>H.implements.find(Y=>Y.id===G["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id));let x=P.find(H=>!!H.properties.find(Y=>{var ie;return Y.implements.find(z=>z.id===G["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id)&&((ie=Y.getDefaultValue())==null?void 0:ie.value)===!0}));if(!x&&P.length)x=P[0];else if(!x&&!P.length){x=a.project.getBuiltIn(G["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id).implement("Relational database",p);const Y=x.properties.find(ie=>ie.implements.find(z=>z.id===G["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id));(y=Y==null?void 0:Y.defaultValue)==null||y.metaSync({value:!0},p),n.push(x)}const $=a.properties.find(H=>H.implements.find(Y=>Y.id===G["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.properties.database.id));if($&&!($!=null&&$.defaultValue)){const H={id:M.UUID.uuid(),version:M.UUID.uuid(),createdAt:(p==null?void 0:p.timestamp)||new Date().toISOString(),author:M.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:r.LiteralValue,standaloneParent:null,name:me.EntityTemplate,autogeneration:null,value:null,valueAsTypeSingle:(x==null?void 0:x.toJSON())||null,valueAsTypeList:null,parent:$==null?void 0:$.toReference()},Y=Se(H,a.project);Y.hydrateAncestors(),Y.setParent($,p),Y.addSelfToProject(p),p==null||p.add(Y,ye.Added),Y.initChildren(p),($==null?void 0:$.defaultValue).setValueAsTypeSingle(x||null,p),n.push(Y),p||Y.captureVersion();return}else $!=null&&$.defaultValue&&!($!=null&&$.defaultValue.valueAsTypeSingle)&&($==null||$.defaultValue.setValueAsTypeSingle(x||null,p));const U=a.properties.find(H=>H.implements.find(Y=>Y.id===G["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.properties.primaryKey.id));if(!U)throw new Error(`[handleAfterEntityImplementationSideEffects] Primary key property not found for implemented base entity ${G["built-in-base-entity"]}`);let Z=!1;if(!U.dataType){const H=pa.new(p);H.parent=U.toReference();const Y=Se(H,a.project);Y.hydrateAncestors(),Y.setParent(U,p),Y.addSelfToProject(p),p==null||p.add(Y,ye.Added),Y.initChildren(p),Z=!0}const q=a.project.getBuiltIn(G["primitive-entity"].number.id);(m=U.dataType)==null||m.setEntity(q,p),Z&&(p||(T=U.dataType)==null||T.captureVersion());return}case G["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id:{const P=a.project.entities.filter(z=>z.implements.find(W=>W.id===G["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id)&&z.id!==a.id),x=P.map(z=>{var te;const W=z.properties.find(X=>X.implements.find(re=>re.id===G["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.identifier.id));return(te=W==null?void 0:W.getDefaultValue())==null?void 0:te.value}).filter(z=>!!z),$=a.properties.find(z=>z.implements.find(W=>W.id===G["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.identifier.id));if(!P.find(z=>!!z.properties.find(W=>{var ee;return W.implements.find(te=>te.id===G["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id)&&((ee=W.getDefaultValue())==null?void 0:ee.value)===!0}))){const z=a.properties.find(ee=>ee.implements.find(te=>te.id===G["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id));if(!z)throw new Error("Default boolean property not found for relational database entity with id: "+a.id);let W=!1;if(!(z!=null&&z.defaultValue)){const ee=ya.new(p);ee.parent=z.toReference();const te=Se(ee,a.project);te.hydrateAncestors(),te.setParent(z,p),te.addSelfToProject(p),p==null||p.add(te,ye.Added),te.initChildren(p),W=!0}(g=z==null?void 0:z.defaultValue)==null||g.metaSync({value:!0},p),W&&(p||(b=z==null?void 0:z.defaultValue)==null||b.captureVersion())}if(!$)throw new Error("Identifier property not found for relational database entity with id: "+a.id);let Z=!1;if(!($!=null&&$.defaultValue)){const z=ya.new(p);z.parent=$.toReference();const W=Se(z,a.project);W.hydrateAncestors(),W.setParent($,p),W.addSelfToProject(p),p==null||p.add(W,ye.Added),W.initChildren(p),Z=!0}const q=ebn(x,P.length);(R=$.defaultValue)==null||R.metaSync({value:q},p),Z&&(p||(I=$.defaultValue)==null||I.captureVersion());const H=a.properties.find(z=>z.implements.find(W=>W.id===G["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.password.id));if(!H)throw new Error(`[handleAfterEntityImplementationSideEffects] Password property not found for implemented base entity ${G["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id} with id ${a.id}`);let Y=!1;if(!H.defaultValue){const z=ya.new(p);z.parent=H.toReference();const W=Se(z,a.project);W.hydrateAncestors(),W.setParent(H,p),W.addSelfToProject(p),p==null||p.add(W,ye.Added),W.initChildren(p),n.push(W),Y=!0}const ie=y4(24);(A=H.defaultValue)==null||A.metaSync({value:ie},p),Y&&(p||(O=H.defaultValue)==null||O.captureVersion());return}case G["built-in-base-entity"].BUILT_IN_SQL_ROW_TRANSFORMER_ENTITY.id:{const P=a.properties.find(Z=>Z.implements.find(q=>q.id===G["built-in-base-entity"].BUILT_IN_SQL_ROW_TRANSFORMER_ENTITY.properties.time.id));if(!P)throw new Error(`[handleAfterEntityImplementationSideEffects] Time property not found for implemented base entity ${G["built-in-base-entity"].BUILT_IN_SQL_ROW_TRANSFORMER_ENTITY.id} with id ${a.id}`);let x=P.defaultValue||null;if(!x){const Z=ya.new(p);Z.parent=P.toReference(),Z.name=me.Date,Z.id=M.UUID.uuid(),x=Se(Z,a.project),x.hydrateAncestors(),x.setParent(P,p),x.addSelfToProject(p),x.initChildren(p),p==null||p.add(x,ye.Added)}x.metaSync({value:new Date().toISOString()},p),x.metaSync({editable:!1,deletable:!1},p),P.metaSync({editable:!1,deletable:!1},p);const $=a.properties.find(Z=>Z.implements.find(q=>q.id===G["built-in-base-entity"].BUILT_IN_SQL_ROW_TRANSFORMER_ENTITY.properties.definition.id));if(!$)throw new Error(`[handleAfterEntityImplementationSideEffects] Definition property not found for implemented base entity ${G["built-in-base-entity"].BUILT_IN_SQL_ROW_TRANSFORMER_ENTITY.id} with id ${a.id}`);let U=$.defaultValue||null;if(!U){const Z=ya.new(p);Z.name=me.EntityTemplate,Z.parent=$.toReference(),Z.id=M.UUID.uuid(),U=Se(Z,a.project),U.hydrateAncestors(),U.setParent($,p),U.addSelfToProject(p),U.initChildren(p),p==null||p.add(U,ye.Added)}break}case G["built-in-base-entity"].BUILT_IN_SHARED_DRIVE_MOUNT_ENTITY.id:{const P=a.project.entities.filter(x=>cn(x,xe.SHARED_DRIVE_ENTITY)&&x.id!==a.id);if(P.length===1){const x=P[0],$=a.properties.find(Z=>Z.implements.find(q=>q.id===G["built-in-base-entity"].BUILT_IN_SHARED_DRIVE_MOUNT_ENTITY.properties.sharedDrive.id));if(!$)throw new Error(`[handleAfterEntityImplementationSideEffects] Shared Drive property not found for implemented base entity ${G["built-in-base-entity"].BUILT_IN_SHARED_DRIVE_MOUNT_ENTITY.id} with id ${a.id}`);let U=$.defaultValue||null;if(!U){const Z=ya.new(p);Z.name=me.EntityTemplate,Z.parent=$.toReference(),Z.id=M.UUID.uuid(),U=Se(Z,a.project),U.hydrateAncestors(),U.setParent($,p),U.addSelfToProject(p),U.initChildren(p),p==null||p.add(U,ye.Added)}U.setValueAsTypeSingle(x,p)}break}case G["built-in-base-entity"].BUILT_IN_COMPUTE_ENTITY.id:{const P=a.properties.find(q=>q.implements.find(H=>H.id===G["built-in-base-entity"].BUILT_IN_COMPUTE_ENTITY.properties.computeName.id));if(!P)throw new Error(`[handleAfterEntityImplementationSideEffects] Compute name property not found for implemented base entity ${G["built-in-base-entity"].BUILT_IN_COMPUTE_ENTITY.id} with id ${a.id}`);const x=a.project.entities.filter(q=>cn(q,xe.COMPUTE_ENTITY)&&q.id!==a.id);let $=P.defaultValue||null;if(!$){const q=ya.new(p);q.name=me.EntityTemplate,q.parent=P.toReference(),q.id=M.UUID.uuid(),$=Se(q,a.project),$.hydrateAncestors(),$.setParent(P,p),$.addSelfToProject(p),$.initChildren(p),p==null||p.add($,ye.Added)}const U=x.map(q=>{var H,Y;return((Y=(H=q.properties.find(ie=>ie.implements.some(z=>z.id===G["built-in-base-entity"].BUILT_IN_COMPUTE_ENTITY.properties.computeName.id)))==null?void 0:H.defaultValue)==null?void 0:Y.value)||""}),Z=a4($.value||"compute-instance",U,"-");$.metaSync({value:Z},p);break}}}),{self:a,updated:_(t),added:_(n),removed:_(s),affected:_(u)}}function lV(a,p,t,n){const s=n||M.UUID.uuid(),u=Rp.new(t);u.id=s,u.name=p,u.static=a.static,u.implements=[a.toJSON()],u.parent=a.project.toReference(),u.static=a.static,umt(a,t);const e=Se(u,a.project);return e.hydrateAncestors(),t==null||t.add(e,ye.Added),e.addSelfToProject(t),e.initChildren(t),t||e.captureVersion(),cmt(e,t),e.afterAllChildrenInitialized(t),e}function m4(a,p){return p.entities.find(s=>{const u=s.properties,e=u.map(g=>g.name),f=a.every(g=>e.includes(g)),y=e.filter(g=>!a.includes(g)),m=u.every(g=>!y.includes(g.name)||!g.required);return f&&m})||null}function fmt(a,p,t,n=vt.OrDataTypeGroup){const s=[],u=[],e=[],f=[],y=M.UUID.uuid(),m=pa.new(t);m.id=y,m.parent=p.toReference(),m.like=!0,m.parentRelationType=n;const T=Se(m,a.project);return u.push(T),T.setParent(p,t),T.addSelfToProject(t),t==null||t.add(T,ye.Added),T.setEntity(a,t),T.initChildren(t),t||T.captureVersion(),{updated:_(s),added:_(u),removed:_(e),affected:_(f),self:T}}function T4(a,p,t,n,s){var m,T,g,b,R,I,A,O;const u=[],e=[],f=[],y=[];switch(typeof a){case"string":let P=!1;const x=new Date(a);if(x instanceof Date&&!isNaN(x.valueOf())&&(P=!0),P){const $=p.project.getBuiltIn(G[r.PrimitiveEntity][me.Date].id);p.setEntity($,n);break}else{const $=p.project.getBuiltIn(G[r.PrimitiveEntity][me.String].id);p.setEntity($,n);break}case"number":p.setEntity(p.project.getBuiltIn(G[r.PrimitiveEntity][me.Number].id),n);break;case"boolean":p.setEntity(p.project.getBuiltIn(G[r.PrimitiveEntity][me.Boolean].id),n);break;case"object":if(a===null){p.setEntity(p.project.getBuiltIn(G[r.PrimitiveEntity][me.Null].id),n);break}else if(Array.isArray(a))if(p.metaSync({isList:!0},n),a.length>0){const $=a.slice(0,5).filter(Z=>Z!==void 0);if($.every(Z=>typeof Z==typeof $[0])&&(typeof $[0]!="object"||$[0]===null))switch(typeof $[0]){case"string":p.setEntity(p.project.getBuiltIn(G[r.PrimitiveEntity][me.String].id),n);break;case"number":p.setEntity(p.project.getBuiltIn(G[r.PrimitiveEntity][me.Number].id),n);break;case"boolean":p.setEntity(p.project.getBuiltIn(G[r.PrimitiveEntity][me.Boolean].id),n);break;case"object":p.setEntity(p.project.getBuiltIn(G[r.PrimitiveEntity][me.Null].id),n);break}else{const Z=[];let q=!1;$.forEach(Y=>{var ie,z,W,ee;if(Array.isArray(Y)&&(q=!0),typeof Y=="object"&&!Array.isArray(Y)&&Y!==null){const te=Dw(Y,p.project,{...t,id:M.UUID.uuid()},n,s);te.hasCreated&&Z.push((ie=te.changeSet)==null?void 0:ie.self),u.push(...(z=te.changeSet)==null?void 0:z.updated),e.push(...(W=te.changeSet)==null?void 0:W.added),f.push(...(ee=te.changeSet)==null?void 0:ee.removed)}});const H=_(Z);if(!H.length&&!q){$.forEach(Y=>{const ie=pa.new(n);ie.parentRelationType=vt.OrDataTypeGroup,ie.parent=p.toReference();const z=Se(ie,p.project);switch(z.hydrateAncestors(),z.setParent(p,n),z.addSelfToProject(n),n==null||n.add(z,ye.Added),z.initChildren(n),typeof Y){case"string":z.setEntity(z.project.getBuiltIn(G[r.PrimitiveEntity][me.String].id),n);break;case"number":z.setEntity(z.project.getBuiltIn(G[r.PrimitiveEntity][me.Number].id),n);break;case"boolean":z.setEntity(z.project.getBuiltIn(G[r.PrimitiveEntity][me.Boolean].id),n);break;case"object":z.setEntity(z.project.getBuiltIn(G[r.PrimitiveEntity][me.Null].id),n);break}n||z.captureVersion()});break}else H.length===1&&!q?p.setEntity(H[0],n):$.forEach(Y=>{if(typeof Y=="object"&&!Array.isArray(Y)&&Y!==null){const ie=m4(Object.keys(Y),p.project);if(ie){const z=fmt(ie||H[0],p,n,vt.OrDataTypeGroup);u.push(...z.updated),e.push(...z.added),f.push(...z.removed)}}else{const ie=pa.new(n);ie.parentRelationType=vt.OrDataTypeGroup,ie.parent=p.toReference();const z=Se(ie,p.project);z.hydrateAncestors(),z.setParent(p,n),z.addSelfToProject(n),n==null||n.add(z,ye.Added),z.initChildren(n);const W=T4(Y,z,{...t,id:M.UUID.uuid()},n,s);u.push(...W.updated),e.push(...W.added),f.push(...W.removed),n||z.captureVersion()}})}}else{const $=Dw(a[0],p.project,{...t},n,s);p.setEntity((m=$.changeSet)==null?void 0:m.self,n),u.push(...(T=$.changeSet)==null?void 0:T.updated),e.push(...(g=$.changeSet)==null?void 0:g.added),f.push(...(b=$.changeSet)==null?void 0:b.removed);break}else{const $=Dw(a,p.project,{...t},n,s);p.setEntity((R=$.changeSet)==null?void 0:R.self,n),u.push(...(I=$.changeSet)==null?void 0:I.updated),e.push(...(A=$.changeSet)==null?void 0:A.added),f.push(...(O=$.changeSet)==null?void 0:O.removed);break}}return{updated:_(u),added:_(e),removed:_(f),affected:_(y),self:p}}function Dw(a,p,t,n,s){const u=[],e=[],f=[],y=[],m=Object.keys(a),T=m4(m,p);if(T)return{hasCreated:!1,changeSet:{updated:[],added:[],removed:[],affected:[],self:T}};const g=s?t.name+" of "+s.name:t.name,R={id:t.id||M.UUID.uuid(),version:M.UUID.uuid(),createdAt:(n==null?void 0:n.timestamp)||new Date().toISOString(),author:M.sessionAuthor,previousVersion:null,deleted:!1,name:g,codeName:null,deletable:!0,editable:!0,type:r.DefinitionEntity,additionalProperties:!1,additionalPropertiesDataType:null,allPropertiesImplement:null,description:t.description||null,static:t.static||!1,abstract:t.abstract||!1,properties:[],methods:[],abstractMethods:[],extends:null,implements:[],x:0,y:0,parent:p.toReference()},I=Se(R,p);return I.hydrateAncestors(),I.setParent(p,n),I.addSelfToProject(n),n==null||n.add(I,ye.Added),I.initChildren(n),e.push(I),m.forEach((A,O)=>{const P=M.UUID.uuid(),x=sd.new(n);x.id=P,x.name=A,x.codeName=A,x.parent=I.toReference(),x.index=O,x.required=!0,x.interactive=!0;const $=Se(x,p);$.hydrateAncestors(),$.setParent(I,n),$.addSelfToProject(n),n==null||n.add($,ye.Added),$.initChildren(n),e.push($);const U=a[A],Z=M.UUID.uuid(),q=pa.new(n);q.id=Z,q.parent=$.toReference(),q.like=!0,q.isList=!1;const H=Se(q,p);H.hydrateAncestors(),H.setParent($,n),H.addSelfToProject(n),n==null||n.add(H,ye.Added),H.initChildren(n),e.push(H);const Y=T4(U,H,{...t,name:A,id:M.UUID.uuid()},n,s||I);u.push(...Y.updated),e.push(...Y.added),f.push(...Y.removed),n||($.captureVersion(),H.captureVersion())}),n||I.captureVersion(),{hasCreated:!0,changeSet:{updated:_(u),added:_(e),removed:_(f),affected:_(y),self:I}}}function sy(a,p,t,n,s){const u={ignoreImplementationMatch:!1,...s},e=[];return!a.length||!p.length?{errors:e,overlap:!1}:(a.length>p.length?a.forEach(f=>{const y=p.find(T=>T.name===f.name),m=p.find(T=>{var g,b;return Array.isArray(T.implements)?T.implements.some(R=>!!f.implements.find(I=>I.id===R.id)):((g=T.implements)==null?void 0:g.id)===((b=f.implements)==null?void 0:b.id)});if(y&&!(u.ignoreImplementationMatch&&m&&(m==null?void 0:m.id)===(y==null?void 0:y.id))){const T=new ht({id:f.id+"--"+y.id+"--"+n,message:`Entity of type ${f.type} named "${f.name}" with id "${f.id}" overrides a base ${y.type} ${y.name} with id "${y.id}" that has the same name`,severity:Ie.Error,code:n,entity:f,firstRelationship:y});e.push(T)}if(m&&!u.ignoreImplementationMatch){const T=new ht({id:f.id+"--"+m.id+"--"+t,message:`Entity of type ${f.type} named "${f.name}" with id "${f.id}" overrides a base ${m.type} ${m.name} with id "${m.id}" that implements the same base descriptor`,severity:Ie.Error,code:t,entity:f,firstRelationship:m});e.push(T)}}):p.forEach(f=>{var T;const y=a.find(g=>g.name===f.name),m=a.find(g=>{var b,R;return g.implements&&Array.isArray(g.implements)?g.implements.some(I=>!!f.implements.find(A=>A.id===I.id)):((b=g.implements)==null?void 0:b.id)===((R=f.implements)==null?void 0:R.id)});if(y&&!(u.ignoreImplementationMatch&&m&&(m==null?void 0:m.id)===(y==null?void 0:y.id))){const g=new ht({id:y.id+"--"+f.id+"--"+n,message:`Entity of type ${y.type} named "${y.name}" with id "${y.id}" overrides a base entity ${f.name} with id "${f.id}" that has the same name`,severity:Ie.Error,code:n,entity:y,firstRelationship:f});e.push(g)}if(m&&!u.ignoreImplementationMatch){const g=new ht({id:m.id+"--"+f.id+"--"+t,message:`Entity of type ${m.type} named "${m.name}" with id "${m.id}" overrides a base entity ${f.name} with id "${f.id}" that implements the same base ${Array.isArray(m==null?void 0:m.implements)?Di(m==null?void 0:m.implements.map(b=>b.type),"', '","' and '"):(T=m.implements)==null?void 0:T.id}`,severity:Ie.Error,code:t,entity:m,firstRelationship:f});e.push(g)}}),{errors:e,overlap:!!e.length})}function tbn(a,p){return a.abstract||(a.properties.forEach(n=>{n.abstract||n.metaSync({abstract:!0},p)}),Object.values(a.detachedDependents).forEach(n=>{n.field===qU.EntityField&&n.entity.remove({ignoreUpstream:!1},p)}),a.metaSync({abstract:!0},p)),a}function ibn(a,p){return a.abstract&&(a.properties.forEach(n=>{n.abstract&&n.metaSync({abstract:!1},p)}),Object.values(a.detachedDependents).forEach(n=>{(n.field===yO.Implements||n.field===yO.Extends)&&n.entity.onDetachedDependencyRemoved(a,n.field,p)}),a.metaSync({abstract:!1},p)),a}function nbn(a,p){return a.static||(a.properties.forEach(n=>{n.static||n.metaSync({static:!0},p)}),a.metaSync({static:!0},p)),a}function rbn(a,p){return a.static&&a.metaSync({static:!1},p),a}const rA=class rA extends l4{constructor(t,n){super(t);C(this,"initialData");C(this,"id");C(this,"version");C(this,"name");C(this,"description",null);C(this,"type",r.BuiltInBaseEntity);C(this,"abstract",!1);C(this,"static");C(this,"additionalProperties",!1);C(this,"properties",[]);C(this,"allPropertiesImplement",null);C(this,"additionalPropertiesDataType",null);C(this,"methods",[]);C(this,"abstractMethods",[]);C(this,"extends",null);C(this,"interactive",!1);C(this,"errors",[]);C(this,"project");if(this.initialData=this.initialData||t,this.project=this.project||n,this.id=this.id||t.id,this.version=this.version||t.version,this.name=this.name||t.name,this.static=this.static||t.static,this.interactive=this.interactive||t.interactive,this.abstract=t.abstract,this.additionalProperties=t.additionalProperties,this.properties=this.initialData.properties.map(s=>{const u=Se(s,this.project);return u.setParent(this,null),u.initChildren(null),u}),this.methods=this.initialData.methods.map(s=>{const u=Se(s,this.project);return u.setParent(this,null),u.initChildren(null),u}),this.abstractMethods=this.initialData.abstractMethods.map(s=>{const u=Se(s,this.project);return u.setParent(this,null),u.initChildren(null),u}),this.initialData.allPropertiesImplement){const s=Se(this.initialData.allPropertiesImplement,this.project);s.setParent(this,null),s.initChildren(null),this.allPropertiesImplement=s}if(this.initialData.additionalPropertiesDataType){const s=Se(this.initialData.additionalPropertiesDataType,this.project);s.setParent(this,null),s.initChildren(null),this.additionalPropertiesDataType=s}this.initialData.extends&&(this.extends=Se(this.initialData.extends,this.project))}get allMethods(){return _([...this.ownDeclaredMethods,...this.allBaseMethodsFromOriginalParents])}get allProperties(){return _([...this.ownDeclaredProperties,...this.allBasePropertiesFromOriginalParents])}get allBaseMethodsFromOriginalParents(){var s;const t=((s=this.extends)==null?void 0:s.allMethods)||[],n=[...t].filter(u=>!t.some(e=>e.id!==u.id));return _(n)}get allBasePropertiesFromOriginalParents(){var s;const t=((s=this.extends)==null?void 0:s.allProperties)||[],n=[...t].filter(u=>!t.some(e=>{var f;return e.id!==u.id&&(!!e.implements.find(y=>y.id===u.id)||((f=e.extends)==null?void 0:f.id)===u.id)}));return _(n)}get allBasePropertiesFromExtendedAndImplementedEntities(){var s,u;const t=[...((s=this.extends)==null?void 0:s.ownDeclaredProperties)||[],...((u=this.extends)==null?void 0:u.allBasePropertiesFromExtendedAndImplementedEntities)||[]].filter(e=>!e.abstract),n=[...t].filter(e=>!t.some(f=>{var y;return f.id!==e.id&&(!!f.implements.find(m=>m.id===e.id)||((y=f.extends)==null?void 0:y.id)===e.id)}));return _([...n])}get allBaseMethodsFromExtendedAndImplementedEntities(){return _([...(this.extends?[this.extends]:[]).reduce((t,n)=>n.type===r.PrimitiveEntity?t:[...[...n.ownDeclaredMethods,...n.allBaseMethodsFromExtendedAndImplementedEntities].filter(u=>u.type!==r.ActionDescriptor),...t],[])])}get extendedPropertiesFromOriginalParents(){var s,u;const t=[...((s=this.extends)==null?void 0:s.ownDeclaredProperties)||[],...((u=this.extends)==null?void 0:u.extendedPropertiesFromOriginalParents)||[]].filter(e=>!e.abstract),n=[...t].filter(e=>!t.some(f=>{var y;return f.id!==e.id&&(!!f.implements.find(m=>m.id===e.id)||((y=f.extends)==null?void 0:y.id)===e.id)}));return _(n)}get implementedPropertiesFromOriginalParents(){return _([...(this.extends?[this.extends]:[]).reduce((t,n)=>{const s=n.implementedPropertiesFromOriginalParents,u=[...n.ownDeclaredProperties].filter(y=>!!y.abstract),e=[...s,...u,...t];return[...e].filter(y=>!!!e.find(T=>{var g;return((g=T.extends)==null?void 0:g.id)===y.id||!!T.implements.find(b=>b.id===y.id)}))},[])].filter(t=>!!t.abstract))}get extendedProperties(){return this.properties.filter(t=>t.isExtendedProperty)}get ownDeclaredMethods(){return[...this.methods,...this.abstractMethods]}get ownDeclaredProperties(){return this.properties.filter(t=>!t.isExtendedProperty)}subscribe(){return this.project.subscribeBuiltInInstance(this),this}unsubscribe(){return this.project.unsubscribeBuiltInInstance(this),this}async APILoad(t=gt,...n){return await rA.repository.APILoad(this.id,...n),this}toFlat(t=new Set){var s;return t.has(this.id)?[]:(t.add(this.id),[this,...this.properties.flatMap(u=>u.toFlat(t)),...this.methods.flatMap(u=>u.toFlat(t)),...this.abstractMethods.flatMap(u=>u.toFlat(t)),...((s=this.extends)==null?void 0:s.toFlat(t))||[]])}toFlatIds(t=new Set){var s;return t.has(this.id)?[]:(t.add(this.id),[this.id,...this.properties.flatMap(u=>u.toFlatIds(t)),...this.methods.flatMap(u=>u.toFlatIds(t)),...this.abstractMethods.flatMap(u=>u.toFlatIds(t)),...((s=this.extends)==null?void 0:s.toFlatIds(t))||[]])}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(t=new Set){var n,s,u;return t.has(this.id)?this.toReference():(t.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:((n=this.additionalPropertiesDataType)==null?void 0:n.toJSON(t))||null,allPropertiesImplement:((s=this.allPropertiesImplement)==null?void 0:s.toJSON(t))||null,properties:this.properties.map(e=>e.toJSON(t)),methods:this.methods.map(e=>e.toJSON(t)),abstractMethods:this.abstractMethods.map(e=>e.toJSON(t)),extends:((u=this.extends)==null?void 0:u.toJSON(t))||null})}toReference(t=Kt){return{id:this.id+"--"+M.UUID.uuid()+"--ref",type:r.GenericReference,entityId:this.id,version:this.version,entityType:this.type}}toShallowJSON(t=Kt){var n,s,u;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:((n=this.additionalPropertiesDataType)==null?void 0:n.toReference())||null,allPropertiesImplement:((s=this.allPropertiesImplement)==null?void 0:s.toReference())||null,properties:this.properties.map(e=>e.toReference()),methods:this.methods.map(e=>e.toReference()),abstractMethods:this.abstractMethods.map(e=>e.toReference()),extends:((u=this.extends)==null?void 0:u.toReference())||null}}toFlatJSON(t=new Set){var s,u;return t.has(this.id)?[]:(t.add(this.id),[this.toShallowJSON(),...this.properties.flatMap(e=>e.toFlatJSON(t)),...this.methods.flatMap(e=>e.toFlatJSON(t)),...this.abstractMethods.flatMap(e=>e.toFlatJSON(t)),...((s=this.additionalPropertiesDataType)==null?void 0:s.toFlatJSON(t))||[],...((u=this.allPropertiesImplement)==null?void 0:u.toFlatJSON(t))||[]])}toGenerationTarget(t=Kt){var n;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:(n=this.extends)==null?void 0:n.id}}toFlatGenerationTarget(t=new Set){var s,u;return t.has(this.id)?[]:(t.add(this.id),[this.toGenerationTarget(),...this.properties.flatMap(e=>e.toFlatGenerationTarget(t)),...this.methods.flatMap(e=>e.toFlatGenerationTarget(t)),...this.abstractMethods.flatMap(e=>e.toFlatGenerationTarget(t)),...((s=this.additionalPropertiesDataType)==null?void 0:s.toFlatGenerationTarget(t))||[],...((u=this.allPropertiesImplement)==null?void 0:u.toFlatGenerationTarget(t))||[]])}clearErrors(){var t,n;return this.errors=[],this.properties.forEach(s=>s.clearErrors()),this.methods.forEach(s=>s.clearErrors()),this.abstractMethods.forEach(s=>s.clearErrors()),(t=this.additionalPropertiesDataType)==null||t.clearErrors(),(n=this.allPropertiesImplement)==null||n.clearErrors(),this}validate(){return this.errors=Hgn(this),{success:!0}}async validateAsync(t={}){const n=pe.YieldTracker.from(t);return this.errors=await Zgn(this,{tracker:n}),{success:!0}}getErrors(){var n,s;return[...this.errors,...this.properties.flatMap(u=>u.getErrors()),...this.methods.flatMap(u=>u.getErrors()),...this.abstractMethods.flatMap(u=>u.getErrors()),...((n=this.additionalPropertiesDataType)==null?void 0:n.getErrors())||[],...((s=this.allPropertiesImplement)==null?void 0:s.getErrors())||[]]}async getErrorsAsync(t={}){const n=pe.YieldTracker.from(t),s=[...this.errors];await n.tick();for(const u of this.properties){const e=await u.getErrorsAsync({tracker:n});s.push(...e)}for(const u of this.methods){const e=await u.getErrorsAsync({tracker:n});s.push(...e)}for(const u of this.abstractMethods){const e=await u.getErrorsAsync({tracker:n});s.push(...e)}if(this.additionalPropertiesDataType){const u=await this.additionalPropertiesDataType.getErrorsAsync({tracker:n});s.push(...u)}if(this.allPropertiesImplement){const u=await this.allPropertiesImplement.getErrorsAsync({tracker:n});s.push(...u)}return s}getShallowErrors(){return this.errors}implement(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),null,!0,"implement-built-in-base-entity")),s){const u=lV(this,t,n,s);return n==null||n.attemptAutoclose("implement-built-in-base-entity",this.id),u}getAllPropertiesImplements(){var n;const t=[];return this.allPropertiesImplement&&t.push(this.allPropertiesImplement),((n=this.extends)==null?void 0:n.type)===r.BuiltInBaseEntity&&t.push(...this.extends.getAllPropertiesImplements()||[]),t}getAllInteractiveMethods(){const t=[];if(this.interactive){if(t.push(...this.methods,...this.abstractMethods),!this.extends||this.extends.type===r.BuiltInBaseEntity&&this.extends.interactive||this.extends.type===r.PrimitiveEntity)return t;this.extends instanceof rA&&t.push(...this.extends.getAllInteractiveMethods())}return _(t)}getRawDefaultValue(){const t={};return this.properties.forEach(n=>{var e;if(!vp(n)||!n.defaultValue)return;const s=De(n,this.project),u=n.codeName||ho(n,this.project)||Zs(jn(s));t[u]=((e=n.getDefaultValue())==null?void 0:e.value)||null}),t}};C(rA,"repository",{APILoad:async(t,...n)=>null});let Hd=rA;class ymt extends Hd{constructor(t){super(nl,t);C(this,"initialData");C(this,"id",xe.PERSISTED_ENTITY);C(this,"version","1");C(this,"name",xe.PERSISTED_ENTITY);C(this,"description",nl.description);C(this,"type",r.BuiltInBaseEntity);C(this,"abstract",nl.abstract);C(this,"static",nl.static);C(this,"properties",[]);C(this,"methods",[]);C(this,"abstractMethods",[]);C(this,"extends",null);C(this,"errors",[]);C(this,"project");this.initialData=nl,this.project=t,this.id=nl.id,this.version=nl.version,this.name=nl.name,this.static=nl.static,this.abstract=nl.abstract,this.properties=this.initialData.properties.map(n=>{const s=Se(n,this.project);return s.setParent(this,null),s.initChildren(null),s}),this.methods=this.initialData.methods.map(n=>{const s=Se(n,this.project);return s.parent=this,s}),this.abstractMethods=this.initialData.abstractMethods.map(n=>{const s=Se(n,this.project);return s.parent=this,s}),this.initialData.extends&&(this.extends=Se(this.initialData.extends,this.project))}}var xl=(a=>(a.ValueMustBeString="value-must-be-string",a.StringValueMustNotHaveSpaces="string-value-must-not-have-spaces",a.StringValueMustNotHaveDashes="string-value-must-not-have-dashes",a.MustBeUniqueAmongSameEntities="must-be-unique-among-same-entities",a))(xl||{});function zg(a,p){const t=[],n=p;if(!n)return{errors:t,override:p};if(typeof n!="string")return{errors:[],override:p};if(n.includes(" ")){const s=new ht({id:a.id+"--string-value-must-not-have-spaces",message:`Entity of type ${a.type} with id "${a.id}" has an invalid value "${p}". The value cannot contain spaces.`,severity:Ie.Error,code:"string-value-must-not-have-spaces",entity:a});t.push(s)}return{errors:t,override:n.replace(/\s/g,"-")}}function hmt(a,p){const t=[],n=p;if(!n)return{errors:t,override:p};if(typeof n!="string")return{errors:[],override:p};if(n.includes(" ")){const s=new ht({id:a.id+"--string-value-must-not-have-spaces",message:`Entity of type ${a.type} with id "${a.id}" has an invalid value "${p}". The value cannot contain spaces or dashes.`,severity:Ie.Error,code:"string-value-must-not-have-spaces",entity:a});t.push(s)}if(n.includes("-")){const s=new ht({id:a.id+"--string-value-must-not-have-dashes",message:`Entity of type ${a.type} with id "${a.id}" has an invalid value "${p}". The value cannot contain spaces or dashes.`,severity:Ie.Error,code:"string-value-must-not-have-dashes",entity:a});t.push(s)}return{errors:t,override:n.replace(/\s|-/g,"_")}}var Ef=(a=>(a.StatusCodeMustBeNumber="status-code-must-be-number",a.StatusCodeMustBeBetween100And599="status-code-must-be-between-100-and-599",a))(Ef||{}),mmt=(a=>(a.PathMustStartWithSlash="path-must-start-with-slash",a.PathContainsInvalidCharacters="path-contains-invalid-characters",a.PathUnclosedCurlyBracket="path-unclosed-curly-bracket",a.PathUnopenedCurlyBracket="path-unopened-curly-bracket",a.PathEmptyCurlyBrackets="path-empty-curly-brackets",a.PathConflictsWithExistingEndpoint="path-conflicts-with-existing-endpoint",a))(mmt||{});function ML(a,p){if(!a||!p)return!1;if(a===p)return!0;const t=a.split("/").filter(Boolean),n=p.split("/").filter(Boolean);if(t.length!==n.length)return!1;for(let s=0;s<t.length;s++){const u=t[s],e=n[s],f=u.startsWith("{")&&u.endsWith("}"),y=e.startsWith("{")&&e.endsWith("}");if(!(f&&y)&&u!==e)return!1}return!0}function Tmt(a,p){const t=[];if(typeof p!="number"){const n=new ht({id:a.id+"--status-code-must-be-number",message:`Entity of type ${a.type} with id "${a.id}" has an invalid value "${p}". The value must be a number.`,severity:Ie.Error,code:"status-code-must-be-number",entity:a});return t.push(n),{errors:t,override:p}}if(p<100||p>599){const n=new ht({id:a.id+"--status-code-must-be-between-100-and-599",message:`Entity of type ${a.type} with id "${a.id}" has an invalid value "${p}". The value must be a number between 100 and 599.`,severity:Ie.Error,code:"status-code-must-be-between-100-and-599",entity:a});t.push(n)}return{errors:t,override:p}}class vmt extends Hd{constructor(t){var f,y;super(_d,t);C(this,"initialData");C(this,"id",xe.HTTP_ENDPOINT);C(this,"version","1");C(this,"name",xe.HTTP_ENDPOINT);C(this,"description",_d.description);C(this,"type",r.BuiltInBaseEntity);C(this,"abstract",_d.abstract);C(this,"static",_d.static);C(this,"properties",[]);C(this,"methods",[]);C(this,"abstractMethods",[]);C(this,"extends",null);C(this,"errors",[]);C(this,"project");this.initialData=_d,this.project=t,this.id=_d.id,this.version=_d.version,this.name=_d.name,this.static=_d.static,this.abstract=_d.abstract,this.properties=this.initialData.properties.map(m=>{const T=Se(m,this.project);return T.setParent(this,null),T.initChildren(null),T}),this.methods=this.initialData.methods.map(m=>{const T=Se(m,this.project);return T.parent=this,T}),this.abstractMethods=this.initialData.abstractMethods.map(m=>{const T=Se(m,this.project);return T.parent=this,T}),this.initialData.extends&&(this.extends=Se(this.initialData.extends,this.project));const n=this.properties.find(m=>m.id===G["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.properties.path.id);if(!n)throw new Error("Path property not found in endpoint entity");n._codeNativeValueValidation=(m,T)=>{var P;const g=zg(m,T);let b=typeof g.override=="string"?g.override:"";if(b&&!b.startsWith("/")&&(b="/"+b),typeof b=="string"){if(/[^a-zA-Z0-9\-_/{}]/g.test(b)){const Z=new ht({id:m.id+"--path-contains-invalid-characters",message:`Path "${b}" contains invalid characters. Only alphanumeric, -, _, /, and {} are allowed.`,severity:Ie.Error,code:"path-contains-invalid-characters",entity:m});g.errors.push(Z)}let $=!1,U="";for(let Z=0;Z<b.length;Z++){const q=b[Z];if(q==="{")$=!0,U+=q;else if(q==="}"){if(!$){const H=new ht({id:m.id+"--path-unopened-curly-bracket",message:`Path "${b}" has a closed curly bracket '}' without an opening bracket '{'.`,severity:Ie.Error,code:"path-unopened-curly-bracket",entity:m});g.errors.push(H)}$=!1,U+=q}else U+=$?q:q.toLowerCase()}if(b=U,$){const Z=new ht({id:m.id+"--path-unclosed-curly-bracket",message:`Path "${b}" has an unclosed curly bracket '{'.`,severity:Ie.Error,code:"path-unclosed-curly-bracket",entity:m});g.errors.push(Z)}if(b.includes("{}")){const Z=new ht({id:m.id+"--path-empty-curly-brackets",message:`Path "${b}" has empty curly brackets '{}'. Path parameters must have a name.`,severity:Ie.Error,code:"path-empty-curly-brackets",entity:m});g.errors.push(Z)}}g.override=b;const R=m.parent,I=R.properties.find(x=>x.implements.find($=>$.id===G["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.properties.method.id)),A=(P=I==null?void 0:I.getDefaultValue())==null?void 0:P.value;if(m.project.entities.filter(x=>cn(x,xe.HTTP_ENDPOINT)&&x.id!==R.id).some(x=>{var Z,q;const $=x.properties.find(H=>H.implements.find(Y=>Y.id===G["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.properties.method.id));if(((Z=$==null?void 0:$.getDefaultValue())==null?void 0:Z.value)!==A)return!1;const U=x.properties.find(H=>H.implements.find(Y=>Y.id===G["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.properties.path.id));if(!U)throw new Error(`"Path" property not found in endpoint entity "${x.name}" (${x.id})`);return ML((q=U.getDefaultValue())==null?void 0:q.value,b)})){const x=new ht({id:m.id+"--path-conflicts-with-existing-endpoint",message:`Path "${b}" conflicts with another endpoint using the ${A} method.`,severity:Ie.Error,code:"path-conflicts-with-existing-endpoint",entity:m});g.errors.push(x)}return g};const s=this.properties.find(m=>m.id===G["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.properties.method.id);s&&(s._codeNativeValueValidation=(m,T)=>{var O;const g={errors:[],override:T},b=m.parent,R=b.properties.find(P=>P.implements.find(x=>x.id===G["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.properties.path.id)),I=(O=R==null?void 0:R.getDefaultValue())==null?void 0:O.value;if(m.project.entities.filter(P=>cn(P,xe.HTTP_ENDPOINT)&&P.id!==b.id).some(P=>{var U,Z;const x=P.properties.find(q=>q.implements.find(H=>H.id===G["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.properties.path.id));if(!ML((U=x==null?void 0:x.getDefaultValue())==null?void 0:U.value,I))return!1;const $=P.properties.find(q=>q.implements.find(H=>H.id===G["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.properties.method.id));return((Z=$==null?void 0:$.getDefaultValue())==null?void 0:Z.value)===T})){const P=new ht({id:m.id+"--"+xl.MustBeUniqueAmongSameEntities,message:`Method "${T}" cannot be used because another endpoint is already using the ${T} method on path "${I}".`,severity:Ie.Error,code:xl.MustBeUniqueAmongSameEntities,entity:m});g.errors.push(P)}return g});const u=this.abstractMethods.find(m=>m.id===G["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.methods.handler.id);if(!u)throw new Error("Handler method not found in endpoint entity");const e=(((y=(f=u.dataType)==null?void 0:f.entity)==null?void 0:y.properties)||[]).find(m=>m.id===G["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,T)=>Tmt(m,T)}}var WR=(a=>(a.InvalidCharacters="cron-invalid-characters",a.MustHaveSixFields="cron-must-have-six-fields",a.DayOfMonthAndWeekConflict="cron-day-of-month-and-week-conflict",a))(WR||{});function gmt(a,p){const t=[];let n=p;if(typeof p!="string"){const e=new ht({id:a.id+"--"+xl.ValueMustBeString,message:`Entity of type ${a.type} with id "${a.id}" has an invalid value. The cron expression must be a string.`,severity:Ie.Error,code:xl.ValueMustBeString,entity:a});return t.push(e),{errors:t,override:""}}n=p.trimStart().replace(/\s{2,}/g," ");const s=/[^0-9A-Z *?\-/,LW#]/g;if(s.test(n)){const e=Array.from(new Set(n.match(s)));t.push(new ht({id:a.id+"--cron-invalid-characters",message:`Cron expression contains invalid characters: "${e.join(", ")}". Only alphanumeric characters and (* ? - / , L W #) are allowed.`,severity:Ie.Error,code:"cron-invalid-characters",entity:a})),n=n.replace(s,"")}const u=n.split(" ").filter(Boolean);if(u.length!==6)t.push(new ht({id:a.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 ${u.length}.`,severity:Ie.Error,code:"cron-must-have-six-fields",entity:a}));else{const e=u[2],f=u[4];e!=="?"&&f!=="?"&&(t.push(new ht({id:a.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:Ie.Error,code:"cron-day-of-month-and-week-conflict",entity:a})),e==="*"&&f==="*"&&(u[4]="?",n=u.join(" ")))}return{errors:t,override:n}}class bmt extends Hd{constructor(t){super(fp,t);C(this,"initialData");C(this,"id",xe.CRON_JOB);C(this,"version","1");C(this,"name",xe.CRON_JOB);C(this,"description",fp.description);C(this,"type",r.BuiltInBaseEntity);C(this,"abstract",fp.abstract);C(this,"static",fp.static);C(this,"properties",[]);C(this,"methods",[]);C(this,"abstractMethods",[]);C(this,"extends",null);C(this,"errors",[]);C(this,"project");this.initialData=fp,this.project=t,this.id=fp.id,this.version=fp.version,this.name=fp.name,this.static=fp.static,this.abstract=fp.abstract,this.properties=this.initialData.properties.map(s=>{const u=Se(s,this.project);return u.setParent(this,null),u.initChildren(null),u}),this.methods=this.initialData.methods.map(s=>{const u=Se(s,this.project);return u.parent=this,u}),this.abstractMethods=this.initialData.abstractMethods.map(s=>{const u=Se(s,this.project);return u.parent=this,u}),this.initialData.extends&&(this.extends=Se(this.initialData.extends,this.project));const n=this.properties.find(s=>s.id===G["built-in-base-entity"].BUILT_IN_CRON_JOB_ENTITY.properties.expression.id);if(!n)throw new Error("Expression property not found in cron job entity");n._codeNativeValueValidation=(s,u)=>gmt(s,u)}}class Emt extends Hd{constructor(t){super(Cl,t);C(this,"initialData");C(this,"id",xe.RELATIONAL_DATABASE);C(this,"version","1");C(this,"name",xe.RELATIONAL_DATABASE);C(this,"description",Cl.description);C(this,"type",r.BuiltInBaseEntity);C(this,"abstract",Cl.abstract);C(this,"static",Cl.static);C(this,"properties",[]);C(this,"methods",[]);C(this,"abstractMethods",[]);C(this,"extends",null);C(this,"errors",[]);C(this,"project");this.initialData=Cl,this.project=t,this.id=Cl.id,this.version=Cl.version,this.name=Cl.name,this.static=Cl.static,this.abstract=Cl.abstract,this.properties=this.initialData.properties.map(u=>{const e=Se(u,this.project);return e.setParent(this,null),e.initChildren(null),e}),this.methods=this.initialData.methods.map(u=>{const e=Se(u,this.project);return e.parent=this,e}),this.abstractMethods=this.initialData.abstractMethods.map(u=>{const e=Se(u,this.project);return e.parent=this,e}),this.initialData.extends&&(this.extends=Se(this.initialData.extends,this.project));const n=this.properties.find(u=>u.id===G["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.identifier.id);if(!n)throw new Error("Path property not found in endpoint entity");n._codeNativeValueValidation=(u,e)=>hmt(u,e);const s=this.properties.find(u=>u.id===G["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.minSize.id);s&&(s._codeNativeValueValidation=(u,e)=>{const f={errors:[],override:e};if(typeof e=="number"){if(e<6){const y=new ht({id:u.id+"--"+Ne.RelationalDatabaseMinSizeTooSmall,message:"Minimum GB size cannot be less than 6.",severity:Ie.Error,code:Ne.RelationalDatabaseMinSizeTooSmall,entity:u});f.errors.push(y)}else if(e>65536){const y=new ht({id:u.id+"--"+Ne.RelationalDatabaseMinSizeTooLarge,message:"Minimum GB size cannot be greater than 65536.",severity:Ie.Error,code:Ne.RelationalDatabaseMinSizeTooLarge,entity:u});f.errors.push(y)}}else if(e!==void 0){const y=new ht({id:u.id+"--"+Ne.RelationalDatabaseMinSizeMustBeNumber,message:"Minimum GB size must be a number.",severity:Ie.Error,code:Ne.RelationalDatabaseMinSizeMustBeNumber,entity:u});f.errors.push(y)}return f})}}var Imt=(a=>(a.InvalidCharacters="compute-name-invalid-characters",a.TooLong="compute-name-too-long",a.Empty="compute-name-empty",a))(Imt||{});class Rmt extends Hd{constructor(t){super(yp,t);C(this,"initialData");C(this,"id",xe.COMPUTE_ENTITY);C(this,"version","1");C(this,"name",xe.COMPUTE_ENTITY);C(this,"description",yp.description);C(this,"type",r.BuiltInBaseEntity);C(this,"abstract",yp.abstract);C(this,"static",yp.static);C(this,"properties",[]);C(this,"methods",[]);C(this,"abstractMethods",[]);C(this,"extends",null);C(this,"errors",[]);C(this,"project");this.initialData=yp,this.project=t,this.id=yp.id,this.version=yp.version,this.name=yp.name,this.static=yp.static,this.abstract=yp.abstract,this.properties=this.initialData.properties.map(s=>{const u=Se(s,this.project);return u.setParent(this,null),u.initChildren(null),u}),this.methods=this.initialData.methods.map(s=>{const u=Se(s,this.project);return u.parent=this,u}),this.abstractMethods=this.initialData.abstractMethods.map(s=>{const u=Se(s,this.project);return u.parent=this,u}),this.initialData.extends&&(this.extends=Se(this.initialData.extends,this.project));const n=this.properties.find(s=>s.id===G["built-in-base-entity"][xe.COMPUTE_ENTITY].properties.computeName.id);n&&(n._codeNativeValueValidation=(s,u)=>{const e={errors:[],override:u};if(typeof u!="string"||!u){const y=new ht({id:s.id+"--compute-name-empty",message:"Compute name cannot be empty.",severity:Ie.Error,code:"compute-name-empty",entity:s});return e.errors.push(y),e}if(u.length>255){const y=new ht({id:s.id+"--compute-name-too-long",message:"Compute name must be 255 characters or fewer.",severity:Ie.Error,code:"compute-name-too-long",entity:s});e.errors.push(y)}if(/[^a-zA-Z0-9\-_]/g.test(u)){const y=new ht({id:s.id+"--compute-name-invalid-characters",message:`Compute name "${u}" contains invalid characters. Only alphanumeric characters, hyphens (-), and underscores (_) are allowed.`,severity:Ie.Error,code:"compute-name-invalid-characters",entity:s});e.errors.push(y)}return e.errors.length||this.project.entities.filter(m=>cn(m,xe.COMPUTE_ENTITY)&&m.id!==this.id).forEach(m=>{var g;const T=m.properties.find(b=>b.implements.some(R=>R.id===G[r.BuiltInBaseEntity][xe.COMPUTE_ENTITY].properties.computeName.id));if(T&&(T==null?void 0:T.id)!==s.id&&((g=T.defaultValue)==null?void 0:g.value)===u){const b=new ht({id:s.id+"--"+Ne.ComputeNameNotUnique,message:`Compute name "${u}" is duplicated.`,severity:Ie.Error,code:Ne.ComputeNameNotUnique,entity:s});e.errors.push(b)}}),e})}}var Amt=(a=>(a.InvalidImageUri="container-compute-invalid-image-uri",a.InvalidMinTasks="container-compute-invalid-min-tasks",a.InvalidMaxTasks="container-compute-invalid-max-tasks",a.MaxTasksLessThanMinTasks="container-compute-max-less-than-min",a.InvalidEphemeralStorage="container-compute-invalid-ephemeral-storage",a))(Amt||{});class Dmt extends Hd{constructor(t){super(hp,t);C(this,"initialData");C(this,"id",xe.CONTAINER_COMPUTE_ENTITY);C(this,"version","1");C(this,"name",xe.CONTAINER_COMPUTE_ENTITY);C(this,"description",hp.description);C(this,"type",r.BuiltInBaseEntity);C(this,"abstract",hp.abstract);C(this,"static",hp.static);C(this,"properties",[]);C(this,"methods",[]);C(this,"abstractMethods",[]);C(this,"extends",null);C(this,"errors",[]);C(this,"project");this.initialData=hp,this.project=t,this.id=hp.id,this.version=hp.version,this.name=hp.name,this.static=hp.static,this.abstract=hp.abstract,this.properties=this.initialData.properties.map(f=>{const y=Se(f,this.project);return y.setParent(this,null),y.initChildren(null),y}),this.methods=this.initialData.methods.map(f=>{const y=Se(f,this.project);return y.parent=this,y}),this.abstractMethods=this.initialData.abstractMethods.map(f=>{const y=Se(f,this.project);return y.parent=this,y}),this.initialData.extends&&(this.extends=Se(this.initialData.extends,this.project));const n=this.properties.find(f=>f.id===G["built-in-base-entity"][xe.CONTAINER_COMPUTE_ENTITY].properties.imageUri.id);n&&(n._codeNativeValueValidation=(f,y)=>{const m={errors:[],override:y};if(typeof y!="string"||!y)return m;if(/\s/.test(y)){const T=new ht({id:f.id+"--container-compute-invalid-image-uri",message:`Image URI "${y}" contains spaces, which is invalid.`,severity:Ie.Error,code:"container-compute-invalid-image-uri",entity:f});m.errors.push(T)}return m});const s=this.properties.find(f=>f.id===G["built-in-base-entity"][xe.CONTAINER_COMPUTE_ENTITY].properties.minTasks.id);s&&(s._codeNativeValueValidation=(f,y)=>{var R;const m={errors:[],override:y};if(typeof y!="number")return m;if(y<0){const I=new ht({id:f.id+"--container-compute-invalid-min-tasks",message:"Minimum Tasks must be 0 or greater.",severity:Ie.Error,code:"container-compute-invalid-min-tasks",entity:f});m.errors.push(I)}const g=f.parent.properties.find(I=>I.implements.find(A=>A.id===G["built-in-base-entity"][xe.CONTAINER_COMPUTE_ENTITY].properties.maxTasks.id)),b=(R=g==null?void 0:g.getDefaultValue())==null?void 0:R.value;if(typeof b=="number"&&y>b){const I=new ht({id:f.id+"--container-compute-max-less-than-min",message:`Minimum Tasks (${y}) cannot be greater than Maximum Tasks (${b}).`,severity:Ie.Error,code:"container-compute-max-less-than-min",entity:f});m.errors.push(I)}return m});const u=this.properties.find(f=>f.id===G["built-in-base-entity"][xe.CONTAINER_COMPUTE_ENTITY].properties.maxTasks.id);u&&(u._codeNativeValueValidation=(f,y)=>{var R;const m={errors:[],override:y};if(typeof y!="number")return m;if(y<1){const I=new ht({id:f.id+"--container-compute-invalid-max-tasks",message:"Maximum Tasks must be 1 or greater.",severity:Ie.Error,code:"container-compute-invalid-max-tasks",entity:f});m.errors.push(I)}const g=f.parent.properties.find(I=>I.implements.find(A=>A.id===G["built-in-base-entity"][xe.CONTAINER_COMPUTE_ENTITY].properties.minTasks.id)),b=(R=g==null?void 0:g.getDefaultValue())==null?void 0:R.value;if(typeof b=="number"&&y<b){const I=new ht({id:f.id+"--container-compute-max-less-than-min",message:`Maximum Tasks (${y}) cannot be less than Minimum Tasks (${b}).`,severity:Ie.Error,code:"container-compute-max-less-than-min",entity:f});m.errors.push(I)}return m});const e=this.properties.find(f=>{var y;return f.id===((y=G["built-in-base-entity"][xe.CONTAINER_COMPUTE_ENTITY].properties.ephemeralStorage)==null?void 0:y.id)});e&&(e._codeNativeValueValidation=(f,y)=>{const m={errors:[],override:y};if(typeof y!="number")return m;if(y<20||y>200){const T=new ht({id:f.id+"--container-compute-invalid-ephemeral-storage",message:"Ephemeral Storage must be between 20 and 200 GB.",severity:Ie.Error,code:"container-compute-invalid-ephemeral-storage",entity:f});m.errors.push(T)}return m})}}var Cmt=(a=>(a.PathContainsInvalidCharacters="shared-drive-mount-path-invalid-characters",a.PathIsSystemFolder="shared-drive-mount-path-is-system-folder",a.PathInvalidFormat="shared-drive-mount-path-invalid-format",a))(Cmt||{});class wmt extends Hd{constructor(t){super($d,t);C(this,"initialData");C(this,"id",xe.SHARED_DRIVE_MOUNT_ENTITY);C(this,"version","1");C(this,"name",xe.SHARED_DRIVE_MOUNT_ENTITY);C(this,"description",$d.description);C(this,"type",r.BuiltInBaseEntity);C(this,"abstract",$d.abstract);C(this,"static",$d.static);C(this,"properties",[]);C(this,"methods",[]);C(this,"abstractMethods",[]);C(this,"extends",null);C(this,"errors",[]);C(this,"project");this.initialData=$d,this.project=t,this.id=$d.id,this.version=$d.version,this.name=$d.name,this.static=$d.static,this.abstract=$d.abstract,this.properties=this.initialData.properties.map(s=>{const u=Se(s,this.project);return u.setParent(this,null),u.initChildren(null),u}),this.methods=this.initialData.methods.map(s=>{const u=Se(s,this.project);return u.parent=this,u}),this.abstractMethods=this.initialData.abstractMethods.map(s=>{const u=Se(s,this.project);return u.parent=this,u}),this.initialData.extends&&(this.extends=Se(this.initialData.extends,this.project));const n=this.properties.find(s=>s.id===G["built-in-base-entity"][xe.SHARED_DRIVE_MOUNT_ENTITY].properties.path.id);if(!n)throw new Error("Path property not found in shared drive mount entity");n._codeNativeValueValidation=(s,u)=>{const e=zg(s,u);let f=typeof e.override=="string"?e.override:"";if(f&&!f.startsWith("/")&&(f="/"+f),typeof f=="string"){if(/[^a-zA-Z0-9\-_/]/g.test(f)){const T=new ht({id:s.id+"--shared-drive-mount-path-invalid-characters",message:`Mount path "${f}" contains invalid characters. Only alphanumeric, -, _, and / are allowed.`,severity:Ie.Error,code:"shared-drive-mount-path-invalid-characters",entity:s});e.errors.push(T)}const m=["/bin","/boot","/dev","/etc","/lib","/lib64","/proc","/sys","/usr","/sbin","/run","/var/run"];for(const T of m)if(f===T||f.startsWith(T+"/")){const g=new ht({id:s.id+"--shared-drive-mount-path-is-system-folder",message:`Mounting to or within critical system folder "${T}" is not allowed.`,severity:Ie.Error,code:"shared-drive-mount-path-is-system-folder",entity:s});e.errors.push(g);break}}return e.override=f,e}}}var Omt=(a=>(a.DocumentCannotStartWithSlash="document-cannot-start-with-slash",a.DocumentContainsInvalidCharacters="document-contains-invalid-characters",a))(Omt||{});class xmt extends Hd{constructor(t){super(ea,t);C(this,"initialData");C(this,"id",xe.CLOUD_FILE_SYSTEM_BUCKET);C(this,"version","1");C(this,"name",xe.CLOUD_FILE_SYSTEM_BUCKET);C(this,"description",ea.description);C(this,"type",r.BuiltInBaseEntity);C(this,"abstract",ea.abstract);C(this,"static",ea.static);C(this,"properties",[]);C(this,"methods",[]);C(this,"abstractMethods",[]);C(this,"extends",null);C(this,"errors",[]);C(this,"project");this.initialData=ea,this.project=t,this.id=ea.id,this.version=ea.version,this.name=ea.name,this.static=ea.static,this.abstract=ea.abstract,this.properties=this.initialData.properties.map(u=>{const e=Se(u,this.project);return e.setParent(this,null),e.initChildren(null),e}),this.methods=this.initialData.methods.map(u=>{const e=Se(u,this.project);return e.parent=this,e}),this.abstractMethods=this.initialData.abstractMethods.map(u=>{const e=Se(u,this.project);return e.parent=this,e}),this.initialData.extends&&(this.extends=Se(this.initialData.extends,this.project));const n=this.properties.find(u=>{var e;return u.id===((e=G["built-in-base-entity"].BUILT_IN_CLOUD_FILE_SYSTEM_BUCKET_ENTITY.properties.indexDocument)==null?void 0:e.id)});n&&(n._codeNativeValueValidation=(u,e)=>{const f=zg(u,e);let y=typeof f.override=="string"?f.override:"";if(typeof y=="string"&&y.startsWith("/")){const m=new ht({id:u.id+"--document-cannot-start-with-slash",message:`Document "${y}" cannot start with a slash. It must be a relative path.`,severity:Ie.Error,code:"document-cannot-start-with-slash",entity:u});f.errors.push(m)}return f});const s=this.properties.find(u=>{var e;return u.id===((e=G["built-in-base-entity"].BUILT_IN_CLOUD_FILE_SYSTEM_BUCKET_ENTITY.properties.errorDocument)==null?void 0:e.id)});s&&(s._codeNativeValueValidation=(u,e)=>{const f=zg(u,e);let y=typeof f.override=="string"?f.override:"";if(typeof y=="string"&&y.startsWith("/")){const m=new ht({id:u.id+"--document-cannot-start-with-slash",message:`Document "${y}" cannot start with a slash. It must be a relative path.`,severity:Ie.Error,code:"document-cannot-start-with-slash",entity:u});f.errors.push(m)}return f})}}class Pmt extends Jt{constructor(t){super(co,t);C(this,"id",co.id);C(this,"name",co.name);C(this,"description",co.description);C(this,"version",co.version);C(this,"autoexecutable",!1);C(this,"type",r.ActionDescriptor);C(this,"inputs",[]);C(this,"dataType",null);C(this,"error",null);C(this,"project");this.project=t,this.inputs=co.inputs.map(n=>{const s=Se(n,this.project);return s.setParent(this,null),s.initChildren(null),s}),this.dataType=Se(co.dataType,this.project),this.dataType.setParent(this,null),this.dataType.initChildren(null),this.error=co.error?Se(co.error,this.project):null}}var Fd=(a=>(a.UUIDMustBeString="uuid-must-be-string",a.UUIDMustBeValidFormat="uuid-must-be-valid-format",a.UUIDMustNotContainSpaces="uuid-must-not-contain-spaces",a))(Fd||{});function abn(a,p){const t=[];if(typeof p!="string"){const s=new ht({id:a.id+"--uuid-must-be-string",message:`Entity of type ${a.type} with id "${a.id}" has an invalid value "${p}". The value must be text.`,severity:Ie.Error,code:"uuid-must-be-string",entity:a});return t.push(s),{errors:t,override:p}}const n=zg(a,p);if(n.errors.length>0)return t.push(...n.errors),{errors:t,override:p};if(!s4(p)){const s=new ht({id:a.id+"--uuid-must-be-valid-format",message:`Entity of type ${a.type} with id "${a.id}" has an invalid value "${p}". The value must be a valid UUID format. Eg: "123e4567-e89b-12d3-a456-426614174000".`,severity:Ie.Error,code:"uuid-must-be-valid-format",entity:a});t.push(s)}return{errors:t,override:p}}var rt=(a=>(a.Inherited="inherited",a.DefaultValue="default-value",a.Missing="missing",a.Undefined="undefined",a.Empty="empty",a.AutoCalculated="auto-calculated",a.QueuedAutocalculation="queued-autocalculation",a.External="external",a.Testing="testing",a.ExecutionResult="execution-result",a))(rt||{});const Vmt={initialized:!1,id:"",project:null,values:{},onWriteCallback:()=>{},onRemoveCallback:()=>{},onWrite:()=>{},onRemove:()=>{},init:()=>{},toJSON:()=>({}),writeValue:()=>{},readValue:()=>null,removeValue:()=>{},clear:()=>{}};function PR(a,p){return{...Vmt,id:a,project:p}}class VR{constructor(p,t){C(this,"initialized",!1);C(this,"id");C(this,"project");C(this,"values",{});C(this,"onWriteCallback",()=>{});C(this,"onRemoveCallback",()=>{});this.id=p,this.project=t,this.init()}onWrite(p){this.onWriteCallback=p}onRemove(p){this.onRemoveCallback=p}init(){var n;if(!((n=this.project)!=null&&n.id)||this.initialized)return;const p={},t={};Object.keys(p).forEach(s=>{const u=p[s],e=new ya(u,this.project);try{if(u.parent){const m=this.project.findSubscribedInstanceFromReference(u.parent);if(!m)return;e.setParent(m,null),e.hydrateAncestors(),e.initChildren(null)}else if(u.standaloneParent){const m=this.project.findSubscribedInstanceFromReference(u.standaloneParent);if(!m)return;e.standalone=!0,e.setStandaloneParent(m,null),e.hydrateAncestors(),e.initChildren(null)}t[s]=e;const f=e.parent||e.standaloneParent,y=Wmt(e,f,this.project);y?t[s]=y:delete p[s]}catch(f){pe.Logger.error("Error hydrating ancestors: ",f),delete p[s]}}),this.values={...this.values,...t},this.initialized=!0}toJSON(){const p={};return Object.keys(this.values).forEach(t=>{p[t]=this.values[t].toJSON()}),p}writeValue(p,t){if(!p)throw new Error("The value owner entity is required when writing a value to a value store");let s=this.values[p.id];if(!s)if(t instanceof ya)s=t;else if(t)s=Zr(t,this.project);else{const u={id:M.UUID.uuid(),version:M.UUID.uuid(),createdAt:new Date().toISOString(),author:M.sessionAuthor,deleted:!1,previousVersion:null,value:null,deletable:!0,editable:!0,type:r.LiteralValue,standaloneParent:p.toReference(),parent:null,valueAsTypeSingle:null,valueAsTypeList:null,autogeneration:null,name:ly(p.getDataType(null))};s=Zr(u,this.project)}s.standalone=!0,s.initialData.standaloneParent||pe.Logger.warn("instance.initialData: ",s.initialData),s.setStandaloneParent(p,null),s.hydrateAncestors(),s.initChildren(null),t&&(s.metaSync({...t},null),s.setValueAsType(t.valueAsType,null)),this.values[p.id]=s,this.onWriteCallback(p,s)}readValue(p){return this.values[p]||null}removeValue(p){if(!this.values[p])return;delete this.values[p];const t=this.project.get(p);t&&this.onRemoveCallback(t)}clear(){this.values={}}}function ks(a){return a!==null&&typeof a=="object"&&!Array.isArray(a)}function v4(a){if(Array.isArray(a))return a.map(y=>typeof y=="number"?y:e(y)?Number(y):String(y));const p=[];let t=0,n="",s=!1,u=null;for(;t<a.length;){const y=a[t];if(y==="."&&!s){n.length&&(p.push(f(n)),n=""),t++;continue}if(y==="["&&!s){n.length&&(p.push(f(n)),n=""),s=!0,t++;continue}if(s){if(!u&&(y==='"'||y==="'")){u=y,t++;continue}if(u){if(y==="\\"&&t+1<a.length){n+=a[t+1],t+=2;continue}if(y===u){u=null,t++;continue}n+=y,t++;continue}if(y==="]"){p.push(f(n)),n="",s=!1,t++;continue}if(/\s/.test(y)&&!u){t++;continue}n+=y,t++;continue}n+=y,t++}return n.length&&p.push(f(n)),p;function e(y){return/^[0-9]+$/.test(y)}function f(y){const m=y.trim();return e(m)?Number(m):m}}function oV(a,p,t){if(a==null)return t;const n=v4(p);let s=a;for(let u=0;u<n.length;u++){const e=n[u];if(s==null)return t;if(Array.isArray(s)&&typeof e=="number"){if(!(e in s))return t;s=s[e]}else{if(!Object.prototype.hasOwnProperty.call(s,e))return t;s=s[e]}}return s}const sbn=new Set(["__proto__","prototype","constructor"]);function Nmt(a){return typeof a=="string"&&sbn.has(a)}function lbn(a,p,t,n){const{createMissing:s=!0,coerce:u=!0}=n??{};if(a==null||typeof a!="object")throw new TypeError("set(...) expects a non-null object as target.");const e=v4(p);if(e.length===0)throw new Error("set(...) path must not be empty.");let f=a;for(let y=0;y<e.length;y++){const m=e[y];if(Nmt(m))throw new Error(`Refusing to set unsafe key "${String(m)}" on object.`);const T=y===e.length-1,b=typeof e[y+1]=="number",R=Array.isArray(f)&&typeof m=="number";if(T){if(R&&f[m]==null&&!s)throw new Error(`set(...) missing array index "${String(m)}" (createMissing=false).`);return f[m]=t,a}else{if(!Object.prototype.hasOwnProperty.call(f,m)||f[m]==null){if(!s)throw new Error(`set(...) missing parent at segment "${String(m)}" (createMissing=false).`);f[m]=b?[]:{}}else{const I=f[m],A=I!==null&&typeof I=="object",O=Array.isArray(I);if(b){if(!O){if(!u)throw new Error(`set(...) expected an array at "${String(m)}" but found non-array (coerce=false).`);f[m]=[]}}else if(!A||O){if(!u)throw new Error(`set(...) expected an object at "${String(m)}" but found non-object (coerce=false).`);f[m]={}}}f=f[m]}}return a}function g4(a,p,t,n){const s=v4(p);if(s.length===0)return a;function u(e,f){const y=s[f],m=f===s.length-1;if(n==="strict-set"||n==="strict-delete"){if(Nmt(y))throw new Error(`Unsafe key "${String(y)}"`);if(e==null||typeof e!="object"&&!Array.isArray(e))throw new Error(`Missing parent or invalid container at segment "${String(y)}".`);if(n==="strict-delete"&&m&&!(y in e))return e}let T;if(Array.isArray(e))T=[...e];else if(e&&typeof e=="object")T={...e};else if(n==="safe-set")T=typeof y=="number"?[]:{};else throw new Error(`Cannot traverse path at "${String(y)}"`);if(m)return n==="strict-delete"?delete T[y]:T[y]=t,T;const g=e?e[y]:void 0;if(n==="safe-set"&&g==null){const b=typeof s[f+1]=="number",R=u(b?[]:{},f+1);return T[y]=R,T}return T[y]=u(g,f+1),T}if(a==null&&n==="safe-set"){const e=typeof s[0]=="number";return u(e?[]:{},0)}return u(a,0)}const JH=Symbol("missing"),obn=a=>a!=null&&typeof a=="object";function dV(a,p){if(typeof a!="string")throw new TypeError(`${p} expects the key to be a string.`);return a}function IE(a,p){if(typeof a!="string"&&!Array.isArray(a))throw new TypeError(`${p} expects the path to be string or array.`);return a}function sv(a,p){if(!ks(a))throw new TypeError(`${p} expects the first argument to be an object.`);return a??{}}function _mt(a,p){const t=dV(p,"ReadKey");return(a??{})[t]}function $mt(a,p,t){const n=dV(p,"WriteKey");if(a&&typeof a=="object"){const s=Array.isArray(a)?[...a]:{...a};return s[n]=t,s}return{[n]:t}}function Gmt(a,p){if(!a||typeof a!="object")return{};const t=String(p),{[t]:n,...s}=a;return s}function Lmt(a,p,t){const n=sv(a,"ReadNestedKey"),s=IE(p,"ReadNestedKey");return oV(n,s,t)}function Bmt(a,p,t){const n=sv(a,"WriteNestedKey"),s=IE(p,"WriteNestedKey");return g4(n,s,t,"strict-set")}function Smt(a,p,t){const n=sv(a,"WriteSafeNestedKeyRecursively"),s=IE(p,"WriteSafeNestedKeyRecursively");return g4(n,s,t,"safe-set")}function Mmt(a,p){const t=sv(a,"DeleteNestedKey"),n=IE(p,"DeleteNestedKey");return g4(t,n,null,"strict-delete")}function Fmt(a,p){const t=dV(p,"HasKey"),n=a;return n!=null&&obn(n)&&Object.prototype.hasOwnProperty.call(n,t)}function kmt(a,p,t){const n=dV(p,"KeyValueEquals");return a==null||typeof a!="object"?!1:a[n]===t}function Umt(a,p){const t=a,n=IE(p,"HasNestedKey");return oV(t,n,JH)!==JH}function Kmt(a,p,t){const n=IE(p,"NestedKeyValueEquals");return oV(a,n)===t}function jmt(...a){const p={};for(let t=0;t<a.length;t++){const n=a[t];if(n!=null){if(!ks(n))throw new TypeError("MergeObjects expects every argument to be an object (or null/undefined).");Object.assign(p,n)}}return p}function qmt(a){const p=sv(a,"ObjectKeys");return Object.keys(p)}function Zmt(a){const p=sv(a,"ObjectValues");return Object.values(p)}function Hmt(a){const p=sv(a,"ObjectEntries");return Object.entries(p)}const Ig=new Set;function dbn(a){return{execution:null,project:a,localTestValues:PR("local-test-values",a),resolvedValues:PR("resolved-values",a),persistedExecutionResults:PR("persisted-execution-results",a),lastExecutionResults:PR("last-execution-results",a),getValueTypePreference:()=>null,setValueTypePreference:()=>{}}}function RE(a,p,t,n){var f;let s;if(((f=a==null?void 0:a.entity)==null?void 0:f.type)===r.PrimitiveEntity)switch(a.entity.name){case me.EntityTemplate:s=me.EntityTemplate;break;case me.String:s=me.String;break;case me.Number:s=me.Number;break;case me.Boolean:s=me.Boolean;break;case me.Null:s=me.Null;break;case me.Enum:s=me.Enum;break;case me.KeyValue:s=me.KeyValue;break;case me.Untyped:s=me.Untyped;break;case me.KeyValue:s=me.KeyValue;break;case me.Date:s=me.Date;break;case me.UUID:s=me.UUID;break;case me.FileReference:s=me.FileReference;break;case me.Void:s=me.Void;break;case me.ActionDescriptor:s=me.ActionDescriptor;break;case me.Bytes:s=me.Bytes;break;case me.SqlProgram:s=me.SqlProgram;break;case me.RGB:s=me.RGB;break;case me.RGBA:s=me.RGBA;break;case me.SpreadsheetRange:s=me.SpreadsheetRange;break;default:throw new Error(`Primitive type ${Ve(a.entity,t)} is not supported`)}else s=me.Untyped;const u=ya.new(n);u.name=s,u.parent=p.toReference();const e=Se(u,t);return e.hydrateAncestors(),n==null||n.add(e,ye.Added),e.addSelfToProject(n),e.initChildren(n),e}function uf(a,p,t){var u,e,f,y;const n=(t==null?void 0:t.seenInRecursion)??new Set,s=(t==null?void 0:t.forVarInst)??!1;if(n.has(a.id))return[];if(n.add(a.id),Yi.includes(a.type)){const m=ba(a);return s?[a]:_([m,...[m].flatMap(T=>uf(T,p,{seenInRecursion:n,forVarInst:s}))])}else if(a.type===r.OutputMap){if(Yi.includes(a.parent.type)&&((u=a.declaration)==null?void 0:u.type)===r.Property&&a.declaration.static)return _([a,a.declaration,...[a,a.declaration].flatMap(m=>uf(m,p,{seenInRecursion:n,forVarInst:s}))])}else if(a.type===r.InputMap){if(Yi.includes(a.parent.type)&&((e=a.declaration)==null?void 0:e.type)===r.Property&&((f=a.declaration)!=null&&f.static))return _([a.declaration,...[a.declaration].flatMap(m=>uf(m,p,{seenInRecursion:n,forVarInst:s}))])}else if(a.type===r.ValueDescriptor&&((y=a.parent)==null?void 0:y.type)===r.Search){const m=a.parent.inputs.find(T=>{var g;return((g=T.declaration)==null?void 0:g.id)===a.id});if(m)return[m]}return[a]}function Wmt(a,p,t){return a}function AE(a,p,t=!1){const n=a.readsValue;let s=null;const u=Qu(n,p,t);if(u){const e={sources:[u],target:a};s={value:u.value,valueOwner:a,type:rt.Inherited,inheritanceLink:e}}else s={value:null,valueOwner:a,type:rt.Inherited,inheritanceLink:null};return s}function Pn(a,p,t){var f;if(!p)return null;let n;if(((f=a==null?void 0:a.entity)==null?void 0:f.type)===r.PrimitiveEntity)switch(a.entity.name){case me.EntityTemplate:n=me.EntityTemplate;break;case me.String:n=me.String;break;case me.Number:n=me.Number;break;case me.Boolean:n=me.Boolean;break;case me.Null:n=me.Null;break;case me.Enum:n=me.Enum;break;case me.KeyValue:n=me.KeyValue;break;case me.Untyped:n=me.Untyped;break;case me.KeyValue:n=me.KeyValue;break;case me.Date:n=me.Date;break;case me.UUID:n=me.UUID;break;case me.FileReference:n=me.FileReference;break;case me.Void:n=me.Void;break;case me.ActionDescriptor:n=me.ActionDescriptor;break;case me.Bytes:n=me.Bytes;break;case me.SqlProgram:n=me.SqlProgram;break;case me.RGB:n=me.RGB;break;case me.RGBA:n=me.RGBA;break;case me.SpreadsheetRange:n=me.SpreadsheetRange;break;default:throw new Error(`Primitive type ${Ve(a.entity,t)} is not supported`)}else n=me.Untyped;if(!t.get(p.id))return null;const u=ya.new(null);u.name=n,u.standaloneParent=p.toReference();let e=new ya(u,t);return e.hydrateAncestors(),e.standalone=!0,e.setStandaloneParent(p,null),e.initChildren(null),e}function zmt(a,p,t=!1){var u,e;if(p.execution&&p.execution.hasEntity(a)&&!t){const f=(u=p.lastExecutionResults)==null?void 0:u.readValue(a.id);if(f)return{value:f,valueOwner:a,type:rt.ExecutionResult,inheritanceLink:null}}const n=(e=p.localTestValues)==null?void 0:e.readValue(a.id),s=p.getValueTypePreference(a.id);return n&&!t&&(s===null||s!==rt.DefaultValue)?{value:n,valueOwner:a,type:rt.Testing,inheritanceLink:null}:{value:null,valueOwner:a,type:rt.QueuedAutocalculation,inheritanceLink:null}}function Cw(a,p,t,n=!1){var f,y,m,T;const s={...a},u=Yi.includes(p.type)?p.inputs:Ni.includes(p.type)?p.outputs:[];if(!u||u.length===0)return s;let e={};if(p.type===r.VariableInstance){const g=ba(p),b=Qu(g,t,n);e=((f=b==null?void 0:b.value)==null?void 0:f.value)||{}}for(const g of u){if(!vT(g))continue;let b=g;p.type===r.VariableInstance&&!g.defaultValue&&!g.readsValue&&(b=ba(p).inputs.find(O=>{var P,x;return((P=O.declaration)==null?void 0:P.id)===((x=g.declaration)==null?void 0:x.id)}));const R=dA(b,t,n);if(R&&R.value)try{const I=De(b,t.project),A=b.codeName||((y=b.declaration)==null?void 0:y.codeName)||jn(I);s[A]=_s((R==null?void 0:R.value)||null)?s[A]:(m=R==null?void 0:R.value)==null?void 0:m.value}catch{}else if(p.type===r.VariableInstance&&!g.defaultValue&&!g.readsValue)try{const I=De(b,t.project),A=b.codeName||((T=b.declaration)==null?void 0:T.codeName)||jn(I);s[A]=e==null?void 0:e[A]}catch{}}return s}function NR(a,p,t,n=!1){var e,f;const s={...a},u=p.inputs;if(!u)return s;for(const y of u){if(!vT(y))continue;const m=B1(y,t,n);if(m&&m.value&&m.type!==rt.Undefined){const T=Ve(y,t.project),g=y.codeName||((e=y.declaration)==null?void 0:e.codeName)||jn(T);s[g]=(f=m==null?void 0:m.value)==null?void 0:f.value}}return s}function Ymt(a,p,t=!1){var g,b,R,I,A,O;let n={};const s=(g=a.getDataType(null))==null?void 0:g.entity;if((s==null?void 0:s.type)===r.DefinitionEntity)n={...n,...s.getActiveRawDefaultValue()};else if((s==null?void 0:s.type)===r.BuiltInBaseEntity)n={...n,...s.getRawDefaultValue()};else if((s==null?void 0:s.type)===r.PrimitiveEntity&&Sd(s,me.KeyValue)){const P={};s.properties.forEach(x=>{var Z;if(!vp(x)||!x.defaultValue)return;const $=De(x,a.project),U=x.codeName||ho(x,a.project)||Zs(jn($));P[U]=((Z=x.getDefaultValue())==null?void 0:Z.value)||null}),n={...n,...P}}if(p.execution&&p.execution.hasEntity(a)&&!t){const P=(b=p.lastExecutionResults)==null?void 0:b.readValue(a.id);if(P){if(ks(P.value)){const $={...n,...P.value},U={...NR($,a,p,t)};P.metaSync({value:U},null)}return{value:P,valueOwner:a,type:rt.ExecutionResult,inheritanceLink:null}}}const u=!!((R=p.execution)!=null&&R.entities.length),e=(I=p.execution)==null?void 0:I.hasEntity(a),f=a.readsValue;let y=null;if(f){const P=(A=p.execution)==null?void 0:A.hasEntity(f);if((!u||u&&P&&e||u&&!P&&!e)&&(y=AE(a,p,t),y&&y.value&&ks(y.value.value))){const $={...n,...y.value.value},U={...NR($,a,p,t)};y.value.metaSync({value:U},null)}}const m=a.defaultValue,T=p.getValueTypePreference(a.id);if(!y&&m){const P=m;if(P&&P.value===null&&P.autogeneration){const x=uN(P);if(P.metaSync({value:x},null),ks(x)){const $={...NR(x,a,p,t)};P.metaSync({value:$},null)}}(t||T===null||T!==rt.Testing)&&(y={value:P,valueOwner:a,type:_s(P)?a.readsValue?rt.Inherited:rt.Empty:rt.DefaultValue,inheritanceLink:null})}if(!y||(y.type===rt.DefaultValue||y.type===rt.External)&&!t||T===rt.Testing){const P=(O=p.localTestValues)==null?void 0:O.readValue(a.id);if(P){if(ks(P.value)){const x={...n,...P.value},$={...NR(x,a,p,t)};P.metaSync({value:$},null)}return{value:P,valueOwner:a,type:rt.Testing,inheritanceLink:null}}}return _s((y==null?void 0:y.value)||null)?{value:null,valueOwner:a,type:a.readsValue?rt.Inherited:rt.Empty,inheritanceLink:null}:y}function pV(a,p,t=!1){var y,m,T,g,b,R,I,A,O;let n={};const s=(y=a.getDataType(null))==null?void 0:y.entity;if((s==null?void 0:s.type)===r.DefinitionEntity)n={...n,...s.getActiveRawDefaultValue()};else if((s==null?void 0:s.type)===r.BuiltInBaseEntity)n={...n,...s.getRawDefaultValue()};else if((s==null?void 0:s.type)===r.PrimitiveEntity&&Sd(s,me.KeyValue)){const P={};s.properties.forEach(x=>{var Z;if(!vp(x)||!x.defaultValue)return;const $=De(x,a.project),U=x.codeName||ho(x,a.project)||Zs(jn($));P[U]=((Z=x.defaultValue)==null?void 0:Z.value)||null}),n={...n,...P}}if(p.execution&&p.execution.hasEntity(a)&&!t){const P=(m=p.lastExecutionResults)==null?void 0:m.readValue(a.id);if(P){if(ks(P.value)){const $={...n,...P.value},U=Cw($,a,p,t);P==null||P.metaSync({value:U},null)}return{value:P,valueOwner:a,type:rt.ExecutionResult,inheritanceLink:null}}}const u=(T=p.localTestValues)==null?void 0:T.readValue(a.id);let e=!1;if(a.type===r.VariableDeclaration||a.type===r.VariableInstance){const P=a,x=!!((g=p.execution)!=null&&g.entities.length),$=(b=p.execution)==null?void 0:b.hasEntity(a),U=P.readsValue;if(U){const Z=(R=p.execution)==null?void 0:R.hasEntity(U);e=!x||x&&Z&&$||x&&!Z&&!$}}const f=p.getValueTypePreference(a.id);if(u&&!t&&(!e||f===rt.Testing)){if(ks(u.value)){const x={...n,...u.value},$=Cw(x,a,p,t);u.metaSync({value:$},null)}return{value:u,valueOwner:a,type:rt.Testing,inheritanceLink:null}}if(s&&((s==null?void 0:s.type)===r.DefinitionEntity||(s==null?void 0:s.type)===r.BuiltInBaseEntity||s.type===r.PrimitiveEntity&&Sd(s,me.KeyValue))&&((I=a.getDataType(null))!=null&&I.isObject())){const P=Pn(a.getDataType(null),a,p.project);n={...ks((A=a.defaultValue)==null?void 0:A.value)?(O=a.defaultValue)==null?void 0:O.value:{}};const x={...Cw(n,a,p,t)};return P==null||P.metaSync({value:x},null),{value:P,valueOwner:a,type:rt.DefaultValue,inheritanceLink:null}}return null}function uV(a,p,t=!1){var T,g,b,R,I;if((T=a.dataType)!=null&&T.isObject())return Ymt(a,p,t);const n=mi(a),s=!!((g=p.execution)!=null&&g.entities.length),u=(b=p.execution)==null?void 0:b.hasEntity(n),e=a.readsValue;let f=null;if(e){const A=(R=p.execution)==null?void 0:R.hasEntity(e);(!s||s&&A&&u||s&&!A&&!u)&&(f=AE(a,p,t))}const y=a.defaultValue,m=p.getValueTypePreference(a.id);if(!f&&y){const A=y;if(A&&A.value===null&&A.autogeneration){const O=uN(A);A.metaSync({value:O},null)}(t||m===null||m!==rt.Testing)&&(f={value:A,valueOwner:a,type:_s(A)?a.readsValue?rt.Inherited:rt.Empty:rt.DefaultValue,inheritanceLink:null})}if(!f||(f.type===rt.DefaultValue||f.type===rt.External)&&!t||m===rt.Testing){const A=(I=p.localTestValues)==null?void 0:I.readValue(a.id);if(A)return{value:A,valueOwner:a,type:rt.Testing,inheritanceLink:null}}return _s((f==null?void 0:f.value)||null)?{value:null,valueOwner:a,type:a.readsValue?rt.Inherited:rt.Empty,inheritanceLink:null}:f}function Jmt(a,p,t=!1){var s,u;if(p.execution&&p.execution.hasEntity(a)&&!t){const e=(s=p.lastExecutionResults)==null?void 0:s.readValue(a.id);if(e)return{value:e,valueOwner:a,type:rt.ExecutionResult,inheritanceLink:null}}return(u=a.dataType)!=null&&u.isObject()||a.outputs.length?pV(a,p,t):uV(a,p,t)}function b4(a,p,t=!1){var b,R,I,A;const n=!!((b=p.execution)!=null&&b.entities.length),s=(R=p.execution)==null?void 0:R.hasEntity(a);let u=null;const e=a.readsValue;if(e){const O=(I=p.execution)==null?void 0:I.hasEntity(e);(!n||n&&O&&s||n&&!O&&!s)&&(u=AE(a,p,t))}const f=a.declaration;if(!u&&f){const O=uV(f,p,t);O&&O.value&&(u=O)}const y=p.getValueTypePreference(a.id);if(!u||(u.type===rt.DefaultValue||u.type===rt.External)&&!t||y===rt.Testing){const O=(A=p.localTestValues)==null?void 0:A.readValue(a.id);if(O)return{value:O,valueOwner:a,type:rt.Testing,inheritanceLink:null}}a.defaultValue&&(u={value:a.defaultValue,valueOwner:a,type:rt.DefaultValue,inheritanceLink:null});const m=Oy(a),T=a.getDataType(null);return m&&s&&(!(u!=null&&u.value)||!Jo(T)&&cf(u==null?void 0:u.value))?{value:null,valueOwner:a,type:rt.Missing,inheritanceLink:null}:s&&!m&&_s((u==null?void 0:u.value)||null)?{value:null,valueOwner:a,type:a.readsValue?rt.Inherited:rt.Empty,inheritanceLink:null}:u||{value:null,valueOwner:a,type:rt.External,inheritanceLink:null}}function Qmt(a,p,t=!1){var n,s;if(p.execution&&p.execution.hasEntity(a.declaration)&&!t){const u=(n=p.lastExecutionResults)==null?void 0:n.readValue(a.declaration.id);if(u)return{value:u,valueOwner:a.declaration,type:rt.ExecutionResult,inheritanceLink:null}}return(s=a.getDataType(null))!=null&&s.isObject()||a.declaration.outputs.length?pV(a,p,t):b4(a,p,t)}function Xmt(a,p,t=!1){var R,I,A,O;if(!t&&p.execution&&p.execution.hasEntity(a)){const P=(R=p.lastExecutionResults)==null?void 0:R.readValue(a.id);if(P)return{value:P,valueOwner:a,type:rt.ExecutionResult,inheritanceLink:null}}const n=!p.execution||!p.execution.parentExecution,s=p.getValueTypePreference(a.id);if(n){const P=(I=p.localTestValues)==null?void 0:I.readValue(a.id);if(P&&!t&&(s===null||s!==rt.DefaultValue))return{value:P,valueOwner:a,type:rt.Testing,inheritanceLink:null}}const u=mi(a),e=a.parent.type===r.FunctionDeclaration&&a.parent.parent.type===r.Loop?a.parent:null,f=!!((A=p.execution)!=null&&A.hasEntity(u))||!!e&&!!((O=p.execution)!=null&&O.hasEntity(e));let y=null;const m=a.defaultValue;if(m){const P=m||null;if(P&&P.value===null&&P.autogeneration){const x=uN(P);P.metaSync({value:x},null)}(t||s===null||s!==rt.Testing)&&(y={value:P,valueOwner:a,type:_s(P)?rt.Empty:rt.DefaultValue,inheritanceLink:null})}!y||(y.type===rt.DefaultValue||y.type===rt.External)&&!t||rt.Testing;const T=Oy(a),g=a.getDataType(null);let b=T&&f&&(!(y!=null&&y.value)||!Jo(g)&&cf(y==null?void 0:y.value));return u.type===r.Loop&&f&&(b=!1),b?{value:null,valueOwner:a,type:rt.Missing,inheritanceLink:null}:f&&!T&&_s((y==null?void 0:y.value)||null)?{value:null,valueOwner:a,type:rt.Empty,inheritanceLink:null}:y||{value:null,valueOwner:a,type:rt.External,inheritanceLink:null}}function E4(a,p,t=!1){var R,I,A,O,P,x;if((R=a.getDataType(null))!=null&&R.isObject()||a.outputs.length)return pV(a,p);if(p.execution&&p.execution.hasEntity(a)&&!t){const $=(I=p.lastExecutionResults)==null?void 0:I.readValue(a.id);if($)return{value:$,valueOwner:a,type:rt.ExecutionResult,inheritanceLink:null}}const n=mi(a),s=!!((A=p.execution)!=null&&A.entities.length),u=(O=p.execution)==null?void 0:O.hasEntity(n),e=a.readsValue;let f=null;if(e){const $=(P=p.execution)==null?void 0:P.hasEntity(e);(!s||s&&$&&u||s&&!$&&!u)&&(f=AE(a,p,t))}const y=a.defaultValue,m=p.getValueTypePreference(a.id);if(!f&&y){const $=y;(t||m===null||m!==rt.Testing)&&(f={value:$,valueOwner:a,type:rt.DefaultValue,inheritanceLink:null})}if(!f||(f.type===rt.DefaultValue||f.type===rt.External)&&!t||m===rt.Testing){const $=(x=p.localTestValues)==null?void 0:x.readValue(a.id);if($)return{value:$,valueOwner:a,type:rt.Testing,inheritanceLink:null}}const T=Oy(a),g=a.getDataType(null);return T&&(!(f!=null&&f.value)||!Jo(g)&&cf(f==null?void 0:f.value))?{value:null,valueOwner:a,type:rt.Missing,inheritanceLink:null}:!a.defaultValue&&!a.readsValue?{value:null,valueOwner:a,type:rt.Undefined,inheritanceLink:null}:!T&&_s((f==null?void 0:f.value)||null)?{value:null,valueOwner:a,type:a.readsValue?rt.Inherited:rt.Empty,inheritanceLink:null}:f}function eTt(a,p,t=!1){var e,f,y,m,T,g,b,R;if(p.execution&&p.execution.hasEntity(a)&&!t){const I=(e=p.lastExecutionResults)==null?void 0:e.readValue(a.id);if(I)return{value:I,valueOwner:a,type:rt.ExecutionResult,inheritanceLink:null}}const n=y0(a);if(hy.includes(n.type)){const I=Qu(n,p,t),A=a.codeName||((f=a.declaration)==null?void 0:f.codeName)||jn(Ve(a,p.project));if(I!=null&&I.value&&a.parentRelationType!==mp.Error){const O=(I.value.value||{})[A];if(O===void 0)return{value:null,valueOwner:a,type:rt.Undefined,inheritanceLink:null};const P=Pn(a.getDataType(null),a,p.project);return P==null||P.metaSync({value:O,rawString:typeof O=="string"&&typeof((y=I==null?void 0:I.value)==null?void 0:y.rawString)=="string"?(m=I==null?void 0:I.value)==null?void 0:m.rawString:void 0},null),{value:P,valueOwner:a,type:!Yi.includes(n.type)&&I.type===rt.Empty?rt.QueuedAutocalculation:I.type,inheritanceLink:{sources:[I],target:a}}}return{value:null,valueOwner:a,type:Yi.includes(n.type)?rt.Empty:rt.QueuedAutocalculation,inheritanceLink:null}}const s=(T=p.execution)==null?void 0:T.hasEntity(n),u=((g=p.execution)==null?void 0:g.state)===U4.Running;if((b=p.persistedExecutionResults)!=null&&b.values[a.id]&&!s&&!u&&!t){const I=(R=p.persistedExecutionResults)==null?void 0:R.readValue(a.id);if((I==null?void 0:I.value)!==null||(I==null?void 0:I.valueAsType)!==null)return{value:I,valueOwner:a,type:rt.ExecutionResult,inheritanceLink:null}}return null}function FL(a,p,t=!1){var g,b,R,I,A;if(![...Ni,...Yi].includes(a.parent.type)||!vT(a))return null;if(((g=a.declaration)==null?void 0:g.type)===r.Property&&a.declaration.static)return Qu(a.declaration,p);const n=B1(a,p,t);if(n&&n.type!==rt.Empty&&n.type!==rt.Missing&&n.type!==rt.Undefined)return n;const s=ba(a.parent),u=Xp(s,p,t),e=a.codeName||((b=a.declaration)==null?void 0:b.codeName)||jn(Ve(a,p.project)),f=Pn(a.getDataType(null),a,p.project),y=Oy(a),m=(R=u==null?void 0:u.value)==null?void 0:R.value;if(m){let O=(m||{})[e];if(m[e]===void 0)return{value:null,valueOwner:a,type:rt.Undefined,inheritanceLink:{sources:u?[u]:[],target:a}};f==null||f.metaSync({value:O,rawString:typeof O=="string"&&typeof((I=u==null?void 0:u.value)==null?void 0:I.rawString)=="string"?(A=u==null?void 0:u.value)==null?void 0:A.rawString:void 0},null);const P=Oy(a),x=a.getDataType(null);return P&&(!f||!Jo(x)&&cf(f))?{value:null,valueOwner:a,type:rt.Missing,inheritanceLink:null}:{value:f,valueOwner:a,type:u.type,inheritanceLink:{sources:u?[u]:[],target:a}}}return u!=null&&u.type&&u.type!==rt.Missing&&u.type!==rt.Empty&&u.type!==rt.Undefined?{value:null,valueOwner:a,type:u.type,inheritanceLink:{sources:u?[u]:[],target:a}}:y?{value:null,valueOwner:a,type:rt.Missing,inheritanceLink:null}:{value:null,valueOwner:a,type:a.readsValue?rt.Inherited:rt.Empty,inheritanceLink:null}}function kL(a,p,t=!1){var m,T,g,b,R,I,A,O,P,x,$;if(![...Ni,...Yi].includes(a.parent.type)||!vT(a))return null;if(((m=a.declaration)==null?void 0:m.type)===r.Property&&a.declaration.static)return Qu(a.declaration,p,t);const n=a.parent;let s=Qu(n,p,t),u=dA(a,p,t);if(((u==null?void 0:u.type)===rt.Undefined||(u==null?void 0:u.type)===rt.Missing)&&!n.defaultValue&&!n.readsValue){const U=ba(a.parent);s=Qu(U,p,t);let Z=a;U.type===r.VariableDeclaration&&(Z=(a.parent===n?a:U.inputs.find(H=>{var Y,ie;return((Y=H.declaration)==null?void 0:Y.id)===((ie=a.declaration)==null?void 0:ie.id)}))||a,u=dA(Z,p,t))}const e=a.codeName||((T=a.declaration)==null?void 0:T.codeName)||jn(Ve(a,p.project));let f=a.defaultValue||Pn(a.getDataType(null),a,p.project);const y=(g=s==null?void 0:s.value)==null?void 0:g.value;if(((s==null?void 0:s.type)===rt.ExecutionResult||(s==null?void 0:s.type)===rt.Testing)&&!t&&y){let U=(y||{})[e];if(y[e]===void 0&&!a.readsValue&&!a.defaultValue)return{value:null,valueOwner:a,type:rt.Undefined,inheritanceLink:{sources:s?[s]:[],target:a}};f!=null&&f.parent&&!f.standaloneParent&&(f=f.clone(null,null,null,!1),f.setStandaloneParent(a,null));let Z=U;return a.defaultValue&&(Z=a.defaultValue.value),f==null||f.metaSync({value:Z,rawString:typeof U=="string"&&typeof((b=s==null?void 0:s.value)==null?void 0:b.rawString)=="string"?(R=s==null?void 0:s.value)==null?void 0:R.rawString:void 0},null),{value:f,valueOwner:a,type:s.type,inheritanceLink:{sources:s?[s]:[],target:a}}}if(u&&u.type!==rt.Empty&&u.type!==rt.Missing&&u.type!==rt.Undefined)return u;if(y){let U=(y||{})[e];y[e]!==void 0&&(f=Xr(f,a),f==null||f.metaSync({value:U,rawString:typeof U=="string"&&typeof((I=s==null?void 0:s.value)==null?void 0:I.rawString)=="string"?(A=s==null?void 0:s.value)==null?void 0:A.rawString:void 0},null));const Z=Oy(a),q=a.getDataType(null),H=Z&&(!f||!Jo(q)&&cf(f)),Y=!!((O=p.execution)!=null&&O.entities.length),ie=(P=p.execution)==null?void 0:P.hasEntity(n),z=n.readsValue;if(z){const ee=(x=p.execution)==null?void 0:x.hasEntity(z);if(H&&(!Y||Y&&ee&&ie||Y&&!ee&&!ie))return{value:null,valueOwner:a,type:rt.Inherited,inheritanceLink:null}}if(a.readsValue){const ee=($=p.execution)==null?void 0:$.hasEntity(a.readsValue);if(H&&(!Y||Y&&ee&&ie||Y&&!ee&&!ie))return{value:null,valueOwner:a,type:rt.Inherited,inheritanceLink:null}}if(H)return{value:null,valueOwner:a,type:rt.Missing,inheritanceLink:null};if(y[e]===void 0&&!a.readsValue&&!a.defaultValue)return{value:null,valueOwner:a,type:rt.Undefined,inheritanceLink:{sources:s?[s]:[],target:a}};let W=rt.Inherited;return _s(f)&&!a.readsValue&&(W=rt.Empty),_s(f)||(s!=null&&s.type?W=s==null?void 0:s.type:a.defaultValue&&(W=rt.DefaultValue)),{value:f,valueOwner:a,type:W,inheritanceLink:null}}return{value:null,valueOwner:a,type:rt.Undefined,inheritanceLink:null}}function B1(a,p,t=!1){var A,O,P,x,$;const n=mi(a),s=!!((A=p.execution)!=null&&A.entities.length),u=(O=p.execution)==null?void 0:O.hasEntity(n),e=a.readsValue;let f=null,y=!1;if(e){const U=(P=p.execution)==null?void 0:P.hasEntity(e);y=!s||s&&U&&u||s&&!U&&!u,y&&(f=AE(a,p,t))}const m=!!e&&y,T=a.defaultValue,g=p.getValueTypePreference(a.id);if(!f&&T&&(t||g===null||g!==rt.Testing)&&(f={value:T,valueOwner:a,type:cf(T)?rt.Empty:rt.DefaultValue,inheritanceLink:null}),(!f||f.type===rt.DefaultValue||(f==null?void 0:f.type)===rt.Empty||g===rt.Testing)&&!m){const U=(x=p.persistedExecutionResults)==null?void 0:x.readValue(a.id);if(U&&!t)return{value:U,valueOwner:a,type:rt.Testing,inheritanceLink:null};const Z=($=p.localTestValues)==null?void 0:$.readValue(a.id);if(Z&&!t&&(g===null||g===rt.Testing))return{value:Z,valueOwner:a,type:rt.Testing,inheritanceLink:null}}if(T&&!cf(T))return{value:T,valueOwner:a,type:rt.DefaultValue,inheritanceLink:null};const b=Oy(a),R=a.getDataType(null),I=b&&(!(f!=null&&f.value)||!Jo(R)&&cf(f==null?void 0:f.value));return m&&I?{value:null,valueOwner:a,type:rt.Inherited,inheritanceLink:null}:I?{value:null,valueOwner:a,type:rt.Missing,inheritanceLink:(f==null?void 0:f.inheritanceLink)||null}:!f&&!a.defaultValue&&!m?{value:null,valueOwner:a,type:rt.Undefined,inheritanceLink:null}:!b&&(!f||f.type===rt.Inherited)&&!(f!=null&&f.inheritanceLink)?{value:null,valueOwner:a,type:m?rt.Inherited:rt.Empty,inheritanceLink:null}:f}function dA(a,p,t=!1){var s;if(p.execution&&p.execution.hasEntity(a)&&!t){const u=(s=p.lastExecutionResults)==null?void 0:s.readValue(a.id);if(u)return{value:u,valueOwner:a,type:rt.ExecutionResult,inheritanceLink:null}}return B1(a,p,t)}function tTt(a,p,t=!1){var n,s;return Yi.includes(a.parent.type)&&(n=ba(a.parent).dataType)!=null&&n.isObject()||Ni.includes(a.parent.type)&&(s=a.parent.getDataType(null))!=null&&s.isObject()?FL(a,p,t):B1(a,p,t)}function I4(a,p,t=!1){var n,s;return Yi.includes(a.parent.type)&&((n=a.parent.getDataType(null))!=null&&n.isObject()||a.parent.inputs.length)||Ni.includes(a.parent.type)&&((s=a.parent.getDataType(null))!=null&&s.isObject()||a.parent.outputs.length)?kL(a,p,t):dA(a,p,t)}function iTt(a,p,t=!1){var T,g;if(p.execution){const b=(T=p.lastExecutionResults)==null?void 0:T.readValue(a.id);if(b&&!t)return{value:b,valueOwner:a,type:rt.ExecutionResult,inheritanceLink:null}}const n=!p.execution||!p.execution.parentExecution,s=p.getValueTypePreference(a.id);if(n){const b=(g=p.localTestValues)==null?void 0:g.readValue(a.id);if(b&&!t&&(s===null||s!==rt.DefaultValue))return{value:b,valueOwner:a,type:rt.Testing,inheritanceLink:null}}const u=a.defaultValue;let e=null;u&&(t||s===null||s!==rt.Testing)&&(e={value:u,valueOwner:a,type:rt.DefaultValue,inheritanceLink:null});const f=Oy(a),y=a.getDataType(null);return f&&(!(e!=null&&e.value)||!Jo(y)&&cf(e==null?void 0:e.value))&&a.static?{value:null,valueOwner:a,type:rt.Missing,inheritanceLink:null}:_s(e==null?void 0:e.value)?{value:null,valueOwner:a,type:rt.Empty,inheritanceLink:null}:e}function nTt(a,p,t=!1){var f,y,m;if(p.execution&&p.execution.hasEntity(a)&&!t){const T=(f=p.lastExecutionResults)==null?void 0:f.readValue(a.id);if(T)return{value:T,valueOwner:a,type:rt.ExecutionResult,inheritanceLink:null}}const n=!p.execution||!p.execution.parentExecution,s=p.getValueTypePreference(a.id);if(n){const T=(y=p.localTestValues)==null?void 0:y.readValue(a.id);if(T&&!t&&(s===null||s!==rt.DefaultValue))return{value:T,valueOwner:a,type:rt.Testing,inheritanceLink:null}}const u=a.defaultValue;let e=null;if(u&&(t||s===null||s!==rt.Testing)&&(e={value:u,valueOwner:a,type:rt.DefaultValue,inheritanceLink:null}),((m=a.parent)==null?void 0:m.type)===r.Search){const T=a.parent.inputs.find(g=>{var b;return((b=g.declaration)==null?void 0:b.id)===a.id});if(T)return I4(T,p,t)}return _s((e==null?void 0:e.value)||null)?{value:null,valueOwner:a,type:rt.Empty,inheritanceLink:null}:e}function Qu(a,p,t=!1){if(Ig.has(a.id))return{value:null,valueOwner:a,type:rt.Undefined,inheritanceLink:null};Ig.add(a.id);try{switch(a.type){case r.ArgumentDeclaration:return Xmt(a,p,t);case r.InputMap:return I4(a,p,t);case r.VariableDeclaration:return Jmt(a,p,t);case r.VariableInstance:return Qmt(a,p,t);case r.OutputMap:return eTt(a,p,t);case r.ReturnStatement:case r.BreakStatement:case r.ContinueStatement:return E4(a,p,t);case r.Property:return iTt(a,p,t);case r.ValueDescriptor:return nTt(a,p,t);case r.Operation:case r.Loop:case r.FunctionCall:case r.InternalCall:case r.Search:return zmt(a,p,t);default:return null}}finally{Ig.delete(a.id)}}function Xp(a,p,t=!1){if(Ig.has(a.id))return{value:null,valueOwner:a,type:rt.Undefined,inheritanceLink:null};Ig.add(a.id);try{switch(a.type){case r.InputMap:return tTt(a,p,t);case r.VariableDeclaration:return uV(a,p,t);case r.VariableInstance:return b4(a,p,t);case r.ReturnStatement:case r.BreakStatement:case r.ContinueStatement:return E4(a,p,t);default:return null}}finally{Ig.delete(a.id)}}function pbn(a){var p,t,n,s,u;if(a&&a.type===rt.DefaultValue&&a.value&&a.valueOwner&&(!xO.includes(a.valueOwner.type)||((p=a.valueOwner.defaultValue)==null?void 0:p.id)===a.value.id)){const e=Pn(a.valueOwner.getDataType(null),a.valueOwner,a.valueOwner.project);return e==null||e.metaSync({value:(t=a.value)==null?void 0:t.value,rawString:typeof((n=a.value)==null?void 0:n.value)=="string"&&typeof((s=a.value)==null?void 0:s.rawString)=="string"?(u=a.value)==null?void 0:u.rawString:void 0},null),{type:rt.DefaultValue,value:e,valueOwner:a.valueOwner,inheritanceLink:null}}return a}function ubn(a,p,t,n){var I,A,O;let s=!1,u=null,e=null;n instanceof de?(s=!0,u=n,e=null):(u=null,e=n);const f=ba(a.parent),y=f.getDataType(null);if(!(y!=null&&y.isObject()))return u;let m=s?f.defaultValue:e==null?void 0:e.readValue(f.id);m?!s&&m&&m.id===((I=f.defaultValue)==null?void 0:I.id)&&(m=Pn(f.getDataType(null),f,p)):s?m=RE(f.getDataType(null),f,p,u):m=Pn(f.getDataType(null),f,p);const T=Ve(a,p),g=a.codeName||((A=a.declaration)==null?void 0:A.codeName)||jn(T);let b={};const R=(O=f.dataType)==null?void 0:O.entity;if((R==null?void 0:R.type)===r.DefinitionEntity)b={...b,...R.getActiveRawDefaultValue()};else if((R==null?void 0:R.type)===r.BuiltInBaseEntity)b={...b,...R.getRawDefaultValue()};else if((R==null?void 0:R.type)===r.PrimitiveEntity&&Sd(R,me.KeyValue)){const P={};R.properties.forEach(x=>{var Z;if(!vp(x)||!x.defaultValue)return;const $=De(x,p),U=x.codeName||ho(x,p)||Zs(jn($));P[U]=((Z=x.getDefaultValue())==null?void 0:Z.value)||null}),b={...b,...P}}if(ks(m==null?void 0:m.value)&&(b={...b,...m.value}),b[g]=t,m==null||m.metaSync({value:b},u),s||e==null||e.writeValue(f,m),(t===""||t===null||t===void 0)&&a.type===r.OutputMap){const P=f.inputs.find(x=>{var $,U;return(($=x.declaration)==null?void 0:$.id)===((U=a.declaration)==null?void 0:U.id)||Ve(x,p)===T});if(P){let x=s?P.defaultValue:e==null?void 0:e.readValue(P.id);x&&x.metaSync({value:null},u),s||e==null||e.removeValue(P.id)}}return u}function cbn(a,p,t){const n=t instanceof de,s=uf(a,p,{forVarInst:n});let u=!1,e=null,f=null;return t instanceof de?(u=!0,e=t,f=null):(e=null,f=t),s.forEach(y=>{let m=u?y.defaultValue||null:f==null?void 0:f.readValue(y.id);u?m==null||m.remove({ignoreUpstream:!1},e):f==null||f.removeValue(y.id)}),e}function fbn(a,p,t,n,s){const u=s==null?void 0:s.asCastedType,e=s==null?void 0:s.rawString,f=(s==null?void 0:s.forVarInst)??!1,y=uf(p,t,{forVarInst:f});let m=!1,T=null,g=null;return n instanceof de?(m=!0,T=n,g=null):(T=null,g=n),t.diggestedBuiltInBaseEntitiesIds.has(p.id)||y.forEach(b=>{var A,O,P,x;if(t.diggestedBuiltInBaseEntitiesIds.has(b.id))return;let R=null;if(m){const $=((A=b.getDefaultValue)==null?void 0:A.call(b))||null;$&&(t.diggestedBuiltInBaseEntitiesIds.has($.id)||((O=$.parent)==null?void 0:O.id)!==b.id?R=$.clone(T,b):R=$)}else R=g==null?void 0:g.readValue(b.id);R?!m&&R&&R.id===((x=(P=b.getDefaultValue)==null?void 0:P.call(b))==null?void 0:x.id)&&(R=Pn(b.getDataType(null),b,t)):m?(R=RE(b.getDataType(null),b,t,T),T==null||T.add(R,ye.Added)):R=Pn(b.getDataType(null),b,t),R==null||R.setValueAsType(null,T);let I=u||(R==null?void 0:R.name);(!(R!=null&&R.name)||(R==null?void 0:R.name)===me.Untyped)&&!u&&(typeof a=="string"?I=me.String:a===null?I=me.Null:typeof a=="number"?I=me.Number:typeof a=="boolean"&&(I=me.Boolean)),R==null||R.metaSync({value:a,name:I,rawString:e!==void 0?e:null},T),m||g==null||g.writeValue(b,R)}),T}function aT(a,p,t,n){let s=!1,u=null,e=null;n instanceof de?(s=!0,u=n,e=null):(u=null,e=n);const f=a.parent;return p.getVariableDeclarations().forEach(m=>{var g,b,R,I,A;const T=m.getDataType(null);if(((g=T==null?void 0:T.entity)==null?void 0:g.id)===f.id){let O=s?m.defaultValue:e==null?void 0:e.readValue(m.id);O?!s&&O&&O.id===((b=m.defaultValue)==null?void 0:b.id)&&(O=Pn(m.getDataType(null),m,p)):s?O=RE(m.getDataType(null),m,p,u):O=Pn(m.getDataType(null),m,p);const P=Ve(a,p),x=a.codeName||((R=a.extends)==null?void 0:R.codeName)||((I=a.implements[0])==null?void 0:I.codeName)||jn(P);let $={};const U=(A=m.dataType)==null?void 0:A.entity;if((U==null?void 0:U.type)===r.DefinitionEntity)$={...$,...U.getActiveRawDefaultValue()};else if((U==null?void 0:U.type)===r.BuiltInBaseEntity)$={...$,...U.getRawDefaultValue()};else if((U==null?void 0:U.type)===r.PrimitiveEntity&&Sd(U,me.KeyValue)){const Z={};U.properties.forEach(q=>{var ie;if(!vp(q)||!q.defaultValue)return;const H=De(q,p),Y=q.codeName||ho(q,p)||Zs(jn(H));Z[Y]=((ie=q.getDefaultValue())==null?void 0:ie.value)||null}),$={...$,...Z}}ks(O==null?void 0:O.value)&&($={...$,...O.value}),Array.isArray(t)?$[x]=(t==null?void 0:t.map(Z=>Z.toShallowJSON()))||null:$[x]=(t==null?void 0:t.toShallowJSON())||null,O==null||O.metaSync({value:$},u),s||e==null||e.writeValue(m,O);return}}),u}function pA(a,p,t,n){var R,I,A,O;let s=!1,u=null,e=null;n instanceof de?(s=!0,u=n,e=null):(u=null,e=n);const f=ba(a.parent),y=f.getDataType(null);if(!(y!=null&&y.isObject()))return u;let m=s?f.defaultValue:e==null?void 0:e.readValue(f.id);m?!s&&m&&m.id===((R=f.defaultValue)==null?void 0:R.id)&&(m=Pn(f.getDataType(null),f,p)):s?m=RE(f.getDataType(null),f,p,u):m=Pn(f.getDataType(null),f,p);const T=Ve(a,p),g=a.codeName||((I=a.declaration)==null?void 0:I.codeName)||jn(T);let b={};if(((O=(A=f.dataType)==null?void 0:A.entity)==null?void 0:O.type)===r.DefinitionEntity&&(b={...b,...f.dataType.entity.getActiveRawDefaultValue()}),ks(m==null?void 0:m.value)&&(b={...b,...m.value}),Array.isArray(t)?b[g]=(t==null?void 0:t.map(P=>P.toShallowJSON()))||null:b[g]=(t==null?void 0:t.toShallowJSON())||null,m==null||m.metaSync({value:b},u),s||e==null||e.writeValue(f,m),t==null&&a.type===r.OutputMap){const P=f.inputs.find(x=>{var $,U;return(($=x.declaration)==null?void 0:$.id)===((U=a.declaration)==null?void 0:U.id)||Ve(x,p)===T});if(P){let x=s?P.defaultValue:e==null?void 0:e.readValue(P.id);x&&(Array.isArray(t)?x==null||x.setValueAsTypeList(t,u):x==null||x.setValueAsTypeSingle(t,u)),s||e==null||e.removeValue(P.id)}}return u}function rTt(a,p,t){var n,s,u,e;return a.type===r.InputMap?((n=a.declaration)==null?void 0:n.type)===r.Property&&a.declaration.static?aT(a.declaration,p,null,t):Yi.includes(a.parent.type)&&((s=a.declaration)==null?void 0:s.type)===r.Property&&pA(a,p,null,t):a.type===r.OutputMap?((u=a.declaration)==null?void 0:u.type)===r.Property&&a.declaration.static?aT(a.declaration,p,null,t):Yi.includes(a.parent.type)&&((e=a.declaration)==null?void 0:e.type)===r.Property&&pA(a,p,null,t):a.type===r.Property&&a.static&&aT(a,p,null,t),t}function aTt(a,p,t,n){var s,u,e,f;return p.type===r.InputMap?((s=p.declaration)==null?void 0:s.type)===r.Property&&p.declaration.static?aT(p.declaration,t,a,n):Yi.includes(p.parent.type)&&((u=p.declaration)==null?void 0:u.type)===r.Property&&pA(p,t,a,n):p.type===r.OutputMap?((e=p.declaration)==null?void 0:e.type)===r.Property&&p.declaration.static?aT(p.declaration,t,null,n):Yi.includes(p.parent.type)&&((f=p.declaration)==null?void 0:f.type)===r.Property&&pA(p,t,null,n):p.type===r.Property&&p.static&&aT(p,t,a,n),n}function ybn(a,p,t){const n=t instanceof de,s=uf(a,p,{forVarInst:n});let u=!1,e=null,f=null;return t instanceof de?(u=!0,e=t,f=null):(e=null,f=t),s.forEach(y=>{let m=u?y.defaultValue:f==null?void 0:f.readValue(y.id);u?m==null||m.remove({ignoreUpstream:!1},e):f==null||f.removeValue(y.id),rTt(y,p,t)}),e}function hbn(a,p,t,n){const s=n instanceof de,u=uf(p,t,{forVarInst:s});let e=!1,f=null,y=null;return n instanceof de?(e=!0,f=n,y=null):(f=null,y=n),u.forEach(m=>{var g,b;let T=e?m.defaultValue:y==null?void 0:y.readValue(m.id);T?!e&&T&&T.id===((b=(g=m.getDefaultValue)==null?void 0:g.call(m))==null?void 0:b.id)&&(T=Pn(m.getDataType(null),m,m.project)):e?T=RE(m.getDataType(null),m,t,f):T=Pn(m.getDataType(null),m,t),Array.isArray(a)?T==null||T.setValueAsTypeList(a,f):T==null||T.setValueAsTypeSingle(a,f),T==null||T.metaSync({value:null},f),e||y==null||y.writeValue(m,T),aTt(a,m,t,n)}),f}function Xr(a,p){let t=a;return a&&a.parent&&a.project.get(a.id)&&(t=t.clone(null,null,null,!1),t.setStandaloneParent(p,null)),t}class cV{constructor(p,t){this.extensionsRegistry=p,this.contextType=t,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,t){this.extensionsRegistry.on(p,t)}emit(p,...t){this.extensionsRegistry.emit(p,...t)}off(p,t){this.extensionsRegistry.off(p,t)}emitAsync(p,...t){return this.extensionsRegistry.emitAsync(p,...t)}emitAsyncAll(p,...t){return this.extensionsRegistry.emitAsyncAll(p,...t)}emitAsyncAllSettled(p,...t){return this.extensionsRegistry.emitAsyncAllSettled(p,...t)}emitAsyncSequentially(p,...t){return this.extensionsRegistry.emitAsyncSequentially(p,...t)}emitAsyncSequentiallyAll(p,...t){return this.extensionsRegistry.emitAsyncSequentiallyAll(p,...t)}emitAsyncSequentiallyAllSettled(p,...t){return this.extensionsRegistry.emitAsyncSequentiallyAllSettled(p,...t)}}var _e=(a=>(a[a.High=1]="High",a[a.Normal=5]="Normal",a[a.Low=10]="Low",a))(_e||{}),Q=(a=>(a.Logic="logic",a.EditorGUI="editor-gui",a.GUI="gui",a.Editor="editor",a.Compile="compile",a.PublicationRun="publication-run",a))(Q||{}),$e=(a=>(a.All="*",a.OnAll="on:*",a.EmitAll="emit:*",a.ReadAll="read:*",a.WriteAll="write:*",a.UpdateAll="update:*",a.DoAll="do:*",a.OnLogicAll="on:logic:*",a.EmitLogicAll="emit:logic:*",a.ReadLogicAll="read:logic:*",a.WriteLogicAll="write:logic:*",a.UpdateLogicAll="update:logic:*",a.DoLogicAll="do:logic:*",a.OnGUIAll="on:gui:*",a.EmitGUIAll="emit:gui:*",a.ReadGUIAll="read:gui:*",a.WriteGUIAll="write:gui:*",a.UpdateGUIAll="update:gui:*",a.DoGUIAll="do:gui:*",a.OnEditorAll="on:editor:*",a.EmitEditorAll="emit:editor:*",a.ReadEditorAll="read:editor:*",a.WriteEditorAll="write:editor:*",a.UpdateEditorAll="update:editor:*",a.DoEditorAll="do:editor:*",a.OnCompileBefore="on:compile:before:DefinitionEntity",a.OnCompileDefault="on:compile:default:DefinitionEntity",a.OnCompileAfter="on:compile:after:DefinitionEntity",a.EmitCompile="emit:compile:DefinitionEntity",a.DoEditorPublish="do:editor:publish",a.PostGUICanvasSlotNewToolbarButton="write:gui:canvas:slot:toolbar-button",a.ReadGUICanvasSlotToolbarButtons="read:gui:canvas:slot:toolbar-buttons",a.UpdateGUIGlobalTheme="update:gui:global:theme",a))($e||{});class sTt{constructor(p){C(this,"state",new Map);p&&(this.state=new Map(Object.entries(p)))}get(p){return this.state.get(p)}set(p,t){this.state.set(p,t)}delete(p){this.state.delete(p)}}class lTt extends sTt{constructor(p,t){super(t),this.parentExtension=p}}class Ge{constructor(p,t){C(this,"manifest");C(this,"module");C(this,"state");this.extensionsRegistry=p,this.state=new lTt(this,t)}}class UL extends cV{constructor(t,n){super(t,Q.Logic);C(this,"id");this._project=n,this.id=n.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(t){return this._project.persistChangeSetSequentially(t)}toLatestChangeSet(t,n,s,u=!1,e="here-this"){return this._project.toLatestChangeSet(t,n,s,u,e)}addChangeSet(t){return this._project.addChangeSet(t)}discardChangeSet(t){return this._project.discardChangeSet(t)}subscribeDependents(t){return this._project.subscribeDependents(t)}unsubscribeDependents(t){return this._project.unsubscribeDependents(t)}syncDependents(t){return this._project.syncDependents(t)}onDetachedDependencyRemoved(t,n,s){return this._project.onDetachedDependencyRemoved(t,n,s)}onDetachedDependencyRestored(t,n,s){return this._project.onDetachedDependencyRestored(t,n,s)}increaseVersion(t){return this._project.increaseVersion(t)}captureVersion(){return this._project.captureVersion()}restoreVersion(t){return this._project.restoreVersion(t)}updateWithShallowTransfer(t,n){return this._project.updateWithShallowTransfer(t,n)}hydrateAncestors(){return this._project.hydrateAncestors()}afterAllChildrenInitialized(t=null){return this._project.afterAllChildrenInitialized(t)}addSelfToProject(t){return this._project.addSelfToProject(t)}get instancesList(){return[...this._project.instancesList]}isOperationDeclaration(t){return this._project.isOperationDeclaration(t)}isGlobalEventActionDescriptor(t){return this._project.isGlobalEventActionDescriptor(t)}isLoopDeclaration(t){return this._project.isLoopDeclaration(t)}isConditionDeclaration(t){return this._project.isConditionDeclaration(t)}findSubscribedBuiltInInstance(t){return this._project.findSubscribedBuiltInInstance(t)}get(t){return this._project.get(t)}getDeleted(t){return this._project.getDeleted(t)}getManaged(t){return this._project.getManaged(t)}getBuiltIn(t){return this._project.getBuiltIn(t)}findSubscribedInstanceFromReference(t){return this._project.findSubscribedInstanceFromReference(t)}findSubscribedBuiltInInstanceFromReference(t){return this._project.findSubscribedBuiltInInstanceFromReference(t)}metaSync(t,n){return this._project.metaSync(t,n)}getAllBuiltInIds(){return this._project.getAllBuiltInIds()}getAllBuiltIn(){return this._project.getAllBuiltIn()}toFlat(t){return this._project.toFlat(t)}toFlatIds(t){return this._project.toFlatIds(t)}toMeta(){return this._project.toMeta()}toJSON(t){return this._project.toJSON(t)}toJSONClone(t){return this._project.toJSONClone(t)}toReference(t){return this._project.toReference(t)}toShallowJSON(t){return this._project.toShallowJSON(t)}toFlatJSON(t){return this._project.toFlatJSON(t)}toGenerationTarget(t){return this._project.toGenerationTarget(t)}toFlatGenerationTarget(t){return this._project.toFlatGenerationTarget(t)}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(t){return this._project.addDefinitionEntity(t)}addFunctionDeclaration(t){return this._project.addFunctionDeclaration(t)}addFunctionCall(t){return this._project.addFunctionCall(t)}addVariableDeclaration(t){return this._project.addVariableDeclaration(t)}addVariableInstance(t){return this._project.addVariableInstance(t)}addInstalledProject(t){return this._project.addInstalledProject(t)}addGlobalEvent(t){return this._project.addGlobalEvent(t)}addCondition(t){return this._project.addCondition(t)}addOperation(t){return this._project.addOperation(t)}addLoop(t){return this._project.addLoop(t)}addSearch(t){return this._project.addSearch(t)}removeDefinitionEntity(t){return this._project.removeDefinitionEntity(t)}removeCondition(t){return this._project.removeCondition(t)}removeOperation(t){return this._project.removeOperation(t)}removeLoop(t){return this._project.removeLoop(t)}removeSearch(t){return this._project.removeSearch(t)}removeFunctionCall(t){return this._project.removeFunctionCall(t)}removeVariableInstance(t){return this._project.removeVariableInstance(t)}removeVariableDeclaration(t){return this._project.removeVariableDeclaration(t)}removeFunctionDeclaration(t){return this._project.removeFunctionDeclaration(t)}removeInstalledProject(t){return this._project.removeInstalledProject(t)}removeGlobalEvent(t){return this._project.removeGlobalEvent(t)}removeTopLevelVariableDeclaration(t){return this._project.removeTopLevelVariableDeclaration(t)}getEntryPoints(){return this._project.getEntryPoints()}getTerminationStatements(){return this._project.getTerminationStatements()}getFunctionDeclaration(t){return this._project.getFunctionDeclaration(t)}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(t,n=!1){return this._project.requestActiveDynamicValue(t,n)}undo(){return this._project.undo()}redo(){return this._project.redo()}applyExternalChangeSet(t){return this._project.applyExternalChangeSet(t)}toFullProjectTransfer(){return this._project.toFullProjectTransfer()}}function mbn(a,p){return p instanceof UL?p:new UL(a,p)}const vi="built-in-function-implementations__",ze="operations-implementations__",Nd="conditions-implementations__",Ga="example-values-generator__",je={UUID:"uuid",SEARCH_NODE_IMPLEMENTATION:"search-node-implementation",BUILT_IN_FUNCTION_IMPLEMENTATIONS__ABORT_EXECUTION:vi+ja.AbortExecution,BUILT_IN_FUNCTION_IMPLEMENTATIONS__CREATE_PERSISTED_ENTITY:vi+ja.CreatePersistedEntity,BUILT_IN_FUNCTION_IMPLEMENTATIONS__UPDATE_PERSISTED_ENTITY:vi+ja.UpdatePersistedEntity,BUILT_IN_FUNCTION_IMPLEMENTATIONS__DELETE_PERSISTED_ENTITY:vi+ja.DeletePersistedEntity,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__VALUES_MERGE_EMPTY:ze+ss.MergeEmpty,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__VALUES_MERGE_FALSY:ze+ss.MergeFalsy,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_EMPTY:ze+Hi.Empty,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_NOT_EMPTY:ze+Hi.NotEmpty,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_PRIMITIVE_EQUAL:ze+Hi.PrimitiveEqual,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_PRIMITIVE_NOT_EQUAL:ze+Hi.PrimitiveNotEqual,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__HTTP_REQUEST:ze+Us.HttpRequest,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_SQL:ze+Ju.ExecuteSQL,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__VALIDATE_ENTITY:ze+Ke.Validate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_WAIT:ze+ld.Wait,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_JOIN:ze+Re.Join,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SPLIT:ze+Re.Split,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_LAST_N_ITEMS:ze+Re.DeleteLastNItems,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_FIRST_N_ITEMS:ze+Re.DeleteFirstNItems,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_AT_INDEX:ze+Re.DeleteAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_ADD_AT_INDEX:ze+Re.AddAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_FIRST_N_ITEMS:ze+Re.ReplaceFirstNItems,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_LAST_N_ITEMS:ze+Re.ReplaceLastNItems,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_ALL:ze+Re.ReplaceAll,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_AT_INDEX:ze+Re.ReplaceAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_INDEX_ITEM:ze+Re.GetIndexItem,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_FIRST:ze+Re.GetFirst,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST:ze+Re.GetLast,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_APPEND:ze+Re.Append,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PREPEND:ze+Re.Prepend,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REVERSE:ze+Re.Reverse,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LENGTH:ze+Re.GetLength,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_FIRST_N_ITEMS:ze+Re.GetFirstNItems,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST_N_ITEMS:ze+Re.GetLastNItems,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SLICE:ze+Re.Slice,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONCAT:ze+Re.Concat,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_INDEX_OF:ze+Re.GetIndexOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST_INDEX_OF:ze+Re.GetLastIndexOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_UNIQUE:ze+Re.Unique,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_FLATTEN:ze+Re.Flatten,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SORT:ze+Re.Sort,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SHUFFLE:ze+Re.Shuffle,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CHUNK:ze+Re.Chunk,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PAD_START:ze+Re.PadStart,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PAD_END:ze+Re.PadEnd,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPEAT:ze+Re.Repeat,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LENGTH:ze+he.GetLength,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TO_LOWER_CASE:ze+he.ToLowerCase,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TO_UPPER_CASE:ze+he.ToUpperCase,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_JOIN:ze+he.Join,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONTAINS:ze+Re.Contains,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONTAINS_ALL:ze+Re.ContainsAll,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONTAINS_ANY:ze+Re.ContainsAny,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT_AT_INDEX:ze+he.SplitAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT_AT_ALL_SEPARATORS:ze+he.SplitAtAllSeparators,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT_AT_FIRST_SEPARATOR:ze+he.SplitAtFirstSeparator,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT_AT_LAST_SEPARATOR:ze+he.SplitAtLastSeparator,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_LAST_N_CHARS:ze+he.DeleteLastNChars,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_FIRST_N_CHARS:ze+he.DeleteFirstNChars,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_AT_INDEX:ze+he.DeleteAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ADD_AT_INDEX:ze+he.AddAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_FIRST_N_CHARS:ze+he.ReplaceFirstNChars,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_LAST_N_CHARS:ze+he.ReplaceLastNChars,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_AT_INDEX:ze+he.ReplaceAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_FIRST_MATCH:ze+he.ReplaceFirstMatch,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_LAST_MATCH:ze+he.ReplaceLastMatch,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_ALL_MATCHES:ze+he.ReplaceAllMatches,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_INDEX_ITEM:ze+he.GetIndexItem,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_FIRST_N_CHARS:ze+he.GetFirstNChars,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LAST_N_CHARS:ze+he.GetLastNChars,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_INDEX_OF:ze+he.GetIndexOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_APPEND:ze+he.Append,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PREPEND:ze+he.Prepend,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REVERSE:ze+he.Reverse,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TRIM:ze+he.Trim,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TRIM_START:ze+he.TrimStart,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TRIM_END:ze+he.TrimEnd,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SUBSTRING:ze+he.Substring,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SLICE:ze+he.Slice,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PAD_START:ze+he.PadStart,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PAD_END:ze+he.PadEnd,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPEAT:ze+he.Repeat,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LAST_INDEX_OF:ze+he.GetLastIndexOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_MATCH_REGEX:ze+he.MatchRegex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_MATCH_ALL_REGEX:ze+he.MatchAllRegex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SEARCH_REGEX:ze+he.SearchRegex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_REGEX:ze+he.ReplaceRegex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_NORMALIZE_UNICODE:ze+he.NormalizeUnicode,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REMOVE_DIACRITICS:ze+he.RemoveDiacritics,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_COUNT_OCCURRENCES:ze+he.CountOccurrences,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ENSURE_PREFIX:ze+he.EnsurePrefix,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ENSURE_SUFFIX:ze+he.EnsureSuffix,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REMOVE_PREFIX:ze+he.RemovePrefix,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REMOVE_SUFFIX:ze+he.RemoveSuffix,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ADDITION:ze+Ae.Addition,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SUBTRACTION:ze+Ae.Subtraction,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MULTIPLICATION:ze+Ae.Multiplication,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_DIVISION:ze+Ae.Division,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_REMAINDER:ze+Ae.Remainder,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_EXPONENTIATION:ze+Ae.Exponentiation,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ABSOLUTE:ze+Ae.Absolute,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SIGN:ze+Ae.Sign,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ROUND:ze+Ae.Round,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_NEGATE:ze+Ae.Negate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_FLOOR:ze+Ae.Floor,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_CEIL:ze+Ae.Ceil,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_CLAMP:ze+Ae.Clamp,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TRUNC:ze+Ae.Trunc,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ROUND_TO_DECIMALS:ze+Ae.RoundToDecimals,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SNAP_TO_STEP:ze+Ae.SnapToStep,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MAP_RANGE:ze+Ae.MapRange,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_AVERAGE:ze+Ae.Average,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MEDIAN:ze+Ae.Median,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MIN_OF:ze+Ae.MinOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MAX_OF:ze+Ae.MaxOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SQUARE_ROOT:ze+Ae.SquareRoot,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_CUBE_ROOT:ze+Ae.CubeRoot,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_NTH_ROOT:ze+Ae.NthRoot,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_EXP:ze+Ae.Exp,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LOG_NATURAL:ze+Ae.LogNatural,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LOG10:ze+Ae.Log10,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SIN:ze+Ae.Sin,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_COS:ze+Ae.Cos,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TAN:ze+Ae.Tan,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ASIN:ze+Ae.Asin,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ACOS:ze+Ae.Acos,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ATAN:ze+Ae.Atan,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ATAN2:ze+Ae.Atan2,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TO_RADIANS:ze+Ae.ToRadians,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TO_DEGREES:ze+Ae.ToDegrees,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_PERCENT_OF:ze+Ae.PercentOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_PERCENTAGE_CHANGE:ze+Ae.PercentageChange,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MORE_THAN:ze+Ae.MoreThan,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LESS_THAN:ze+Ae.LessThan,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LESS_THAN_OR_EQUAL:ze+Ae.LessThanOrEqual,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MORE_THAN_OR_EQUAL:ze+Ae.MoreThanOrEqual,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_INTEGER:ze+Ot.GenerateRandomInteger,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_FLOAT:ze+Ot.GenerateRandomFloat,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_HEXADECIMAL:ze+Ot.GenerateRandomHexadecimal,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE62:ze+Ot.GenerateRandomBase62,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE64:ze+Ot.GenerateRandomBase64,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_ALPHANUMERIC:ze+Ot.GenerateRandomAlphanumeric,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_IDENTIFIER:ze+Ot.GenerateIdentifier,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_UUIDV4:ze+Ot.GenerateRandomUUIDv4,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_SHORT_IDENTIFIER:ze+Ot.GenerateShortIdentifier,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_HEXADECIMAL_TOKEN:ze+Ot.GenerateHexadecimalToken,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_STARTS_WITH:ze+he.StartsWith,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ENDS_WITH:ze+he.EndsWith,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_CONTAINS:ze+he.Contains,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_MATCHES_REGEX:ze+he.MatchesRegex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_CURRENT_TIMESTAMP:ze+ne.GetCurrentTimestamp,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_FORMAT_DATE:ze+ne.FormatDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_PARSE_DATE:ze+ne.ParseDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_ADD_TO_DATE:ze+ne.AddToDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SUBTRACT_FROM_DATE:ze+ne.SubtractFromDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_DIFFERENCE_BETWEEN_DATES:ze+ne.DifferenceBetweenDates,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_DATE:ze+ne.ToDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_UNIX:ze+ne.ToUnix,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_FROM_UNIX:ze+ne.FromUnix,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_ISO_STRING:ze+ne.ToISOString,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_YEAR:ze+ne.GetYear,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_MONTH:ze+ne.GetMonth,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_DATE:ze+ne.GetDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_HOUR:ze+ne.GetHour,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_MINUTE:ze+ne.GetMinute,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_SECOND:ze+ne.GetSecond,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_MILLISECOND:ze+ne.GetMillisecond,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_ISO_WEEKDAY:ze+ne.GetIsoWeekday,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_WEEK_OF_YEAR:ze+ne.GetWeekOfYear,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_QUARTER:ze+ne.GetQuarter,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_DAY_OF_YEAR:ze+ne.GetDayOfYear,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_DAYS_IN_MONTH:ze+ne.GetDaysInMonth,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_CURRENT_IANA_TIMEZONE:ze+ne.GetCurrentIanaTimeZone,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_YEAR:ze+ne.SetYear,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_MONTH:ze+ne.SetMonth,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_DATE:ze+ne.SetDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_HOUR:ze+ne.SetHour,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_MINUTE:ze+ne.SetMinute,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_SECOND:ze+ne.SetSecond,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_MILLISECOND:ze+ne.SetMillisecond,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_ISO_WEEKDAY:ze+ne.SetIsoWeekday,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_QUARTER:ze+ne.SetQuarter,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_START_OF:ze+ne.StartOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_END_OF:ze+ne.EndOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_ROUND_TO:ze+ne.RoundTo,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_BEFORE:Nd+ne.IsBefore,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_AFTER:Nd+ne.IsAfter,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_SAME:Nd+ne.IsSame,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_SAME_OR_BEFORE:Nd+ne.IsSameOrBefore,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_SAME_OR_AFTER:Nd+ne.IsSameOrAfter,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_BETWEEN:Nd+ne.IsBetween,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_VALID:Nd+ne.IsValid,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_LEAP_YEAR:Nd+ne.IsLeapYear,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_CLAMP_TO_RANGE:ze+ne.ClampToRange,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_MIN_OF:ze+ne.MinOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_MAX_OF:ze+ne.MaxOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_FROM_NOW:ze+ne.FromNow,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_NOW:ze+ne.ToNow,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_HUMANIZE_DIFF:ze+ne.HumanizeDiff,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_ADD_BUSINESS_DAYS:ze+ne.AddBusinessDays,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_NEXT_WEEKDAY:ze+ne.NextWeekday,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_PREVIOUS_WEEKDAY:ze+ne.PreviousWeekday,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_UTC:ze+ne.ToUTC,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_CONVERT_TIMEZONE:ze+ne.ConvertTimezone,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_TIMEZONE_OFFSET:ze+ne.GetTimezoneOffset,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_UTC_OFFSET:ze+ne.SetUTCOffset,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_READ_KEY:ze+Ke.ReadKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_WRITE_KEY:ze+Ke.WriteKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_DELETE_KEY:ze+Ke.DeleteKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_READ_NESTED_KEY:ze+Ke.ReadNestedKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_WRITE_NESTED_KEY:ze+Ke.WriteNestedKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_DELETE_NESTED_KEY:ze+Ke.DeleteNestedKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_WRITE_SAFE_NESTED_KEY_RECURSIVELY:ze+Ke.WriteSafeNestedKeyRecursively,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_HAS_KEY:Nd+Ke.HasKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_HAS_NESTED_KEY:Nd+Ke.HasNestedKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_KEY_VALUE_EQUALS:Nd+Ke.KeyValueEquals,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_NESTED_KEY_VALUE_EQUALS:Nd+Ke.NestedKeyValueEquals,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_IS_INSTANCE_OF_TYPE:Nd+Ke.IsInstanceOfType,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_MERGE:ze+Ke.Merge,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_KEYS:ze+Ke.Keys,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_VALUES:ze+Ke.Values,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_ENTRIES:ze+Ke.Entries,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_GET_TYPE_OF:ze+Qe.GetTypeOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_HASH:ze+Ui.Hash,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_HMAC:ze+Ui.Hmac,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_GENERATE_RANDOM_BYTES:ze+Ot.GenerateRandomBytes,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_CONSTANT_TIME_EQUAL:ze+Ui.ConstantTimeEqual,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_DERIVE_KEY_PBKDF2:ze+Ui.DeriveKeyPBKDF2,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__PASSWORD_HASH_PBKDF2:ze+Ia.HashPasswordPBKDF2,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__PASSWORD_VERIFY_PBKDF2:ze+Ia.VerifyPasswordPBKDF2,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_BUILD_HMAC:ze+un.BuildJwtHmac,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_VERIFY_HMAC:ze+un.VerifyJwtHmac,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_DECODE:ze+un.DecodeJwt,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_FROM_BYTES_TO_STRING:ze+Qe.FromBytesToString,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_BYTES:ze+Qe.ToBytes,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_NUMBER:ze+Qe.ToNumber,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_STRING:ze+Qe.ToString,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_BASE64:ze+Qe.EncodeBase64,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_BASE64:ze+Qe.DecodeBase64,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_BASE64URL:ze+Qe.EncodeBase64Url,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_BASE64URL:ze+Qe.DecodeBase64Url,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_HEX:ze+Qe.EncodeHex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_HEX:ze+Qe.DecodeHex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_PARSE_MULTIPART_BODY:ze+Qe.ParseMultipartBody,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_PARSE_DATA_URI:ze+Qe.ParseDataUri,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DETECT_MIME_TYPE_FROM_BYTES:ze+Qe.DetectMimeTypeFromBytes,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_PARSE_SPREADSHEET_RANGE_TO_A1:ze+Qe.ParseSpreadsheetRangeToA1,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_PARSE_A1_TO_SPREADSHEET_RANGE:ze+Qe.ParseA1ToSpreadsheetRange,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_BYTES_TO_FILE_REFERENCE:ze+Qe.BytesToFileReference,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_FILE_REFERENCE_TO_BYTES:ze+Qe.FileReferenceToBytes,BUILT_IN_OPERATIONS_IMPLEMENTATIONS__JSON_PARSE:ze+js.Parse,BUILT_IN_OPERATIONS_IMPLEMENTATIONS__JSON_STRINGIFY:ze+js.Stringify,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_UPLOAD_FILE:ze+Ye.UploadFile,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_GET_FILE:ze+Ye.GetFile,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_DOWNLOAD_FILE:ze+Ye.DownloadFile,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_LIST_FILES:ze+Ye.ListFiles,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_DELETE_FILE:ze+Ye.DeleteFile,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_DELETE_FILES:ze+Ye.DeleteFiles,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_COPY_FILE:ze+Ye.CopyFile,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_MOVE_FILE:ze+Ye.MoveFile,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_RENAME_FILE:ze+Ye.RenameFile,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_GET_FILE_METADATA:ze+Ye.GetFileMetadata,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_CHECK_FILE_EXISTS:ze+Ye.CheckFileExists,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_GET_PRESIGNED_URL:ze+Ye.GetPresignedUrl,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_SET_FILE_ACCESS:ze+Ye.SetFileAccess,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_CREATE_FOLDER:ze+Ye.CreateFolder,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_DELETE_FOLDER:ze+Ye.DeleteFolders,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_DELETE_FOLDERS:ze+Ye.DeleteFolders,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_CREATE_MULTIPART_UPLOAD:ze+Ye.CreateMultipartUpload,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_GET_UPLOAD_PART_PRESIGNED_URL:ze+Ye.GetUploadPartPresignedUrl,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_COMPLETE_MULTIPART_UPLOAD:ze+Ye.CompleteMultipartUpload,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_ABORT_MULTIPART_UPLOAD:ze+Ye.AbortMultipartUpload,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_UPLOAD_FILE_PART:ze+Ye.UploadFilePart};class oTt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.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:[$e.All],contexts:[Q.Editor]});C(this,"module",{main:async(t,n)=>({value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,entity:t,error:null,result:null})})}}class dTt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_IN_FUNCTION_IMPLEMENTATIONS__DELETE_PERSISTED_ENTITY,version:"1.0.0",description:'Implementation for the built-in function "Delete SQL database table". It deletes the current entity as an entry in the persisted storage.',initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor]});C(this,"module",{main:async(t,n)=>({value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,entity:t,error:null,result:null})})}}class pTt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_IN_FUNCTION_IMPLEMENTATIONS__CREATE_PERSISTED_ENTITY,version:"1.0.0",description:'Implementation for the built-in function "Create SQL database table". It saves the current entity state to the persisted storage.',initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor]});C(this,"module",{main:async(t,n)=>({value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,entity:t,error:null,result:null})})}}class uTt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_IN_FUNCTION_IMPLEMENTATIONS__UPDATE_PERSISTED_ENTITY,version:"1.0.0",description:'Implementation for the built-in function "Update SQL database table". It saves the current entity state to the persisted storage.',initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor]});C(this,"module",{main:async(t,n)=>({value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,entity:t,error:null,result:null})})}}class cTt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.SEARCH_NODE_IMPLEMENTATION,version:"1.0.0",description:"Implementation for search nodes when they get executed and query data.",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor]});C(this,"module",{main:async(t,n)=>({error:"Search module not implemented",data:null})})}}class fTt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.UUID,version:"1.0.0",description:"UUID generation module, for all contexts and runtimes",initPriority:_e.High,permissions:[$e.All],contexts:[]});C(this,"module",_2)}}class yTt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_EMPTY,version:"1.0.0",description:"Comparison: Empty (!value)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic);if(!n)return;const s=n.get(Hi.Empty);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[Hi.Empty].inputs.leftHand.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=f==null;return{value:K.Success,error:null,result:y}}catch(e){return{value:K.UnhandledError,error:e,result:null}}}})}}class hTt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_NOT_EMPTY,version:"1.0.0",description:"Comparison: NotEmpty (!!value)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic);if(!n)return;const s=n.get(Hi.NotEmpty);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[Hi.NotEmpty].inputs.leftHand.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=f!=null;return{value:K.Success,error:null,result:y}}catch(e){return{value:K.UnhandledError,error:e,result:null}}}})}}const IO=class IO extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_PRIMITIVE_EQUAL,version:"1.0.0",description:"Comparison: PrimitiveEqual (typed equality / deep JSON equality)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic);if(!n)return;const s=n.get(Hi.PrimitiveEqual);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=(u=(s=n[0])==null?void 0:s.value)==null?void 0:u.name,g=(f=(e=n[0])==null?void 0:e.value)==null?void 0:f.value,b=(m=(y=n[1])==null?void 0:y.value)==null?void 0:m.value;let R=!1;return T&&IO.primitiveSet.has(T)?R=g===b:T===me.Untyped||T===me.KeyValue?R=JSON.stringify(g)===JSON.stringify(b):R=!1,{value:K.Success,error:null,result:R}}catch(T){return{value:K.UnhandledError,error:T,result:null}}}})}};C(IO,"primitiveSet",new Set([me.String,me.Number,me.Boolean,me.Null,me.Enum,me.Date,me.UUID]));let Jw=IO;const RO=class RO extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_PRIMITIVE_NOT_EQUAL,version:"1.0.0",description:"Comparison: PrimitiveNotEqual (typed inequality / deep JSON inequality)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic);if(!n)return;const s=n.get(Hi.PrimitiveNotEqual);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=(u=(s=n[0])==null?void 0:s.value)==null?void 0:u.name,g=(f=(e=n[0])==null?void 0:e.value)==null?void 0:f.value,b=(m=(y=n[1])==null?void 0:y.value)==null?void 0:m.value;let R=!1;return T&&RO.primitiveSet.has(T)?R=g!==b:T===me.Untyped||T===me.KeyValue?R=JSON.stringify(g)!==JSON.stringify(b):R=!1,{value:K.Success,error:null,result:R}}catch(T){return{value:K.UnhandledError,error:T,result:null}}}})}};C(RO,"primitiveSet",new Set([me.String,me.Number,me.Boolean,me.Null,me.Enum,me.Date,me.UUID]));let Qw=RO;var mTt={exports:{}};(function(a,p){(function(t,n){a.exports=n()})(os,function(){var t="minute",n=/[+-]\d\d(?::?\d\d)?/g,s=/([+-]|\d\d)/g;return function(u,e,f){var y=e.prototype;f.utc=function(A){var O={date:A,utc:!0,args:arguments};return new e(O)},y.utc=function(A){var O=f(this.toDate(),{locale:this.$L,utc:!0});return A?O.add(this.utcOffset(),t):O},y.local=function(){return f(this.toDate(),{locale:this.$L,utc:!1})};var m=y.parse;y.parse=function(A){A.utc&&(this.$u=!0),this.$utils().u(A.$offset)||(this.$offset=A.$offset),m.call(this,A)};var T=y.init;y.init=function(){if(this.$u){var A=this.$d;this.$y=A.getUTCFullYear(),this.$M=A.getUTCMonth(),this.$D=A.getUTCDate(),this.$W=A.getUTCDay(),this.$H=A.getUTCHours(),this.$m=A.getUTCMinutes(),this.$s=A.getUTCSeconds(),this.$ms=A.getUTCMilliseconds()}else T.call(this)};var g=y.utcOffset;y.utcOffset=function(A,O){var P=this.$utils().u;if(P(A))return this.$u?0:P(this.$offset)?g.call(this):this.$offset;if(typeof A=="string"&&(A=function(Z){Z===void 0&&(Z="");var q=Z.match(n);if(!q)return null;var H=(""+q[0]).match(s)||["-",0,0],Y=H[0],ie=60*+H[1]+ +H[2];return ie===0?0:Y==="+"?ie:-ie}(A),A===null))return this;var x=Math.abs(A)<=16?60*A:A;if(x===0)return this.utc(O);var $=this.clone();if(O)return $.$offset=x,$.$u=!1,$;var U=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return($=this.local().add(x+U,t)).$offset=x,$.$x.$localOffset=U,$};var b=y.format;y.format=function(A){var O=A||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return b.call(this,O)},y.valueOf=function(){var A=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*A},y.isUTC=function(){return!!this.$u},y.toISOString=function(){return this.toDate().toISOString()},y.toString=function(){return this.toDate().toUTCString()};var R=y.toDate;y.toDate=function(A){return A==="s"&&this.$offset?f(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():R.call(this)};var I=y.diff;y.diff=function(A,O,P){if(A&&this.$u===A.$u)return I.call(this,A,O,P);var x=this.local(),$=f(A).local();return I.call(x,$,O,P)}}})})(mTt);var Tbn=mTt.exports;const vbn=ip(Tbn);var TTt={exports:{}};(function(a,p){(function(t,n){a.exports=n()})(os,function(){var t={year:0,month:1,day:2,hour:3,minute:4,second:5},n={};return function(s,u,e){var f,y=function(b,R,I){I===void 0&&(I={});var A=new Date(b),O=function(P,x){x===void 0&&(x={});var $=x.timeZoneName||"short",U=P+"|"+$,Z=n[U];return Z||(Z=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:P,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:$}),n[U]=Z),Z}(R,I);return O.formatToParts(A)},m=function(b,R){for(var I=y(b,R),A=[],O=0;O<I.length;O+=1){var P=I[O],x=P.type,$=P.value,U=t[x];U>=0&&(A[U]=parseInt($,10))}var Z=A[3],q=Z===24?0:Z,H=A[0]+"-"+A[1]+"-"+A[2]+" "+q+":"+A[4]+":"+A[5]+":000",Y=+b;return(e.utc(H).valueOf()-(Y-=Y%1e3))/6e4},T=u.prototype;T.tz=function(b,R){b===void 0&&(b=f);var I,A=this.utcOffset(),O=this.toDate(),P=O.toLocaleString("en-US",{timeZone:b}),x=Math.round((O-new Date(P))/1e3/60),$=15*-Math.round(O.getTimezoneOffset()/15)-x;if(!Number($))I=this.utcOffset(0,R);else if(I=e(P,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset($,!0),R){var U=I.utcOffset();I=I.add(A-U,"minute")}return I.$x.$timezone=b,I},T.offsetName=function(b){var R=this.$x.$timezone||e.tz.guess(),I=y(this.valueOf(),R,{timeZoneName:b}).find(function(A){return A.type.toLowerCase()==="timezonename"});return I&&I.value};var g=T.startOf;T.startOf=function(b,R){if(!this.$x||!this.$x.$timezone)return g.call(this,b,R);var I=e(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return g.call(I,b,R).tz(this.$x.$timezone,!0)},e.tz=function(b,R,I){var A=I&&R,O=I||R||f,P=m(+e(),O);if(typeof b!="string")return e(b).tz(O);var x=function(q,H,Y){var ie=q-60*H*1e3,z=m(ie,Y);if(H===z)return[ie,H];var W=m(ie-=60*(z-H)*1e3,Y);return z===W?[ie,z]:[q-60*Math.min(z,W)*1e3,Math.max(z,W)]}(e.utc(b,A).valueOf(),P,O),$=x[0],U=x[1],Z=e($).utcOffset(U);return Z.$x.$timezone=O,Z},e.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},e.tz.setDefault=function(b){f=b}}})})(TTt);var gbn=TTt.exports;const bbn=ip(gbn);var vTt={exports:{}};(function(a,p){(function(t,n){a.exports=n()})(os,function(){return function(t,n,s){n.prototype.isBetween=function(u,e,f,y){var m=s(u),T=s(e),g=(y=y||"()")[0]==="(",b=y[1]===")";return(g?this.isAfter(m,f):!this.isBefore(m,f))&&(b?this.isBefore(T,f):!this.isAfter(T,f))||(g?this.isBefore(m,f):!this.isAfter(m,f))&&(b?this.isAfter(T,f):!this.isBefore(T,f))}}})})(vTt);var Ebn=vTt.exports;const Ibn=ip(Ebn);var gTt={exports:{}};(function(a,p){(function(t,n){a.exports=n()})(os,function(){return function(t,n){n.prototype.isSameOrAfter=function(s,u){return this.isSame(s,u)||this.isAfter(s,u)}}})})(gTt);var Rbn=gTt.exports;const Abn=ip(Rbn);var bTt={exports:{}};(function(a,p){(function(t,n){a.exports=n()})(os,function(){return function(t,n){n.prototype.isSameOrBefore=function(s,u){return this.isSame(s,u)||this.isBefore(s,u)}}})})(bTt);var Dbn=bTt.exports;const Cbn=ip(Dbn);var ETt={exports:{}};(function(a,p){(function(t,n){a.exports=n()})(os,function(){var t="week",n="year";return function(s,u,e){var f=u.prototype;f.week=function(y){if(y===void 0&&(y=null),y!==null)return this.add(7*(y-this.week()),"day");var m=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var T=e(this).startOf(n).add(1,n).date(m),g=e(this).endOf(t);if(T.isBefore(g))return 1}var b=e(this).startOf(n).date(m).startOf(t).subtract(1,"millisecond"),R=this.diff(b,t,!0);return R<0?e(this).startOf("week").week():Math.ceil(R)},f.weeks=function(y){return y===void 0&&(y=null),this.week(y)}}})})(ETt);var wbn=ETt.exports;const Obn=ip(wbn);var ITt={exports:{}};(function(a,p){(function(t,n){a.exports=n()})(os,function(){var t="day";return function(n,s,u){var e=function(m){return m.add(4-m.isoWeekday(),t)},f=s.prototype;f.isoWeekYear=function(){return e(this).year()},f.isoWeek=function(m){if(!this.$utils().u(m))return this.add(7*(m-this.isoWeek()),t);var T,g,b,R,I=e(this),A=(T=this.isoWeekYear(),g=this.$u,b=(g?u.utc:u)().year(T).startOf("year"),R=4-b.isoWeekday(),b.isoWeekday()>4&&(R+=7),b.add(R,t));return I.diff(A,"week")+1},f.isoWeekday=function(m){return this.$utils().u(m)?this.day()||7:this.day(this.day()%7?m:m-7)};var y=f.startOf;f.startOf=function(m,T){var g=this.$utils(),b=!!g.u(T)||T;return g.p(m)==="isoweek"?b?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):y.bind(this)(m,T)}}})})(ITt);var xbn=ITt.exports;const Pbn=ip(xbn);var RTt={exports:{}};(function(a,p){(function(t,n){a.exports=n()})(os,function(){var t="month",n="quarter";return function(s,u){var e=u.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,T){return m=Number(m),this.$utils().p(T)===n?this.add(3*m,t):f.bind(this)(m,T)};var y=e.startOf;e.startOf=function(m,T){var g=this.$utils(),b=!!g.u(T)||T;if(g.p(m)===n){var R=this.quarter()-1;return b?this.month(3*R).startOf(t).startOf("day"):this.month(3*R+2).endOf(t).endOf("day")}return y.bind(this)(m,T)}}})})(RTt);var Vbn=RTt.exports;const Nbn=ip(Vbn);var ATt={exports:{}};(function(a,p){(function(t,n){a.exports=n()})(os,function(){return function(t,n,s){n.prototype.dayOfYear=function(u){var e=Math.round((s(this).startOf("day")-s(this).startOf("year"))/864e5)+1;return u==null?e:this.add(u-e,"day")}}})})(ATt);var _bn=ATt.exports;const $bn=ip(_bn);var DTt={exports:{}};(function(a,p){(function(t,n){a.exports=n()})(os,function(){return function(t,n,s){t=t||{};var u=n.prototype,e={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function f(m,T,g,b){return u.fromToBase(m,T,g,b)}s.en.relativeTime=e,u.fromToBase=function(m,T,g,b,R){for(var I,A,O,P=g.$locale().relativeTime||e,x=t.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],$=x.length,U=0;U<$;U+=1){var Z=x[U];Z.d&&(I=b?s(m).diff(g,Z.d,!0):g.diff(m,Z.d,!0));var q=(t.rounding||Math.round)(Math.abs(I));if(O=I>0,q<=Z.r||!Z.r){q<=1&&U>0&&(Z=x[U-1]);var H=P[Z.l];R&&(q=R(""+q)),A=typeof H=="string"?H.replace("%d",q):H(q,T,Z.l,O);break}}if(T)return A;var Y=O?P.future:P.past;return typeof Y=="function"?Y(A):Y.replace("%s",A)},u.to=function(m,T){return f(m,T,this,!0)},u.from=function(m,T){return f(m,T,this)};var y=function(m){return m.$u?s.utc():s()};u.toNow=function(m){return this.to(y(this),m)},u.fromNow=function(m){return this.from(y(this),m)}}})})(DTt);var Gbn=DTt.exports;const Lbn=ip(Gbn);var CTt={exports:{}};(function(a,p){(function(t,n){a.exports=n()})(os,function(){var t,n,s=1e3,u=6e4,e=36e5,f=864e5,y=/\[([^\]]+)]|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,T=2628e6,g=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,b={years:m,months:T,days:f,hours:e,minutes:u,seconds:s,milliseconds:1,weeks:6048e5},R=function(q){return q instanceof U},I=function(q,H,Y){return new U(q,Y,H.$l)},A=function(q){return n.p(q)+"s"},O=function(q){return q<0},P=function(q){return O(q)?Math.ceil(q):Math.floor(q)},x=function(q){return Math.abs(q)},$=function(q,H){return q?O(q)?{negative:!0,format:""+x(q)+H}:{negative:!1,format:""+q+H}:{negative:!1,format:""}},U=function(){function q(Y,ie,z){var W=this;if(this.$d={},this.$l=z,Y===void 0&&(this.$ms=0,this.parseFromMilliseconds()),ie)return I(Y*b[A(ie)],this);if(typeof Y=="number")return this.$ms=Y,this.parseFromMilliseconds(),this;if(typeof Y=="object")return Object.keys(Y).forEach(function(X){W.$d[A(X)]=Y[X]}),this.calMilliseconds(),this;if(typeof Y=="string"){var ee=Y.match(g);if(ee){var te=ee.slice(2).map(function(X){return X!=null?Number(X):0});return this.$d.years=te[0],this.$d.months=te[1],this.$d.weeks=te[2],this.$d.days=te[3],this.$d.hours=te[4],this.$d.minutes=te[5],this.$d.seconds=te[6],this.calMilliseconds(),this}}return this}var H=q.prototype;return H.calMilliseconds=function(){var Y=this;this.$ms=Object.keys(this.$d).reduce(function(ie,z){return ie+(Y.$d[z]||0)*b[z]},0)},H.parseFromMilliseconds=function(){var Y=this.$ms;this.$d.years=P(Y/m),Y%=m,this.$d.months=P(Y/T),Y%=T,this.$d.days=P(Y/f),Y%=f,this.$d.hours=P(Y/e),Y%=e,this.$d.minutes=P(Y/u),Y%=u,this.$d.seconds=P(Y/s),Y%=s,this.$d.milliseconds=Y},H.toISOString=function(){var Y=$(this.$d.years,"Y"),ie=$(this.$d.months,"M"),z=+this.$d.days||0;this.$d.weeks&&(z+=7*this.$d.weeks);var W=$(z,"D"),ee=$(this.$d.hours,"H"),te=$(this.$d.minutes,"M"),X=this.$d.seconds||0;this.$d.milliseconds&&(X+=this.$d.milliseconds/1e3,X=Math.round(1e3*X)/1e3);var re=$(X,"S"),ae=Y.negative||ie.negative||W.negative||ee.negative||te.negative||re.negative,le=ee.format||te.format||re.format?"T":"",oe=(ae?"-":"")+"P"+Y.format+ie.format+W.format+le+ee.format+te.format+re.format;return oe==="P"||oe==="-P"?"P0D":oe},H.toJSON=function(){return this.toISOString()},H.format=function(Y){var ie=Y||"YYYY-MM-DDTHH:mm:ss",z={Y:this.$d.years,YY:n.s(this.$d.years,2,"0"),YYYY:n.s(this.$d.years,4,"0"),M:this.$d.months,MM:n.s(this.$d.months,2,"0"),D:this.$d.days,DD:n.s(this.$d.days,2,"0"),H:this.$d.hours,HH:n.s(this.$d.hours,2,"0"),m:this.$d.minutes,mm:n.s(this.$d.minutes,2,"0"),s:this.$d.seconds,ss:n.s(this.$d.seconds,2,"0"),SSS:n.s(this.$d.milliseconds,3,"0")};return ie.replace(y,function(W,ee){return ee||String(z[W])})},H.as=function(Y){return this.$ms/b[A(Y)]},H.get=function(Y){var ie=this.$ms,z=A(Y);return z==="milliseconds"?ie%=1e3:ie=z==="weeks"?P(ie/b[z]):this.$d[z],ie||0},H.add=function(Y,ie,z){var W;return W=ie?Y*b[A(ie)]:R(Y)?Y.$ms:I(Y,this).$ms,I(this.$ms+W*(z?-1:1),this)},H.subtract=function(Y,ie){return this.add(Y,ie,!0)},H.locale=function(Y){var ie=this.clone();return ie.$l=Y,ie},H.clone=function(){return I(this.$ms,this)},H.humanize=function(Y){return t().add(this.$ms,"ms").locale(this.$l).fromNow(!Y)},H.valueOf=function(){return this.asMilliseconds()},H.milliseconds=function(){return this.get("milliseconds")},H.asMilliseconds=function(){return this.as("milliseconds")},H.seconds=function(){return this.get("seconds")},H.asSeconds=function(){return this.as("seconds")},H.minutes=function(){return this.get("minutes")},H.asMinutes=function(){return this.as("minutes")},H.hours=function(){return this.get("hours")},H.asHours=function(){return this.as("hours")},H.days=function(){return this.get("days")},H.asDays=function(){return this.as("days")},H.weeks=function(){return this.get("weeks")},H.asWeeks=function(){return this.as("weeks")},H.months=function(){return this.get("months")},H.asMonths=function(){return this.as("months")},H.years=function(){return this.get("years")},H.asYears=function(){return this.as("years")},q}(),Z=function(q,H,Y){return q.add(H.years()*Y,"y").add(H.months()*Y,"M").add(H.days()*Y,"d").add(H.hours()*Y,"h").add(H.minutes()*Y,"m").add(H.seconds()*Y,"s").add(H.milliseconds()*Y,"ms")};return function(q,H,Y){t=Y,n=Y().$utils(),Y.duration=function(W,ee){var te=Y.locale();return I(W,{$l:te},ee)},Y.isDuration=R;var ie=H.prototype.add,z=H.prototype.subtract;H.prototype.add=function(W,ee){return R(W)?Z(this,W,1):ie.bind(this)(W,ee)},H.prototype.subtract=function(W,ee){return R(W)?Z(this,W,-1):z.bind(this)(W,ee)}}})})(CTt);var Bbn=CTt.exports;const Sbn=ip(Bbn);var wTt={exports:{}};(function(a,p){(function(t,n){a.exports=n()})(os,function(){return function(t,n){n.prototype.isLeapYear=function(){return this.$y%4==0&&this.$y%100!=0||this.$y%400==0}}})})(wTt);var Mbn=wTt.exports;const Fbn=ip(Mbn);j.extend(vbn);j.extend(bbn);j.extend(Ibn);j.extend(Abn);j.extend(Cbn);j.extend(Obn);j.extend(Pbn);j.extend(Nbn);j.extend($bn);j.extend(Lbn);j.extend(Sbn);j.extend(Fbn);const Ki=a=>j(a),ma=a=>a.toISOString();function OTt(){return ma(j())}function xTt(a,p){return Ki(a).format(p)}function PTt(a){return ma(j(a))}function VTt(a){if(a==null)throw new TypeError("ToDate expects a non-null value.");if(typeof a=="string"){const p=j(a);if(!p.isValid())throw new TypeError("Invalid date string.");return p.toISOString()}if(typeof a=="number"&&Number.isFinite(a)){const p=Math.abs(a)<1e12?j.unix(a):j(a);if(!p.isValid())throw new TypeError("Invalid numeric timestamp.");return p.toISOString()}if(a instanceof Date){const p=j(a);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 NTt(a,p,t){return ma(Ki(a).add(p,t))}function _Tt(a,p,t){return ma(Ki(a).subtract(p,t))}function $Tt(a,p,t,n=!1){return Ki(a).diff(Ki(p),t,n)}function GTt(a){return Ki(a).unix()}function LTt(a){return ma(j.unix(a))}function BTt(a){return ma(Ki(a))}function STt(a){return Ki(a).year()}function MTt(a){return Ki(a).month()}function FTt(a){return Ki(a).date()}function kTt(a){return Ki(a).hour()}function UTt(a){return Ki(a).minute()}function KTt(a){return Ki(a).second()}function jTt(a){return Ki(a).millisecond()}function qTt(a){return Ki(a).isoWeekday()}function ZTt(a){return Ki(a).week()}function HTt(a){return Ki(a).quarter()}function WTt(a){return Ki(a).dayOfYear()}function zTt(a){return Ki(a).daysInMonth()}function YTt(a,p){return ma(Ki(a).year(p))}function JTt(a,p){return ma(Ki(a).month(p))}function QTt(a,p){return ma(Ki(a).date(p))}function XTt(a,p){return ma(Ki(a).hour(p))}function evt(a,p){return ma(Ki(a).minute(p))}function tvt(a,p){return ma(Ki(a).second(p))}function ivt(a,p){return ma(Ki(a).millisecond(p))}function nvt(a,p){return ma(Ki(a).isoWeekday(p))}function rvt(a,p){return ma(Ki(a).quarter(p))}function avt(a,p){return ma(Ki(a).startOf(p))}function svt(a,p){return ma(Ki(a).endOf(p))}function lvt(a,p){const t=Ki(a),n=t.startOf(p),s=t.endOf(p),u=n.valueOf()+(s.valueOf()-n.valueOf())/2;return ma(t.valueOf()<u?n:s)}function ovt(a,p,t){return Ki(a).isBefore(Ki(p),t)}function dvt(a,p,t){return Ki(a).isAfter(Ki(p),t)}function pvt(a,p,t){return Ki(a).isSame(Ki(p),t)}function uvt(a,p,t){return Ki(a).isSameOrBefore(Ki(p),t)}function cvt(a,p,t){return Ki(a).isSameOrAfter(Ki(p),t)}function fvt(a,p,t,n,s="()"){return Ki(a).isBetween(Ki(p),Ki(t),n,s)}function yvt(a){return j(a).isValid()}function hvt(a){return Ki(a).isLeapYear()}function mvt(a,p,t){const n=Ki(a);return n.isBefore(p)?ma(Ki(p)):n.isAfter(t)?ma(Ki(t)):ma(n)}function Tvt(a){if(a.length===0)throw new Error("minOf requires at least one date");let p=Ki(a[0]);for(let t=1;t<a.length;t++){const n=Ki(a[t]);n.isBefore(p)&&(p=n)}return ma(p)}function vvt(a){if(a.length===0)throw new Error("maxOf requires at least one date");let p=Ki(a[0]);for(let t=1;t<a.length;t++){const n=Ki(a[t]);n.isAfter(p)&&(p=n)}return ma(p)}function gvt(a,p=!1){return Ki(a).fromNow(p)}function bvt(a,p=!1){return Ki(a).toNow(p)}function Evt(a,p,t=!0){const n=Ki(a).diff(Ki(p),"millisecond",!0),s=Math.abs(n),e=j.duration(s,"milliseconds").humanize();return t?n>=0?`in ${e}`:`${e} ago`:e}function Ivt(a,p,t=["6","7"],n=[]){const s=m=>n.some(T=>Ki(T).isSame(m,"day")),u=m=>((m.day()+6)%7+1).toString();let e=Ki(a);const f=p>=0?1:-1;let y=Math.abs(p);for(;y>0;){e=e.add(f,"day");const m=u(e);!t.includes(m)&&!s(e)&&y--}return ma(e)}function Rvt(a,p){let t=Ki(a);const n=p;for(let s=0;s<7;s++)if(t=t.add(1,"day"),t.isoWeekday()===n)return ma(t);return ma(t)}function Avt(a,p){let t=Ki(a);const n=p;for(let s=0;s<7;s++)if(t=t.subtract(1,"day"),t.isoWeekday()===n)return ma(t);return ma(t)}const Dvt="Local";function R4(){try{const a=Intl.DateTimeFormat().resolvedOptions().timeZone;if(a&&typeof a=="string")return a}catch{}try{if(typeof process<"u"&&process.env&&process.env.TZ)return process.env.TZ}catch{}return null}function A4(){const a=R4();if(a)return a;throw new Error("Unable to detect current IANA timezone from host environment.")}function Cvt(a,p,t=!1){let n=p;if(n===Dvt){const e=R4();if(!e)throw new Error("Unable to detect current timezone from host environment.");n=e}const s=n?j.tz(a,n):Ki(a),u=t?s.utc(!0):s.utc();return ma(u)}function wvt(a,p,t=!1){const n=Ki(a);return ma(t?n.tz(p,!0):n.tz(p))}function Ovt(a,p){const t=a===Dvt?A4():a;return Ki(p).tz(t).utcOffset()}function xvt(a,p,t=!1){return ma(Ki(a).utcOffset(p,t))}class Pvt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_CURRENT_TIMESTAMP,version:"1.0.0",description:"Date get current timestamp operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.GetCurrentTimestamp);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const s=OTt();return{value:K.Success,error:null,result:s}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class Vvt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_FORMAT_DATE,version:"1.0.0",description:"Date format operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.FormatDate);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.FormatDate].inputs.dateValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.FormatDate].inputs.format.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),b=xTt(m,g);return{value:K.Success,error:null,result:b}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class Nvt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_PARSE_DATE,version:"1.0.0",description:"Date parse operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.ParseDate);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[ne.ParseDate].inputs.inputValue.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=PTt(f);return{value:K.Success,error:null,result:y}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class _vt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_ADD_TO_DATE,version:"1.0.0",description:"Date add-to-date operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.AddToDate);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[ne.AddToDate].inputs.dateValue.id}),g=((s=T==null?void 0:T.value)==null?void 0:s.valueAsType)??((u=T==null?void 0:T.value)==null?void 0:u.value),b=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[ne.AddToDate].inputs.amount.id}),R=((e=b==null?void 0:b.value)==null?void 0:e.valueAsType)??((f=b==null?void 0:b.value)==null?void 0:f.value),I=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[ne.AddToDate].inputs.unit.id}),A=((y=I==null?void 0:I.value)==null?void 0:y.valueAsType)??((m=I==null?void 0:I.value)==null?void 0:m.value),O=NTt(g,R,A);return{value:K.Success,error:null,result:O}}catch(T){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class $vt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SUBTRACT_FROM_DATE,version:"1.0.0",description:"Date subtract-from-date operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.SubtractFromDate);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[ne.SubtractFromDate].inputs.dateValue.id}),g=((s=T==null?void 0:T.value)==null?void 0:s.valueAsType)??((u=T==null?void 0:T.value)==null?void 0:u.value),b=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[ne.SubtractFromDate].inputs.amount.id}),R=((e=b==null?void 0:b.value)==null?void 0:e.valueAsType)??((f=b==null?void 0:b.value)==null?void 0:f.value),I=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[ne.SubtractFromDate].inputs.unit.id}),A=((y=I==null?void 0:I.value)==null?void 0:y.valueAsType)??((m=I==null?void 0:I.value)==null?void 0:m.value),O=_Tt(g,R,A);return{value:K.Success,error:null,result:O}}catch(T){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class Gvt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_DIFFERENCE_BETWEEN_DATES,version:"1.0.0",description:"Date difference-between-dates operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.DifferenceBetweenDates);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g;try{const b=n.find(Z=>{var q,H;return((H=(q=Z.valueOwner)==null?void 0:q.declaration)==null?void 0:H.id)===G.operation[ne.DifferenceBetweenDates].inputs.firstDate.id}),R=((s=b==null?void 0:b.value)==null?void 0:s.valueAsType)??((u=b==null?void 0:b.value)==null?void 0:u.value),I=n.find(Z=>{var q,H;return((H=(q=Z.valueOwner)==null?void 0:q.declaration)==null?void 0:H.id)===G.operation[ne.DifferenceBetweenDates].inputs.secondDate.id}),A=((e=I==null?void 0:I.value)==null?void 0:e.valueAsType)??((f=I==null?void 0:I.value)==null?void 0:f.value),O=n.find(Z=>{var q,H;return((H=(q=Z.valueOwner)==null?void 0:q.declaration)==null?void 0:H.id)===G.operation[ne.DifferenceBetweenDates].inputs.unit.id}),P=((y=O==null?void 0:O.value)==null?void 0:y.valueAsType)??((m=O==null?void 0:O.value)==null?void 0:m.value),x=n.find(Z=>{var q,H;return((H=(q=Z.valueOwner)==null?void 0:q.declaration)==null?void 0:H.id)===G.operation[ne.DifferenceBetweenDates].inputs.asFloat.id}),$=((T=x==null?void 0:x.value)==null?void 0:T.valueAsType)??((g=x==null?void 0:x.value)==null?void 0:g.value)??!1,U=$Tt(R,A,P,$);return{value:K.Success,error:null,result:U}}catch(b){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:b,result:null}}}})}}class kbn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.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:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.ToDate);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[ne.ToDate].inputs.inputValue.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=VTt(f);return{value:K.Success,error:null,result:y}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class Lvt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_UNIX,version:"1.0.0",description:"Date to-unix operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.ToUnix);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[ne.ToUnix].inputs.dateValue.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=GTt(f);return{value:K.Success,error:null,result:y}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class Bvt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_FROM_UNIX,version:"1.0.0",description:"Date from-unix operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.FromUnix);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[ne.FromUnix].inputs.seconds.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=LTt(f);return{value:K.Success,error:null,result:y}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class Svt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_ISO_STRING,version:"1.0.0",description:"Date to-iso-string operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.ToISOString);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[ne.ToISOString].inputs.inputValue.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=BTt(f);return{value:K.Success,error:null,result:y}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class Mvt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_YEAR,version:"1.0.0",description:"Date get-year operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.GetYear);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[ne.GetYear].inputs.dateValue.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=STt(f);return{value:K.Success,error:null,result:y}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class Fvt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_MONTH,version:"1.0.0",description:"Date get-month (0-based) operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.GetMonth);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[ne.GetMonth].inputs.dateValue.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=MTt(f);return{value:K.Success,error:null,result:y}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class kvt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.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:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.GetDate);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[ne.GetDate].inputs.dateValue.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=FTt(f);return{value:K.Success,error:null,result:y}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class Uvt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_HOUR,version:"1.0.0",description:"Date get-hour operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.GetHour);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[ne.GetHour].inputs.dateValue.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=kTt(f);return{value:K.Success,error:null,result:y}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class Kvt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_MINUTE,version:"1.0.0",description:"Date get-minute operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.GetMinute);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[ne.GetMinute].inputs.dateValue.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=UTt(f);return{value:K.Success,error:null,result:y}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class jvt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_SECOND,version:"1.0.0",description:"Date get-second operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.GetSecond);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[ne.GetSecond].inputs.dateValue.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=KTt(f);return{value:K.Success,error:null,result:y}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class qvt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_MILLISECOND,version:"1.0.0",description:"Date get-millisecond operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.GetMillisecond);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[ne.GetMillisecond].inputs.dateValue.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=jTt(f);return{value:K.Success,error:null,result:y}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class Zvt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_ISO_WEEKDAY,version:"1.0.0",description:"Date get-iso-weekday operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.GetIsoWeekday);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[ne.GetIsoWeekday].inputs.dateValue.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=qTt(f);return{value:K.Success,error:null,result:y}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class Hvt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.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:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.GetWeekOfYear);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[ne.GetWeekOfYear].inputs.dateValue.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=ZTt(f);return{value:K.Success,error:null,result:y}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class Wvt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_QUARTER,version:"1.0.0",description:"Date get-quarter operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.GetQuarter);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[ne.GetQuarter].inputs.dateValue.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=HTt(f);return{value:K.Success,error:null,result:y}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class zvt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.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:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.GetDayOfYear);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[ne.GetDayOfYear].inputs.dateValue.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=WTt(f);return{value:K.Success,error:null,result:y}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class Yvt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.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:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.GetDaysInMonth);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[ne.GetDaysInMonth].inputs.dateValue.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=zTt(f);return{value:K.Success,error:null,result:y}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class Jvt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.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:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.GetCurrentIanaTimeZone);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const s=A4();return{value:K.Success,error:null,result:s}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class Qvt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_YEAR,version:"1.0.0",description:"Date set-year operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.SetYear);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.SetYear].inputs.dateValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.SetYear].inputs.year.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),b=YTt(m,g);return{value:K.Success,error:null,result:b}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class Xvt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.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:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.SetMonth);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.SetMonth].inputs.dateValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.SetMonth].inputs.month.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),b=JTt(m,g);return{value:K.Success,error:null,result:b}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class egt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.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:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.SetDate);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.SetDate].inputs.dateValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.SetDate].inputs.date.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),b=QTt(m,g);return{value:K.Success,error:null,result:b}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class tgt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_HOUR,version:"1.0.0",description:"Date set-hour operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.SetHour);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.SetHour].inputs.dateValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.SetHour].inputs.hour.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),b=XTt(m,g);return{value:K.Success,error:null,result:b}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class igt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_MINUTE,version:"1.0.0",description:"Date set-minute operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.SetMinute);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.SetMinute].inputs.dateValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.SetMinute].inputs.minute.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),b=evt(m,g);return{value:K.Success,error:null,result:b}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class ngt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_SECOND,version:"1.0.0",description:"Date set-second operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.SetSecond);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.SetSecond].inputs.dateValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.SetSecond].inputs.second.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),b=tvt(m,g);return{value:K.Success,error:null,result:b}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class rgt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_MILLISECOND,version:"1.0.0",description:"Date set-millisecond operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.SetMillisecond);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.SetMillisecond].inputs.dateValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.SetMillisecond].inputs.millisecond.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),b=ivt(m,g);return{value:K.Success,error:null,result:b}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class agt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_ISO_WEEKDAY,version:"1.0.0",description:"Date set-iso-weekday operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.SetIsoWeekday);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.SetIsoWeekday].inputs.dateValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.SetIsoWeekday].inputs.isoWeekday.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),b=nvt(m,g);return{value:K.Success,error:null,result:b}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class sgt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_QUARTER,version:"1.0.0",description:"Date set-quarter operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.SetQuarter);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.SetQuarter].inputs.dateValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.SetQuarter].inputs.quarter.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),b=rvt(m,g);return{value:K.Success,error:null,result:b}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class lgt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_START_OF,version:"1.0.0",description:"Date start-of operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.StartOf);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.StartOf].inputs.dateValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.StartOf].inputs.unit.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),b=avt(m,g);return{value:K.Success,error:null,result:b}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class ogt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_END_OF,version:"1.0.0",description:"Date end-of operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.EndOf);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.EndOf].inputs.dateValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.EndOf].inputs.unit.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),b=svt(m,g);return{value:K.Success,error:null,result:b}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class dgt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_ROUND_TO,version:"1.0.0",description:"Date round-to operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.RoundTo);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.RoundTo].inputs.dateValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.RoundTo].inputs.unit.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),b=lvt(m,g);return{value:K.Success,error:null,result:b}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class pgt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_BEFORE,version:"1.0.0",description:"Date is-before operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.IsBefore);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[ne.IsBefore].inputs.leftHand.id}),g=((s=T==null?void 0:T.value)==null?void 0:s.valueAsType)??((u=T==null?void 0:T.value)==null?void 0:u.value),b=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[ne.IsBefore].inputs.rightHand.id}),R=((e=b==null?void 0:b.value)==null?void 0:e.valueAsType)??((f=b==null?void 0:b.value)==null?void 0:f.value),I=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[ne.IsBefore].inputs.unit.id}),A=((y=I==null?void 0:I.value)==null?void 0:y.valueAsType)??((m=I==null?void 0:I.value)==null?void 0:m.value),O=ovt(g,R,A);return{value:K.Success,error:null,result:O}}catch(T){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class ugt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_AFTER,version:"1.0.0",description:"Date is-after operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.IsAfter);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[ne.IsAfter].inputs.leftHand.id}),g=((s=T==null?void 0:T.value)==null?void 0:s.valueAsType)??((u=T==null?void 0:T.value)==null?void 0:u.value),b=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[ne.IsAfter].inputs.rightHand.id}),R=((e=b==null?void 0:b.value)==null?void 0:e.valueAsType)??((f=b==null?void 0:b.value)==null?void 0:f.value),I=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[ne.IsAfter].inputs.unit.id}),A=((y=I==null?void 0:I.value)==null?void 0:y.valueAsType)??((m=I==null?void 0:I.value)==null?void 0:m.value),O=dvt(g,R,A);return{value:K.Success,error:null,result:O}}catch(T){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class cgt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_SAME,version:"1.0.0",description:"Date is-same operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.IsSame);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[ne.IsSame].inputs.leftHand.id}),g=((s=T==null?void 0:T.value)==null?void 0:s.valueAsType)??((u=T==null?void 0:T.value)==null?void 0:u.value),b=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[ne.IsSame].inputs.rightHand.id}),R=((e=b==null?void 0:b.value)==null?void 0:e.valueAsType)??((f=b==null?void 0:b.value)==null?void 0:f.value),I=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[ne.IsSame].inputs.unit.id}),A=((y=I==null?void 0:I.value)==null?void 0:y.valueAsType)??((m=I==null?void 0:I.value)==null?void 0:m.value),O=pvt(g,R,A);return{value:K.Success,error:null,result:O}}catch(T){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class fgt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.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:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.IsSameOrBefore);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[ne.IsSameOrBefore].inputs.leftHand.id}),g=((s=T==null?void 0:T.value)==null?void 0:s.valueAsType)??((u=T==null?void 0:T.value)==null?void 0:u.value),b=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[ne.IsSameOrBefore].inputs.rightHand.id}),R=((e=b==null?void 0:b.value)==null?void 0:e.valueAsType)??((f=b==null?void 0:b.value)==null?void 0:f.value),I=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[ne.IsSameOrBefore].inputs.unit.id}),A=((y=I==null?void 0:I.value)==null?void 0:y.valueAsType)??((m=I==null?void 0:I.value)==null?void 0:m.value),O=uvt(g,R,A);return{value:K.Success,error:null,result:O}}catch(T){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class ygt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.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:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.IsSameOrAfter);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[ne.IsSameOrAfter].inputs.leftHand.id}),g=((s=T==null?void 0:T.value)==null?void 0:s.valueAsType)??((u=T==null?void 0:T.value)==null?void 0:u.value),b=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[ne.IsSameOrAfter].inputs.rightHand.id}),R=((e=b==null?void 0:b.value)==null?void 0:e.valueAsType)??((f=b==null?void 0:b.value)==null?void 0:f.value),I=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[ne.IsSameOrAfter].inputs.unit.id}),A=((y=I==null?void 0:I.value)==null?void 0:y.valueAsType)??((m=I==null?void 0:I.value)==null?void 0:m.value),O=cvt(g,R,A);return{value:K.Success,error:null,result:O}}catch(T){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class hgt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_BETWEEN,version:"1.0.0",description:"Date is-between operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.IsBetween);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R;try{const I=n.find(ie=>{var z,W;return((W=(z=ie.valueOwner)==null?void 0:z.declaration)==null?void 0:W.id)===G.operation[ne.IsBetween].inputs.target.id}),A=((s=I==null?void 0:I.value)==null?void 0:s.valueAsType)??((u=I==null?void 0:I.value)==null?void 0:u.value),O=n.find(ie=>{var z,W;return((W=(z=ie.valueOwner)==null?void 0:z.declaration)==null?void 0:W.id)===G.operation[ne.IsBetween].inputs.start.id}),P=((e=O==null?void 0:O.value)==null?void 0:e.valueAsType)??((f=O==null?void 0:O.value)==null?void 0:f.value),x=n.find(ie=>{var z,W;return((W=(z=ie.valueOwner)==null?void 0:z.declaration)==null?void 0:W.id)===G.operation[ne.IsBetween].inputs.end.id}),$=((y=x==null?void 0:x.value)==null?void 0:y.valueAsType)??((m=x==null?void 0:x.value)==null?void 0:m.value),U=n.find(ie=>{var z,W;return((W=(z=ie.valueOwner)==null?void 0:z.declaration)==null?void 0:W.id)===G.operation[ne.IsBetween].inputs.unit.id}),Z=((T=U==null?void 0:U.value)==null?void 0:T.valueAsType)??((g=U==null?void 0:U.value)==null?void 0:g.value),q=n.find(ie=>{var z,W;return((W=(z=ie.valueOwner)==null?void 0:z.declaration)==null?void 0:W.id)===G.operation[ne.IsBetween].inputs.inclusivity.id}),H=((b=q==null?void 0:q.value)==null?void 0:b.valueAsType)??((R=q==null?void 0:q.value)==null?void 0:R.value),Y=fvt(A,P,$,Z,H??void 0);return{value:K.Success,error:null,result:Y}}catch(I){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:I,result:null}}}})}}class mgt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_VALID,version:"1.0.0",description:"Date is-valid operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.IsValid);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[ne.IsValid].inputs.value.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=yvt(f);return{value:K.Success,error:null,result:y}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class Tgt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_LEAP_YEAR,version:"1.0.0",description:"Date is-leap-year operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.IsLeapYear);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[ne.IsLeapYear].inputs.dateValue.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=hvt(f);return{value:K.Success,error:null,result:y}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class vgt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_CLAMP_TO_RANGE,version:"1.0.0",description:"Date clamp-to-range operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.ClampToRange);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[ne.ClampToRange].inputs.dateValue.id}),g=((s=T==null?void 0:T.value)==null?void 0:s.valueAsType)??((u=T==null?void 0:T.value)==null?void 0:u.value),b=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[ne.ClampToRange].inputs.min.id}),R=((e=b==null?void 0:b.value)==null?void 0:e.valueAsType)??((f=b==null?void 0:b.value)==null?void 0:f.value),I=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[ne.ClampToRange].inputs.max.id}),A=((y=I==null?void 0:I.value)==null?void 0:y.valueAsType)??((m=I==null?void 0:I.value)==null?void 0:m.value),O=mvt(g,R,A);return{value:K.Success,error:null,result:O}}catch(T){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class ggt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_MIN_OF,version:"1.0.0",description:"Date min-of operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.MinOf);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const u=n.filter(y=>{var m,T;return((T=(m=y.valueOwner)==null?void 0:m.declaration)==null?void 0:T.id)===G.operation[ne.MinOf].inputs.dates.id}).map(y=>{var m,T;return((m=y.value)==null?void 0:m.valueAsType)??((T=y.value)==null?void 0:T.value)}),e=u.length===1&&Array.isArray(u[0])?u[0]:u,f=Tvt(e);return{value:K.Success,error:null,result:f}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class bgt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_MAX_OF,version:"1.0.0",description:"Date max-of operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.MaxOf);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const u=n.filter(y=>{var m,T;return((T=(m=y.valueOwner)==null?void 0:m.declaration)==null?void 0:T.id)===G.operation[ne.MaxOf].inputs.dates.id}).map(y=>{var m,T;return((m=y.value)==null?void 0:m.valueAsType)??((T=y.value)==null?void 0:T.value)}),e=u.length===1&&Array.isArray(u[0])?u[0]:u,f=vvt(e);return{value:K.Success,error:null,result:f}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class Egt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_FROM_NOW,version:"1.0.0",description:"Date from-now operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.FromNow);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(I=>{var A,O;return((O=(A=I.valueOwner)==null?void 0:A.declaration)==null?void 0:O.id)===G.operation[ne.FromNow].inputs.dateValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(I=>{var A,O;return((O=(A=I.valueOwner)==null?void 0:A.declaration)==null?void 0:O.id)===G.operation[ne.FromNow].inputs.withoutSuffix.id}),b=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value)??!1,R=gvt(m,b);return{value:K.Success,error:null,result:R}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class Igt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_NOW,version:"1.0.0",description:"Date to-now operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.ToNow);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(I=>{var A,O;return((O=(A=I.valueOwner)==null?void 0:A.declaration)==null?void 0:O.id)===G.operation[ne.ToNow].inputs.dateValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(I=>{var A,O;return((O=(A=I.valueOwner)==null?void 0:A.declaration)==null?void 0:O.id)===G.operation[ne.ToNow].inputs.withoutSuffix.id}),b=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value)??!1,R=bvt(m,b);return{value:K.Success,error:null,result:R}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class Rgt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_HUMANIZE_DIFF,version:"1.0.0",description:"Date humanize-diff operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.HumanizeDiff);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=n.find(x=>{var $,U;return((U=($=x.valueOwner)==null?void 0:$.declaration)==null?void 0:U.id)===G.operation[ne.HumanizeDiff].inputs.firstDate.id}),g=((s=T==null?void 0:T.value)==null?void 0:s.valueAsType)??((u=T==null?void 0:T.value)==null?void 0:u.value),b=n.find(x=>{var $,U;return((U=($=x.valueOwner)==null?void 0:$.declaration)==null?void 0:U.id)===G.operation[ne.HumanizeDiff].inputs.secondDate.id}),R=((e=b==null?void 0:b.value)==null?void 0:e.valueAsType)??((f=b==null?void 0:b.value)==null?void 0:f.value),I=n.find(x=>{var $,U;return((U=($=x.valueOwner)==null?void 0:$.declaration)==null?void 0:U.id)===G.operation[ne.HumanizeDiff].inputs.withoutSuffix.id}),O=((y=I==null?void 0:I.value)==null?void 0:y.valueAsType)??((m=I==null?void 0:I.value)==null?void 0:m.value)??!0,P=Evt(g,R,O);return{value:K.Success,error:null,result:P}}catch(T){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class Agt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.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:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.AddBusinessDays);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const u=n.filter(g=>{var b,R;return((R=(b=g.valueOwner)==null?void 0:b.declaration)==null?void 0:R.id)===G.operation[ne.AddBusinessDays].inputs.dateValue.id}).map(g=>{var b,R;return((b=g.value)==null?void 0:b.valueAsType)??((R=g.value)==null?void 0:R.value)}),e=u[0],f=u[1],y=u[2]??void 0,m=u[3]??[],T=Ivt(e,f,y,m);return{value:K.Success,error:null,result:T}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class Dgt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_NEXT_WEEKDAY,version:"1.0.0",description:"Date next-weekday operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.NextWeekday);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.NextWeekday].inputs.dateValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.NextWeekday].inputs.weekday.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),b=Rvt(m,g);return{value:K.Success,error:null,result:b}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class Cgt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_PREVIOUS_WEEKDAY,version:"1.0.0",description:"Date previous-weekday operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.PreviousWeekday);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.PreviousWeekday].inputs.dateValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.PreviousWeekday].inputs.weekday.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),b=Avt(m,g);return{value:K.Success,error:null,result:b}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class wgt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_UTC,version:"1.1.0",description:"Date to-utc operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.ToUTC);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const u=n.filter(T=>{var g,b;return((b=(g=T.valueOwner)==null?void 0:g.declaration)==null?void 0:b.id)===G.operation[ne.ToUTC].inputs.dateValue.id}).map(T=>{var g,b;return((g=T.value)==null?void 0:g.valueAsType)??((b=T.value)==null?void 0:b.value)}),e=u[0],f=u[1]||void 0,y=u[2]??!1,m=Cvt(e,f,y);return{value:K.Success,error:null,result:m}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class Ogt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_CONVERT_TIMEZONE,version:"1.0.0",description:"Date convert-timezone operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.ConvertTimezone);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=n.find(x=>{var $,U;return((U=($=x.valueOwner)==null?void 0:$.declaration)==null?void 0:U.id)===G.operation[ne.ConvertTimezone].inputs.dateValue.id}),g=((s=T==null?void 0:T.value)==null?void 0:s.valueAsType)??((u=T==null?void 0:T.value)==null?void 0:u.value),b=n.find(x=>{var $,U;return((U=($=x.valueOwner)==null?void 0:$.declaration)==null?void 0:U.id)===G.operation[ne.ConvertTimezone].inputs.targetTimezone.id}),R=((e=b==null?void 0:b.value)==null?void 0:e.valueAsType)??((f=b==null?void 0:b.value)==null?void 0:f.value),I=n.find(x=>{var $,U;return((U=($=x.valueOwner)==null?void 0:$.declaration)==null?void 0:U.id)===G.operation[ne.ConvertTimezone].inputs.keepLocalTime.id}),O=((y=I==null?void 0:I.value)==null?void 0:y.valueAsType)??((m=I==null?void 0:I.value)==null?void 0:m.value)??!1,P=wvt(g,R,O);return{value:K.Success,error:null,result:P}}catch(T){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class xgt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_TIMEZONE_OFFSET,version:"1.0.0",description:"Date get-timezone-offset operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.GetTimezoneOffset);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(A=>{var O,P;return((P=(O=A.valueOwner)==null?void 0:O.declaration)==null?void 0:P.id)===G.operation[ne.GetTimezoneOffset].inputs.timezone.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(A=>{var O,P;return((P=(O=A.valueOwner)==null?void 0:O.declaration)==null?void 0:P.id)===G.operation[ne.GetTimezoneOffset].inputs.atDate.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),I=Ovt(m,g);return{value:K.Success,error:null,result:I}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class Pgt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_UTC_OFFSET,version:"1.0.0",description:"Date set-utc-offset operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.SetUTCOffset);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=n.find(x=>{var $,U;return((U=($=x.valueOwner)==null?void 0:$.declaration)==null?void 0:U.id)===G.operation[ne.SetUTCOffset].inputs.dateValue.id}),g=((s=T==null?void 0:T.value)==null?void 0:s.valueAsType)??((u=T==null?void 0:T.value)==null?void 0:u.value),b=n.find(x=>{var $,U;return((U=($=x.valueOwner)==null?void 0:$.declaration)==null?void 0:U.id)===G.operation[ne.SetUTCOffset].inputs.offsetMinutes.id}),R=((e=b==null?void 0:b.value)==null?void 0:e.valueAsType)??((f=b==null?void 0:b.value)==null?void 0:f.value),I=n.find(x=>{var $,U;return((U=($=x.valueOwner)==null?void 0:$.declaration)==null?void 0:U.id)===G.operation[ne.SetUTCOffset].inputs.keepLocalTime.id}),O=((y=I==null?void 0:I.value)==null?void 0:y.valueAsType)??((m=I==null?void 0:I.value)==null?void 0:m.value)??!1,P=xvt(g,R,O);return{value:K.Success,error:null,result:P}}catch(T){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class Vgt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_WAIT,version:"1.0.0",description:"Execution wait operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ld.Wait);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u;try{const e=n.find(y=>{var m,T;return((T=(m=y.valueOwner)==null?void 0:m.declaration)==null?void 0:T.id)===G.operation[ld.Wait].inputs.duration.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value);return typeof f!="number"||f<0?{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:"Invalid wait time provided",result:null}:(await new Promise(y=>setTimeout(y,f)),{value:K.Success,error:null,result:null})}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}const Ubn=/^\d{4}-\d{2}-\d{2}(?:[T ]\d{2}:\d{2}(?::\d{2}(?:\.\d{1,3})?)?(?:Z|[+-]\d{2}:?\d{2})?)?$/,D4=a=>a===null||["string","number","boolean"].includes(typeof a);function $l(a,p="Input must be an array"){if(!Array.isArray(a))throw new TypeError(p);return a}function $c(a){const p=$l(a,"Input must be an array");if(!p||p.length===0)throw new TypeError("No list provided or list is empty");return p}function C4(a){return Array.isArray(a)?a:[]}function Ip(a){return Number(a)}function Ngt(a){if(!a||a.length===0)throw new TypeError("No input lists provided");if(!a.every(n=>Array.isArray(n)))throw new TypeError("All inputs must be arrays");const[p,...t]=a;return t.reduce((n,s)=>n.concat(s),p)}function _gt(a,...p){if(!Array.isArray(a))throw new TypeError("First input must be an array");if(!p.every(t=>Array.isArray(t)))throw new TypeError("All subsequent inputs must be arrays");return a.concat(...p)}function $gt(a,p){const t=$c(a),n=Ip(p);return[t.slice(0,n),t.slice(n)]}function Ggt(a){return $c(a).slice().reverse()}function Lgt(a){return $c(a).slice(0,-1)}function Bgt(a){return $c(a).slice(1)}function Sgt(a,p,t){const n=$l(a),s=Ip(p);if(s<0||s>n.length)throw new TypeError("Index out of bounds");return[...n.slice(0,s),t,...n.slice(s)]}function Mgt(a,p,t){const n=$c(a),s=Ip(p);if(s<0||s>=n.length)throw new TypeError("Index out of bounds");const u=[...n];return u[s]=t,u}function Fgt(a,p,t){const n=$c(a),s=n.indexOf(p);if(s===-1)return n;const u=[...n];return u[s]=t,u}function kgt(a,p,t){const n=$c(a),s=n.lastIndexOf(p);if(s===-1)return n;const u=[...n];return u[s]=t,u}function Ugt(a,p,t){return $c(a).map(s=>s===p?t:s)}function Kgt(a,p){const t=$c(a),n=Ip(p);if(n<0||n>=t.length)throw new TypeError("Index out of bounds");return t[n]}function jgt(a){return $c(a)[0]}function qgt(a){const p=$c(a);return p[p.length-1]}function Zgt(a,p,...t){return[...$l(a),p,...t]}function Hgt(a,p){const t=$l(a);return[p,...t]}function Wgt(a){return $l(a).length}function zgt(a,p){const t=$l(a),n=Ip(p);if(n<0||n>=t.length)throw new TypeError("Index out of bounds");return t.slice(0,n).concat(t.slice(n+1))}function Ygt(a,p){const t=$l(a),n=Math.max(0,Ip(p)??0);return t.slice(0,n)}function Jgt(a,p){const t=$l(a),n=Math.max(0,Ip(p)??0);return n===0?[]:t.slice(-n)}function Qgt(a,p,t){const n=$l(a),s=p==null?void 0:Ip(p),u=t==null?void 0:Ip(t);return n.slice(s,u)}function Xgt(a,p){return $l(a).indexOf(p)}function ebt(a,p){return $l(a).lastIndexOf(p)}function tbt(a){const p=$l(a),t=[],n=new Set;for(const s of p)n.has(s)||(n.add(s),t.push(s));return t}function ibt(a){return $l(a).reduce((t,n)=>t.concat(n),[])}function nbt(a){const p=$l(a);if(p.length<=1)return[...p];const t=p[0],n=typeof t=="number"&&p.every(e=>typeof e=="number"&&Number.isFinite(e)),s=typeof t=="string"&&p.every(e=>typeof e=="string");let u=null;if(n?u="number":s&&(u=p.every(f=>Ubn.test(f)&&j(f).isValid())?"date":"string"),!u)throw new TypeError("All items must be of the same supported type: number, string, or ISO date string.");return u==="number"?[...p].sort((e,f)=>e-f):u==="string"?[...p].sort((e,f)=>e.localeCompare(f)):[...p].sort((e,f)=>j(e).valueOf()-j(f).valueOf())}function rbt(a){const t=[...$l(a)];for(let n=t.length-1;n>0;n--){const s=Math.floor(sV()*(n+1));[t[n],t[s]]=[t[s],t[n]]}return t}function abt(a,p){const t=$l(a),n=Math.max(1,Ip(p)||1),s=[];for(let u=0;u<t.length;u+=n)s.push(t.slice(u,u+n));return s}function sbt(a,p,t){const n=$l(a),s=Math.max(0,Ip(p)||0);if(n.length>=s)return[...n];const u=s-n.length;return Array(u).fill(t).concat(n)}function lbt(a,p,t){const n=$l(a),s=Math.max(0,Ip(p)||0);if(n.length>=s)return[...n];const u=s-n.length,e=Array(u).fill(t);return n.concat(e)}function obt(a,p){const t=$l(a),n=Math.max(0,Ip(p)||0),s=[];for(let u=0;u<n;u++)s.push(...t);return s}function dbt(a,p){if(!D4(p))throw new TypeError("Contains expects the needle to be a primitive (string | number | boolean | null).");return C4(a).some(n=>n===p)}function pbt(a,p){const t=C4(a),n=Array.isArray(p)?p:[p];if(n.length===0)return!1;if(!n.every(D4))throw new TypeError("ContainsAll expects all needles to be primitives (string | number | boolean | null).");return n.every(s=>t.includes(s))}function ubt(a,p){const t=C4(a),n=Array.isArray(p)?p:[p];if(n.length===0)return!1;if(!n.every(D4))throw new TypeError("ContainsAny expects all needles to be primitives (string | number | boolean | null).");return n.some(s=>t.includes(s))}class cbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_JOIN,version:"1.0.0",description:"List join operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(Re.Join);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(A=>{var O,P;return((P=(O=A.valueOwner)==null?void 0:O.declaration)==null?void 0:P.id)===G.operation[Re.Join].inputs.firstList.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(A=>{var O,P;return((P=(O=A.valueOwner)==null?void 0:O.declaration)==null?void 0:P.id)===G.operation[Re.Join].inputs.separator.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),R=n.filter(A=>{var O,P;return((P=(O=A.valueOwner)==null?void 0:O.declaration)==null?void 0:P.id)===G.operation[Re.Join].inputs.secondList.id}).map(A=>{var O,P;return((O=A.value)==null?void 0:O.valueAsType)??((P=A.value)==null?void 0:P.value)}),I=Ngt([m,g,...R]);return{value:K.Success,error:null,result:I}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class fbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SPLIT,version:"1.0.0",description:"List split operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(Re.Split);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(I=>{var A,O;return((O=(A=I.valueOwner)==null?void 0:A.declaration)==null?void 0:O.id)===G.operation[Re.Split].inputs.list.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(I=>{var A,O;return((O=(A=I.valueOwner)==null?void 0:A.declaration)==null?void 0:O.id)===G.operation[Re.Split].inputs.index.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),[b,R]=$gt(m,g);return{value:K.Success,error:null,result:[b,R]}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class ybt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REVERSE,version:"1.0.0",description:"List reverse operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(Re.Reverse);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[Re.Reverse].inputs.listValue.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=Ggt(f);return{value:K.Success,error:null,result:y}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class hbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_LAST_N_ITEMS,version:"1.0.0",description:"List delete last operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(Re.DeleteLastNItems);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[Re.DeleteLastNItems].inputs.listValue.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=Lgt(f);return{value:K.Success,error:null,result:y}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class mbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_FIRST_N_ITEMS,version:"1.0.0",description:"List delete first operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(Re.DeleteFirstNItems);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[Re.DeleteFirstNItems].inputs.listValue.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=Bgt(f);return{value:K.Success,error:null,result:y}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class Tbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_ADD_AT_INDEX,version:"1.0.0",description:"List add index operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(Re.AddAtIndex);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[Re.AddAtIndex].inputs.listValue.id}),g=((s=T==null?void 0:T.value)==null?void 0:s.valueAsType)??((u=T==null?void 0:T.value)==null?void 0:u.value),b=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[Re.AddAtIndex].inputs.index.id}),R=((e=b==null?void 0:b.value)==null?void 0:e.valueAsType)??((f=b==null?void 0:b.value)==null?void 0:f.value),I=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[Re.AddAtIndex].inputs.value.id}),A=((y=I==null?void 0:I.value)==null?void 0:y.valueAsType)??((m=I==null?void 0:I.value)==null?void 0:m.value),O=Sgt(g,R,A);return{value:K.Success,error:null,result:O}}catch(T){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class vbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_AT_INDEX,version:"1.0.0",description:"List replace index operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(Re.ReplaceAtIndex);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[Re.ReplaceAtIndex].inputs.listValue.id}),g=((s=T==null?void 0:T.value)==null?void 0:s.valueAsType)??((u=T==null?void 0:T.value)==null?void 0:u.value),b=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[Re.ReplaceAtIndex].inputs.index.id}),R=((e=b==null?void 0:b.value)==null?void 0:e.valueAsType)??((f=b==null?void 0:b.value)==null?void 0:f.value),I=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[Re.ReplaceAtIndex].inputs.value.id}),A=((y=I==null?void 0:I.value)==null?void 0:y.valueAsType)??((m=I==null?void 0:I.value)==null?void 0:m.value),O=Mgt(g,R,A);return{value:K.Success,error:null,result:O}}catch(T){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class gbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_FIRST_N_ITEMS,version:"1.0.0",description:"List replace first operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(Re.ReplaceFirstNItems);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[Re.ReplaceFirstNItems].inputs.listValue.id}),g=((s=T==null?void 0:T.value)==null?void 0:s.valueAsType)??((u=T==null?void 0:T.value)==null?void 0:u.value),b=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[Re.ReplaceFirstNItems].inputs.searchValue.id}),R=((e=b==null?void 0:b.value)==null?void 0:e.valueAsType)??((f=b==null?void 0:b.value)==null?void 0:f.value),I=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[Re.ReplaceFirstNItems].inputs.replaceValue.id}),A=((y=I==null?void 0:I.value)==null?void 0:y.valueAsType)??((m=I==null?void 0:I.value)==null?void 0:m.value),O=Fgt(g,R,A);return{value:K.Success,error:null,result:O}}catch(T){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class bbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_LAST_N_ITEMS,version:"1.0.0",description:"List replace last operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(Re.ReplaceLastNItems);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[Re.ReplaceLastNItems].inputs.listValue.id}),g=((s=T==null?void 0:T.value)==null?void 0:s.valueAsType)??((u=T==null?void 0:T.value)==null?void 0:u.value),b=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[Re.ReplaceLastNItems].inputs.searchValue.id}),R=((e=b==null?void 0:b.value)==null?void 0:e.valueAsType)??((f=b==null?void 0:b.value)==null?void 0:f.value),I=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[Re.ReplaceLastNItems].inputs.replaceValue.id}),A=((y=I==null?void 0:I.value)==null?void 0:y.valueAsType)??((m=I==null?void 0:I.value)==null?void 0:m.value),O=kgt(g,R,A);return{value:K.Success,error:null,result:O}}catch(T){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class Ebt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_ALL,version:"1.0.0",description:"List replace all operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(Re.ReplaceAll);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[Re.ReplaceAll].inputs.listValue.id}),g=((s=T==null?void 0:T.value)==null?void 0:s.valueAsType)??((u=T==null?void 0:T.value)==null?void 0:u.value),b=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[Re.ReplaceAll].inputs.searchValue.id}),R=((e=b==null?void 0:b.value)==null?void 0:e.valueAsType)??((f=b==null?void 0:b.value)==null?void 0:f.value),I=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[Re.ReplaceAll].inputs.replaceValue.id}),A=((y=I==null?void 0:I.value)==null?void 0:y.valueAsType)??((m=I==null?void 0:I.value)==null?void 0:m.value),O=Ugt(g,R,A);return{value:K.Success,error:null,result:O}}catch(T){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class Ibt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_INDEX_ITEM,version:"1.0.0",description:"List get index item operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(Re.GetIndexItem);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[Re.GetIndexItem].inputs.listValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[Re.GetIndexItem].inputs.index.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),b=Kgt(m,g);return{value:K.Success,error:null,result:b}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class Rbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_FIRST,version:"1.0.0",description:"List get first operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(Re.GetFirst);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[Re.GetFirst].inputs.listValue.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=jgt(f);return{value:K.Success,error:null,result:y}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class Abt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST,version:"1.0.0",description:"List get last operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(Re.GetLast);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[Re.GetLast].inputs.list.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=qgt(f);return{value:K.Success,error:null,result:y}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class Dbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_APPEND,version:"1.0.0",description:"List append operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(Re.Append);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(A=>{var O,P;return((P=(O=A.valueOwner)==null?void 0:O.declaration)==null?void 0:P.id)===G.operation[Re.Append].inputs.list.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(A=>{var O,P;return((P=(O=A.valueOwner)==null?void 0:O.declaration)==null?void 0:P.id)===G.operation[Re.Append].inputs.elementToAppend.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),R=n.filter(A=>{var O,P;return((P=(O=A.valueOwner)==null?void 0:O.declaration)==null?void 0:P.id)===G.operation[Re.Append].inputs.dynamicArgument.id}).map(A=>{var O,P;return((O=A.value)==null?void 0:O.valueAsType)??((P=A.value)==null?void 0:P.value)}),I=Zgt(m,g,...R);return{value:K.Success,error:null,result:I}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class Cbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PREPEND,version:"1.0.0",description:"List prepend operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(Re.Prepend);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[Re.Prepend].inputs.listValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[Re.Prepend].inputs.value.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),b=Hgt(m,g);return{value:K.Success,error:null,result:b}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class wbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LENGTH,version:"1.0.0",description:"List get length",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Re.GetLength);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u;try{const e=n.find(y=>{var m,T;return((T=(m=y.valueOwner)==null?void 0:m.declaration)==null?void 0:T.id)===G.operation[Re.GetLength].inputs.listValue.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value);return{value:K.Success,error:null,result:Wgt(f)}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class Obt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.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:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Re.DeleteAtIndex);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[Re.DeleteAtIndex].inputs.listValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[Re.DeleteAtIndex].inputs.index.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),b=zgt(m,g);return{value:K.Success,error:null,result:b}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class xbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_FIRST_N_ITEMS,version:"1.0.0",description:"List get first N items",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Re.GetFirstNItems);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[Re.GetFirstNItems].inputs.listValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[Re.GetFirstNItems].inputs.count.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),b=Ygt(m,g);return{value:K.Success,error:null,result:b}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class Pbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST_N_ITEMS,version:"1.0.0",description:"List get last N items",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Re.GetLastNItems);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[Re.GetLastNItems].inputs.listValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[Re.GetLastNItems].inputs.count.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),b=Jgt(m,g);return{value:K.Success,error:null,result:b}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class Vbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SLICE,version:"1.0.0",description:"List slice(start, end)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Re.Slice);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[Re.Slice].inputs.listValue.id}),g=((s=T==null?void 0:T.value)==null?void 0:s.valueAsType)??((u=T==null?void 0:T.value)==null?void 0:u.value),b=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[Re.Slice].inputs.startIndex.id}),R=((e=b==null?void 0:b.value)==null?void 0:e.valueAsType)??((f=b==null?void 0:b.value)==null?void 0:f.value),I=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[Re.Slice].inputs.endIndex.id}),A=((y=I==null?void 0:I.value)==null?void 0:y.valueAsType)??((m=I==null?void 0:I.value)==null?void 0:m.value),O=Qgt(g,R,A);return{value:K.Success,error:null,result:O}}catch(T){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class Nbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONCAT,version:"1.0.0",description:"List concat(base, ...others)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Re.Concat);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const s=n.map(y=>{var m,T;return((m=y.value)==null?void 0:m.valueAsType)??((T=y.value)==null?void 0:T.value)}),[u,...e]=s,f=_gt(u,...e);return{value:K.Success,error:null,result:f}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class _bt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_INDEX_OF,version:"1.0.0",description:"List listGetIndexOf(value)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Re.GetIndexOf);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[Re.GetIndexOf].inputs.listValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[Re.GetIndexOf].inputs.searchValue.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),b=Xgt(m,g);return{value:K.Success,error:null,result:b}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class $bt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST_INDEX_OF,version:"1.0.0",description:"List listGetLastIndexOf(value)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Re.GetLastIndexOf);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[Re.GetLastIndexOf].inputs.listValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[Re.GetLastIndexOf].inputs.searchValue.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),b=ebt(m,g);return{value:K.Success,error:null,result:b}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class Gbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_UNIQUE,version:"1.0.0",description:"List unique (stable, by reference/===)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Re.Unique);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[Re.Unique].inputs.listValue.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=tbt(f);return{value:K.Success,error:null,result:y}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class Lbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_FLATTEN,version:"1.0.0",description:"List flatten one level",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Re.Flatten);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[Re.Flatten].inputs.listValue.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=ibt(f);return{value:K.Success,error:null,result:y}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class Bbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.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:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Re.Sort);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[Re.Sort].inputs.listValue.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=nbt(f);return{value:K.Success,error:null,result:y}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class Sbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SHUFFLE,version:"1.0.0",description:"List shuffle (Fisher–Yates, secure RNG helper)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Re.Shuffle);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[Re.Shuffle].inputs.listValue.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=rbt(f);return{value:K.Success,error:null,result:y}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class Mbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CHUNK,version:"1.0.0",description:"List chunk(size) -> list of lists",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Re.Chunk);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[Re.Chunk].inputs.listValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[Re.Chunk].inputs.size.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),b=abt(m,g);return{value:K.Success,error:null,result:b}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class Fbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PAD_START,version:"1.0.0",description:"List padStart(targetLength, padValue)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Re.PadStart);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[Re.PadStart].inputs.listValue.id}),g=((s=T==null?void 0:T.value)==null?void 0:s.valueAsType)??((u=T==null?void 0:T.value)==null?void 0:u.value),b=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[Re.PadStart].inputs.targetLength.id}),R=((e=b==null?void 0:b.value)==null?void 0:e.valueAsType)??((f=b==null?void 0:b.value)==null?void 0:f.value),I=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[Re.PadStart].inputs.padValue.id}),A=((y=I==null?void 0:I.value)==null?void 0:y.valueAsType)??((m=I==null?void 0:I.value)==null?void 0:m.value),O=sbt(g,R,A);return{value:K.Success,error:null,result:O}}catch(T){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class kbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PAD_END,version:"1.0.0",description:"List padEnd(targetLength, padValue)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Re.PadEnd);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[Re.PadEnd].inputs.listValue.id}),g=((s=T==null?void 0:T.value)==null?void 0:s.valueAsType)??((u=T==null?void 0:T.value)==null?void 0:u.value),b=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[Re.PadEnd].inputs.targetLength.id}),R=((e=b==null?void 0:b.value)==null?void 0:e.valueAsType)??((f=b==null?void 0:b.value)==null?void 0:f.value),I=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[Re.PadEnd].inputs.padValue.id}),A=((y=I==null?void 0:I.value)==null?void 0:y.valueAsType)??((m=I==null?void 0:I.value)==null?void 0:m.value),O=lbt(g,R,A);return{value:K.Success,error:null,result:O}}catch(T){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class Ubt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPEAT,version:"1.0.0",description:"List repeat(count)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Re.Repeat);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[Re.Repeat].inputs.listValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[Re.Repeat].inputs.count.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),b=obt(m,g);return{value:K.Success,error:null,result:b}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class Kbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONTAINS,version:"1.0.0",description:"List contains (primitive needles)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Re.Contains);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[Re.Contains].inputs.list.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[Re.Contains].inputs.needle.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),b=dbt(m,g);return{value:K.Success,error:null,result:b}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class jbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONTAINS_ALL,version:"1.0.0",description:"List contains all (primitive needles)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Re.ContainsAll);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[Re.ContainsAll].inputs.list.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[Re.ContainsAll].inputs.needle.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),b=pbt(m,g);return{value:K.Success,error:null,result:b}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class qbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONTAINS_ANY,version:"1.0.0",description:"List contains any (primitive needles)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Re.ContainsAny);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[Re.ContainsAny].inputs.list.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[Re.ContainsAny].inputs.needle.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),b=ubt(m,g);return{value:K.Success,error:null,result:b}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class Kbn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LENGTH,version:"1.0.0",description:"Returns the number of characters in a string",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(he.GetLength);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s]=n.map(e=>{var f,y;return((f=e.value)==null?void 0:f.valueAsType)??((y=e.value)==null?void 0:y.value)}),u=s.length;return{value:K.Success,error:null,result:u}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class Zbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_JOIN,version:"1.0.0",description:"String join operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(he.Join);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e;try{const f=n.find(O=>{var P,x;return((x=(P=O.valueOwner)==null?void 0:P.declaration)==null?void 0:x.id)===G.operation[he.Join].inputs.separator.id}),y=((s=f==null?void 0:f.value)==null?void 0:s.value)||"",m=n.find(O=>{var P,x;return((x=(P=O.valueOwner)==null?void 0:P.declaration)==null?void 0:x.id)===G.operation[he.Join].inputs.first.id}),T=((u=m==null?void 0:m.value)==null?void 0:u.value)||"",g=n.find(O=>{var P,x;return((x=(P=O.valueOwner)==null?void 0:P.declaration)==null?void 0:x.id)===G.operation[he.Join].inputs.second.id}),b=((e=g==null?void 0:g.value)==null?void 0:e.value)||"",I=n.filter(O=>{var P,x;return((x=(P=O.valueOwner)==null?void 0:P.declaration)==null?void 0:x.id)===G.operation[he.Join].inputs.dynamicString.id}).map(O=>{var P,x;return((P=O.value)==null?void 0:P.valueAsType)||((x=O.value)==null?void 0:x.value)||""}),A=[T,b,...I].join(y);return{value:K.Success,error:null,result:A}}catch(f){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:f,result:null}}}})}}class Hbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT_AT_INDEX,version:"1.0.0",description:"String split at index operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(he.SplitAtIndex);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const s=n.map(y=>{var m,T;return((m=y.value)==null?void 0:m.valueAsType)||((T=y.value)==null?void 0:T.value)}),u=s[0],e=s[1],f={firstPart:u.slice(0,e),secondPart:u.slice(e)};return{value:K.Success,error:null,result:f}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class Wbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.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:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(he.SplitAtAllSeparators);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const s=n.map(y=>{var m,T;return((m=y.value)==null?void 0:m.valueAsType)||((T=y.value)==null?void 0:T.value)}),u=s[0],e=s[1],f=u.split(e);return{value:K.Success,error:null,result:f}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class zbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.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:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(he.SplitAtFirstSeparator);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const s=n.map(m=>{var T,g;return((T=m.value)==null?void 0:T.valueAsType)||((g=m.value)==null?void 0:g.value)}),u=s[0],e=s[1],f=u.indexOf(e),y={firstPart:u.slice(0,f),secondPart:u.slice(f+e.length)};return{value:K.Success,error:null,result:y}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class Ybt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.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:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(he.SplitAtLastSeparator);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const s=n.map(m=>{var T,g;return((T=m.value)==null?void 0:T.valueAsType)||((g=m.value)==null?void 0:g.value)}),u=s[0],e=s[1],f=u.lastIndexOf(e),y={firstPart:u.slice(0,f),secondPart:u.slice(f+e.length)};return{value:K.Success,error:null,result:y}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class Jbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.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:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(he.DeleteLastNChars);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const s=n.map(y=>{var m,T;return((m=y.value)==null?void 0:m.valueAsType)||((T=y.value)==null?void 0:T.value)}),u=s[0],e=s[1]??1;if(typeof u!="string")return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:"No string provided",result:null};const f=u.slice(0,-e);return{value:K.Success,error:null,result:f}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class Qbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.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:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(he.DeleteFirstNChars);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const s=n.map(y=>{var m,T;return((m=y.value)==null?void 0:m.valueAsType)||((T=y.value)==null?void 0:T.value)}),u=s[0],e=s[1]??1;if(typeof u!="string")return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:"No string provided",result:null};const f=u.slice(0,e);return{value:K.Success,error:null,result:f}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class Xbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REVERSE,version:"1.0.0",description:"String reverse operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(he.Reverse);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const u=n.map(f=>{var y,m;return((y=f.value)==null?void 0:y.valueAsType)||((m=f.value)==null?void 0:m.value)})[0];if(typeof u!="string")return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:"No string provided",result:null};const e=u.split("").reverse().join("");return{value:K.Success,error:null,result:e}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class eEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TO_LOWER_CASE,version:"1.0.0",description:"String to lower case operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(he.ToLowerCase);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const u=n.map(f=>{var y,m;return((y=f.value)==null?void 0:y.valueAsType)||((m=f.value)==null?void 0:m.value)})[0];if(typeof u!="string")return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:"No string provided",result:null};const e=u.toLowerCase();return{value:K.Success,error:null,result:e}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class tEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TO_UPPER_CASE,version:"1.0.0",description:"String to upper case operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(he.ToUpperCase);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const u=n.map(f=>{var y,m;return((y=f.value)==null?void 0:y.valueAsType)||((m=f.value)==null?void 0:m.value)})[0];if(typeof u!="string")return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:"No string provided",result:null};const e=u.toUpperCase();return{value:K.Success,error:null,result:e}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class iEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_AT_INDEX,version:"1.0.0",description:"String delete index operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(he.DeleteAtIndex);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const s=n.map(T=>{var g,b;return((g=T.value)==null?void 0:g.valueAsType)||((b=T.value)==null?void 0:b.value)}),u=s[0],e=s[1],f=s[2]??1;if(typeof u!="string")return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:"No string provided",result:null};const y=Math.min(f,u.length-e),m=u.slice(0,e)+u.slice(e+y);return{value:K.Success,error:null,result:m}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class nEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ADD_AT_INDEX,version:"1.0.0",description:"String add index operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(he.AddAtIndex);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const s=n.map(m=>{var T,g;return((T=m.value)==null?void 0:T.valueAsType)||((g=m.value)==null?void 0:g.value)}),u=s[0],e=s[1],f=s[2];if(typeof u!="string")return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:"No string provided",result:null};const y=u.slice(0,e)+f+u.slice(e);return{value:K.Success,error:null,result:y}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class rEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_FIRST_N_CHARS,version:"1.0.0",description:"String replace first operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(he.ReplaceFirstNChars);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const s=n.map(m=>{var T,g;return((T=m.value)==null?void 0:T.valueAsType)||((g=m.value)==null?void 0:g.value)}),u=s[0],e=s[1]??1,f=s[2];if(typeof u!="string")return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:"No string provided",result:null};const y=f+u.slice(e);return{value:K.Success,error:null,result:y}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class aEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_LAST_N_CHARS,version:"1.0.0",description:"String replace last operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(he.ReplaceLastNChars);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const s=n.map(m=>{var T,g;return((T=m.value)==null?void 0:T.valueAsType)||((g=m.value)==null?void 0:g.value)}),u=s[0],e=s[1]??1,f=s[2];if(typeof u!="string")return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:"No string provided",result:null};const y=u.slice(0,-e)+f;return{value:K.Success,error:null,result:y}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class sEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_AT_INDEX,version:"1.0.0",description:"String replace index operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(he.ReplaceAtIndex);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const s=n.map(T=>{var g,b;return((g=T.value)==null?void 0:g.valueAsType)||((b=T.value)==null?void 0:b.value)}),u=s[0],e=s[1],f=s[2]??1,y=s[3];if(typeof u!="string")return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:"No string provided",result:null};const m=(u.slice(0,e)||"")+y+(u.slice(e+f)||"");return{value:K.Success,error:null,result:m}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class lEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_FIRST_MATCH,version:"1.0.0",description:"String replace single match operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(he.ReplaceFirstMatch);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const s=n.map(m=>{var T,g;return((T=m.value)==null?void 0:T.valueAsType)||((g=m.value)==null?void 0:g.value)}),u=s[0],e=s[1],f=s[2];if(typeof u!="string")return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:"No string provided",result:null};const y=u.replace(e,f);return{value:K.Success,error:null,result:y}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class oEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_LAST_MATCH,version:"1.0.0",description:"String replace single match operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(he.ReplaceLastMatch);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const s=n.map(T=>{var g,b;return((g=T.value)==null?void 0:g.valueAsType)||((b=T.value)==null?void 0:b.value)}),u=s[0],e=s[1],f=s[2];if(typeof u!="string")return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:"No string provided",result:null};const y=u.lastIndexOf(e),m=y===-1?u:u.substring(0,y)+f+u.substring(y+e.length);return{value:K.Success,error:null,result:m}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class dEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_ALL_MATCHES,version:"1.0.0",description:"String replace all matches operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(he.ReplaceAllMatches);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const s=n.map(m=>{var T,g;return((T=m.value)==null?void 0:T.valueAsType)||((g=m.value)==null?void 0:g.value)}),u=s[0],e=s[1],f=s[2];if(typeof u!="string")return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:"No string provided",result:null};const y=u.split(e).join(f);return{value:K.Success,error:null,result:y}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class pEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_INDEX_ITEM,version:"1.0.0",description:"String get index operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(he.GetIndexItem);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const s=n.map(y=>{var m,T;return((m=y.value)==null?void 0:m.valueAsType)||((T=y.value)==null?void 0:T.value)}),u=s[0],e=s[1];if(typeof u!="string")return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:"No string provided",result:null};const f=u.charAt(e);return{value:K.Success,error:null,result:f}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class uEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.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:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(he.GetLastNChars);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const s=n.map(y=>{var m,T;return((m=y.value)==null?void 0:m.valueAsType)||((T=y.value)==null?void 0:T.value)}),u=s[0],e=s[1];if(typeof u!="string")return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:"No string provided",result:null};const f=u.slice(-e);return{value:K.Success,error:null,result:f}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class cEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.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:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(he.GetFirstNChars);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const s=n.map(y=>{var m,T;return((m=y.value)==null?void 0:m.valueAsType)||((T=y.value)==null?void 0:T.value)}),u=s[0],e=s[1];if(typeof u!="string")return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:"No string provided",result:null};const f=u.slice(0,e);return{value:K.Success,error:null,result:f}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class fEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_INDEX_OF,version:"1.0.0",description:"String get index of operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(he.GetIndexOf);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const s=n.map(y=>{var m,T;return((m=y.value)==null?void 0:m.valueAsType)||((T=y.value)==null?void 0:T.value)}),u=s[0],e=s[1];if(typeof u!="string")return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:"No string provided",result:null};if(typeof e!="string")return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:"No search value provided",result:null};const f=u.indexOf(e);return{value:K.Success,error:null,result:f}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class yEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_APPEND,version:"1.0.0",description:"String append operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(he.Append);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(A=>{var O,P;return((P=(O=A.valueOwner)==null?void 0:O.declaration)==null?void 0:P.id)===G.operation[he.Append].inputs.stringValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(A=>{var O,P;return((P=(O=A.valueOwner)==null?void 0:O.declaration)==null?void 0:P.id)===G.operation[he.Append].inputs.valueToAppend.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),R=n.filter(A=>{var O,P;return((P=(O=A.valueOwner)==null?void 0:O.declaration)==null?void 0:P.id)===G.operation[he.Append].inputs.dynamicArgument.id}).map(A=>{var O,P;return((O=A.value)==null?void 0:O.valueAsType)??((P=A.value)==null?void 0:P.value)});if(typeof m!="string")return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:"No string provided",result:null};if(typeof g!="string")return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:"No value to append provided",result:null};if(!R.every(A=>typeof A=="string"))return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:"All values to append must be strings",result:null};const I=[m,g,...R].join("");return{value:K.Success,error:null,result:I}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class hEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PREPEND,version:"1.0.0",description:"String prepend operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(he.Prepend);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const s=n.map(y=>{var m,T;return((m=y.value)==null?void 0:m.valueAsType)||((T=y.value)==null?void 0:T.value)}),u=s[0],e=s[1];if(typeof u!="string")return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:"No string provided",result:null};const f=e+u;return{value:K.Success,error:null,result:f}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class mEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TRIM,version:"1.0.0",description:"String trim implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(he.Trim);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s]=n.map(e=>{var f,y;return((f=e.value)==null?void 0:f.valueAsType)??((y=e.value)==null?void 0:y.value)}),u=s.trim();return{value:K.Success,error:null,result:u}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class TEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TRIM_START,version:"1.0.0",description:"String trimStart implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(he.TrimStart);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s]=n.map(e=>{var f,y;return((f=e.value)==null?void 0:f.valueAsType)??((y=e.value)==null?void 0:y.value)}),u=s.trimStart();return{value:K.Success,error:null,result:u}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class vEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TRIM_END,version:"1.0.0",description:"String trimEnd implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(he.TrimEnd);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s]=n.map(e=>{var f,y;return((f=e.value)==null?void 0:f.valueAsType)??((y=e.value)==null?void 0:y.value)}),u=s.trimEnd();return{value:K.Success,error:null,result:u}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class gEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SUBSTRING,version:"1.0.0",description:"String substring(start, end?) implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(he.Substring);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u,e]=n.map(y=>{var m,T;return((m=y.value)==null?void 0:m.valueAsType)??((T=y.value)==null?void 0:T.value)}),f=s.substring(u,e??void 0);return{value:K.Success,error:null,result:f}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class bEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SLICE,version:"1.0.0",description:"String slice(start, end?) implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(he.Slice);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u,e]=n.map(y=>{var m,T;return((m=y.value)==null?void 0:m.valueAsType)??((T=y.value)==null?void 0:T.value)}),f=s.slice(u,e??void 0);return{value:K.Success,error:null,result:f}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class EEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LAST_INDEX_OF,version:"1.0.0",description:"String lastIndexOf(search, fromIndex?) implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(he.GetLastIndexOf);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u,e]=n.map(y=>{var m,T;return((m=y.value)==null?void 0:m.valueAsType)??((T=y.value)==null?void 0:T.value)}),f=s.lastIndexOf(u,e??void 0);return{value:K.Success,error:null,result:f}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class IEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PAD_START,version:"1.0.0",description:"String padStart(targetLength, padString?) implementation",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(he.PadStart);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u,e]=n.map(y=>{var m,T;return((m=y.value)==null?void 0:m.valueAsType)??((T=y.value)==null?void 0:T.value)}),f=s.padStart(u,e??void 0);return{value:K.Success,error:null,result:f}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class REt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PAD_END,version:"1.0.0",description:"String padEnd(targetLength, padString?) implementation",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(he.PadEnd);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u,e]=n.map(y=>{var m,T;return((m=y.value)==null?void 0:m.valueAsType)??((T=y.value)==null?void 0:T.value)}),f=s.padEnd(u,e??void 0);return{value:K.Success,error:null,result:f}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class AEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPEAT,version:"1.0.0",description:"String repeat(count) implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(he.Repeat);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u]=n.map(f=>{var y,m;return((y=f.value)==null?void 0:y.valueAsType)??((m=f.value)==null?void 0:m.value)}),e=s.repeat(u);return{value:K.Success,error:null,result:e}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class DEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_MATCH_REGEX,version:"1.0.0",description:"String match(regex) -> first match array or null",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(he.MatchRegex);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u,e]=n.map(m=>{var T,g;return((T=m.value)==null?void 0:T.valueAsType)??((g=m.value)==null?void 0:g.value)}),f=new RegExp(String(u??""),e?String(e):void 0),y=String(s??"").match(f);return{value:K.Success,error:null,result:y}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class CEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_MATCH_ALL_REGEX,version:"1.0.0",description:"String matchAll(regex) -> array of matches",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(he.MatchAllRegex);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u,e]=n.map(g=>{var b,R;return((b=g.value)==null?void 0:b.valueAsType)??((R=g.value)==null?void 0:R.value)}),f=e?String(e):"",y=f.includes("g")?f:f+"g",m=new RegExp(String(u??""),y),T=Array.from(String(s??"").matchAll(m),g=>Array.from(g));return{value:K.Success,error:null,result:T}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class wEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SEARCH_REGEX,version:"1.0.0",description:"String search(regex) -> index or -1",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(he.SearchRegex);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u,e]=n.map(y=>{var m,T;return((m=y.value)==null?void 0:m.valueAsType)??((T=y.value)==null?void 0:T.value)});let f=-1;try{const y=new RegExp(String(u??""),e?String(e):void 0);f=String(s??"").search(y)}catch{f=-1}return{value:K.Success,error:null,result:f}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class OEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_REGEX,version:"1.0.0",description:"String replace using RegExp (pattern, replacement, flags?)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(he.ReplaceRegex);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u,e,f]=n.map(T=>{var g,b;return((g=T.value)==null?void 0:g.valueAsType)??((b=T.value)==null?void 0:b.value)});let y=String(s??"");const m=new RegExp(String(u??""),f?String(f):void 0);return y=y.replace(m,String(e??"")),{value:K.Success,error:null,result:y}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class xEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_NORMALIZE_UNICODE,version:"1.0.0",description:"String normalize(form?) implementation module (NFC by default)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(he.NormalizeUnicode);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u]=n.map(f=>{var y,m;return((y=f.value)==null?void 0:y.valueAsType)??((m=f.value)==null?void 0:m.value)}),e=s.normalize(u||"NFC");return{value:K.Success,error:null,result:e}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}const AO=class AO extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REMOVE_DIACRITICS,version:"1.0.0",description:"Remove diacritics via NFD decomposition + strip combining marks",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(he.RemoveDiacritics);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s]=n.map(e=>{var f,y;return((f=e.value)==null?void 0:f.valueAsType)??((y=e.value)==null?void 0:y.value)}),u=String(s??"").normalize("NFD").replace(AO.COMBINING_MARKS,"");return{value:K.Success,error:null,result:u}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}};C(AO,"COMBINING_MARKS",/[\u0300-\u036f]/g);let Xw=AO;class PEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_COUNT_OCCURRENCES,version:"1.0.0",description:"Count literal substring occurrences in a string",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(he.CountOccurrences);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u]=n.map(m=>{var T,g;return((T=m.value)==null?void 0:T.valueAsType)??((g=m.value)==null?void 0:g.value)}),e=String(s??""),f=String(u??""),y=f===""?0:e.split(f).length-1;return{value:K.Success,error:null,result:y}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class VEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.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:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(he.EnsurePrefix);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u]=n.map(m=>{var T,g;return((T=m.value)==null?void 0:T.valueAsType)??((g=m.value)==null?void 0:g.value)}),e=String(s??""),f=String(u??""),y=e.startsWith(f)?e:f+e;return{value:K.Success,error:null,result:y}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class NEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.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:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(he.EnsureSuffix);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u]=n.map(m=>{var T,g;return((T=m.value)==null?void 0:T.valueAsType)??((g=m.value)==null?void 0:g.value)}),e=String(s??""),f=String(u??""),y=e.endsWith(f)?e:e+f;return{value:K.Success,error:null,result:y}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class _Et extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REMOVE_PREFIX,version:"1.0.0",description:"Remove prefix if present",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(he.RemovePrefix);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u]=n.map(m=>{var T,g;return((T=m.value)==null?void 0:T.valueAsType)??((g=m.value)==null?void 0:g.value)}),e=String(s??""),f=String(u??""),y=e.startsWith(f)?e.slice(f.length):e;return{value:K.Success,error:null,result:y}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class $Et extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REMOVE_SUFFIX,version:"1.0.0",description:"Remove suffix if present",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(he.RemoveSuffix);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u]=n.map(m=>{var T,g;return((T=m.value)==null?void 0:T.valueAsType)??((g=m.value)==null?void 0:g.value)}),e=String(s??""),f=String(u??""),y=e.endsWith(f)?e.slice(0,-f.length):e;return{value:K.Success,error:null,result:y}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class GEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_STARTS_WITH,version:"1.0.0",description:"String startsWith(needle) -> boolean",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(he.StartsWith);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u]=n.map(f=>{var y,m;return((y=f.value)==null?void 0:y.valueAsType)??((m=f.value)==null?void 0:m.value)});if(typeof s!="string"||typeof u!="string")throw new TypeError("StartsWith expects two strings.");const e=s.startsWith(u);return{value:K.Success,error:null,result:e}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class LEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ENDS_WITH,version:"1.0.0",description:"String endsWith(needle) -> boolean",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(he.EndsWith);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u]=n.map(f=>{var y,m;return((y=f.value)==null?void 0:y.valueAsType)??((m=f.value)==null?void 0:m.value)});if(typeof s!="string"||typeof u!="string")throw new TypeError("EndsWith expects two strings.");const e=s.endsWith(u);return{value:K.Success,error:null,result:e}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class BEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_CONTAINS,version:"1.0.0",description:"String includes(needle) -> boolean",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(he.Contains);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u]=n.map(f=>{var y,m;return((y=f.value)==null?void 0:y.valueAsType)??((m=f.value)==null?void 0:m.value)});if(typeof s!="string"||typeof u!="string")throw new TypeError("Contains expects two strings.");const e=s.includes(u);return{value:K.Success,error:null,result:e}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class SEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.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:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(he.MatchesRegex);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u,e]=n.map(m=>{var T,g;return((T=m.value)==null?void 0:T.valueAsType)??((g=m.value)==null?void 0:g.value)});if(typeof s!="string"||typeof u!="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(u,e).test(s),{value:K.Success,error:null,result:f}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}function MEt(a,p){const t=Number(a),s=10**Math.max(0,Number(p)||0);return Math.round(t*s)/s}function FEt(a,p){const t=Number(a),n=Math.abs(Number(p)||0);return n===0?t:Math.round(t/n)*n}function kEt(a,p,t){const n=Number(a),s=Number(p),u=Number(t);return Math.min(Math.max(n,s),u)}function UEt(a,p,t,n,s){const u=Number(a),e=Number(p),f=Number(t),y=Number(n),m=Number(s);if(e===f)throw new Error("Input range cannot be zero");const T=(u-e)/(f-e);return y+T*(m-y)}function KEt(...a){const p=a.map(n=>Number(n));return p.length===0?0:p.reduce((n,s)=>n+s,0)/p.length}function jEt(...a){const p=a.map(n=>Number(n)).sort((n,s)=>n-s);if(p.length===0)return 0;const t=Math.floor(p.length/2);return p.length%2?p[t]:(p[t-1]+p[t])/2}function qEt(a,p){const t=Number(a),n=Number(p);return n===0?NaN:t<0&&n%2===1?-Math.pow(-t,1/n):Math.pow(t,1/n)}function ZEt(a,p){const t=Number(a),n=Number(p);return t===0?1/0:(n-t)/t*100}const Mr=a=>a.map(p=>{var t,n;return((t=p.value)==null?void 0:t.valueAsType)??((n=p.value)==null?void 0:n.value)});class HEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ADDITION,version:"1.0.0",description:"Number addition operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(Ae.Addition);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const u=Mr(n).reduce((e,f)=>e+f,0);return{value:K.Success,error:null,result:u}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class WEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SUBTRACTION,version:"1.0.0",description:"Number subtraction operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(Ae.Subtraction);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const u=Mr(n).reduce((e,f)=>e-f,0);return{value:K.Success,error:null,result:u}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class zEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MULTIPLICATION,version:"1.0.0",description:"Number multiplication operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(Ae.Multiplication);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(O=>{var P,x;return((x=(P=O.valueOwner)==null?void 0:P.declaration)==null?void 0:x.id)===G.operation[Ae.Multiplication].inputs.firstFactor.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(O=>{var P,x;return((x=(P=O.valueOwner)==null?void 0:P.declaration)==null?void 0:x.id)===G.operation[Ae.Multiplication].inputs.secondFactor.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),R=n.filter(O=>{var P,x;return((x=(P=O.valueOwner)==null?void 0:P.declaration)==null?void 0:x.id)===G.operation[Ae.Multiplication].inputs.dynamicFactor.id}).map(O=>{var P,x;return((P=O.value)==null?void 0:P.valueAsType)??((x=O.value)==null?void 0:x.value)}),A=[m,g,...R].reduce((O,P)=>O*P,1);return{value:K.Success,error:null,result:A}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class YEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_DIVISION,version:"1.0.0",description:"Number division operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(Ae.Division);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const[s,u]=Mr(n);if(u===0)throw new Error("Division by zero is not allowed");const e=s/u;return{value:K.Success,error:null,result:e}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class JEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_REMAINDER,version:"1.0.0",description:"Number remainder operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(Ae.Remainder);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const[s,u]=Mr(n);if(u===0)throw new Error("Division by zero is not allowed");const e=s%u;return{value:K.Success,error:null,result:e}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class QEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_EXPONENTIATION,version:"1.0.0",description:"Number exponentiation operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(Ae.Exponentiation);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const[s,u]=Mr(n),e=Math.pow(s,u);return{value:K.Success,error:null,result:e}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class XEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_NEGATE,version:"1.0.0",description:"Number negate (unary -x)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.Negate);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s]=Mr(n);return{value:K.Success,error:null,result:-s}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class eIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ABSOLUTE,version:"1.0.0",description:"Number absolute (|x|)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.Absolute);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s]=Mr(n);return{value:K.Success,error:null,result:Math.abs(Number(s))}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class tIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SIGN,version:"1.0.0",description:"Number sign (-1 | 0 | 1)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.Sign);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s]=Mr(n);return{value:K.Success,error:null,result:Math.sign(Number(s))}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class iIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ROUND,version:"1.0.0",description:"Number round to nearest integer",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.Round);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s]=Mr(n);return{value:K.Success,error:null,result:Math.round(Number(s))}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}class nIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_FLOOR,version:"1.0.0",description:"Number floor (⌊x⌋)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.Floor);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s]=Mr(n);return{value:K.Success,error:null,result:Math.floor(Number(s))}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}class rIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_CEIL,version:"1.0.0",description:"Number ceil (⌈x⌉)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.Ceil);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s]=Mr(n);return{value:K.Success,error:null,result:Math.ceil(Number(s))}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}class aIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TRUNC,version:"1.0.0",description:"Number truncation (drop fractional part)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.Trunc);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s]=Mr(n);return{value:K.Success,error:null,result:Math.trunc(Number(s))}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}class sIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ROUND_TO_DECIMALS,version:"1.0.0",description:"Round to N decimals",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.RoundToDecimals);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u]=Mr(n),e=MEt(s,u);return{value:K.Success,error:null,result:e}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}class lIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.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:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.SnapToStep);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u]=Mr(n),e=FEt(s,u);return{value:K.Success,error:null,result:e}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}class oIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_CLAMP,version:"1.0.0",description:"Clamp value to [min, max]",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.Clamp);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u,e]=Mr(n),f=kEt(s,u,e);return{value:K.Success,error:null,result:f}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}class dIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MAP_RANGE,version:"1.0.0",description:"Map value from [inMin,inMax] to [outMin,outMax]",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.MapRange);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u,e,f,y]=Mr(n),m=UEt(s,u,e,f,y);return{value:K.Success,error:null,result:m}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}class pIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_AVERAGE,version:"1.0.0",description:"Average(numbers...)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.Average);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(O=>{var P,x;return((x=(P=O.valueOwner)==null?void 0:P.declaration)==null?void 0:x.id)===G.operation[Ae.Average].inputs.firstValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(O=>{var P,x;return((x=(P=O.valueOwner)==null?void 0:P.declaration)==null?void 0:x.id)===G.operation[Ae.Average].inputs.secondValue.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),R=n.filter(O=>{var P,x;return((x=(P=O.valueOwner)==null?void 0:P.declaration)==null?void 0:x.id)===G.operation[Ae.Average].inputs.dynamicValue.id}).map(O=>{var P,x;return((P=O.value)==null?void 0:P.valueAsType)??((x=O.value)==null?void 0:x.value)}),I=[m,g,...R],A=KEt(...I);return{value:K.Success,error:null,result:A}}catch(y){return{value:K.UnhandledError,error:y,result:null}}}})}}class uIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MEDIAN,version:"1.0.0",description:"Median(numbers...)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.Median);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(O=>{var P,x;return((x=(P=O.valueOwner)==null?void 0:P.declaration)==null?void 0:x.id)===G.operation[Ae.Median].inputs.firstValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(O=>{var P,x;return((x=(P=O.valueOwner)==null?void 0:P.declaration)==null?void 0:x.id)===G.operation[Ae.Median].inputs.secondValue.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),R=n.filter(O=>{var P,x;return((x=(P=O.valueOwner)==null?void 0:P.declaration)==null?void 0:x.id)===G.operation[Ae.Median].inputs.dynamicValue.id}).map(O=>{var P,x;return((P=O.value)==null?void 0:P.valueAsType)??((x=O.value)==null?void 0:x.value)}),I=[m,g,...R],A=jEt(...I);return{value:K.Success,error:null,result:A}}catch(y){return{value:K.UnhandledError,error:y,result:null}}}})}}class cIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MIN_OF,version:"1.0.0",description:"Min(numbers...)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.MinOf);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(O=>{var P,x;return((x=(P=O.valueOwner)==null?void 0:P.declaration)==null?void 0:x.id)===G.operation[Ae.MinOf].inputs.firstValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(O=>{var P,x;return((x=(P=O.valueOwner)==null?void 0:P.declaration)==null?void 0:x.id)===G.operation[Ae.MinOf].inputs.secondValue.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),R=n.filter(O=>{var P,x;return((x=(P=O.valueOwner)==null?void 0:P.declaration)==null?void 0:x.id)===G.operation[Ae.MinOf].inputs.dynamicValue.id}).map(O=>{var P,x;return((P=O.value)==null?void 0:P.valueAsType)??((x=O.value)==null?void 0:x.value)}),I=[m,g,...R].filter(O=>typeof O=="number"&&!Number.isNaN(O)),A=I.length?Math.min(...I):1/0;return{value:K.Success,error:null,result:A}}catch(y){return{value:K.UnhandledError,error:y,result:null}}}})}}class fIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MAX_OF,version:"1.0.0",description:"Max(numbers...)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.MaxOf);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(O=>{var P,x;return((x=(P=O.valueOwner)==null?void 0:P.declaration)==null?void 0:x.id)===G.operation[Ae.MaxOf].inputs.firstValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(O=>{var P,x;return((x=(P=O.valueOwner)==null?void 0:P.declaration)==null?void 0:x.id)===G.operation[Ae.MaxOf].inputs.secondValue.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),R=n.filter(O=>{var P,x;return((x=(P=O.valueOwner)==null?void 0:P.declaration)==null?void 0:x.id)===G.operation[Ae.MaxOf].inputs.dynamicValue.id}).map(O=>{var P,x;return((P=O.value)==null?void 0:P.valueAsType)??((x=O.value)==null?void 0:x.value)}),I=[m,g,...R].filter(O=>typeof O=="number"&&!Number.isNaN(O)),A=I.length?Math.max(...I):-1/0;return{value:K.Success,error:null,result:A}}catch(y){return{value:K.UnhandledError,error:y,result:null}}}})}}class yIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SQUARE_ROOT,version:"1.0.0",description:"Square root",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.SquareRoot);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s]=Mr(n);return{value:K.Success,error:null,result:Math.sqrt(Number(s))}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}class hIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_CUBE_ROOT,version:"1.0.0",description:"Cube root",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.CubeRoot);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s]=Mr(n);return{value:K.Success,error:null,result:Math.cbrt(Number(s))}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}class mIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_NTH_ROOT,version:"1.0.0",description:"Nth root (value, n)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.NthRoot);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u]=Mr(n),e=qEt(s,u);return{value:K.Success,error:null,result:e}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}class TIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_EXP,version:"1.0.0",description:"e^x",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.Exp);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s]=Mr(n);return{value:K.Success,error:null,result:Math.exp(Number(s))}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}class vIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LOG_NATURAL,version:"1.0.0",description:"Natural log ln(x)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.LogNatural);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s]=Mr(n);return{value:K.Success,error:null,result:Math.log(Number(s))}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}class gIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LOG10,version:"1.0.0",description:"Log base 10",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.Log10);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s]=Mr(n),u=Number(s),e=Math.log10?Math.log10(u):Math.log(u)/Math.LN10;return{value:K.Success,error:null,result:e}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}class bIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SIN,version:"1.0.0",description:"sin(x in radians)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.Sin);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s]=Mr(n);return{value:K.Success,error:null,result:Math.sin(Number(s))}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}class EIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_COS,version:"1.0.0",description:"cos(x in radians)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.Cos);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s]=Mr(n);return{value:K.Success,error:null,result:Math.cos(Number(s))}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}class IIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TAN,version:"1.0.0",description:"tan(x in radians)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.Tan);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s]=Mr(n);return{value:K.Success,error:null,result:Math.tan(Number(s))}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}class RIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ASIN,version:"1.0.0",description:"asin(x)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.Asin);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s]=Mr(n);return{value:K.Success,error:null,result:Math.asin(Number(s))}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}class AIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ACOS,version:"1.0.0",description:"acos(x)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.Acos);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s]=Mr(n);return{value:K.Success,error:null,result:Math.acos(Number(s))}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}class DIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ATAN,version:"1.0.0",description:"atan(x)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.Atan);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s]=Mr(n);return{value:K.Success,error:null,result:Math.atan(Number(s))}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}class CIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ATAN2,version:"1.0.0",description:"atan2(y, x)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.Atan2);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u]=Mr(n);return{value:K.Success,error:null,result:Math.atan2(Number(s),Number(u))}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}class wIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TO_RADIANS,version:"1.0.0",description:"deg → rad",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.ToRadians);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s]=Mr(n);return{value:K.Success,error:null,result:Number(s)*Math.PI/180}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}class OIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TO_DEGREES,version:"1.0.0",description:"rad → deg",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.ToDegrees);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s]=Mr(n);return{value:K.Success,error:null,result:Number(s)*180/Math.PI}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}class xIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_PERCENT_OF,version:"1.0.0",description:"x percent of y",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.PercentOf);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u]=Mr(n),e=Number(s)/100*Number(u);return{value:K.Success,error:null,result:e}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}class KL extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_PERCENTAGE_CHANGE,version:"1.0.0",description:"((new-old)/old)*100",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.PercentageChange);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u]=Mr(n),e=ZEt(s,u);return{value:K.Success,error:null,result:e}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}class PIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LESS_THAN,version:"1.0.0",description:"a < b",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.LessThan);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u]=Mr(n);return{value:K.Success,error:null,result:s<u}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}class VIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MORE_THAN,version:"1.0.0",description:"a > b",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.MoreThan);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u]=Mr(n);return{value:K.Success,error:null,result:s>u}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}class NIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LESS_THAN_OR_EQUAL,version:"1.0.0",description:"a <= b",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.LessThanOrEqual);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u]=Mr(n);return{value:K.Success,error:null,result:s<=u}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}class _It extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MORE_THAN_OR_EQUAL,version:"1.0.0",description:"a >= b",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.MoreThanOrEqual);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u]=Mr(n);return{value:K.Success,error:null,result:s>=u}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}function $It(a,p){return function(){return a.apply(p,arguments)}}const{toString:jbn}=Object.prototype,{getPrototypeOf:w4}=Object,{iterator:fV,toStringTag:GIt}=Symbol,yV=(a=>p=>{const t=jbn.call(p);return a[t]||(a[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),Gc=a=>(a=a.toLowerCase(),p=>yV(p)===a),hV=a=>p=>typeof p===a,{isArray:DE}=Array,Yg=hV("undefined");function S1(a){return a!==null&&!Yg(a)&&a.constructor!==null&&!Yg(a.constructor)&&kd(a.constructor.isBuffer)&&a.constructor.isBuffer(a)}const LIt=Gc("ArrayBuffer");function qbn(a){let p;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?p=ArrayBuffer.isView(a):p=a&&a.buffer&&LIt(a.buffer),p}const Zbn=hV("string"),kd=hV("function"),BIt=hV("number"),M1=a=>a!==null&&typeof a=="object",Hbn=a=>a===!0||a===!1,ww=a=>{if(yV(a)!=="object")return!1;const p=w4(a);return(p===null||p===Object.prototype||Object.getPrototypeOf(p)===null)&&!(GIt in a)&&!(fV in a)},Wbn=a=>{if(!M1(a)||S1(a))return!1;try{return Object.keys(a).length===0&&Object.getPrototypeOf(a)===Object.prototype}catch{return!1}},zbn=Gc("Date"),Ybn=Gc("File"),Jbn=a=>!!(a&&typeof a.uri<"u"),Qbn=a=>a&&typeof a.getParts<"u",Xbn=Gc("Blob"),eEn=Gc("FileList"),tEn=a=>M1(a)&&kd(a.pipe);function iEn(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const QH=iEn(),XH=typeof QH.FormData<"u"?QH.FormData:void 0,nEn=a=>{let p;return a&&(XH&&a instanceof XH||kd(a.append)&&((p=yV(a))==="formdata"||p==="object"&&kd(a.toString)&&a.toString()==="[object FormData]"))},rEn=Gc("URLSearchParams"),[aEn,sEn,lEn,oEn]=["ReadableStream","Request","Response","Headers"].map(Gc),dEn=a=>a.trim?a.trim():a.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function F1(a,p,{allOwnKeys:t=!1}={}){if(a===null||typeof a>"u")return;let n,s;if(typeof a!="object"&&(a=[a]),DE(a))for(n=0,s=a.length;n<s;n++)p.call(null,a[n],n,a);else{if(S1(a))return;const u=t?Object.getOwnPropertyNames(a):Object.keys(a),e=u.length;let f;for(n=0;n<e;n++)f=u[n],p.call(null,a[f],f,a)}}function SIt(a,p){if(S1(a))return null;p=p.toLowerCase();const t=Object.keys(a);let n=t.length,s;for(;n-- >0;)if(s=t[n],p===s.toLowerCase())return s;return null}const tT=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),MIt=a=>!Yg(a)&&a!==tT;function jL(){const{caseless:a,skipUndefined:p}=MIt(this)&&this||{},t={},n=(s,u)=>{if(u==="__proto__"||u==="constructor"||u==="prototype")return;const e=a&&SIt(t,u)||u;ww(t[e])&&ww(s)?t[e]=jL(t[e],s):ww(s)?t[e]=jL({},s):DE(s)?t[e]=s.slice():(!p||!Yg(s))&&(t[e]=s)};for(let s=0,u=arguments.length;s<u;s++)arguments[s]&&F1(arguments[s],n);return t}const pEn=(a,p,t,{allOwnKeys:n}={})=>(F1(p,(s,u)=>{t&&kd(s)?Object.defineProperty(a,u,{value:$It(s,t),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(a,u,{value:s,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:n}),a),uEn=a=>(a.charCodeAt(0)===65279&&(a=a.slice(1)),a),cEn=(a,p,t,n)=>{a.prototype=Object.create(p.prototype,n),Object.defineProperty(a.prototype,"constructor",{value:a,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(a,"super",{value:p.prototype}),t&&Object.assign(a.prototype,t)},fEn=(a,p,t,n)=>{let s,u,e;const f={};if(p=p||{},a==null)return p;do{for(s=Object.getOwnPropertyNames(a),u=s.length;u-- >0;)e=s[u],(!n||n(e,a,p))&&!f[e]&&(p[e]=a[e],f[e]=!0);a=t!==!1&&w4(a)}while(a&&(!t||t(a,p))&&a!==Object.prototype);return p},yEn=(a,p,t)=>{a=String(a),(t===void 0||t>a.length)&&(t=a.length),t-=p.length;const n=a.indexOf(p,t);return n!==-1&&n===t},hEn=a=>{if(!a)return null;if(DE(a))return a;let p=a.length;if(!BIt(p))return null;const t=new Array(p);for(;p-- >0;)t[p]=a[p];return t},mEn=(a=>p=>a&&p instanceof a)(typeof Uint8Array<"u"&&w4(Uint8Array)),TEn=(a,p)=>{const n=(a&&a[fV]).call(a);let s;for(;(s=n.next())&&!s.done;){const u=s.value;p.call(a,u[0],u[1])}},vEn=(a,p)=>{let t;const n=[];for(;(t=a.exec(p))!==null;)n.push(t);return n},gEn=Gc("HTMLFormElement"),bEn=a=>a.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,n,s){return n.toUpperCase()+s}),e5=(({hasOwnProperty:a})=>(p,t)=>a.call(p,t))(Object.prototype),EEn=Gc("RegExp"),FIt=(a,p)=>{const t=Object.getOwnPropertyDescriptors(a),n={};F1(t,(s,u)=>{let e;(e=p(s,u,a))!==!1&&(n[u]=e||s)}),Object.defineProperties(a,n)},IEn=a=>{FIt(a,(p,t)=>{if(kd(a)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const n=a[t];if(kd(n)){if(p.enumerable=!1,"writable"in p){p.writable=!1;return}p.set||(p.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},REn=(a,p)=>{const t={},n=s=>{s.forEach(u=>{t[u]=!0})};return DE(a)?n(a):n(String(a).split(p)),t},AEn=()=>{},DEn=(a,p)=>a!=null&&Number.isFinite(a=+a)?a:p;function CEn(a){return!!(a&&kd(a.append)&&a[GIt]==="FormData"&&a[fV])}const wEn=a=>{const p=new Array(10),t=(n,s)=>{if(M1(n)){if(p.indexOf(n)>=0)return;if(S1(n))return n;if(!("toJSON"in n)){p[s]=n;const u=DE(n)?[]:{};return F1(n,(e,f)=>{const y=t(e,s+1);!Yg(y)&&(u[f]=y)}),p[s]=void 0,u}}return n};return t(a,0)},OEn=Gc("AsyncFunction"),xEn=a=>a&&(M1(a)||kd(a))&&kd(a.then)&&kd(a.catch),kIt=((a,p)=>a?setImmediate:p?((t,n)=>(tT.addEventListener("message",({source:s,data:u})=>{s===tT&&u===t&&n.length&&n.shift()()},!1),s=>{n.push(s),tT.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",kd(tT.postMessage)),PEn=typeof queueMicrotask<"u"?queueMicrotask.bind(tT):typeof process<"u"&&process.nextTick||kIt,VEn=a=>a!=null&&kd(a[fV]),Rt={isArray:DE,isArrayBuffer:LIt,isBuffer:S1,isFormData:nEn,isArrayBufferView:qbn,isString:Zbn,isNumber:BIt,isBoolean:Hbn,isObject:M1,isPlainObject:ww,isEmptyObject:Wbn,isReadableStream:aEn,isRequest:sEn,isResponse:lEn,isHeaders:oEn,isUndefined:Yg,isDate:zbn,isFile:Ybn,isReactNativeBlob:Jbn,isReactNative:Qbn,isBlob:Xbn,isRegExp:EEn,isFunction:kd,isStream:tEn,isURLSearchParams:rEn,isTypedArray:mEn,isFileList:eEn,forEach:F1,merge:jL,extend:pEn,trim:dEn,stripBOM:uEn,inherits:cEn,toFlatObject:fEn,kindOf:yV,kindOfTest:Gc,endsWith:yEn,toArray:hEn,forEachEntry:TEn,matchAll:vEn,isHTMLForm:gEn,hasOwnProperty:e5,hasOwnProp:e5,reduceDescriptors:FIt,freezeMethods:IEn,toObjectSet:REn,toCamelCase:bEn,noop:AEn,toFiniteNumber:DEn,findKey:SIt,global:tT,isContextDefined:MIt,isSpecCompliantForm:CEn,toJSONObject:wEn,isAsyncFn:OEn,isThenable:xEn,setImmediate:kIt,asap:PEn,isIterable:VEn};class Id extends Error{static from(p,t,n,s,u,e){const f=new Id(p.message,t||p.code,n,s,u);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,t,n,s,u){super(p),Object.defineProperty(this,"message",{value:p,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),n&&(this.config=n),s&&(this.request=s),u&&(this.response=u,this.status=u.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:Rt.toJSONObject(this.config),code:this.code,status:this.status}}}Id.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";Id.ERR_BAD_OPTION="ERR_BAD_OPTION";Id.ECONNABORTED="ECONNABORTED";Id.ETIMEDOUT="ETIMEDOUT";Id.ERR_NETWORK="ERR_NETWORK";Id.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";Id.ERR_DEPRECATED="ERR_DEPRECATED";Id.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";Id.ERR_BAD_REQUEST="ERR_BAD_REQUEST";Id.ERR_CANCELED="ERR_CANCELED";Id.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";Id.ERR_INVALID_URL="ERR_INVALID_URL";const Ur=Id,NEn=null;function qL(a){return Rt.isPlainObject(a)||Rt.isArray(a)}function UIt(a){return Rt.endsWith(a,"[]")?a.slice(0,-2):a}function jG(a,p,t){return a?a.concat(p).map(function(s,u){return s=UIt(s),!t&&u?"["+s+"]":s}).join(t?".":""):p}function _En(a){return Rt.isArray(a)&&!a.some(qL)}const $En=Rt.toFlatObject(Rt,{},null,function(p){return/^is[A-Z]/.test(p)});function mV(a,p,t){if(!Rt.isObject(a))throw new TypeError("target must be an object");p=p||new FormData,t=Rt.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(A,O){return!Rt.isUndefined(O[A])});const n=t.metaTokens,s=t.visitor||T,u=t.dots,e=t.indexes,y=(t.Blob||typeof Blob<"u"&&Blob)&&Rt.isSpecCompliantForm(p);if(!Rt.isFunction(s))throw new TypeError("visitor must be a function");function m(I){if(I===null)return"";if(Rt.isDate(I))return I.toISOString();if(Rt.isBoolean(I))return I.toString();if(!y&&Rt.isBlob(I))throw new Ur("Blob is not supported. Use a Buffer instead.");return Rt.isArrayBuffer(I)||Rt.isTypedArray(I)?y&&typeof Blob=="function"?new Blob([I]):Buffer.from(I):I}function T(I,A,O){let P=I;if(Rt.isReactNative(p)&&Rt.isReactNativeBlob(I))return p.append(jG(O,A,u),m(I)),!1;if(I&&!O&&typeof I=="object"){if(Rt.endsWith(A,"{}"))A=n?A:A.slice(0,-2),I=JSON.stringify(I);else if(Rt.isArray(I)&&_En(I)||(Rt.isFileList(I)||Rt.endsWith(A,"[]"))&&(P=Rt.toArray(I)))return A=UIt(A),P.forEach(function($,U){!(Rt.isUndefined($)||$===null)&&p.append(e===!0?jG([A],U,u):e===null?A:A+"[]",m($))}),!1}return qL(I)?!0:(p.append(jG(O,A,u),m(I)),!1)}const g=[],b=Object.assign($En,{defaultVisitor:T,convertValue:m,isVisitable:qL});function R(I,A){if(!Rt.isUndefined(I)){if(g.indexOf(I)!==-1)throw Error("Circular reference detected in "+A.join("."));g.push(I),Rt.forEach(I,function(P,x){(!(Rt.isUndefined(P)||P===null)&&s.call(p,P,Rt.isString(x)?x.trim():x,A,b))===!0&&R(P,A?A.concat(x):[x])}),g.pop()}}if(!Rt.isObject(a))throw new TypeError("data must be an object");return R(a),p}function t5(a){const p={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(a).replace(/[!'()~]|%20|%00/g,function(n){return p[n]})}function O4(a,p){this._pairs=[],a&&mV(a,this,p)}const KIt=O4.prototype;KIt.append=function(p,t){this._pairs.push([p,t])};KIt.toString=function(p){const t=p?function(n){return p.call(this,n,t5)}:t5;return this._pairs.map(function(s){return t(s[0])+"="+t(s[1])},"").join("&")};function GEn(a){return encodeURIComponent(a).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function jIt(a,p,t){if(!p)return a;const n=t&&t.encode||GEn,s=Rt.isFunction(t)?{serialize:t}:t,u=s&&s.serialize;let e;if(u?e=u(p,s):e=Rt.isURLSearchParams(p)?p.toString():new O4(p,s).toString(n),e){const f=a.indexOf("#");f!==-1&&(a=a.slice(0,f)),a+=(a.indexOf("?")===-1?"?":"&")+e}return a}class LEn{constructor(){this.handlers=[]}use(p,t,n){return this.handlers.push({fulfilled:p,rejected:t,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(p){this.handlers[p]&&(this.handlers[p]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(p){Rt.forEach(this.handlers,function(n){n!==null&&p(n)})}}const i5=LEn,x4={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},BEn=typeof URLSearchParams<"u"?URLSearchParams:O4,SEn=typeof FormData<"u"?FormData:null,MEn=typeof Blob<"u"?Blob:null,FEn={isBrowser:!0,classes:{URLSearchParams:BEn,FormData:SEn,Blob:MEn},protocols:["http","https","file","blob","url","data"]},P4=typeof window<"u"&&typeof document<"u",ZL=typeof navigator=="object"&&navigator||void 0,kEn=P4&&(!ZL||["ReactNative","NativeScript","NS"].indexOf(ZL.product)<0),UEn=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),KEn=P4&&window.location.href||"http://localhost",jEn=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:P4,hasStandardBrowserEnv:kEn,hasStandardBrowserWebWorkerEnv:UEn,navigator:ZL,origin:KEn},Symbol.toStringTag,{value:"Module"})),Co={...jEn,...FEn};function qEn(a,p){return mV(a,new Co.classes.URLSearchParams,{visitor:function(t,n,s,u){return Co.isNode&&Rt.isBuffer(t)?(this.append(n,t.toString("base64")),!1):u.defaultVisitor.apply(this,arguments)},...p})}function ZEn(a){return Rt.matchAll(/\w+|\[(\w*)]/g,a).map(p=>p[0]==="[]"?"":p[1]||p[0])}function HEn(a){const p={},t=Object.keys(a);let n;const s=t.length;let u;for(n=0;n<s;n++)u=t[n],p[u]=a[u];return p}function qIt(a){function p(t,n,s,u){let e=t[u++];if(e==="__proto__")return!0;const f=Number.isFinite(+e),y=u>=t.length;return e=!e&&Rt.isArray(s)?s.length:e,y?(Rt.hasOwnProp(s,e)?s[e]=[s[e],n]:s[e]=n,!f):((!s[e]||!Rt.isObject(s[e]))&&(s[e]=[]),p(t,n,s[e],u)&&Rt.isArray(s[e])&&(s[e]=HEn(s[e])),!f)}if(Rt.isFormData(a)&&Rt.isFunction(a.entries)){const t={};return Rt.forEachEntry(a,(n,s)=>{p(ZEn(n),s,t,0)}),t}return null}function WEn(a,p,t){if(Rt.isString(a))try{return(p||JSON.parse)(a),Rt.trim(a)}catch(n){if(n.name!=="SyntaxError")throw n}return(t||JSON.stringify)(a)}const V4={transitional:x4,adapter:["xhr","http","fetch"],transformRequest:[function(p,t){const n=t.getContentType()||"",s=n.indexOf("application/json")>-1,u=Rt.isObject(p);if(u&&Rt.isHTMLForm(p)&&(p=new FormData(p)),Rt.isFormData(p))return s?JSON.stringify(qIt(p)):p;if(Rt.isArrayBuffer(p)||Rt.isBuffer(p)||Rt.isStream(p)||Rt.isFile(p)||Rt.isBlob(p)||Rt.isReadableStream(p))return p;if(Rt.isArrayBufferView(p))return p.buffer;if(Rt.isURLSearchParams(p))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),p.toString();let f;if(u){if(n.indexOf("application/x-www-form-urlencoded")>-1)return qEn(p,this.formSerializer).toString();if((f=Rt.isFileList(p))||n.indexOf("multipart/form-data")>-1){const y=this.env&&this.env.FormData;return mV(f?{"files[]":p}:p,y&&new y,this.formSerializer)}}return u||s?(t.setContentType("application/json",!1),WEn(p)):p}],transformResponse:[function(p){const t=this.transitional||V4.transitional,n=t&&t.forcedJSONParsing,s=this.responseType==="json";if(Rt.isResponse(p)||Rt.isReadableStream(p))return p;if(p&&Rt.isString(p)&&(n&&!this.responseType||s)){const e=!(t&&t.silentJSONParsing)&&s;try{return JSON.parse(p,this.parseReviver)}catch(f){if(e)throw f.name==="SyntaxError"?Ur.from(f,Ur.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:Co.classes.FormData,Blob:Co.classes.Blob},validateStatus:function(p){return p>=200&&p<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Rt.forEach(["delete","get","head","post","put","patch"],a=>{V4.headers[a]={}});const N4=V4,zEn=Rt.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"]),YEn=a=>{const p={};let t,n,s;return a&&a.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:n,explanations:s,modifiedData:t}}subscribeDependents(t){return t.forEach(n=>{this.detachedDependents[n.entity.id]||(this.detachedDependents[n.entity.id]=n)}),this}unsubscribeDependents(t){return t.forEach(n=>{this.detachedDependents[n.entity.id]&&delete this.detachedDependents[n.entity.id]}),this}syncDependents(t=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,"sync-dependents"))){const n=[],s=[],u=[],e=[];return Object.values(this.detachedDependents).forEach(f=>{const y=f.entity.afterAllChildrenInitialized(t);n.push(...y.updated),s.push(...y.added),u.push(...y.removed),e.push(...y.affected)}),t==null||t.attemptAutoclose("sync-dependents",this.id),{updated:_(n),added:_(s),removed:_(u),affected:_(e),self:this}}onDetachedDependencyRemoved(t,n,s){const u=[],e=[],f=[],y=[];return n==="value-as-type-single"&&(this.valueAsTypeSingle=null,s==null||s.add(this,ye.Updated)),n==="value-as-type-list"&&(this.valueAsTypeList=(this.valueAsTypeList||[]).filter(m=>m.id!==t.id),s==null||s.add(this,ye.Updated)),{updated:_(u),added:_(e),removed:_(f),affected:_(y),self:this}}onDetachedDependencyRestored(t,n,s){const u=[],e=[],f=[],y=[];return n==="value-as-type-single"&&(this.valueAsTypeSingle=t,s==null||s.add(this,ye.Updated)),n==="value-as-type-list"&&(this.valueAsTypeList=[...Array.isArray(this.valueAsTypeList||[])?this.valueAsTypeList:[],t],s==null||s.add(this,ye.Updated)),{updated:_(u),added:_(e),removed:_(f),affected:_(y),self:this}}unsubscribeFromDependencies(){return this.valueAsTypeSingle&&this.valueAsTypeSingle.type!==r.BuiltInBaseEntity&&this.valueAsTypeSingle.unsubscribeDependents([{entity:this,field:"value-as-type-single"}]),this.valueAsTypeList&&Array.isArray(this.valueAsTypeList)&&this.valueAsTypeList.forEach(t=>{t.type!==r.BuiltInBaseEntity&&t.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(t=>{t.type!==r.BuiltInBaseEntity&&t.subscribeDependents([{entity:this,field:"value-as-type-list"}])}):this.valueAsTypeSingle&&this.valueAsTypeSingle.type!==r.BuiltInBaseEntity&&this.valueAsTypeSingle.subscribeDependents([{entity:this,field:"value-as-type-single"}]),this)}increaseVersion(t){var n;if(this.project.diggestedBuiltInBaseEntitiesIds.has(this.id))return this;if(t&&!j(t).isValid())throw new Error(`The shared timestamp '${t}' is not a valid ISO 8601 date string.`);if(t&&j(t).isSame(j(this.createdAt)))return this;if(!((n=this.knownVersions)!=null&&n.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=M.UUID.uuid(),this.createdAt=j(t).toISOString()||j().toISOString(),this}captureVersion(){var n;const t=((n=this.knownVersions)==null?void 0:n.get(this.version))||new Wn(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!==t.version)throw new Error(`Captured ${this.type} with id '${this.id}', version '${t.version}' does not match current entity version '${this.version}'.`);return this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,t):new Map().set(this.version,t),this.apply(t),this}snapshot(){const t=new Wn(this,this.project);return this.apply(t)}apply(t){const n=this.toMeta();return t.metaSync(n,null),t.valueAsTypeSingle=this.valueAsTypeSingle,t.valueAsTypeList=this.valueAsTypeList?[...this.valueAsTypeList]:this.valueAsTypeList,t.parent=this.parent,t}recursiveCaptureUpstreamVersions(t){const n=[],s=[],u=[],e=[];if(this.parent){this.parent.increaseVersion(t);const f=this.parent.recursiveCaptureUpstreamVersions(t);n.push(this.parent,...f.updated),s.push(...f.added),u.push(...f.removed)}return{updated:_(n),added:_(s),removed:_(u),affected:_(e),self:this}}async restoreVersion(t,n){var m;const s=[],u=[],e=[],f=[];if(this.version===t&&(n!=null&&n.skipIfSameVersion))return{updated:_(s),added:_(u),removed:_(e),affected:_(f),self:this};if(!this.knownVersions){const T=new Map;for(const[g,b]of this.knownVersions||new Map){if(T.set(g,b),b.activeVersion=!1,b.knownVersions)for(const[R,I]of b.knownVersions)T.set(R,I);b.knownVersions=null}}let y=(m=this.knownVersions)==null?void 0:m.get(t);if(!y){const T=await this.APILoadVersion({},t);if(!T)throw new Error(`Version with id '${t}' for entity with id '${this.id}' not found.`);y=new Wn(T,this.project)}return this.metaSync(y.toShallowJSON(),null),this.previousVersion=y.previousVersion,this.version=y.version,this.createdAt=y.createdAt,this.author=y.author,this.deleted=y.deleted,this.valueAsTypeSingle=y.valueAsTypeSingle,this.parent=y.parent,{updated:_(s),added:_(u),removed:_(e),affected:_(f),self:this}}updateWithShallowTransfer(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.UpdateWithShallowTransfer))){if(!this.checkCanEdit(this,n))return pe.Logger.warn(`[updateWithShallowTransfer] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(N.UpdateWithShallowTransfer,this.id),this;if(this.metaSync(t,n),this.version=t.version,this.createdAt=t.createdAt,this.author=t.author,this.deleted=t.deleted,this.previousVersion=t.previousVersion,this.unsubscribeFromDependencies(),t.parent&&t.standaloneParent)throw new Error(`Entity with id '${this.id}' cannot have both 'parent' and 'standaloneParent' properties set.`);if(t.parent){const s=ge(t.parent),u=this.project.get(s),e=this.parent;if(e&&e.id!==(u==null?void 0:u.id)&&this.removeFromParent(n),u)this.setParent(u,n),this.addSelfToProject(n);else throw new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${s}' that isn't found in the project`)}else if(t.standaloneParent){const s=ge(t.standaloneParent),u=this.project.get(s);if(u)this.setStandaloneParent(u,n);else throw new Error(`${this.type} with id '${this.id}' has a 'standaloneParent' reference '${s}' that isn't found in the project`)}else throw new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(t.valueAsTypeList&&Array.isArray(t.valueAsTypeList))this.valueAsTypeList=this.valueAsTypeList||[],t.valueAsTypeList.forEach(s=>{const u=ge(s),e=this.project.get(u);e&&this.addValueAsTypeToList(e,n)}),[...this.valueAsTypeList].forEach(s=>{(t.valueAsTypeList||[]).find(e=>ge(e)===s.id)||this.removeValueAsTypeFromList(s,n)}),this.setValueAsTypeSingle(null,n),this.metaSync({value:null},n);else if(t.valueAsTypeSingle){const s=ge(t.valueAsTypeSingle),u=this.project.get(s);u&&(this.setValueAsTypeSingle(u,n),this.setValueAsTypeList(null,n),this.metaSync({value:null},n))}else this.setValueAsTypeSingle(null,n),this.setValueAsTypeList(null,n);return this.captureVersion(),this.subscribeToDependencies(),n==null||n.attemptAutoclose(N.UpdateWithShallowTransfer,this.id),this}updateWithGenerationTarget(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.UpdateWithGenerationTarget))){if(!this.checkCanEdit(this,n))return pe.Logger.warn(`[updateWithGenerationTarget] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(N.UpdateWithGenerationTarget,this.id),this;if(this.metaSync(t,n),t.parent&&t.standaloneParent)throw new Error(`Entity with id '${this.id}' cannot have both 'parent' and 'standaloneParent' properties set.`);if(t.parent){const s=ge(t.parent),u=this.project.get(s),e=this.parent;if(e&&e.id!==(u==null?void 0:u.id)&&this.removeFromParent(n),u)this.setParent(u,n),this.addSelfToProject(n);else throw new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${s}' that isn't found in the project`)}else if(t.standaloneParent){const s=ge(t.standaloneParent),u=this.project.get(s);if(u)this.setStandaloneParent(u,n);else throw new Error(`${this.type} with id '${this.id}' has a 'standaloneParent' reference '${s}' that isn't found in the project`)}if(t.valueAsTypeList&&Array.isArray(t.valueAsTypeList))this.valueAsTypeList=this.valueAsTypeList||[],t.valueAsTypeList.forEach(s=>{const u=ge(s),e=this.project.get(u);e&&this.addValueAsTypeToList(e,n)}),[...this.valueAsTypeList].forEach(s=>{(t.valueAsTypeList||[]).find(e=>ge(e)===s.id)||this.removeValueAsTypeFromList(s,n)}),this.setValueAsTypeSingle(null,n),this.metaSync({value:null},n);else if(t.valueAsTypeSingle){const s=ge(t.valueAsTypeSingle),u=this.project.get(s);u&&(this.setValueAsTypeSingle(u,n),this.setValueAsTypeList(null,n),this.metaSync({value:null},n))}return(t.valueAsTypeSingle===null||t.valueAsTypeList||t.value!==null&&t.value!==void 0)&&this.setValueAsTypeSingle(null,n),(t.valueAsTypeList===null||t.valueAsTypeSingle||t.value!==null&&t.value!==void 0)&&this.setValueAsTypeList(null,n),this.captureVersion(),this.subscribeToDependencies(),n==null||n.attemptAutoclose(N.UpdateWithGenerationTarget,this.id),this}hydrateAncestors(){const t=[],n=[],s=[],u=[];if(this.initialData.parent&&this.initialData.standaloneParent){const e=ge(this.initialData.parent),f=this.project.get(e),y=ge(this.initialData.standaloneParent),m=this.project.get(y);let T="";throw f?T+=` Parent -> ${f.type}: '${f.id}' "${Ve(f,this.project)}".`:T+=" Parent -> not-found.",m?T+=` Standalone Parent -> ${m.type}: '${m.id}' "${Ve(m,this.project)}".`:T+=" Standalone Parent -> not-found.",new Error(`Entity with id '${this.id}' cannot have both 'parent' and 'standaloneParent' properties set.${T}`)}if(this.initialData.parent){const e=ge(this.initialData.parent),f=this.project.get(e);if(pe.Logger.log(`[LiteralValueState.hydrateAncestors] Hydrating parent reference '${e}' for entity with id '${this.id}'`),f)pe.Logger.log(`[LiteralValueState.hydrateAncestors] Setting parent reference '${f.id}' for entity with id '${this.id}'`),this.setParent(f,null),t.push(f);else throw pe.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=ge(this.initialData.standaloneParent),f=this.project.get(e);if(pe.Logger.log(`[LiteralValueState.hydrateAncestors] Hydrating standalone parent reference '${e}' for entity with id '${this.id}'`),f)pe.Logger.log(`[LiteralValueState.hydrateAncestors] Setting standalone parent reference '${f.id}' for entity with id '${this.id}'`),this.setStandaloneParent(f,null);else throw pe.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 pe.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=ge(e),y=this.project.get(f);y&&this.valueAsTypeList.push(y)});else if(this.initialData.valueAsTypeSingle){const e=ge(this.initialData.valueAsTypeSingle),f=this.project.get(e);f&&(this.valueAsTypeSingle=f)}return{updated:_(t),added:_(n),removed:_(s),affected:_(u),self:this}}afterAllChildrenInitialized(t=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.AfterAllChildrenInitialized))){if(!this.checkCanEdit(this,t))return pe.Logger.warn(`[afterAllChildrenInitialized] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),t==null||t.attemptAutoclose(N.AfterAllChildrenInitialized,this.id),{updated:[],added:[],removed:[],affected:[],self:this};const n=[],s=[],u=[],e=[];return this.initialized=!0,t==null||t.attemptAutoclose(N.AfterAllChildrenInitialized,this.id),{updated:_(n),added:_(s),removed:_(u),affected:_(e),self:this}}addSelfToProject(t=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,"add-self-to-project"))){var f,y;const n=[this],s=[],u=[],e=[];return((f=this.parent)==null?void 0:f.type)===r.DataType?this.parent.setEntity(this,t):(y=this.parent)==null||y.setDefaultValue(this,t),e.push(this.parent),this.subscribe(),this.subscribeToDependencies(),t==null||t.attemptAutoclose("add-self-to-project",this.id),{updated:_(n),added:_(s),removed:_(u),affected:_(e),self:this}}setParent(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.SetParent))){var s;return this.checkCanEditWithCounterpartAndSideEffects(this,t,N.SetParent,n)?(((s=this.parent)==null?void 0:s.id)!==(t==null?void 0:t.id)&&(this.parent=t,this.standaloneParent&&(this.standaloneParent=null,this.standalone=!1),n&&(n==null||n.add(this,ye.Updated))),n==null||n.attemptAutoclose(N.SetParent,this.id),this):this}setStandaloneParent(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.SetStandaloneParent))){var s;if(!this.checkCanEditWithCounterpartAndSideEffects(this,t,N.SetStandaloneParent,n))return this;if(this.project.get(this.id)&&this.parent)throw new Error("[LiteralValueState.setStandaloneParent] This literal-value belongs to the project AST and setting a standalone parent is not possible. Clone the instance, or create a separate one to be standalone.");return((s=this.standaloneParent)==null?void 0:s.id)!==(t==null?void 0:t.id)&&(this.parent&&(this.removeFromParent(n),this.parent=null),this.standaloneParent=t,this.standalone=!0,n&&(n==null||n.add(this,ye.Updated))),n==null||n.attemptAutoclose(N.SetStandaloneParent,this.id),this}addValueAsTypeToList(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.AddValueAsTypeToList))){return this.checkCanEdit(this,n)?((this.valueAsTypeList||[]).includes(t)||(this.valueAsTypeList=this.valueAsTypeList||[],this.valueAsTypeList.push(t),this.value!==null&&this.metaSync({value:null},n),this.valueAsTypeSingle!==null&&(this.valueAsTypeSingle=null,n==null||n.add(this,ye.Updated)),n==null||n.add(this,ye.Updated)),n==null||n.attemptAutoclose(N.AddValueAsTypeToList,this.id),this):(pe.Logger.warn(`[addValueAsTypeToList] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(N.AddValueAsTypeToList,this.id),this)}removeValueAsTypeFromList(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.RemoveValueAsTypeFromList))){return this.checkCanEdit(this,n)?(this.valueAsTypeList&&Array.isArray(this.valueAsTypeList)&&(this.valueAsTypeList||[]).includes(t)&&(this.valueAsTypeList=this.valueAsTypeList.filter(s=>s.id!==t.id),this.valueAsTypeList.length===0?this.valueAsTypeList=null:(this.value!==null&&this.metaSync({value:null},n),this.valueAsTypeSingle!==null&&(this.valueAsTypeSingle=null,n==null||n.add(this,ye.Updated))),n==null||n.add(this,ye.Updated)),n==null||n.attemptAutoclose(N.RemoveValueAsTypeFromList,this.id),this):(pe.Logger.warn(`[removeValueAsTypeFromList] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(N.RemoveValueAsTypeFromList,this.id),this)}setValueAsTypeSingle(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.SetValueAsTypeSingle))){return this.checkCanEdit(this,n)?(this.valueAsTypeSingle!==t&&(this.valueAsTypeSingle=t,n==null||n.add(this,ye.Updated)),n==null||n.attemptAutoclose(N.SetValueAsTypeSingle,this.id),this):(pe.Logger.warn(`[setValueAsTypeSingle] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(N.SetValueAsTypeSingle,this.id),this)}setValueAsTypeList(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.SetValueAsTypeList))){var s,u;return this.checkCanEdit(this,n)?(!t&&this.valueAsTypeList?(this.valueAsTypeList=null,n==null||n.add(this,ye.Updated)):t&&!this.valueAsTypeList?(this.valueAsTypeList=t,n==null||n.add(this,ye.Updated)):t&&this.valueAsTypeList&&((s=this.valueAsTypeList)==null?void 0:s.length)!==t.length?(this.valueAsTypeList=t,n==null||n.add(this,ye.Updated)):t&&this.valueAsTypeList&&((u=this.valueAsTypeList)!=null&&u.every((e,f)=>e!==t[f]))&&(this.valueAsTypeList=t,n==null||n.add(this,ye.Updated)),n==null||n.attemptAutoclose(N.SetValueAsTypeList,this.id),this):(pe.Logger.warn(`[setValueAsTypeList] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(N.SetValueAsTypeList,this.id),this)}setValueAsType(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.SetValueAsType))){return this.checkCanEdit(this,n)?t?(Array.isArray(t)?this.setValueAsTypeList(t,n):this.setValueAsTypeSingle(t,n),n==null||n.attemptAutoclose(N.SetValueAsType,this.id),this):(this.setValueAsTypeSingle(null,n),this.setValueAsTypeList(null,n),this):(pe.Logger.warn(`[setValueAsType] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(N.SetValueAsType,this.id),this)}initChildren(t=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,"init-children"))){if(this.initialized||this.startedInitialization)return this;if(this.startedInitialization=!0,this.standalone){if(this.initialData.valueAsTypeList&&Array.isArray(this.initialData.valueAsTypeList))this.valueAsTypeList=this.initialData.valueAsTypeList.map(n=>{if(n.type===r.GenericReference){const u=this.project.findSubscribedBuiltInInstanceFromReference(n);if(!u)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${n.entityType}' with id '${n.entityId}' that is not part of the project state.`);return u}const s=this.project.get(n.id);if(!s)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${n.type}' with id '${n.id}' that is not part of the project state.`);return s});else if(this.initialData.valueAsTypeSingle){if(this.initialData.valueAsTypeSingle.type===r.GenericReference){const s=this.project.findSubscribedBuiltInInstanceFromReference(this.initialData.valueAsTypeSingle);if(!s)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=s,this}const n=this.project.get(this.initialData.valueAsTypeSingle.id);if(!n)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${this.initialData.valueAsTypeSingle.type}' with id '${this.initialData.valueAsTypeSingle.id}' that is not part of the project state.`);this.valueAsTypeSingle=n}return this}if(this.initialData.valueAsTypeList&&Array.isArray(this.initialData.valueAsTypeList))this.valueAsTypeList=this.initialData.valueAsTypeList.map(n=>{if(n.type===r.GenericReference){const u=this.project.findSubscribedBuiltInInstanceFromReference(n);if(!u)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${n.entityType}' with id '${n.entityId}' that is not part of the project state.`);return u}const s=this.project.get(n.id);if(!s)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${n.type}' with id '${n.id}' that is not part of the project state.`);return s});else if(this.initialData.valueAsTypeSingle){if(this.initialData.valueAsTypeSingle.type===r.GenericReference){const s=ge(this.initialData.valueAsTypeSingle),u=s?this.project.get(s):null;if(!u)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=u,this}const n=this.project.get(this.initialData.valueAsTypeSingle.id);if(!n)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${this.initialData.valueAsTypeSingle.type}' with id '${this.initialData.valueAsTypeSingle.id}' that is not part of the project state.`);this.valueAsTypeSingle=n}return this.subscribeToDependencies(),this.afterAllChildrenInitialized(t),t==null||t.attemptAutoclose("init-children",this.id),this}subscribe(){var t;return this.activeVersion=!0,(t=this.knownVersions)==null||t.forEach(n=>{n.version!==this.version&&(n.activeVersion=!1)}),this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,"meta-sync"))){const s=ys(this,t,n);this.id==="3a497c83-1410-4ab0-8478-1e9c4f0c1935"&&t.value===!1&&console.trace("[LiteralValueState.metaSync] Test error");const u=fs(this,s),e=this.toMeta();this.name=s.name!==void 0?s.name:e.name,this.autogeneration=s.autogeneration!==void 0?s.autogeneration:e.autogeneration,this.value=s.value!==void 0?s.value:e.value,s.rawString!==void 0?this.rawString=s.rawString:s.value!==void 0&&typeof s.value=="string"?this.rawString=s.value:this.rawString=e.rawString;const f=t.valueAsTypeSingle!==void 0?t.valueAsTypeSingle:this.valueAsTypeSingle??null,y=t.valueAsTypeList!==void 0?t.valueAsTypeList:this.valueAsTypeList??null;return(this.name!==me.String||f!==null||y!==null&&y.length>0)&&(this.rawString=null,s.rawString=null),super.baseMetaSync(s,this,n),s.deleted===!0&&!e.deleted?n==null||n.add(this,ye.Removed):s.deleted===!1&&e.deleted?n==null||n.add(this,ye.Added):u&&(n==null||n.add(this,ye.Updated)),n==null||n.attemptAutoclose("meta-sync",this.id),this}async APILoad(t=gt,...n){return await Wn.repository.APILoad(this.id,...n),this}async APICreate(t=gt,...n){return await Wn.repository.APICreate(this.toShallowJSON(),...n),this}async APIUpdate(t=gt,...n){return await Wn.repository.APIUpdate(this.toShallowJSON(),...n),this}async APIDelete(t=gt,...n){return await Wn.repository.APIDelete(this.toShallowJSON(),...n),this}async APIClone(t=gt,...n){return await Wn.repository.APIClone(this.id,...n),this}async APILoadVersion(t=gt,n,...s){return await Wn.repository.APILoadVersion(this.id,n,...s)}removeFromParent(t=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.RemoveFromParent))){if(!this.checkCanEdit(this,t))return pe.Logger.warn(`[removeFromParent] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),t==null||t.attemptAutoclose(N.RemoveFromParent,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const n=[],s=[],u=[],e=[];return this.parent&&(this.parent.type===r.DataType?this.parent.setEntity(null,t):xO.includes(this.parent.type)&&this.parent.setDefaultValue(null,t),e.push(this.parent)),t==null||t.attemptAutoclose(N.RemoveFromParent,this.id),{added:_(u),updated:_(n),removed:_(s),affected:_(e),self:this}}remove({ignoreUpstream:t}={ignoreUpstream:!1},n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.RemoveEntity))){var y;if(!this.checkCanDelete(this,n))return pe.Logger.warn(`[remove] User is not allowed to delete or edit this ${this.type} entity with id: ${this.id}`),n==null||n.event({id:`${N.RemoveEntity}-${this.id}--${at.ActionOwnerEntityNonDeletable}`,action:N.RemoveEntity,owner:this,errorReason:at.ActionOwnerEntityNonDeletable,rootAction:((y=n==null?void 0:n.self)==null?void 0:y.id)===this.id&&(n==null?void 0:n.actionName)===N.RemoveEntity}),n==null||n.attemptAutoclose(N.RemoveEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const s=[],u=[],e=[],f=[];if(n!=null&&n.hasRemoved(this.id))return n==null||n.attemptAutoclose(N.RemoveEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(u.push(this),this.unsubscribe(),this.unsubscribeFromDependencies(),this.project.subscribeDeletedInstance(this),this.metaSync({deleted:!0},n),Object.values(this.detachedDependents).forEach(m=>{const{updated:T,removed:g,added:b}=m.entity.onDetachedDependencyRemoved(this,m.field,n);s.push(...T),u.push(...g),e.push(...b)}),!t){const m=this.removeFromParent(n);e.push(...m.added),s.push(...m.updated),u.push(...m.removed),f.push(...m.affected)}return n==null||n.attemptAutoclose(N.RemoveEntity,this.id),{added:_(e),updated:_(s),removed:_(u),affected:_(f),self:this}}restore({}={},t=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.RestoreEntity))){if(!this.checkCanEdit(this,t))return pe.Logger.warn(`[restore] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),t==null||t.attemptAutoclose(N.RestoreEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const n=[],s=[],u=[],e=[];return t!=null&&t.hasAdded(this.id)?(t==null||t.attemptAutoclose(N.RestoreEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this}):(this.subscribe(),this.project.unsubscribeDeletedInstance(this),this.metaSync({deleted:!1},t),Object.values(this.detachedDependents).forEach(f=>{const{updated:y,removed:m,added:T}=f.entity.onDetachedDependencyRestored(this,f.field,t);s.push(...y),u.push(...m),n.push(...T)}),t==null||t.attemptAutoclose(N.RestoreEntity,this.id),{added:_(n),updated:_(s),removed:_(u),affected:_(e),self:this})}toFlat(t=new Set){return t.has(this.id)?[]:(t.add(this.id),[this,...this.valueAsTypeSingle?this.valueAsTypeSingle.toFlat(t):[],...this.valueAsTypeList&&Array.isArray(this.valueAsTypeList)?this.valueAsTypeList.flatMap(s=>s.toFlat(t)):[]])}toFlatIds(t=new Set){return t.has(this.id)?[]:(t.add(this.id),[this.id,...this.valueAsTypeSingle?this.valueAsTypeSingle.toFlatIds(t):[],...this.valueAsTypeList&&Array.isArray(this.valueAsTypeList)?this.valueAsTypeList.flatMap(s=>s.toFlatIds(t)):[]])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,value:this.value,rawString:this.rawString,autogeneration:this.autogeneration,type:this.type,editable:this.editable,deletable:this.deletable,name:this.name}}toJSON(t=new Set){var n,s,u;return t.has(this.id)?this.toReference():(t.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,rawString:this.rawString,valueAsTypeSingle:((n=this.valueAsTypeSingle)==null?void 0:n.toJSON(t))||null,valueAsTypeList:Array.isArray(this.valueAsTypeList)?this.valueAsTypeList.map(e=>e.toJSON(t)):null,parent:((s=this.parent)==null?void 0:s.toReference())||null,standaloneParent:((u=this.standaloneParent)==null?void 0:u.toReference())||null})}toJSONClone(t=Kt){var s,u,e,f,y,m,T;let n;return(s=t.seenEntityMaps)!=null&&s.has(this.id)?n=t.seenEntityMaps.get(this.id):(n=t.newId||xs(this,this.project,t.uuidStrategy),t.seenEntityMaps&&t.seenEntityMaps.set(this.id,n)),(u=t.seenEntities)!=null&&u.has(n)||(e=t.seenEntities)!=null&&e.has(this.id)?this.toReference({seenEntityMaps:t.seenEntityMaps}):((f=t.seenEntities)==null||f.add(n),(y=t.seenEntities)==null||y.add(this.id),{id:n,version:M.UUID.uuid(),createdAt:t.timestamp||j().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,rawString:this.rawString,valueAsTypeSingle:this.valueAsTypeSingle?this.project.getBuiltIn(this.valueAsTypeSingle.id)?this.valueAsTypeSingle.toJSON():this.valueAsTypeSingle.toJSONClone({...t,newId:null}):null,valueAsTypeList:this.valueAsTypeList&&Array.isArray(this.valueAsTypeList)?this.valueAsTypeList.map(g=>{var b;return this.project.getBuiltIn(g.id)?g.toJSON(t.seenEntities):(b=g.toJSONClone)==null?void 0:b.call(g,{...t,newId:null})}):null,parent:((m=this.parent)==null?void 0:m.toReference({seenEntityMaps:t.seenEntityMaps}))||null,standaloneParent:((T=this.standaloneParent)==null?void 0:T.toReference({seenEntityMaps:t.seenEntityMaps}))||null})}toReference(t=Kt){var s;let n=this.id;return(s=t.seenEntityMaps)!=null&&s.has(this.id)&&(n=t.seenEntityMaps.get(this.id)),{id:n+"--"+M.UUID.uuid()+"--ref",type:r.GenericReference,entityId:n,version:this.version,entityType:this.type}}toShallowJSON(t=Kt){var s,u,e,f;let n=this.id;return(s=t.seenEntityMaps)!=null&&s.has(this.id)&&(n=t.seenEntityMaps.get(this.id)),{id:n,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,editable:this.editable,deletable:this.deletable,name:this.name,valueAsTypeSingle:((u=this.valueAsTypeSingle)==null?void 0:u.toReference(t))||null,valueAsTypeList:Array.isArray(this.valueAsTypeList)?this.valueAsTypeList.map(y=>y.toReference(t)):null,value:this.value,rawString:this.rawString,autogeneration:this.autogeneration,parent:((e=this.parent)==null?void 0:e.toReference(t))||null,standaloneParent:(f=this.standaloneParent)==null?void 0:f.toReference(t)}}toFlatJSON(t=new Set){return t.has(this.id)?[]:(t.add(this.id),[this.toShallowJSON(),...this.valueAsTypeSingle?this.valueAsTypeSingle.toFlatJSON(t):[],...this.valueAsTypeList&&Array.isArray(this.valueAsTypeList)?this.valueAsTypeList.flatMap(s=>s.toFlatJSON(t)):[]])}toGenerationTarget(t=Kt){var s,u,e,f;let n=this.id;return(s=t.seenEntityMaps)!=null&&s.has(this.id)&&(n=t.seenEntityMaps.get(this.id)),{id:n,type:this.type,name:this.name,valueAsTypeSingle:((u=this.valueAsTypeSingle)==null?void 0:u.id)||null,valueAsTypeList:Array.isArray(this.valueAsTypeList)?this.valueAsTypeList.map(y=>y.id):null,value:this.value,rawString:this.rawString,autogeneration:this.autogeneration,parent:(e=this.parent)==null?void 0:e.id,standaloneParent:(f=this.standaloneParent)==null?void 0:f.id}}toFlatGenerationTarget(t=new Set){return t.has(this.id)?[]:(t.add(this.id),[this.toGenerationTarget(),...this.valueAsTypeSingle?this.valueAsTypeSingle.toFlatGenerationTarget(t):[],...this.valueAsTypeList&&Array.isArray(this.valueAsTypeList)?this.valueAsTypeList.flatMap(s=>s.toFlatGenerationTarget(t)):[]])}clearErrors(){return this.errors=[],this}validate(){return this.errors=rmt(this),{success:!0}}async validateAsync(t={}){const n=pe.YieldTracker.from(t);return this.errors=await nmt(this,{tracker:n}),{success:!0}}getErrors(){return[...this.errors]}async getErrorsAsync(t={}){const n=pe.YieldTracker.from(t),s=[...this.errors];return await n.tick(),s}getShallowErrors(){return this.errors}clone(t=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,N.CloneEntity)),n=null,s=null,u=!0){const e=Qa(n,this),f=this.toJSON();n?(f.parent=n.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 y=s||M.UUID.uuid();f.id=y,f.version=M.UUID.uuid(),f.createdAt=(t==null?void 0:t.timestamp)||j().toISOString(),f.author=(t==null?void 0:t.author)||"1",f.previousVersion=null,f.deleted=!1,f.editable=!0,f.deletable=!0;const m=Zr(f,e);return m.hydrateAncestors(),n&&m.setParent(n,t),u&&(m.subscribe(),m.addSelfToProject(t)),t==null||t.add(m,ye.Added),m.initChildren(t),!t&&u&&m.captureVersion(),t==null||t.attemptAutoclose(N.CloneEntity,this.id),m}merge(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),this,!0,"merge-literal-value"))){const s=[],u=[],e=[],f=[];return this.valueAsTypeSingle!==(t==null?void 0:t.valueAsTypeSingle)&&(this.setValueAsType(t.valueAsTypeSingle,n),s.push(this)),this.valueAsTypeList!==t.valueAsTypeList&&(this.setValueAsTypeList(t.valueAsTypeList,n),s.push(this)),this.value!==t.value&&(this.metaSync({value:t.value},n),s.push(this)),this.autogeneration!==t.autogeneration&&(this.metaSync({autogeneration:t.autogeneration},n),s.push(this)),this.name!==t.name&&(this.metaSync({name:t.name},n),s.push(this)),n==null||n.attemptAutoclose("merge-literal-value",this.id),{updated:_(s),added:_(u),removed:_(e),affected:_(f),self:this}}};C(Wn,"repository",{APICreate:async(t,...n)=>t,APIUpdate:async(t,...n)=>t,APIDelete:async(t,...n)=>t,APIClone:async(t,...n)=>{},APILoad:async(t,...n)=>null,APILoadVersion:async(t,n,...s)=>null}),C(Wn,"type",r.LiteralValue),C(Wn,"USER_MANAGED_PARENT_TYPES",[r.DataType,r.InputMap,r.Property,r.ArgumentDeclaration,r.ReturnStatement,r.BreakStatement,r.ContinueStatement,r.VariableDeclaration,r.VariableInstance,r.ValueDescriptor]),C(Wn,"USER_MANAGED_STANDALONE_PARENT_TYPES",[...OO]),C(Wn,"PARENT_TYPES",[...Wn.USER_MANAGED_PARENT_TYPES]),C(Wn,"MUTABLE_BASE_PROPERTIES",["name","autogeneration","value","rawString"]),C(Wn,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),C(Wn,"BASE_PROPERTIES",[...Wn.MUTABLE_BASE_PROPERTIES,...Wn.INMUTABLE_BASE_PROPERTIES]),C(Wn,"MUTABLE_META_PROPERTIES",[...Wn.MUTABLE_BASE_PROPERTIES]),C(Wn,"INMUTABLE_META_PROPERTIES",[...Wn.INMUTABLE_BASE_PROPERTIES]),C(Wn,"META_PROPERTIES",[...Wn.MUTABLE_META_PROPERTIES,...Wn.INMUTABLE_META_PROPERTIES]),C(Wn,"MUTABLE_UPSTREAM_PROPERTIES",["valueAsTypeSingle","valueAsTypeList"]),C(Wn,"INMUTABLE_UPSTREAM_PROPERTIES",["parent"]),C(Wn,"UPSTREAM_PROPERTIES",[...Wn.MUTABLE_UPSTREAM_PROPERTIES,...Wn.INMUTABLE_UPSTREAM_PROPERTIES]),C(Wn,"MUTABLE_DOWNSTREAM_PROPERTIES",[]),C(Wn,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),C(Wn,"DOWNSTREAM_PROPERTIES",[...Wn.MUTABLE_DOWNSTREAM_PROPERTIES,...Wn.INMUTABLE_DOWNSTREAM_PROPERTIES]),C(Wn,"PROPERTIES",[...Wn.META_PROPERTIES,...Wn.UPSTREAM_PROPERTIES,...Wn.DOWNSTREAM_PROPERTIES]);let ya=Wn;function av(a){if(typeof crypto<"u"&&typeof crypto.getRandomValues=="function"){const t=new Uint8Array(a);return crypto.getRandomValues(t),t}const{randomBytes:p}=require("crypto");return p(a)}function smt(a,p){const t=p-a+1,s=sV()*t;return Math.floor(s)+a}function lmt(){const a=av(4);return(a[0]<<24|a[1]<<16|a[2]<<8|a[3])>>>0}function sV(){return lmt()/2**32}function c4(a){const p=av(a);return Array.from(p).map(t=>t.toString(16).padStart(2,"0")).join("")}const SL="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";function f4(a){let p="";const t=av(a);for(let n=0;n<a;n++)p+=SL[t[n]%SL.length];return p}function omt(a){const p=av(a);let t;if(typeof Buffer<"u")t=Buffer.from(p).toString("base64");else{const n=String.fromCharCode(...p);t=btoa(n)}return t.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function y4(a){return f4(a)}function h4(a,p=SL){let t="";const n=av(a);for(let s=0;s<a;s++)t+=p[n[s]%p.length];return t}function Bh(){const a=av(16);a[6]=a[6]&15|64,a[8]=a[8]&63|128;const p=Array.from(a).map(t=>t.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 dmt(){return h4(6)}function pmt(){return c4(32)}const Ygn=63,Jgn=/^[a-z][a-z0-9-]*[a-z0-9]$/;function Qgn(a){return a.length>=1&&a.length<=Ygn&&Jgn.test(a)&&!a.includes("--")}function*Xgn(){yield"";const a="abcdefghijklmnopqrstuvwxyz";for(let p=1;;p++){const t=new Array(p).fill(0);let n=!1;for(;!n;){yield t.map(s=>a[s]).join("");for(let s=p-1;s>=0&&(t[s]++,!(t[s]<a.length));s--)t[s]=0,s===0&&(n=!0)}}}function ebn(a,p){const t=new Set(a.map(s=>s.toLowerCase())),n=p>0?"secondarydb":"main";for(const s of Xgn()){const u=s?`${n}${s}`:n;if(Qgn(u)&&!t.has(u))return u}throw new Error("Unable to generate identifier")}function umt(a,p){switch(a.id){case G["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.id:{const t=a.project.entities.filter(y=>!!y.implements.find(m=>m.id===G["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id)),n=t.find(y=>{const m=y.properties.find(b=>b.implements.find(R=>R.id===G["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id)),T=m==null?void 0:m.getDefaultValue();return(T==null?void 0:T.value)===!0});if(!n&&t.length){const m=t[0].properties.find(g=>g.implements.find(b=>b.id===G["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id)),T=m==null?void 0:m.defaultValue;if(T)T.metaSync({value:!0},p);else if(m!=null&&m.dataType){const g={id:M.UUID.uuid(),version:M.UUID.uuid(),createdAt:(p==null?void 0:p.timestamp)||new Date().toISOString(),author:M.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:r.LiteralValue,standaloneParent:null,name:me.EntityTemplate,autogeneration:null,value:!0,valueAsTypeSingle:null,valueAsTypeList:null,parent:m==null?void 0:m.toReference()},b=Se(g,a.project);return b.hydrateAncestors(),b.setParent(m,p),b.addSelfToProject(p),p==null||p.add(b,ye.Added),b.initChildren(p),p||b.captureVersion(),{newEntities:[b]}}return{newEntities:[]}}else if(n)return{newEntities:[]};const s=a.project.get(G["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id),u=lV(s,"Main database",p);if(u.errors.length>0)return{newEntities:[]};const e=u.properties.find(y=>y.implements.find(m=>m.id===G["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 y={id:M.UUID.uuid(),version:M.UUID.uuid(),createdAt:(p==null?void 0:p.timestamp)||new Date().toISOString(),author:M.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:r.LiteralValue,standaloneParent:null,name:me.EntityTemplate,autogeneration:null,value:!0,valueAsTypeSingle:null,valueAsTypeList:null,parent:e==null?void 0:e.toReference()},m=Se(y,a.project);m.hydrateAncestors(),m.setParent(e,p),m.addSelfToProject(p),p==null||p.add(m,ye.Added),m.initChildren(p),p||m.captureVersion()}return{newEntities:[u]}}}return{newEntities:[]}}function cmt(a,p){const t=[],n=[],s=[],u=[];return BE(a).filter(f=>f.type===r.BuiltInBaseEntity).forEach(f=>{var y,m,T,g,b,R,I,A,O;switch(f.id){case G["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.id:{const P=a.project.entities.filter(H=>H.implements.find(Y=>Y.id===G["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id));let x=P.find(H=>!!H.properties.find(Y=>{var ie;return Y.implements.find(z=>z.id===G["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id)&&((ie=Y.getDefaultValue())==null?void 0:ie.value)===!0}));if(!x&&P.length)x=P[0];else if(!x&&!P.length){x=a.project.getBuiltIn(G["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id).implement("Relational database",p);const Y=x.properties.find(ie=>ie.implements.find(z=>z.id===G["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id));(y=Y==null?void 0:Y.defaultValue)==null||y.metaSync({value:!0},p),n.push(x)}const $=a.properties.find(H=>H.implements.find(Y=>Y.id===G["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.properties.database.id));if($&&!($!=null&&$.defaultValue)){const H={id:M.UUID.uuid(),version:M.UUID.uuid(),createdAt:(p==null?void 0:p.timestamp)||new Date().toISOString(),author:M.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:r.LiteralValue,standaloneParent:null,name:me.EntityTemplate,autogeneration:null,value:null,valueAsTypeSingle:(x==null?void 0:x.toJSON())||null,valueAsTypeList:null,parent:$==null?void 0:$.toReference()},Y=Se(H,a.project);Y.hydrateAncestors(),Y.setParent($,p),Y.addSelfToProject(p),p==null||p.add(Y,ye.Added),Y.initChildren(p),($==null?void 0:$.defaultValue).setValueAsTypeSingle(x||null,p),n.push(Y),p||Y.captureVersion();return}else $!=null&&$.defaultValue&&!($!=null&&$.defaultValue.valueAsTypeSingle)&&($==null||$.defaultValue.setValueAsTypeSingle(x||null,p));const U=a.properties.find(H=>H.implements.find(Y=>Y.id===G["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.properties.primaryKey.id));if(!U)throw new Error(`[handleAfterEntityImplementationSideEffects] Primary key property not found for implemented base entity ${G["built-in-base-entity"]}`);let Z=!1;if(!U.dataType){const H=pa.new(p);H.parent=U.toReference();const Y=Se(H,a.project);Y.hydrateAncestors(),Y.setParent(U,p),Y.addSelfToProject(p),p==null||p.add(Y,ye.Added),Y.initChildren(p),Z=!0}const q=a.project.getBuiltIn(G["primitive-entity"].number.id);(m=U.dataType)==null||m.setEntity(q,p),Z&&(p||(T=U.dataType)==null||T.captureVersion());return}case G["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id:{const P=a.project.entities.filter(z=>z.implements.find(W=>W.id===G["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id)&&z.id!==a.id),x=P.map(z=>{var te;const W=z.properties.find(X=>X.implements.find(re=>re.id===G["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.identifier.id));return(te=W==null?void 0:W.getDefaultValue())==null?void 0:te.value}).filter(z=>!!z),$=a.properties.find(z=>z.implements.find(W=>W.id===G["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.identifier.id));if(!P.find(z=>!!z.properties.find(W=>{var ee;return W.implements.find(te=>te.id===G["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id)&&((ee=W.getDefaultValue())==null?void 0:ee.value)===!0}))){const z=a.properties.find(ee=>ee.implements.find(te=>te.id===G["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id));if(!z)throw new Error("Default boolean property not found for relational database entity with id: "+a.id);let W=!1;if(!(z!=null&&z.defaultValue)){const ee=ya.new(p);ee.parent=z.toReference();const te=Se(ee,a.project);te.hydrateAncestors(),te.setParent(z,p),te.addSelfToProject(p),p==null||p.add(te,ye.Added),te.initChildren(p),W=!0}(g=z==null?void 0:z.defaultValue)==null||g.metaSync({value:!0},p),W&&(p||(b=z==null?void 0:z.defaultValue)==null||b.captureVersion())}if(!$)throw new Error("Identifier property not found for relational database entity with id: "+a.id);let Z=!1;if(!($!=null&&$.defaultValue)){const z=ya.new(p);z.parent=$.toReference();const W=Se(z,a.project);W.hydrateAncestors(),W.setParent($,p),W.addSelfToProject(p),p==null||p.add(W,ye.Added),W.initChildren(p),Z=!0}const q=ebn(x,P.length);(R=$.defaultValue)==null||R.metaSync({value:q},p),Z&&(p||(I=$.defaultValue)==null||I.captureVersion());const H=a.properties.find(z=>z.implements.find(W=>W.id===G["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.password.id));if(!H)throw new Error(`[handleAfterEntityImplementationSideEffects] Password property not found for implemented base entity ${G["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id} with id ${a.id}`);let Y=!1;if(!H.defaultValue){const z=ya.new(p);z.parent=H.toReference();const W=Se(z,a.project);W.hydrateAncestors(),W.setParent(H,p),W.addSelfToProject(p),p==null||p.add(W,ye.Added),W.initChildren(p),n.push(W),Y=!0}const ie=y4(24);(A=H.defaultValue)==null||A.metaSync({value:ie},p),Y&&(p||(O=H.defaultValue)==null||O.captureVersion());return}case G["built-in-base-entity"].BUILT_IN_SQL_ROW_TRANSFORMER_ENTITY.id:{const P=a.properties.find(Z=>Z.implements.find(q=>q.id===G["built-in-base-entity"].BUILT_IN_SQL_ROW_TRANSFORMER_ENTITY.properties.time.id));if(!P)throw new Error(`[handleAfterEntityImplementationSideEffects] Time property not found for implemented base entity ${G["built-in-base-entity"].BUILT_IN_SQL_ROW_TRANSFORMER_ENTITY.id} with id ${a.id}`);let x=P.defaultValue||null;if(!x){const Z=ya.new(p);Z.parent=P.toReference(),Z.name=me.Date,Z.id=M.UUID.uuid(),x=Se(Z,a.project),x.hydrateAncestors(),x.setParent(P,p),x.addSelfToProject(p),x.initChildren(p),p==null||p.add(x,ye.Added)}x.metaSync({value:new Date().toISOString()},p),x.metaSync({editable:!1,deletable:!1},p),P.metaSync({editable:!1,deletable:!1},p);const $=a.properties.find(Z=>Z.implements.find(q=>q.id===G["built-in-base-entity"].BUILT_IN_SQL_ROW_TRANSFORMER_ENTITY.properties.definition.id));if(!$)throw new Error(`[handleAfterEntityImplementationSideEffects] Definition property not found for implemented base entity ${G["built-in-base-entity"].BUILT_IN_SQL_ROW_TRANSFORMER_ENTITY.id} with id ${a.id}`);let U=$.defaultValue||null;if(!U){const Z=ya.new(p);Z.name=me.EntityTemplate,Z.parent=$.toReference(),Z.id=M.UUID.uuid(),U=Se(Z,a.project),U.hydrateAncestors(),U.setParent($,p),U.addSelfToProject(p),U.initChildren(p),p==null||p.add(U,ye.Added)}break}case G["built-in-base-entity"].BUILT_IN_SHARED_DRIVE_MOUNT_ENTITY.id:{const P=a.project.entities.filter(x=>cn(x,xe.SHARED_DRIVE_ENTITY)&&x.id!==a.id);if(P.length===1){const x=P[0],$=a.properties.find(Z=>Z.implements.find(q=>q.id===G["built-in-base-entity"].BUILT_IN_SHARED_DRIVE_MOUNT_ENTITY.properties.sharedDrive.id));if(!$)throw new Error(`[handleAfterEntityImplementationSideEffects] Shared Drive property not found for implemented base entity ${G["built-in-base-entity"].BUILT_IN_SHARED_DRIVE_MOUNT_ENTITY.id} with id ${a.id}`);let U=$.defaultValue||null;if(!U){const Z=ya.new(p);Z.name=me.EntityTemplate,Z.parent=$.toReference(),Z.id=M.UUID.uuid(),U=Se(Z,a.project),U.hydrateAncestors(),U.setParent($,p),U.addSelfToProject(p),U.initChildren(p),p==null||p.add(U,ye.Added)}U.setValueAsTypeSingle(x,p)}break}case G["built-in-base-entity"].BUILT_IN_COMPUTE_ENTITY.id:{const P=a.properties.find(q=>q.implements.find(H=>H.id===G["built-in-base-entity"].BUILT_IN_COMPUTE_ENTITY.properties.computeName.id));if(!P)throw new Error(`[handleAfterEntityImplementationSideEffects] Compute name property not found for implemented base entity ${G["built-in-base-entity"].BUILT_IN_COMPUTE_ENTITY.id} with id ${a.id}`);const x=a.project.entities.filter(q=>cn(q,xe.COMPUTE_ENTITY)&&q.id!==a.id);let $=P.defaultValue||null;if(!$){const q=ya.new(p);q.name=me.EntityTemplate,q.parent=P.toReference(),q.id=M.UUID.uuid(),$=Se(q,a.project),$.hydrateAncestors(),$.setParent(P,p),$.addSelfToProject(p),$.initChildren(p),p==null||p.add($,ye.Added)}const U=x.map(q=>{var H,Y;return((Y=(H=q.properties.find(ie=>ie.implements.some(z=>z.id===G["built-in-base-entity"].BUILT_IN_COMPUTE_ENTITY.properties.computeName.id)))==null?void 0:H.defaultValue)==null?void 0:Y.value)||""}),Z=a4($.value||"compute-instance",U,"-");$.metaSync({value:Z},p);break}}}),{self:a,updated:_(t),added:_(n),removed:_(s),affected:_(u)}}function lV(a,p,t,n){const s=n||M.UUID.uuid(),u=Rp.new(t);u.id=s,u.name=p,u.static=a.static,u.implements=[a.toJSON()],u.parent=a.project.toReference(),u.static=a.static,umt(a,t);const e=Se(u,a.project);return e.hydrateAncestors(),t==null||t.add(e,ye.Added),e.addSelfToProject(t),e.initChildren(t),t||e.captureVersion(),cmt(e,t),e.afterAllChildrenInitialized(t),e}function m4(a,p){return p.entities.find(s=>{const u=s.properties,e=u.map(g=>g.name),f=a.every(g=>e.includes(g)),y=e.filter(g=>!a.includes(g)),m=u.every(g=>!y.includes(g.name)||!g.required);return f&&m})||null}function fmt(a,p,t,n=vt.OrDataTypeGroup){const s=[],u=[],e=[],f=[],y=M.UUID.uuid(),m=pa.new(t);m.id=y,m.parent=p.toReference(),m.like=!0,m.parentRelationType=n;const T=Se(m,a.project);return u.push(T),T.setParent(p,t),T.addSelfToProject(t),t==null||t.add(T,ye.Added),T.setEntity(a,t),T.initChildren(t),t||T.captureVersion(),{updated:_(s),added:_(u),removed:_(e),affected:_(f),self:T}}function T4(a,p,t,n,s){var m,T,g,b,R,I,A,O;const u=[],e=[],f=[],y=[];switch(typeof a){case"string":let P=!1;const x=new Date(a);if(x instanceof Date&&!isNaN(x.valueOf())&&(P=!0),P){const $=p.project.getBuiltIn(G[r.PrimitiveEntity][me.Date].id);p.setEntity($,n);break}else{const $=p.project.getBuiltIn(G[r.PrimitiveEntity][me.String].id);p.setEntity($,n);break}case"number":p.setEntity(p.project.getBuiltIn(G[r.PrimitiveEntity][me.Number].id),n);break;case"boolean":p.setEntity(p.project.getBuiltIn(G[r.PrimitiveEntity][me.Boolean].id),n);break;case"object":if(a===null){p.setEntity(p.project.getBuiltIn(G[r.PrimitiveEntity][me.Null].id),n);break}else if(Array.isArray(a))if(p.metaSync({isList:!0},n),a.length>0){const $=a.slice(0,5).filter(Z=>Z!==void 0);if($.every(Z=>typeof Z==typeof $[0])&&(typeof $[0]!="object"||$[0]===null))switch(typeof $[0]){case"string":p.setEntity(p.project.getBuiltIn(G[r.PrimitiveEntity][me.String].id),n);break;case"number":p.setEntity(p.project.getBuiltIn(G[r.PrimitiveEntity][me.Number].id),n);break;case"boolean":p.setEntity(p.project.getBuiltIn(G[r.PrimitiveEntity][me.Boolean].id),n);break;case"object":p.setEntity(p.project.getBuiltIn(G[r.PrimitiveEntity][me.Null].id),n);break}else{const Z=[];let q=!1;$.forEach(Y=>{var ie,z,W,ee;if(Array.isArray(Y)&&(q=!0),typeof Y=="object"&&!Array.isArray(Y)&&Y!==null){const te=Dw(Y,p.project,{...t,id:M.UUID.uuid()},n,s);te.hasCreated&&Z.push((ie=te.changeSet)==null?void 0:ie.self),u.push(...(z=te.changeSet)==null?void 0:z.updated),e.push(...(W=te.changeSet)==null?void 0:W.added),f.push(...(ee=te.changeSet)==null?void 0:ee.removed)}});const H=_(Z);if(!H.length&&!q){$.forEach(Y=>{const ie=pa.new(n);ie.parentRelationType=vt.OrDataTypeGroup,ie.parent=p.toReference();const z=Se(ie,p.project);switch(z.hydrateAncestors(),z.setParent(p,n),z.addSelfToProject(n),n==null||n.add(z,ye.Added),z.initChildren(n),typeof Y){case"string":z.setEntity(z.project.getBuiltIn(G[r.PrimitiveEntity][me.String].id),n);break;case"number":z.setEntity(z.project.getBuiltIn(G[r.PrimitiveEntity][me.Number].id),n);break;case"boolean":z.setEntity(z.project.getBuiltIn(G[r.PrimitiveEntity][me.Boolean].id),n);break;case"object":z.setEntity(z.project.getBuiltIn(G[r.PrimitiveEntity][me.Null].id),n);break}n||z.captureVersion()});break}else H.length===1&&!q?p.setEntity(H[0],n):$.forEach(Y=>{if(typeof Y=="object"&&!Array.isArray(Y)&&Y!==null){const ie=m4(Object.keys(Y),p.project);if(ie){const z=fmt(ie||H[0],p,n,vt.OrDataTypeGroup);u.push(...z.updated),e.push(...z.added),f.push(...z.removed)}}else{const ie=pa.new(n);ie.parentRelationType=vt.OrDataTypeGroup,ie.parent=p.toReference();const z=Se(ie,p.project);z.hydrateAncestors(),z.setParent(p,n),z.addSelfToProject(n),n==null||n.add(z,ye.Added),z.initChildren(n);const W=T4(Y,z,{...t,id:M.UUID.uuid()},n,s);u.push(...W.updated),e.push(...W.added),f.push(...W.removed),n||z.captureVersion()}})}}else{const $=Dw(a[0],p.project,{...t},n,s);p.setEntity((m=$.changeSet)==null?void 0:m.self,n),u.push(...(T=$.changeSet)==null?void 0:T.updated),e.push(...(g=$.changeSet)==null?void 0:g.added),f.push(...(b=$.changeSet)==null?void 0:b.removed);break}else{const $=Dw(a,p.project,{...t},n,s);p.setEntity((R=$.changeSet)==null?void 0:R.self,n),u.push(...(I=$.changeSet)==null?void 0:I.updated),e.push(...(A=$.changeSet)==null?void 0:A.added),f.push(...(O=$.changeSet)==null?void 0:O.removed);break}}return{updated:_(u),added:_(e),removed:_(f),affected:_(y),self:p}}function Dw(a,p,t,n,s){const u=[],e=[],f=[],y=[],m=Object.keys(a),T=m4(m,p);if(T)return{hasCreated:!1,changeSet:{updated:[],added:[],removed:[],affected:[],self:T}};const g=s?t.name+" of "+s.name:t.name,R={id:t.id||M.UUID.uuid(),version:M.UUID.uuid(),createdAt:(n==null?void 0:n.timestamp)||new Date().toISOString(),author:M.sessionAuthor,previousVersion:null,deleted:!1,name:g,codeName:null,deletable:!0,editable:!0,type:r.DefinitionEntity,additionalProperties:!1,additionalPropertiesDataType:null,allPropertiesImplement:null,description:t.description||null,static:t.static||!1,abstract:t.abstract||!1,properties:[],methods:[],abstractMethods:[],extends:null,implements:[],x:0,y:0,parent:p.toReference()},I=Se(R,p);return I.hydrateAncestors(),I.setParent(p,n),I.addSelfToProject(n),n==null||n.add(I,ye.Added),I.initChildren(n),e.push(I),m.forEach((A,O)=>{const P=M.UUID.uuid(),x=sd.new(n);x.id=P,x.name=A,x.codeName=A,x.parent=I.toReference(),x.index=O,x.required=!0,x.interactive=!0;const $=Se(x,p);$.hydrateAncestors(),$.setParent(I,n),$.addSelfToProject(n),n==null||n.add($,ye.Added),$.initChildren(n),e.push($);const U=a[A],Z=M.UUID.uuid(),q=pa.new(n);q.id=Z,q.parent=$.toReference(),q.like=!0,q.isList=!1;const H=Se(q,p);H.hydrateAncestors(),H.setParent($,n),H.addSelfToProject(n),n==null||n.add(H,ye.Added),H.initChildren(n),e.push(H);const Y=T4(U,H,{...t,name:A,id:M.UUID.uuid()},n,s||I);u.push(...Y.updated),e.push(...Y.added),f.push(...Y.removed),n||($.captureVersion(),H.captureVersion())}),n||I.captureVersion(),{hasCreated:!0,changeSet:{updated:_(u),added:_(e),removed:_(f),affected:_(y),self:I}}}function sy(a,p,t,n,s){const u={ignoreImplementationMatch:!1,...s},e=[];return!a.length||!p.length?{errors:e,overlap:!1}:(a.length>p.length?a.forEach(f=>{const y=p.find(T=>T.name===f.name),m=p.find(T=>{var g,b;return Array.isArray(T.implements)?T.implements.some(R=>!!f.implements.find(I=>I.id===R.id)):((g=T.implements)==null?void 0:g.id)===((b=f.implements)==null?void 0:b.id)});if(y&&!(u.ignoreImplementationMatch&&m&&(m==null?void 0:m.id)===(y==null?void 0:y.id))){const T=new ht({id:f.id+"--"+y.id+"--"+n,message:`Entity of type ${f.type} named "${f.name}" with id "${f.id}" overrides a base ${y.type} ${y.name} with id "${y.id}" that has the same name`,severity:Ie.Error,code:n,entity:f,firstRelationship:y});e.push(T)}if(m&&!u.ignoreImplementationMatch){const T=new ht({id:f.id+"--"+m.id+"--"+t,message:`Entity of type ${f.type} named "${f.name}" with id "${f.id}" overrides a base ${m.type} ${m.name} with id "${m.id}" that implements the same base descriptor`,severity:Ie.Error,code:t,entity:f,firstRelationship:m});e.push(T)}}):p.forEach(f=>{var T;const y=a.find(g=>g.name===f.name),m=a.find(g=>{var b,R;return g.implements&&Array.isArray(g.implements)?g.implements.some(I=>!!f.implements.find(A=>A.id===I.id)):((b=g.implements)==null?void 0:b.id)===((R=f.implements)==null?void 0:R.id)});if(y&&!(u.ignoreImplementationMatch&&m&&(m==null?void 0:m.id)===(y==null?void 0:y.id))){const g=new ht({id:y.id+"--"+f.id+"--"+n,message:`Entity of type ${y.type} named "${y.name}" with id "${y.id}" overrides a base entity ${f.name} with id "${f.id}" that has the same name`,severity:Ie.Error,code:n,entity:y,firstRelationship:f});e.push(g)}if(m&&!u.ignoreImplementationMatch){const g=new ht({id:m.id+"--"+f.id+"--"+t,message:`Entity of type ${m.type} named "${m.name}" with id "${m.id}" overrides a base entity ${f.name} with id "${f.id}" that implements the same base ${Array.isArray(m==null?void 0:m.implements)?Di(m==null?void 0:m.implements.map(b=>b.type),"', '","' and '"):(T=m.implements)==null?void 0:T.id}`,severity:Ie.Error,code:t,entity:m,firstRelationship:f});e.push(g)}}),{errors:e,overlap:!!e.length})}function tbn(a,p){return a.abstract||(a.properties.forEach(n=>{n.abstract||n.metaSync({abstract:!0},p)}),Object.values(a.detachedDependents).forEach(n=>{n.field===qU.EntityField&&n.entity.remove({ignoreUpstream:!1},p)}),a.metaSync({abstract:!0},p)),a}function ibn(a,p){return a.abstract&&(a.properties.forEach(n=>{n.abstract&&n.metaSync({abstract:!1},p)}),Object.values(a.detachedDependents).forEach(n=>{(n.field===yO.Implements||n.field===yO.Extends)&&n.entity.onDetachedDependencyRemoved(a,n.field,p)}),a.metaSync({abstract:!1},p)),a}function nbn(a,p){return a.static||(a.properties.forEach(n=>{n.static||n.metaSync({static:!0},p)}),a.metaSync({static:!0},p)),a}function rbn(a,p){return a.static&&a.metaSync({static:!1},p),a}const rA=class rA extends l4{constructor(t,n){super(t);C(this,"initialData");C(this,"id");C(this,"version");C(this,"name");C(this,"description",null);C(this,"type",r.BuiltInBaseEntity);C(this,"abstract",!1);C(this,"static");C(this,"additionalProperties",!1);C(this,"properties",[]);C(this,"allPropertiesImplement",null);C(this,"additionalPropertiesDataType",null);C(this,"methods",[]);C(this,"abstractMethods",[]);C(this,"extends",null);C(this,"interactive",!1);C(this,"errors",[]);C(this,"project");if(this.initialData=this.initialData||t,this.project=this.project||n,this.id=this.id||t.id,this.version=this.version||t.version,this.name=this.name||t.name,this.static=this.static||t.static,this.interactive=this.interactive||t.interactive,this.abstract=t.abstract,this.additionalProperties=t.additionalProperties,this.properties=this.initialData.properties.map(s=>{const u=Se(s,this.project);return u.setParent(this,null),u.initChildren(null),u}),this.methods=this.initialData.methods.map(s=>{const u=Se(s,this.project);return u.setParent(this,null),u.initChildren(null),u}),this.abstractMethods=this.initialData.abstractMethods.map(s=>{const u=Se(s,this.project);return u.setParent(this,null),u.initChildren(null),u}),this.initialData.allPropertiesImplement){const s=Se(this.initialData.allPropertiesImplement,this.project);s.setParent(this,null),s.initChildren(null),this.allPropertiesImplement=s}if(this.initialData.additionalPropertiesDataType){const s=Se(this.initialData.additionalPropertiesDataType,this.project);s.setParent(this,null),s.initChildren(null),this.additionalPropertiesDataType=s}this.initialData.extends&&(this.extends=Se(this.initialData.extends,this.project))}get allMethods(){return _([...this.ownDeclaredMethods,...this.allBaseMethodsFromOriginalParents])}get allProperties(){return _([...this.ownDeclaredProperties,...this.allBasePropertiesFromOriginalParents])}get allBaseMethodsFromOriginalParents(){var s;const t=((s=this.extends)==null?void 0:s.allMethods)||[],n=[...t].filter(u=>!t.some(e=>e.id!==u.id));return _(n)}get allBasePropertiesFromOriginalParents(){var s;const t=((s=this.extends)==null?void 0:s.allProperties)||[],n=[...t].filter(u=>!t.some(e=>{var f;return e.id!==u.id&&(!!e.implements.find(y=>y.id===u.id)||((f=e.extends)==null?void 0:f.id)===u.id)}));return _(n)}get allBasePropertiesFromExtendedAndImplementedEntities(){var s,u;const t=[...((s=this.extends)==null?void 0:s.ownDeclaredProperties)||[],...((u=this.extends)==null?void 0:u.allBasePropertiesFromExtendedAndImplementedEntities)||[]].filter(e=>!e.abstract),n=[...t].filter(e=>!t.some(f=>{var y;return f.id!==e.id&&(!!f.implements.find(m=>m.id===e.id)||((y=f.extends)==null?void 0:y.id)===e.id)}));return _([...n])}get allBaseMethodsFromExtendedAndImplementedEntities(){return _([...(this.extends?[this.extends]:[]).reduce((t,n)=>n.type===r.PrimitiveEntity?t:[...[...n.ownDeclaredMethods,...n.allBaseMethodsFromExtendedAndImplementedEntities].filter(u=>u.type!==r.ActionDescriptor),...t],[])])}get extendedPropertiesFromOriginalParents(){var s,u;const t=[...((s=this.extends)==null?void 0:s.ownDeclaredProperties)||[],...((u=this.extends)==null?void 0:u.extendedPropertiesFromOriginalParents)||[]].filter(e=>!e.abstract),n=[...t].filter(e=>!t.some(f=>{var y;return f.id!==e.id&&(!!f.implements.find(m=>m.id===e.id)||((y=f.extends)==null?void 0:y.id)===e.id)}));return _(n)}get implementedPropertiesFromOriginalParents(){return _([...(this.extends?[this.extends]:[]).reduce((t,n)=>{const s=n.implementedPropertiesFromOriginalParents,u=[...n.ownDeclaredProperties].filter(y=>!!y.abstract),e=[...s,...u,...t];return[...e].filter(y=>!!!e.find(T=>{var g;return((g=T.extends)==null?void 0:g.id)===y.id||!!T.implements.find(b=>b.id===y.id)}))},[])].filter(t=>!!t.abstract))}get extendedProperties(){return this.properties.filter(t=>t.isExtendedProperty)}get ownDeclaredMethods(){return[...this.methods,...this.abstractMethods]}get ownDeclaredProperties(){return this.properties.filter(t=>!t.isExtendedProperty)}subscribe(){return this.project.subscribeBuiltInInstance(this),this}unsubscribe(){return this.project.unsubscribeBuiltInInstance(this),this}async APILoad(t=gt,...n){return await rA.repository.APILoad(this.id,...n),this}toFlat(t=new Set){var s;return t.has(this.id)?[]:(t.add(this.id),[this,...this.properties.flatMap(u=>u.toFlat(t)),...this.methods.flatMap(u=>u.toFlat(t)),...this.abstractMethods.flatMap(u=>u.toFlat(t)),...((s=this.extends)==null?void 0:s.toFlat(t))||[]])}toFlatIds(t=new Set){var s;return t.has(this.id)?[]:(t.add(this.id),[this.id,...this.properties.flatMap(u=>u.toFlatIds(t)),...this.methods.flatMap(u=>u.toFlatIds(t)),...this.abstractMethods.flatMap(u=>u.toFlatIds(t)),...((s=this.extends)==null?void 0:s.toFlatIds(t))||[]])}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(t=new Set){var n,s,u;return t.has(this.id)?this.toReference():(t.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:((n=this.additionalPropertiesDataType)==null?void 0:n.toJSON(t))||null,allPropertiesImplement:((s=this.allPropertiesImplement)==null?void 0:s.toJSON(t))||null,properties:this.properties.map(e=>e.toJSON(t)),methods:this.methods.map(e=>e.toJSON(t)),abstractMethods:this.abstractMethods.map(e=>e.toJSON(t)),extends:((u=this.extends)==null?void 0:u.toJSON(t))||null})}toReference(t=Kt){return{id:this.id+"--"+M.UUID.uuid()+"--ref",type:r.GenericReference,entityId:this.id,version:this.version,entityType:this.type}}toShallowJSON(t=Kt){var n,s,u;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:((n=this.additionalPropertiesDataType)==null?void 0:n.toReference())||null,allPropertiesImplement:((s=this.allPropertiesImplement)==null?void 0:s.toReference())||null,properties:this.properties.map(e=>e.toReference()),methods:this.methods.map(e=>e.toReference()),abstractMethods:this.abstractMethods.map(e=>e.toReference()),extends:((u=this.extends)==null?void 0:u.toReference())||null}}toFlatJSON(t=new Set){var s,u;return t.has(this.id)?[]:(t.add(this.id),[this.toShallowJSON(),...this.properties.flatMap(e=>e.toFlatJSON(t)),...this.methods.flatMap(e=>e.toFlatJSON(t)),...this.abstractMethods.flatMap(e=>e.toFlatJSON(t)),...((s=this.additionalPropertiesDataType)==null?void 0:s.toFlatJSON(t))||[],...((u=this.allPropertiesImplement)==null?void 0:u.toFlatJSON(t))||[]])}toGenerationTarget(t=Kt){var n;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:(n=this.extends)==null?void 0:n.id}}toFlatGenerationTarget(t=new Set){var s,u;return t.has(this.id)?[]:(t.add(this.id),[this.toGenerationTarget(),...this.properties.flatMap(e=>e.toFlatGenerationTarget(t)),...this.methods.flatMap(e=>e.toFlatGenerationTarget(t)),...this.abstractMethods.flatMap(e=>e.toFlatGenerationTarget(t)),...((s=this.additionalPropertiesDataType)==null?void 0:s.toFlatGenerationTarget(t))||[],...((u=this.allPropertiesImplement)==null?void 0:u.toFlatGenerationTarget(t))||[]])}clearErrors(){var t,n;return this.errors=[],this.properties.forEach(s=>s.clearErrors()),this.methods.forEach(s=>s.clearErrors()),this.abstractMethods.forEach(s=>s.clearErrors()),(t=this.additionalPropertiesDataType)==null||t.clearErrors(),(n=this.allPropertiesImplement)==null||n.clearErrors(),this}validate(){return this.errors=Hgn(this),{success:!0}}async validateAsync(t={}){const n=pe.YieldTracker.from(t);return this.errors=await Zgn(this,{tracker:n}),{success:!0}}getErrors(){var n,s;return[...this.errors,...this.properties.flatMap(u=>u.getErrors()),...this.methods.flatMap(u=>u.getErrors()),...this.abstractMethods.flatMap(u=>u.getErrors()),...((n=this.additionalPropertiesDataType)==null?void 0:n.getErrors())||[],...((s=this.allPropertiesImplement)==null?void 0:s.getErrors())||[]]}async getErrorsAsync(t={}){const n=pe.YieldTracker.from(t),s=[...this.errors];await n.tick();for(const u of this.properties){const e=await u.getErrorsAsync({tracker:n});s.push(...e)}for(const u of this.methods){const e=await u.getErrorsAsync({tracker:n});s.push(...e)}for(const u of this.abstractMethods){const e=await u.getErrorsAsync({tracker:n});s.push(...e)}if(this.additionalPropertiesDataType){const u=await this.additionalPropertiesDataType.getErrorsAsync({tracker:n});s.push(...u)}if(this.allPropertiesImplement){const u=await this.allPropertiesImplement.getErrorsAsync({tracker:n});s.push(...u)}return s}getShallowErrors(){return this.errors}implement(t,n=this.project.addChangeSet(new de(this.project,M.sessionAuthor,j().toISOString(),null,!0,"implement-built-in-base-entity")),s){const u=lV(this,t,n,s);return n==null||n.attemptAutoclose("implement-built-in-base-entity",this.id),u}getAllPropertiesImplements(){var n;const t=[];return this.allPropertiesImplement&&t.push(this.allPropertiesImplement),((n=this.extends)==null?void 0:n.type)===r.BuiltInBaseEntity&&t.push(...this.extends.getAllPropertiesImplements()||[]),t}getAllInteractiveMethods(){const t=[];if(this.interactive){if(t.push(...this.methods,...this.abstractMethods),!this.extends||this.extends.type===r.BuiltInBaseEntity&&this.extends.interactive||this.extends.type===r.PrimitiveEntity)return t;this.extends instanceof rA&&t.push(...this.extends.getAllInteractiveMethods())}return _(t)}getRawDefaultValue(){const t={};return this.properties.forEach(n=>{var e;if(!vp(n)||!n.defaultValue)return;const s=De(n,this.project),u=n.codeName||ho(n,this.project)||Zs(jn(s));t[u]=((e=n.getDefaultValue())==null?void 0:e.value)||null}),t}};C(rA,"repository",{APILoad:async(t,...n)=>null});let Hd=rA;class ymt extends Hd{constructor(t){super(nl,t);C(this,"initialData");C(this,"id",xe.PERSISTED_ENTITY);C(this,"version","1");C(this,"name",xe.PERSISTED_ENTITY);C(this,"description",nl.description);C(this,"type",r.BuiltInBaseEntity);C(this,"abstract",nl.abstract);C(this,"static",nl.static);C(this,"properties",[]);C(this,"methods",[]);C(this,"abstractMethods",[]);C(this,"extends",null);C(this,"errors",[]);C(this,"project");this.initialData=nl,this.project=t,this.id=nl.id,this.version=nl.version,this.name=nl.name,this.static=nl.static,this.abstract=nl.abstract,this.properties=this.initialData.properties.map(n=>{const s=Se(n,this.project);return s.setParent(this,null),s.initChildren(null),s}),this.methods=this.initialData.methods.map(n=>{const s=Se(n,this.project);return s.parent=this,s}),this.abstractMethods=this.initialData.abstractMethods.map(n=>{const s=Se(n,this.project);return s.parent=this,s}),this.initialData.extends&&(this.extends=Se(this.initialData.extends,this.project))}}var xl=(a=>(a.ValueMustBeString="value-must-be-string",a.StringValueMustNotHaveSpaces="string-value-must-not-have-spaces",a.StringValueMustNotHaveDashes="string-value-must-not-have-dashes",a.MustBeUniqueAmongSameEntities="must-be-unique-among-same-entities",a))(xl||{});function zg(a,p){const t=[],n=p;if(!n)return{errors:t,override:p};if(typeof n!="string")return{errors:[],override:p};if(n.includes(" ")){const s=new ht({id:a.id+"--string-value-must-not-have-spaces",message:`Entity of type ${a.type} with id "${a.id}" has an invalid value "${p}". The value cannot contain spaces.`,severity:Ie.Error,code:"string-value-must-not-have-spaces",entity:a});t.push(s)}return{errors:t,override:n.replace(/\s/g,"-")}}function hmt(a,p){const t=[],n=p;if(!n)return{errors:t,override:p};if(typeof n!="string")return{errors:[],override:p};if(n.includes(" ")){const s=new ht({id:a.id+"--string-value-must-not-have-spaces",message:`Entity of type ${a.type} with id "${a.id}" has an invalid value "${p}". The value cannot contain spaces or dashes.`,severity:Ie.Error,code:"string-value-must-not-have-spaces",entity:a});t.push(s)}if(n.includes("-")){const s=new ht({id:a.id+"--string-value-must-not-have-dashes",message:`Entity of type ${a.type} with id "${a.id}" has an invalid value "${p}". The value cannot contain spaces or dashes.`,severity:Ie.Error,code:"string-value-must-not-have-dashes",entity:a});t.push(s)}return{errors:t,override:n.replace(/\s|-/g,"_")}}var Ef=(a=>(a.StatusCodeMustBeNumber="status-code-must-be-number",a.StatusCodeMustBeBetween100And599="status-code-must-be-between-100-and-599",a))(Ef||{}),mmt=(a=>(a.PathMustStartWithSlash="path-must-start-with-slash",a.PathContainsInvalidCharacters="path-contains-invalid-characters",a.PathUnclosedCurlyBracket="path-unclosed-curly-bracket",a.PathUnopenedCurlyBracket="path-unopened-curly-bracket",a.PathEmptyCurlyBrackets="path-empty-curly-brackets",a.PathConflictsWithExistingEndpoint="path-conflicts-with-existing-endpoint",a))(mmt||{});function ML(a,p){if(!a||!p)return!1;if(a===p)return!0;const t=a.split("/").filter(Boolean),n=p.split("/").filter(Boolean);if(t.length!==n.length)return!1;for(let s=0;s<t.length;s++){const u=t[s],e=n[s],f=u.startsWith("{")&&u.endsWith("}"),y=e.startsWith("{")&&e.endsWith("}");if(!(f&&y)&&u!==e)return!1}return!0}function Tmt(a,p){const t=[];if(typeof p!="number"){const n=new ht({id:a.id+"--status-code-must-be-number",message:`Entity of type ${a.type} with id "${a.id}" has an invalid value "${p}". The value must be a number.`,severity:Ie.Error,code:"status-code-must-be-number",entity:a});return t.push(n),{errors:t,override:p}}if(p<100||p>599){const n=new ht({id:a.id+"--status-code-must-be-between-100-and-599",message:`Entity of type ${a.type} with id "${a.id}" has an invalid value "${p}". The value must be a number between 100 and 599.`,severity:Ie.Error,code:"status-code-must-be-between-100-and-599",entity:a});t.push(n)}return{errors:t,override:p}}class vmt extends Hd{constructor(t){var f,y;super(_d,t);C(this,"initialData");C(this,"id",xe.HTTP_ENDPOINT);C(this,"version","1");C(this,"name",xe.HTTP_ENDPOINT);C(this,"description",_d.description);C(this,"type",r.BuiltInBaseEntity);C(this,"abstract",_d.abstract);C(this,"static",_d.static);C(this,"properties",[]);C(this,"methods",[]);C(this,"abstractMethods",[]);C(this,"extends",null);C(this,"errors",[]);C(this,"project");this.initialData=_d,this.project=t,this.id=_d.id,this.version=_d.version,this.name=_d.name,this.static=_d.static,this.abstract=_d.abstract,this.properties=this.initialData.properties.map(m=>{const T=Se(m,this.project);return T.setParent(this,null),T.initChildren(null),T}),this.methods=this.initialData.methods.map(m=>{const T=Se(m,this.project);return T.parent=this,T}),this.abstractMethods=this.initialData.abstractMethods.map(m=>{const T=Se(m,this.project);return T.parent=this,T}),this.initialData.extends&&(this.extends=Se(this.initialData.extends,this.project));const n=this.properties.find(m=>m.id===G["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.properties.path.id);if(!n)throw new Error("Path property not found in endpoint entity");n._codeNativeValueValidation=(m,T)=>{var P;const g=zg(m,T);let b=typeof g.override=="string"?g.override:"";if(b&&!b.startsWith("/")&&(b="/"+b),typeof b=="string"){if(/[^a-zA-Z0-9\-_/{}]/g.test(b)){const Z=new ht({id:m.id+"--path-contains-invalid-characters",message:`Path "${b}" contains invalid characters. Only alphanumeric, -, _, /, and {} are allowed.`,severity:Ie.Error,code:"path-contains-invalid-characters",entity:m});g.errors.push(Z)}let $=!1,U="";for(let Z=0;Z<b.length;Z++){const q=b[Z];if(q==="{")$=!0,U+=q;else if(q==="}"){if(!$){const H=new ht({id:m.id+"--path-unopened-curly-bracket",message:`Path "${b}" has a closed curly bracket '}' without an opening bracket '{'.`,severity:Ie.Error,code:"path-unopened-curly-bracket",entity:m});g.errors.push(H)}$=!1,U+=q}else U+=$?q:q.toLowerCase()}if(b=U,$){const Z=new ht({id:m.id+"--path-unclosed-curly-bracket",message:`Path "${b}" has an unclosed curly bracket '{'.`,severity:Ie.Error,code:"path-unclosed-curly-bracket",entity:m});g.errors.push(Z)}if(b.includes("{}")){const Z=new ht({id:m.id+"--path-empty-curly-brackets",message:`Path "${b}" has empty curly brackets '{}'. Path parameters must have a name.`,severity:Ie.Error,code:"path-empty-curly-brackets",entity:m});g.errors.push(Z)}}g.override=b;const R=m.parent,I=R.properties.find(x=>x.implements.find($=>$.id===G["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.properties.method.id)),A=(P=I==null?void 0:I.getDefaultValue())==null?void 0:P.value;if(m.project.entities.filter(x=>cn(x,xe.HTTP_ENDPOINT)&&x.id!==R.id).some(x=>{var Z,q;const $=x.properties.find(H=>H.implements.find(Y=>Y.id===G["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.properties.method.id));if(((Z=$==null?void 0:$.getDefaultValue())==null?void 0:Z.value)!==A)return!1;const U=x.properties.find(H=>H.implements.find(Y=>Y.id===G["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.properties.path.id));if(!U)throw new Error(`"Path" property not found in endpoint entity "${x.name}" (${x.id})`);return ML((q=U.getDefaultValue())==null?void 0:q.value,b)})){const x=new ht({id:m.id+"--path-conflicts-with-existing-endpoint",message:`Path "${b}" conflicts with another endpoint using the ${A} method.`,severity:Ie.Error,code:"path-conflicts-with-existing-endpoint",entity:m});g.errors.push(x)}return g};const s=this.properties.find(m=>m.id===G["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.properties.method.id);s&&(s._codeNativeValueValidation=(m,T)=>{var O;const g={errors:[],override:T},b=m.parent,R=b.properties.find(P=>P.implements.find(x=>x.id===G["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.properties.path.id)),I=(O=R==null?void 0:R.getDefaultValue())==null?void 0:O.value;if(m.project.entities.filter(P=>cn(P,xe.HTTP_ENDPOINT)&&P.id!==b.id).some(P=>{var U,Z;const x=P.properties.find(q=>q.implements.find(H=>H.id===G["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.properties.path.id));if(!ML((U=x==null?void 0:x.getDefaultValue())==null?void 0:U.value,I))return!1;const $=P.properties.find(q=>q.implements.find(H=>H.id===G["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.properties.method.id));return((Z=$==null?void 0:$.getDefaultValue())==null?void 0:Z.value)===T})){const P=new ht({id:m.id+"--"+xl.MustBeUniqueAmongSameEntities,message:`Method "${T}" cannot be used because another endpoint is already using the ${T} method on path "${I}".`,severity:Ie.Error,code:xl.MustBeUniqueAmongSameEntities,entity:m});g.errors.push(P)}return g});const u=this.abstractMethods.find(m=>m.id===G["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.methods.handler.id);if(!u)throw new Error("Handler method not found in endpoint entity");const e=(((y=(f=u.dataType)==null?void 0:f.entity)==null?void 0:y.properties)||[]).find(m=>m.id===G["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,T)=>Tmt(m,T)}}var WR=(a=>(a.InvalidCharacters="cron-invalid-characters",a.MustHaveSixFields="cron-must-have-six-fields",a.DayOfMonthAndWeekConflict="cron-day-of-month-and-week-conflict",a))(WR||{});function gmt(a,p){const t=[];let n=p;if(typeof p!="string"){const e=new ht({id:a.id+"--"+xl.ValueMustBeString,message:`Entity of type ${a.type} with id "${a.id}" has an invalid value. The cron expression must be a string.`,severity:Ie.Error,code:xl.ValueMustBeString,entity:a});return t.push(e),{errors:t,override:""}}n=p.trimStart().replace(/\s{2,}/g," ");const s=/[^0-9A-Z *?\-/,LW#]/g;if(s.test(n)){const e=Array.from(new Set(n.match(s)));t.push(new ht({id:a.id+"--cron-invalid-characters",message:`Cron expression contains invalid characters: "${e.join(", ")}". Only alphanumeric characters and (* ? - / , L W #) are allowed.`,severity:Ie.Error,code:"cron-invalid-characters",entity:a})),n=n.replace(s,"")}const u=n.split(" ").filter(Boolean);if(u.length!==6)t.push(new ht({id:a.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 ${u.length}.`,severity:Ie.Error,code:"cron-must-have-six-fields",entity:a}));else{const e=u[2],f=u[4];e!=="?"&&f!=="?"&&(t.push(new ht({id:a.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:Ie.Error,code:"cron-day-of-month-and-week-conflict",entity:a})),e==="*"&&f==="*"&&(u[4]="?",n=u.join(" ")))}return{errors:t,override:n}}class bmt extends Hd{constructor(t){super(fp,t);C(this,"initialData");C(this,"id",xe.CRON_JOB);C(this,"version","1");C(this,"name",xe.CRON_JOB);C(this,"description",fp.description);C(this,"type",r.BuiltInBaseEntity);C(this,"abstract",fp.abstract);C(this,"static",fp.static);C(this,"properties",[]);C(this,"methods",[]);C(this,"abstractMethods",[]);C(this,"extends",null);C(this,"errors",[]);C(this,"project");this.initialData=fp,this.project=t,this.id=fp.id,this.version=fp.version,this.name=fp.name,this.static=fp.static,this.abstract=fp.abstract,this.properties=this.initialData.properties.map(s=>{const u=Se(s,this.project);return u.setParent(this,null),u.initChildren(null),u}),this.methods=this.initialData.methods.map(s=>{const u=Se(s,this.project);return u.parent=this,u}),this.abstractMethods=this.initialData.abstractMethods.map(s=>{const u=Se(s,this.project);return u.parent=this,u}),this.initialData.extends&&(this.extends=Se(this.initialData.extends,this.project));const n=this.properties.find(s=>s.id===G["built-in-base-entity"].BUILT_IN_CRON_JOB_ENTITY.properties.expression.id);if(!n)throw new Error("Expression property not found in cron job entity");n._codeNativeValueValidation=(s,u)=>gmt(s,u)}}class Emt extends Hd{constructor(t){super(Cl,t);C(this,"initialData");C(this,"id",xe.RELATIONAL_DATABASE);C(this,"version","1");C(this,"name",xe.RELATIONAL_DATABASE);C(this,"description",Cl.description);C(this,"type",r.BuiltInBaseEntity);C(this,"abstract",Cl.abstract);C(this,"static",Cl.static);C(this,"properties",[]);C(this,"methods",[]);C(this,"abstractMethods",[]);C(this,"extends",null);C(this,"errors",[]);C(this,"project");this.initialData=Cl,this.project=t,this.id=Cl.id,this.version=Cl.version,this.name=Cl.name,this.static=Cl.static,this.abstract=Cl.abstract,this.properties=this.initialData.properties.map(u=>{const e=Se(u,this.project);return e.setParent(this,null),e.initChildren(null),e}),this.methods=this.initialData.methods.map(u=>{const e=Se(u,this.project);return e.parent=this,e}),this.abstractMethods=this.initialData.abstractMethods.map(u=>{const e=Se(u,this.project);return e.parent=this,e}),this.initialData.extends&&(this.extends=Se(this.initialData.extends,this.project));const n=this.properties.find(u=>u.id===G["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.identifier.id);if(!n)throw new Error("Path property not found in endpoint entity");n._codeNativeValueValidation=(u,e)=>hmt(u,e);const s=this.properties.find(u=>u.id===G["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.minSize.id);s&&(s._codeNativeValueValidation=(u,e)=>{const f={errors:[],override:e};if(typeof e=="number"){if(e<6){const y=new ht({id:u.id+"--"+Ne.RelationalDatabaseMinSizeTooSmall,message:"Minimum GB size cannot be less than 6.",severity:Ie.Error,code:Ne.RelationalDatabaseMinSizeTooSmall,entity:u});f.errors.push(y)}else if(e>65536){const y=new ht({id:u.id+"--"+Ne.RelationalDatabaseMinSizeTooLarge,message:"Minimum GB size cannot be greater than 65536.",severity:Ie.Error,code:Ne.RelationalDatabaseMinSizeTooLarge,entity:u});f.errors.push(y)}}else if(e!==void 0){const y=new ht({id:u.id+"--"+Ne.RelationalDatabaseMinSizeMustBeNumber,message:"Minimum GB size must be a number.",severity:Ie.Error,code:Ne.RelationalDatabaseMinSizeMustBeNumber,entity:u});f.errors.push(y)}return f})}}var Imt=(a=>(a.InvalidCharacters="compute-name-invalid-characters",a.TooLong="compute-name-too-long",a.Empty="compute-name-empty",a))(Imt||{});class Rmt extends Hd{constructor(t){super(yp,t);C(this,"initialData");C(this,"id",xe.COMPUTE_ENTITY);C(this,"version","1");C(this,"name",xe.COMPUTE_ENTITY);C(this,"description",yp.description);C(this,"type",r.BuiltInBaseEntity);C(this,"abstract",yp.abstract);C(this,"static",yp.static);C(this,"properties",[]);C(this,"methods",[]);C(this,"abstractMethods",[]);C(this,"extends",null);C(this,"errors",[]);C(this,"project");this.initialData=yp,this.project=t,this.id=yp.id,this.version=yp.version,this.name=yp.name,this.static=yp.static,this.abstract=yp.abstract,this.properties=this.initialData.properties.map(s=>{const u=Se(s,this.project);return u.setParent(this,null),u.initChildren(null),u}),this.methods=this.initialData.methods.map(s=>{const u=Se(s,this.project);return u.parent=this,u}),this.abstractMethods=this.initialData.abstractMethods.map(s=>{const u=Se(s,this.project);return u.parent=this,u}),this.initialData.extends&&(this.extends=Se(this.initialData.extends,this.project));const n=this.properties.find(s=>s.id===G["built-in-base-entity"][xe.COMPUTE_ENTITY].properties.computeName.id);n&&(n._codeNativeValueValidation=(s,u)=>{const e={errors:[],override:u};if(typeof u!="string"||!u){const y=new ht({id:s.id+"--compute-name-empty",message:"Compute name cannot be empty.",severity:Ie.Error,code:"compute-name-empty",entity:s});return e.errors.push(y),e}if(u.length>255){const y=new ht({id:s.id+"--compute-name-too-long",message:"Compute name must be 255 characters or fewer.",severity:Ie.Error,code:"compute-name-too-long",entity:s});e.errors.push(y)}if(/[^a-zA-Z0-9\-_]/g.test(u)){const y=new ht({id:s.id+"--compute-name-invalid-characters",message:`Compute name "${u}" contains invalid characters. Only alphanumeric characters, hyphens (-), and underscores (_) are allowed.`,severity:Ie.Error,code:"compute-name-invalid-characters",entity:s});e.errors.push(y)}return e.errors.length||this.project.entities.filter(m=>cn(m,xe.COMPUTE_ENTITY)&&m.id!==this.id).forEach(m=>{var g;const T=m.properties.find(b=>b.implements.some(R=>R.id===G[r.BuiltInBaseEntity][xe.COMPUTE_ENTITY].properties.computeName.id));if(T&&(T==null?void 0:T.id)!==s.id&&((g=T.defaultValue)==null?void 0:g.value)===u){const b=new ht({id:s.id+"--"+Ne.ComputeNameNotUnique,message:`Compute name "${u}" is duplicated.`,severity:Ie.Error,code:Ne.ComputeNameNotUnique,entity:s});e.errors.push(b)}}),e})}}var Amt=(a=>(a.InvalidImageUri="container-compute-invalid-image-uri",a.InvalidMinTasks="container-compute-invalid-min-tasks",a.InvalidMaxTasks="container-compute-invalid-max-tasks",a.MaxTasksLessThanMinTasks="container-compute-max-less-than-min",a.InvalidEphemeralStorage="container-compute-invalid-ephemeral-storage",a))(Amt||{});class Dmt extends Hd{constructor(t){super(hp,t);C(this,"initialData");C(this,"id",xe.CONTAINER_COMPUTE_ENTITY);C(this,"version","1");C(this,"name",xe.CONTAINER_COMPUTE_ENTITY);C(this,"description",hp.description);C(this,"type",r.BuiltInBaseEntity);C(this,"abstract",hp.abstract);C(this,"static",hp.static);C(this,"properties",[]);C(this,"methods",[]);C(this,"abstractMethods",[]);C(this,"extends",null);C(this,"errors",[]);C(this,"project");this.initialData=hp,this.project=t,this.id=hp.id,this.version=hp.version,this.name=hp.name,this.static=hp.static,this.abstract=hp.abstract,this.properties=this.initialData.properties.map(f=>{const y=Se(f,this.project);return y.setParent(this,null),y.initChildren(null),y}),this.methods=this.initialData.methods.map(f=>{const y=Se(f,this.project);return y.parent=this,y}),this.abstractMethods=this.initialData.abstractMethods.map(f=>{const y=Se(f,this.project);return y.parent=this,y}),this.initialData.extends&&(this.extends=Se(this.initialData.extends,this.project));const n=this.properties.find(f=>f.id===G["built-in-base-entity"][xe.CONTAINER_COMPUTE_ENTITY].properties.imageUri.id);n&&(n._codeNativeValueValidation=(f,y)=>{const m={errors:[],override:y};if(typeof y!="string"||!y)return m;if(/\s/.test(y)){const T=new ht({id:f.id+"--container-compute-invalid-image-uri",message:`Image URI "${y}" contains spaces, which is invalid.`,severity:Ie.Error,code:"container-compute-invalid-image-uri",entity:f});m.errors.push(T)}return m});const s=this.properties.find(f=>f.id===G["built-in-base-entity"][xe.CONTAINER_COMPUTE_ENTITY].properties.minTasks.id);s&&(s._codeNativeValueValidation=(f,y)=>{var R;const m={errors:[],override:y};if(typeof y!="number")return m;if(y<0){const I=new ht({id:f.id+"--container-compute-invalid-min-tasks",message:"Minimum Tasks must be 0 or greater.",severity:Ie.Error,code:"container-compute-invalid-min-tasks",entity:f});m.errors.push(I)}const g=f.parent.properties.find(I=>I.implements.find(A=>A.id===G["built-in-base-entity"][xe.CONTAINER_COMPUTE_ENTITY].properties.maxTasks.id)),b=(R=g==null?void 0:g.getDefaultValue())==null?void 0:R.value;if(typeof b=="number"&&y>b){const I=new ht({id:f.id+"--container-compute-max-less-than-min",message:`Minimum Tasks (${y}) cannot be greater than Maximum Tasks (${b}).`,severity:Ie.Error,code:"container-compute-max-less-than-min",entity:f});m.errors.push(I)}return m});const u=this.properties.find(f=>f.id===G["built-in-base-entity"][xe.CONTAINER_COMPUTE_ENTITY].properties.maxTasks.id);u&&(u._codeNativeValueValidation=(f,y)=>{var R;const m={errors:[],override:y};if(typeof y!="number")return m;if(y<1){const I=new ht({id:f.id+"--container-compute-invalid-max-tasks",message:"Maximum Tasks must be 1 or greater.",severity:Ie.Error,code:"container-compute-invalid-max-tasks",entity:f});m.errors.push(I)}const g=f.parent.properties.find(I=>I.implements.find(A=>A.id===G["built-in-base-entity"][xe.CONTAINER_COMPUTE_ENTITY].properties.minTasks.id)),b=(R=g==null?void 0:g.getDefaultValue())==null?void 0:R.value;if(typeof b=="number"&&y<b){const I=new ht({id:f.id+"--container-compute-max-less-than-min",message:`Maximum Tasks (${y}) cannot be less than Minimum Tasks (${b}).`,severity:Ie.Error,code:"container-compute-max-less-than-min",entity:f});m.errors.push(I)}return m});const e=this.properties.find(f=>{var y;return f.id===((y=G["built-in-base-entity"][xe.CONTAINER_COMPUTE_ENTITY].properties.ephemeralStorage)==null?void 0:y.id)});e&&(e._codeNativeValueValidation=(f,y)=>{const m={errors:[],override:y};if(typeof y!="number")return m;if(y<20||y>200){const T=new ht({id:f.id+"--container-compute-invalid-ephemeral-storage",message:"Ephemeral Storage must be between 20 and 200 GB.",severity:Ie.Error,code:"container-compute-invalid-ephemeral-storage",entity:f});m.errors.push(T)}return m})}}var Cmt=(a=>(a.PathContainsInvalidCharacters="shared-drive-mount-path-invalid-characters",a.PathIsSystemFolder="shared-drive-mount-path-is-system-folder",a.PathInvalidFormat="shared-drive-mount-path-invalid-format",a))(Cmt||{});class wmt extends Hd{constructor(t){super($d,t);C(this,"initialData");C(this,"id",xe.SHARED_DRIVE_MOUNT_ENTITY);C(this,"version","1");C(this,"name",xe.SHARED_DRIVE_MOUNT_ENTITY);C(this,"description",$d.description);C(this,"type",r.BuiltInBaseEntity);C(this,"abstract",$d.abstract);C(this,"static",$d.static);C(this,"properties",[]);C(this,"methods",[]);C(this,"abstractMethods",[]);C(this,"extends",null);C(this,"errors",[]);C(this,"project");this.initialData=$d,this.project=t,this.id=$d.id,this.version=$d.version,this.name=$d.name,this.static=$d.static,this.abstract=$d.abstract,this.properties=this.initialData.properties.map(s=>{const u=Se(s,this.project);return u.setParent(this,null),u.initChildren(null),u}),this.methods=this.initialData.methods.map(s=>{const u=Se(s,this.project);return u.parent=this,u}),this.abstractMethods=this.initialData.abstractMethods.map(s=>{const u=Se(s,this.project);return u.parent=this,u}),this.initialData.extends&&(this.extends=Se(this.initialData.extends,this.project));const n=this.properties.find(s=>s.id===G["built-in-base-entity"][xe.SHARED_DRIVE_MOUNT_ENTITY].properties.path.id);if(!n)throw new Error("Path property not found in shared drive mount entity");n._codeNativeValueValidation=(s,u)=>{const e=zg(s,u);let f=typeof e.override=="string"?e.override:"";if(f&&!f.startsWith("/")&&(f="/"+f),typeof f=="string"){if(/[^a-zA-Z0-9\-_/]/g.test(f)){const T=new ht({id:s.id+"--shared-drive-mount-path-invalid-characters",message:`Mount path "${f}" contains invalid characters. Only alphanumeric, -, _, and / are allowed.`,severity:Ie.Error,code:"shared-drive-mount-path-invalid-characters",entity:s});e.errors.push(T)}const m=["/bin","/boot","/dev","/etc","/lib","/lib64","/proc","/sys","/usr","/sbin","/run","/var/run"];for(const T of m)if(f===T||f.startsWith(T+"/")){const g=new ht({id:s.id+"--shared-drive-mount-path-is-system-folder",message:`Mounting to or within critical system folder "${T}" is not allowed.`,severity:Ie.Error,code:"shared-drive-mount-path-is-system-folder",entity:s});e.errors.push(g);break}}return e.override=f,e}}}var Omt=(a=>(a.DocumentCannotStartWithSlash="document-cannot-start-with-slash",a.DocumentContainsInvalidCharacters="document-contains-invalid-characters",a))(Omt||{});class xmt extends Hd{constructor(t){super(ea,t);C(this,"initialData");C(this,"id",xe.CLOUD_FILE_SYSTEM_BUCKET);C(this,"version","1");C(this,"name",xe.CLOUD_FILE_SYSTEM_BUCKET);C(this,"description",ea.description);C(this,"type",r.BuiltInBaseEntity);C(this,"abstract",ea.abstract);C(this,"static",ea.static);C(this,"properties",[]);C(this,"methods",[]);C(this,"abstractMethods",[]);C(this,"extends",null);C(this,"errors",[]);C(this,"project");this.initialData=ea,this.project=t,this.id=ea.id,this.version=ea.version,this.name=ea.name,this.static=ea.static,this.abstract=ea.abstract,this.properties=this.initialData.properties.map(u=>{const e=Se(u,this.project);return e.setParent(this,null),e.initChildren(null),e}),this.methods=this.initialData.methods.map(u=>{const e=Se(u,this.project);return e.parent=this,e}),this.abstractMethods=this.initialData.abstractMethods.map(u=>{const e=Se(u,this.project);return e.parent=this,e}),this.initialData.extends&&(this.extends=Se(this.initialData.extends,this.project));const n=this.properties.find(u=>{var e;return u.id===((e=G["built-in-base-entity"].BUILT_IN_CLOUD_FILE_SYSTEM_BUCKET_ENTITY.properties.indexDocument)==null?void 0:e.id)});n&&(n._codeNativeValueValidation=(u,e)=>{const f=zg(u,e);let y=typeof f.override=="string"?f.override:"";if(typeof y=="string"&&y.startsWith("/")){const m=new ht({id:u.id+"--document-cannot-start-with-slash",message:`Document "${y}" cannot start with a slash. It must be a relative path.`,severity:Ie.Error,code:"document-cannot-start-with-slash",entity:u});f.errors.push(m)}return f});const s=this.properties.find(u=>{var e;return u.id===((e=G["built-in-base-entity"].BUILT_IN_CLOUD_FILE_SYSTEM_BUCKET_ENTITY.properties.errorDocument)==null?void 0:e.id)});s&&(s._codeNativeValueValidation=(u,e)=>{const f=zg(u,e);let y=typeof f.override=="string"?f.override:"";if(typeof y=="string"&&y.startsWith("/")){const m=new ht({id:u.id+"--document-cannot-start-with-slash",message:`Document "${y}" cannot start with a slash. It must be a relative path.`,severity:Ie.Error,code:"document-cannot-start-with-slash",entity:u});f.errors.push(m)}return f})}}class Pmt extends Jt{constructor(t){super(co,t);C(this,"id",co.id);C(this,"name",co.name);C(this,"description",co.description);C(this,"version",co.version);C(this,"autoexecutable",!1);C(this,"type",r.ActionDescriptor);C(this,"inputs",[]);C(this,"dataType",null);C(this,"error",null);C(this,"project");this.project=t,this.inputs=co.inputs.map(n=>{const s=Se(n,this.project);return s.setParent(this,null),s.initChildren(null),s}),this.dataType=Se(co.dataType,this.project),this.dataType.setParent(this,null),this.dataType.initChildren(null),this.error=co.error?Se(co.error,this.project):null}}var Fd=(a=>(a.UUIDMustBeString="uuid-must-be-string",a.UUIDMustBeValidFormat="uuid-must-be-valid-format",a.UUIDMustNotContainSpaces="uuid-must-not-contain-spaces",a))(Fd||{});function abn(a,p){const t=[];if(typeof p!="string"){const s=new ht({id:a.id+"--uuid-must-be-string",message:`Entity of type ${a.type} with id "${a.id}" has an invalid value "${p}". The value must be text.`,severity:Ie.Error,code:"uuid-must-be-string",entity:a});return t.push(s),{errors:t,override:p}}const n=zg(a,p);if(n.errors.length>0)return t.push(...n.errors),{errors:t,override:p};if(!s4(p)){const s=new ht({id:a.id+"--uuid-must-be-valid-format",message:`Entity of type ${a.type} with id "${a.id}" has an invalid value "${p}". The value must be a valid UUID format. Eg: "123e4567-e89b-12d3-a456-426614174000".`,severity:Ie.Error,code:"uuid-must-be-valid-format",entity:a});t.push(s)}return{errors:t,override:p}}var rt=(a=>(a.Inherited="inherited",a.DefaultValue="default-value",a.Missing="missing",a.Undefined="undefined",a.Empty="empty",a.AutoCalculated="auto-calculated",a.QueuedAutocalculation="queued-autocalculation",a.External="external",a.Testing="testing",a.ExecutionResult="execution-result",a))(rt||{});const Vmt={initialized:!1,id:"",project:null,values:{},onWriteCallback:()=>{},onRemoveCallback:()=>{},onWrite:()=>{},onRemove:()=>{},init:()=>{},toJSON:()=>({}),writeValue:()=>{},readValue:()=>null,removeValue:()=>{},clear:()=>{}};function PR(a,p){return{...Vmt,id:a,project:p}}class VR{constructor(p,t){C(this,"initialized",!1);C(this,"id");C(this,"project");C(this,"values",{});C(this,"onWriteCallback",()=>{});C(this,"onRemoveCallback",()=>{});this.id=p,this.project=t,this.init()}onWrite(p){this.onWriteCallback=p}onRemove(p){this.onRemoveCallback=p}init(){var n;if(!((n=this.project)!=null&&n.id)||this.initialized)return;const p={},t={};Object.keys(p).forEach(s=>{const u=p[s],e=new ya(u,this.project);try{if(u.parent){const m=this.project.findSubscribedInstanceFromReference(u.parent);if(!m)return;e.setParent(m,null),e.hydrateAncestors(),e.initChildren(null)}else if(u.standaloneParent){const m=this.project.findSubscribedInstanceFromReference(u.standaloneParent);if(!m)return;e.standalone=!0,e.setStandaloneParent(m,null),e.hydrateAncestors(),e.initChildren(null)}t[s]=e;const f=e.parent||e.standaloneParent,y=Wmt(e,f,this.project);y?t[s]=y:delete p[s]}catch(f){pe.Logger.error("Error hydrating ancestors: ",f),delete p[s]}}),this.values={...this.values,...t},this.initialized=!0}toJSON(){const p={};return Object.keys(this.values).forEach(t=>{p[t]=this.values[t].toJSON()}),p}writeValue(p,t){if(!p)throw new Error("The value owner entity is required when writing a value to a value store");let s=this.values[p.id];if(!s)if(t instanceof ya)s=t;else if(t)s=Zr(t,this.project);else{const u={id:M.UUID.uuid(),version:M.UUID.uuid(),createdAt:new Date().toISOString(),author:M.sessionAuthor,deleted:!1,previousVersion:null,value:null,deletable:!0,editable:!0,type:r.LiteralValue,standaloneParent:p.toReference(),parent:null,valueAsTypeSingle:null,valueAsTypeList:null,autogeneration:null,name:ly(p.getDataType(null))};s=Zr(u,this.project)}s.standalone=!0,s.initialData.standaloneParent||pe.Logger.warn("instance.initialData: ",s.initialData),s.setStandaloneParent(p,null),s.hydrateAncestors(),s.initChildren(null),t&&(s.metaSync({...t},null),s.setValueAsType(t.valueAsType,null)),this.values[p.id]=s,this.onWriteCallback(p,s)}readValue(p){return this.values[p]||null}removeValue(p){if(!this.values[p])return;delete this.values[p];const t=this.project.get(p);t&&this.onRemoveCallback(t)}clear(){this.values={}}}function ks(a){return a!==null&&typeof a=="object"&&!Array.isArray(a)}function v4(a){if(Array.isArray(a))return a.map(y=>typeof y=="number"?y:e(y)?Number(y):String(y));const p=[];let t=0,n="",s=!1,u=null;for(;t<a.length;){const y=a[t];if(y==="."&&!s){n.length&&(p.push(f(n)),n=""),t++;continue}if(y==="["&&!s){n.length&&(p.push(f(n)),n=""),s=!0,t++;continue}if(s){if(!u&&(y==='"'||y==="'")){u=y,t++;continue}if(u){if(y==="\\"&&t+1<a.length){n+=a[t+1],t+=2;continue}if(y===u){u=null,t++;continue}n+=y,t++;continue}if(y==="]"){p.push(f(n)),n="",s=!1,t++;continue}if(/\s/.test(y)&&!u){t++;continue}n+=y,t++;continue}n+=y,t++}return n.length&&p.push(f(n)),p;function e(y){return/^[0-9]+$/.test(y)}function f(y){const m=y.trim();return e(m)?Number(m):m}}function oV(a,p,t){if(a==null)return t;const n=v4(p);let s=a;for(let u=0;u<n.length;u++){const e=n[u];if(s==null)return t;if(Array.isArray(s)&&typeof e=="number"){if(!(e in s))return t;s=s[e]}else{if(!Object.prototype.hasOwnProperty.call(s,e))return t;s=s[e]}}return s}const sbn=new Set(["__proto__","prototype","constructor"]);function Nmt(a){return typeof a=="string"&&sbn.has(a)}function lbn(a,p,t,n){const{createMissing:s=!0,coerce:u=!0}=n??{};if(a==null||typeof a!="object")throw new TypeError("set(...) expects a non-null object as target.");const e=v4(p);if(e.length===0)throw new Error("set(...) path must not be empty.");let f=a;for(let y=0;y<e.length;y++){const m=e[y];if(Nmt(m))throw new Error(`Refusing to set unsafe key "${String(m)}" on object.`);const T=y===e.length-1,b=typeof e[y+1]=="number",R=Array.isArray(f)&&typeof m=="number";if(T){if(R&&f[m]==null&&!s)throw new Error(`set(...) missing array index "${String(m)}" (createMissing=false).`);return f[m]=t,a}else{if(!Object.prototype.hasOwnProperty.call(f,m)||f[m]==null){if(!s)throw new Error(`set(...) missing parent at segment "${String(m)}" (createMissing=false).`);f[m]=b?[]:{}}else{const I=f[m],A=I!==null&&typeof I=="object",O=Array.isArray(I);if(b){if(!O){if(!u)throw new Error(`set(...) expected an array at "${String(m)}" but found non-array (coerce=false).`);f[m]=[]}}else if(!A||O){if(!u)throw new Error(`set(...) expected an object at "${String(m)}" but found non-object (coerce=false).`);f[m]={}}}f=f[m]}}return a}function g4(a,p,t,n){const s=v4(p);if(s.length===0)return a;function u(e,f){const y=s[f],m=f===s.length-1;if(n==="strict-set"||n==="strict-delete"){if(Nmt(y))throw new Error(`Unsafe key "${String(y)}"`);if(e==null||typeof e!="object"&&!Array.isArray(e))throw new Error(`Missing parent or invalid container at segment "${String(y)}".`);if(n==="strict-delete"&&m&&!(y in e))return e}let T;if(Array.isArray(e))T=[...e];else if(e&&typeof e=="object")T={...e};else if(n==="safe-set")T=typeof y=="number"?[]:{};else throw new Error(`Cannot traverse path at "${String(y)}"`);if(m)return n==="strict-delete"?delete T[y]:T[y]=t,T;const g=e?e[y]:void 0;if(n==="safe-set"&&g==null){const b=typeof s[f+1]=="number",R=u(b?[]:{},f+1);return T[y]=R,T}return T[y]=u(g,f+1),T}if(a==null&&n==="safe-set"){const e=typeof s[0]=="number";return u(e?[]:{},0)}return u(a,0)}const JH=Symbol("missing"),obn=a=>a!=null&&typeof a=="object";function dV(a,p){if(typeof a!="string")throw new TypeError(`${p} expects the key to be a string.`);return a}function IE(a,p){if(typeof a!="string"&&!Array.isArray(a))throw new TypeError(`${p} expects the path to be string or array.`);return a}function sv(a,p){if(!ks(a))throw new TypeError(`${p} expects the first argument to be an object.`);return a??{}}function _mt(a,p){const t=dV(p,"ReadKey");return(a??{})[t]}function $mt(a,p,t){const n=dV(p,"WriteKey");if(a&&typeof a=="object"){const s=Array.isArray(a)?[...a]:{...a};return s[n]=t,s}return{[n]:t}}function Gmt(a,p){if(!a||typeof a!="object")return{};const t=String(p),{[t]:n,...s}=a;return s}function Lmt(a,p,t){const n=sv(a,"ReadNestedKey"),s=IE(p,"ReadNestedKey");return oV(n,s,t)}function Bmt(a,p,t){const n=sv(a,"WriteNestedKey"),s=IE(p,"WriteNestedKey");return g4(n,s,t,"strict-set")}function Smt(a,p,t){const n=sv(a,"WriteSafeNestedKeyRecursively"),s=IE(p,"WriteSafeNestedKeyRecursively");return g4(n,s,t,"safe-set")}function Mmt(a,p){const t=sv(a,"DeleteNestedKey"),n=IE(p,"DeleteNestedKey");return g4(t,n,null,"strict-delete")}function Fmt(a,p){const t=dV(p,"HasKey"),n=a;return n!=null&&obn(n)&&Object.prototype.hasOwnProperty.call(n,t)}function kmt(a,p,t){const n=dV(p,"KeyValueEquals");return a==null||typeof a!="object"?!1:a[n]===t}function Umt(a,p){const t=a,n=IE(p,"HasNestedKey");return oV(t,n,JH)!==JH}function Kmt(a,p,t){const n=IE(p,"NestedKeyValueEquals");return oV(a,n)===t}function jmt(...a){const p={};for(let t=0;t<a.length;t++){const n=a[t];if(n!=null){if(!ks(n))throw new TypeError("MergeObjects expects every argument to be an object (or null/undefined).");Object.assign(p,n)}}return p}function qmt(a){const p=sv(a,"ObjectKeys");return Object.keys(p)}function Zmt(a){const p=sv(a,"ObjectValues");return Object.values(p)}function Hmt(a){const p=sv(a,"ObjectEntries");return Object.entries(p)}const Ig=new Set;function dbn(a){return{execution:null,project:a,localTestValues:PR("local-test-values",a),resolvedValues:PR("resolved-values",a),persistedExecutionResults:PR("persisted-execution-results",a),lastExecutionResults:PR("last-execution-results",a),getValueTypePreference:()=>null,setValueTypePreference:()=>{}}}function RE(a,p,t,n){var f;let s;if(((f=a==null?void 0:a.entity)==null?void 0:f.type)===r.PrimitiveEntity)switch(a.entity.name){case me.EntityTemplate:s=me.EntityTemplate;break;case me.String:s=me.String;break;case me.Number:s=me.Number;break;case me.Boolean:s=me.Boolean;break;case me.Null:s=me.Null;break;case me.Enum:s=me.Enum;break;case me.KeyValue:s=me.KeyValue;break;case me.Untyped:s=me.Untyped;break;case me.KeyValue:s=me.KeyValue;break;case me.Date:s=me.Date;break;case me.UUID:s=me.UUID;break;case me.FileReference:s=me.FileReference;break;case me.Void:s=me.Void;break;case me.ActionDescriptor:s=me.ActionDescriptor;break;case me.Bytes:s=me.Bytes;break;case me.SqlProgram:s=me.SqlProgram;break;case me.RGB:s=me.RGB;break;case me.RGBA:s=me.RGBA;break;case me.SpreadsheetRange:s=me.SpreadsheetRange;break;default:throw new Error(`Primitive type ${Ve(a.entity,t)} is not supported`)}else s=me.Untyped;const u=ya.new(n);u.name=s,u.parent=p.toReference();const e=Se(u,t);return e.hydrateAncestors(),n==null||n.add(e,ye.Added),e.addSelfToProject(n),e.initChildren(n),e}function uf(a,p,t){var u,e,f,y;const n=(t==null?void 0:t.seenInRecursion)??new Set,s=(t==null?void 0:t.forVarInst)??!1;if(n.has(a.id))return[];if(n.add(a.id),Yi.includes(a.type)){const m=ba(a);return s?[a]:_([m,...[m].flatMap(T=>uf(T,p,{seenInRecursion:n,forVarInst:s}))])}else if(a.type===r.OutputMap){if(Yi.includes(a.parent.type)&&((u=a.declaration)==null?void 0:u.type)===r.Property&&a.declaration.static)return _([a,a.declaration,...[a,a.declaration].flatMap(m=>uf(m,p,{seenInRecursion:n,forVarInst:s}))])}else if(a.type===r.InputMap){if(Yi.includes(a.parent.type)&&((e=a.declaration)==null?void 0:e.type)===r.Property&&((f=a.declaration)!=null&&f.static))return _([a.declaration,...[a.declaration].flatMap(m=>uf(m,p,{seenInRecursion:n,forVarInst:s}))])}else if(a.type===r.ValueDescriptor&&((y=a.parent)==null?void 0:y.type)===r.Search){const m=a.parent.inputs.find(T=>{var g;return((g=T.declaration)==null?void 0:g.id)===a.id});if(m)return[m]}return[a]}function Wmt(a,p,t){return a}function AE(a,p,t=!1){const n=a.readsValue;let s=null;const u=Qu(n,p,t);if(u){const e={sources:[u],target:a};s={value:u.value,valueOwner:a,type:rt.Inherited,inheritanceLink:e}}else s={value:null,valueOwner:a,type:rt.Inherited,inheritanceLink:null};return s}function Pn(a,p,t){var f;if(!p)return null;let n;if(((f=a==null?void 0:a.entity)==null?void 0:f.type)===r.PrimitiveEntity)switch(a.entity.name){case me.EntityTemplate:n=me.EntityTemplate;break;case me.String:n=me.String;break;case me.Number:n=me.Number;break;case me.Boolean:n=me.Boolean;break;case me.Null:n=me.Null;break;case me.Enum:n=me.Enum;break;case me.KeyValue:n=me.KeyValue;break;case me.Untyped:n=me.Untyped;break;case me.KeyValue:n=me.KeyValue;break;case me.Date:n=me.Date;break;case me.UUID:n=me.UUID;break;case me.FileReference:n=me.FileReference;break;case me.Void:n=me.Void;break;case me.ActionDescriptor:n=me.ActionDescriptor;break;case me.Bytes:n=me.Bytes;break;case me.SqlProgram:n=me.SqlProgram;break;case me.RGB:n=me.RGB;break;case me.RGBA:n=me.RGBA;break;case me.SpreadsheetRange:n=me.SpreadsheetRange;break;default:throw new Error(`Primitive type ${Ve(a.entity,t)} is not supported`)}else n=me.Untyped;if(!t.get(p.id))return null;const u=ya.new(null);u.name=n,u.standaloneParent=p.toReference();let e=new ya(u,t);return e.hydrateAncestors(),e.standalone=!0,e.setStandaloneParent(p,null),e.initChildren(null),e}function zmt(a,p,t=!1){var u,e;if(p.execution&&p.execution.hasEntity(a)&&!t){const f=(u=p.lastExecutionResults)==null?void 0:u.readValue(a.id);if(f)return{value:f,valueOwner:a,type:rt.ExecutionResult,inheritanceLink:null}}const n=(e=p.localTestValues)==null?void 0:e.readValue(a.id),s=p.getValueTypePreference(a.id);return n&&!t&&(s===null||s!==rt.DefaultValue)?{value:n,valueOwner:a,type:rt.Testing,inheritanceLink:null}:{value:null,valueOwner:a,type:rt.QueuedAutocalculation,inheritanceLink:null}}function Cw(a,p,t,n=!1){var f,y,m,T;const s={...a},u=Yi.includes(p.type)?p.inputs:Ni.includes(p.type)?p.outputs:[];if(!u||u.length===0)return s;let e={};if(p.type===r.VariableInstance){const g=ba(p),b=Qu(g,t,n);e=((f=b==null?void 0:b.value)==null?void 0:f.value)||{}}for(const g of u){if(!vT(g))continue;let b=g;p.type===r.VariableInstance&&!g.defaultValue&&!g.readsValue&&(b=ba(p).inputs.find(O=>{var P,x;return((P=O.declaration)==null?void 0:P.id)===((x=g.declaration)==null?void 0:x.id)}));const R=dA(b,t,n);if(R&&R.value)try{const I=De(b,t.project),A=b.codeName||((y=b.declaration)==null?void 0:y.codeName)||jn(I);s[A]=_s((R==null?void 0:R.value)||null)?s[A]:(m=R==null?void 0:R.value)==null?void 0:m.value}catch{}else if(p.type===r.VariableInstance&&!g.defaultValue&&!g.readsValue)try{const I=De(b,t.project),A=b.codeName||((T=b.declaration)==null?void 0:T.codeName)||jn(I);s[A]=e==null?void 0:e[A]}catch{}}return s}function NR(a,p,t,n=!1){var e,f;const s={...a},u=p.inputs;if(!u)return s;for(const y of u){if(!vT(y))continue;const m=B1(y,t,n);if(m&&m.value&&m.type!==rt.Undefined){const T=Ve(y,t.project),g=y.codeName||((e=y.declaration)==null?void 0:e.codeName)||jn(T);s[g]=(f=m==null?void 0:m.value)==null?void 0:f.value}}return s}function Ymt(a,p,t=!1){var g,b,R,I,A,O;let n={};const s=(g=a.getDataType(null))==null?void 0:g.entity;if((s==null?void 0:s.type)===r.DefinitionEntity)n={...n,...s.getActiveRawDefaultValue()};else if((s==null?void 0:s.type)===r.BuiltInBaseEntity)n={...n,...s.getRawDefaultValue()};else if((s==null?void 0:s.type)===r.PrimitiveEntity&&Sd(s,me.KeyValue)){const P={};s.properties.forEach(x=>{var Z;if(!vp(x)||!x.defaultValue)return;const $=De(x,a.project),U=x.codeName||ho(x,a.project)||Zs(jn($));P[U]=((Z=x.getDefaultValue())==null?void 0:Z.value)||null}),n={...n,...P}}if(p.execution&&p.execution.hasEntity(a)&&!t){const P=(b=p.lastExecutionResults)==null?void 0:b.readValue(a.id);if(P){if(ks(P.value)){const $={...n,...P.value},U={...NR($,a,p,t)};P.metaSync({value:U},null)}return{value:P,valueOwner:a,type:rt.ExecutionResult,inheritanceLink:null}}}const u=!!((R=p.execution)!=null&&R.entities.length),e=(I=p.execution)==null?void 0:I.hasEntity(a),f=a.readsValue;let y=null;if(f){const P=(A=p.execution)==null?void 0:A.hasEntity(f);if((!u||u&&P&&e||u&&!P&&!e)&&(y=AE(a,p,t),y&&y.value&&ks(y.value.value))){const $={...n,...y.value.value},U={...NR($,a,p,t)};y.value.metaSync({value:U},null)}}const m=a.defaultValue,T=p.getValueTypePreference(a.id);if(!y&&m){const P=m;if(P&&P.value===null&&P.autogeneration){const x=uN(P);if(P.metaSync({value:x},null),ks(x)){const $={...NR(x,a,p,t)};P.metaSync({value:$},null)}}(t||T===null||T!==rt.Testing)&&(y={value:P,valueOwner:a,type:_s(P)?a.readsValue?rt.Inherited:rt.Empty:rt.DefaultValue,inheritanceLink:null})}if(!y||(y.type===rt.DefaultValue||y.type===rt.External)&&!t||T===rt.Testing){const P=(O=p.localTestValues)==null?void 0:O.readValue(a.id);if(P){if(ks(P.value)){const x={...n,...P.value},$={...NR(x,a,p,t)};P.metaSync({value:$},null)}return{value:P,valueOwner:a,type:rt.Testing,inheritanceLink:null}}}return _s((y==null?void 0:y.value)||null)?{value:null,valueOwner:a,type:a.readsValue?rt.Inherited:rt.Empty,inheritanceLink:null}:y}function pV(a,p,t=!1){var y,m,T,g,b,R,I,A,O;let n={};const s=(y=a.getDataType(null))==null?void 0:y.entity;if((s==null?void 0:s.type)===r.DefinitionEntity)n={...n,...s.getActiveRawDefaultValue()};else if((s==null?void 0:s.type)===r.BuiltInBaseEntity)n={...n,...s.getRawDefaultValue()};else if((s==null?void 0:s.type)===r.PrimitiveEntity&&Sd(s,me.KeyValue)){const P={};s.properties.forEach(x=>{var Z;if(!vp(x)||!x.defaultValue)return;const $=De(x,a.project),U=x.codeName||ho(x,a.project)||Zs(jn($));P[U]=((Z=x.defaultValue)==null?void 0:Z.value)||null}),n={...n,...P}}if(p.execution&&p.execution.hasEntity(a)&&!t){const P=(m=p.lastExecutionResults)==null?void 0:m.readValue(a.id);if(P){if(ks(P.value)){const $={...n,...P.value},U=Cw($,a,p,t);P==null||P.metaSync({value:U},null)}return{value:P,valueOwner:a,type:rt.ExecutionResult,inheritanceLink:null}}}const u=(T=p.localTestValues)==null?void 0:T.readValue(a.id);let e=!1;if(a.type===r.VariableDeclaration||a.type===r.VariableInstance){const P=a,x=!!((g=p.execution)!=null&&g.entities.length),$=(b=p.execution)==null?void 0:b.hasEntity(a),U=P.readsValue;if(U){const Z=(R=p.execution)==null?void 0:R.hasEntity(U);e=!x||x&&Z&&$||x&&!Z&&!$}}const f=p.getValueTypePreference(a.id);if(u&&!t&&(!e||f===rt.Testing)){if(ks(u.value)){const x={...n,...u.value},$=Cw(x,a,p,t);u.metaSync({value:$},null)}return{value:u,valueOwner:a,type:rt.Testing,inheritanceLink:null}}if(s&&((s==null?void 0:s.type)===r.DefinitionEntity||(s==null?void 0:s.type)===r.BuiltInBaseEntity||s.type===r.PrimitiveEntity&&Sd(s,me.KeyValue))&&((I=a.getDataType(null))!=null&&I.isObject())){const P=Pn(a.getDataType(null),a,p.project);n={...ks((A=a.defaultValue)==null?void 0:A.value)?(O=a.defaultValue)==null?void 0:O.value:{}};const x={...Cw(n,a,p,t)};return P==null||P.metaSync({value:x},null),{value:P,valueOwner:a,type:rt.DefaultValue,inheritanceLink:null}}return null}function uV(a,p,t=!1){var T,g,b,R,I;if((T=a.dataType)!=null&&T.isObject())return Ymt(a,p,t);const n=mi(a),s=!!((g=p.execution)!=null&&g.entities.length),u=(b=p.execution)==null?void 0:b.hasEntity(n),e=a.readsValue;let f=null;if(e){const A=(R=p.execution)==null?void 0:R.hasEntity(e);(!s||s&&A&&u||s&&!A&&!u)&&(f=AE(a,p,t))}const y=a.defaultValue,m=p.getValueTypePreference(a.id);if(!f&&y){const A=y;if(A&&A.value===null&&A.autogeneration){const O=uN(A);A.metaSync({value:O},null)}(t||m===null||m!==rt.Testing)&&(f={value:A,valueOwner:a,type:_s(A)?a.readsValue?rt.Inherited:rt.Empty:rt.DefaultValue,inheritanceLink:null})}if(!f||(f.type===rt.DefaultValue||f.type===rt.External)&&!t||m===rt.Testing){const A=(I=p.localTestValues)==null?void 0:I.readValue(a.id);if(A)return{value:A,valueOwner:a,type:rt.Testing,inheritanceLink:null}}return _s((f==null?void 0:f.value)||null)?{value:null,valueOwner:a,type:a.readsValue?rt.Inherited:rt.Empty,inheritanceLink:null}:f}function Jmt(a,p,t=!1){var s,u;if(p.execution&&p.execution.hasEntity(a)&&!t){const e=(s=p.lastExecutionResults)==null?void 0:s.readValue(a.id);if(e)return{value:e,valueOwner:a,type:rt.ExecutionResult,inheritanceLink:null}}return(u=a.dataType)!=null&&u.isObject()||a.outputs.length?pV(a,p,t):uV(a,p,t)}function b4(a,p,t=!1){var b,R,I,A;const n=!!((b=p.execution)!=null&&b.entities.length),s=(R=p.execution)==null?void 0:R.hasEntity(a);let u=null;const e=a.readsValue;if(e){const O=(I=p.execution)==null?void 0:I.hasEntity(e);(!n||n&&O&&s||n&&!O&&!s)&&(u=AE(a,p,t))}const f=a.declaration;if(!u&&f){const O=uV(f,p,t);O&&O.value&&(u=O)}const y=p.getValueTypePreference(a.id);if(!u||(u.type===rt.DefaultValue||u.type===rt.External)&&!t||y===rt.Testing){const O=(A=p.localTestValues)==null?void 0:A.readValue(a.id);if(O)return{value:O,valueOwner:a,type:rt.Testing,inheritanceLink:null}}a.defaultValue&&(u={value:a.defaultValue,valueOwner:a,type:rt.DefaultValue,inheritanceLink:null});const m=Oy(a),T=a.getDataType(null);return m&&s&&(!(u!=null&&u.value)||!Jo(T)&&cf(u==null?void 0:u.value))?{value:null,valueOwner:a,type:rt.Missing,inheritanceLink:null}:s&&!m&&_s((u==null?void 0:u.value)||null)?{value:null,valueOwner:a,type:a.readsValue?rt.Inherited:rt.Empty,inheritanceLink:null}:u||{value:null,valueOwner:a,type:rt.External,inheritanceLink:null}}function Qmt(a,p,t=!1){var n,s;if(p.execution&&p.execution.hasEntity(a.declaration)&&!t){const u=(n=p.lastExecutionResults)==null?void 0:n.readValue(a.declaration.id);if(u)return{value:u,valueOwner:a.declaration,type:rt.ExecutionResult,inheritanceLink:null}}return(s=a.getDataType(null))!=null&&s.isObject()||a.declaration.outputs.length?pV(a,p,t):b4(a,p,t)}function Xmt(a,p,t=!1){var R,I,A,O;if(!t&&p.execution&&p.execution.hasEntity(a)){const P=(R=p.lastExecutionResults)==null?void 0:R.readValue(a.id);if(P)return{value:P,valueOwner:a,type:rt.ExecutionResult,inheritanceLink:null}}const n=!p.execution||!p.execution.parentExecution,s=p.getValueTypePreference(a.id);if(n){const P=(I=p.localTestValues)==null?void 0:I.readValue(a.id);if(P&&!t&&(s===null||s!==rt.DefaultValue))return{value:P,valueOwner:a,type:rt.Testing,inheritanceLink:null}}const u=mi(a),e=a.parent.type===r.FunctionDeclaration&&a.parent.parent.type===r.Loop?a.parent:null,f=!!((A=p.execution)!=null&&A.hasEntity(u))||!!e&&!!((O=p.execution)!=null&&O.hasEntity(e));let y=null;const m=a.defaultValue;if(m){const P=m||null;if(P&&P.value===null&&P.autogeneration){const x=uN(P);P.metaSync({value:x},null)}(t||s===null||s!==rt.Testing)&&(y={value:P,valueOwner:a,type:_s(P)?rt.Empty:rt.DefaultValue,inheritanceLink:null})}!y||(y.type===rt.DefaultValue||y.type===rt.External)&&!t||rt.Testing;const T=Oy(a),g=a.getDataType(null);let b=T&&f&&(!(y!=null&&y.value)||!Jo(g)&&cf(y==null?void 0:y.value));return u.type===r.Loop&&f&&(b=!1),b?{value:null,valueOwner:a,type:rt.Missing,inheritanceLink:null}:f&&!T&&_s((y==null?void 0:y.value)||null)?{value:null,valueOwner:a,type:rt.Empty,inheritanceLink:null}:y||{value:null,valueOwner:a,type:rt.External,inheritanceLink:null}}function E4(a,p,t=!1){var R,I,A,O,P,x;if((R=a.getDataType(null))!=null&&R.isObject()||a.outputs.length)return pV(a,p);if(p.execution&&p.execution.hasEntity(a)&&!t){const $=(I=p.lastExecutionResults)==null?void 0:I.readValue(a.id);if($)return{value:$,valueOwner:a,type:rt.ExecutionResult,inheritanceLink:null}}const n=mi(a),s=!!((A=p.execution)!=null&&A.entities.length),u=(O=p.execution)==null?void 0:O.hasEntity(n),e=a.readsValue;let f=null;if(e){const $=(P=p.execution)==null?void 0:P.hasEntity(e);(!s||s&&$&&u||s&&!$&&!u)&&(f=AE(a,p,t))}const y=a.defaultValue,m=p.getValueTypePreference(a.id);if(!f&&y){const $=y;(t||m===null||m!==rt.Testing)&&(f={value:$,valueOwner:a,type:rt.DefaultValue,inheritanceLink:null})}if(!f||(f.type===rt.DefaultValue||f.type===rt.External)&&!t||m===rt.Testing){const $=(x=p.localTestValues)==null?void 0:x.readValue(a.id);if($)return{value:$,valueOwner:a,type:rt.Testing,inheritanceLink:null}}const T=Oy(a),g=a.getDataType(null);return T&&(!(f!=null&&f.value)||!Jo(g)&&cf(f==null?void 0:f.value))?{value:null,valueOwner:a,type:rt.Missing,inheritanceLink:null}:!a.defaultValue&&!a.readsValue?{value:null,valueOwner:a,type:rt.Undefined,inheritanceLink:null}:!T&&_s((f==null?void 0:f.value)||null)?{value:null,valueOwner:a,type:a.readsValue?rt.Inherited:rt.Empty,inheritanceLink:null}:f}function eTt(a,p,t=!1){var e,f,y,m,T,g,b,R;if(p.execution&&p.execution.hasEntity(a)&&!t){const I=(e=p.lastExecutionResults)==null?void 0:e.readValue(a.id);if(I)return{value:I,valueOwner:a,type:rt.ExecutionResult,inheritanceLink:null}}const n=y0(a);if(hy.includes(n.type)){const I=Qu(n,p,t),A=a.codeName||((f=a.declaration)==null?void 0:f.codeName)||jn(Ve(a,p.project));if(I!=null&&I.value&&a.parentRelationType!==mp.Error){const O=(I.value.value||{})[A];if(O===void 0)return{value:null,valueOwner:a,type:rt.Undefined,inheritanceLink:null};const P=Pn(a.getDataType(null),a,p.project);return P==null||P.metaSync({value:O,rawString:typeof O=="string"&&typeof((y=I==null?void 0:I.value)==null?void 0:y.rawString)=="string"?(m=I==null?void 0:I.value)==null?void 0:m.rawString:void 0},null),{value:P,valueOwner:a,type:!Yi.includes(n.type)&&I.type===rt.Empty?rt.QueuedAutocalculation:I.type,inheritanceLink:{sources:[I],target:a}}}return{value:null,valueOwner:a,type:Yi.includes(n.type)?rt.Empty:rt.QueuedAutocalculation,inheritanceLink:null}}const s=(T=p.execution)==null?void 0:T.hasEntity(n),u=((g=p.execution)==null?void 0:g.state)===U4.Running;if((b=p.persistedExecutionResults)!=null&&b.values[a.id]&&!s&&!u&&!t){const I=(R=p.persistedExecutionResults)==null?void 0:R.readValue(a.id);if((I==null?void 0:I.value)!==null||(I==null?void 0:I.valueAsType)!==null)return{value:I,valueOwner:a,type:rt.ExecutionResult,inheritanceLink:null}}return null}function FL(a,p,t=!1){var g,b,R,I,A;if(![...Ni,...Yi].includes(a.parent.type)||!vT(a))return null;if(((g=a.declaration)==null?void 0:g.type)===r.Property&&a.declaration.static)return Qu(a.declaration,p);const n=B1(a,p,t);if(n&&n.type!==rt.Empty&&n.type!==rt.Missing&&n.type!==rt.Undefined)return n;const s=ba(a.parent),u=Xp(s,p,t),e=a.codeName||((b=a.declaration)==null?void 0:b.codeName)||jn(Ve(a,p.project)),f=Pn(a.getDataType(null),a,p.project),y=Oy(a),m=(R=u==null?void 0:u.value)==null?void 0:R.value;if(m){let O=(m||{})[e];if(m[e]===void 0)return{value:null,valueOwner:a,type:rt.Undefined,inheritanceLink:{sources:u?[u]:[],target:a}};f==null||f.metaSync({value:O,rawString:typeof O=="string"&&typeof((I=u==null?void 0:u.value)==null?void 0:I.rawString)=="string"?(A=u==null?void 0:u.value)==null?void 0:A.rawString:void 0},null);const P=Oy(a),x=a.getDataType(null);return P&&(!f||!Jo(x)&&cf(f))?{value:null,valueOwner:a,type:rt.Missing,inheritanceLink:null}:{value:f,valueOwner:a,type:u.type,inheritanceLink:{sources:u?[u]:[],target:a}}}return u!=null&&u.type&&u.type!==rt.Missing&&u.type!==rt.Empty&&u.type!==rt.Undefined?{value:null,valueOwner:a,type:u.type,inheritanceLink:{sources:u?[u]:[],target:a}}:y?{value:null,valueOwner:a,type:rt.Missing,inheritanceLink:null}:{value:null,valueOwner:a,type:a.readsValue?rt.Inherited:rt.Empty,inheritanceLink:null}}function kL(a,p,t=!1){var m,T,g,b,R,I,A,O,P,x,$;if(![...Ni,...Yi].includes(a.parent.type)||!vT(a))return null;if(((m=a.declaration)==null?void 0:m.type)===r.Property&&a.declaration.static)return Qu(a.declaration,p,t);const n=a.parent;let s=Qu(n,p,t),u=dA(a,p,t);if(((u==null?void 0:u.type)===rt.Undefined||(u==null?void 0:u.type)===rt.Missing)&&!n.defaultValue&&!n.readsValue){const U=ba(a.parent);s=Qu(U,p,t);let Z=a;U.type===r.VariableDeclaration&&(Z=(a.parent===n?a:U.inputs.find(H=>{var Y,ie;return((Y=H.declaration)==null?void 0:Y.id)===((ie=a.declaration)==null?void 0:ie.id)}))||a,u=dA(Z,p,t))}const e=a.codeName||((T=a.declaration)==null?void 0:T.codeName)||jn(Ve(a,p.project));let f=a.defaultValue||Pn(a.getDataType(null),a,p.project);const y=(g=s==null?void 0:s.value)==null?void 0:g.value;if(((s==null?void 0:s.type)===rt.ExecutionResult||(s==null?void 0:s.type)===rt.Testing)&&!t&&y){let U=(y||{})[e];if(y[e]===void 0&&!a.readsValue&&!a.defaultValue)return{value:null,valueOwner:a,type:rt.Undefined,inheritanceLink:{sources:s?[s]:[],target:a}};f!=null&&f.parent&&!f.standaloneParent&&(f=f.clone(null,null,null,!1),f.setStandaloneParent(a,null));let Z=U;return a.defaultValue&&(Z=a.defaultValue.value),f==null||f.metaSync({value:Z,rawString:typeof U=="string"&&typeof((b=s==null?void 0:s.value)==null?void 0:b.rawString)=="string"?(R=s==null?void 0:s.value)==null?void 0:R.rawString:void 0},null),{value:f,valueOwner:a,type:s.type,inheritanceLink:{sources:s?[s]:[],target:a}}}if(u&&u.type!==rt.Empty&&u.type!==rt.Missing&&u.type!==rt.Undefined)return u;if(y){let U=(y||{})[e];y[e]!==void 0&&(f=Xr(f,a),f==null||f.metaSync({value:U,rawString:typeof U=="string"&&typeof((I=s==null?void 0:s.value)==null?void 0:I.rawString)=="string"?(A=s==null?void 0:s.value)==null?void 0:A.rawString:void 0},null));const Z=Oy(a),q=a.getDataType(null),H=Z&&(!f||!Jo(q)&&cf(f)),Y=!!((O=p.execution)!=null&&O.entities.length),ie=(P=p.execution)==null?void 0:P.hasEntity(n),z=n.readsValue;if(z){const ee=(x=p.execution)==null?void 0:x.hasEntity(z);if(H&&(!Y||Y&&ee&&ie||Y&&!ee&&!ie))return{value:null,valueOwner:a,type:rt.Inherited,inheritanceLink:null}}if(a.readsValue){const ee=($=p.execution)==null?void 0:$.hasEntity(a.readsValue);if(H&&(!Y||Y&&ee&&ie||Y&&!ee&&!ie))return{value:null,valueOwner:a,type:rt.Inherited,inheritanceLink:null}}if(H)return{value:null,valueOwner:a,type:rt.Missing,inheritanceLink:null};if(y[e]===void 0&&!a.readsValue&&!a.defaultValue)return{value:null,valueOwner:a,type:rt.Undefined,inheritanceLink:{sources:s?[s]:[],target:a}};let W=rt.Inherited;return _s(f)&&!a.readsValue&&(W=rt.Empty),_s(f)||(s!=null&&s.type?W=s==null?void 0:s.type:a.defaultValue&&(W=rt.DefaultValue)),{value:f,valueOwner:a,type:W,inheritanceLink:null}}return{value:null,valueOwner:a,type:rt.Undefined,inheritanceLink:null}}function B1(a,p,t=!1){var A,O,P,x,$;const n=mi(a),s=!!((A=p.execution)!=null&&A.entities.length),u=(O=p.execution)==null?void 0:O.hasEntity(n),e=a.readsValue;let f=null,y=!1;if(e){const U=(P=p.execution)==null?void 0:P.hasEntity(e);y=!s||s&&U&&u||s&&!U&&!u,y&&(f=AE(a,p,t))}const m=!!e&&y,T=a.defaultValue,g=p.getValueTypePreference(a.id);if(!f&&T&&(t||g===null||g!==rt.Testing)&&(f={value:T,valueOwner:a,type:cf(T)?rt.Empty:rt.DefaultValue,inheritanceLink:null}),(!f||f.type===rt.DefaultValue||(f==null?void 0:f.type)===rt.Empty||g===rt.Testing)&&!m){const U=(x=p.persistedExecutionResults)==null?void 0:x.readValue(a.id);if(U&&!t)return{value:U,valueOwner:a,type:rt.Testing,inheritanceLink:null};const Z=($=p.localTestValues)==null?void 0:$.readValue(a.id);if(Z&&!t&&(g===null||g===rt.Testing))return{value:Z,valueOwner:a,type:rt.Testing,inheritanceLink:null}}if(T&&!cf(T))return{value:T,valueOwner:a,type:rt.DefaultValue,inheritanceLink:null};const b=Oy(a),R=a.getDataType(null),I=b&&(!(f!=null&&f.value)||!Jo(R)&&cf(f==null?void 0:f.value));return m&&I?{value:null,valueOwner:a,type:rt.Inherited,inheritanceLink:null}:I?{value:null,valueOwner:a,type:rt.Missing,inheritanceLink:(f==null?void 0:f.inheritanceLink)||null}:!f&&!a.defaultValue&&!m?{value:null,valueOwner:a,type:rt.Undefined,inheritanceLink:null}:!b&&(!f||f.type===rt.Inherited)&&!(f!=null&&f.inheritanceLink)?{value:null,valueOwner:a,type:m?rt.Inherited:rt.Empty,inheritanceLink:null}:f}function dA(a,p,t=!1){var s;if(p.execution&&p.execution.hasEntity(a)&&!t){const u=(s=p.lastExecutionResults)==null?void 0:s.readValue(a.id);if(u)return{value:u,valueOwner:a,type:rt.ExecutionResult,inheritanceLink:null}}return B1(a,p,t)}function tTt(a,p,t=!1){var n,s;return Yi.includes(a.parent.type)&&(n=ba(a.parent).dataType)!=null&&n.isObject()||Ni.includes(a.parent.type)&&(s=a.parent.getDataType(null))!=null&&s.isObject()?FL(a,p,t):B1(a,p,t)}function I4(a,p,t=!1){var n,s;return Yi.includes(a.parent.type)&&((n=a.parent.getDataType(null))!=null&&n.isObject()||a.parent.inputs.length)||Ni.includes(a.parent.type)&&((s=a.parent.getDataType(null))!=null&&s.isObject()||a.parent.outputs.length)?kL(a,p,t):dA(a,p,t)}function iTt(a,p,t=!1){var T,g;if(p.execution){const b=(T=p.lastExecutionResults)==null?void 0:T.readValue(a.id);if(b&&!t)return{value:b,valueOwner:a,type:rt.ExecutionResult,inheritanceLink:null}}const n=!p.execution||!p.execution.parentExecution,s=p.getValueTypePreference(a.id);if(n){const b=(g=p.localTestValues)==null?void 0:g.readValue(a.id);if(b&&!t&&(s===null||s!==rt.DefaultValue))return{value:b,valueOwner:a,type:rt.Testing,inheritanceLink:null}}const u=a.defaultValue;let e=null;u&&(t||s===null||s!==rt.Testing)&&(e={value:u,valueOwner:a,type:rt.DefaultValue,inheritanceLink:null});const f=Oy(a),y=a.getDataType(null);return f&&(!(e!=null&&e.value)||!Jo(y)&&cf(e==null?void 0:e.value))&&a.static?{value:null,valueOwner:a,type:rt.Missing,inheritanceLink:null}:_s(e==null?void 0:e.value)?{value:null,valueOwner:a,type:rt.Empty,inheritanceLink:null}:e}function nTt(a,p,t=!1){var f,y,m;if(p.execution&&p.execution.hasEntity(a)&&!t){const T=(f=p.lastExecutionResults)==null?void 0:f.readValue(a.id);if(T)return{value:T,valueOwner:a,type:rt.ExecutionResult,inheritanceLink:null}}const n=!p.execution||!p.execution.parentExecution,s=p.getValueTypePreference(a.id);if(n){const T=(y=p.localTestValues)==null?void 0:y.readValue(a.id);if(T&&!t&&(s===null||s!==rt.DefaultValue))return{value:T,valueOwner:a,type:rt.Testing,inheritanceLink:null}}const u=a.defaultValue;let e=null;if(u&&(t||s===null||s!==rt.Testing)&&(e={value:u,valueOwner:a,type:rt.DefaultValue,inheritanceLink:null}),((m=a.parent)==null?void 0:m.type)===r.Search){const T=a.parent.inputs.find(g=>{var b;return((b=g.declaration)==null?void 0:b.id)===a.id});if(T)return I4(T,p,t)}return _s((e==null?void 0:e.value)||null)?{value:null,valueOwner:a,type:rt.Empty,inheritanceLink:null}:e}function Qu(a,p,t=!1){if(Ig.has(a.id))return{value:null,valueOwner:a,type:rt.Undefined,inheritanceLink:null};Ig.add(a.id);try{switch(a.type){case r.ArgumentDeclaration:return Xmt(a,p,t);case r.InputMap:return I4(a,p,t);case r.VariableDeclaration:return Jmt(a,p,t);case r.VariableInstance:return Qmt(a,p,t);case r.OutputMap:return eTt(a,p,t);case r.ReturnStatement:case r.BreakStatement:case r.ContinueStatement:return E4(a,p,t);case r.Property:return iTt(a,p,t);case r.ValueDescriptor:return nTt(a,p,t);case r.Operation:case r.Loop:case r.FunctionCall:case r.InternalCall:case r.Search:return zmt(a,p,t);default:return null}}finally{Ig.delete(a.id)}}function Xp(a,p,t=!1){if(Ig.has(a.id))return{value:null,valueOwner:a,type:rt.Undefined,inheritanceLink:null};Ig.add(a.id);try{switch(a.type){case r.InputMap:return tTt(a,p,t);case r.VariableDeclaration:return uV(a,p,t);case r.VariableInstance:return b4(a,p,t);case r.ReturnStatement:case r.BreakStatement:case r.ContinueStatement:return E4(a,p,t);default:return null}}finally{Ig.delete(a.id)}}function pbn(a){var p,t,n,s,u;if(a&&a.type===rt.DefaultValue&&a.value&&a.valueOwner&&(!xO.includes(a.valueOwner.type)||((p=a.valueOwner.defaultValue)==null?void 0:p.id)===a.value.id)){const e=Pn(a.valueOwner.getDataType(null),a.valueOwner,a.valueOwner.project);return e==null||e.metaSync({value:(t=a.value)==null?void 0:t.value,rawString:typeof((n=a.value)==null?void 0:n.value)=="string"&&typeof((s=a.value)==null?void 0:s.rawString)=="string"?(u=a.value)==null?void 0:u.rawString:void 0},null),{type:rt.DefaultValue,value:e,valueOwner:a.valueOwner,inheritanceLink:null}}return a}function ubn(a,p,t,n){var I,A,O;let s=!1,u=null,e=null;n instanceof de?(s=!0,u=n,e=null):(u=null,e=n);const f=ba(a.parent),y=f.getDataType(null);if(!(y!=null&&y.isObject()))return u;let m=s?f.defaultValue:e==null?void 0:e.readValue(f.id);m?!s&&m&&m.id===((I=f.defaultValue)==null?void 0:I.id)&&(m=Pn(f.getDataType(null),f,p)):s?m=RE(f.getDataType(null),f,p,u):m=Pn(f.getDataType(null),f,p);const T=Ve(a,p),g=a.codeName||((A=a.declaration)==null?void 0:A.codeName)||jn(T);let b={};const R=(O=f.dataType)==null?void 0:O.entity;if((R==null?void 0:R.type)===r.DefinitionEntity)b={...b,...R.getActiveRawDefaultValue()};else if((R==null?void 0:R.type)===r.BuiltInBaseEntity)b={...b,...R.getRawDefaultValue()};else if((R==null?void 0:R.type)===r.PrimitiveEntity&&Sd(R,me.KeyValue)){const P={};R.properties.forEach(x=>{var Z;if(!vp(x)||!x.defaultValue)return;const $=De(x,p),U=x.codeName||ho(x,p)||Zs(jn($));P[U]=((Z=x.getDefaultValue())==null?void 0:Z.value)||null}),b={...b,...P}}if(ks(m==null?void 0:m.value)&&(b={...b,...m.value}),b[g]=t,m==null||m.metaSync({value:b},u),s||e==null||e.writeValue(f,m),(t===""||t===null||t===void 0)&&a.type===r.OutputMap){const P=f.inputs.find(x=>{var $,U;return(($=x.declaration)==null?void 0:$.id)===((U=a.declaration)==null?void 0:U.id)||Ve(x,p)===T});if(P){let x=s?P.defaultValue:e==null?void 0:e.readValue(P.id);x&&x.metaSync({value:null},u),s||e==null||e.removeValue(P.id)}}return u}function cbn(a,p,t){const n=t instanceof de,s=uf(a,p,{forVarInst:n});let u=!1,e=null,f=null;return t instanceof de?(u=!0,e=t,f=null):(e=null,f=t),s.forEach(y=>{let m=u?y.defaultValue||null:f==null?void 0:f.readValue(y.id);u?m==null||m.remove({ignoreUpstream:!1},e):f==null||f.removeValue(y.id)}),e}function fbn(a,p,t,n,s){const u=s==null?void 0:s.asCastedType,e=s==null?void 0:s.rawString,f=(s==null?void 0:s.forVarInst)??!1,y=uf(p,t,{forVarInst:f});let m=!1,T=null,g=null;return n instanceof de?(m=!0,T=n,g=null):(T=null,g=n),t.diggestedBuiltInBaseEntitiesIds.has(p.id)||y.forEach(b=>{var A,O,P,x;if(t.diggestedBuiltInBaseEntitiesIds.has(b.id))return;let R=null;if(m){const $=((A=b.getDefaultValue)==null?void 0:A.call(b))||null;$&&(t.diggestedBuiltInBaseEntitiesIds.has($.id)||((O=$.parent)==null?void 0:O.id)!==b.id?R=$.clone(T,b):R=$)}else R=g==null?void 0:g.readValue(b.id);R?!m&&R&&R.id===((x=(P=b.getDefaultValue)==null?void 0:P.call(b))==null?void 0:x.id)&&(R=Pn(b.getDataType(null),b,t)):m?(R=RE(b.getDataType(null),b,t,T),T==null||T.add(R,ye.Added)):R=Pn(b.getDataType(null),b,t),R==null||R.setValueAsType(null,T);let I=u||(R==null?void 0:R.name);(!(R!=null&&R.name)||(R==null?void 0:R.name)===me.Untyped)&&!u&&(typeof a=="string"?I=me.String:a===null?I=me.Null:typeof a=="number"?I=me.Number:typeof a=="boolean"&&(I=me.Boolean)),R==null||R.metaSync({value:a,name:I,rawString:e!==void 0?e:null},T),m||g==null||g.writeValue(b,R)}),T}function aT(a,p,t,n){let s=!1,u=null,e=null;n instanceof de?(s=!0,u=n,e=null):(u=null,e=n);const f=a.parent;return p.getVariableDeclarations().forEach(m=>{var g,b,R,I,A;const T=m.getDataType(null);if(((g=T==null?void 0:T.entity)==null?void 0:g.id)===f.id){let O=s?m.defaultValue:e==null?void 0:e.readValue(m.id);O?!s&&O&&O.id===((b=m.defaultValue)==null?void 0:b.id)&&(O=Pn(m.getDataType(null),m,p)):s?O=RE(m.getDataType(null),m,p,u):O=Pn(m.getDataType(null),m,p);const P=Ve(a,p),x=a.codeName||((R=a.extends)==null?void 0:R.codeName)||((I=a.implements[0])==null?void 0:I.codeName)||jn(P);let $={};const U=(A=m.dataType)==null?void 0:A.entity;if((U==null?void 0:U.type)===r.DefinitionEntity)$={...$,...U.getActiveRawDefaultValue()};else if((U==null?void 0:U.type)===r.BuiltInBaseEntity)$={...$,...U.getRawDefaultValue()};else if((U==null?void 0:U.type)===r.PrimitiveEntity&&Sd(U,me.KeyValue)){const Z={};U.properties.forEach(q=>{var ie;if(!vp(q)||!q.defaultValue)return;const H=De(q,p),Y=q.codeName||ho(q,p)||Zs(jn(H));Z[Y]=((ie=q.getDefaultValue())==null?void 0:ie.value)||null}),$={...$,...Z}}ks(O==null?void 0:O.value)&&($={...$,...O.value}),Array.isArray(t)?$[x]=(t==null?void 0:t.map(Z=>Z.toShallowJSON()))||null:$[x]=(t==null?void 0:t.toShallowJSON())||null,O==null||O.metaSync({value:$},u),s||e==null||e.writeValue(m,O);return}}),u}function pA(a,p,t,n){var R,I,A,O;let s=!1,u=null,e=null;n instanceof de?(s=!0,u=n,e=null):(u=null,e=n);const f=ba(a.parent),y=f.getDataType(null);if(!(y!=null&&y.isObject()))return u;let m=s?f.defaultValue:e==null?void 0:e.readValue(f.id);m?!s&&m&&m.id===((R=f.defaultValue)==null?void 0:R.id)&&(m=Pn(f.getDataType(null),f,p)):s?m=RE(f.getDataType(null),f,p,u):m=Pn(f.getDataType(null),f,p);const T=Ve(a,p),g=a.codeName||((I=a.declaration)==null?void 0:I.codeName)||jn(T);let b={};if(((O=(A=f.dataType)==null?void 0:A.entity)==null?void 0:O.type)===r.DefinitionEntity&&(b={...b,...f.dataType.entity.getActiveRawDefaultValue()}),ks(m==null?void 0:m.value)&&(b={...b,...m.value}),Array.isArray(t)?b[g]=(t==null?void 0:t.map(P=>P.toShallowJSON()))||null:b[g]=(t==null?void 0:t.toShallowJSON())||null,m==null||m.metaSync({value:b},u),s||e==null||e.writeValue(f,m),t==null&&a.type===r.OutputMap){const P=f.inputs.find(x=>{var $,U;return(($=x.declaration)==null?void 0:$.id)===((U=a.declaration)==null?void 0:U.id)||Ve(x,p)===T});if(P){let x=s?P.defaultValue:e==null?void 0:e.readValue(P.id);x&&(Array.isArray(t)?x==null||x.setValueAsTypeList(t,u):x==null||x.setValueAsTypeSingle(t,u)),s||e==null||e.removeValue(P.id)}}return u}function rTt(a,p,t){var n,s,u,e;return a.type===r.InputMap?((n=a.declaration)==null?void 0:n.type)===r.Property&&a.declaration.static?aT(a.declaration,p,null,t):Yi.includes(a.parent.type)&&((s=a.declaration)==null?void 0:s.type)===r.Property&&pA(a,p,null,t):a.type===r.OutputMap?((u=a.declaration)==null?void 0:u.type)===r.Property&&a.declaration.static?aT(a.declaration,p,null,t):Yi.includes(a.parent.type)&&((e=a.declaration)==null?void 0:e.type)===r.Property&&pA(a,p,null,t):a.type===r.Property&&a.static&&aT(a,p,null,t),t}function aTt(a,p,t,n){var s,u,e,f;return p.type===r.InputMap?((s=p.declaration)==null?void 0:s.type)===r.Property&&p.declaration.static?aT(p.declaration,t,a,n):Yi.includes(p.parent.type)&&((u=p.declaration)==null?void 0:u.type)===r.Property&&pA(p,t,a,n):p.type===r.OutputMap?((e=p.declaration)==null?void 0:e.type)===r.Property&&p.declaration.static?aT(p.declaration,t,null,n):Yi.includes(p.parent.type)&&((f=p.declaration)==null?void 0:f.type)===r.Property&&pA(p,t,null,n):p.type===r.Property&&p.static&&aT(p,t,a,n),n}function ybn(a,p,t){const n=t instanceof de,s=uf(a,p,{forVarInst:n});let u=!1,e=null,f=null;return t instanceof de?(u=!0,e=t,f=null):(e=null,f=t),s.forEach(y=>{let m=u?y.defaultValue:f==null?void 0:f.readValue(y.id);u?m==null||m.remove({ignoreUpstream:!1},e):f==null||f.removeValue(y.id),rTt(y,p,t)}),e}function hbn(a,p,t,n){const s=n instanceof de,u=uf(p,t,{forVarInst:s});let e=!1,f=null,y=null;return n instanceof de?(e=!0,f=n,y=null):(f=null,y=n),u.forEach(m=>{var g,b;let T=e?m.defaultValue:y==null?void 0:y.readValue(m.id);T?!e&&T&&T.id===((b=(g=m.getDefaultValue)==null?void 0:g.call(m))==null?void 0:b.id)&&(T=Pn(m.getDataType(null),m,m.project)):e?T=RE(m.getDataType(null),m,t,f):T=Pn(m.getDataType(null),m,t),Array.isArray(a)?T==null||T.setValueAsTypeList(a,f):T==null||T.setValueAsTypeSingle(a,f),T==null||T.metaSync({value:null},f),e||y==null||y.writeValue(m,T),aTt(a,m,t,n)}),f}function Xr(a,p){let t=a;return a&&a.parent&&a.project.get(a.id)&&(t=t.clone(null,null,null,!1),t.setStandaloneParent(p,null)),t}class cV{constructor(p,t){this.extensionsRegistry=p,this.contextType=t,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,t){this.extensionsRegistry.on(p,t)}emit(p,...t){this.extensionsRegistry.emit(p,...t)}off(p,t){this.extensionsRegistry.off(p,t)}emitAsync(p,...t){return this.extensionsRegistry.emitAsync(p,...t)}emitAsyncAll(p,...t){return this.extensionsRegistry.emitAsyncAll(p,...t)}emitAsyncAllSettled(p,...t){return this.extensionsRegistry.emitAsyncAllSettled(p,...t)}emitAsyncSequentially(p,...t){return this.extensionsRegistry.emitAsyncSequentially(p,...t)}emitAsyncSequentiallyAll(p,...t){return this.extensionsRegistry.emitAsyncSequentiallyAll(p,...t)}emitAsyncSequentiallyAllSettled(p,...t){return this.extensionsRegistry.emitAsyncSequentiallyAllSettled(p,...t)}}var _e=(a=>(a[a.High=1]="High",a[a.Normal=5]="Normal",a[a.Low=10]="Low",a))(_e||{}),Q=(a=>(a.Logic="logic",a.EditorGUI="editor-gui",a.GUI="gui",a.Editor="editor",a.Compile="compile",a.PublicationRun="publication-run",a))(Q||{}),$e=(a=>(a.All="*",a.OnAll="on:*",a.EmitAll="emit:*",a.ReadAll="read:*",a.WriteAll="write:*",a.UpdateAll="update:*",a.DoAll="do:*",a.OnLogicAll="on:logic:*",a.EmitLogicAll="emit:logic:*",a.ReadLogicAll="read:logic:*",a.WriteLogicAll="write:logic:*",a.UpdateLogicAll="update:logic:*",a.DoLogicAll="do:logic:*",a.OnGUIAll="on:gui:*",a.EmitGUIAll="emit:gui:*",a.ReadGUIAll="read:gui:*",a.WriteGUIAll="write:gui:*",a.UpdateGUIAll="update:gui:*",a.DoGUIAll="do:gui:*",a.OnEditorAll="on:editor:*",a.EmitEditorAll="emit:editor:*",a.ReadEditorAll="read:editor:*",a.WriteEditorAll="write:editor:*",a.UpdateEditorAll="update:editor:*",a.DoEditorAll="do:editor:*",a.OnCompileBefore="on:compile:before:DefinitionEntity",a.OnCompileDefault="on:compile:default:DefinitionEntity",a.OnCompileAfter="on:compile:after:DefinitionEntity",a.EmitCompile="emit:compile:DefinitionEntity",a.DoEditorPublish="do:editor:publish",a.PostGUICanvasSlotNewToolbarButton="write:gui:canvas:slot:toolbar-button",a.ReadGUICanvasSlotToolbarButtons="read:gui:canvas:slot:toolbar-buttons",a.UpdateGUIGlobalTheme="update:gui:global:theme",a))($e||{});class sTt{constructor(p){C(this,"state",new Map);p&&(this.state=new Map(Object.entries(p)))}get(p){return this.state.get(p)}set(p,t){this.state.set(p,t)}delete(p){this.state.delete(p)}}class lTt extends sTt{constructor(p,t){super(t),this.parentExtension=p}}class Ge{constructor(p,t){C(this,"manifest");C(this,"command");C(this,"module");C(this,"state");this.extensionsRegistry=p,this.state=new lTt(this,t)}}class UL extends cV{constructor(t,n){super(t,Q.Logic);C(this,"id");this._project=n,this.id=n.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(t){return this._project.persistChangeSetSequentially(t)}toLatestChangeSet(t,n,s,u=!1,e="here-this"){return this._project.toLatestChangeSet(t,n,s,u,e)}addChangeSet(t){return this._project.addChangeSet(t)}discardChangeSet(t){return this._project.discardChangeSet(t)}subscribeDependents(t){return this._project.subscribeDependents(t)}unsubscribeDependents(t){return this._project.unsubscribeDependents(t)}syncDependents(t){return this._project.syncDependents(t)}onDetachedDependencyRemoved(t,n,s){return this._project.onDetachedDependencyRemoved(t,n,s)}onDetachedDependencyRestored(t,n,s){return this._project.onDetachedDependencyRestored(t,n,s)}increaseVersion(t){return this._project.increaseVersion(t)}captureVersion(){return this._project.captureVersion()}restoreVersion(t){return this._project.restoreVersion(t)}updateWithShallowTransfer(t,n){return this._project.updateWithShallowTransfer(t,n)}hydrateAncestors(){return this._project.hydrateAncestors()}afterAllChildrenInitialized(t=null){return this._project.afterAllChildrenInitialized(t)}addSelfToProject(t){return this._project.addSelfToProject(t)}get instancesList(){return[...this._project.instancesList]}isOperationDeclaration(t){return this._project.isOperationDeclaration(t)}isGlobalEventActionDescriptor(t){return this._project.isGlobalEventActionDescriptor(t)}isLoopDeclaration(t){return this._project.isLoopDeclaration(t)}isConditionDeclaration(t){return this._project.isConditionDeclaration(t)}findSubscribedBuiltInInstance(t){return this._project.findSubscribedBuiltInInstance(t)}get(t){return this._project.get(t)}getDeleted(t){return this._project.getDeleted(t)}getManaged(t){return this._project.getManaged(t)}getBuiltIn(t){return this._project.getBuiltIn(t)}findSubscribedInstanceFromReference(t){return this._project.findSubscribedInstanceFromReference(t)}findSubscribedBuiltInInstanceFromReference(t){return this._project.findSubscribedBuiltInInstanceFromReference(t)}metaSync(t,n){return this._project.metaSync(t,n)}getAllBuiltInIds(){return this._project.getAllBuiltInIds()}getAllBuiltIn(){return this._project.getAllBuiltIn()}toFlat(t){return this._project.toFlat(t)}toFlatIds(t){return this._project.toFlatIds(t)}toMeta(){return this._project.toMeta()}toJSON(t){return this._project.toJSON(t)}toJSONClone(t){return this._project.toJSONClone(t)}toReference(t){return this._project.toReference(t)}toShallowJSON(t){return this._project.toShallowJSON(t)}toFlatJSON(t){return this._project.toFlatJSON(t)}toGenerationTarget(t){return this._project.toGenerationTarget(t)}toFlatGenerationTarget(t){return this._project.toFlatGenerationTarget(t)}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(t){return this._project.addDefinitionEntity(t)}addFunctionDeclaration(t){return this._project.addFunctionDeclaration(t)}addFunctionCall(t){return this._project.addFunctionCall(t)}addVariableDeclaration(t){return this._project.addVariableDeclaration(t)}addVariableInstance(t){return this._project.addVariableInstance(t)}addInstalledProject(t){return this._project.addInstalledProject(t)}addGlobalEvent(t){return this._project.addGlobalEvent(t)}addCondition(t){return this._project.addCondition(t)}addOperation(t){return this._project.addOperation(t)}addLoop(t){return this._project.addLoop(t)}addSearch(t){return this._project.addSearch(t)}removeDefinitionEntity(t){return this._project.removeDefinitionEntity(t)}removeCondition(t){return this._project.removeCondition(t)}removeOperation(t){return this._project.removeOperation(t)}removeLoop(t){return this._project.removeLoop(t)}removeSearch(t){return this._project.removeSearch(t)}removeFunctionCall(t){return this._project.removeFunctionCall(t)}removeVariableInstance(t){return this._project.removeVariableInstance(t)}removeVariableDeclaration(t){return this._project.removeVariableDeclaration(t)}removeFunctionDeclaration(t){return this._project.removeFunctionDeclaration(t)}removeInstalledProject(t){return this._project.removeInstalledProject(t)}removeGlobalEvent(t){return this._project.removeGlobalEvent(t)}removeTopLevelVariableDeclaration(t){return this._project.removeTopLevelVariableDeclaration(t)}getEntryPoints(){return this._project.getEntryPoints()}getTerminationStatements(){return this._project.getTerminationStatements()}getFunctionDeclaration(t){return this._project.getFunctionDeclaration(t)}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(t,n=!1){return this._project.requestActiveDynamicValue(t,n)}undo(){return this._project.undo()}redo(){return this._project.redo()}applyExternalChangeSet(t){return this._project.applyExternalChangeSet(t)}toFullProjectTransfer(){return this._project.toFullProjectTransfer()}}function mbn(a,p){return p instanceof UL?p:new UL(a,p)}const vi="built-in-function-implementations__",ze="operations-implementations__",Nd="conditions-implementations__",Ga="example-values-generator__",je={UUID:"uuid",SEARCH_NODE_IMPLEMENTATION:"search-node-implementation",BUILT_IN_FUNCTION_IMPLEMENTATIONS__ABORT_EXECUTION:vi+ja.AbortExecution,BUILT_IN_FUNCTION_IMPLEMENTATIONS__CREATE_PERSISTED_ENTITY:vi+ja.CreatePersistedEntity,BUILT_IN_FUNCTION_IMPLEMENTATIONS__UPDATE_PERSISTED_ENTITY:vi+ja.UpdatePersistedEntity,BUILT_IN_FUNCTION_IMPLEMENTATIONS__DELETE_PERSISTED_ENTITY:vi+ja.DeletePersistedEntity,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__VALUES_MERGE_EMPTY:ze+ss.MergeEmpty,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__VALUES_MERGE_FALSY:ze+ss.MergeFalsy,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_EMPTY:ze+Hi.Empty,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_NOT_EMPTY:ze+Hi.NotEmpty,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_PRIMITIVE_EQUAL:ze+Hi.PrimitiveEqual,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_PRIMITIVE_NOT_EQUAL:ze+Hi.PrimitiveNotEqual,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__HTTP_REQUEST:ze+Us.HttpRequest,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_SQL:ze+Ju.ExecuteSQL,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__VALIDATE_ENTITY:ze+Ke.Validate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_WAIT:ze+ld.Wait,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_JOIN:ze+Re.Join,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SPLIT:ze+Re.Split,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_LAST_N_ITEMS:ze+Re.DeleteLastNItems,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_FIRST_N_ITEMS:ze+Re.DeleteFirstNItems,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_AT_INDEX:ze+Re.DeleteAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_ADD_AT_INDEX:ze+Re.AddAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_FIRST_N_ITEMS:ze+Re.ReplaceFirstNItems,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_LAST_N_ITEMS:ze+Re.ReplaceLastNItems,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_ALL:ze+Re.ReplaceAll,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_AT_INDEX:ze+Re.ReplaceAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_INDEX_ITEM:ze+Re.GetIndexItem,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_FIRST:ze+Re.GetFirst,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST:ze+Re.GetLast,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_APPEND:ze+Re.Append,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PREPEND:ze+Re.Prepend,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REVERSE:ze+Re.Reverse,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LENGTH:ze+Re.GetLength,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_FIRST_N_ITEMS:ze+Re.GetFirstNItems,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST_N_ITEMS:ze+Re.GetLastNItems,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SLICE:ze+Re.Slice,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONCAT:ze+Re.Concat,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_INDEX_OF:ze+Re.GetIndexOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST_INDEX_OF:ze+Re.GetLastIndexOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_UNIQUE:ze+Re.Unique,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_FLATTEN:ze+Re.Flatten,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SORT:ze+Re.Sort,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SHUFFLE:ze+Re.Shuffle,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CHUNK:ze+Re.Chunk,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PAD_START:ze+Re.PadStart,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PAD_END:ze+Re.PadEnd,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPEAT:ze+Re.Repeat,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LENGTH:ze+he.GetLength,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TO_LOWER_CASE:ze+he.ToLowerCase,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TO_UPPER_CASE:ze+he.ToUpperCase,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_JOIN:ze+he.Join,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONTAINS:ze+Re.Contains,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONTAINS_ALL:ze+Re.ContainsAll,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONTAINS_ANY:ze+Re.ContainsAny,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT_AT_INDEX:ze+he.SplitAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT_AT_ALL_SEPARATORS:ze+he.SplitAtAllSeparators,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT_AT_FIRST_SEPARATOR:ze+he.SplitAtFirstSeparator,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT_AT_LAST_SEPARATOR:ze+he.SplitAtLastSeparator,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_LAST_N_CHARS:ze+he.DeleteLastNChars,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_FIRST_N_CHARS:ze+he.DeleteFirstNChars,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_AT_INDEX:ze+he.DeleteAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ADD_AT_INDEX:ze+he.AddAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_FIRST_N_CHARS:ze+he.ReplaceFirstNChars,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_LAST_N_CHARS:ze+he.ReplaceLastNChars,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_AT_INDEX:ze+he.ReplaceAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_FIRST_MATCH:ze+he.ReplaceFirstMatch,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_LAST_MATCH:ze+he.ReplaceLastMatch,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_ALL_MATCHES:ze+he.ReplaceAllMatches,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_INDEX_ITEM:ze+he.GetIndexItem,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_FIRST_N_CHARS:ze+he.GetFirstNChars,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LAST_N_CHARS:ze+he.GetLastNChars,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_INDEX_OF:ze+he.GetIndexOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_APPEND:ze+he.Append,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PREPEND:ze+he.Prepend,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REVERSE:ze+he.Reverse,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TRIM:ze+he.Trim,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TRIM_START:ze+he.TrimStart,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TRIM_END:ze+he.TrimEnd,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SUBSTRING:ze+he.Substring,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SLICE:ze+he.Slice,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PAD_START:ze+he.PadStart,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PAD_END:ze+he.PadEnd,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPEAT:ze+he.Repeat,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LAST_INDEX_OF:ze+he.GetLastIndexOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_MATCH_REGEX:ze+he.MatchRegex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_MATCH_ALL_REGEX:ze+he.MatchAllRegex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SEARCH_REGEX:ze+he.SearchRegex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_REGEX:ze+he.ReplaceRegex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_NORMALIZE_UNICODE:ze+he.NormalizeUnicode,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REMOVE_DIACRITICS:ze+he.RemoveDiacritics,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_COUNT_OCCURRENCES:ze+he.CountOccurrences,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ENSURE_PREFIX:ze+he.EnsurePrefix,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ENSURE_SUFFIX:ze+he.EnsureSuffix,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REMOVE_PREFIX:ze+he.RemovePrefix,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REMOVE_SUFFIX:ze+he.RemoveSuffix,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ADDITION:ze+Ae.Addition,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SUBTRACTION:ze+Ae.Subtraction,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MULTIPLICATION:ze+Ae.Multiplication,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_DIVISION:ze+Ae.Division,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_REMAINDER:ze+Ae.Remainder,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_EXPONENTIATION:ze+Ae.Exponentiation,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ABSOLUTE:ze+Ae.Absolute,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SIGN:ze+Ae.Sign,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ROUND:ze+Ae.Round,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_NEGATE:ze+Ae.Negate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_FLOOR:ze+Ae.Floor,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_CEIL:ze+Ae.Ceil,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_CLAMP:ze+Ae.Clamp,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TRUNC:ze+Ae.Trunc,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ROUND_TO_DECIMALS:ze+Ae.RoundToDecimals,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SNAP_TO_STEP:ze+Ae.SnapToStep,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MAP_RANGE:ze+Ae.MapRange,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_AVERAGE:ze+Ae.Average,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MEDIAN:ze+Ae.Median,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MIN_OF:ze+Ae.MinOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MAX_OF:ze+Ae.MaxOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SQUARE_ROOT:ze+Ae.SquareRoot,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_CUBE_ROOT:ze+Ae.CubeRoot,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_NTH_ROOT:ze+Ae.NthRoot,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_EXP:ze+Ae.Exp,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LOG_NATURAL:ze+Ae.LogNatural,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LOG10:ze+Ae.Log10,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SIN:ze+Ae.Sin,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_COS:ze+Ae.Cos,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TAN:ze+Ae.Tan,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ASIN:ze+Ae.Asin,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ACOS:ze+Ae.Acos,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ATAN:ze+Ae.Atan,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ATAN2:ze+Ae.Atan2,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TO_RADIANS:ze+Ae.ToRadians,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TO_DEGREES:ze+Ae.ToDegrees,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_PERCENT_OF:ze+Ae.PercentOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_PERCENTAGE_CHANGE:ze+Ae.PercentageChange,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MORE_THAN:ze+Ae.MoreThan,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LESS_THAN:ze+Ae.LessThan,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LESS_THAN_OR_EQUAL:ze+Ae.LessThanOrEqual,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MORE_THAN_OR_EQUAL:ze+Ae.MoreThanOrEqual,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_INTEGER:ze+Ot.GenerateRandomInteger,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_FLOAT:ze+Ot.GenerateRandomFloat,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_HEXADECIMAL:ze+Ot.GenerateRandomHexadecimal,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE62:ze+Ot.GenerateRandomBase62,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE64:ze+Ot.GenerateRandomBase64,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_ALPHANUMERIC:ze+Ot.GenerateRandomAlphanumeric,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_IDENTIFIER:ze+Ot.GenerateIdentifier,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_UUIDV4:ze+Ot.GenerateRandomUUIDv4,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_SHORT_IDENTIFIER:ze+Ot.GenerateShortIdentifier,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_HEXADECIMAL_TOKEN:ze+Ot.GenerateHexadecimalToken,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_STARTS_WITH:ze+he.StartsWith,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ENDS_WITH:ze+he.EndsWith,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_CONTAINS:ze+he.Contains,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_MATCHES_REGEX:ze+he.MatchesRegex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_CURRENT_TIMESTAMP:ze+ne.GetCurrentTimestamp,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_FORMAT_DATE:ze+ne.FormatDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_PARSE_DATE:ze+ne.ParseDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_ADD_TO_DATE:ze+ne.AddToDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SUBTRACT_FROM_DATE:ze+ne.SubtractFromDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_DIFFERENCE_BETWEEN_DATES:ze+ne.DifferenceBetweenDates,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_DATE:ze+ne.ToDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_UNIX:ze+ne.ToUnix,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_FROM_UNIX:ze+ne.FromUnix,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_ISO_STRING:ze+ne.ToISOString,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_YEAR:ze+ne.GetYear,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_MONTH:ze+ne.GetMonth,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_DATE:ze+ne.GetDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_HOUR:ze+ne.GetHour,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_MINUTE:ze+ne.GetMinute,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_SECOND:ze+ne.GetSecond,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_MILLISECOND:ze+ne.GetMillisecond,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_ISO_WEEKDAY:ze+ne.GetIsoWeekday,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_WEEK_OF_YEAR:ze+ne.GetWeekOfYear,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_QUARTER:ze+ne.GetQuarter,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_DAY_OF_YEAR:ze+ne.GetDayOfYear,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_DAYS_IN_MONTH:ze+ne.GetDaysInMonth,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_CURRENT_IANA_TIMEZONE:ze+ne.GetCurrentIanaTimeZone,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_YEAR:ze+ne.SetYear,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_MONTH:ze+ne.SetMonth,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_DATE:ze+ne.SetDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_HOUR:ze+ne.SetHour,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_MINUTE:ze+ne.SetMinute,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_SECOND:ze+ne.SetSecond,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_MILLISECOND:ze+ne.SetMillisecond,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_ISO_WEEKDAY:ze+ne.SetIsoWeekday,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_QUARTER:ze+ne.SetQuarter,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_START_OF:ze+ne.StartOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_END_OF:ze+ne.EndOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_ROUND_TO:ze+ne.RoundTo,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_BEFORE:Nd+ne.IsBefore,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_AFTER:Nd+ne.IsAfter,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_SAME:Nd+ne.IsSame,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_SAME_OR_BEFORE:Nd+ne.IsSameOrBefore,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_SAME_OR_AFTER:Nd+ne.IsSameOrAfter,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_BETWEEN:Nd+ne.IsBetween,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_VALID:Nd+ne.IsValid,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_LEAP_YEAR:Nd+ne.IsLeapYear,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_CLAMP_TO_RANGE:ze+ne.ClampToRange,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_MIN_OF:ze+ne.MinOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_MAX_OF:ze+ne.MaxOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_FROM_NOW:ze+ne.FromNow,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_NOW:ze+ne.ToNow,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_HUMANIZE_DIFF:ze+ne.HumanizeDiff,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_ADD_BUSINESS_DAYS:ze+ne.AddBusinessDays,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_NEXT_WEEKDAY:ze+ne.NextWeekday,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_PREVIOUS_WEEKDAY:ze+ne.PreviousWeekday,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_UTC:ze+ne.ToUTC,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_CONVERT_TIMEZONE:ze+ne.ConvertTimezone,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_TIMEZONE_OFFSET:ze+ne.GetTimezoneOffset,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_UTC_OFFSET:ze+ne.SetUTCOffset,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_READ_KEY:ze+Ke.ReadKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_WRITE_KEY:ze+Ke.WriteKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_DELETE_KEY:ze+Ke.DeleteKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_READ_NESTED_KEY:ze+Ke.ReadNestedKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_WRITE_NESTED_KEY:ze+Ke.WriteNestedKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_DELETE_NESTED_KEY:ze+Ke.DeleteNestedKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_WRITE_SAFE_NESTED_KEY_RECURSIVELY:ze+Ke.WriteSafeNestedKeyRecursively,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_HAS_KEY:Nd+Ke.HasKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_HAS_NESTED_KEY:Nd+Ke.HasNestedKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_KEY_VALUE_EQUALS:Nd+Ke.KeyValueEquals,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_NESTED_KEY_VALUE_EQUALS:Nd+Ke.NestedKeyValueEquals,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_IS_INSTANCE_OF_TYPE:Nd+Ke.IsInstanceOfType,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_MERGE:ze+Ke.Merge,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_KEYS:ze+Ke.Keys,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_VALUES:ze+Ke.Values,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_ENTRIES:ze+Ke.Entries,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_GET_TYPE_OF:ze+Qe.GetTypeOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_HASH:ze+Ui.Hash,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_HMAC:ze+Ui.Hmac,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_GENERATE_RANDOM_BYTES:ze+Ot.GenerateRandomBytes,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_CONSTANT_TIME_EQUAL:ze+Ui.ConstantTimeEqual,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_DERIVE_KEY_PBKDF2:ze+Ui.DeriveKeyPBKDF2,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__PASSWORD_HASH_PBKDF2:ze+Ia.HashPasswordPBKDF2,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__PASSWORD_VERIFY_PBKDF2:ze+Ia.VerifyPasswordPBKDF2,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_BUILD_HMAC:ze+un.BuildJwtHmac,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_VERIFY_HMAC:ze+un.VerifyJwtHmac,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_DECODE:ze+un.DecodeJwt,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_FROM_BYTES_TO_STRING:ze+Qe.FromBytesToString,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_BYTES:ze+Qe.ToBytes,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_NUMBER:ze+Qe.ToNumber,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_STRING:ze+Qe.ToString,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_BASE64:ze+Qe.EncodeBase64,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_BASE64:ze+Qe.DecodeBase64,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_BASE64URL:ze+Qe.EncodeBase64Url,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_BASE64URL:ze+Qe.DecodeBase64Url,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_HEX:ze+Qe.EncodeHex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_HEX:ze+Qe.DecodeHex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_PARSE_MULTIPART_BODY:ze+Qe.ParseMultipartBody,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_PARSE_DATA_URI:ze+Qe.ParseDataUri,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DETECT_MIME_TYPE_FROM_BYTES:ze+Qe.DetectMimeTypeFromBytes,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_PARSE_SPREADSHEET_RANGE_TO_A1:ze+Qe.ParseSpreadsheetRangeToA1,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_PARSE_A1_TO_SPREADSHEET_RANGE:ze+Qe.ParseA1ToSpreadsheetRange,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_BYTES_TO_FILE_REFERENCE:ze+Qe.BytesToFileReference,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_FILE_REFERENCE_TO_BYTES:ze+Qe.FileReferenceToBytes,BUILT_IN_OPERATIONS_IMPLEMENTATIONS__JSON_PARSE:ze+js.Parse,BUILT_IN_OPERATIONS_IMPLEMENTATIONS__JSON_STRINGIFY:ze+js.Stringify,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_UPLOAD_FILE:ze+Ye.UploadFile,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_GET_FILE:ze+Ye.GetFile,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_DOWNLOAD_FILE:ze+Ye.DownloadFile,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_LIST_FILES:ze+Ye.ListFiles,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_DELETE_FILE:ze+Ye.DeleteFile,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_DELETE_FILES:ze+Ye.DeleteFiles,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_COPY_FILE:ze+Ye.CopyFile,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_MOVE_FILE:ze+Ye.MoveFile,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_RENAME_FILE:ze+Ye.RenameFile,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_GET_FILE_METADATA:ze+Ye.GetFileMetadata,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_CHECK_FILE_EXISTS:ze+Ye.CheckFileExists,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_GET_PRESIGNED_URL:ze+Ye.GetPresignedUrl,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_SET_FILE_ACCESS:ze+Ye.SetFileAccess,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_CREATE_FOLDER:ze+Ye.CreateFolder,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_DELETE_FOLDER:ze+Ye.DeleteFolders,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_DELETE_FOLDERS:ze+Ye.DeleteFolders,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_CREATE_MULTIPART_UPLOAD:ze+Ye.CreateMultipartUpload,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_GET_UPLOAD_PART_PRESIGNED_URL:ze+Ye.GetUploadPartPresignedUrl,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_COMPLETE_MULTIPART_UPLOAD:ze+Ye.CompleteMultipartUpload,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_ABORT_MULTIPART_UPLOAD:ze+Ye.AbortMultipartUpload,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_UPLOAD_FILE_PART:ze+Ye.UploadFilePart};class oTt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.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:[$e.All],contexts:[Q.Editor]});C(this,"module",{main:async(t,n)=>({value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,entity:t,error:null,result:null})})}}class dTt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_IN_FUNCTION_IMPLEMENTATIONS__DELETE_PERSISTED_ENTITY,version:"1.0.0",description:'Implementation for the built-in function "Delete SQL database table". It deletes the current entity as an entry in the persisted storage.',initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor]});C(this,"module",{main:async(t,n)=>({value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,entity:t,error:null,result:null})})}}class pTt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_IN_FUNCTION_IMPLEMENTATIONS__CREATE_PERSISTED_ENTITY,version:"1.0.0",description:'Implementation for the built-in function "Create SQL database table". It saves the current entity state to the persisted storage.',initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor]});C(this,"module",{main:async(t,n)=>({value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,entity:t,error:null,result:null})})}}class uTt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_IN_FUNCTION_IMPLEMENTATIONS__UPDATE_PERSISTED_ENTITY,version:"1.0.0",description:'Implementation for the built-in function "Update SQL database table". It saves the current entity state to the persisted storage.',initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor]});C(this,"module",{main:async(t,n)=>({value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,entity:t,error:null,result:null})})}}class cTt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.SEARCH_NODE_IMPLEMENTATION,version:"1.0.0",description:"Implementation for search nodes when they get executed and query data.",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor]});C(this,"module",{main:async(t,n)=>({error:"Search module not implemented",data:null})})}}class fTt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.UUID,version:"1.0.0",description:"UUID generation module, for all contexts and runtimes",initPriority:_e.High,permissions:[$e.All],contexts:[]});C(this,"module",_2)}}class yTt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_EMPTY,version:"1.0.0",description:"Comparison: Empty (!value)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic);if(!n)return;const s=n.get(Hi.Empty);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[Hi.Empty].inputs.leftHand.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=f==null;return{value:K.Success,error:null,result:y}}catch(e){return{value:K.UnhandledError,error:e,result:null}}}})}}class hTt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_NOT_EMPTY,version:"1.0.0",description:"Comparison: NotEmpty (!!value)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic);if(!n)return;const s=n.get(Hi.NotEmpty);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[Hi.NotEmpty].inputs.leftHand.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=f!=null;return{value:K.Success,error:null,result:y}}catch(e){return{value:K.UnhandledError,error:e,result:null}}}})}}const IO=class IO extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_PRIMITIVE_EQUAL,version:"1.0.0",description:"Comparison: PrimitiveEqual (typed equality / deep JSON equality)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic);if(!n)return;const s=n.get(Hi.PrimitiveEqual);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=(u=(s=n[0])==null?void 0:s.value)==null?void 0:u.name,g=(f=(e=n[0])==null?void 0:e.value)==null?void 0:f.value,b=(m=(y=n[1])==null?void 0:y.value)==null?void 0:m.value;let R=!1;return T&&IO.primitiveSet.has(T)?R=g===b:T===me.Untyped||T===me.KeyValue?R=JSON.stringify(g)===JSON.stringify(b):R=!1,{value:K.Success,error:null,result:R}}catch(T){return{value:K.UnhandledError,error:T,result:null}}}})}};C(IO,"primitiveSet",new Set([me.String,me.Number,me.Boolean,me.Null,me.Enum,me.Date,me.UUID]));let Jw=IO;const RO=class RO extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_PRIMITIVE_NOT_EQUAL,version:"1.0.0",description:"Comparison: PrimitiveNotEqual (typed inequality / deep JSON inequality)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic);if(!n)return;const s=n.get(Hi.PrimitiveNotEqual);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=(u=(s=n[0])==null?void 0:s.value)==null?void 0:u.name,g=(f=(e=n[0])==null?void 0:e.value)==null?void 0:f.value,b=(m=(y=n[1])==null?void 0:y.value)==null?void 0:m.value;let R=!1;return T&&RO.primitiveSet.has(T)?R=g!==b:T===me.Untyped||T===me.KeyValue?R=JSON.stringify(g)!==JSON.stringify(b):R=!1,{value:K.Success,error:null,result:R}}catch(T){return{value:K.UnhandledError,error:T,result:null}}}})}};C(RO,"primitiveSet",new Set([me.String,me.Number,me.Boolean,me.Null,me.Enum,me.Date,me.UUID]));let Qw=RO;var mTt={exports:{}};(function(a,p){(function(t,n){a.exports=n()})(os,function(){var t="minute",n=/[+-]\d\d(?::?\d\d)?/g,s=/([+-]|\d\d)/g;return function(u,e,f){var y=e.prototype;f.utc=function(A){var O={date:A,utc:!0,args:arguments};return new e(O)},y.utc=function(A){var O=f(this.toDate(),{locale:this.$L,utc:!0});return A?O.add(this.utcOffset(),t):O},y.local=function(){return f(this.toDate(),{locale:this.$L,utc:!1})};var m=y.parse;y.parse=function(A){A.utc&&(this.$u=!0),this.$utils().u(A.$offset)||(this.$offset=A.$offset),m.call(this,A)};var T=y.init;y.init=function(){if(this.$u){var A=this.$d;this.$y=A.getUTCFullYear(),this.$M=A.getUTCMonth(),this.$D=A.getUTCDate(),this.$W=A.getUTCDay(),this.$H=A.getUTCHours(),this.$m=A.getUTCMinutes(),this.$s=A.getUTCSeconds(),this.$ms=A.getUTCMilliseconds()}else T.call(this)};var g=y.utcOffset;y.utcOffset=function(A,O){var P=this.$utils().u;if(P(A))return this.$u?0:P(this.$offset)?g.call(this):this.$offset;if(typeof A=="string"&&(A=function(Z){Z===void 0&&(Z="");var q=Z.match(n);if(!q)return null;var H=(""+q[0]).match(s)||["-",0,0],Y=H[0],ie=60*+H[1]+ +H[2];return ie===0?0:Y==="+"?ie:-ie}(A),A===null))return this;var x=Math.abs(A)<=16?60*A:A;if(x===0)return this.utc(O);var $=this.clone();if(O)return $.$offset=x,$.$u=!1,$;var U=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return($=this.local().add(x+U,t)).$offset=x,$.$x.$localOffset=U,$};var b=y.format;y.format=function(A){var O=A||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return b.call(this,O)},y.valueOf=function(){var A=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*A},y.isUTC=function(){return!!this.$u},y.toISOString=function(){return this.toDate().toISOString()},y.toString=function(){return this.toDate().toUTCString()};var R=y.toDate;y.toDate=function(A){return A==="s"&&this.$offset?f(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():R.call(this)};var I=y.diff;y.diff=function(A,O,P){if(A&&this.$u===A.$u)return I.call(this,A,O,P);var x=this.local(),$=f(A).local();return I.call(x,$,O,P)}}})})(mTt);var Tbn=mTt.exports;const vbn=ip(Tbn);var TTt={exports:{}};(function(a,p){(function(t,n){a.exports=n()})(os,function(){var t={year:0,month:1,day:2,hour:3,minute:4,second:5},n={};return function(s,u,e){var f,y=function(b,R,I){I===void 0&&(I={});var A=new Date(b),O=function(P,x){x===void 0&&(x={});var $=x.timeZoneName||"short",U=P+"|"+$,Z=n[U];return Z||(Z=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:P,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:$}),n[U]=Z),Z}(R,I);return O.formatToParts(A)},m=function(b,R){for(var I=y(b,R),A=[],O=0;O<I.length;O+=1){var P=I[O],x=P.type,$=P.value,U=t[x];U>=0&&(A[U]=parseInt($,10))}var Z=A[3],q=Z===24?0:Z,H=A[0]+"-"+A[1]+"-"+A[2]+" "+q+":"+A[4]+":"+A[5]+":000",Y=+b;return(e.utc(H).valueOf()-(Y-=Y%1e3))/6e4},T=u.prototype;T.tz=function(b,R){b===void 0&&(b=f);var I,A=this.utcOffset(),O=this.toDate(),P=O.toLocaleString("en-US",{timeZone:b}),x=Math.round((O-new Date(P))/1e3/60),$=15*-Math.round(O.getTimezoneOffset()/15)-x;if(!Number($))I=this.utcOffset(0,R);else if(I=e(P,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset($,!0),R){var U=I.utcOffset();I=I.add(A-U,"minute")}return I.$x.$timezone=b,I},T.offsetName=function(b){var R=this.$x.$timezone||e.tz.guess(),I=y(this.valueOf(),R,{timeZoneName:b}).find(function(A){return A.type.toLowerCase()==="timezonename"});return I&&I.value};var g=T.startOf;T.startOf=function(b,R){if(!this.$x||!this.$x.$timezone)return g.call(this,b,R);var I=e(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return g.call(I,b,R).tz(this.$x.$timezone,!0)},e.tz=function(b,R,I){var A=I&&R,O=I||R||f,P=m(+e(),O);if(typeof b!="string")return e(b).tz(O);var x=function(q,H,Y){var ie=q-60*H*1e3,z=m(ie,Y);if(H===z)return[ie,H];var W=m(ie-=60*(z-H)*1e3,Y);return z===W?[ie,z]:[q-60*Math.min(z,W)*1e3,Math.max(z,W)]}(e.utc(b,A).valueOf(),P,O),$=x[0],U=x[1],Z=e($).utcOffset(U);return Z.$x.$timezone=O,Z},e.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},e.tz.setDefault=function(b){f=b}}})})(TTt);var gbn=TTt.exports;const bbn=ip(gbn);var vTt={exports:{}};(function(a,p){(function(t,n){a.exports=n()})(os,function(){return function(t,n,s){n.prototype.isBetween=function(u,e,f,y){var m=s(u),T=s(e),g=(y=y||"()")[0]==="(",b=y[1]===")";return(g?this.isAfter(m,f):!this.isBefore(m,f))&&(b?this.isBefore(T,f):!this.isAfter(T,f))||(g?this.isBefore(m,f):!this.isAfter(m,f))&&(b?this.isAfter(T,f):!this.isBefore(T,f))}}})})(vTt);var Ebn=vTt.exports;const Ibn=ip(Ebn);var gTt={exports:{}};(function(a,p){(function(t,n){a.exports=n()})(os,function(){return function(t,n){n.prototype.isSameOrAfter=function(s,u){return this.isSame(s,u)||this.isAfter(s,u)}}})})(gTt);var Rbn=gTt.exports;const Abn=ip(Rbn);var bTt={exports:{}};(function(a,p){(function(t,n){a.exports=n()})(os,function(){return function(t,n){n.prototype.isSameOrBefore=function(s,u){return this.isSame(s,u)||this.isBefore(s,u)}}})})(bTt);var Dbn=bTt.exports;const Cbn=ip(Dbn);var ETt={exports:{}};(function(a,p){(function(t,n){a.exports=n()})(os,function(){var t="week",n="year";return function(s,u,e){var f=u.prototype;f.week=function(y){if(y===void 0&&(y=null),y!==null)return this.add(7*(y-this.week()),"day");var m=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var T=e(this).startOf(n).add(1,n).date(m),g=e(this).endOf(t);if(T.isBefore(g))return 1}var b=e(this).startOf(n).date(m).startOf(t).subtract(1,"millisecond"),R=this.diff(b,t,!0);return R<0?e(this).startOf("week").week():Math.ceil(R)},f.weeks=function(y){return y===void 0&&(y=null),this.week(y)}}})})(ETt);var wbn=ETt.exports;const Obn=ip(wbn);var ITt={exports:{}};(function(a,p){(function(t,n){a.exports=n()})(os,function(){var t="day";return function(n,s,u){var e=function(m){return m.add(4-m.isoWeekday(),t)},f=s.prototype;f.isoWeekYear=function(){return e(this).year()},f.isoWeek=function(m){if(!this.$utils().u(m))return this.add(7*(m-this.isoWeek()),t);var T,g,b,R,I=e(this),A=(T=this.isoWeekYear(),g=this.$u,b=(g?u.utc:u)().year(T).startOf("year"),R=4-b.isoWeekday(),b.isoWeekday()>4&&(R+=7),b.add(R,t));return I.diff(A,"week")+1},f.isoWeekday=function(m){return this.$utils().u(m)?this.day()||7:this.day(this.day()%7?m:m-7)};var y=f.startOf;f.startOf=function(m,T){var g=this.$utils(),b=!!g.u(T)||T;return g.p(m)==="isoweek"?b?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):y.bind(this)(m,T)}}})})(ITt);var xbn=ITt.exports;const Pbn=ip(xbn);var RTt={exports:{}};(function(a,p){(function(t,n){a.exports=n()})(os,function(){var t="month",n="quarter";return function(s,u){var e=u.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,T){return m=Number(m),this.$utils().p(T)===n?this.add(3*m,t):f.bind(this)(m,T)};var y=e.startOf;e.startOf=function(m,T){var g=this.$utils(),b=!!g.u(T)||T;if(g.p(m)===n){var R=this.quarter()-1;return b?this.month(3*R).startOf(t).startOf("day"):this.month(3*R+2).endOf(t).endOf("day")}return y.bind(this)(m,T)}}})})(RTt);var Vbn=RTt.exports;const Nbn=ip(Vbn);var ATt={exports:{}};(function(a,p){(function(t,n){a.exports=n()})(os,function(){return function(t,n,s){n.prototype.dayOfYear=function(u){var e=Math.round((s(this).startOf("day")-s(this).startOf("year"))/864e5)+1;return u==null?e:this.add(u-e,"day")}}})})(ATt);var _bn=ATt.exports;const $bn=ip(_bn);var DTt={exports:{}};(function(a,p){(function(t,n){a.exports=n()})(os,function(){return function(t,n,s){t=t||{};var u=n.prototype,e={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function f(m,T,g,b){return u.fromToBase(m,T,g,b)}s.en.relativeTime=e,u.fromToBase=function(m,T,g,b,R){for(var I,A,O,P=g.$locale().relativeTime||e,x=t.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],$=x.length,U=0;U<$;U+=1){var Z=x[U];Z.d&&(I=b?s(m).diff(g,Z.d,!0):g.diff(m,Z.d,!0));var q=(t.rounding||Math.round)(Math.abs(I));if(O=I>0,q<=Z.r||!Z.r){q<=1&&U>0&&(Z=x[U-1]);var H=P[Z.l];R&&(q=R(""+q)),A=typeof H=="string"?H.replace("%d",q):H(q,T,Z.l,O);break}}if(T)return A;var Y=O?P.future:P.past;return typeof Y=="function"?Y(A):Y.replace("%s",A)},u.to=function(m,T){return f(m,T,this,!0)},u.from=function(m,T){return f(m,T,this)};var y=function(m){return m.$u?s.utc():s()};u.toNow=function(m){return this.to(y(this),m)},u.fromNow=function(m){return this.from(y(this),m)}}})})(DTt);var Gbn=DTt.exports;const Lbn=ip(Gbn);var CTt={exports:{}};(function(a,p){(function(t,n){a.exports=n()})(os,function(){var t,n,s=1e3,u=6e4,e=36e5,f=864e5,y=/\[([^\]]+)]|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,T=2628e6,g=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,b={years:m,months:T,days:f,hours:e,minutes:u,seconds:s,milliseconds:1,weeks:6048e5},R=function(q){return q instanceof U},I=function(q,H,Y){return new U(q,Y,H.$l)},A=function(q){return n.p(q)+"s"},O=function(q){return q<0},P=function(q){return O(q)?Math.ceil(q):Math.floor(q)},x=function(q){return Math.abs(q)},$=function(q,H){return q?O(q)?{negative:!0,format:""+x(q)+H}:{negative:!1,format:""+q+H}:{negative:!1,format:""}},U=function(){function q(Y,ie,z){var W=this;if(this.$d={},this.$l=z,Y===void 0&&(this.$ms=0,this.parseFromMilliseconds()),ie)return I(Y*b[A(ie)],this);if(typeof Y=="number")return this.$ms=Y,this.parseFromMilliseconds(),this;if(typeof Y=="object")return Object.keys(Y).forEach(function(X){W.$d[A(X)]=Y[X]}),this.calMilliseconds(),this;if(typeof Y=="string"){var ee=Y.match(g);if(ee){var te=ee.slice(2).map(function(X){return X!=null?Number(X):0});return this.$d.years=te[0],this.$d.months=te[1],this.$d.weeks=te[2],this.$d.days=te[3],this.$d.hours=te[4],this.$d.minutes=te[5],this.$d.seconds=te[6],this.calMilliseconds(),this}}return this}var H=q.prototype;return H.calMilliseconds=function(){var Y=this;this.$ms=Object.keys(this.$d).reduce(function(ie,z){return ie+(Y.$d[z]||0)*b[z]},0)},H.parseFromMilliseconds=function(){var Y=this.$ms;this.$d.years=P(Y/m),Y%=m,this.$d.months=P(Y/T),Y%=T,this.$d.days=P(Y/f),Y%=f,this.$d.hours=P(Y/e),Y%=e,this.$d.minutes=P(Y/u),Y%=u,this.$d.seconds=P(Y/s),Y%=s,this.$d.milliseconds=Y},H.toISOString=function(){var Y=$(this.$d.years,"Y"),ie=$(this.$d.months,"M"),z=+this.$d.days||0;this.$d.weeks&&(z+=7*this.$d.weeks);var W=$(z,"D"),ee=$(this.$d.hours,"H"),te=$(this.$d.minutes,"M"),X=this.$d.seconds||0;this.$d.milliseconds&&(X+=this.$d.milliseconds/1e3,X=Math.round(1e3*X)/1e3);var re=$(X,"S"),ae=Y.negative||ie.negative||W.negative||ee.negative||te.negative||re.negative,le=ee.format||te.format||re.format?"T":"",oe=(ae?"-":"")+"P"+Y.format+ie.format+W.format+le+ee.format+te.format+re.format;return oe==="P"||oe==="-P"?"P0D":oe},H.toJSON=function(){return this.toISOString()},H.format=function(Y){var ie=Y||"YYYY-MM-DDTHH:mm:ss",z={Y:this.$d.years,YY:n.s(this.$d.years,2,"0"),YYYY:n.s(this.$d.years,4,"0"),M:this.$d.months,MM:n.s(this.$d.months,2,"0"),D:this.$d.days,DD:n.s(this.$d.days,2,"0"),H:this.$d.hours,HH:n.s(this.$d.hours,2,"0"),m:this.$d.minutes,mm:n.s(this.$d.minutes,2,"0"),s:this.$d.seconds,ss:n.s(this.$d.seconds,2,"0"),SSS:n.s(this.$d.milliseconds,3,"0")};return ie.replace(y,function(W,ee){return ee||String(z[W])})},H.as=function(Y){return this.$ms/b[A(Y)]},H.get=function(Y){var ie=this.$ms,z=A(Y);return z==="milliseconds"?ie%=1e3:ie=z==="weeks"?P(ie/b[z]):this.$d[z],ie||0},H.add=function(Y,ie,z){var W;return W=ie?Y*b[A(ie)]:R(Y)?Y.$ms:I(Y,this).$ms,I(this.$ms+W*(z?-1:1),this)},H.subtract=function(Y,ie){return this.add(Y,ie,!0)},H.locale=function(Y){var ie=this.clone();return ie.$l=Y,ie},H.clone=function(){return I(this.$ms,this)},H.humanize=function(Y){return t().add(this.$ms,"ms").locale(this.$l).fromNow(!Y)},H.valueOf=function(){return this.asMilliseconds()},H.milliseconds=function(){return this.get("milliseconds")},H.asMilliseconds=function(){return this.as("milliseconds")},H.seconds=function(){return this.get("seconds")},H.asSeconds=function(){return this.as("seconds")},H.minutes=function(){return this.get("minutes")},H.asMinutes=function(){return this.as("minutes")},H.hours=function(){return this.get("hours")},H.asHours=function(){return this.as("hours")},H.days=function(){return this.get("days")},H.asDays=function(){return this.as("days")},H.weeks=function(){return this.get("weeks")},H.asWeeks=function(){return this.as("weeks")},H.months=function(){return this.get("months")},H.asMonths=function(){return this.as("months")},H.years=function(){return this.get("years")},H.asYears=function(){return this.as("years")},q}(),Z=function(q,H,Y){return q.add(H.years()*Y,"y").add(H.months()*Y,"M").add(H.days()*Y,"d").add(H.hours()*Y,"h").add(H.minutes()*Y,"m").add(H.seconds()*Y,"s").add(H.milliseconds()*Y,"ms")};return function(q,H,Y){t=Y,n=Y().$utils(),Y.duration=function(W,ee){var te=Y.locale();return I(W,{$l:te},ee)},Y.isDuration=R;var ie=H.prototype.add,z=H.prototype.subtract;H.prototype.add=function(W,ee){return R(W)?Z(this,W,1):ie.bind(this)(W,ee)},H.prototype.subtract=function(W,ee){return R(W)?Z(this,W,-1):z.bind(this)(W,ee)}}})})(CTt);var Bbn=CTt.exports;const Sbn=ip(Bbn);var wTt={exports:{}};(function(a,p){(function(t,n){a.exports=n()})(os,function(){return function(t,n){n.prototype.isLeapYear=function(){return this.$y%4==0&&this.$y%100!=0||this.$y%400==0}}})})(wTt);var Mbn=wTt.exports;const Fbn=ip(Mbn);j.extend(vbn);j.extend(bbn);j.extend(Ibn);j.extend(Abn);j.extend(Cbn);j.extend(Obn);j.extend(Pbn);j.extend(Nbn);j.extend($bn);j.extend(Lbn);j.extend(Sbn);j.extend(Fbn);const Ki=a=>j(a),ma=a=>a.toISOString();function OTt(){return ma(j())}function xTt(a,p){return Ki(a).format(p)}function PTt(a){return ma(j(a))}function VTt(a){if(a==null)throw new TypeError("ToDate expects a non-null value.");if(typeof a=="string"){const p=j(a);if(!p.isValid())throw new TypeError("Invalid date string.");return p.toISOString()}if(typeof a=="number"&&Number.isFinite(a)){const p=Math.abs(a)<1e12?j.unix(a):j(a);if(!p.isValid())throw new TypeError("Invalid numeric timestamp.");return p.toISOString()}if(a instanceof Date){const p=j(a);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 NTt(a,p,t){return ma(Ki(a).add(p,t))}function _Tt(a,p,t){return ma(Ki(a).subtract(p,t))}function $Tt(a,p,t,n=!1){return Ki(a).diff(Ki(p),t,n)}function GTt(a){return Ki(a).unix()}function LTt(a){return ma(j.unix(a))}function BTt(a){return ma(Ki(a))}function STt(a){return Ki(a).year()}function MTt(a){return Ki(a).month()}function FTt(a){return Ki(a).date()}function kTt(a){return Ki(a).hour()}function UTt(a){return Ki(a).minute()}function KTt(a){return Ki(a).second()}function jTt(a){return Ki(a).millisecond()}function qTt(a){return Ki(a).isoWeekday()}function ZTt(a){return Ki(a).week()}function HTt(a){return Ki(a).quarter()}function WTt(a){return Ki(a).dayOfYear()}function zTt(a){return Ki(a).daysInMonth()}function YTt(a,p){return ma(Ki(a).year(p))}function JTt(a,p){return ma(Ki(a).month(p))}function QTt(a,p){return ma(Ki(a).date(p))}function XTt(a,p){return ma(Ki(a).hour(p))}function evt(a,p){return ma(Ki(a).minute(p))}function tvt(a,p){return ma(Ki(a).second(p))}function ivt(a,p){return ma(Ki(a).millisecond(p))}function nvt(a,p){return ma(Ki(a).isoWeekday(p))}function rvt(a,p){return ma(Ki(a).quarter(p))}function avt(a,p){return ma(Ki(a).startOf(p))}function svt(a,p){return ma(Ki(a).endOf(p))}function lvt(a,p){const t=Ki(a),n=t.startOf(p),s=t.endOf(p),u=n.valueOf()+(s.valueOf()-n.valueOf())/2;return ma(t.valueOf()<u?n:s)}function ovt(a,p,t){return Ki(a).isBefore(Ki(p),t)}function dvt(a,p,t){return Ki(a).isAfter(Ki(p),t)}function pvt(a,p,t){return Ki(a).isSame(Ki(p),t)}function uvt(a,p,t){return Ki(a).isSameOrBefore(Ki(p),t)}function cvt(a,p,t){return Ki(a).isSameOrAfter(Ki(p),t)}function fvt(a,p,t,n,s="()"){return Ki(a).isBetween(Ki(p),Ki(t),n,s)}function yvt(a){return j(a).isValid()}function hvt(a){return Ki(a).isLeapYear()}function mvt(a,p,t){const n=Ki(a);return n.isBefore(p)?ma(Ki(p)):n.isAfter(t)?ma(Ki(t)):ma(n)}function Tvt(a){if(a.length===0)throw new Error("minOf requires at least one date");let p=Ki(a[0]);for(let t=1;t<a.length;t++){const n=Ki(a[t]);n.isBefore(p)&&(p=n)}return ma(p)}function vvt(a){if(a.length===0)throw new Error("maxOf requires at least one date");let p=Ki(a[0]);for(let t=1;t<a.length;t++){const n=Ki(a[t]);n.isAfter(p)&&(p=n)}return ma(p)}function gvt(a,p=!1){return Ki(a).fromNow(p)}function bvt(a,p=!1){return Ki(a).toNow(p)}function Evt(a,p,t=!0){const n=Ki(a).diff(Ki(p),"millisecond",!0),s=Math.abs(n),e=j.duration(s,"milliseconds").humanize();return t?n>=0?`in ${e}`:`${e} ago`:e}function Ivt(a,p,t=["6","7"],n=[]){const s=m=>n.some(T=>Ki(T).isSame(m,"day")),u=m=>((m.day()+6)%7+1).toString();let e=Ki(a);const f=p>=0?1:-1;let y=Math.abs(p);for(;y>0;){e=e.add(f,"day");const m=u(e);!t.includes(m)&&!s(e)&&y--}return ma(e)}function Rvt(a,p){let t=Ki(a);const n=p;for(let s=0;s<7;s++)if(t=t.add(1,"day"),t.isoWeekday()===n)return ma(t);return ma(t)}function Avt(a,p){let t=Ki(a);const n=p;for(let s=0;s<7;s++)if(t=t.subtract(1,"day"),t.isoWeekday()===n)return ma(t);return ma(t)}const Dvt="Local";function R4(){try{const a=Intl.DateTimeFormat().resolvedOptions().timeZone;if(a&&typeof a=="string")return a}catch{}try{if(typeof process<"u"&&process.env&&process.env.TZ)return process.env.TZ}catch{}return null}function A4(){const a=R4();if(a)return a;throw new Error("Unable to detect current IANA timezone from host environment.")}function Cvt(a,p,t=!1){let n=p;if(n===Dvt){const e=R4();if(!e)throw new Error("Unable to detect current timezone from host environment.");n=e}const s=n?j.tz(a,n):Ki(a),u=t?s.utc(!0):s.utc();return ma(u)}function wvt(a,p,t=!1){const n=Ki(a);return ma(t?n.tz(p,!0):n.tz(p))}function Ovt(a,p){const t=a===Dvt?A4():a;return Ki(p).tz(t).utcOffset()}function xvt(a,p,t=!1){return ma(Ki(a).utcOffset(p,t))}class Pvt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_CURRENT_TIMESTAMP,version:"1.0.0",description:"Date get current timestamp operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.GetCurrentTimestamp);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const s=OTt();return{value:K.Success,error:null,result:s}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class Vvt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_FORMAT_DATE,version:"1.0.0",description:"Date format operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.FormatDate);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.FormatDate].inputs.dateValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.FormatDate].inputs.format.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),b=xTt(m,g);return{value:K.Success,error:null,result:b}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class Nvt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_PARSE_DATE,version:"1.0.0",description:"Date parse operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.ParseDate);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[ne.ParseDate].inputs.inputValue.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=PTt(f);return{value:K.Success,error:null,result:y}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class _vt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_ADD_TO_DATE,version:"1.0.0",description:"Date add-to-date operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.AddToDate);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[ne.AddToDate].inputs.dateValue.id}),g=((s=T==null?void 0:T.value)==null?void 0:s.valueAsType)??((u=T==null?void 0:T.value)==null?void 0:u.value),b=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[ne.AddToDate].inputs.amount.id}),R=((e=b==null?void 0:b.value)==null?void 0:e.valueAsType)??((f=b==null?void 0:b.value)==null?void 0:f.value),I=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[ne.AddToDate].inputs.unit.id}),A=((y=I==null?void 0:I.value)==null?void 0:y.valueAsType)??((m=I==null?void 0:I.value)==null?void 0:m.value),O=NTt(g,R,A);return{value:K.Success,error:null,result:O}}catch(T){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class $vt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SUBTRACT_FROM_DATE,version:"1.0.0",description:"Date subtract-from-date operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.SubtractFromDate);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[ne.SubtractFromDate].inputs.dateValue.id}),g=((s=T==null?void 0:T.value)==null?void 0:s.valueAsType)??((u=T==null?void 0:T.value)==null?void 0:u.value),b=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[ne.SubtractFromDate].inputs.amount.id}),R=((e=b==null?void 0:b.value)==null?void 0:e.valueAsType)??((f=b==null?void 0:b.value)==null?void 0:f.value),I=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[ne.SubtractFromDate].inputs.unit.id}),A=((y=I==null?void 0:I.value)==null?void 0:y.valueAsType)??((m=I==null?void 0:I.value)==null?void 0:m.value),O=_Tt(g,R,A);return{value:K.Success,error:null,result:O}}catch(T){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class Gvt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_DIFFERENCE_BETWEEN_DATES,version:"1.0.0",description:"Date difference-between-dates operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.DifferenceBetweenDates);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g;try{const b=n.find(Z=>{var q,H;return((H=(q=Z.valueOwner)==null?void 0:q.declaration)==null?void 0:H.id)===G.operation[ne.DifferenceBetweenDates].inputs.firstDate.id}),R=((s=b==null?void 0:b.value)==null?void 0:s.valueAsType)??((u=b==null?void 0:b.value)==null?void 0:u.value),I=n.find(Z=>{var q,H;return((H=(q=Z.valueOwner)==null?void 0:q.declaration)==null?void 0:H.id)===G.operation[ne.DifferenceBetweenDates].inputs.secondDate.id}),A=((e=I==null?void 0:I.value)==null?void 0:e.valueAsType)??((f=I==null?void 0:I.value)==null?void 0:f.value),O=n.find(Z=>{var q,H;return((H=(q=Z.valueOwner)==null?void 0:q.declaration)==null?void 0:H.id)===G.operation[ne.DifferenceBetweenDates].inputs.unit.id}),P=((y=O==null?void 0:O.value)==null?void 0:y.valueAsType)??((m=O==null?void 0:O.value)==null?void 0:m.value),x=n.find(Z=>{var q,H;return((H=(q=Z.valueOwner)==null?void 0:q.declaration)==null?void 0:H.id)===G.operation[ne.DifferenceBetweenDates].inputs.asFloat.id}),$=((T=x==null?void 0:x.value)==null?void 0:T.valueAsType)??((g=x==null?void 0:x.value)==null?void 0:g.value)??!1,U=$Tt(R,A,P,$);return{value:K.Success,error:null,result:U}}catch(b){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:b,result:null}}}})}}class kbn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.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:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.ToDate);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[ne.ToDate].inputs.inputValue.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=VTt(f);return{value:K.Success,error:null,result:y}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class Lvt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_UNIX,version:"1.0.0",description:"Date to-unix operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.ToUnix);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[ne.ToUnix].inputs.dateValue.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=GTt(f);return{value:K.Success,error:null,result:y}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class Bvt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_FROM_UNIX,version:"1.0.0",description:"Date from-unix operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.FromUnix);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[ne.FromUnix].inputs.seconds.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=LTt(f);return{value:K.Success,error:null,result:y}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class Svt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_ISO_STRING,version:"1.0.0",description:"Date to-iso-string operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.ToISOString);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[ne.ToISOString].inputs.inputValue.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=BTt(f);return{value:K.Success,error:null,result:y}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class Mvt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_YEAR,version:"1.0.0",description:"Date get-year operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.GetYear);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[ne.GetYear].inputs.dateValue.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=STt(f);return{value:K.Success,error:null,result:y}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class Fvt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_MONTH,version:"1.0.0",description:"Date get-month (0-based) operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.GetMonth);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[ne.GetMonth].inputs.dateValue.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=MTt(f);return{value:K.Success,error:null,result:y}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class kvt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.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:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.GetDate);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[ne.GetDate].inputs.dateValue.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=FTt(f);return{value:K.Success,error:null,result:y}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class Uvt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_HOUR,version:"1.0.0",description:"Date get-hour operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.GetHour);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[ne.GetHour].inputs.dateValue.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=kTt(f);return{value:K.Success,error:null,result:y}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class Kvt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_MINUTE,version:"1.0.0",description:"Date get-minute operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.GetMinute);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[ne.GetMinute].inputs.dateValue.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=UTt(f);return{value:K.Success,error:null,result:y}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class jvt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_SECOND,version:"1.0.0",description:"Date get-second operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.GetSecond);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[ne.GetSecond].inputs.dateValue.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=KTt(f);return{value:K.Success,error:null,result:y}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class qvt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_MILLISECOND,version:"1.0.0",description:"Date get-millisecond operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.GetMillisecond);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[ne.GetMillisecond].inputs.dateValue.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=jTt(f);return{value:K.Success,error:null,result:y}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class Zvt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_ISO_WEEKDAY,version:"1.0.0",description:"Date get-iso-weekday operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.GetIsoWeekday);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[ne.GetIsoWeekday].inputs.dateValue.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=qTt(f);return{value:K.Success,error:null,result:y}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class Hvt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.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:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.GetWeekOfYear);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[ne.GetWeekOfYear].inputs.dateValue.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=ZTt(f);return{value:K.Success,error:null,result:y}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class Wvt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_QUARTER,version:"1.0.0",description:"Date get-quarter operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.GetQuarter);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[ne.GetQuarter].inputs.dateValue.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=HTt(f);return{value:K.Success,error:null,result:y}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class zvt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.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:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.GetDayOfYear);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[ne.GetDayOfYear].inputs.dateValue.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=WTt(f);return{value:K.Success,error:null,result:y}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class Yvt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.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:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.GetDaysInMonth);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[ne.GetDaysInMonth].inputs.dateValue.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=zTt(f);return{value:K.Success,error:null,result:y}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class Jvt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.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:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.GetCurrentIanaTimeZone);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const s=A4();return{value:K.Success,error:null,result:s}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class Qvt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_YEAR,version:"1.0.0",description:"Date set-year operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.SetYear);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.SetYear].inputs.dateValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.SetYear].inputs.year.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),b=YTt(m,g);return{value:K.Success,error:null,result:b}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class Xvt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.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:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.SetMonth);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.SetMonth].inputs.dateValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.SetMonth].inputs.month.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),b=JTt(m,g);return{value:K.Success,error:null,result:b}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class egt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.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:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.SetDate);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.SetDate].inputs.dateValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.SetDate].inputs.date.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),b=QTt(m,g);return{value:K.Success,error:null,result:b}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class tgt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_HOUR,version:"1.0.0",description:"Date set-hour operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.SetHour);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.SetHour].inputs.dateValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.SetHour].inputs.hour.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),b=XTt(m,g);return{value:K.Success,error:null,result:b}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class igt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_MINUTE,version:"1.0.0",description:"Date set-minute operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.SetMinute);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.SetMinute].inputs.dateValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.SetMinute].inputs.minute.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),b=evt(m,g);return{value:K.Success,error:null,result:b}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class ngt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_SECOND,version:"1.0.0",description:"Date set-second operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.SetSecond);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.SetSecond].inputs.dateValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.SetSecond].inputs.second.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),b=tvt(m,g);return{value:K.Success,error:null,result:b}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class rgt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_MILLISECOND,version:"1.0.0",description:"Date set-millisecond operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.SetMillisecond);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.SetMillisecond].inputs.dateValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.SetMillisecond].inputs.millisecond.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),b=ivt(m,g);return{value:K.Success,error:null,result:b}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class agt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_ISO_WEEKDAY,version:"1.0.0",description:"Date set-iso-weekday operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.SetIsoWeekday);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.SetIsoWeekday].inputs.dateValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.SetIsoWeekday].inputs.isoWeekday.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),b=nvt(m,g);return{value:K.Success,error:null,result:b}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class sgt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_QUARTER,version:"1.0.0",description:"Date set-quarter operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.SetQuarter);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.SetQuarter].inputs.dateValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.SetQuarter].inputs.quarter.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),b=rvt(m,g);return{value:K.Success,error:null,result:b}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class lgt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_START_OF,version:"1.0.0",description:"Date start-of operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.StartOf);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.StartOf].inputs.dateValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.StartOf].inputs.unit.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),b=avt(m,g);return{value:K.Success,error:null,result:b}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class ogt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_END_OF,version:"1.0.0",description:"Date end-of operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.EndOf);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.EndOf].inputs.dateValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.EndOf].inputs.unit.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),b=svt(m,g);return{value:K.Success,error:null,result:b}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class dgt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_ROUND_TO,version:"1.0.0",description:"Date round-to operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.RoundTo);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.RoundTo].inputs.dateValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.RoundTo].inputs.unit.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),b=lvt(m,g);return{value:K.Success,error:null,result:b}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class pgt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_BEFORE,version:"1.0.0",description:"Date is-before operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.IsBefore);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[ne.IsBefore].inputs.leftHand.id}),g=((s=T==null?void 0:T.value)==null?void 0:s.valueAsType)??((u=T==null?void 0:T.value)==null?void 0:u.value),b=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[ne.IsBefore].inputs.rightHand.id}),R=((e=b==null?void 0:b.value)==null?void 0:e.valueAsType)??((f=b==null?void 0:b.value)==null?void 0:f.value),I=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[ne.IsBefore].inputs.unit.id}),A=((y=I==null?void 0:I.value)==null?void 0:y.valueAsType)??((m=I==null?void 0:I.value)==null?void 0:m.value),O=ovt(g,R,A);return{value:K.Success,error:null,result:O}}catch(T){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class ugt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_AFTER,version:"1.0.0",description:"Date is-after operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.IsAfter);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[ne.IsAfter].inputs.leftHand.id}),g=((s=T==null?void 0:T.value)==null?void 0:s.valueAsType)??((u=T==null?void 0:T.value)==null?void 0:u.value),b=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[ne.IsAfter].inputs.rightHand.id}),R=((e=b==null?void 0:b.value)==null?void 0:e.valueAsType)??((f=b==null?void 0:b.value)==null?void 0:f.value),I=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[ne.IsAfter].inputs.unit.id}),A=((y=I==null?void 0:I.value)==null?void 0:y.valueAsType)??((m=I==null?void 0:I.value)==null?void 0:m.value),O=dvt(g,R,A);return{value:K.Success,error:null,result:O}}catch(T){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class cgt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_SAME,version:"1.0.0",description:"Date is-same operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.IsSame);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[ne.IsSame].inputs.leftHand.id}),g=((s=T==null?void 0:T.value)==null?void 0:s.valueAsType)??((u=T==null?void 0:T.value)==null?void 0:u.value),b=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[ne.IsSame].inputs.rightHand.id}),R=((e=b==null?void 0:b.value)==null?void 0:e.valueAsType)??((f=b==null?void 0:b.value)==null?void 0:f.value),I=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[ne.IsSame].inputs.unit.id}),A=((y=I==null?void 0:I.value)==null?void 0:y.valueAsType)??((m=I==null?void 0:I.value)==null?void 0:m.value),O=pvt(g,R,A);return{value:K.Success,error:null,result:O}}catch(T){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class fgt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.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:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.IsSameOrBefore);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[ne.IsSameOrBefore].inputs.leftHand.id}),g=((s=T==null?void 0:T.value)==null?void 0:s.valueAsType)??((u=T==null?void 0:T.value)==null?void 0:u.value),b=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[ne.IsSameOrBefore].inputs.rightHand.id}),R=((e=b==null?void 0:b.value)==null?void 0:e.valueAsType)??((f=b==null?void 0:b.value)==null?void 0:f.value),I=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[ne.IsSameOrBefore].inputs.unit.id}),A=((y=I==null?void 0:I.value)==null?void 0:y.valueAsType)??((m=I==null?void 0:I.value)==null?void 0:m.value),O=uvt(g,R,A);return{value:K.Success,error:null,result:O}}catch(T){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class ygt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.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:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.IsSameOrAfter);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[ne.IsSameOrAfter].inputs.leftHand.id}),g=((s=T==null?void 0:T.value)==null?void 0:s.valueAsType)??((u=T==null?void 0:T.value)==null?void 0:u.value),b=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[ne.IsSameOrAfter].inputs.rightHand.id}),R=((e=b==null?void 0:b.value)==null?void 0:e.valueAsType)??((f=b==null?void 0:b.value)==null?void 0:f.value),I=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[ne.IsSameOrAfter].inputs.unit.id}),A=((y=I==null?void 0:I.value)==null?void 0:y.valueAsType)??((m=I==null?void 0:I.value)==null?void 0:m.value),O=cvt(g,R,A);return{value:K.Success,error:null,result:O}}catch(T){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class hgt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_BETWEEN,version:"1.0.0",description:"Date is-between operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.IsBetween);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R;try{const I=n.find(ie=>{var z,W;return((W=(z=ie.valueOwner)==null?void 0:z.declaration)==null?void 0:W.id)===G.operation[ne.IsBetween].inputs.target.id}),A=((s=I==null?void 0:I.value)==null?void 0:s.valueAsType)??((u=I==null?void 0:I.value)==null?void 0:u.value),O=n.find(ie=>{var z,W;return((W=(z=ie.valueOwner)==null?void 0:z.declaration)==null?void 0:W.id)===G.operation[ne.IsBetween].inputs.start.id}),P=((e=O==null?void 0:O.value)==null?void 0:e.valueAsType)??((f=O==null?void 0:O.value)==null?void 0:f.value),x=n.find(ie=>{var z,W;return((W=(z=ie.valueOwner)==null?void 0:z.declaration)==null?void 0:W.id)===G.operation[ne.IsBetween].inputs.end.id}),$=((y=x==null?void 0:x.value)==null?void 0:y.valueAsType)??((m=x==null?void 0:x.value)==null?void 0:m.value),U=n.find(ie=>{var z,W;return((W=(z=ie.valueOwner)==null?void 0:z.declaration)==null?void 0:W.id)===G.operation[ne.IsBetween].inputs.unit.id}),Z=((T=U==null?void 0:U.value)==null?void 0:T.valueAsType)??((g=U==null?void 0:U.value)==null?void 0:g.value),q=n.find(ie=>{var z,W;return((W=(z=ie.valueOwner)==null?void 0:z.declaration)==null?void 0:W.id)===G.operation[ne.IsBetween].inputs.inclusivity.id}),H=((b=q==null?void 0:q.value)==null?void 0:b.valueAsType)??((R=q==null?void 0:q.value)==null?void 0:R.value),Y=fvt(A,P,$,Z,H??void 0);return{value:K.Success,error:null,result:Y}}catch(I){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:I,result:null}}}})}}class mgt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_VALID,version:"1.0.0",description:"Date is-valid operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.IsValid);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[ne.IsValid].inputs.value.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=yvt(f);return{value:K.Success,error:null,result:y}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class Tgt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_LEAP_YEAR,version:"1.0.0",description:"Date is-leap-year operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.IsLeapYear);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[ne.IsLeapYear].inputs.dateValue.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=hvt(f);return{value:K.Success,error:null,result:y}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class vgt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_CLAMP_TO_RANGE,version:"1.0.0",description:"Date clamp-to-range operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.ClampToRange);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[ne.ClampToRange].inputs.dateValue.id}),g=((s=T==null?void 0:T.value)==null?void 0:s.valueAsType)??((u=T==null?void 0:T.value)==null?void 0:u.value),b=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[ne.ClampToRange].inputs.min.id}),R=((e=b==null?void 0:b.value)==null?void 0:e.valueAsType)??((f=b==null?void 0:b.value)==null?void 0:f.value),I=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[ne.ClampToRange].inputs.max.id}),A=((y=I==null?void 0:I.value)==null?void 0:y.valueAsType)??((m=I==null?void 0:I.value)==null?void 0:m.value),O=mvt(g,R,A);return{value:K.Success,error:null,result:O}}catch(T){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class ggt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_MIN_OF,version:"1.0.0",description:"Date min-of operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.MinOf);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const u=n.filter(y=>{var m,T;return((T=(m=y.valueOwner)==null?void 0:m.declaration)==null?void 0:T.id)===G.operation[ne.MinOf].inputs.dates.id}).map(y=>{var m,T;return((m=y.value)==null?void 0:m.valueAsType)??((T=y.value)==null?void 0:T.value)}),e=u.length===1&&Array.isArray(u[0])?u[0]:u,f=Tvt(e);return{value:K.Success,error:null,result:f}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class bgt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_MAX_OF,version:"1.0.0",description:"Date max-of operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.MaxOf);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const u=n.filter(y=>{var m,T;return((T=(m=y.valueOwner)==null?void 0:m.declaration)==null?void 0:T.id)===G.operation[ne.MaxOf].inputs.dates.id}).map(y=>{var m,T;return((m=y.value)==null?void 0:m.valueAsType)??((T=y.value)==null?void 0:T.value)}),e=u.length===1&&Array.isArray(u[0])?u[0]:u,f=vvt(e);return{value:K.Success,error:null,result:f}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class Egt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_FROM_NOW,version:"1.0.0",description:"Date from-now operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.FromNow);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(I=>{var A,O;return((O=(A=I.valueOwner)==null?void 0:A.declaration)==null?void 0:O.id)===G.operation[ne.FromNow].inputs.dateValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(I=>{var A,O;return((O=(A=I.valueOwner)==null?void 0:A.declaration)==null?void 0:O.id)===G.operation[ne.FromNow].inputs.withoutSuffix.id}),b=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value)??!1,R=gvt(m,b);return{value:K.Success,error:null,result:R}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class Igt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_NOW,version:"1.0.0",description:"Date to-now operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.ToNow);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(I=>{var A,O;return((O=(A=I.valueOwner)==null?void 0:A.declaration)==null?void 0:O.id)===G.operation[ne.ToNow].inputs.dateValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(I=>{var A,O;return((O=(A=I.valueOwner)==null?void 0:A.declaration)==null?void 0:O.id)===G.operation[ne.ToNow].inputs.withoutSuffix.id}),b=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value)??!1,R=bvt(m,b);return{value:K.Success,error:null,result:R}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class Rgt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_HUMANIZE_DIFF,version:"1.0.0",description:"Date humanize-diff operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.HumanizeDiff);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=n.find(x=>{var $,U;return((U=($=x.valueOwner)==null?void 0:$.declaration)==null?void 0:U.id)===G.operation[ne.HumanizeDiff].inputs.firstDate.id}),g=((s=T==null?void 0:T.value)==null?void 0:s.valueAsType)??((u=T==null?void 0:T.value)==null?void 0:u.value),b=n.find(x=>{var $,U;return((U=($=x.valueOwner)==null?void 0:$.declaration)==null?void 0:U.id)===G.operation[ne.HumanizeDiff].inputs.secondDate.id}),R=((e=b==null?void 0:b.value)==null?void 0:e.valueAsType)??((f=b==null?void 0:b.value)==null?void 0:f.value),I=n.find(x=>{var $,U;return((U=($=x.valueOwner)==null?void 0:$.declaration)==null?void 0:U.id)===G.operation[ne.HumanizeDiff].inputs.withoutSuffix.id}),O=((y=I==null?void 0:I.value)==null?void 0:y.valueAsType)??((m=I==null?void 0:I.value)==null?void 0:m.value)??!0,P=Evt(g,R,O);return{value:K.Success,error:null,result:P}}catch(T){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class Agt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.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:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.AddBusinessDays);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const u=n.filter(g=>{var b,R;return((R=(b=g.valueOwner)==null?void 0:b.declaration)==null?void 0:R.id)===G.operation[ne.AddBusinessDays].inputs.dateValue.id}).map(g=>{var b,R;return((b=g.value)==null?void 0:b.valueAsType)??((R=g.value)==null?void 0:R.value)}),e=u[0],f=u[1],y=u[2]??void 0,m=u[3]??[],T=Ivt(e,f,y,m);return{value:K.Success,error:null,result:T}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class Dgt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_NEXT_WEEKDAY,version:"1.0.0",description:"Date next-weekday operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.NextWeekday);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.NextWeekday].inputs.dateValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.NextWeekday].inputs.weekday.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),b=Rvt(m,g);return{value:K.Success,error:null,result:b}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class Cgt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_PREVIOUS_WEEKDAY,version:"1.0.0",description:"Date previous-weekday operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.PreviousWeekday);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.PreviousWeekday].inputs.dateValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[ne.PreviousWeekday].inputs.weekday.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),b=Avt(m,g);return{value:K.Success,error:null,result:b}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class wgt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_UTC,version:"1.1.0",description:"Date to-utc operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.ToUTC);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const u=n.filter(T=>{var g,b;return((b=(g=T.valueOwner)==null?void 0:g.declaration)==null?void 0:b.id)===G.operation[ne.ToUTC].inputs.dateValue.id}).map(T=>{var g,b;return((g=T.value)==null?void 0:g.valueAsType)??((b=T.value)==null?void 0:b.value)}),e=u[0],f=u[1]||void 0,y=u[2]??!1,m=Cvt(e,f,y);return{value:K.Success,error:null,result:m}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class Ogt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_CONVERT_TIMEZONE,version:"1.0.0",description:"Date convert-timezone operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.ConvertTimezone);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=n.find(x=>{var $,U;return((U=($=x.valueOwner)==null?void 0:$.declaration)==null?void 0:U.id)===G.operation[ne.ConvertTimezone].inputs.dateValue.id}),g=((s=T==null?void 0:T.value)==null?void 0:s.valueAsType)??((u=T==null?void 0:T.value)==null?void 0:u.value),b=n.find(x=>{var $,U;return((U=($=x.valueOwner)==null?void 0:$.declaration)==null?void 0:U.id)===G.operation[ne.ConvertTimezone].inputs.targetTimezone.id}),R=((e=b==null?void 0:b.value)==null?void 0:e.valueAsType)??((f=b==null?void 0:b.value)==null?void 0:f.value),I=n.find(x=>{var $,U;return((U=($=x.valueOwner)==null?void 0:$.declaration)==null?void 0:U.id)===G.operation[ne.ConvertTimezone].inputs.keepLocalTime.id}),O=((y=I==null?void 0:I.value)==null?void 0:y.valueAsType)??((m=I==null?void 0:I.value)==null?void 0:m.value)??!1,P=wvt(g,R,O);return{value:K.Success,error:null,result:P}}catch(T){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class xgt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_TIMEZONE_OFFSET,version:"1.0.0",description:"Date get-timezone-offset operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.GetTimezoneOffset);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(A=>{var O,P;return((P=(O=A.valueOwner)==null?void 0:O.declaration)==null?void 0:P.id)===G.operation[ne.GetTimezoneOffset].inputs.timezone.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(A=>{var O,P;return((P=(O=A.valueOwner)==null?void 0:O.declaration)==null?void 0:P.id)===G.operation[ne.GetTimezoneOffset].inputs.atDate.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),I=Ovt(m,g);return{value:K.Success,error:null,result:I}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class Pgt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_UTC_OFFSET,version:"1.0.0",description:"Date set-utc-offset operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ne.SetUTCOffset);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=n.find(x=>{var $,U;return((U=($=x.valueOwner)==null?void 0:$.declaration)==null?void 0:U.id)===G.operation[ne.SetUTCOffset].inputs.dateValue.id}),g=((s=T==null?void 0:T.value)==null?void 0:s.valueAsType)??((u=T==null?void 0:T.value)==null?void 0:u.value),b=n.find(x=>{var $,U;return((U=($=x.valueOwner)==null?void 0:$.declaration)==null?void 0:U.id)===G.operation[ne.SetUTCOffset].inputs.offsetMinutes.id}),R=((e=b==null?void 0:b.value)==null?void 0:e.valueAsType)??((f=b==null?void 0:b.value)==null?void 0:f.value),I=n.find(x=>{var $,U;return((U=($=x.valueOwner)==null?void 0:$.declaration)==null?void 0:U.id)===G.operation[ne.SetUTCOffset].inputs.keepLocalTime.id}),O=((y=I==null?void 0:I.value)==null?void 0:y.valueAsType)??((m=I==null?void 0:I.value)==null?void 0:m.value)??!1,P=xvt(g,R,O);return{value:K.Success,error:null,result:P}}catch(T){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class Vgt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_WAIT,version:"1.0.0",description:"Execution wait operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(ld.Wait);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u;try{const e=n.find(y=>{var m,T;return((T=(m=y.valueOwner)==null?void 0:m.declaration)==null?void 0:T.id)===G.operation[ld.Wait].inputs.duration.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value);return typeof f!="number"||f<0?{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:"Invalid wait time provided",result:null}:(await new Promise(y=>setTimeout(y,f)),{value:K.Success,error:null,result:null})}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}const Ubn=/^\d{4}-\d{2}-\d{2}(?:[T ]\d{2}:\d{2}(?::\d{2}(?:\.\d{1,3})?)?(?:Z|[+-]\d{2}:?\d{2})?)?$/,D4=a=>a===null||["string","number","boolean"].includes(typeof a);function $l(a,p="Input must be an array"){if(!Array.isArray(a))throw new TypeError(p);return a}function $c(a){const p=$l(a,"Input must be an array");if(!p||p.length===0)throw new TypeError("No list provided or list is empty");return p}function C4(a){return Array.isArray(a)?a:[]}function Ip(a){return Number(a)}function Ngt(a){if(!a||a.length===0)throw new TypeError("No input lists provided");if(!a.every(n=>Array.isArray(n)))throw new TypeError("All inputs must be arrays");const[p,...t]=a;return t.reduce((n,s)=>n.concat(s),p)}function _gt(a,...p){if(!Array.isArray(a))throw new TypeError("First input must be an array");if(!p.every(t=>Array.isArray(t)))throw new TypeError("All subsequent inputs must be arrays");return a.concat(...p)}function $gt(a,p){const t=$c(a),n=Ip(p);return[t.slice(0,n),t.slice(n)]}function Ggt(a){return $c(a).slice().reverse()}function Lgt(a){return $c(a).slice(0,-1)}function Bgt(a){return $c(a).slice(1)}function Sgt(a,p,t){const n=$l(a),s=Ip(p);if(s<0||s>n.length)throw new TypeError("Index out of bounds");return[...n.slice(0,s),t,...n.slice(s)]}function Mgt(a,p,t){const n=$c(a),s=Ip(p);if(s<0||s>=n.length)throw new TypeError("Index out of bounds");const u=[...n];return u[s]=t,u}function Fgt(a,p,t){const n=$c(a),s=n.indexOf(p);if(s===-1)return n;const u=[...n];return u[s]=t,u}function kgt(a,p,t){const n=$c(a),s=n.lastIndexOf(p);if(s===-1)return n;const u=[...n];return u[s]=t,u}function Ugt(a,p,t){return $c(a).map(s=>s===p?t:s)}function Kgt(a,p){const t=$c(a),n=Ip(p);if(n<0||n>=t.length)throw new TypeError("Index out of bounds");return t[n]}function jgt(a){return $c(a)[0]}function qgt(a){const p=$c(a);return p[p.length-1]}function Zgt(a,p,...t){return[...$l(a),p,...t]}function Hgt(a,p){const t=$l(a);return[p,...t]}function Wgt(a){return $l(a).length}function zgt(a,p){const t=$l(a),n=Ip(p);if(n<0||n>=t.length)throw new TypeError("Index out of bounds");return t.slice(0,n).concat(t.slice(n+1))}function Ygt(a,p){const t=$l(a),n=Math.max(0,Ip(p)??0);return t.slice(0,n)}function Jgt(a,p){const t=$l(a),n=Math.max(0,Ip(p)??0);return n===0?[]:t.slice(-n)}function Qgt(a,p,t){const n=$l(a),s=p==null?void 0:Ip(p),u=t==null?void 0:Ip(t);return n.slice(s,u)}function Xgt(a,p){return $l(a).indexOf(p)}function ebt(a,p){return $l(a).lastIndexOf(p)}function tbt(a){const p=$l(a),t=[],n=new Set;for(const s of p)n.has(s)||(n.add(s),t.push(s));return t}function ibt(a){return $l(a).reduce((t,n)=>t.concat(n),[])}function nbt(a){const p=$l(a);if(p.length<=1)return[...p];const t=p[0],n=typeof t=="number"&&p.every(e=>typeof e=="number"&&Number.isFinite(e)),s=typeof t=="string"&&p.every(e=>typeof e=="string");let u=null;if(n?u="number":s&&(u=p.every(f=>Ubn.test(f)&&j(f).isValid())?"date":"string"),!u)throw new TypeError("All items must be of the same supported type: number, string, or ISO date string.");return u==="number"?[...p].sort((e,f)=>e-f):u==="string"?[...p].sort((e,f)=>e.localeCompare(f)):[...p].sort((e,f)=>j(e).valueOf()-j(f).valueOf())}function rbt(a){const t=[...$l(a)];for(let n=t.length-1;n>0;n--){const s=Math.floor(sV()*(n+1));[t[n],t[s]]=[t[s],t[n]]}return t}function abt(a,p){const t=$l(a),n=Math.max(1,Ip(p)||1),s=[];for(let u=0;u<t.length;u+=n)s.push(t.slice(u,u+n));return s}function sbt(a,p,t){const n=$l(a),s=Math.max(0,Ip(p)||0);if(n.length>=s)return[...n];const u=s-n.length;return Array(u).fill(t).concat(n)}function lbt(a,p,t){const n=$l(a),s=Math.max(0,Ip(p)||0);if(n.length>=s)return[...n];const u=s-n.length,e=Array(u).fill(t);return n.concat(e)}function obt(a,p){const t=$l(a),n=Math.max(0,Ip(p)||0),s=[];for(let u=0;u<n;u++)s.push(...t);return s}function dbt(a,p){if(!D4(p))throw new TypeError("Contains expects the needle to be a primitive (string | number | boolean | null).");return C4(a).some(n=>n===p)}function pbt(a,p){const t=C4(a),n=Array.isArray(p)?p:[p];if(n.length===0)return!1;if(!n.every(D4))throw new TypeError("ContainsAll expects all needles to be primitives (string | number | boolean | null).");return n.every(s=>t.includes(s))}function ubt(a,p){const t=C4(a),n=Array.isArray(p)?p:[p];if(n.length===0)return!1;if(!n.every(D4))throw new TypeError("ContainsAny expects all needles to be primitives (string | number | boolean | null).");return n.some(s=>t.includes(s))}class cbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_JOIN,version:"1.0.0",description:"List join operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(Re.Join);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(A=>{var O,P;return((P=(O=A.valueOwner)==null?void 0:O.declaration)==null?void 0:P.id)===G.operation[Re.Join].inputs.firstList.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(A=>{var O,P;return((P=(O=A.valueOwner)==null?void 0:O.declaration)==null?void 0:P.id)===G.operation[Re.Join].inputs.separator.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),R=n.filter(A=>{var O,P;return((P=(O=A.valueOwner)==null?void 0:O.declaration)==null?void 0:P.id)===G.operation[Re.Join].inputs.secondList.id}).map(A=>{var O,P;return((O=A.value)==null?void 0:O.valueAsType)??((P=A.value)==null?void 0:P.value)}),I=Ngt([m,g,...R]);return{value:K.Success,error:null,result:I}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class fbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SPLIT,version:"1.0.0",description:"List split operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(Re.Split);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(I=>{var A,O;return((O=(A=I.valueOwner)==null?void 0:A.declaration)==null?void 0:O.id)===G.operation[Re.Split].inputs.list.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(I=>{var A,O;return((O=(A=I.valueOwner)==null?void 0:A.declaration)==null?void 0:O.id)===G.operation[Re.Split].inputs.index.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),[b,R]=$gt(m,g);return{value:K.Success,error:null,result:[b,R]}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class ybt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REVERSE,version:"1.0.0",description:"List reverse operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(Re.Reverse);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[Re.Reverse].inputs.listValue.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=Ggt(f);return{value:K.Success,error:null,result:y}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class hbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_LAST_N_ITEMS,version:"1.0.0",description:"List delete last operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(Re.DeleteLastNItems);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[Re.DeleteLastNItems].inputs.listValue.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=Lgt(f);return{value:K.Success,error:null,result:y}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class mbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_FIRST_N_ITEMS,version:"1.0.0",description:"List delete first operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(Re.DeleteFirstNItems);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[Re.DeleteFirstNItems].inputs.listValue.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=Bgt(f);return{value:K.Success,error:null,result:y}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class Tbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_ADD_AT_INDEX,version:"1.0.0",description:"List add index operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(Re.AddAtIndex);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[Re.AddAtIndex].inputs.listValue.id}),g=((s=T==null?void 0:T.value)==null?void 0:s.valueAsType)??((u=T==null?void 0:T.value)==null?void 0:u.value),b=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[Re.AddAtIndex].inputs.index.id}),R=((e=b==null?void 0:b.value)==null?void 0:e.valueAsType)??((f=b==null?void 0:b.value)==null?void 0:f.value),I=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[Re.AddAtIndex].inputs.value.id}),A=((y=I==null?void 0:I.value)==null?void 0:y.valueAsType)??((m=I==null?void 0:I.value)==null?void 0:m.value),O=Sgt(g,R,A);return{value:K.Success,error:null,result:O}}catch(T){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class vbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_AT_INDEX,version:"1.0.0",description:"List replace index operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(Re.ReplaceAtIndex);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[Re.ReplaceAtIndex].inputs.listValue.id}),g=((s=T==null?void 0:T.value)==null?void 0:s.valueAsType)??((u=T==null?void 0:T.value)==null?void 0:u.value),b=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[Re.ReplaceAtIndex].inputs.index.id}),R=((e=b==null?void 0:b.value)==null?void 0:e.valueAsType)??((f=b==null?void 0:b.value)==null?void 0:f.value),I=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[Re.ReplaceAtIndex].inputs.value.id}),A=((y=I==null?void 0:I.value)==null?void 0:y.valueAsType)??((m=I==null?void 0:I.value)==null?void 0:m.value),O=Mgt(g,R,A);return{value:K.Success,error:null,result:O}}catch(T){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class gbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_FIRST_N_ITEMS,version:"1.0.0",description:"List replace first operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(Re.ReplaceFirstNItems);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[Re.ReplaceFirstNItems].inputs.listValue.id}),g=((s=T==null?void 0:T.value)==null?void 0:s.valueAsType)??((u=T==null?void 0:T.value)==null?void 0:u.value),b=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[Re.ReplaceFirstNItems].inputs.searchValue.id}),R=((e=b==null?void 0:b.value)==null?void 0:e.valueAsType)??((f=b==null?void 0:b.value)==null?void 0:f.value),I=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[Re.ReplaceFirstNItems].inputs.replaceValue.id}),A=((y=I==null?void 0:I.value)==null?void 0:y.valueAsType)??((m=I==null?void 0:I.value)==null?void 0:m.value),O=Fgt(g,R,A);return{value:K.Success,error:null,result:O}}catch(T){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class bbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_LAST_N_ITEMS,version:"1.0.0",description:"List replace last operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(Re.ReplaceLastNItems);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[Re.ReplaceLastNItems].inputs.listValue.id}),g=((s=T==null?void 0:T.value)==null?void 0:s.valueAsType)??((u=T==null?void 0:T.value)==null?void 0:u.value),b=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[Re.ReplaceLastNItems].inputs.searchValue.id}),R=((e=b==null?void 0:b.value)==null?void 0:e.valueAsType)??((f=b==null?void 0:b.value)==null?void 0:f.value),I=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[Re.ReplaceLastNItems].inputs.replaceValue.id}),A=((y=I==null?void 0:I.value)==null?void 0:y.valueAsType)??((m=I==null?void 0:I.value)==null?void 0:m.value),O=kgt(g,R,A);return{value:K.Success,error:null,result:O}}catch(T){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class Ebt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_ALL,version:"1.0.0",description:"List replace all operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(Re.ReplaceAll);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[Re.ReplaceAll].inputs.listValue.id}),g=((s=T==null?void 0:T.value)==null?void 0:s.valueAsType)??((u=T==null?void 0:T.value)==null?void 0:u.value),b=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[Re.ReplaceAll].inputs.searchValue.id}),R=((e=b==null?void 0:b.value)==null?void 0:e.valueAsType)??((f=b==null?void 0:b.value)==null?void 0:f.value),I=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[Re.ReplaceAll].inputs.replaceValue.id}),A=((y=I==null?void 0:I.value)==null?void 0:y.valueAsType)??((m=I==null?void 0:I.value)==null?void 0:m.value),O=Ugt(g,R,A);return{value:K.Success,error:null,result:O}}catch(T){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class Ibt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_INDEX_ITEM,version:"1.0.0",description:"List get index item operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(Re.GetIndexItem);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[Re.GetIndexItem].inputs.listValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[Re.GetIndexItem].inputs.index.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),b=Kgt(m,g);return{value:K.Success,error:null,result:b}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class Rbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_FIRST,version:"1.0.0",description:"List get first operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(Re.GetFirst);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[Re.GetFirst].inputs.listValue.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=jgt(f);return{value:K.Success,error:null,result:y}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class Abt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST,version:"1.0.0",description:"List get last operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(Re.GetLast);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[Re.GetLast].inputs.list.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=qgt(f);return{value:K.Success,error:null,result:y}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class Dbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_APPEND,version:"1.0.0",description:"List append operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(Re.Append);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(A=>{var O,P;return((P=(O=A.valueOwner)==null?void 0:O.declaration)==null?void 0:P.id)===G.operation[Re.Append].inputs.list.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(A=>{var O,P;return((P=(O=A.valueOwner)==null?void 0:O.declaration)==null?void 0:P.id)===G.operation[Re.Append].inputs.elementToAppend.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),R=n.filter(A=>{var O,P;return((P=(O=A.valueOwner)==null?void 0:O.declaration)==null?void 0:P.id)===G.operation[Re.Append].inputs.dynamicArgument.id}).map(A=>{var O,P;return((O=A.value)==null?void 0:O.valueAsType)??((P=A.value)==null?void 0:P.value)}),I=Zgt(m,g,...R);return{value:K.Success,error:null,result:I}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class Cbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PREPEND,version:"1.0.0",description:"List prepend operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(Re.Prepend);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[Re.Prepend].inputs.listValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[Re.Prepend].inputs.value.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),b=Hgt(m,g);return{value:K.Success,error:null,result:b}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class wbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LENGTH,version:"1.0.0",description:"List get length",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Re.GetLength);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u;try{const e=n.find(y=>{var m,T;return((T=(m=y.valueOwner)==null?void 0:m.declaration)==null?void 0:T.id)===G.operation[Re.GetLength].inputs.listValue.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value);return{value:K.Success,error:null,result:Wgt(f)}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class Obt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.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:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Re.DeleteAtIndex);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[Re.DeleteAtIndex].inputs.listValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[Re.DeleteAtIndex].inputs.index.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),b=zgt(m,g);return{value:K.Success,error:null,result:b}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class xbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_FIRST_N_ITEMS,version:"1.0.0",description:"List get first N items",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Re.GetFirstNItems);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[Re.GetFirstNItems].inputs.listValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[Re.GetFirstNItems].inputs.count.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),b=Ygt(m,g);return{value:K.Success,error:null,result:b}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class Pbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST_N_ITEMS,version:"1.0.0",description:"List get last N items",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Re.GetLastNItems);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[Re.GetLastNItems].inputs.listValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[Re.GetLastNItems].inputs.count.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),b=Jgt(m,g);return{value:K.Success,error:null,result:b}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class Vbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SLICE,version:"1.0.0",description:"List slice(start, end)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Re.Slice);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[Re.Slice].inputs.listValue.id}),g=((s=T==null?void 0:T.value)==null?void 0:s.valueAsType)??((u=T==null?void 0:T.value)==null?void 0:u.value),b=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[Re.Slice].inputs.startIndex.id}),R=((e=b==null?void 0:b.value)==null?void 0:e.valueAsType)??((f=b==null?void 0:b.value)==null?void 0:f.value),I=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[Re.Slice].inputs.endIndex.id}),A=((y=I==null?void 0:I.value)==null?void 0:y.valueAsType)??((m=I==null?void 0:I.value)==null?void 0:m.value),O=Qgt(g,R,A);return{value:K.Success,error:null,result:O}}catch(T){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class Nbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONCAT,version:"1.0.0",description:"List concat(base, ...others)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Re.Concat);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const s=n.map(y=>{var m,T;return((m=y.value)==null?void 0:m.valueAsType)??((T=y.value)==null?void 0:T.value)}),[u,...e]=s,f=_gt(u,...e);return{value:K.Success,error:null,result:f}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class _bt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_INDEX_OF,version:"1.0.0",description:"List listGetIndexOf(value)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Re.GetIndexOf);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[Re.GetIndexOf].inputs.listValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[Re.GetIndexOf].inputs.searchValue.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),b=Xgt(m,g);return{value:K.Success,error:null,result:b}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class $bt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST_INDEX_OF,version:"1.0.0",description:"List listGetLastIndexOf(value)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Re.GetLastIndexOf);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[Re.GetLastIndexOf].inputs.listValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[Re.GetLastIndexOf].inputs.searchValue.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),b=ebt(m,g);return{value:K.Success,error:null,result:b}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class Gbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_UNIQUE,version:"1.0.0",description:"List unique (stable, by reference/===)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Re.Unique);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[Re.Unique].inputs.listValue.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=tbt(f);return{value:K.Success,error:null,result:y}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class Lbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_FLATTEN,version:"1.0.0",description:"List flatten one level",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Re.Flatten);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[Re.Flatten].inputs.listValue.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=ibt(f);return{value:K.Success,error:null,result:y}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class Bbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.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:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Re.Sort);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[Re.Sort].inputs.listValue.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=nbt(f);return{value:K.Success,error:null,result:y}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class Sbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SHUFFLE,version:"1.0.0",description:"List shuffle (Fisher–Yates, secure RNG helper)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Re.Shuffle);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u;try{const e=n.find(m=>{var T,g;return((g=(T=m.valueOwner)==null?void 0:T.declaration)==null?void 0:g.id)===G.operation[Re.Shuffle].inputs.listValue.id}),f=((s=e==null?void 0:e.value)==null?void 0:s.valueAsType)??((u=e==null?void 0:e.value)==null?void 0:u.value),y=rbt(f);return{value:K.Success,error:null,result:y}}catch(e){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:e,result:null}}}})}}class Mbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CHUNK,version:"1.0.0",description:"List chunk(size) -> list of lists",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Re.Chunk);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[Re.Chunk].inputs.listValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[Re.Chunk].inputs.size.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),b=abt(m,g);return{value:K.Success,error:null,result:b}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class Fbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PAD_START,version:"1.0.0",description:"List padStart(targetLength, padValue)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Re.PadStart);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[Re.PadStart].inputs.listValue.id}),g=((s=T==null?void 0:T.value)==null?void 0:s.valueAsType)??((u=T==null?void 0:T.value)==null?void 0:u.value),b=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[Re.PadStart].inputs.targetLength.id}),R=((e=b==null?void 0:b.value)==null?void 0:e.valueAsType)??((f=b==null?void 0:b.value)==null?void 0:f.value),I=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[Re.PadStart].inputs.padValue.id}),A=((y=I==null?void 0:I.value)==null?void 0:y.valueAsType)??((m=I==null?void 0:I.value)==null?void 0:m.value),O=sbt(g,R,A);return{value:K.Success,error:null,result:O}}catch(T){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class kbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PAD_END,version:"1.0.0",description:"List padEnd(targetLength, padValue)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Re.PadEnd);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[Re.PadEnd].inputs.listValue.id}),g=((s=T==null?void 0:T.value)==null?void 0:s.valueAsType)??((u=T==null?void 0:T.value)==null?void 0:u.value),b=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[Re.PadEnd].inputs.targetLength.id}),R=((e=b==null?void 0:b.value)==null?void 0:e.valueAsType)??((f=b==null?void 0:b.value)==null?void 0:f.value),I=n.find(P=>{var x,$;return(($=(x=P.valueOwner)==null?void 0:x.declaration)==null?void 0:$.id)===G.operation[Re.PadEnd].inputs.padValue.id}),A=((y=I==null?void 0:I.value)==null?void 0:y.valueAsType)??((m=I==null?void 0:I.value)==null?void 0:m.value),O=lbt(g,R,A);return{value:K.Success,error:null,result:O}}catch(T){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class Ubt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPEAT,version:"1.0.0",description:"List repeat(count)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Re.Repeat);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[Re.Repeat].inputs.listValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[Re.Repeat].inputs.count.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),b=obt(m,g);return{value:K.Success,error:null,result:b}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class Kbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONTAINS,version:"1.0.0",description:"List contains (primitive needles)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Re.Contains);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[Re.Contains].inputs.list.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[Re.Contains].inputs.needle.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),b=dbt(m,g);return{value:K.Success,error:null,result:b}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class jbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONTAINS_ALL,version:"1.0.0",description:"List contains all (primitive needles)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Re.ContainsAll);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[Re.ContainsAll].inputs.list.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[Re.ContainsAll].inputs.needle.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),b=pbt(m,g);return{value:K.Success,error:null,result:b}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class qbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONTAINS_ANY,version:"1.0.0",description:"List contains any (primitive needles)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Re.ContainsAny);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[Re.ContainsAny].inputs.list.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(R=>{var I,A;return((A=(I=R.valueOwner)==null?void 0:I.declaration)==null?void 0:A.id)===G.operation[Re.ContainsAny].inputs.needle.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),b=ubt(m,g);return{value:K.Success,error:null,result:b}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class Kbn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LENGTH,version:"1.0.0",description:"Returns the number of characters in a string",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(he.GetLength);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s]=n.map(e=>{var f,y;return((f=e.value)==null?void 0:f.valueAsType)??((y=e.value)==null?void 0:y.value)}),u=s.length;return{value:K.Success,error:null,result:u}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class Zbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_JOIN,version:"1.0.0",description:"String join operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(he.Join);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e;try{const f=n.find(O=>{var P,x;return((x=(P=O.valueOwner)==null?void 0:P.declaration)==null?void 0:x.id)===G.operation[he.Join].inputs.separator.id}),y=((s=f==null?void 0:f.value)==null?void 0:s.value)||"",m=n.find(O=>{var P,x;return((x=(P=O.valueOwner)==null?void 0:P.declaration)==null?void 0:x.id)===G.operation[he.Join].inputs.first.id}),T=((u=m==null?void 0:m.value)==null?void 0:u.value)||"",g=n.find(O=>{var P,x;return((x=(P=O.valueOwner)==null?void 0:P.declaration)==null?void 0:x.id)===G.operation[he.Join].inputs.second.id}),b=((e=g==null?void 0:g.value)==null?void 0:e.value)||"",I=n.filter(O=>{var P,x;return((x=(P=O.valueOwner)==null?void 0:P.declaration)==null?void 0:x.id)===G.operation[he.Join].inputs.dynamicString.id}).map(O=>{var P,x;return((P=O.value)==null?void 0:P.valueAsType)||((x=O.value)==null?void 0:x.value)||""}),A=[T,b,...I].join(y);return{value:K.Success,error:null,result:A}}catch(f){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:f,result:null}}}})}}class Hbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT_AT_INDEX,version:"1.0.0",description:"String split at index operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(he.SplitAtIndex);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const s=n.map(y=>{var m,T;return((m=y.value)==null?void 0:m.valueAsType)||((T=y.value)==null?void 0:T.value)}),u=s[0],e=s[1],f={firstPart:u.slice(0,e),secondPart:u.slice(e)};return{value:K.Success,error:null,result:f}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class Wbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.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:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(he.SplitAtAllSeparators);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const s=n.map(y=>{var m,T;return((m=y.value)==null?void 0:m.valueAsType)||((T=y.value)==null?void 0:T.value)}),u=s[0],e=s[1],f=u.split(e);return{value:K.Success,error:null,result:f}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class zbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.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:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(he.SplitAtFirstSeparator);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const s=n.map(m=>{var T,g;return((T=m.value)==null?void 0:T.valueAsType)||((g=m.value)==null?void 0:g.value)}),u=s[0],e=s[1],f=u.indexOf(e),y={firstPart:u.slice(0,f),secondPart:u.slice(f+e.length)};return{value:K.Success,error:null,result:y}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class Ybt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.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:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(he.SplitAtLastSeparator);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const s=n.map(m=>{var T,g;return((T=m.value)==null?void 0:T.valueAsType)||((g=m.value)==null?void 0:g.value)}),u=s[0],e=s[1],f=u.lastIndexOf(e),y={firstPart:u.slice(0,f),secondPart:u.slice(f+e.length)};return{value:K.Success,error:null,result:y}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class Jbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.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:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(he.DeleteLastNChars);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const s=n.map(y=>{var m,T;return((m=y.value)==null?void 0:m.valueAsType)||((T=y.value)==null?void 0:T.value)}),u=s[0],e=s[1]??1;if(typeof u!="string")return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:"No string provided",result:null};const f=u.slice(0,-e);return{value:K.Success,error:null,result:f}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class Qbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.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:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(he.DeleteFirstNChars);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const s=n.map(y=>{var m,T;return((m=y.value)==null?void 0:m.valueAsType)||((T=y.value)==null?void 0:T.value)}),u=s[0],e=s[1]??1;if(typeof u!="string")return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:"No string provided",result:null};const f=u.slice(0,e);return{value:K.Success,error:null,result:f}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class Xbt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REVERSE,version:"1.0.0",description:"String reverse operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(he.Reverse);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const u=n.map(f=>{var y,m;return((y=f.value)==null?void 0:y.valueAsType)||((m=f.value)==null?void 0:m.value)})[0];if(typeof u!="string")return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:"No string provided",result:null};const e=u.split("").reverse().join("");return{value:K.Success,error:null,result:e}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class eEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TO_LOWER_CASE,version:"1.0.0",description:"String to lower case operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(he.ToLowerCase);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const u=n.map(f=>{var y,m;return((y=f.value)==null?void 0:y.valueAsType)||((m=f.value)==null?void 0:m.value)})[0];if(typeof u!="string")return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:"No string provided",result:null};const e=u.toLowerCase();return{value:K.Success,error:null,result:e}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class tEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TO_UPPER_CASE,version:"1.0.0",description:"String to upper case operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(he.ToUpperCase);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const u=n.map(f=>{var y,m;return((y=f.value)==null?void 0:y.valueAsType)||((m=f.value)==null?void 0:m.value)})[0];if(typeof u!="string")return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:"No string provided",result:null};const e=u.toUpperCase();return{value:K.Success,error:null,result:e}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class iEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_AT_INDEX,version:"1.0.0",description:"String delete index operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(he.DeleteAtIndex);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const s=n.map(T=>{var g,b;return((g=T.value)==null?void 0:g.valueAsType)||((b=T.value)==null?void 0:b.value)}),u=s[0],e=s[1],f=s[2]??1;if(typeof u!="string")return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:"No string provided",result:null};const y=Math.min(f,u.length-e),m=u.slice(0,e)+u.slice(e+y);return{value:K.Success,error:null,result:m}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class nEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ADD_AT_INDEX,version:"1.0.0",description:"String add index operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(he.AddAtIndex);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const s=n.map(m=>{var T,g;return((T=m.value)==null?void 0:T.valueAsType)||((g=m.value)==null?void 0:g.value)}),u=s[0],e=s[1],f=s[2];if(typeof u!="string")return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:"No string provided",result:null};const y=u.slice(0,e)+f+u.slice(e);return{value:K.Success,error:null,result:y}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class rEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_FIRST_N_CHARS,version:"1.0.0",description:"String replace first operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(he.ReplaceFirstNChars);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const s=n.map(m=>{var T,g;return((T=m.value)==null?void 0:T.valueAsType)||((g=m.value)==null?void 0:g.value)}),u=s[0],e=s[1]??1,f=s[2];if(typeof u!="string")return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:"No string provided",result:null};const y=f+u.slice(e);return{value:K.Success,error:null,result:y}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class aEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_LAST_N_CHARS,version:"1.0.0",description:"String replace last operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(he.ReplaceLastNChars);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const s=n.map(m=>{var T,g;return((T=m.value)==null?void 0:T.valueAsType)||((g=m.value)==null?void 0:g.value)}),u=s[0],e=s[1]??1,f=s[2];if(typeof u!="string")return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:"No string provided",result:null};const y=u.slice(0,-e)+f;return{value:K.Success,error:null,result:y}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class sEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_AT_INDEX,version:"1.0.0",description:"String replace index operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(he.ReplaceAtIndex);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const s=n.map(T=>{var g,b;return((g=T.value)==null?void 0:g.valueAsType)||((b=T.value)==null?void 0:b.value)}),u=s[0],e=s[1],f=s[2]??1,y=s[3];if(typeof u!="string")return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:"No string provided",result:null};const m=(u.slice(0,e)||"")+y+(u.slice(e+f)||"");return{value:K.Success,error:null,result:m}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class lEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_FIRST_MATCH,version:"1.0.0",description:"String replace single match operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(he.ReplaceFirstMatch);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const s=n.map(m=>{var T,g;return((T=m.value)==null?void 0:T.valueAsType)||((g=m.value)==null?void 0:g.value)}),u=s[0],e=s[1],f=s[2];if(typeof u!="string")return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:"No string provided",result:null};const y=u.replace(e,f);return{value:K.Success,error:null,result:y}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class oEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_LAST_MATCH,version:"1.0.0",description:"String replace single match operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(he.ReplaceLastMatch);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const s=n.map(T=>{var g,b;return((g=T.value)==null?void 0:g.valueAsType)||((b=T.value)==null?void 0:b.value)}),u=s[0],e=s[1],f=s[2];if(typeof u!="string")return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:"No string provided",result:null};const y=u.lastIndexOf(e),m=y===-1?u:u.substring(0,y)+f+u.substring(y+e.length);return{value:K.Success,error:null,result:m}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class dEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_ALL_MATCHES,version:"1.0.0",description:"String replace all matches operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(he.ReplaceAllMatches);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const s=n.map(m=>{var T,g;return((T=m.value)==null?void 0:T.valueAsType)||((g=m.value)==null?void 0:g.value)}),u=s[0],e=s[1],f=s[2];if(typeof u!="string")return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:"No string provided",result:null};const y=u.split(e).join(f);return{value:K.Success,error:null,result:y}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class pEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_INDEX_ITEM,version:"1.0.0",description:"String get index operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(he.GetIndexItem);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const s=n.map(y=>{var m,T;return((m=y.value)==null?void 0:m.valueAsType)||((T=y.value)==null?void 0:T.value)}),u=s[0],e=s[1];if(typeof u!="string")return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:"No string provided",result:null};const f=u.charAt(e);return{value:K.Success,error:null,result:f}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class uEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.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:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(he.GetLastNChars);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const s=n.map(y=>{var m,T;return((m=y.value)==null?void 0:m.valueAsType)||((T=y.value)==null?void 0:T.value)}),u=s[0],e=s[1];if(typeof u!="string")return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:"No string provided",result:null};const f=u.slice(-e);return{value:K.Success,error:null,result:f}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class cEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.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:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(he.GetFirstNChars);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const s=n.map(y=>{var m,T;return((m=y.value)==null?void 0:m.valueAsType)||((T=y.value)==null?void 0:T.value)}),u=s[0],e=s[1];if(typeof u!="string")return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:"No string provided",result:null};const f=u.slice(0,e);return{value:K.Success,error:null,result:f}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class fEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_INDEX_OF,version:"1.0.0",description:"String get index of operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(he.GetIndexOf);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const s=n.map(y=>{var m,T;return((m=y.value)==null?void 0:m.valueAsType)||((T=y.value)==null?void 0:T.value)}),u=s[0],e=s[1];if(typeof u!="string")return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:"No string provided",result:null};if(typeof e!="string")return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:"No search value provided",result:null};const f=u.indexOf(e);return{value:K.Success,error:null,result:f}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class yEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_APPEND,version:"1.0.0",description:"String append operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(he.Append);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(A=>{var O,P;return((P=(O=A.valueOwner)==null?void 0:O.declaration)==null?void 0:P.id)===G.operation[he.Append].inputs.stringValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(A=>{var O,P;return((P=(O=A.valueOwner)==null?void 0:O.declaration)==null?void 0:P.id)===G.operation[he.Append].inputs.valueToAppend.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),R=n.filter(A=>{var O,P;return((P=(O=A.valueOwner)==null?void 0:O.declaration)==null?void 0:P.id)===G.operation[he.Append].inputs.dynamicArgument.id}).map(A=>{var O,P;return((O=A.value)==null?void 0:O.valueAsType)??((P=A.value)==null?void 0:P.value)});if(typeof m!="string")return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:"No string provided",result:null};if(typeof g!="string")return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:"No value to append provided",result:null};if(!R.every(A=>typeof A=="string"))return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:"All values to append must be strings",result:null};const I=[m,g,...R].join("");return{value:K.Success,error:null,result:I}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class hEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PREPEND,version:"1.0.0",description:"String prepend operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(he.Prepend);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const s=n.map(y=>{var m,T;return((m=y.value)==null?void 0:m.valueAsType)||((T=y.value)==null?void 0:T.value)}),u=s[0],e=s[1];if(typeof u!="string")return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:"No string provided",result:null};const f=e+u;return{value:K.Success,error:null,result:f}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class mEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TRIM,version:"1.0.0",description:"String trim implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(he.Trim);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s]=n.map(e=>{var f,y;return((f=e.value)==null?void 0:f.valueAsType)??((y=e.value)==null?void 0:y.value)}),u=s.trim();return{value:K.Success,error:null,result:u}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class TEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TRIM_START,version:"1.0.0",description:"String trimStart implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(he.TrimStart);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s]=n.map(e=>{var f,y;return((f=e.value)==null?void 0:f.valueAsType)??((y=e.value)==null?void 0:y.value)}),u=s.trimStart();return{value:K.Success,error:null,result:u}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class vEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TRIM_END,version:"1.0.0",description:"String trimEnd implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(he.TrimEnd);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s]=n.map(e=>{var f,y;return((f=e.value)==null?void 0:f.valueAsType)??((y=e.value)==null?void 0:y.value)}),u=s.trimEnd();return{value:K.Success,error:null,result:u}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class gEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SUBSTRING,version:"1.0.0",description:"String substring(start, end?) implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(he.Substring);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u,e]=n.map(y=>{var m,T;return((m=y.value)==null?void 0:m.valueAsType)??((T=y.value)==null?void 0:T.value)}),f=s.substring(u,e??void 0);return{value:K.Success,error:null,result:f}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class bEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SLICE,version:"1.0.0",description:"String slice(start, end?) implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(he.Slice);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u,e]=n.map(y=>{var m,T;return((m=y.value)==null?void 0:m.valueAsType)??((T=y.value)==null?void 0:T.value)}),f=s.slice(u,e??void 0);return{value:K.Success,error:null,result:f}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class EEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LAST_INDEX_OF,version:"1.0.0",description:"String lastIndexOf(search, fromIndex?) implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(he.GetLastIndexOf);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u,e]=n.map(y=>{var m,T;return((m=y.value)==null?void 0:m.valueAsType)??((T=y.value)==null?void 0:T.value)}),f=s.lastIndexOf(u,e??void 0);return{value:K.Success,error:null,result:f}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class IEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PAD_START,version:"1.0.0",description:"String padStart(targetLength, padString?) implementation",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(he.PadStart);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u,e]=n.map(y=>{var m,T;return((m=y.value)==null?void 0:m.valueAsType)??((T=y.value)==null?void 0:T.value)}),f=s.padStart(u,e??void 0);return{value:K.Success,error:null,result:f}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class REt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PAD_END,version:"1.0.0",description:"String padEnd(targetLength, padString?) implementation",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(he.PadEnd);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u,e]=n.map(y=>{var m,T;return((m=y.value)==null?void 0:m.valueAsType)??((T=y.value)==null?void 0:T.value)}),f=s.padEnd(u,e??void 0);return{value:K.Success,error:null,result:f}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class AEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPEAT,version:"1.0.0",description:"String repeat(count) implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(he.Repeat);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u]=n.map(f=>{var y,m;return((y=f.value)==null?void 0:y.valueAsType)??((m=f.value)==null?void 0:m.value)}),e=s.repeat(u);return{value:K.Success,error:null,result:e}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class DEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_MATCH_REGEX,version:"1.0.0",description:"String match(regex) -> first match array or null",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(he.MatchRegex);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u,e]=n.map(m=>{var T,g;return((T=m.value)==null?void 0:T.valueAsType)??((g=m.value)==null?void 0:g.value)}),f=new RegExp(String(u??""),e?String(e):void 0),y=String(s??"").match(f);return{value:K.Success,error:null,result:y}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class CEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_MATCH_ALL_REGEX,version:"1.0.0",description:"String matchAll(regex) -> array of matches",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(he.MatchAllRegex);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u,e]=n.map(g=>{var b,R;return((b=g.value)==null?void 0:b.valueAsType)??((R=g.value)==null?void 0:R.value)}),f=e?String(e):"",y=f.includes("g")?f:f+"g",m=new RegExp(String(u??""),y),T=Array.from(String(s??"").matchAll(m),g=>Array.from(g));return{value:K.Success,error:null,result:T}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class wEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SEARCH_REGEX,version:"1.0.0",description:"String search(regex) -> index or -1",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(he.SearchRegex);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u,e]=n.map(y=>{var m,T;return((m=y.value)==null?void 0:m.valueAsType)??((T=y.value)==null?void 0:T.value)});let f=-1;try{const y=new RegExp(String(u??""),e?String(e):void 0);f=String(s??"").search(y)}catch{f=-1}return{value:K.Success,error:null,result:f}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class OEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_REGEX,version:"1.0.0",description:"String replace using RegExp (pattern, replacement, flags?)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(he.ReplaceRegex);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u,e,f]=n.map(T=>{var g,b;return((g=T.value)==null?void 0:g.valueAsType)??((b=T.value)==null?void 0:b.value)});let y=String(s??"");const m=new RegExp(String(u??""),f?String(f):void 0);return y=y.replace(m,String(e??"")),{value:K.Success,error:null,result:y}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class xEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_NORMALIZE_UNICODE,version:"1.0.0",description:"String normalize(form?) implementation module (NFC by default)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(he.NormalizeUnicode);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u]=n.map(f=>{var y,m;return((y=f.value)==null?void 0:y.valueAsType)??((m=f.value)==null?void 0:m.value)}),e=s.normalize(u||"NFC");return{value:K.Success,error:null,result:e}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}const AO=class AO extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REMOVE_DIACRITICS,version:"1.0.0",description:"Remove diacritics via NFD decomposition + strip combining marks",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(he.RemoveDiacritics);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s]=n.map(e=>{var f,y;return((f=e.value)==null?void 0:f.valueAsType)??((y=e.value)==null?void 0:y.value)}),u=String(s??"").normalize("NFD").replace(AO.COMBINING_MARKS,"");return{value:K.Success,error:null,result:u}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}};C(AO,"COMBINING_MARKS",/[\u0300-\u036f]/g);let Xw=AO;class PEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_COUNT_OCCURRENCES,version:"1.0.0",description:"Count literal substring occurrences in a string",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(he.CountOccurrences);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u]=n.map(m=>{var T,g;return((T=m.value)==null?void 0:T.valueAsType)??((g=m.value)==null?void 0:g.value)}),e=String(s??""),f=String(u??""),y=f===""?0:e.split(f).length-1;return{value:K.Success,error:null,result:y}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class VEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.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:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(he.EnsurePrefix);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u]=n.map(m=>{var T,g;return((T=m.value)==null?void 0:T.valueAsType)??((g=m.value)==null?void 0:g.value)}),e=String(s??""),f=String(u??""),y=e.startsWith(f)?e:f+e;return{value:K.Success,error:null,result:y}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class NEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.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:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(he.EnsureSuffix);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u]=n.map(m=>{var T,g;return((T=m.value)==null?void 0:T.valueAsType)??((g=m.value)==null?void 0:g.value)}),e=String(s??""),f=String(u??""),y=e.endsWith(f)?e:e+f;return{value:K.Success,error:null,result:y}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class _Et extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REMOVE_PREFIX,version:"1.0.0",description:"Remove prefix if present",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(he.RemovePrefix);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u]=n.map(m=>{var T,g;return((T=m.value)==null?void 0:T.valueAsType)??((g=m.value)==null?void 0:g.value)}),e=String(s??""),f=String(u??""),y=e.startsWith(f)?e.slice(f.length):e;return{value:K.Success,error:null,result:y}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class $Et extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REMOVE_SUFFIX,version:"1.0.0",description:"Remove suffix if present",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(he.RemoveSuffix);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u]=n.map(m=>{var T,g;return((T=m.value)==null?void 0:T.valueAsType)??((g=m.value)==null?void 0:g.value)}),e=String(s??""),f=String(u??""),y=e.endsWith(f)?e.slice(0,-f.length):e;return{value:K.Success,error:null,result:y}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class GEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_STARTS_WITH,version:"1.0.0",description:"String startsWith(needle) -> boolean",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(he.StartsWith);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u]=n.map(f=>{var y,m;return((y=f.value)==null?void 0:y.valueAsType)??((m=f.value)==null?void 0:m.value)});if(typeof s!="string"||typeof u!="string")throw new TypeError("StartsWith expects two strings.");const e=s.startsWith(u);return{value:K.Success,error:null,result:e}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class LEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ENDS_WITH,version:"1.0.0",description:"String endsWith(needle) -> boolean",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(he.EndsWith);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u]=n.map(f=>{var y,m;return((y=f.value)==null?void 0:y.valueAsType)??((m=f.value)==null?void 0:m.value)});if(typeof s!="string"||typeof u!="string")throw new TypeError("EndsWith expects two strings.");const e=s.endsWith(u);return{value:K.Success,error:null,result:e}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class BEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_CONTAINS,version:"1.0.0",description:"String includes(needle) -> boolean",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(he.Contains);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u]=n.map(f=>{var y,m;return((y=f.value)==null?void 0:y.valueAsType)??((m=f.value)==null?void 0:m.value)});if(typeof s!="string"||typeof u!="string")throw new TypeError("Contains expects two strings.");const e=s.includes(u);return{value:K.Success,error:null,result:e}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class SEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.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:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(he.MatchesRegex);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u,e]=n.map(m=>{var T,g;return((T=m.value)==null?void 0:T.valueAsType)??((g=m.value)==null?void 0:g.value)});if(typeof s!="string"||typeof u!="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(u,e).test(s),{value:K.Success,error:null,result:f}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}function MEt(a,p){const t=Number(a),s=10**Math.max(0,Number(p)||0);return Math.round(t*s)/s}function FEt(a,p){const t=Number(a),n=Math.abs(Number(p)||0);return n===0?t:Math.round(t/n)*n}function kEt(a,p,t){const n=Number(a),s=Number(p),u=Number(t);return Math.min(Math.max(n,s),u)}function UEt(a,p,t,n,s){const u=Number(a),e=Number(p),f=Number(t),y=Number(n),m=Number(s);if(e===f)throw new Error("Input range cannot be zero");const T=(u-e)/(f-e);return y+T*(m-y)}function KEt(...a){const p=a.map(n=>Number(n));return p.length===0?0:p.reduce((n,s)=>n+s,0)/p.length}function jEt(...a){const p=a.map(n=>Number(n)).sort((n,s)=>n-s);if(p.length===0)return 0;const t=Math.floor(p.length/2);return p.length%2?p[t]:(p[t-1]+p[t])/2}function qEt(a,p){const t=Number(a),n=Number(p);return n===0?NaN:t<0&&n%2===1?-Math.pow(-t,1/n):Math.pow(t,1/n)}function ZEt(a,p){const t=Number(a),n=Number(p);return t===0?1/0:(n-t)/t*100}const Mr=a=>a.map(p=>{var t,n;return((t=p.value)==null?void 0:t.valueAsType)??((n=p.value)==null?void 0:n.value)});class HEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ADDITION,version:"1.0.0",description:"Number addition operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(Ae.Addition);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const u=Mr(n).reduce((e,f)=>e+f,0);return{value:K.Success,error:null,result:u}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class WEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SUBTRACTION,version:"1.0.0",description:"Number subtraction operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(Ae.Subtraction);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const u=Mr(n).reduce((e,f)=>e-f,0);return{value:K.Success,error:null,result:u}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class zEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MULTIPLICATION,version:"1.0.0",description:"Number multiplication operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(Ae.Multiplication);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(O=>{var P,x;return((x=(P=O.valueOwner)==null?void 0:P.declaration)==null?void 0:x.id)===G.operation[Ae.Multiplication].inputs.firstFactor.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(O=>{var P,x;return((x=(P=O.valueOwner)==null?void 0:P.declaration)==null?void 0:x.id)===G.operation[Ae.Multiplication].inputs.secondFactor.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),R=n.filter(O=>{var P,x;return((x=(P=O.valueOwner)==null?void 0:P.declaration)==null?void 0:x.id)===G.operation[Ae.Multiplication].inputs.dynamicFactor.id}).map(O=>{var P,x;return((P=O.value)==null?void 0:P.valueAsType)??((x=O.value)==null?void 0:x.value)}),A=[m,g,...R].reduce((O,P)=>O*P,1);return{value:K.Success,error:null,result:A}}catch(y){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:y,result:null}}}})}}class YEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_DIVISION,version:"1.0.0",description:"Number division operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(Ae.Division);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const[s,u]=Mr(n);if(u===0)throw new Error("Division by zero is not allowed");const e=s/u;return{value:K.Success,error:null,result:e}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class JEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_REMAINDER,version:"1.0.0",description:"Number remainder operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(Ae.Remainder);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const[s,u]=Mr(n);if(u===0)throw new Error("Division by zero is not allowed");const e=s%u;return{value:K.Success,error:null,result:e}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class QEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_EXPONENTIATION,version:"1.0.0",description:"Number exponentiation operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(Ae.Exponentiation);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(t,n)=>{try{const[s,u]=Mr(n),e=Math.pow(s,u);return{value:K.Success,error:null,result:e}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class XEt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_NEGATE,version:"1.0.0",description:"Number negate (unary -x)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.Negate);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s]=Mr(n);return{value:K.Success,error:null,result:-s}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class eIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ABSOLUTE,version:"1.0.0",description:"Number absolute (|x|)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.Absolute);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s]=Mr(n);return{value:K.Success,error:null,result:Math.abs(Number(s))}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class tIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SIGN,version:"1.0.0",description:"Number sign (-1 | 0 | 1)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.Sign);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s]=Mr(n);return{value:K.Success,error:null,result:Math.sign(Number(s))}}catch(s){return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:s,result:null}}}})}}class iIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ROUND,version:"1.0.0",description:"Number round to nearest integer",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.Round);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s]=Mr(n);return{value:K.Success,error:null,result:Math.round(Number(s))}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}class nIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_FLOOR,version:"1.0.0",description:"Number floor (⌊x⌋)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.Floor);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s]=Mr(n);return{value:K.Success,error:null,result:Math.floor(Number(s))}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}class rIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_CEIL,version:"1.0.0",description:"Number ceil (⌈x⌉)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.Ceil);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s]=Mr(n);return{value:K.Success,error:null,result:Math.ceil(Number(s))}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}class aIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TRUNC,version:"1.0.0",description:"Number truncation (drop fractional part)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.Trunc);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s]=Mr(n);return{value:K.Success,error:null,result:Math.trunc(Number(s))}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}class sIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ROUND_TO_DECIMALS,version:"1.0.0",description:"Round to N decimals",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.RoundToDecimals);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u]=Mr(n),e=MEt(s,u);return{value:K.Success,error:null,result:e}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}class lIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.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:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.SnapToStep);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u]=Mr(n),e=FEt(s,u);return{value:K.Success,error:null,result:e}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}class oIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_CLAMP,version:"1.0.0",description:"Clamp value to [min, max]",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.Clamp);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u,e]=Mr(n),f=kEt(s,u,e);return{value:K.Success,error:null,result:f}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}class dIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MAP_RANGE,version:"1.0.0",description:"Map value from [inMin,inMax] to [outMin,outMax]",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.MapRange);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u,e,f,y]=Mr(n),m=UEt(s,u,e,f,y);return{value:K.Success,error:null,result:m}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}class pIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_AVERAGE,version:"1.0.0",description:"Average(numbers...)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.Average);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(O=>{var P,x;return((x=(P=O.valueOwner)==null?void 0:P.declaration)==null?void 0:x.id)===G.operation[Ae.Average].inputs.firstValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(O=>{var P,x;return((x=(P=O.valueOwner)==null?void 0:P.declaration)==null?void 0:x.id)===G.operation[Ae.Average].inputs.secondValue.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),R=n.filter(O=>{var P,x;return((x=(P=O.valueOwner)==null?void 0:P.declaration)==null?void 0:x.id)===G.operation[Ae.Average].inputs.dynamicValue.id}).map(O=>{var P,x;return((P=O.value)==null?void 0:P.valueAsType)??((x=O.value)==null?void 0:x.value)}),I=[m,g,...R],A=KEt(...I);return{value:K.Success,error:null,result:A}}catch(y){return{value:K.UnhandledError,error:y,result:null}}}})}}class uIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MEDIAN,version:"1.0.0",description:"Median(numbers...)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.Median);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(O=>{var P,x;return((x=(P=O.valueOwner)==null?void 0:P.declaration)==null?void 0:x.id)===G.operation[Ae.Median].inputs.firstValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(O=>{var P,x;return((x=(P=O.valueOwner)==null?void 0:P.declaration)==null?void 0:x.id)===G.operation[Ae.Median].inputs.secondValue.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),R=n.filter(O=>{var P,x;return((x=(P=O.valueOwner)==null?void 0:P.declaration)==null?void 0:x.id)===G.operation[Ae.Median].inputs.dynamicValue.id}).map(O=>{var P,x;return((P=O.value)==null?void 0:P.valueAsType)??((x=O.value)==null?void 0:x.value)}),I=[m,g,...R],A=jEt(...I);return{value:K.Success,error:null,result:A}}catch(y){return{value:K.UnhandledError,error:y,result:null}}}})}}class cIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MIN_OF,version:"1.0.0",description:"Min(numbers...)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.MinOf);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(O=>{var P,x;return((x=(P=O.valueOwner)==null?void 0:P.declaration)==null?void 0:x.id)===G.operation[Ae.MinOf].inputs.firstValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(O=>{var P,x;return((x=(P=O.valueOwner)==null?void 0:P.declaration)==null?void 0:x.id)===G.operation[Ae.MinOf].inputs.secondValue.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),R=n.filter(O=>{var P,x;return((x=(P=O.valueOwner)==null?void 0:P.declaration)==null?void 0:x.id)===G.operation[Ae.MinOf].inputs.dynamicValue.id}).map(O=>{var P,x;return((P=O.value)==null?void 0:P.valueAsType)??((x=O.value)==null?void 0:x.value)}),I=[m,g,...R].filter(O=>typeof O=="number"&&!Number.isNaN(O)),A=I.length?Math.min(...I):1/0;return{value:K.Success,error:null,result:A}}catch(y){return{value:K.UnhandledError,error:y,result:null}}}})}}class fIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MAX_OF,version:"1.0.0",description:"Max(numbers...)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.MaxOf);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f;try{const y=n.find(O=>{var P,x;return((x=(P=O.valueOwner)==null?void 0:P.declaration)==null?void 0:x.id)===G.operation[Ae.MaxOf].inputs.firstValue.id}),m=((s=y==null?void 0:y.value)==null?void 0:s.valueAsType)??((u=y==null?void 0:y.value)==null?void 0:u.value),T=n.find(O=>{var P,x;return((x=(P=O.valueOwner)==null?void 0:P.declaration)==null?void 0:x.id)===G.operation[Ae.MaxOf].inputs.secondValue.id}),g=((e=T==null?void 0:T.value)==null?void 0:e.valueAsType)??((f=T==null?void 0:T.value)==null?void 0:f.value),R=n.filter(O=>{var P,x;return((x=(P=O.valueOwner)==null?void 0:P.declaration)==null?void 0:x.id)===G.operation[Ae.MaxOf].inputs.dynamicValue.id}).map(O=>{var P,x;return((P=O.value)==null?void 0:P.valueAsType)??((x=O.value)==null?void 0:x.value)}),I=[m,g,...R].filter(O=>typeof O=="number"&&!Number.isNaN(O)),A=I.length?Math.max(...I):-1/0;return{value:K.Success,error:null,result:A}}catch(y){return{value:K.UnhandledError,error:y,result:null}}}})}}class yIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SQUARE_ROOT,version:"1.0.0",description:"Square root",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.SquareRoot);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s]=Mr(n);return{value:K.Success,error:null,result:Math.sqrt(Number(s))}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}class hIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_CUBE_ROOT,version:"1.0.0",description:"Cube root",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.CubeRoot);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s]=Mr(n);return{value:K.Success,error:null,result:Math.cbrt(Number(s))}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}class mIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_NTH_ROOT,version:"1.0.0",description:"Nth root (value, n)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.NthRoot);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u]=Mr(n),e=qEt(s,u);return{value:K.Success,error:null,result:e}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}class TIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_EXP,version:"1.0.0",description:"e^x",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.Exp);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s]=Mr(n);return{value:K.Success,error:null,result:Math.exp(Number(s))}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}class vIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LOG_NATURAL,version:"1.0.0",description:"Natural log ln(x)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.LogNatural);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s]=Mr(n);return{value:K.Success,error:null,result:Math.log(Number(s))}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}class gIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LOG10,version:"1.0.0",description:"Log base 10",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.Log10);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s]=Mr(n),u=Number(s),e=Math.log10?Math.log10(u):Math.log(u)/Math.LN10;return{value:K.Success,error:null,result:e}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}class bIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SIN,version:"1.0.0",description:"sin(x in radians)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.Sin);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s]=Mr(n);return{value:K.Success,error:null,result:Math.sin(Number(s))}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}class EIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_COS,version:"1.0.0",description:"cos(x in radians)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.Cos);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s]=Mr(n);return{value:K.Success,error:null,result:Math.cos(Number(s))}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}class IIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TAN,version:"1.0.0",description:"tan(x in radians)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.Tan);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s]=Mr(n);return{value:K.Success,error:null,result:Math.tan(Number(s))}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}class RIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ASIN,version:"1.0.0",description:"asin(x)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.Asin);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s]=Mr(n);return{value:K.Success,error:null,result:Math.asin(Number(s))}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}class AIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ACOS,version:"1.0.0",description:"acos(x)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.Acos);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s]=Mr(n);return{value:K.Success,error:null,result:Math.acos(Number(s))}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}class DIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ATAN,version:"1.0.0",description:"atan(x)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.Atan);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s]=Mr(n);return{value:K.Success,error:null,result:Math.atan(Number(s))}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}class CIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ATAN2,version:"1.0.0",description:"atan2(y, x)",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.Atan2);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u]=Mr(n);return{value:K.Success,error:null,result:Math.atan2(Number(s),Number(u))}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}class wIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TO_RADIANS,version:"1.0.0",description:"deg → rad",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.ToRadians);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s]=Mr(n);return{value:K.Success,error:null,result:Number(s)*Math.PI/180}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}class OIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TO_DEGREES,version:"1.0.0",description:"rad → deg",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.ToDegrees);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s]=Mr(n);return{value:K.Success,error:null,result:Number(s)*180/Math.PI}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}class xIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_PERCENT_OF,version:"1.0.0",description:"x percent of y",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.PercentOf);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u]=Mr(n),e=Number(s)/100*Number(u);return{value:K.Success,error:null,result:e}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}class KL extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_PERCENTAGE_CHANGE,version:"1.0.0",description:"((new-old)/old)*100",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.PercentageChange);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u]=Mr(n),e=ZEt(s,u);return{value:K.Success,error:null,result:e}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}class PIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LESS_THAN,version:"1.0.0",description:"a < b",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.LessThan);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u]=Mr(n);return{value:K.Success,error:null,result:s<u}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}class VIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MORE_THAN,version:"1.0.0",description:"a > b",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.MoreThan);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u]=Mr(n);return{value:K.Success,error:null,result:s>u}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}class NIt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LESS_THAN_OR_EQUAL,version:"1.0.0",description:"a <= b",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.LessThanOrEqual);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u]=Mr(n);return{value:K.Success,error:null,result:s<=u}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}class _It extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MORE_THAN_OR_EQUAL,version:"1.0.0",description:"a >= b",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic),s=n==null?void 0:n.get(Ae.MoreThanOrEqual);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{try{const[s,u]=Mr(n);return{value:K.Success,error:null,result:s>=u}}catch(s){return{value:K.UnhandledError,error:s,result:null}}}})}}function $It(a,p){return function(){return a.apply(p,arguments)}}const{toString:jbn}=Object.prototype,{getPrototypeOf:w4}=Object,{iterator:fV,toStringTag:GIt}=Symbol,yV=(a=>p=>{const t=jbn.call(p);return a[t]||(a[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),Gc=a=>(a=a.toLowerCase(),p=>yV(p)===a),hV=a=>p=>typeof p===a,{isArray:DE}=Array,Yg=hV("undefined");function S1(a){return a!==null&&!Yg(a)&&a.constructor!==null&&!Yg(a.constructor)&&kd(a.constructor.isBuffer)&&a.constructor.isBuffer(a)}const LIt=Gc("ArrayBuffer");function qbn(a){let p;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?p=ArrayBuffer.isView(a):p=a&&a.buffer&&LIt(a.buffer),p}const Zbn=hV("string"),kd=hV("function"),BIt=hV("number"),M1=a=>a!==null&&typeof a=="object",Hbn=a=>a===!0||a===!1,ww=a=>{if(yV(a)!=="object")return!1;const p=w4(a);return(p===null||p===Object.prototype||Object.getPrototypeOf(p)===null)&&!(GIt in a)&&!(fV in a)},Wbn=a=>{if(!M1(a)||S1(a))return!1;try{return Object.keys(a).length===0&&Object.getPrototypeOf(a)===Object.prototype}catch{return!1}},zbn=Gc("Date"),Ybn=Gc("File"),Jbn=a=>!!(a&&typeof a.uri<"u"),Qbn=a=>a&&typeof a.getParts<"u",Xbn=Gc("Blob"),eEn=Gc("FileList"),tEn=a=>M1(a)&&kd(a.pipe);function iEn(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const QH=iEn(),XH=typeof QH.FormData<"u"?QH.FormData:void 0,nEn=a=>{let p;return a&&(XH&&a instanceof XH||kd(a.append)&&((p=yV(a))==="formdata"||p==="object"&&kd(a.toString)&&a.toString()==="[object FormData]"))},rEn=Gc("URLSearchParams"),[aEn,sEn,lEn,oEn]=["ReadableStream","Request","Response","Headers"].map(Gc),dEn=a=>a.trim?a.trim():a.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function F1(a,p,{allOwnKeys:t=!1}={}){if(a===null||typeof a>"u")return;let n,s;if(typeof a!="object"&&(a=[a]),DE(a))for(n=0,s=a.length;n<s;n++)p.call(null,a[n],n,a);else{if(S1(a))return;const u=t?Object.getOwnPropertyNames(a):Object.keys(a),e=u.length;let f;for(n=0;n<e;n++)f=u[n],p.call(null,a[f],f,a)}}function SIt(a,p){if(S1(a))return null;p=p.toLowerCase();const t=Object.keys(a);let n=t.length,s;for(;n-- >0;)if(s=t[n],p===s.toLowerCase())return s;return null}const tT=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),MIt=a=>!Yg(a)&&a!==tT;function jL(){const{caseless:a,skipUndefined:p}=MIt(this)&&this||{},t={},n=(s,u)=>{if(u==="__proto__"||u==="constructor"||u==="prototype")return;const e=a&&SIt(t,u)||u;ww(t[e])&&ww(s)?t[e]=jL(t[e],s):ww(s)?t[e]=jL({},s):DE(s)?t[e]=s.slice():(!p||!Yg(s))&&(t[e]=s)};for(let s=0,u=arguments.length;s<u;s++)arguments[s]&&F1(arguments[s],n);return t}const pEn=(a,p,t,{allOwnKeys:n}={})=>(F1(p,(s,u)=>{t&&kd(s)?Object.defineProperty(a,u,{value:$It(s,t),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(a,u,{value:s,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:n}),a),uEn=a=>(a.charCodeAt(0)===65279&&(a=a.slice(1)),a),cEn=(a,p,t,n)=>{a.prototype=Object.create(p.prototype,n),Object.defineProperty(a.prototype,"constructor",{value:a,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(a,"super",{value:p.prototype}),t&&Object.assign(a.prototype,t)},fEn=(a,p,t,n)=>{let s,u,e;const f={};if(p=p||{},a==null)return p;do{for(s=Object.getOwnPropertyNames(a),u=s.length;u-- >0;)e=s[u],(!n||n(e,a,p))&&!f[e]&&(p[e]=a[e],f[e]=!0);a=t!==!1&&w4(a)}while(a&&(!t||t(a,p))&&a!==Object.prototype);return p},yEn=(a,p,t)=>{a=String(a),(t===void 0||t>a.length)&&(t=a.length),t-=p.length;const n=a.indexOf(p,t);return n!==-1&&n===t},hEn=a=>{if(!a)return null;if(DE(a))return a;let p=a.length;if(!BIt(p))return null;const t=new Array(p);for(;p-- >0;)t[p]=a[p];return t},mEn=(a=>p=>a&&p instanceof a)(typeof Uint8Array<"u"&&w4(Uint8Array)),TEn=(a,p)=>{const n=(a&&a[fV]).call(a);let s;for(;(s=n.next())&&!s.done;){const u=s.value;p.call(a,u[0],u[1])}},vEn=(a,p)=>{let t;const n=[];for(;(t=a.exec(p))!==null;)n.push(t);return n},gEn=Gc("HTMLFormElement"),bEn=a=>a.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,n,s){return n.toUpperCase()+s}),e5=(({hasOwnProperty:a})=>(p,t)=>a.call(p,t))(Object.prototype),EEn=Gc("RegExp"),FIt=(a,p)=>{const t=Object.getOwnPropertyDescriptors(a),n={};F1(t,(s,u)=>{let e;(e=p(s,u,a))!==!1&&(n[u]=e||s)}),Object.defineProperties(a,n)},IEn=a=>{FIt(a,(p,t)=>{if(kd(a)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const n=a[t];if(kd(n)){if(p.enumerable=!1,"writable"in p){p.writable=!1;return}p.set||(p.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},REn=(a,p)=>{const t={},n=s=>{s.forEach(u=>{t[u]=!0})};return DE(a)?n(a):n(String(a).split(p)),t},AEn=()=>{},DEn=(a,p)=>a!=null&&Number.isFinite(a=+a)?a:p;function CEn(a){return!!(a&&kd(a.append)&&a[GIt]==="FormData"&&a[fV])}const wEn=a=>{const p=new Array(10),t=(n,s)=>{if(M1(n)){if(p.indexOf(n)>=0)return;if(S1(n))return n;if(!("toJSON"in n)){p[s]=n;const u=DE(n)?[]:{};return F1(n,(e,f)=>{const y=t(e,s+1);!Yg(y)&&(u[f]=y)}),p[s]=void 0,u}}return n};return t(a,0)},OEn=Gc("AsyncFunction"),xEn=a=>a&&(M1(a)||kd(a))&&kd(a.then)&&kd(a.catch),kIt=((a,p)=>a?setImmediate:p?((t,n)=>(tT.addEventListener("message",({source:s,data:u})=>{s===tT&&u===t&&n.length&&n.shift()()},!1),s=>{n.push(s),tT.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",kd(tT.postMessage)),PEn=typeof queueMicrotask<"u"?queueMicrotask.bind(tT):typeof process<"u"&&process.nextTick||kIt,VEn=a=>a!=null&&kd(a[fV]),Rt={isArray:DE,isArrayBuffer:LIt,isBuffer:S1,isFormData:nEn,isArrayBufferView:qbn,isString:Zbn,isNumber:BIt,isBoolean:Hbn,isObject:M1,isPlainObject:ww,isEmptyObject:Wbn,isReadableStream:aEn,isRequest:sEn,isResponse:lEn,isHeaders:oEn,isUndefined:Yg,isDate:zbn,isFile:Ybn,isReactNativeBlob:Jbn,isReactNative:Qbn,isBlob:Xbn,isRegExp:EEn,isFunction:kd,isStream:tEn,isURLSearchParams:rEn,isTypedArray:mEn,isFileList:eEn,forEach:F1,merge:jL,extend:pEn,trim:dEn,stripBOM:uEn,inherits:cEn,toFlatObject:fEn,kindOf:yV,kindOfTest:Gc,endsWith:yEn,toArray:hEn,forEachEntry:TEn,matchAll:vEn,isHTMLForm:gEn,hasOwnProperty:e5,hasOwnProp:e5,reduceDescriptors:FIt,freezeMethods:IEn,toObjectSet:REn,toCamelCase:bEn,noop:AEn,toFiniteNumber:DEn,findKey:SIt,global:tT,isContextDefined:MIt,isSpecCompliantForm:CEn,toJSONObject:wEn,isAsyncFn:OEn,isThenable:xEn,setImmediate:kIt,asap:PEn,isIterable:VEn};class Id extends Error{static from(p,t,n,s,u,e){const f=new Id(p.message,t||p.code,n,s,u);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,t,n,s,u){super(p),Object.defineProperty(this,"message",{value:p,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),n&&(this.config=n),s&&(this.request=s),u&&(this.response=u,this.status=u.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:Rt.toJSONObject(this.config),code:this.code,status:this.status}}}Id.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";Id.ERR_BAD_OPTION="ERR_BAD_OPTION";Id.ECONNABORTED="ECONNABORTED";Id.ETIMEDOUT="ETIMEDOUT";Id.ERR_NETWORK="ERR_NETWORK";Id.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";Id.ERR_DEPRECATED="ERR_DEPRECATED";Id.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";Id.ERR_BAD_REQUEST="ERR_BAD_REQUEST";Id.ERR_CANCELED="ERR_CANCELED";Id.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";Id.ERR_INVALID_URL="ERR_INVALID_URL";const Ur=Id,NEn=null;function qL(a){return Rt.isPlainObject(a)||Rt.isArray(a)}function UIt(a){return Rt.endsWith(a,"[]")?a.slice(0,-2):a}function jG(a,p,t){return a?a.concat(p).map(function(s,u){return s=UIt(s),!t&&u?"["+s+"]":s}).join(t?".":""):p}function _En(a){return Rt.isArray(a)&&!a.some(qL)}const $En=Rt.toFlatObject(Rt,{},null,function(p){return/^is[A-Z]/.test(p)});function mV(a,p,t){if(!Rt.isObject(a))throw new TypeError("target must be an object");p=p||new FormData,t=Rt.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(A,O){return!Rt.isUndefined(O[A])});const n=t.metaTokens,s=t.visitor||T,u=t.dots,e=t.indexes,y=(t.Blob||typeof Blob<"u"&&Blob)&&Rt.isSpecCompliantForm(p);if(!Rt.isFunction(s))throw new TypeError("visitor must be a function");function m(I){if(I===null)return"";if(Rt.isDate(I))return I.toISOString();if(Rt.isBoolean(I))return I.toString();if(!y&&Rt.isBlob(I))throw new Ur("Blob is not supported. Use a Buffer instead.");return Rt.isArrayBuffer(I)||Rt.isTypedArray(I)?y&&typeof Blob=="function"?new Blob([I]):Buffer.from(I):I}function T(I,A,O){let P=I;if(Rt.isReactNative(p)&&Rt.isReactNativeBlob(I))return p.append(jG(O,A,u),m(I)),!1;if(I&&!O&&typeof I=="object"){if(Rt.endsWith(A,"{}"))A=n?A:A.slice(0,-2),I=JSON.stringify(I);else if(Rt.isArray(I)&&_En(I)||(Rt.isFileList(I)||Rt.endsWith(A,"[]"))&&(P=Rt.toArray(I)))return A=UIt(A),P.forEach(function($,U){!(Rt.isUndefined($)||$===null)&&p.append(e===!0?jG([A],U,u):e===null?A:A+"[]",m($))}),!1}return qL(I)?!0:(p.append(jG(O,A,u),m(I)),!1)}const g=[],b=Object.assign($En,{defaultVisitor:T,convertValue:m,isVisitable:qL});function R(I,A){if(!Rt.isUndefined(I)){if(g.indexOf(I)!==-1)throw Error("Circular reference detected in "+A.join("."));g.push(I),Rt.forEach(I,function(P,x){(!(Rt.isUndefined(P)||P===null)&&s.call(p,P,Rt.isString(x)?x.trim():x,A,b))===!0&&R(P,A?A.concat(x):[x])}),g.pop()}}if(!Rt.isObject(a))throw new TypeError("data must be an object");return R(a),p}function t5(a){const p={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(a).replace(/[!'()~]|%20|%00/g,function(n){return p[n]})}function O4(a,p){this._pairs=[],a&&mV(a,this,p)}const KIt=O4.prototype;KIt.append=function(p,t){this._pairs.push([p,t])};KIt.toString=function(p){const t=p?function(n){return p.call(this,n,t5)}:t5;return this._pairs.map(function(s){return t(s[0])+"="+t(s[1])},"").join("&")};function GEn(a){return encodeURIComponent(a).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function jIt(a,p,t){if(!p)return a;const n=t&&t.encode||GEn,s=Rt.isFunction(t)?{serialize:t}:t,u=s&&s.serialize;let e;if(u?e=u(p,s):e=Rt.isURLSearchParams(p)?p.toString():new O4(p,s).toString(n),e){const f=a.indexOf("#");f!==-1&&(a=a.slice(0,f)),a+=(a.indexOf("?")===-1?"?":"&")+e}return a}class LEn{constructor(){this.handlers=[]}use(p,t,n){return this.handlers.push({fulfilled:p,rejected:t,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(p){this.handlers[p]&&(this.handlers[p]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(p){Rt.forEach(this.handlers,function(n){n!==null&&p(n)})}}const i5=LEn,x4={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},BEn=typeof URLSearchParams<"u"?URLSearchParams:O4,SEn=typeof FormData<"u"?FormData:null,MEn=typeof Blob<"u"?Blob:null,FEn={isBrowser:!0,classes:{URLSearchParams:BEn,FormData:SEn,Blob:MEn},protocols:["http","https","file","blob","url","data"]},P4=typeof window<"u"&&typeof document<"u",ZL=typeof navigator=="object"&&navigator||void 0,kEn=P4&&(!ZL||["ReactNative","NativeScript","NS"].indexOf(ZL.product)<0),UEn=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),KEn=P4&&window.location.href||"http://localhost",jEn=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:P4,hasStandardBrowserEnv:kEn,hasStandardBrowserWebWorkerEnv:UEn,navigator:ZL,origin:KEn},Symbol.toStringTag,{value:"Module"})),Co={...jEn,...FEn};function qEn(a,p){return mV(a,new Co.classes.URLSearchParams,{visitor:function(t,n,s,u){return Co.isNode&&Rt.isBuffer(t)?(this.append(n,t.toString("base64")),!1):u.defaultVisitor.apply(this,arguments)},...p})}function ZEn(a){return Rt.matchAll(/\w+|\[(\w*)]/g,a).map(p=>p[0]==="[]"?"":p[1]||p[0])}function HEn(a){const p={},t=Object.keys(a);let n;const s=t.length;let u;for(n=0;n<s;n++)u=t[n],p[u]=a[u];return p}function qIt(a){function p(t,n,s,u){let e=t[u++];if(e==="__proto__")return!0;const f=Number.isFinite(+e),y=u>=t.length;return e=!e&&Rt.isArray(s)?s.length:e,y?(Rt.hasOwnProp(s,e)?s[e]=[s[e],n]:s[e]=n,!f):((!s[e]||!Rt.isObject(s[e]))&&(s[e]=[]),p(t,n,s[e],u)&&Rt.isArray(s[e])&&(s[e]=HEn(s[e])),!f)}if(Rt.isFormData(a)&&Rt.isFunction(a.entries)){const t={};return Rt.forEachEntry(a,(n,s)=>{p(ZEn(n),s,t,0)}),t}return null}function WEn(a,p,t){if(Rt.isString(a))try{return(p||JSON.parse)(a),Rt.trim(a)}catch(n){if(n.name!=="SyntaxError")throw n}return(t||JSON.stringify)(a)}const V4={transitional:x4,adapter:["xhr","http","fetch"],transformRequest:[function(p,t){const n=t.getContentType()||"",s=n.indexOf("application/json")>-1,u=Rt.isObject(p);if(u&&Rt.isHTMLForm(p)&&(p=new FormData(p)),Rt.isFormData(p))return s?JSON.stringify(qIt(p)):p;if(Rt.isArrayBuffer(p)||Rt.isBuffer(p)||Rt.isStream(p)||Rt.isFile(p)||Rt.isBlob(p)||Rt.isReadableStream(p))return p;if(Rt.isArrayBufferView(p))return p.buffer;if(Rt.isURLSearchParams(p))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),p.toString();let f;if(u){if(n.indexOf("application/x-www-form-urlencoded")>-1)return qEn(p,this.formSerializer).toString();if((f=Rt.isFileList(p))||n.indexOf("multipart/form-data")>-1){const y=this.env&&this.env.FormData;return mV(f?{"files[]":p}:p,y&&new y,this.formSerializer)}}return u||s?(t.setContentType("application/json",!1),WEn(p)):p}],transformResponse:[function(p){const t=this.transitional||V4.transitional,n=t&&t.forcedJSONParsing,s=this.responseType==="json";if(Rt.isResponse(p)||Rt.isReadableStream(p))return p;if(p&&Rt.isString(p)&&(n&&!this.responseType||s)){const e=!(t&&t.silentJSONParsing)&&s;try{return JSON.parse(p,this.parseReviver)}catch(f){if(e)throw f.name==="SyntaxError"?Ur.from(f,Ur.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:Co.classes.FormData,Blob:Co.classes.Blob},validateStatus:function(p){return p>=200&&p<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Rt.forEach(["delete","get","head","post","put","patch"],a=>{V4.headers[a]={}});const N4=V4,zEn=Rt.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"]),YEn=a=>{const p={};let t,n,s;return a&&a.split(`
50
50
  `).forEach(function(e){s=e.indexOf(":"),t=e.substring(0,s).trim().toLowerCase(),n=e.substring(s+1).trim(),!(!t||p[t]&&zEn[t])&&(t==="set-cookie"?p[t]?p[t].push(n):p[t]=[n]:p[t]=p[t]?p[t]+", "+n:n)}),p},n5=Symbol("internals");function kI(a){return a&&String(a).trim().toLowerCase()}function Ow(a){return a===!1||a==null?a:Rt.isArray(a)?a.map(Ow):String(a)}function JEn(a){const p=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=t.exec(a);)p[n[1]]=n[2];return p}const QEn=a=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(a.trim());function qG(a,p,t,n,s){if(Rt.isFunction(n))return n.call(this,p,t);if(s&&(p=t),!!Rt.isString(p)){if(Rt.isString(n))return p.indexOf(n)!==-1;if(Rt.isRegExp(n))return n.test(p)}}function XEn(a){return a.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(p,t,n)=>t.toUpperCase()+n)}function eIn(a,p){const t=Rt.toCamelCase(" "+p);["get","set","has"].forEach(n=>{Object.defineProperty(a,n+t,{value:function(s,u,e){return this[n].call(this,p,s,u,e)},configurable:!0})})}class TV{constructor(p){p&&this.set(p)}set(p,t,n){const s=this;function u(f,y,m){const T=kI(y);if(!T)throw new Error("header name must be a non-empty string");const g=Rt.findKey(s,T);(!g||s[g]===void 0||m===!0||m===void 0&&s[g]!==!1)&&(s[g||y]=Ow(f))}const e=(f,y)=>Rt.forEach(f,(m,T)=>u(m,T,y));if(Rt.isPlainObject(p)||p instanceof this.constructor)e(p,t);else if(Rt.isString(p)&&(p=p.trim())&&!QEn(p))e(YEn(p),t);else if(Rt.isObject(p)&&Rt.isIterable(p)){let f={},y,m;for(const T of p){if(!Rt.isArray(T))throw TypeError("Object iterator must return a key-value pair");f[m=T[0]]=(y=f[m])?Rt.isArray(y)?[...y,T[1]]:[y,T[1]]:T[1]}e(f,t)}else p!=null&&u(t,p,n);return this}get(p,t){if(p=kI(p),p){const n=Rt.findKey(this,p);if(n){const s=this[n];if(!t)return s;if(t===!0)return JEn(s);if(Rt.isFunction(t))return t.call(this,s,n);if(Rt.isRegExp(t))return t.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(p,t){if(p=kI(p),p){const n=Rt.findKey(this,p);return!!(n&&this[n]!==void 0&&(!t||qG(this,this[n],n,t)))}return!1}delete(p,t){const n=this;let s=!1;function u(e){if(e=kI(e),e){const f=Rt.findKey(n,e);f&&(!t||qG(n,n[f],f,t))&&(delete n[f],s=!0)}}return Rt.isArray(p)?p.forEach(u):u(p),s}clear(p){const t=Object.keys(this);let n=t.length,s=!1;for(;n--;){const u=t[n];(!p||qG(this,this[u],u,p,!0))&&(delete this[u],s=!0)}return s}normalize(p){const t=this,n={};return Rt.forEach(this,(s,u)=>{const e=Rt.findKey(n,u);if(e){t[e]=Ow(s),delete t[u];return}const f=p?XEn(u):String(u).trim();f!==u&&delete t[u],t[f]=Ow(s),n[f]=!0}),this}concat(...p){return this.constructor.concat(this,...p)}toJSON(p){const t=Object.create(null);return Rt.forEach(this,(n,s)=>{n!=null&&n!==!1&&(t[s]=p&&Rt.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([p,t])=>p+": "+t).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,...t){const n=new this(p);return t.forEach(s=>n.set(s)),n}static accessor(p){const n=(this[n5]=this[n5]={accessors:{}}).accessors,s=this.prototype;function u(e){const f=kI(e);n[f]||(eIn(s,e),n[f]=!0)}return Rt.isArray(p)?p.forEach(u):u(p),this}}TV.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Rt.reduceDescriptors(TV.prototype,({value:a},p)=>{let t=p[0].toUpperCase()+p.slice(1);return{get:()=>a,set(n){this[t]=n}}});Rt.freezeMethods(TV);const Xu=TV;function ZG(a,p){const t=this||N4,n=p||t,s=Xu.from(n.headers);let u=n.data;return Rt.forEach(a,function(f){u=f.call(t,u,s.normalize(),p?p.status:void 0)}),s.normalize(),u}function ZIt(a){return!!(a&&a.__CANCEL__)}class tIn extends Ur{constructor(p,t,n){super(p??"canceled",Ur.ERR_CANCELED,t,n),this.name="CanceledError",this.__CANCEL__=!0}}const k1=tIn;function HIt(a,p,t){const n=t.config.validateStatus;!t.status||!n||n(t.status)?a(t):p(new Ur("Request failed with status code "+t.status,[Ur.ERR_BAD_REQUEST,Ur.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function iIn(a){const p=/^([-+\w]{1,25})(:?\/\/|:)/.exec(a);return p&&p[1]||""}function nIn(a,p){a=a||10;const t=new Array(a),n=new Array(a);let s=0,u=0,e;return p=p!==void 0?p:1e3,function(y){const m=Date.now(),T=n[u];e||(e=m),t[s]=y,n[s]=m;let g=u,b=0;for(;g!==s;)b+=t[g++],g=g%a;if(s=(s+1)%a,s===u&&(u=(u+1)%a),m-e<p)return;const R=T&&m-T;return R?Math.round(b*1e3/R):void 0}}function rIn(a,p){let t=0,n=1e3/p,s,u;const e=(m,T=Date.now())=>{t=T,s=null,u&&(clearTimeout(u),u=null),a(...m)};return[(...m)=>{const T=Date.now(),g=T-t;g>=n?e(m,T):(s=m,u||(u=setTimeout(()=>{u=null,e(s)},n-g)))},()=>s&&e(s)]}const eO=(a,p,t=3)=>{let n=0;const s=nIn(50,250);return rIn(u=>{const e=u.loaded,f=u.lengthComputable?u.total:void 0,y=e-n,m=s(y),T=e<=f;n=e;const g={loaded:e,total:f,progress:f?e/f:void 0,bytes:y,rate:m||void 0,estimated:m&&f&&T?(f-e)/m:void 0,event:u,lengthComputable:f!=null,[p?"download":"upload"]:!0};a(g)},t)},r5=(a,p)=>{const t=a!=null;return[n=>p[0]({lengthComputable:t,total:a,loaded:n}),p[1]]},a5=a=>(...p)=>Rt.asap(()=>a(...p)),aIn=Co.hasStandardBrowserEnv?((a,p)=>t=>(t=new URL(t,Co.origin),a.protocol===t.protocol&&a.host===t.host&&(p||a.port===t.port)))(new URL(Co.origin),Co.navigator&&/(msie|trident)/i.test(Co.navigator.userAgent)):()=>!0,sIn=Co.hasStandardBrowserEnv?{write(a,p,t,n,s,u,e){if(typeof document>"u")return;const f=[`${a}=${encodeURIComponent(p)}`];Rt.isNumber(t)&&f.push(`expires=${new Date(t).toUTCString()}`),Rt.isString(n)&&f.push(`path=${n}`),Rt.isString(s)&&f.push(`domain=${s}`),u===!0&&f.push("secure"),Rt.isString(e)&&f.push(`SameSite=${e}`),document.cookie=f.join("; ")},read(a){if(typeof document>"u")return null;const p=document.cookie.match(new RegExp("(?:^|; )"+a+"=([^;]*)"));return p?decodeURIComponent(p[1]):null},remove(a){this.write(a,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function lIn(a){return typeof a!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(a)}function oIn(a,p){return p?a.replace(/\/?\/$/,"")+"/"+p.replace(/^\/+/,""):a}function WIt(a,p,t){let n=!lIn(p);return a&&(n||t==!1)?oIn(a,p):p}const s5=a=>a instanceof Xu?{...a}:a;function yT(a,p){p=p||{};const t={};function n(m,T,g,b){return Rt.isPlainObject(m)&&Rt.isPlainObject(T)?Rt.merge.call({caseless:b},m,T):Rt.isPlainObject(T)?Rt.merge({},T):Rt.isArray(T)?T.slice():T}function s(m,T,g,b){if(Rt.isUndefined(T)){if(!Rt.isUndefined(m))return n(void 0,m,g,b)}else return n(m,T,g,b)}function u(m,T){if(!Rt.isUndefined(T))return n(void 0,T)}function e(m,T){if(Rt.isUndefined(T)){if(!Rt.isUndefined(m))return n(void 0,m)}else return n(void 0,T)}function f(m,T,g){if(g in p)return n(m,T);if(g in a)return n(void 0,m)}const y={url:u,method:u,data:u,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,T,g)=>s(s5(m),s5(T),g,!0)};return Rt.forEach(Object.keys({...a,...p}),function(T){if(T==="__proto__"||T==="constructor"||T==="prototype")return;const g=Rt.hasOwnProp(y,T)?y[T]:s,b=g(a[T],p[T],T);Rt.isUndefined(b)&&g!==f||(t[T]=b)}),t}const zIt=a=>{const p=yT({},a);let{data:t,withXSRFToken:n,xsrfHeaderName:s,xsrfCookieName:u,headers:e,auth:f}=p;if(p.headers=e=Xu.from(e),p.url=jIt(WIt(p.baseURL,p.url,p.allowAbsoluteUrls),a.params,a.paramsSerializer),f&&e.set("Authorization","Basic "+btoa((f.username||"")+":"+(f.password?unescape(encodeURIComponent(f.password)):""))),Rt.isFormData(t)){if(Co.hasStandardBrowserEnv||Co.hasStandardBrowserWebWorkerEnv)e.setContentType(void 0);else if(Rt.isFunction(t.getHeaders)){const y=t.getHeaders(),m=["content-type","content-length"];Object.entries(y).forEach(([T,g])=>{m.includes(T.toLowerCase())&&e.set(T,g)})}}if(Co.hasStandardBrowserEnv&&(n&&Rt.isFunction(n)&&(n=n(p)),n||n!==!1&&aIn(p.url))){const y=s&&u&&sIn.read(u);y&&e.set(s,y)}return p},dIn=typeof XMLHttpRequest<"u",pIn=dIn&&function(a){return new Promise(function(t,n){const s=zIt(a);let u=s.data;const e=Xu.from(s.headers).normalize();let{responseType:f,onUploadProgress:y,onDownloadProgress:m}=s,T,g,b,R,I;function A(){R&&R(),I&&I(),s.cancelToken&&s.cancelToken.unsubscribe(T),s.signal&&s.signal.removeEventListener("abort",T)}let O=new XMLHttpRequest;O.open(s.method.toUpperCase(),s.url,!0),O.timeout=s.timeout;function P(){if(!O)return;const $=Xu.from("getAllResponseHeaders"in O&&O.getAllResponseHeaders()),Z={data:!f||f==="text"||f==="json"?O.responseText:O.response,status:O.status,statusText:O.statusText,headers:$,config:a,request:O};HIt(function(H){t(H),A()},function(H){n(H),A()},Z),O=null}"onloadend"in O?O.onloadend=P:O.onreadystatechange=function(){!O||O.readyState!==4||O.status===0&&!(O.responseURL&&O.responseURL.indexOf("file:")===0)||setTimeout(P)},O.onabort=function(){O&&(n(new Ur("Request aborted",Ur.ECONNABORTED,a,O)),O=null)},O.onerror=function(U){const Z=U&&U.message?U.message:"Network Error",q=new Ur(Z,Ur.ERR_NETWORK,a,O);q.event=U||null,n(q),O=null},O.ontimeout=function(){let U=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const Z=s.transitional||x4;s.timeoutErrorMessage&&(U=s.timeoutErrorMessage),n(new Ur(U,Z.clarifyTimeoutError?Ur.ETIMEDOUT:Ur.ECONNABORTED,a,O)),O=null},u===void 0&&e.setContentType(null),"setRequestHeader"in O&&Rt.forEach(e.toJSON(),function(U,Z){O.setRequestHeader(Z,U)}),Rt.isUndefined(s.withCredentials)||(O.withCredentials=!!s.withCredentials),f&&f!=="json"&&(O.responseType=s.responseType),m&&([b,I]=eO(m,!0),O.addEventListener("progress",b)),y&&O.upload&&([g,R]=eO(y),O.upload.addEventListener("progress",g),O.upload.addEventListener("loadend",R)),(s.cancelToken||s.signal)&&(T=$=>{O&&(n(!$||$.type?new k1(null,a,O):$),O.abort(),O=null)},s.cancelToken&&s.cancelToken.subscribe(T),s.signal&&(s.signal.aborted?T():s.signal.addEventListener("abort",T)));const x=iIn(s.url);if(x&&Co.protocols.indexOf(x)===-1){n(new Ur("Unsupported protocol "+x+":",Ur.ERR_BAD_REQUEST,a));return}O.send(u||null)})},uIn=(a,p)=>{const{length:t}=a=a?a.filter(Boolean):[];if(p||t){let n=new AbortController,s;const u=function(m){if(!s){s=!0,f();const T=m instanceof Error?m:this.reason;n.abort(T instanceof Ur?T:new k1(T instanceof Error?T.message:T))}};let e=p&&setTimeout(()=>{e=null,u(new Ur(`timeout of ${p}ms exceeded`,Ur.ETIMEDOUT))},p);const f=()=>{a&&(e&&clearTimeout(e),e=null,a.forEach(m=>{m.unsubscribe?m.unsubscribe(u):m.removeEventListener("abort",u)}),a=null)};a.forEach(m=>m.addEventListener("abort",u));const{signal:y}=n;return y.unsubscribe=()=>Rt.asap(f),y}},cIn=uIn,fIn=function*(a,p){let t=a.byteLength;if(!p||t<p){yield a;return}let n=0,s;for(;n<t;)s=n+p,yield a.slice(n,s),n=s},yIn=async function*(a,p){for await(const t of hIn(a))yield*fIn(t,p)},hIn=async function*(a){if(a[Symbol.asyncIterator]){yield*a;return}const p=a.getReader();try{for(;;){const{done:t,value:n}=await p.read();if(t)break;yield n}}finally{await p.cancel()}},l5=(a,p,t,n)=>{const s=yIn(a,p);let u=0,e,f=y=>{e||(e=!0,n&&n(y))};return new ReadableStream({async pull(y){try{const{done:m,value:T}=await s.next();if(m){f(),y.close();return}let g=T.byteLength;if(t){let b=u+=g;t(b)}y.enqueue(new Uint8Array(T))}catch(m){throw f(m),m}},cancel(y){return f(y),s.return()}},{highWaterMark:2})},o5=64*1024,{isFunction:fw}=Rt,mIn=(({Request:a,Response:p})=>({Request:a,Response:p}))(Rt.global),{ReadableStream:d5,TextEncoder:p5}=Rt.global,u5=(a,...p)=>{try{return!!a(...p)}catch{return!1}},TIn=a=>{a=Rt.merge.call({skipUndefined:!0},mIn,a);const{fetch:p,Request:t,Response:n}=a,s=p?fw(p):typeof fetch=="function",u=fw(t),e=fw(n);if(!s)return!1;const f=s&&fw(d5),y=s&&(typeof p5=="function"?(I=>A=>I.encode(A))(new p5):async I=>new Uint8Array(await new t(I).arrayBuffer())),m=u&&f&&u5(()=>{let I=!1;const A=new t(Co.origin,{body:new d5,method:"POST",get duplex(){return I=!0,"half"}}).headers.has("Content-Type");return I&&!A}),T=e&&f&&u5(()=>Rt.isReadableStream(new n("").body)),g={stream:T&&(I=>I.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(I=>{!g[I]&&(g[I]=(A,O)=>{let P=A&&A[I];if(P)return P.call(A);throw new Ur(`Response type '${I}' is not supported`,Ur.ERR_NOT_SUPPORT,O)})});const b=async I=>{if(I==null)return 0;if(Rt.isBlob(I))return I.size;if(Rt.isSpecCompliantForm(I))return(await new t(Co.origin,{method:"POST",body:I}).arrayBuffer()).byteLength;if(Rt.isArrayBufferView(I)||Rt.isArrayBuffer(I))return I.byteLength;if(Rt.isURLSearchParams(I)&&(I=I+""),Rt.isString(I))return(await y(I)).byteLength},R=async(I,A)=>{const O=Rt.toFiniteNumber(I.getContentLength());return O??b(A)};return async I=>{let{url:A,method:O,data:P,signal:x,cancelToken:$,timeout:U,onDownloadProgress:Z,onUploadProgress:q,responseType:H,headers:Y,withCredentials:ie="same-origin",fetchOptions:z}=zIt(I),W=p||fetch;H=H?(H+"").toLowerCase():"text";let ee=cIn([x,$&&$.toAbortSignal()],U),te=null;const X=ee&&ee.unsubscribe&&(()=>{ee.unsubscribe()});let re;try{if(q&&m&&O!=="get"&&O!=="head"&&(re=await R(Y,P))!==0){let Ce=new t(A,{method:"POST",body:P,duplex:"half"}),Ee;if(Rt.isFormData(P)&&(Ee=Ce.headers.get("content-type"))&&Y.setContentType(Ee),Ce.body){const[Oe,Le]=r5(re,eO(a5(q)));P=l5(Ce.body,o5,Oe,Le)}}Rt.isString(ie)||(ie=ie?"include":"omit");const ae=u&&"credentials"in t.prototype,le={...z,signal:ee,method:O.toUpperCase(),headers:Y.normalize().toJSON(),body:P,duplex:"half",credentials:ae?ie:void 0};te=u&&new t(A,le);let oe=await(u?W(te,z):W(A,le));const ce=T&&(H==="stream"||H==="response");if(T&&(Z||ce&&X)){const Ce={};["status","statusText","headers"].forEach(Fe=>{Ce[Fe]=oe[Fe]});const Ee=Rt.toFiniteNumber(oe.headers.get("content-length")),[Oe,Le]=Z&&r5(Ee,eO(a5(Z),!0))||[];oe=new n(l5(oe.body,o5,Oe,()=>{Le&&Le(),X&&X()}),Ce)}H=H||"text";let be=await g[Rt.findKey(g,H)||"text"](oe,I);return!ce&&X&&X(),await new Promise((Ce,Ee)=>{HIt(Ce,Ee,{data:be,headers:Xu.from(oe.headers),status:oe.status,statusText:oe.statusText,config:I,request:te})})}catch(ae){throw X&&X(),ae&&ae.name==="TypeError"&&/Load failed|fetch/i.test(ae.message)?Object.assign(new Ur("Network Error",Ur.ERR_NETWORK,I,te,ae&&ae.response),{cause:ae.cause||ae}):Ur.from(ae,ae&&ae.code,I,te,ae&&ae.response)}}},vIn=new Map,YIt=a=>{let p=a&&a.env||{};const{fetch:t,Request:n,Response:s}=p,u=[n,s,t];let e=u.length,f=e,y,m,T=vIn;for(;f--;)y=u[f],m=T.get(y),m===void 0&&T.set(y,m=f?new Map:TIn(p)),T=m;return m};YIt();const _4={http:NEn,xhr:pIn,fetch:{get:YIt}};Rt.forEach(_4,(a,p)=>{if(a){try{Object.defineProperty(a,"name",{value:p})}catch{}Object.defineProperty(a,"adapterName",{value:p})}});const c5=a=>`- ${a}`,gIn=a=>Rt.isFunction(a)||a===null||a===!1;function bIn(a,p){a=Rt.isArray(a)?a:[a];const{length:t}=a;let n,s;const u={};for(let e=0;e<t;e++){n=a[e];let f;if(s=n,!gIn(n)&&(s=_4[(f=String(n)).toLowerCase()],s===void 0))throw new Ur(`Unknown adapter '${f}'`);if(s&&(Rt.isFunction(s)||(s=s.get(p))))break;u[f||"#"+e]=s}if(!s){const e=Object.entries(u).map(([y,m])=>`adapter ${y} `+(m===!1?"is not supported by the environment":"is not available in the build"));let f=t?e.length>1?`since :
52
52
  `+e.map(c5).join(`
@@ -58,7 +58,7 @@ This is likely an incorrect strategy, either the '${this.type}' entity doesn't n
58
58
  `)),!p.includes(" ")&&/\\t/.test(p)&&(p=p.replace(/\\t/g," ")),p=p.replace(/\r\n/g,`
59
59
  `).replace(/\r/g,`
60
60
  `),p=p.replace(/\n/g,`\r
61
- `),p}class _At extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleDriveUploadFile,version:"2.0.0",description:"Upload a file to Google Drive (media / import+copy) with auto content detection and simplified inputs.",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleDriveUploadFile);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A,O,P,x,$,U,Z,q,H,Y,ie,z,W,ee,te;try{const X=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0],re=Be(t,t.project,"uploadFile"),le="["+Ve(t,t.project,"Upload Google Drive File")+": `"+re+"`] ",oe=G.operation[J.GoogleDriveUploadFile],ce=n.find(kt=>{var Ct,xi;return((xi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:xi.id)===oe.inputs.connection.id}),be=((s=ce==null?void 0:ce.value)==null?void 0:s.valueAsType)??((u=ce==null?void 0:ce.value)==null?void 0:u.value);if(!be||!be.id||!be.name||be.type!==r.DefinitionEntity)throw new Error(`${le}Invalid input "${Ve(ce==null?void 0:ce.valueOwner,X==null?void 0:X.logic,"Connection")}" (\`${Be(ce==null?void 0:ce.valueOwner,X==null?void 0:X.logic,"connection")}\`), expected a valid connection node.`);const Ce=n.find(kt=>{var Ct,xi;return((xi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:xi.id)===oe.inputs.content.id}),Ee=((e=Ce==null?void 0:Ce.value)==null?void 0:e.valueAsType)??((f=Ce==null?void 0:Ce.value)==null?void 0:f.value),Oe=n.find(kt=>{var Ct,xi;return((xi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:xi.id)===oe.inputs.name.id}),Le=(m=(y=Oe==null?void 0:Oe.value)==null?void 0:y.value)==null?void 0:m.trim();if(!Le||Le==="")throw new Error(`${le}The "${Ve(Oe==null?void 0:Oe.valueOwner,X==null?void 0:X.logic,"File Name")}" (\`${Be(Oe==null?void 0:Oe.valueOwner,X==null?void 0:X.logic,"name")}\`) input is missing.`);const Fe=(((g=(T=n.find(kt=>{var Ct,xi;return((xi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:xi.id)===G.operation[J.GoogleDriveUploadFile].inputs.mimeType.id}))==null?void 0:T.value)==null?void 0:g.valueAsType)??((R=(b=n.find(kt=>{var Ct,xi;return((xi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:xi.id)===G.operation[J.GoogleDriveUploadFile].inputs.mimeType.id}))==null?void 0:b.value)==null?void 0:R.value))||"application/octet-stream",tt=(((A=(I=n.find(kt=>{var Ct,xi;return((xi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:xi.id)===G.operation[J.GoogleDriveUploadFile].inputs.folderId.id}))==null?void 0:I.value)==null?void 0:A.valueAsType)??((P=(O=n.find(kt=>{var Ct,xi;return((xi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:xi.id)===G.operation[J.GoogleDriveUploadFile].inputs.folderId.id}))==null?void 0:O.value)==null?void 0:P.value))||void 0,We=((($=(x=n.find(kt=>{var Ct,xi;return((xi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:xi.id)===G.operation[J.GoogleDriveUploadFile].inputs.description.id}))==null?void 0:x.value)==null?void 0:$.valueAsType)??((Z=(U=n.find(kt=>{var Ct,xi;return((xi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:xi.id)===G.operation[J.GoogleDriveUploadFile].inputs.description.id}))==null?void 0:U.value)==null?void 0:Z.value))||void 0,et=(((H=(q=n.find(kt=>{var Ct,xi;return((xi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:xi.id)===G.operation[J.GoogleDriveUploadFile].inputs.importMimeType.id}))==null?void 0:q.value)==null?void 0:H.valueAsType)??((ie=(Y=n.find(kt=>{var Ct,xi;return((xi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:xi.id)===G.operation[J.GoogleDriveUploadFile].inputs.importMimeType.id}))==null?void 0:Y.value)==null?void 0:ie.value))||"text/plain";if(!Le)return ay(t,"Missing required input: name");const qe=ui(be),st={Authorization:`Bearer ${await X.getAccessToken()}`},ft=`${((z=X.env)==null?void 0:z.API_BASE_URL)+"/editor-runtime"}/v2/external-integrations/proxy/${X.projectId}/${Zt["google-drive"]}/${qe}`,Et=async(kt,Ct,{params:xi,body:wn,contentType:Yr,providerHeaders:Jr,responseType:hi}={})=>{const $t=`${ft}/${ZIn(Ct)}`,Nt={...st};return Yr&&(Nt["Content-Type"]=Yr),(Jr||hi)&&(Nt[qIn]=JSON.stringify({...Jr?{headers:Jr}:{},...hi?{responseType:hi}:{}})),Ht.request({method:kt,url:$t,params:xi,data:wn,responseType:hi||"json",headers:Nt})},pt=typeof Fe=="string"&&Fe.startsWith("application/vnd.google-apps.");if(pt&&(Ee==null||Ee==="")){const kt={name:Le,mimeType:Fe};tt&&(kt.parents=[tt]),typeof We=="string"&&(kt.description=We);const Ct=await Et("POST","/drive/v3/files",{params:{supportsAllDrives:"true",fields:_R},body:JSON.stringify(kt),contentType:"application/json"});return Ct.status!==200&&Ct.status!==201?ay(t,`Drive create failed (status=${Ct.status})`):WG({file:Ct.data})}if(pt&&Ee!=null){let kt=await WIn(Ee);const xi=((hi,$t)=>$t||(hi==="application/vnd.google-apps.spreadsheet"?"text/csv":hi==="application/vnd.google-apps.document"||hi==="application/vnd.google-apps.presentation"?"text/html":"text/plain"))(Fe,et),wn=xi.startsWith("text/")&&!/charset=/i.test(xi)?`${xi}; charset=UTF-8`:xi;xi.startsWith("text/csv")&&(kt=zIn(kt));const Yr=new TextEncoder().encode(kt);if(Yr.byteLength>v5)return ay(t,`Text body exceeds simple upload limit (${Yr.byteLength} bytes).`);let Jr;try{const hi=await Et("POST","/upload/drive/v3/files",{params:{uploadType:"media",supportsAllDrives:"true",fields:_R},body:Yr,contentType:wn});if(hi.status!==200&&hi.status!==201)return ay(t,`Drive media upload failed (status=${hi.status})`);if(Jr=(W=hi.data)==null?void 0:W.id,!Jr)return ay(t,"Drive media upload did not return an id");const $t={name:Le,mimeType:Fe};tt&&($t.parents=[tt]),typeof We=="string"&&($t.description=We);const Nt=await Et("POST",`/drive/v3/files/${encodeURIComponent(Jr)}/copy`,{params:{supportsAllDrives:"true",fields:_R},body:JSON.stringify($t),contentType:"application/json"});return Nt.status!==200&&Nt.status!==201?ay(t,`Drive copy-convert failed (status=${Nt.status})`):WG({file:Nt.data})}finally{if(Jr)try{await Et("DELETE",`/drive/v3/files/${encodeURIComponent(Jr)}`,{params:{supportsAllDrives:"true"}})}catch{}}}if(Ee==null)return ay(t,"Missing content for non-native upload");const{bytes:Me,inferredMime:Je,isBinary:ke}=await HIn(Ee),lt=Me.byteLength;if(lt>v5)return ay(t,`File too large for simple upload (${lt} bytes).`);const Gt=await Et("POST","/upload/drive/v3/files",{params:{uploadType:"media",supportsAllDrives:"true",fields:_R},body:Me,contentType:Fe||Je||(ke?"application/octet-stream":"text/plain; charset=UTF-8")});if(Gt.status!==200&&Gt.status!==201)return ay(t,`Drive media upload failed (status=${Gt.status})`);let si=Gt.data;const pi=(ee=Gt.data)==null?void 0:ee.id;return pi&&(tt||Le||We)&&(si=await YIn(Et,pi,Le,We,tt)),WG({file:si})}catch(X){const re=((te=X.response)==null?void 0:te.data)||X.message||X;return pe.Logger.error("[Google Drive] Upload document failed:",re),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:re,result:null}}}})}}function WG(a){return{value:K.Success,error:null,result:a}}function ay(a,p){return pe.Logger.log("[Google Drive] Upload error:",p),{value:a.catchesError||a.errorCalls.length?K.CaughtError:K.UnhandledError,error:p,result:null}}async function YIn(a,p,t,n,s){const u={};t&&(u.name=t),typeof n=="string"&&(u.description=n);const e={supportsAllDrives:"true",fields:_R},f={...e};s&&(f.addParents=s,f.removeParents="root");let y=await a("PATCH",`/drive/v3/files/${encodeURIComponent(p)}`,{params:f,body:JSON.stringify(u),contentType:"application/json"});if(y.status>=400&&s&&(y=await a("PATCH",`/drive/v3/files/${encodeURIComponent(p)}`,{params:{...e,addParents:s},body:JSON.stringify(u),contentType:"application/json"})),y.status!==200)throw new Error(`Drive metadata update failed (status=${y.status})`);return y.data}const JIn="id,name,mimeType,webViewLink",QIn="X-Elyx-Proxy-Config";function XIn(a){return a.startsWith("/")?a.slice(1):a}const eRn=(a,p)=>(pe.Logger.log("[Google Drive Clone Document] error:",p),{value:a.catchesError||a.errorCalls.length?K.CaughtError:K.UnhandledError,error:p,result:null});class $At extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleDriveCloneDocument,version:"1.0.0",description:"Google Drive clone document operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleDriveCloneDocument);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A,O;try{const P=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0],x=G.operation[J.GoogleDriveCloneDocument],$=Be(t,t.project,"cloneDocument"),Z="["+Ve(t,t.project,"Clone document")+": `"+$+"`] ",q=n.find(Ee=>{var Oe,Le;return((Le=(Oe=Ee.valueOwner)==null?void 0:Oe.declaration)==null?void 0:Le.id)===x.inputs.connection.id}),H=((s=q==null?void 0:q.value)==null?void 0:s.valueAsType)??((u=q==null?void 0:q.value)==null?void 0:u.value);if(!H||!H.id||!H.name||H.type!==r.DefinitionEntity)throw new Error(`${Z}Invalid input "${Ve(q==null?void 0:q.valueOwner,P==null?void 0:P.logic,"Connection")}" (\`${Be(q==null?void 0:q.valueOwner,P==null?void 0:P.logic,"connection")}\`), expected a valid connection node.`);const Y=ui(H);if(!Y)throw new Error(`${Z}The "${Ve(q==null?void 0:q.valueOwner,P==null?void 0:P.logic,"Connection")}" (\`${Be(q==null?void 0:q.valueOwner,P==null?void 0:P.logic,"connection")}\`) input is invalid, missing underlying Connection ID value.`);const ie=n.find(Ee=>{var Oe,Le;return((Le=(Oe=Ee.valueOwner)==null?void 0:Oe.declaration)==null?void 0:Le.id)===x.inputs.documentId.id}),z=(e=ie==null?void 0:ie.value)==null?void 0:e.value;if(!z||z==="")throw new Error(`${Z}The "${Ve(ie==null?void 0:ie.valueOwner,P==null?void 0:P.logic,"Document ID")}" (\`${Be(ie==null?void 0:ie.valueOwner,P==null?void 0:P.logic,"documentId")}\`) input is missing.`);if(typeof z!="string")throw new Error(`${Z}The "${Ve(ie==null?void 0:ie.valueOwner,P==null?void 0:P.logic,"Document ID")}" (\`${Be(ie==null?void 0:ie.valueOwner,P==null?void 0:P.logic,"documentId")}\`) input value is invalid, if present, it must be a non-empty string.`);const W=(y=(f=n.find(Ee=>{var Oe,Le;return((Le=(Oe=Ee.valueOwner)==null?void 0:Oe.declaration)==null?void 0:Le.id)===x.inputs.newName.id}))==null?void 0:f.value)==null?void 0:y.value,ee=(T=(m=n.find(Ee=>{var Oe,Le;return((Le=(Oe=Ee.valueOwner)==null?void 0:Oe.declaration)==null?void 0:Le.id)===x.inputs.parentFolderIds.id}))==null?void 0:m.value)==null?void 0:T.value,te=(b=(g=n.find(Ee=>{var Oe,Le;return((Le=(Oe=Ee.valueOwner)==null?void 0:Oe.declaration)==null?void 0:Le.id)===x.inputs.description.id}))==null?void 0:g.value)==null?void 0:b.value,X=(I=(R=n.find(Ee=>{var Oe,Le;return((Le=(Oe=Ee.valueOwner)==null?void 0:Oe.declaration)==null?void 0:Le.id)===x.inputs.starred.id}))==null?void 0:R.value)==null?void 0:I.value;ui(H);const ae={Authorization:`Bearer ${await P.getAccessToken()}`},le=`${((A=P.env)==null?void 0:A.API_BASE_URL)+"/editor-runtime"}/v2/external-integrations/proxy/${P.projectId}/${Zt["google-drive"]}/${Y}`,oe=async(Ee,Oe,{params:Le,body:Fe,contentType:tt,providerHeaders:We,responseType:et}={})=>{const qe=`${le}/${XIn(Oe)}`,ot={...ae};return tt&&(ot["Content-Type"]=tt),(We||et)&&(ot[QIn]=JSON.stringify({...We?{headers:We}:{},...et?{responseType:et}:{}})),Ht({method:Ee,url:qe,headers:ot,params:Le,data:Fe,responseType:et||"json"})},ce={};W&&(ce.name=W),ee&&ee.length>0&&(ce.parents=ee),te&&(ce.description=te),X!==void 0&&(ce.starred=X);const Ce=(await oe("POST",`/drive/v3/files/${z}/copy`,{params:{fields:JIn,supportsAllDrives:!0},body:ce,contentType:"application/json"})).data;return{value:K.Success,error:null,result:{id:Ce.id,name:Ce.name,mimeType:Ce.mimeType,webViewLink:Ce.webViewLink}}}catch(P){const x=((O=P.response)==null?void 0:O.data)||P.message||P;return eRn(t,x)}}})}}const tRn="X-Elyx-Proxy-Config";function iRn(a){return a.startsWith("/")?a.slice(1):a}const nRn=(a,p)=>(pe.Logger.log("[Google Drive Delete Document] error:",p),{value:a.catchesError||a.errorCalls.length?K.CaughtError:K.UnhandledError,error:p,result:null});class GAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleDriveDeleteDocument,version:"1.0.0",description:"Google Drive delete document operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleDriveDeleteDocument);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T;try{const g=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0],b=G.operation[J.GoogleDriveDeleteDocument],R=Be(t,t.project,"deleteDocument"),A="["+Ve(t,t.project,"Delete document")+": `"+R+"`] ",O=n.find(z=>{var W,ee;return((ee=(W=z.valueOwner)==null?void 0:W.declaration)==null?void 0:ee.id)===b.inputs.connection.id}),P=((s=O==null?void 0:O.value)==null?void 0:s.valueAsType)??((u=O==null?void 0:O.value)==null?void 0:u.value);if(!P||!P.id||!P.name||P.type!==r.DefinitionEntity)throw new Error(`${A}Invalid input "${Ve(O==null?void 0:O.valueOwner,g==null?void 0:g.logic,"Connection")}" (\`${Be(O==null?void 0:O.valueOwner,g==null?void 0:g.logic,"connection")}\`), expected a valid connection node.`);const x=ui(P);if(!x)throw new Error(`${A}The "${Ve(O==null?void 0:O.valueOwner,g==null?void 0:g.logic,"Connection")}" (\`${Be(O==null?void 0:O.valueOwner,g==null?void 0:g.logic,"connection")}\`) input is invalid, missing underlying Connection ID value.`);const $=n.find(z=>{var W,ee;return((ee=(W=z.valueOwner)==null?void 0:W.declaration)==null?void 0:ee.id)===b.inputs.documentId.id}),U=(e=$==null?void 0:$.value)==null?void 0:e.value;if(!U||U==="")throw new Error(`${A}The "${Ve($==null?void 0:$.valueOwner,g==null?void 0:g.logic,"Document ID")}" (\`${Be($==null?void 0:$.valueOwner,g==null?void 0:g.logic,"documentId")}\`) input is missing.`);if(typeof U!="string")throw new Error(`${A}The "${Ve($==null?void 0:$.valueOwner,g==null?void 0:g.logic,"Document ID")}" (\`${Be($==null?void 0:$.valueOwner,g==null?void 0:g.logic,"documentId")}\`) input value is invalid, if present, it must be a non-empty string.`);const Z=(y=(f=n.find(z=>{var W,ee;return((ee=(W=z.valueOwner)==null?void 0:W.declaration)==null?void 0:ee.id)===b.inputs.permanent.id}))==null?void 0:f.value)==null?void 0:y.value;ui(P);const H={Authorization:`Bearer ${await g.getAccessToken()}`},Y=`${((m=g.env)==null?void 0:m.API_BASE_URL)+"/editor-runtime"}/v2/external-integrations/proxy/${g.projectId}/${Zt["google-drive"]}/${x}`,ie=async(z,W,{params:ee,body:te,contentType:X,providerHeaders:re,responseType:ae}={})=>{const le=`${Y}/${iRn(W)}`,oe={...H};return X&&(oe["Content-Type"]=X),(re||ae)&&(oe[tRn]=JSON.stringify({...re?{headers:re}:{},...ae?{responseType:ae}:{}})),Ht({method:z,url:le,headers:oe,params:ee,data:te,responseType:ae||"json"})};return Z?await ie("DELETE",`/drive/v3/files/${U}`,{params:{supportsAllDrives:!0}}):await ie("PATCH",`/drive/v3/files/${U}`,{params:{supportsAllDrives:!0},body:{trashed:!0},contentType:"application/json"}),{value:K.Success,error:null,result:null}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return nRn(t,b)}}})}}const rRn="X-Elyx-Proxy-Config";function aRn(a){return a.startsWith("/")?a.slice(1):a}const sRn=(a,p)=>(pe.Logger.log("[Google Drive Create Permission] error:",p),{value:a.catchesError||a.errorCalls.length?K.CaughtError:K.UnhandledError,error:p,result:null});class LAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleDriveCreatePermission,version:"1.0.0",description:"Google Drive create permission operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleDriveCreatePermission);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A,O,P,x,$,U,Z;try{const q=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0],H=G.operation[J.GoogleDriveCreatePermission],Y=Be(t,t.project,"createPermission"),z="["+Ve(t,t.project,"Create permission")+": `"+Y+"`] ",W=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===H.inputs.connection.id}),ee=((s=W==null?void 0:W.value)==null?void 0:s.valueAsType)??((u=W==null?void 0:W.value)==null?void 0:u.value);if(!ee||!ee.id||!ee.name||ee.type!==r.DefinitionEntity)throw new Error(`${z}Invalid input "${Ve(W==null?void 0:W.valueOwner,q==null?void 0:q.logic,"Connection")}" (\`${Be(W==null?void 0:W.valueOwner,q==null?void 0:q.logic,"connection")}\`), expected a valid connection node.`);const te=ui(ee);if(!te)throw new Error(`${z}The "${Ve(W==null?void 0:W.valueOwner,q==null?void 0:q.logic,"Connection")}" (\`${Be(W==null?void 0:W.valueOwner,q==null?void 0:q.logic,"connection")}\`) input is invalid, missing underlying Connection ID value.`);const X=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===H.inputs.fileId.id}),re=(e=X==null?void 0:X.value)==null?void 0:e.value;if(!re||re==="")throw new Error(`${z}The "${Ve(X==null?void 0:X.valueOwner,q==null?void 0:q.logic,"File ID")}" (\`${Be(X==null?void 0:X.valueOwner,q==null?void 0:q.logic,"fileId")}\`) input is missing.`);if(typeof re!="string")throw new Error(`${z}The "${Ve(X==null?void 0:X.valueOwner,q==null?void 0:q.logic,"File ID")}" (\`${Be(X==null?void 0:X.valueOwner,q==null?void 0:q.logic,"fileId")}\`) input value is invalid, if present, it must be a non-empty string.`);const ae=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===H.inputs.role.id}),le=(f=ae==null?void 0:ae.value)==null?void 0:f.value;if(!le||le==="")throw new Error(`${z}The "${Ve(ae==null?void 0:ae.valueOwner,q==null?void 0:q.logic,"Role")}" (\`${Be(ae==null?void 0:ae.valueOwner,q==null?void 0:q.logic,"role")}\`) input is missing.`);if(typeof le!="string")throw new Error(`${z}The "${Ve(ae==null?void 0:ae.valueOwner,q==null?void 0:q.logic,"Role")}" (\`${Be(ae==null?void 0:ae.valueOwner,q==null?void 0:q.logic,"role")}\`) input value is invalid, if present, it must be a non-empty string.`);const oe=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===H.inputs.type.id}),ce=(y=oe==null?void 0:oe.value)==null?void 0:y.value;if(!ce||ce==="")throw new Error(`${z}The "${Ve(oe==null?void 0:oe.valueOwner,q==null?void 0:q.logic,"Type")}" (\`${Be(oe==null?void 0:oe.valueOwner,q==null?void 0:q.logic,"type")}\`) input is missing.`);if(typeof ce!="string")throw new Error(`${z}The "${Ve(oe==null?void 0:oe.valueOwner,q==null?void 0:q.logic,"Type")}" (\`${Be(oe==null?void 0:oe.valueOwner,q==null?void 0:q.logic,"type")}\`) input value is invalid, if present, it must be a non-empty string.`);const be=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===H.inputs.emailAddress.id}),Ce=(m=be==null?void 0:be.value)==null?void 0:m.value,Ee=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===H.inputs.domain.id}),Oe=(T=Ee==null?void 0:Ee.value)==null?void 0:T.value;if((ce==="user"||ce==="group")&&(!Ce||Ce.trim()===""))throw new Error(`${z}The "${Ve(be==null?void 0:be.valueOwner,q==null?void 0:q.logic,"Email address")}" (\`${Be(be==null?void 0:be.valueOwner,q==null?void 0:q.logic,"emailAddress")}\`) input is required when type is "${ce}".`);if(ce==="domain"&&(!Oe||Oe.trim()===""))throw new Error(`${z}The "${Ve(Ee==null?void 0:Ee.valueOwner,q==null?void 0:q.logic,"Domain")}" (\`${Be(Ee==null?void 0:Ee.valueOwner,q==null?void 0:q.logic,"domain")}\`) input is required when type is "domain".`);const Le=(b=(g=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===H.inputs.sendNotificationEmail.id}))==null?void 0:g.value)==null?void 0:b.value,Fe=(I=(R=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===H.inputs.emailMessage.id}))==null?void 0:R.value)==null?void 0:I.value,tt=(O=(A=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===H.inputs.allowFileDiscovery.id}))==null?void 0:A.value)==null?void 0:O.value,We=(x=(P=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===H.inputs.transferOwnership.id}))==null?void 0:P.value)==null?void 0:x.value;ui(ee);const qe={Authorization:`Bearer ${await q.getAccessToken()}`},ot=`${(($=q.env)==null?void 0:$.API_BASE_URL)+"/editor-runtime"}/v2/external-integrations/proxy/${q.projectId}/${Zt["google-drive"]}/${te}`,st=async(Je,ke,{params:lt,body:Pt,contentType:Gt,providerHeaders:si,responseType:pi}={})=>{const kt=`${ot}/${aRn(ke)}`,Ct={...qe};return Gt&&(Ct["Content-Type"]=Gt),(si||pi)&&(Ct[rRn]=JSON.stringify({...si?{headers:si}:{},...pi?{responseType:pi}:{}})),Ht({method:Je,url:kt,headers:Ct,params:lt,data:Pt,responseType:pi||"json"})},ft={supportsAllDrives:!0,fields:"id,type,role,emailAddress,domain,displayName"};Le!==void 0&&(ft.sendNotificationEmail=Le),Fe&&(ft.emailMessage=Fe),We!==void 0&&(ft.transferOwnership=We);const Et={role:le,type:ce};Ce&&(Et.emailAddress=Ce),Oe&&(Et.domain=Oe),tt!==void 0&&(Et.allowFileDiscovery=tt);const pt=await st("POST",`/drive/v3/files/${re}/permissions`,{params:ft,body:Et,contentType:"application/json"}),Me=((U=pt.data)==null?void 0:U.data)??pt.data;return{value:K.Success,error:null,result:{id:(Me==null?void 0:Me.id)??"",type:(Me==null?void 0:Me.type)??ce,role:(Me==null?void 0:Me.role)??le,emailAddress:(Me==null?void 0:Me.emailAddress)??Ce??"",domain:(Me==null?void 0:Me.domain)??Oe??"",displayName:(Me==null?void 0:Me.displayName)??""}}}catch(q){const H=((Z=q.response)==null?void 0:Z.data)||q.message||q;return sRn(t,typeof H=="object"?JSON.stringify(H):String(H))}}})}}const lRn="X-Elyx-Proxy-Config";function oRn(a){return a.startsWith("/")?a.slice(1):a}const dRn=(a,p)=>(pe.Logger.log("[Google Drive Delete Permission] error:",p),{value:a.catchesError||a.errorCalls.length?K.CaughtError:K.UnhandledError,error:p,result:null});class BAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleDriveDeletePermission,version:"1.0.0",description:"Google Drive delete permission operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleDriveDeletePermission);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0],g=G.operation[J.GoogleDriveDeletePermission],b=Be(t,t.project,"deletePermission"),I="["+Ve(t,t.project,"Delete permission")+": `"+b+"`] ",A=n.find(z=>{var W,ee;return((ee=(W=z.valueOwner)==null?void 0:W.declaration)==null?void 0:ee.id)===g.inputs.connection.id}),O=((s=A==null?void 0:A.value)==null?void 0:s.valueAsType)??((u=A==null?void 0:A.value)==null?void 0:u.value);if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${I}Invalid input "${Ve(A==null?void 0:A.valueOwner,T==null?void 0:T.logic,"Connection")}" (\`${Be(A==null?void 0:A.valueOwner,T==null?void 0:T.logic,"connection")}\`), expected a valid connection node.`);const P=ui(O);if(!P)throw new Error(`${I}The "${Ve(A==null?void 0:A.valueOwner,T==null?void 0:T.logic,"Connection")}" (\`${Be(A==null?void 0:A.valueOwner,T==null?void 0:T.logic,"connection")}\`) input is invalid, missing underlying Connection ID value.`);const x=n.find(z=>{var W,ee;return((ee=(W=z.valueOwner)==null?void 0:W.declaration)==null?void 0:ee.id)===g.inputs.fileId.id}),$=(e=x==null?void 0:x.value)==null?void 0:e.value;if(!$||$==="")throw new Error(`${I}The "${Ve(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"File ID")}" (\`${Be(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"fileId")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${I}The "${Ve(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"File ID")}" (\`${Be(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"fileId")}\`) input value is invalid, if present, it must be a non-empty string.`);const U=n.find(z=>{var W,ee;return((ee=(W=z.valueOwner)==null?void 0:W.declaration)==null?void 0:ee.id)===g.inputs.permissionId.id}),Z=(f=U==null?void 0:U.value)==null?void 0:f.value;if(!Z||Z==="")throw new Error(`${I}The "${Ve(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"Permission ID")}" (\`${Be(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"permissionId")}\`) input is missing.`);if(typeof Z!="string")throw new Error(`${I}The "${Ve(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"Permission ID")}" (\`${Be(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"permissionId")}\`) input value is invalid, if present, it must be a non-empty string.`);ui(O);const H={Authorization:`Bearer ${await T.getAccessToken()}`},Y=`${((y=T.env)==null?void 0:y.API_BASE_URL)+"/editor-runtime"}/v2/external-integrations/proxy/${T.projectId}/${Zt["google-drive"]}/${P}`;return await(async(z,W,{params:ee,body:te,contentType:X,providerHeaders:re,responseType:ae}={})=>{const le=`${Y}/${oRn(W)}`,oe={...H};return X&&(oe["Content-Type"]=X),(re||ae)&&(oe[lRn]=JSON.stringify({...re?{headers:re}:{},...ae?{responseType:ae}:{}})),Ht({method:z,url:le,headers:oe,params:ee,data:te,responseType:ae||"json"})})("DELETE",`/drive/v3/files/${$}/permissions/${Z}`,{params:{supportsAllDrives:!0}}),{value:K.Success,error:null,result:void 0}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return dRn(t,typeof g=="object"?JSON.stringify(g):String(g))}}})}}const pRn="X-Elyx-Proxy-Config";function uRn(a){return a.startsWith("/")?a.slice(1):a}const cRn=(a,p)=>(pe.Logger.log("[Google Drive List Permissions] error:",p),{value:a.catchesError||a.errorCalls.length?K.CaughtError:K.UnhandledError,error:p,result:null});class SAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleDriveListPermissions,version:"1.0.0",description:"Google Drive list permissions operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleDriveListPermissions);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R;try{const I=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0],A=G.operation[J.GoogleDriveListPermissions],O=Be(t,t.project,"listPermissions"),x="["+Ve(t,t.project,"List permissions")+": `"+O+"`] ",$=n.find(ce=>{var be,Ce;return((Ce=(be=ce.valueOwner)==null?void 0:be.declaration)==null?void 0:Ce.id)===A.inputs.connection.id}),U=((s=$==null?void 0:$.value)==null?void 0:s.valueAsType)??((u=$==null?void 0:$.value)==null?void 0:u.value);if(!U||!U.id||!U.name||U.type!==r.DefinitionEntity)throw new Error(`${x}Invalid input "${Ve($==null?void 0:$.valueOwner,I==null?void 0:I.logic,"Connection")}" (\`${Be($==null?void 0:$.valueOwner,I==null?void 0:I.logic,"connection")}\`), expected a valid connection node.`);const Z=ui(U);if(!Z)throw new Error(`${x}The "${Ve($==null?void 0:$.valueOwner,I==null?void 0:I.logic,"Connection")}" (\`${Be($==null?void 0:$.valueOwner,I==null?void 0:I.logic,"connection")}\`) input is invalid, missing underlying Connection ID value.`);const q=n.find(ce=>{var be,Ce;return((Ce=(be=ce.valueOwner)==null?void 0:be.declaration)==null?void 0:Ce.id)===A.inputs.fileId.id}),H=(e=q==null?void 0:q.value)==null?void 0:e.value;if(!H||H==="")throw new Error(`${x}The "${Ve(q==null?void 0:q.valueOwner,I==null?void 0:I.logic,"File ID")}" (\`${Be(q==null?void 0:q.valueOwner,I==null?void 0:I.logic,"fileId")}\`) input is missing.`);if(typeof H!="string")throw new Error(`${x}The "${Ve(q==null?void 0:q.valueOwner,I==null?void 0:I.logic,"File ID")}" (\`${Be(q==null?void 0:q.valueOwner,I==null?void 0:I.logic,"fileId")}\`) input value is invalid, if present, it must be a non-empty string.`);const Y=(y=(f=n.find(ce=>{var be,Ce;return((Ce=(be=ce.valueOwner)==null?void 0:be.declaration)==null?void 0:Ce.id)===A.inputs.pageSize.id}))==null?void 0:f.value)==null?void 0:y.value,ie=(T=(m=n.find(ce=>{var be,Ce;return((Ce=(be=ce.valueOwner)==null?void 0:be.declaration)==null?void 0:Ce.id)===A.inputs.pageToken.id}))==null?void 0:m.value)==null?void 0:T.value;ui(U);const W={Authorization:`Bearer ${await I.getAccessToken()}`},ee=`${((g=I.env)==null?void 0:g.API_BASE_URL)+"/editor-runtime"}/v2/external-integrations/proxy/${I.projectId}/${Zt["google-drive"]}/${Z}`,te=async(ce,be,{params:Ce,body:Ee,contentType:Oe,providerHeaders:Le,responseType:Fe}={})=>{const tt=`${ee}/${uRn(be)}`,We={...W};return Oe&&(We["Content-Type"]=Oe),(Le||Fe)&&(We[pRn]=JSON.stringify({...Le?{headers:Le}:{},...Fe?{responseType:Fe}:{}})),Ht({method:ce,url:tt,headers:We,params:Ce,data:Ee,responseType:Fe||"json"})},X={supportsAllDrives:!0,fields:"nextPageToken,permissions(id,type,role,emailAddress,domain,displayName)"};Y!=null&&(X.pageSize=Y),ie&&(X.pageToken=ie);const re=await te("GET",`/drive/v3/files/${H}/permissions`,{params:X}),ae=((b=re.data)==null?void 0:b.data)??re.data,oe=(Array.isArray(ae==null?void 0:ae.permissions)?ae.permissions:[]).map(ce=>({id:(ce==null?void 0:ce.id)??"",type:(ce==null?void 0:ce.type)??"",role:(ce==null?void 0:ce.role)??"",emailAddress:(ce==null?void 0:ce.emailAddress)??"",domain:(ce==null?void 0:ce.domain)??"",displayName:(ce==null?void 0:ce.displayName)??""}));return{value:K.Success,error:null,result:{permissions:oe,nextPageToken:(ae==null?void 0:ae.nextPageToken)??""}}}catch(I){const A=((R=I.response)==null?void 0:R.data)||I.message||I;return cRn(t,typeof A=="object"?JSON.stringify(A):String(A))}}})}}const fRn="X-Elyx-Proxy-Config";function yRn(a){return a.startsWith("/")?a.slice(1):a}const hRn=(a,p)=>(pe.Logger.log("[Google Drive Update Permission] error:",p),{value:a.catchesError||a.errorCalls.length?K.CaughtError:K.UnhandledError,error:p,result:null});class MAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleDriveUpdatePermission,version:"1.0.0",description:"Google Drive update permission operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleDriveUpdatePermission);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R;try{const I=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0],A=G.operation[J.GoogleDriveUpdatePermission],O=Be(t,t.project,"updatePermission"),x="["+Ve(t,t.project,"Update permission")+": `"+O+"`] ",$=n.find(be=>{var Ce,Ee;return((Ee=(Ce=be.valueOwner)==null?void 0:Ce.declaration)==null?void 0:Ee.id)===A.inputs.connection.id}),U=((s=$==null?void 0:$.value)==null?void 0:s.valueAsType)??((u=$==null?void 0:$.value)==null?void 0:u.value);if(!U||!U.id||!U.name||U.type!==r.DefinitionEntity)throw new Error(`${x}Invalid input "${Ve($==null?void 0:$.valueOwner,I==null?void 0:I.logic,"Connection")}" (\`${Be($==null?void 0:$.valueOwner,I==null?void 0:I.logic,"connection")}\`), expected a valid connection node.`);const Z=ui(U);if(!Z)throw new Error(`${x}The "${Ve($==null?void 0:$.valueOwner,I==null?void 0:I.logic,"Connection")}" (\`${Be($==null?void 0:$.valueOwner,I==null?void 0:I.logic,"connection")}\`) input is invalid, missing underlying Connection ID value.`);const q=n.find(be=>{var Ce,Ee;return((Ee=(Ce=be.valueOwner)==null?void 0:Ce.declaration)==null?void 0:Ee.id)===A.inputs.fileId.id}),H=(e=q==null?void 0:q.value)==null?void 0:e.value;if(!H||H==="")throw new Error(`${x}The "${Ve(q==null?void 0:q.valueOwner,I==null?void 0:I.logic,"File ID")}" (\`${Be(q==null?void 0:q.valueOwner,I==null?void 0:I.logic,"fileId")}\`) input is missing.`);if(typeof H!="string")throw new Error(`${x}The "${Ve(q==null?void 0:q.valueOwner,I==null?void 0:I.logic,"File ID")}" (\`${Be(q==null?void 0:q.valueOwner,I==null?void 0:I.logic,"fileId")}\`) input value is invalid, if present, it must be a non-empty string.`);const Y=n.find(be=>{var Ce,Ee;return((Ee=(Ce=be.valueOwner)==null?void 0:Ce.declaration)==null?void 0:Ee.id)===A.inputs.permissionId.id}),ie=(f=Y==null?void 0:Y.value)==null?void 0:f.value;if(!ie||ie==="")throw new Error(`${x}The "${Ve(Y==null?void 0:Y.valueOwner,I==null?void 0:I.logic,"Permission ID")}" (\`${Be(Y==null?void 0:Y.valueOwner,I==null?void 0:I.logic,"permissionId")}\`) input is missing.`);if(typeof ie!="string")throw new Error(`${x}The "${Ve(Y==null?void 0:Y.valueOwner,I==null?void 0:I.logic,"Permission ID")}" (\`${Be(Y==null?void 0:Y.valueOwner,I==null?void 0:I.logic,"permissionId")}\`) input value is invalid, if present, it must be a non-empty string.`);const z=n.find(be=>{var Ce,Ee;return((Ee=(Ce=be.valueOwner)==null?void 0:Ce.declaration)==null?void 0:Ee.id)===A.inputs.role.id}),W=(y=z==null?void 0:z.value)==null?void 0:y.value;if(!W||W==="")throw new Error(`${x}The "${Ve(z==null?void 0:z.valueOwner,I==null?void 0:I.logic,"Role")}" (\`${Be(z==null?void 0:z.valueOwner,I==null?void 0:I.logic,"role")}\`) input is missing.`);if(typeof W!="string")throw new Error(`${x}The "${Ve(z==null?void 0:z.valueOwner,I==null?void 0:I.logic,"Role")}" (\`${Be(z==null?void 0:z.valueOwner,I==null?void 0:I.logic,"role")}\`) input value is invalid, if present, it must be a non-empty string.`);const ee=(T=(m=n.find(be=>{var Ce,Ee;return((Ee=(Ce=be.valueOwner)==null?void 0:Ce.declaration)==null?void 0:Ee.id)===A.inputs.transferOwnership.id}))==null?void 0:m.value)==null?void 0:T.value;ui(U);const X={Authorization:`Bearer ${await I.getAccessToken()}`},re=`${((g=I.env)==null?void 0:g.API_BASE_URL)+"/editor-runtime"}/v2/external-integrations/proxy/${I.projectId}/${Zt["google-drive"]}/${Z}`,ae=async(be,Ce,{params:Ee,body:Oe,contentType:Le,providerHeaders:Fe,responseType:tt}={})=>{const We=`${re}/${yRn(Ce)}`,et={...X};return Le&&(et["Content-Type"]=Le),(Fe||tt)&&(et[fRn]=JSON.stringify({...Fe?{headers:Fe}:{},...tt?{responseType:tt}:{}})),Ht({method:be,url:We,headers:et,params:Ee,data:Oe,responseType:tt||"json"})},le={supportsAllDrives:!0,fields:"id,type,role,emailAddress,domain,displayName"};ee!=null&&(le.transferOwnership=ee);const oe=await ae("PATCH",`/drive/v3/files/${H}/permissions/${ie}`,{params:le,body:{role:W},contentType:"application/json"}),ce=((b=oe.data)==null?void 0:b.data)??oe.data;return{value:K.Success,error:null,result:{id:(ce==null?void 0:ce.id)??ie,type:(ce==null?void 0:ce.type)??"",role:(ce==null?void 0:ce.role)??W,emailAddress:(ce==null?void 0:ce.emailAddress)??"",domain:(ce==null?void 0:ce.domain)??"",displayName:(ce==null?void 0:ce.displayName)??""}}}catch(I){const A=((R=I.response)==null?void 0:R.data)||I.message||I;return hRn(t,typeof A=="object"?JSON.stringify(A):String(A))}}})}}class FAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleGeminiGenerateContent,version:"1.0.0",description:"Send Gmail email operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleGeminiGenerateContent);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0],g=Be(t,t.project,"generateContent"),R="["+Ve(t,t.project,"Generate content")+": `"+g+"`] ",I=G.operation[J.GoogleGeminiGenerateContent],A=n.find(H=>{var Y,ie;return((ie=(Y=H.valueOwner)==null?void 0:Y.declaration)==null?void 0:ie.id)===I.inputs.connection.id}),O=((s=A==null?void 0:A.value)==null?void 0:s.valueAsType)??((u=A==null?void 0:A.value)==null?void 0:u.value);if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${R}Invalid input "${Ve(A==null?void 0:A.valueOwner,T==null?void 0:T.logic,"Connection")}" (\`${Be(A==null?void 0:A.valueOwner,T==null?void 0:T.logic,"connection")}\`), expected a valid connection node.`);const P=ui(O);if(!P)throw new Error(`${R}The "${Ve(A==null?void 0:A.valueOwner,T==null?void 0:T.logic,"Connection")}" (\`${Be(A==null?void 0:A.valueOwner,T==null?void 0:T.logic,"connection")}\`) input is invalid, missing underlying Connection ID value.`);const x=n.find(H=>{var Y,ie;return((ie=(Y=H.valueOwner)==null?void 0:Y.declaration)==null?void 0:ie.id)===I.inputs.prompt.id}),$=(e=x==null?void 0:x.value)==null?void 0:e.value;if($==null||$==="")throw new Error(`${R}The "${Ve(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"Prompt")}" (\`${Be(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"prompt")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${R}The "${Ve(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"Prompt")}" (\`${Be(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"prompt")}\`) input value is invalid, if present, it must be a non-empty string.`);const U=n.find(H=>{var Y,ie;return((ie=(Y=H.valueOwner)==null?void 0:Y.declaration)==null?void 0:ie.id)===I.inputs.model.id}),Z=(f=U==null?void 0:U.value)==null?void 0:f.value;if(Z==null||Z==="")throw new Error(`${R}The "${Ve(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"Model")}" (\`${Be(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"model")}\`) input is missing.`);if(typeof Z!="string")throw new Error(`${R}The "${Ve(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"Model")}" (\`${Be(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"model")}\`) input value is invalid, if present, it must be a non-empty string.`);ui(O),console.log("Triggering Google Gemini generate content action with connectionId:",P);const q=await(await Ht.post(`${(y=T.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v1/external-integrations/trigger-action/${Zt["google-gemini"]}/${P}/generate-content`,{payload:{prompt:$,model:Z}},{headers:{"Content-Type":"application/json",Authorization:`Bearer ${await T.getAccessToken()}`}})).data;return pe.Logger.log("[Google Gemini] Generate content action response:",q),{value:K.Success,error:null,result:{content:q.content}}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return pe.Logger.error("[Google Gemini] Generate content failed:",g),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:g,result:null}}}})}}class kAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsCreateSpreadsheet,version:"1.0.0",description:"Create Spreadsheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsCreateSpreadsheet);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f;try{const y=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!y||!y.env)throw new Error("Editor context or environment missing");const m=Be(t,t.project,"createSpreadsheet"),g="["+Ve(t,t.project,"Create spreadsheet")+": `"+m+"`] ",b=(ie,z,W)=>{const ee=Ve(ie==null?void 0:ie.valueOwner,y==null?void 0:y.logic,z),te=Be(ie==null?void 0:ie.valueOwner,y==null?void 0:y.logic,W);return`"${ee}" (\`${te}\`)`},R=n.find(ie=>{var z;return((z=ie.valueOwner.declaration)==null?void 0:z.id)===G.operation[J.GoogleSheetsCreateSpreadsheet].inputs.connection.id}),I=(s=R==null?void 0:R.value)==null?void 0:s.valueAsType;if(!I||!I.id||!I.name||I.type!==r.DefinitionEntity)throw new Error(`${g}The ${b(R,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const A=ui(I);if(!A)throw new Error(`${g}The ${b(R,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const O=n.find(ie=>{var z;return((z=ie.valueOwner.declaration)==null?void 0:z.id)===G.operation[J.GoogleSheetsCreateSpreadsheet].inputs.title.id}),P=(u=O==null?void 0:O.value)==null?void 0:u.value;if(P&&typeof P!="string")throw new Error(`${g}The ${b(O,"Title","title")} input value is invalid. If present, it must be a non-empty string. E.g. "My Spreadsheet"`);const $={Authorization:`Bearer ${await y.getAccessToken()}`},U=`${(e=y.env)==null?void 0:e.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${y.projectId}/${Zt["google-sheet"]}/${A}`,Z=async ie=>Ht.post(U,ie,{headers:$}),q={};P&&(q.properties={title:P});const Y=(await Z({method:"POST",endpoint:"/v4/spreadsheets",data:q})).data||{};return{value:K.Success,error:null,result:{spreadsheetId:Y.spreadsheetId,spreadsheetUrl:Y.spreadsheetUrl}}}catch(y){const m=((f=y.response)==null?void 0:f.data)||y.message||y;return pe.Logger.log("[Google Sheets] error:",m),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:m,result:null}}}})}}function zL(a){let p="",t=a;for(;t>0;){const n=(t-1)%26;p=String.fromCharCode(65+n)+p,t=Math.floor((t-n)/26)}return p}function IV(a){if(!/^[A-Z]{1,3}$/.test(a))return NaN;let p=0;for(let t=0;t<a.length;t++)p=p*26+(a.charCodeAt(t)-64);return p}function cA(a,p){const t=(p==null?void 0:p.errorPrefix)||"";if(typeof a!="string")throw new Error(`${t}Input must be a string.`);let n,s=a;if(a.includes("!")){const R=a.split("!");let I=R.slice(0,-1).join("!");s=R[R.length-1],I.startsWith("'")&&I.endsWith("'")&&(I=I.slice(1,-1)),n=I}const u=/^(\$?[A-Z]{1,3})?(\$?\d+)?(?::(\$?[A-Z]{1,3})?(\$?\d+)?)?$/i,e=s.match(u);if(!e)throw new Error(`${t}Invalid A1 notation format: ${a}`);const[f,y,m,T,g]=e,b={sheet:n};return y&&(b.startColumn=y.toUpperCase()),m&&(b.startRow=m),T&&(b.endColumn=T.toUpperCase()),g&&(b.endRow=g),b}function B4(a,p){const t=p!=null&&p.errorPrefix?p.errorPrefix:"",n=T=>{if(typeof T=="string"){const g=T.replace("$","");return/^\d+$/.test(g)?parseInt(g,10):NaN}return T},s=T=>{if(typeof T=="string"){const g=T.replace("$","").toUpperCase();return/^\d+$/.test(g)?parseInt(g,10):IV(g)}return T},u=n(a.startRow),e=n(a.endRow),f=s(a.startColumn),y=s(a.endColumn),m=T=>typeof T=="string"&&T.includes("{{")&&T.includes("}}");if(a.startRow!==void 0&&a.startRow!==null&&a.startRow!==""&&isNaN(u)&&!m(a.startRow))throw new Error(`${t}Start Row is invalid.`);if(a.endRow!==void 0&&a.endRow!==null&&a.endRow!==""&&isNaN(e)&&!m(a.endRow))throw new Error(`${t}End Row is invalid.`);if(a.startColumn!==void 0&&a.startColumn!==null&&a.startColumn!==""&&isNaN(f)&&!m(a.startColumn))throw new Error(`${t}Start Column is invalid.`);if(a.endColumn!==void 0&&a.endColumn!==null&&a.endColumn!==""&&isNaN(y)&&!m(a.endColumn))throw new Error(`${t}End Column is invalid.`);if(u!=null&&!isNaN(u)&&u<1)throw new Error(`${t}Start Row must be greater than or equal to 1.`);if(e!=null&&!isNaN(e)&&e<1)throw new Error(`${t}End Row must be greater than or equal to 1.`);if(f!=null&&!isNaN(f)&&f<1)throw new Error(`${t}Start Column must be greater than or equal to 1.`);if(y!=null&&!isNaN(y)&&y<1)throw new Error(`${t}End Column must be greater than or equal to 1.`);if(u!=null&&!isNaN(u)&&e!==void 0&&e!==null&&!isNaN(e)&&u>e)throw new Error(`${t}Start Row must be less than or equal to End Row.`);if(f!=null&&!isNaN(f)&&y!==void 0&&y!==null&&!isNaN(y)&&f>y)throw new Error(`${t}Start Column must be less than or equal to End Column.`);if(typeof a.sheet=="number"&&a.sheet<0)throw new Error(`${t}Sheet ID must be greater than or equal to 0.`)}async function Ha(a,p,t){if(!a)return a;let n=a;if(typeof a=="string"){const f=a.trim();if(f.startsWith("{"))try{n=new Function("return "+f)()}catch{try{n=JSON.parse(f)}catch{}}else try{n=cA(f,{errorPrefix:"Internal"})}catch{}}else if(typeof a=="object"&&a!==null)try{n=JSON.parse(JSON.stringify(a))}catch{n={...a}}if(n.sheet===void 0||n.sheet===null||n.sheet==="")return n;const s=typeof n.sheet=="string",u=typeof n.sheet=="number";if(p==="Name"&&s)return n;if(p==="Id"&&u)return n._resolvedSheetId=n.sheet,n;const e=n.sheet;try{const f=await t();for(const y of f){const m=y.id,T=y.name,g=String(T).trim().toLowerCase()===String(e).trim().toLowerCase(),b=String(m)===String(e);if(g||b)return n._resolvedSheetId=m,n._resolvedSheetName=T,n}}catch{}return n}function lv(a,p){if(!a)return"";if(typeof a=="string")return a;let t=a;if(typeof a=="string"&&a.trim().startsWith("{"))try{t=JSON.parse(a)}catch{}if(B4(t,p),t.namedRange&&t.namedRange.trim()!=="")return t.namedRange;const n=t._resolvedSheetName!==void 0?t._resolvedSheetName:typeof t.sheet=="string"?t.sheet:void 0,s=n?`'${n}'!`:"",u=R=>{if(typeof R=="number")return zL(R);if(typeof R=="string"){const I=R.replace("$","");if(/^\d+$/.test(I))return(R.startsWith("$")?"$":"")+zL(parseInt(I,10))}return R||""},e=u(t.startColumn),f=typeof t.startRow=="number"?t.startRow.toString():t.startRow||"",y=u(t.endColumn),m=typeof t.endRow=="number"?t.endRow.toString():t.endRow||"",T=`${e}${f}`,g=`${y}${m}`;if(T&&g)return`${s}${T}:${g}`;if(T)return`${s}${T}`;const b=s.replace(/!$/,"");return b||"A1"}function ps(a,p){if(!a)return{};let t=a;if(typeof a=="string"){const g=a.trim();if(g.startsWith("{"))try{t=new Function("return "+g)()}catch{try{t=JSON.parse(g)}catch{}}else try{t=cA(g,p)}catch{}}B4(t,p);const n={},s=t._resolvedSheetId!==void 0?t._resolvedSheetId:typeof t.sheet=="number"?t.sheet:/^\d+$/.test(String(t.sheet||""))?Number(t.sheet):void 0;s!=null&&!isNaN(s)&&(n.sheetId=s);const u=g=>{if(g==null)return null;if(typeof g=="string"){const b=g.trim().replace("$","");return b===""?null:/^\d+$/.test(b)?parseInt(b,10):NaN}return typeof g=="number"?g:null},e=g=>{if(g==null)return null;if(typeof g=="string"){const b=g.trim().replace("$","").toUpperCase();return b===""?null:/^\d+$/.test(b)?parseInt(b,10):IV(b)}return typeof g=="number"?g:null},f=u(t.startRow),y=u(t.endRow),m=e(t.startColumn),T=e(t.endColumn);return f!=null&&(n.startRowIndex=f-1),y!=null&&(n.endRowIndex=y),m!=null&&(n.startColumnIndex=m-1),T!=null&&(n.endColumnIndex=T),n}function YL(a,p){if(!a)return{};let t=a;if(typeof a=="string")if(a.trim().startsWith("{"))try{t=JSON.parse(a)}catch{t=cA(a,{errorPrefix:"Internal"})}else t=cA(a,{errorPrefix:"Internal"});B4(t,p);const n={},s=t._resolvedSheetId!==void 0?t._resolvedSheetId:typeof t.sheet=="number"?t.sheet:void 0;s!=null&&(n.sheetId=s);const u=g=>{if(g==null)return null;if(typeof g=="string"){const b=g.trim().replace("$","");return b===""?null:/^\d+$/.test(b)?parseInt(b,10):NaN}return typeof g=="number"?g:null},e=g=>{if(g==null)return null;if(typeof g=="string"){const b=g.trim().replace("$","").toUpperCase();return b===""?null:/^\d+$/.test(b)?parseInt(b,10):IV(b)}return typeof g=="number"?g:null},f=u(t.startRow),y=u(t.endRow),m=e(t.startColumn),T=e(t.endColumn);return f!=null&&(!isNaN(f)||y===null&&m===null&&T===null)?(n.dimension="ROWS",n.startIndex=isNaN(f)?NaN:f-1,y!=null?n.endIndex=y:n.endIndex=isNaN(f)?NaN:f):m!=null?(n.dimension="COLUMNS",n.startIndex=isNaN(m)?NaN:m-1,T!=null?n.endIndex=T:n.endIndex=isNaN(m)?NaN:m):f!=null&&(n.dimension="ROWS",n.startIndex=isNaN(f)?NaN:f-1,y!=null?n.endIndex=y:n.endIndex=isNaN(f)?NaN:f),n}function ln(a,p){const t=(p==null?void 0:p.errorPrefix)||"";if(typeof a!="string")throw new Error(`${t}Spreadsheet ID must be a string.`);const n=a.trim();if(n.length===0)throw new Error(`${t}Spreadsheet ID cannot be empty.`);if(n.includes("docs.google.com")||n.startsWith("http://")||n.startsWith("https://")||n.startsWith("www.google.com")){const u=n.match(/\/spreadsheets\/d\/e\/([a-zA-Z0-9-_]+)/);if(u&&u[1])return u[1];const e=n.match(/\/spreadsheets\/d\/([a-zA-Z0-9-_]+)/);if(e&&e[1])return e[1];throw new Error(`${t}Invalid Google Sheet URL format. Could not extract a valid Spreadsheet ID from the URL.`)}if(n.includes(" "))throw new Error(`${t}Spreadsheet ID cannot contain spaces.`);if(/[^a-zA-Z0-9-_]/.test(n))throw new Error(`${t}Spreadsheet ID contains invalid characters. Only alphanumeric characters, dashes, and underscores are allowed.`);return n}function UAt(a){if(!a)return"A1";const p=lv(a);if(!p)return"A1";const t=p.split("!");return t[t.length-1].trim().split(":")[0].trim().replace(/\$/g,"")||"A1"}function S4(a,p,t){if(!p){const f=YL(a,t);return f?[f]:[]}const n=ps(a,t),s=n.sheetId,u=f=>{const y={dimension:f};return s!=null&&(y.sheetId=s),f==="COLUMNS"?(n.startColumnIndex!==void 0&&n.startColumnIndex!==null&&(y.startIndex=n.startColumnIndex),n.endColumnIndex!==void 0&&n.endColumnIndex!==null&&(y.endIndex=n.endColumnIndex)):(n.startRowIndex!==void 0&&n.startRowIndex!==null&&(y.startIndex=n.startRowIndex),n.endRowIndex!==void 0&&n.endRowIndex!==null&&(y.endIndex=n.endRowIndex)),y},e=String(p).trim().toUpperCase();return e==="COLUMNS"?[u("COLUMNS")]:e==="ROWS"?[u("ROWS")]:e==="BOTH"?[u("COLUMNS"),u("ROWS")]:[YL(a,t)]}class KAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsGetSpreadsheet,version:"1.0.0",description:"Get Spreadsheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsGetSpreadsheet);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g;try{const b=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!b||!b.env)throw new Error("Editor context or environment missing");const R=Be(t,t.project,"getSpreadsheet"),A="["+Ve(t,t.project,"Get spreadsheet")+": `"+R+"`] ",O=(X,re,ae)=>{const le=Ve(X==null?void 0:X.valueOwner,b==null?void 0:b.logic,re),oe=Be(X==null?void 0:X.valueOwner,b==null?void 0:b.logic,ae);return`"${le}" (\`${oe}\`)`},P=n.find(X=>{var re;return((re=X.valueOwner.declaration)==null?void 0:re.id)===G.operation[J.GoogleSheetsGetSpreadsheet].inputs.connection.id}),x=(s=P==null?void 0:P.value)==null?void 0:s.valueAsType;if(!x||!x.id||!x.name||x.type!==r.DefinitionEntity)throw new Error(`${A}The ${O(P,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const $=ui(x);if(!$)throw new Error(`${A}The ${O(P,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const U=n.find(X=>{var re;return((re=X.valueOwner.declaration)==null?void 0:re.id)===G.operation[J.GoogleSheetsGetSpreadsheet].inputs.spreadsheetId.id}),Z=(u=U==null?void 0:U.value)==null?void 0:u.value,q=ln(Z,{errorPrefix:`${A}The ${O(U,"Spreadsheet ID","spreadsheetId")} input `}),Y={Authorization:`Bearer ${await b.getAccessToken()}`},ie=`${(e=b.env)==null?void 0:e.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${b.projectId}/${Zt["google-sheet"]}/${$}`,ee=(await(async X=>Ht.post(ie,X,{headers:Y}))({method:"GET",endpoint:`/v4/spreadsheets/${q}`})).data||{},te=(ee.sheets||[]).map(X=>{var re,ae,le,oe,ce,be,Ce,Ee,Oe,Le,Fe,tt,We;return{sheetId:(re=X.properties)==null?void 0:re.sheetId,title:(ae=X.properties)==null?void 0:ae.title,index:(le=X.properties)==null?void 0:le.index,sheetType:(oe=X.properties)==null?void 0:oe.sheetType,rowCount:(be=(ce=X.properties)==null?void 0:ce.gridProperties)==null?void 0:be.rowCount,columnCount:(Ee=(Ce=X.properties)==null?void 0:Ce.gridProperties)==null?void 0:Ee.columnCount,frozenRowCount:(Le=(Oe=X.properties)==null?void 0:Oe.gridProperties)==null?void 0:Le.frozenRowCount,frozenColumnCount:(tt=(Fe=X.properties)==null?void 0:Fe.gridProperties)==null?void 0:tt.frozenColumnCount,hidden:((We=X.properties)==null?void 0:We.hidden)??!1}});return{value:K.Success,error:null,result:{spreadsheetId:ee.spreadsheetId,title:(f=ee.properties)==null?void 0:f.title,spreadsheetUrl:ee.spreadsheetUrl,locale:(y=ee.properties)==null?void 0:y.locale,timeZone:(m=ee.properties)==null?void 0:m.timeZone,autoRecalc:(T=ee.properties)==null?void 0:T.autoRecalc,sheets:te}}}catch(b){const R=((g=b.response)==null?void 0:g.data)||b.message||b;return pe.Logger.log("[Google Sheets] error:",R),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:R,result:null}}}})}}class jAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsAddSheet,version:"1.0.0",description:"Add Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsAddSheet);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g;try{const b=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!b||!b.env)throw new Error("Editor context or environment missing");const R=Be(t,t.project,"addSheet"),A="["+Ve(t,t.project,"Add sheet")+": `"+R+"`] ",O=(oe,ce,be)=>{const Ce=Ve(oe==null?void 0:oe.valueOwner,b==null?void 0:b.logic,ce),Ee=Be(oe==null?void 0:oe.valueOwner,b==null?void 0:b.logic,be);return`"${Ce}" (\`${Ee}\`)`},P=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[J.GoogleSheetsAddSheet].inputs.connection.id}),x=(s=P==null?void 0:P.value)==null?void 0:s.valueAsType;if(!x||!x.id||!x.name||x.type!==r.DefinitionEntity)throw new Error(`${A}The ${O(P,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const $=ui(x);if(!$)throw new Error(`${A}The ${O(P,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const U=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[J.GoogleSheetsAddSheet].inputs.spreadsheetId.id}),Z=(u=U==null?void 0:U.value)==null?void 0:u.value,q=ln(Z,{errorPrefix:`${A}The ${O(U,"Spreadsheet ID","spreadsheetId")} input `}),H=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[J.GoogleSheetsAddSheet].inputs.title.id}),Y=(e=H==null?void 0:H.value)==null?void 0:e.value;if(Y!=null&&typeof Y!="string")throw new Error(`${A}The ${O(H,"Title","title")} input value is invalid. If present, it must be a string. E.g. "New Sheet"`);const z={Authorization:`Bearer ${await b.getAccessToken()}`},W=`${(f=b.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${b.projectId}/${Zt["google-sheet"]}/${$}`,re=((T=(m=(y=((await(async oe=>Ht.post(W,oe,{headers:z}))({method:"POST",endpoint:`/v4/spreadsheets/${q}:batchUpdate`,data:{requests:[{addSheet:{properties:{title:Y}}}]}})).data||{}).replies)==null?void 0:y[0])==null?void 0:m.addSheet)==null?void 0:T.properties)||{},ae=re.gridProperties||{},le={sheetId:re.sheetId,title:re.title,index:re.index,sheetType:re.sheetType,rowCount:ae.rowCount,columnCount:ae.columnCount,frozenRowCount:ae.frozenRowCount,frozenColumnCount:ae.frozenColumnCount,hideGridlines:ae.hideGridlines??!1,rowGroupControlAfter:ae.rowGroupControlAfter??!1,columnGroupControlAfter:ae.columnGroupControlAfter??!1,hidden:re.hidden??!1,rightToLeft:re.rightToLeft??!1,tabColor:re.tabColor?{red:re.tabColor.red??0,green:re.tabColor.green??0,blue:re.tabColor.blue??0,alpha:re.tabColor.alpha??1}:null,basicFilter:null,protectedRanges:[],bandedRanges:[],charts:[],conditionalFormatRules:[],mergedCells:[]};return{value:K.Success,error:null,result:le}}catch(b){const R=((g=b.response)==null?void 0:g.data)||b.message||b;return pe.Logger.log("[Google Sheets] error:",R),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:R,result:null}}}})}}class qAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsDeleteSheet,version:"1.0.0",description:"Delete Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsDeleteSheet);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T;try{const g=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!g||!g.env)throw new Error("Editor context or environment missing");const b=Be(t,t.project,"deleteSheet"),I="["+Ve(t,t.project,"Delete sheet")+": `"+b+"`] ",A=(te,X,re)=>{const ae=Ve(te==null?void 0:te.valueOwner,g==null?void 0:g.logic,X),le=Be(te==null?void 0:te.valueOwner,g==null?void 0:g.logic,re);return`"${ae}" (\`${le}\`)`},O=n.find(te=>{var X;return((X=te.valueOwner.declaration)==null?void 0:X.id)===G.operation[J.GoogleSheetsDeleteSheet].inputs.connection.id}),P=(s=O==null?void 0:O.value)==null?void 0:s.valueAsType;if(!P||!P.id||!P.name||P.type!==r.DefinitionEntity)throw new Error(`${I}The ${A(O,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=ui(P);if(!x)throw new Error(`${I}The ${A(O,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const $=n.find(te=>{var X;return((X=te.valueOwner.declaration)==null?void 0:X.id)===G.operation[J.GoogleSheetsDeleteSheet].inputs.spreadsheetId.id}),U=(u=$==null?void 0:$.value)==null?void 0:u.value,Z=ln(U,{errorPrefix:`${I}The ${A($,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(te=>{var X;return((X=te.valueOwner.declaration)==null?void 0:X.id)===G.operation[J.GoogleSheetsDeleteSheet].inputs.sheetId.id}),H=(e=q==null?void 0:q.value)==null?void 0:e.value;if(H==null||H==="")throw new Error(`${I}The ${A(q,"Sheet (ID or name)","sheetId")} input is missing.`);const ie={Authorization:`Bearer ${await g.getAccessToken()}`},z=`${(f=g.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${g.projectId}/${Zt["google-sheet"]}/${x}`,W=async te=>Ht.post(z,te,{headers:ie});let ee;if(typeof H=="number")ee=H;else if(typeof H=="string"){const te=H.trim(),X=await W({method:"GET",endpoint:`/v4/spreadsheets/${Z}?fields=sheets.properties(sheetId,title)`}).catch(()=>null),ae=(((y=X==null?void 0:X.data)==null?void 0:y.sheets)||[]).find(le=>{var oe,ce;return((oe=le.properties)==null?void 0:oe.title)===te||String((ce=le.properties)==null?void 0:ce.sheetId)===te});if(ae&&((m=ae.properties)==null?void 0:m.sheetId)!==void 0)ee=ae.properties.sheetId;else if(/^\d+$/.test(te))ee=parseInt(te,10);else throw new Error(`${I}Sheet "${H}" was not found in the spreadsheet.`)}else throw new Error(`${I}The ${A(q,"Sheet (ID or name)","sheetId")} input value is invalid. It must be a number or string.`);return await W({method:"POST",endpoint:`/v4/spreadsheets/${Z}:batchUpdate`,data:{requests:[{deleteSheet:{sheetId:ee}}]}}),{value:K.Success,error:null,result:null}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return pe.Logger.log("[Google Sheets] error:",b),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:b,result:null}}}})}}class ZAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsAppendRows,version:"1.0.0",description:"Append Row(s) Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsAppendRows);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T;try{const g=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!g||!g.env)throw new Error("Editor context or environment missing");const b=Be(t,t.project,"appendRows"),I="["+Ve(t,t.project,"Append rows")+": `"+b+"`] ",A=(oe,ce,be)=>{const Ce=Ve(oe==null?void 0:oe.valueOwner,g==null?void 0:g.logic,ce),Ee=Be(oe==null?void 0:oe.valueOwner,g==null?void 0:g.logic,be);return`"${Ce}" (\`${Ee}\`)`},O=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[J.GoogleSheetsAppendRows].inputs.connection.id}),P=(s=O==null?void 0:O.value)==null?void 0:s.valueAsType;if(!P||!P.id||!P.name||P.type!==r.DefinitionEntity)throw new Error(`${I}The ${A(O,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=ui(P);if(!x)throw new Error(`${I}The ${A(O,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const $=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[J.GoogleSheetsAppendRows].inputs.spreadsheetId.id}),U=(u=$==null?void 0:$.value)==null?void 0:u.value,Z=ln(U,{errorPrefix:`${I}The ${A($,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[J.GoogleSheetsAppendRows].inputs.range.id}),H=(e=q==null?void 0:q.value)==null?void 0:e.value;if(!H||H==="")throw new Error(`${I}The ${A(q,"Range","range")} input is missing.`);const Y=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[J.GoogleSheetsAppendRows].inputs.values.id}),ie=(f=Y==null?void 0:Y.value)==null?void 0:f.value;if(ie==null)throw new Error(`${I}The ${A(Y,"Values","values")} input is missing.`);const W={Authorization:`Bearer ${await g.getAccessToken()}`},ee=`${(y=g.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${g.projectId}/${Zt["google-sheet"]}/${x}`,te=async oe=>Ht.post(ee,oe,{headers:W});let X=ie;if(typeof ie=="string")try{X=JSON.parse(ie)}catch{}const re=await Ha(H,"Name",async()=>{var ce;return(((ce=(await te({method:"GET",endpoint:`/v4/spreadsheets/${Z}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:ce.sheets)||[]).map(be=>{var Ce,Ee;return{id:(Ce=be.properties)==null?void 0:Ce.sheetId,name:(Ee=be.properties)==null?void 0:Ee.title}})}),le=(await te({method:"POST",endpoint:`/v4/spreadsheets/${Z}/values/${lv(re,{errorPrefix:`${I}The ${A(q,"Range","range")} input `})}:append`,params:{valueInputOption:"USER_ENTERED"},data:{values:Array.isArray(X)?X:[X]}})).data||{};return{value:K.Success,error:null,result:{updatedRange:(m=le.updates)==null?void 0:m.updatedRange}}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return pe.Logger.log("[Google Sheets] error:",b),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:b,result:null}}}})}}class HAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsGetRangeValues,version:"1.0.0",description:"Get Range Values Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsGetRangeValues);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"getRangeValues"),b="["+Ve(t,t.project,"Get range values")+": `"+T+"`] ",R=(X,re,ae)=>{const le=Ve(X==null?void 0:X.valueOwner,m==null?void 0:m.logic,re),oe=Be(X==null?void 0:X.valueOwner,m==null?void 0:m.logic,ae);return`"${le}" (\`${oe}\`)`},I=n.find(X=>{var re;return((re=X.valueOwner.declaration)==null?void 0:re.id)===G.operation[J.GoogleSheetsGetRangeValues].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(A);if(!O)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(X=>{var re;return((re=X.valueOwner.declaration)==null?void 0:re.id)===G.operation[J.GoogleSheetsGetRangeValues].inputs.spreadsheetId.id}),x=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(x,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(X=>{var re;return((re=X.valueOwner.declaration)==null?void 0:re.id)===G.operation[J.GoogleSheetsGetRangeValues].inputs.range.id}),Z=(e=U==null?void 0:U.value)==null?void 0:e.value;if(!Z||Z==="")throw new Error(`${b}The ${R(U,"Range","range")} input is missing.`);const H={Authorization:`Bearer ${await m.getAccessToken()}`},Y=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${O}`,ie=async X=>Ht.post(Y,X,{headers:H}),z=await Ha(Z,"Name",async()=>{var re;return(((re=(await ie({method:"GET",endpoint:`/v4/spreadsheets/${$}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:re.sheets)||[]).map(ae=>{var le,oe;return{id:(le=ae.properties)==null?void 0:le.sheetId,name:(oe=ae.properties)==null?void 0:oe.title}})}),W=lv(z,{errorPrefix:`${b}The ${R(U,"Range","range")} input `}),te=(await ie({method:"GET",endpoint:`/v4/spreadsheets/${$}/values/${encodeURIComponent(W)}`})).data||{};return{value:K.Success,error:null,result:{values:te.values}}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class WAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsUpdateRangeValues,version:"1.0.0",description:"Update Range Values Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsUpdateRangeValues);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=Be(t,t.project,"updateRangeValues"),R="["+Ve(t,t.project,"Update range values")+": `"+g+"`] ",I=(le,oe,ce)=>{const be=Ve(le==null?void 0:le.valueOwner,T==null?void 0:T.logic,oe),Ce=Be(le==null?void 0:le.valueOwner,T==null?void 0:T.logic,ce);return`"${be}" (\`${Ce}\`)`},A=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[J.GoogleSheetsUpdateRangeValues].inputs.connection.id}),O=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${R}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const P=ui(O);if(!P)throw new Error(`${R}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[J.GoogleSheetsUpdateRangeValues].inputs.spreadsheetId.id}),$=(u=x==null?void 0:x.value)==null?void 0:u.value,U=ln($,{errorPrefix:`${R}The ${I(x,"Spreadsheet ID","spreadsheetId")} input `}),Z=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[J.GoogleSheetsUpdateRangeValues].inputs.range.id}),q=(e=Z==null?void 0:Z.value)==null?void 0:e.value;if(!q||q==="")throw new Error(`${R}The ${I(Z,"Range","range")} input is missing.`);const H=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[J.GoogleSheetsUpdateRangeValues].inputs.values.id}),Y=(f=H==null?void 0:H.value)==null?void 0:f.value;if(Y==null)throw new Error(`${R}The ${I(H,"Values","values")} input is missing.`);const z={Authorization:`Bearer ${await T.getAccessToken()}`},W=`${(y=T.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${T.projectId}/${Zt["google-sheet"]}/${P}`,ee=async le=>Ht.post(W,le,{headers:z});let te=Y;if(typeof Y=="string")try{te=JSON.parse(Y)}catch{}const X=await Ha(q,"Name",async()=>{var oe;return(((oe=(await ee({method:"GET",endpoint:`/v4/spreadsheets/${U}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:oe.sheets)||[]).map(ce=>{var be,Ce;return{id:(be=ce.properties)==null?void 0:be.sheetId,name:(Ce=ce.properties)==null?void 0:Ce.title}})}),ae=(await ee({method:"PUT",endpoint:`/v4/spreadsheets/${U}/values/${lv(X,{errorPrefix:`${R}The ${I(Z,"Range","range")} input `})}`,params:{valueInputOption:"USER_ENTERED"},data:{values:Array.isArray(te)?te:[te]}})).data||{};return{value:K.Success,error:null,result:{updatedRange:ae.updatedRange}}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return pe.Logger.log("[Google Sheets] error:",g),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:g,result:null}}}})}}class zAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsClearRange,version:"1.0.0",description:"Clear Range Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsClearRange);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"clearRange"),b="["+Ve(t,t.project,"Clear range")+": `"+T+"`] ",R=(te,X,re)=>{const ae=Ve(te==null?void 0:te.valueOwner,m==null?void 0:m.logic,X),le=Be(te==null?void 0:te.valueOwner,m==null?void 0:m.logic,re);return`"${ae}" (\`${le}\`)`},I=n.find(te=>{var X;return((X=te.valueOwner.declaration)==null?void 0:X.id)===G.operation[J.GoogleSheetsClearRange].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(A);if(!O)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(te=>{var X;return((X=te.valueOwner.declaration)==null?void 0:X.id)===G.operation[J.GoogleSheetsClearRange].inputs.spreadsheetId.id}),x=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(x,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(te=>{var X;return((X=te.valueOwner.declaration)==null?void 0:X.id)===G.operation[J.GoogleSheetsClearRange].inputs.range.id}),Z=(e=U==null?void 0:U.value)==null?void 0:e.value;if(!Z||Z==="")throw new Error(`${b}The ${R(U,"Range","range")} input is missing.`);const H={Authorization:`Bearer ${await m.getAccessToken()}`},Y=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${O}`,ie=async te=>Ht.post(Y,te,{headers:H}),z=await Ha(Z,"Name",async()=>{var X;return(((X=(await ie({method:"GET",endpoint:`/v4/spreadsheets/${$}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:X.sheets)||[]).map(re=>{var ae,le;return{id:(ae=re.properties)==null?void 0:ae.sheetId,name:(le=re.properties)==null?void 0:le.title}})}),ee=(await ie({method:"POST",endpoint:`/v4/spreadsheets/${$}/values/${lv(z,{errorPrefix:`${b}The ${R(U,"Range","range")} input `})}:clear`,data:{}})).data||{};return{value:K.Success,error:null,result:{clearedRange:ee.clearedRange}}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class YAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsBatchUpdateSpreadsheet,version:"1.0.0",description:"Batch Update Spreadsheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsBatchUpdateSpreadsheet);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"batchUpdateSpreadsheet"),b="["+Ve(t,t.project,"Batch update spreadsheet")+": `"+T+"`] ",R=(te,X,re)=>{const ae=Ve(te==null?void 0:te.valueOwner,m==null?void 0:m.logic,X),le=Be(te==null?void 0:te.valueOwner,m==null?void 0:m.logic,re);return`"${ae}" (\`${le}\`)`},I=n.find(te=>{var X;return((X=te.valueOwner.declaration)==null?void 0:X.id)===G.operation[J.GoogleSheetsBatchUpdateSpreadsheet].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(A);if(!O)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(te=>{var X;return((X=te.valueOwner.declaration)==null?void 0:X.id)===G.operation[J.GoogleSheetsBatchUpdateSpreadsheet].inputs.spreadsheetId.id}),x=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(x,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(te=>{var X;return((X=te.valueOwner.declaration)==null?void 0:X.id)===G.operation[J.GoogleSheetsBatchUpdateSpreadsheet].inputs.requests.id}),Z=(e=U==null?void 0:U.value)==null?void 0:e.value;if(Z==null||Z==="")throw new Error(`${b}The ${R(U,"Requests","requests")} input is missing.`);let q=Z;if(typeof Z=="string")try{q=JSON.parse(Z)}catch{}if(Array.isArray(q)||(q=[q]),q.length===0)throw new Error(`${b}The ${R(U,"Requests","requests")} input evaluated to an empty array. E.g. [{ addSheet: { properties: { title: "New Sheet" } } }]`);const Y={Authorization:`Bearer ${await m.getAccessToken()}`},ie=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${O}`,ee=(await(async te=>Ht.post(ie,te,{headers:Y}))({method:"POST",endpoint:`/v4/spreadsheets/${$}:batchUpdate`,data:{requests:q}})).data||{};return{value:K.Success,result:{replies:ee.replies||[]},error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class JAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsRenameSheet,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsRenameSheet);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g;try{const b=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!b||!b.env)throw new Error("Editor context or environment missing");const R=Be(t,t.project,"renameSheet"),A="["+Ve(t,t.project,"Rename sheet")+": `"+R+"`] ",O=(oe,ce,be)=>{const Ce=Ve(oe==null?void 0:oe.valueOwner,b==null?void 0:b.logic,ce),Ee=Be(oe==null?void 0:oe.valueOwner,b==null?void 0:b.logic,be);return`"${Ce}" (\`${Ee}\`)`},P=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[J.GoogleSheetsRenameSheet].inputs.connection.id}),x=(s=P==null?void 0:P.value)==null?void 0:s.valueAsType;if(!x||!x.id||!x.name||x.type!==r.DefinitionEntity)throw new Error(`${A}The ${O(P,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const $=ui(x);if(!$)throw new Error(`${A}The ${O(P,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const U=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[J.GoogleSheetsRenameSheet].inputs.spreadsheetId.id}),Z=(u=U==null?void 0:U.value)==null?void 0:u.value,q=ln(Z,{errorPrefix:`${A}The ${O(U,"Spreadsheet ID","spreadsheetId")} input `}),H=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[J.GoogleSheetsRenameSheet].inputs.sheetId.id}),Y=(e=H==null?void 0:H.value)==null?void 0:e.value;if(Y==null||Y==="")throw new Error(`${A}The ${O(H,"Sheet (ID or name)","sheetId")} input is missing.`);const ie=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[J.GoogleSheetsRenameSheet].inputs.title.id}),z=(f=ie==null?void 0:ie.value)==null?void 0:f.value;if(z!=null&&typeof z!="string")throw new Error(`${A}The ${O(ie,"Title","title")} input value is invalid, if present, it must be a string.`);const ee={Authorization:`Bearer ${await b.getAccessToken()}`},te=`${(y=b.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${b.projectId}/${Zt["google-sheet"]}/${$}`,X=async oe=>Ht.post(te,oe,{headers:ee});let re;if(typeof Y=="number")re=Y;else if(typeof Y=="string"){const oe=Y.trim(),ce=await X({method:"GET",endpoint:`/v4/spreadsheets/${q}?fields=sheets.properties(sheetId,title)`}).catch(()=>null),Ce=(((m=ce==null?void 0:ce.data)==null?void 0:m.sheets)||[]).find(Ee=>{var Oe,Le;return((Oe=Ee.properties)==null?void 0:Oe.title)===oe||String((Le=Ee.properties)==null?void 0:Le.sheetId)===oe});if(Ce&&((T=Ce.properties)==null?void 0:T.sheetId)!==void 0)re=Ce.properties.sheetId;else if(/^\d+$/.test(oe))re=parseInt(oe,10);else throw new Error(`${A}Sheet "${Y}" was not found in the spreadsheet.`)}else throw new Error(`${A}The ${O(H,"Sheet (ID or name)","sheetId")} input value is invalid. It must be a number or string.`);const ae={sheetId:re},le=[];return ae.title=z||"",le.push("title"),await X({method:"POST",endpoint:`/v4/spreadsheets/${q}:batchUpdate`,data:{requests:[{updateSheetProperties:{properties:ae,fields:le.join(",")}}]}}),{value:K.Success,result:null,error:null}}catch(b){const R=((g=b.response)==null?void 0:g.data)||b.message||b;return pe.Logger.log("[Google Sheets] error:",R),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:R,result:null}}}})}}class QAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsCopySheet,version:"1.0.0",description:"Copy Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsCopySheet);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b;try{const R=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!R||!R.env)throw new Error("Editor context or environment missing");const I=Be(t,t.project,"copySheet"),O="["+Ve(t,t.project,"Copy sheet")+": `"+I+"`] ",P=(Oe,Le,Fe)=>{const tt=Ve(Oe==null?void 0:Oe.valueOwner,R==null?void 0:R.logic,Le),We=Be(Oe==null?void 0:Oe.valueOwner,R==null?void 0:R.logic,Fe);return`"${tt}" (\`${We}\`)`},x=n.find(Oe=>{var Le;return((Le=Oe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[J.GoogleSheetsCopySheet].inputs.connection.id}),$=(s=x==null?void 0:x.value)==null?void 0:s.valueAsType;if(!$||!$.id||!$.name||$.type!==r.DefinitionEntity)throw new Error(`${O}The ${P(x,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const U=ui($);if(!U)throw new Error(`${O}The ${P(x,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const Z=n.find(Oe=>{var Le;return((Le=Oe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[J.GoogleSheetsCopySheet].inputs.spreadsheetId.id}),q=(u=Z==null?void 0:Z.value)==null?void 0:u.value,H=ln(q,{errorPrefix:`${O}The ${P(Z,"Spreadsheet ID","spreadsheetId")} input `}),Y=n.find(Oe=>{var Le;return((Le=Oe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[J.GoogleSheetsCopySheet].inputs.sheetId.id}),ie=(e=Y==null?void 0:Y.value)==null?void 0:e.value;if(ie==null||ie==="")throw new Error(`${O}The ${P(Y,"Sheet (ID or name)","sheetId")} input is missing.`);const z=n.find(Oe=>{var Le;return((Le=Oe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[J.GoogleSheetsCopySheet].inputs.destinationSpreadsheetId.id}),W=(f=z==null?void 0:z.value)==null?void 0:f.value;let ee=H;if(W!=null&&String(W).trim()!==""){if(typeof W!="string")throw new Error(`${O}The ${P(z,"Destination Spreadsheet ID","destinationSpreadsheetId")} input value is invalid, if present, it must be a string.`);ee=ln(W,{errorPrefix:`${O}The ${P(z,"Destination Spreadsheet ID","destinationSpreadsheetId")} input `})}const te=n.find(Oe=>{var Le;return((Le=Oe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[J.GoogleSheetsCopySheet].inputs.newSheetName.id}),X=(y=te==null?void 0:te.value)==null?void 0:y.value;if(X!=null&&typeof X!="string")throw new Error(`${O}The ${P(te,"New Sheet Name","newSheetName")} input value is invalid, if present, it must be a string.`);const ae={Authorization:`Bearer ${await R.getAccessToken()}`},le=`${(m=R.env)==null?void 0:m.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${R.projectId}/${Zt["google-sheet"]}/${U}`,oe=async Oe=>Ht.post(le,Oe,{headers:ae});let ce;if(typeof ie=="number")ce=ie;else if(typeof ie=="string"){const Oe=ie.trim(),Le=await oe({method:"GET",endpoint:`/v4/spreadsheets/${H}?fields=sheets.properties(sheetId,title)`}).catch(()=>null),tt=(((T=Le==null?void 0:Le.data)==null?void 0:T.sheets)||[]).find(We=>{var et,qe;return((et=We.properties)==null?void 0:et.title)===Oe||String((qe=We.properties)==null?void 0:qe.sheetId)===Oe});if(tt&&((g=tt.properties)==null?void 0:g.sheetId)!==void 0)ce=tt.properties.sheetId;else if(/^\d+$/.test(Oe))ce=parseInt(Oe,10);else throw new Error(`${O}Sheet "${ie}" was not found in the source spreadsheet.`)}else throw new Error(`${O}The ${P(Y,"Sheet (ID or name)","sheetId")} input value is invalid. It must be a number or string.`);const Ee=((await oe({method:"POST",endpoint:`/v4/spreadsheets/${H}/sheets/${ce}:copyTo`,data:{destinationSpreadsheetId:ee}})).data||{}).sheetId;return X&&typeof X=="string"&&X.trim()!==""&&await oe({method:"POST",endpoint:`/v4/spreadsheets/${ee}:batchUpdate`,data:{requests:[{updateSheetProperties:{properties:{sheetId:Ee,title:X.trim()},fields:"title"}}]}}),{value:K.Success,result:{newSheetId:Ee},error:null}}catch(R){const I=((b=R.response)==null?void 0:b.data)||R.message||R;return pe.Logger.log("[Google Sheets] error:",I),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:I,result:null}}}})}}class XAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsClearSheet,version:"1.0.0",description:"Clear Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsClearSheet);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b;try{const R=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!R||!R.env)throw new Error("Editor context or environment missing");const I=Be(t,t.project,"clearSheet"),O="["+Ve(t,t.project,"Clear sheet")+": `"+I+"`] ",P=(le,oe,ce)=>{const be=Ve(le==null?void 0:le.valueOwner,R==null?void 0:R.logic,oe),Ce=Be(le==null?void 0:le.valueOwner,R==null?void 0:R.logic,ce);return`"${be}" (\`${Ce}\`)`},x=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[J.GoogleSheetsClearSheet].inputs.connection.id}),$=(s=x==null?void 0:x.value)==null?void 0:s.valueAsType;if(!$||!$.id||!$.name||$.type!==r.DefinitionEntity)throw new Error(`${O}The ${P(x,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const U=ui($);if(!U)throw new Error(`${O}The ${P(x,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const Z=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[J.GoogleSheetsClearSheet].inputs.spreadsheetId.id}),q=(u=Z==null?void 0:Z.value)==null?void 0:u.value,H=ln(q,{errorPrefix:`${O}The ${P(Z,"Spreadsheet ID","spreadsheetId")} input `}),Y=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[J.GoogleSheetsClearSheet].inputs.sheetName.id}),ie=(e=Y==null?void 0:Y.value)==null?void 0:e.value;if(ie==null||ie==="")throw new Error(`${O}The ${P(Y,"Sheet (ID or name)","sheetName")} input is missing.`);const W={Authorization:`Bearer ${await R.getAccessToken()}`},ee=`${(f=R.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${R.projectId}/${Zt["google-sheet"]}/${U}`,te=async le=>Ht.post(ee,le,{headers:W});let X;if(typeof ie=="string"){const le=ie.trim();if(/^\d+$/.test(le)){const oe=await te({method:"GET",endpoint:`/v4/spreadsheets/${H}?fields=sheets.properties(sheetId,title)`}).catch(()=>null),be=(((y=oe==null?void 0:oe.data)==null?void 0:y.sheets)||[]).find(Ce=>{var Ee,Oe;return String((Ee=Ce.properties)==null?void 0:Ee.sheetId)===le||((Oe=Ce.properties)==null?void 0:Oe.title)===le});X=((m=be==null?void 0:be.properties)==null?void 0:m.title)||le}else X=le}else if(typeof ie=="number"){const ce=(((T=(await te({method:"GET",endpoint:`/v4/spreadsheets/${H}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:T.sheets)||[]).find(be=>{var Ce;return Number((Ce=be.properties)==null?void 0:Ce.sheetId)===ie});if(!ce||!((g=ce.properties)!=null&&g.title))throw new Error(`${O}Sheet with ID ${ie} was not found in the spreadsheet.`);X=ce.properties.title}else throw new Error(`${O}The ${P(Y,"Sheet (ID or name)","sheetName")} input value is invalid. It must be a number or string.`);const ae=(await te({method:"POST",endpoint:`/v4/spreadsheets/${H}/values/${encodeURIComponent(X)}:clear`,data:{}})).data||{};return{value:K.Success,result:{clearedRange:ae.clearedRange},error:null}}catch(R){const I=((b=R.response)==null?void 0:b.data)||R.message||R;return pe.Logger.log("[Google Sheets] error:",I),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:I,result:null}}}})}}class e1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsBatchGetValues,version:"1.0.0",description:"Batch Get Values Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsBatchGetValues);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T;try{const g=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!g||!g.env)throw new Error("Editor context or environment missing");const b=Be(t,t.project,"batchGetValues"),I="["+Ve(t,t.project,"Batch get values")+": `"+b+"`] ",A=(ce,be,Ce)=>{const Ee=Ve(ce==null?void 0:ce.valueOwner,g==null?void 0:g.logic,be),Oe=Be(ce==null?void 0:ce.valueOwner,g==null?void 0:g.logic,Ce);return`"${Ee}" (\`${Oe}\`)`},O=n.find(ce=>{var be;return((be=ce.valueOwner.declaration)==null?void 0:be.id)===G.operation[J.GoogleSheetsBatchGetValues].inputs.connection.id}),P=(s=O==null?void 0:O.value)==null?void 0:s.valueAsType;if(!P||!P.id||!P.name||P.type!==r.DefinitionEntity)throw new Error(`${I}The ${A(O,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=ui(P);if(!x)throw new Error(`${I}The ${A(O,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const $=n.find(ce=>{var be;return((be=ce.valueOwner.declaration)==null?void 0:be.id)===G.operation[J.GoogleSheetsBatchGetValues].inputs.spreadsheetId.id}),U=(u=$==null?void 0:$.value)==null?void 0:u.value,Z=ln(U,{errorPrefix:`${I}The ${A($,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(ce=>{var be;return((be=ce.valueOwner.declaration)==null?void 0:be.id)===G.operation[J.GoogleSheetsBatchGetValues].inputs.ranges.id}),H=(e=q==null?void 0:q.value)==null?void 0:e.value;if(H==null||H==="")throw new Error(`${I}The ${A(q,"Ranges","ranges")} input is missing.`);const ie={Authorization:`Bearer ${await g.getAccessToken()}`},z=`${(f=g.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${g.projectId}/${Zt["google-sheet"]}/${x}`,W=async ce=>Ht.post(z,ce,{headers:ie});let ee=Array.isArray(H)?H:[H];if(ee.length===0)throw new Error(`${I}The ${A(q,"Ranges","ranges")} input evaluated to an empty array. E.g. ["Sheet1!A1:B2"]`);let te=new Set;try{const be=((y=(await W({method:"GET",endpoint:`/v4/spreadsheets/${Z}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:y.sheets)||[];te=new Set(be.map(Ce=>{var Ee;return(Ee=Ce.properties)==null?void 0:Ee.title}).filter(Boolean))}catch{}const X=ce=>{const be=ce.indexOf("!");if(be>-1){let Ce=ce.substring(0,be).trim();return Ce.startsWith("'")&&Ce.endsWith("'")&&(Ce=Ce.slice(1,-1)),Ce}return null},re=[],ae=[];for(const ce of ee){const be=lv(ce,{errorPrefix:`${I}The ${A(q,"Ranges","ranges")} input `}),Ce=X(be);Ce&&te.size>0&&!te.has(Ce)?ae.push({range:be,majorDimension:"ROWS",values:[]}):re.push({a1Range:be})}let le=[];re.length>0&&(le=(((m=(await W({method:"POST",endpoint:`/v4/spreadsheets/${Z}/values:batchGetByDataFilter`,data:{dataFilters:re}})).data)==null?void 0:m.valueRanges)||[]).map(Ce=>Ce.valueRange||Ce));const oe=[...le,...ae];return{value:K.Success,result:{valueRanges:oe},error:null}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return pe.Logger.log("[Google Sheets] error:",b),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:b,result:null}}}})}}function fo(a){if(!a||typeof a!="object")return;const p={};return typeof a.red=="number"&&(p.red=a.red>1?a.red/255:a.red),typeof a.green=="number"&&(p.green=a.green>1?a.green/255:a.green),typeof a.blue=="number"&&(p.blue=a.blue>1?a.blue/255:a.blue),typeof a.alpha=="number"&&(p.alpha=a.alpha),Object.keys(p).length>0?p:void 0}class t1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsFormatCells,version:"1.0.0",description:"Format Cells Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsFormatCells);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"formatCells"),b="["+Ve(t,t.project,"Format cells")+": `"+T+"`] ",R=(ft,Et,pt)=>{const Me=Ve(ft==null?void 0:ft.valueOwner,m==null?void 0:m.logic,Et),Je=Be(ft==null?void 0:ft.valueOwner,m==null?void 0:m.logic,pt);return`"${Me}" (\`${Je}\`)`},I=n.find(ft=>{var Et;return((Et=ft.valueOwner.declaration)==null?void 0:Et.id)===G.operation[J.GoogleSheetsFormatCells].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(A);if(!O)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(ft=>{var Et;return((Et=ft.valueOwner.declaration)==null?void 0:Et.id)===G.operation[J.GoogleSheetsFormatCells].inputs.spreadsheetId.id}),x=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(x,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(ft=>{var Et;return((Et=ft.valueOwner.declaration)==null?void 0:Et.id)===G.operation[J.GoogleSheetsFormatCells].inputs.range.id}),Z=(e=U==null?void 0:U.value)==null?void 0:e.value;if(Z==null)throw new Error(`${b}The ${R(U,"Range","range")} input is missing.`);const H={Authorization:`Bearer ${await m.getAccessToken()}`},Y=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${O}`,ie=async ft=>Ht.post(Y,ft,{headers:H}),z=await Ha(Z,"Id",async()=>(await ie({method:"GET",endpoint:`/v4/spreadsheets/${$}?fields=sheets.properties(sheetId,title)`})).data.sheets.map(Et=>({id:Et.properties.sheetId,name:Et.properties.title}))),W=ps(z,{errorPrefix:`${b}The ${R(U,"Range","range")} input `}),ee=G.operation[J.GoogleSheetsFormatCells].inputs,te=ft=>{var pt;const Et=n.find(Me=>{var Je;return((Je=Me.valueOwner.declaration)==null?void 0:Je.id)===ft});return(pt=Et==null?void 0:Et.value)==null?void 0:pt.value},X=te(ee.bold.id),re=te(ee.italic.id),ae=te(ee.underline.id),le=te(ee.strikethrough.id),oe=te(ee.fontSize.id),ce=te(ee.fontFamily.id),be=te(ee.textColor.id),Ce=te(ee.backgroundColor.id),Ee=te(ee.horizontalAlignment.id),Oe=te(ee.verticalAlignment.id),Le=te(ee.wrapStrategy.id),Fe={},tt=[],We={},et=[];typeof X=="boolean"&&(We.bold=X,et.push("bold")),typeof re=="boolean"&&(We.italic=re,et.push("italic")),typeof ae=="boolean"&&(We.underline=ae,et.push("underline")),typeof le=="boolean"&&(We.strikethrough=le,et.push("strikethrough")),typeof oe=="number"&&!isNaN(oe)&&(We.fontSize=oe,et.push("fontSize")),typeof ce=="string"&&ce.trim()!==""&&(We.fontFamily=ce.trim(),et.push("fontFamily"));const qe=fo(be);qe&&(We.foregroundColor=qe,et.push("foregroundColor")),et.length>0&&(Fe.textFormat=We,tt.push(`userEnteredFormat.textFormat(${et.join(",")})`));const ot=fo(Ce);if(ot&&(Fe.backgroundColor=ot,tt.push("userEnteredFormat.backgroundColor")),typeof Ee=="string"&&Ee!==""){const ft={Left:"LEFT",Center:"CENTER",Right:"RIGHT",Justify:"JUSTIFY"};Fe.horizontalAlignment=ft[Ee]||Ee.toUpperCase(),tt.push("userEnteredFormat.horizontalAlignment")}if(typeof Oe=="string"&&Oe!==""){const ft={Top:"TOP",Middle:"MIDDLE",Bottom:"BOTTOM"};Fe.verticalAlignment=ft[Oe]||Oe.toUpperCase(),tt.push("userEnteredFormat.verticalAlignment")}if(typeof Le=="string"&&Le!==""){const ft={"Overflow cell":"OVERFLOW_CELL","Wrap text":"WRAP","Clip text":"CLIP"};Fe.wrapStrategy=ft[Le]||Le.toUpperCase(),tt.push("userEnteredFormat.wrapStrategy")}if(tt.length===0)return{value:K.Success,result:null,error:null};const st={repeatCell:{range:W,cell:{userEnteredFormat:Fe},fields:tt.join(",")}};return await ie({method:"POST",endpoint:`/v4/spreadsheets/${$}:batchUpdate`,data:{requests:[st]}}),{value:K.Success,result:null,error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class i1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsSetNumberFormat,version:"1.0.0",description:"Set Number Format Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsSetNumberFormat);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=Be(t,t.project,"setNumberFormat"),R="["+Ve(t,t.project,"Set number format")+": `"+g+"`] ",I=(ae,le,oe)=>{const ce=Ve(ae==null?void 0:ae.valueOwner,T==null?void 0:T.logic,le),be=Be(ae==null?void 0:ae.valueOwner,T==null?void 0:T.logic,oe);return`"${ce}" (\`${be}\`)`},A=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[J.GoogleSheetsSetNumberFormat].inputs.connection.id}),O=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${R}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const P=ui(O);if(!P)throw new Error(`${R}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[J.GoogleSheetsSetNumberFormat].inputs.spreadsheetId.id}),$=(u=x==null?void 0:x.value)==null?void 0:u.value,U=ln($,{errorPrefix:`${R}The ${I(x,"Spreadsheet ID","spreadsheetId")} input `}),Z=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[J.GoogleSheetsSetNumberFormat].inputs.range.id}),q=(e=Z==null?void 0:Z.value)==null?void 0:e.value;if(q==null)throw new Error(`${R}The ${I(Z,"Range","range")} input is missing.`);const Y={Authorization:`Bearer ${await T.getAccessToken()}`},ie=`${(f=T.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${T.projectId}/${Zt["google-sheet"]}/${P}`,z=async ae=>Ht.post(ie,ae,{headers:Y}),W=await Ha(q,"Id",async()=>(await z({method:"GET",endpoint:`/v4/spreadsheets/${U}?fields=sheets.properties(sheetId,title)`})).data.sheets.map(le=>({id:le.properties.sheetId,name:le.properties.title}))),ee=ps(W,{errorPrefix:`${R}The ${I(Z,"Range","range")} input `}),te=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[J.GoogleSheetsSetNumberFormat].inputs.pattern.id}),X=(y=te==null?void 0:te.value)==null?void 0:y.value;if(X==null||X==="")throw new Error(`${R}The ${I(te,"Pattern","pattern")} input is missing.`);if(typeof X!="string")throw new Error(`${R}The ${I(te,"Pattern","pattern")} input value is invalid. It must be a string.`);const re={repeatCell:{range:ee,cell:{userEnteredFormat:{numberFormat:{type:"CUSTOM",pattern:X}}},fields:"userEnteredFormat.numberFormat"}};return await z({method:"POST",endpoint:`/v4/spreadsheets/${U}:batchUpdate`,data:{requests:[re]}}),{value:K.Success,result:null,error:null}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return pe.Logger.log("[Google Sheets] error:",g),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:g,result:null}}}})}}class n1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsMergeCells,version:"1.0.0",description:"Merge Cells Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsMergeCells);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=Be(t,t.project,"mergeCells"),R="["+Ve(t,t.project,"Merge cells")+": `"+g+"`] ",I=(oe,ce,be)=>{const Ce=Ve(oe==null?void 0:oe.valueOwner,T==null?void 0:T.logic,ce),Ee=Be(oe==null?void 0:oe.valueOwner,T==null?void 0:T.logic,be);return`"${Ce}" (\`${Ee}\`)`},A=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[J.GoogleSheetsMergeCells].inputs.connection.id}),O=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${R}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const P=ui(O);if(!P)throw new Error(`${R}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[J.GoogleSheetsMergeCells].inputs.spreadsheetId.id}),$=(u=x==null?void 0:x.value)==null?void 0:u.value,U=ln($,{errorPrefix:`${R}The ${I(x,"Spreadsheet ID","spreadsheetId")} input `}),Z=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[J.GoogleSheetsMergeCells].inputs.range.id}),q=(e=Z==null?void 0:Z.value)==null?void 0:e.value;if(!q||q==="")throw new Error(`${R}The ${I(Z,"Range","range")} input is missing.`);const H=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[J.GoogleSheetsMergeCells].inputs.mergeType.id}),Y=(f=H==null?void 0:H.value)==null?void 0:f.value,ie={Columns:"MERGE_COLUMNS",Rows:"MERGE_ROWS",Both:"MERGE_ALL","All (combine entire range)":"MERGE_ALL","Columns (merge within columns)":"MERGE_COLUMNS","Rows (merge within rows)":"MERGE_ROWS",MERGE_ALL:"MERGE_ALL",MERGE_COLUMNS:"MERGE_COLUMNS",MERGE_ROWS:"MERGE_ROWS"},z=typeof Y=="string"?Y:String(Y||""),W=ie[z]||(Y?String(Y).toUpperCase():"MERGE_ALL"),te={Authorization:`Bearer ${await T.getAccessToken()}`},X=`${(y=T.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${T.projectId}/${Zt["google-sheet"]}/${P}`,re=async oe=>Ht.post(X,oe,{headers:te}),ae=await Ha(q,"Id",async()=>{var ce;return(((ce=(await re({method:"GET",endpoint:`/v4/spreadsheets/${U}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:ce.sheets)||[]).map(be=>{var Ce,Ee;return{id:(Ce=be.properties)==null?void 0:Ce.sheetId,name:(Ee=be.properties)==null?void 0:Ee.title}})}),le=ps(ae,{errorPrefix:`${R}The ${I(Z,"Range","range")} input `});return await re({method:"POST",endpoint:`/v4/spreadsheets/${U}:batchUpdate`,data:{requests:[{mergeCells:{range:le,mergeType:W}}]}}),{value:K.Success,error:null,result:null}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return pe.Logger.log("[Google Sheets] error:",g),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:g,result:null}}}})}}class r1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsUnmergeCells,version:"1.0.0",description:"Unmerge Cells Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsUnmergeCells);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"unmergeCells"),b="["+Ve(t,t.project,"Unmerge cells")+": `"+T+"`] ",R=(ee,te,X)=>{const re=Ve(ee==null?void 0:ee.valueOwner,m==null?void 0:m.logic,te),ae=Be(ee==null?void 0:ee.valueOwner,m==null?void 0:m.logic,X);return`"${re}" (\`${ae}\`)`},I=n.find(ee=>{var te;return((te=ee.valueOwner.declaration)==null?void 0:te.id)===G.operation[J.GoogleSheetsUnmergeCells].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(A);if(!O)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(ee=>{var te;return((te=ee.valueOwner.declaration)==null?void 0:te.id)===G.operation[J.GoogleSheetsUnmergeCells].inputs.spreadsheetId.id}),x=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(x,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(ee=>{var te;return((te=ee.valueOwner.declaration)==null?void 0:te.id)===G.operation[J.GoogleSheetsUnmergeCells].inputs.range.id}),Z=(e=U==null?void 0:U.value)==null?void 0:e.value;if(!Z||Z==="")throw new Error(`${b}The ${R(U,"Range","range")} input is missing.`);const H={Authorization:`Bearer ${await m.getAccessToken()}`},Y=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${O}`,ie=async ee=>Ht.post(Y,ee,{headers:H}),z=await Ha(Z,"Id",async()=>{var te;return(((te=(await ie({method:"GET",endpoint:`/v4/spreadsheets/${$}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:te.sheets)||[]).map(X=>{var re,ae;return{id:(re=X.properties)==null?void 0:re.sheetId,name:(ae=X.properties)==null?void 0:ae.title}})}),W=ps(z,{errorPrefix:`${b}The ${R(U,"Range","range")} input `});return await ie({method:"POST",endpoint:`/v4/spreadsheets/${$}:batchUpdate`,data:{requests:[{unmergeCells:{range:W}}]}}),{value:K.Success,error:null,result:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class a1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsAutoResizeDimensions,version:"1.0.0",description:"Auto-Resize Dimensions Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsAutoResizeDimensions);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=Be(t,t.project,"autoResizeDimensions"),R="["+Ve(t,t.project,"Auto-resize dimensions")+": `"+g+"`] ",I=(ae,le,oe)=>{const ce=Ve(ae==null?void 0:ae.valueOwner,T==null?void 0:T.logic,le),be=Be(ae==null?void 0:ae.valueOwner,T==null?void 0:T.logic,oe);return`"${ce}" (\`${be}\`)`},A=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[J.GoogleSheetsAutoResizeDimensions].inputs.connection.id}),O=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${R}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const P=ui(O);if(!P)throw new Error(`${R}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[J.GoogleSheetsAutoResizeDimensions].inputs.spreadsheetId.id}),$=(u=x==null?void 0:x.value)==null?void 0:u.value,U=ln($,{errorPrefix:`${R}The ${I(x,"Spreadsheet ID","spreadsheetId")} input `}),Z=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[J.GoogleSheetsAutoResizeDimensions].inputs.range.id}),q=(e=Z==null?void 0:Z.value)==null?void 0:e.value;if(q==null)throw new Error(`${R}The ${I(Z,"Range","range")} input is missing.`);const H=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[J.GoogleSheetsAutoResizeDimensions].inputs.dimension.id}),Y=((f=H==null?void 0:H.value)==null?void 0:f.value)||"Both",z={Authorization:`Bearer ${await T.getAccessToken()}`},W=`${(y=T.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${T.projectId}/${Zt["google-sheet"]}/${P}`,ee=async ae=>Ht.post(W,ae,{headers:z}),te=await Ha(q,"Id",async()=>{var le;return(((le=(await ee({method:"GET",endpoint:`/v4/spreadsheets/${U}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:le.sheets)||[]).map(oe=>{var ce,be;return{id:(ce=oe.properties)==null?void 0:ce.sheetId,name:(be=oe.properties)==null?void 0:be.title}})}),re=S4(te,typeof Y=="string"?Y:void 0,{errorPrefix:`${R}The ${I(Z,"Range","range")} input `}).map(ae=>({autoResizeDimensions:{dimensions:ae}}));return await ee({method:"POST",endpoint:`/v4/spreadsheets/${U}:batchUpdate`,data:{requests:re}}),{value:K.Success,result:null,error:null}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return pe.Logger.log("[Google Sheets] error:",g),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:g,result:null}}}})}}class s1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsFindAndReplace,version:"1.0.0",description:"Find and Replace Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsFindAndReplace);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A;try{const O=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!O||!O.env)throw new Error("Editor context or environment missing");const P=Be(t,t.project,"findAndReplace"),$="["+Ve(t,t.project,"Find and replace")+": `"+P+"`] ",U=(et,qe,ot)=>{const st=Ve(et==null?void 0:et.valueOwner,O==null?void 0:O.logic,qe),ft=Be(et==null?void 0:et.valueOwner,O==null?void 0:O.logic,ot);return`"${st}" (\`${ft}\`)`},Z=n.find(et=>{var qe;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===G.operation[J.GoogleSheetsFindAndReplace].inputs.connection.id}),q=(s=Z==null?void 0:Z.value)==null?void 0:s.valueAsType;if(!q||!q.id||!q.name||q.type!==r.DefinitionEntity)throw new Error(`${$}The ${U(Z,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const H=ui(q);if(!H)throw new Error(`${$}The ${U(Z,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const Y=n.find(et=>{var qe;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===G.operation[J.GoogleSheetsFindAndReplace].inputs.spreadsheetId.id}),ie=(u=Y==null?void 0:Y.value)==null?void 0:u.value,z=ln(ie,{errorPrefix:`${$}The ${U(Y,"Spreadsheet ID","spreadsheetId")} input `}),W=n.find(et=>{var qe;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===G.operation[J.GoogleSheetsFindAndReplace].inputs.range.id}),ee=(e=W==null?void 0:W.value)==null?void 0:e.value;if(ee==null)throw new Error(`${$}The ${U(W,"Range","range")} input is missing.`);const te=n.find(et=>{var qe;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===G.operation[J.GoogleSheetsFindAndReplace].inputs.find.id}),X=(f=te==null?void 0:te.value)==null?void 0:f.value;if(!X||X==="")throw new Error(`${$}The ${U(te,"Find","find")} input is missing.`);if(typeof X!="string")throw new Error(`${$}The ${U(te,"Find","find")} input value is invalid. It must be a non-empty string.`);const re=n.find(et=>{var qe;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===G.operation[J.GoogleSheetsFindAndReplace].inputs.replace.id}),ae=((y=re==null?void 0:re.value)==null?void 0:y.value)||"";if(typeof ae!="string")throw new Error(`${$}The ${U(re,"Replace","replace")} input value is invalid. It must be a string.`);const le=n.find(et=>{var qe;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===G.operation[J.GoogleSheetsFindAndReplace].inputs.matchCase.id}),oe=!!((m=le==null?void 0:le.value)!=null&&m.value),ce=n.find(et=>{var qe;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===G.operation[J.GoogleSheetsFindAndReplace].inputs.matchEntireCell.id}),be=!!((T=ce==null?void 0:ce.value)!=null&&T.value),Ee={Authorization:`Bearer ${await O.getAccessToken()}`},Oe=`${(g=O.env)==null?void 0:g.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${O.projectId}/${Zt["google-sheet"]}/${H}`,Le=async et=>Ht.post(Oe,et,{headers:Ee}),Fe={findReplace:{range:ps(ee,{errorPrefix:`${$}The ${U(W,"Range","range")} input `}),find:X,replacement:ae,matchCase:oe,matchEntireCell:be}},We=(await Le({method:"POST",endpoint:`/v4/spreadsheets/${z}:batchUpdate`,data:{requests:[Fe]}})).data||{};return{value:K.Success,result:{occurrencesChanged:((I=(R=(b=We.replies)==null?void 0:b[0])==null?void 0:R.findReplace)==null?void 0:I.occurrencesChanged)||0},error:null}}catch(O){const P=((A=O.response)==null?void 0:A.data)||O.message||O;return pe.Logger.log("[Google Sheets] error:",P),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:P,result:null}}}})}}const JL={"List of items":"ONE_OF_LIST","List from cell range":"ONE_OF_RANGE","Number greater than":"NUMBER_GREATER","Number greater than or equal":"NUMBER_GREATER_THAN_EQ","Number less than":"NUMBER_LESS","Number less than or equal":"NUMBER_LESS_THAN_EQ","Number equal to":"NUMBER_EQ","Number not equal to":"NUMBER_NOT_EQ","Number between":"NUMBER_BETWEEN","Number not between":"NUMBER_NOT_BETWEEN","Text contains":"TEXT_CONTAINS","Text does not contain":"TEXT_NOT_CONTAINS","Text starts with":"TEXT_STARTS_WITH","Text ends with":"TEXT_ENDS_WITH","Text equals":"TEXT_EQ","Text is valid email":"TEXT_IS_EMAIL","Text is valid URL":"TEXT_IS_URL","Date is":"DATE_EQ","Date is before":"DATE_BEFORE","Date is after":"DATE_AFTER","Date is on or before":"DATE_ON_OR_BEFORE","Date is on or after":"DATE_ON_OR_AFTER","Date is between":"DATE_BETWEEN","Date is not between":"DATE_NOT_BETWEEN","Date is valid":"DATE_IS_VALID",Checkbox:"BOOLEAN","Custom formula":"CUSTOM_FORMULA"},nO={NUMBER_EQUAL:"NUMBER_EQ",NUMBER_NOT_EQUAL:"NUMBER_NOT_EQ",TEXT_DOES_NOT_CONTAIN:"TEXT_NOT_CONTAINS",TEXT_EQUAL:"TEXT_EQ",DATE_TIME_EQUAL:"DATE_EQ",DATE_EQUAL:"DATE_EQ"},mRn=new Set([...Object.values(JL),...Object.keys(nO),...Object.values(nO)]);function l1t(a){if(!a||typeof a!="string")return null;const p=a.trim();if(!p)return null;if(JL[p])return JL[p];const t=p.toUpperCase().replace(/\s+/g,"_");return nO[t]?nO[t]:(mRn.has(t),t)}function TRn(a,p,t){if(a.length===0){t.push(new ht({id:`${p.id}--${Nr.ConditionValuesInvalidFormula}`,message:'Custom formula condition requires a formula string starting with "=" (e.g., ["=SUM(A1:A10)>100"]).',severity:Ie.Error,code:Nr.ConditionValuesInvalidFormula,entity:p}));return}a.length>1&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesInvalidFormula}-count`,message:`Custom formula condition rule accepts only 1 formula string (e.g., ["=SUM(A1:A10)>100"]). You provided ${a.length} items.`,severity:Ie.Error,code:Nr.ConditionValuesInvalidFormula,entity:p}));for(let n=0;n<a.length;n++){const s=String(a[n]).trim();s.startsWith("=")||t.push(new ht({id:`${p.id}--${Nr.ConditionValuesInvalidFormula}-${n}`,message:`Custom formula "${s}" ${a.length>1?`(at index ${n}) `:""}is invalid. A custom formula must start with "=" (e.g., "=A1>100" or "=ISNUMBER(A1)").`,severity:Ie.Error,code:Nr.ConditionValuesInvalidFormula,entity:p}))}}function vRn(a,p,t){if(a.length===0){t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleNumberRequired}`,message:'This numeric condition rule requires 1 numeric target value (e.g., ["100"]).',severity:Ie.Error,code:Nr.ConditionValuesSingleNumberRequired,entity:p}));return}a.length>1&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleNumberRequired}-count`,message:`This numeric condition rule accepts only 1 numeric target value (e.g., ["100"]). You provided ${a.length} items.`,severity:Ie.Error,code:Nr.ConditionValuesSingleNumberRequired,entity:p}));for(let n=0;n<a.length;n++){const s=String(a[n]).trim();(s===""||isNaN(Number(s)))&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleNumberRequired}-${n}`,message:`Condition value "${s}" ${a.length>1?`(at index ${n}) `:""}is invalid. It must be a valid number (e.g., "100").`,severity:Ie.Error,code:Nr.ConditionValuesSingleNumberRequired,entity:p}))}}function gRn(a,p,t){a.length!==2&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesTwoNumbersRequired}`,message:`A "between" condition rule requires exactly 2 boundary values (e.g., ["10", "50"] or ["2024-01-01", "2024-12-31"]). You provided ${a.length} items.`,severity:Ie.Error,code:Nr.ConditionValuesTwoNumbersRequired,entity:p}))}function bRn(a,p,t){if(a.length===0){t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleRangeRequired}`,message:'The "List from cell range" rule requires a valid cell range in A1 notation (e.g., ["Sheet1!A1:A50"]).',severity:Ie.Error,code:Nr.ConditionValuesSingleRangeRequired,entity:p}));return}a.length>1&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleRangeRequired}-count`,message:`The "List from cell range" rule accepts only 1 cell range in A1 notation (e.g., ["Sheet1!A1:A50"]). You provided ${a.length} items.`,severity:Ie.Error,code:Nr.ConditionValuesSingleRangeRequired,entity:p}))}function ERn(a,p,t){a.length===0&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesListEmpty}`,message:'The "List of items" rule requires at least one choice item (e.g., ["Pending", "Approved", "Rejected"]).',severity:Ie.Error,code:Nr.ConditionValuesListEmpty,entity:p}))}function IRn(a,p,t){if(a.length===0){t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleTextRequired}`,message:'This text condition rule requires a non-empty text target value (e.g., ["important"]).',severity:Ie.Error,code:Nr.ConditionValuesSingleTextRequired,entity:p}));return}a.length>1&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleTextRequired}-count`,message:`This text condition rule accepts only 1 text target value (e.g., ["important"]). You provided ${a.length} items.`,severity:Ie.Error,code:Nr.ConditionValuesSingleTextRequired,entity:p}));for(let n=0;n<a.length;n++)String(a[n]).trim()===""&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleTextRequired}-${n}`,message:`Text target value ${a.length>1?`(at index ${n}) `:""}is empty. Expected a non-empty text string.`,severity:Ie.Error,code:Nr.ConditionValuesSingleTextRequired,entity:p}))}function RRn(a,p,t){if(a.length===0){t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleTextRequired}`,message:'This date condition rule requires a target date or relative date string (e.g., ["2024-01-01"]).',severity:Ie.Error,code:Nr.ConditionValuesSingleTextRequired,entity:p}));return}a.length>1&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleTextRequired}-count`,message:`This date condition rule accepts only 1 target date string (e.g., ["2024-01-01"]). You provided ${a.length} items.`,severity:Ie.Error,code:Nr.ConditionValuesSingleTextRequired,entity:p}))}function ARn(a,p,t){a.length>0&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesNoValuesRequired}`,message:`This condition rule does not take any argument values (must be empty list []). You provided ${a.length} items.`,severity:Ie.Error,code:Nr.ConditionValuesNoValuesRequired,entity:p}))}function DRn(a,p,t,n){if(!p&&p!==0&&p!==!1)return;let s=[];if(typeof p=="string")try{const e=JSON.parse(p);s=Array.isArray(e)?e:[p]}catch{s=p.split(",").map(e=>e.trim()).filter(Boolean)}else Array.isArray(p)?s=p:s=[p];const u=l1t(a);if(u)switch(u){case"CUSTOM_FORMULA":TRn(s,t,n);break;case"ONE_OF_LIST":ERn(s,t,n);break;case"ONE_OF_RANGE":bRn(s,t,n);break;case"NUMBER_GREATER":case"NUMBER_GREATER_THAN_EQ":case"NUMBER_LESS":case"NUMBER_LESS_THAN_EQ":case"NUMBER_EQUAL":case"NUMBER_NOT_EQUAL":vRn(s,t,n);break;case"NUMBER_BETWEEN":case"NUMBER_NOT_BETWEEN":case"DATE_BETWEEN":case"DATE_NOT_BETWEEN":gRn(s,t,n);break;case"TEXT_CONTAINS":case"TEXT_NOT_CONTAINS":case"TEXT_DOES_NOT_CONTAIN":case"TEXT_STARTS_WITH":case"TEXT_ENDS_WITH":case"TEXT_EQ":case"TEXT_EQUAL":IRn(s,t,n);break;case"DATE_EQ":case"DATE_TIME_EQUAL":case"DATE_BEFORE":case"DATE_AFTER":case"DATE_ON_OR_BEFORE":case"DATE_ON_OR_AFTER":RRn(s,t,n);break;case"TEXT_IS_EMAIL":case"TEXT_IS_URL":case"DATE_IS_VALID":case"BOOLEAN":ARn(s,t,n);break}}class o1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsAddDataValidation,version:"1.0.0",description:"Add Data Validation Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsAddDataValidation);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T;try{const g=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!g||!g.env)throw new Error("Editor context or environment missing");const b=Be(t,t.project,"addDataValidation"),I="["+Ve(t,t.project,"Add data validation")+": `"+b+"`] ",A=(Oe,Le,Fe)=>{const tt=Ve(Oe==null?void 0:Oe.valueOwner,g==null?void 0:g.logic,Le),We=Be(Oe==null?void 0:Oe.valueOwner,g==null?void 0:g.logic,Fe);return`"${tt}" (\`${We}\`)`},O=n.find(Oe=>{var Le;return((Le=Oe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[J.GoogleSheetsAddDataValidation].inputs.connection.id}),P=(s=O==null?void 0:O.value)==null?void 0:s.valueAsType;if(!P||!P.id||!P.name||P.type!==r.DefinitionEntity)throw new Error(`${I}The ${A(O,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=ui(P);if(!x)throw new Error(`${I}The ${A(O,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const $=n.find(Oe=>{var Le;return((Le=Oe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[J.GoogleSheetsAddDataValidation].inputs.spreadsheetId.id}),U=(u=$==null?void 0:$.value)==null?void 0:u.value,Z=ln(U,{errorPrefix:`${I}The ${A($,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(Oe=>{var Le;return((Le=Oe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[J.GoogleSheetsAddDataValidation].inputs.range.id}),H=(e=q==null?void 0:q.value)==null?void 0:e.value;if(H==null)throw new Error(`${I}The ${A(q,"Range","range")} input is missing.`);const ie={Authorization:`Bearer ${await g.getAccessToken()}`},z=`${(f=g.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${g.projectId}/${Zt["google-sheet"]}/${x}`,W=async Oe=>Ht.post(z,Oe,{headers:ie}),ee=await Ha(H,"Id",async()=>(await W({method:"GET",endpoint:`/v4/spreadsheets/${Z}?fields=sheets.properties(sheetId,title)`})).data.sheets.map(Le=>({id:Le.properties.sheetId,name:Le.properties.title}))),te=ps(ee,{errorPrefix:`${I}The ${A(q,"Range","range")} input `}),X=n.find(Oe=>{var Le;return((Le=Oe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[J.GoogleSheetsAddDataValidation].inputs.conditionType.id}),re=(y=X==null?void 0:X.value)==null?void 0:y.value;if(!re||re==="")throw new Error(`${I}The ${A(X,"Condition Type","conditionType")} input is missing.`);if(typeof re!="string")throw new Error(`${I}The ${A(X,"Condition Type","conditionType")} input value is invalid. It must be a non-empty string.`);const ae=l1t(re)||re,le=n.find(Oe=>{var Le;return((Le=Oe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[J.GoogleSheetsAddDataValidation].inputs.conditionValues.id}),oe=(m=le==null?void 0:le.value)==null?void 0:m.value;let ce=oe;if(typeof oe=="string")try{ce=JSON.parse(oe)}catch{ce=oe.split(",").map(Le=>Le.trim())}Array.isArray(ce)||(ce=ce?[ce]:[]);let be=ae,Ce=ce.map(Oe=>({userEnteredValue:String(Oe)}));if(ae==="TEXT_STARTS_WITH"||ae==="TEXT_ENDS_WITH"){const Oe=UAt(H),Le=ce.length>0?String(ce[0]):"",Fe=Le.replace(/"/g,'""'),tt=ae==="TEXT_STARTS_WITH"?`=LEFT(${Oe}, ${Le.length})="${Fe}"`:`=RIGHT(${Oe}, ${Le.length})="${Fe}"`;be="CUSTOM_FORMULA",Ce=[{userEnteredValue:tt}]}const Ee={setDataValidation:{range:te,rule:{condition:{type:be,values:Ce},showCustomUi:!0}}};return await W({method:"POST",endpoint:`/v4/spreadsheets/${Z}:batchUpdate`,data:{requests:[Ee]}}),{value:K.Success,result:null,error:null}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return pe.Logger.log("[Google Sheets] error:",b),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:b,result:null}}}})}}class d1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsSortRange,version:"1.0.0",description:"Sort Range Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsSortRange);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T;try{const g=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!g||!g.env)throw new Error("Editor context or environment missing");const b=Be(t,t.project,"sortRange"),I="["+Ve(t,t.project,"Sort range")+": `"+b+"`] ",A=(Le,Fe,tt)=>{const We=Ve(Le==null?void 0:Le.valueOwner,g==null?void 0:g.logic,Fe),et=Be(Le==null?void 0:Le.valueOwner,g==null?void 0:g.logic,tt);return`"${We}" (\`${et}\`)`},O=n.find(Le=>{var Fe;return((Fe=Le.valueOwner.declaration)==null?void 0:Fe.id)===G.operation[J.GoogleSheetsSortRange].inputs.connection.id}),P=(s=O==null?void 0:O.value)==null?void 0:s.valueAsType;if(!P||!P.id||!P.name||P.type!==r.DefinitionEntity)throw new Error(`${I}The ${A(O,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=ui(P);if(!x)throw new Error(`${I}The ${A(O,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const $=n.find(Le=>{var Fe;return((Fe=Le.valueOwner.declaration)==null?void 0:Fe.id)===G.operation[J.GoogleSheetsSortRange].inputs.spreadsheetId.id}),U=(u=$==null?void 0:$.value)==null?void 0:u.value,Z=ln(U,{errorPrefix:`${I}The ${A($,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(Le=>{var Fe;return((Fe=Le.valueOwner.declaration)==null?void 0:Fe.id)===G.operation[J.GoogleSheetsSortRange].inputs.range.id}),H=(e=q==null?void 0:q.value)==null?void 0:e.value;if(H==null)throw new Error(`${I}The ${A(q,"Range","range")} input is missing.`);const ie={Authorization:`Bearer ${await g.getAccessToken()}`},z=`${(f=g.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${g.projectId}/${Zt["google-sheet"]}/${x}`,W=async Le=>Ht.post(z,Le,{headers:ie}),ee=await Ha(H,"Id",async()=>(await W({method:"GET",endpoint:`/v4/spreadsheets/${Z}?fields=sheets.properties(sheetId,title)`})).data.sheets.map(Fe=>({id:Fe.properties.sheetId,name:Fe.properties.title}))),te=ps(ee,{errorPrefix:`${I}The ${A(q,"Range","range")} input `}),X=n.find(Le=>{var Fe;return((Fe=Le.valueOwner.declaration)==null?void 0:Fe.id)===G.operation[J.GoogleSheetsSortRange].inputs.sortColumnIndex.id}),re=(y=X==null?void 0:X.value)==null?void 0:y.value;if(re==null)throw new Error(`${I}The ${A(X,"Sort Column Index","sortColumnIndex")} input is missing.`);if(typeof re!="number")throw new Error(`${I}The ${A(X,"Sort Column Index","sortColumnIndex")} input value is invalid. It must be a number.`);const ae=n.find(Le=>{var Fe;return((Fe=Le.valueOwner.declaration)==null?void 0:Fe.id)===G.operation[J.GoogleSheetsSortRange].inputs.sortOrder.id}),le=(m=ae==null?void 0:ae.value)==null?void 0:m.value;if(le==null||le==="")throw new Error(`${I}The ${A(ae,"Sort Order","sortOrder")} input is missing.`);if(typeof le!="string")throw new Error(`${I}The ${A(ae,"Sort Order","sortOrder")} input value is invalid. It must be a string.`);const ce={"Ascending (A-Z, 0-9)":"ASCENDING","Descending (Z-A, 9-0)":"DESCENDING",Ascending:"ASCENDING",Descending:"DESCENDING"}[le]||le.toUpperCase(),be=te.startColumnIndex??0,Ce=te.endColumnIndex;let Ee;if(re>=1?Ee=be+(re-1):Ee=be+re,Ce!==void 0&&(Ee<be||Ee>=Ce)){const Le=Ce-be;throw new Error(`${I}The ${A(X,"Sort Column Index","sortColumnIndex")} input value (${re}) is out of bounds for the specified range. The range contains ${Le} column(s).`)}const Oe={sortRange:{range:te,sortSpecs:[{dimensionIndex:Ee,sortOrder:ce}]}};return await W({method:"POST",endpoint:`/v4/spreadsheets/${Z}:batchUpdate`,data:{requests:[Oe]}}),{value:K.Success,result:null,error:null}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return pe.Logger.log("[Google Sheets] error:",b),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:b,result:null}}}})}}const CRn={"Is empty":"BLANK","Is not empty":"NOT_BLANK","Text contains":"TEXT_CONTAINS","Text does not contain":"TEXT_NOT_CONTAINS","Text starts with":"TEXT_STARTS_WITH","Text ends with":"TEXT_ENDS_WITH","Text is exactly":"TEXT_EQ","Greater than":"NUMBER_GREATER","Greater than or equal to":"NUMBER_GREATER_THAN_EQ","Less than":"NUMBER_LESS","Less than or equal to":"NUMBER_LESS_THAN_EQ","Is equal to":"NUMBER_EQUAL","Is not equal to":"NUMBER_NOT_EQUAL","Is between":"NUMBER_BETWEEN","Is not between":"NUMBER_NOT_BETWEEN","Custom formula":"CUSTOM_FORMULA"},wRn={"Ascending (A-Z, 0-9)":"ASCENDING","Descending (Z-A, 9-0)":"DESCENDING",Ascending:"ASCENDING",Descending:"DESCENDING"};class p1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsCreateFilter,version:"1.0.0",description:"Create Filter Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsCreateFilter);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R;try{const I=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!I||!I.env)throw new Error("Editor context or environment missing");const A=Be(t,t.project,"createFilter"),P="["+Ve(t,t.project,"Create filter")+": `"+A+"`] ",x=(pt,Me,Je)=>{const ke=Ve(pt==null?void 0:pt.valueOwner,I==null?void 0:I.logic,Me),lt=Be(pt==null?void 0:pt.valueOwner,I==null?void 0:I.logic,Je);return`"${ke}" (\`${lt}\`)`},$=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===G.operation[J.GoogleSheetsCreateFilter].inputs.connection.id}),U=(s=$==null?void 0:$.value)==null?void 0:s.valueAsType;if(!U||!U.id||!U.name||U.type!==r.DefinitionEntity)throw new Error(`${P}The ${x($,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const Z=ui(U);if(!Z)throw new Error(`${P}The ${x($,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const q=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===G.operation[J.GoogleSheetsCreateFilter].inputs.spreadsheetId.id}),H=(u=q==null?void 0:q.value)==null?void 0:u.value,Y=ln(H,{errorPrefix:`${P}The ${x(q,"Spreadsheet ID","spreadsheetId")} input `}),ie=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===G.operation[J.GoogleSheetsCreateFilter].inputs.range.id}),z=(e=ie==null?void 0:ie.value)==null?void 0:e.value;if(z==null)throw new Error(`${P}The ${x(ie,"Range","range")} input is missing.`);const W=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===G.operation[J.GoogleSheetsCreateFilter].inputs.columnIndex.id}),ee=(f=W==null?void 0:W.value)==null?void 0:f.value,te=typeof ee=="number"?ee:0,X=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===G.operation[J.GoogleSheetsCreateFilter].inputs.conditionType.id}),re=(y=X==null?void 0:X.value)==null?void 0:y.value,ae=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===G.operation[J.GoogleSheetsCreateFilter].inputs.conditionValues.id}),le=(m=ae==null?void 0:ae.value)==null?void 0:m.value,oe=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===G.operation[J.GoogleSheetsCreateFilter].inputs.hiddenValues.id}),ce=(T=oe==null?void 0:oe.value)==null?void 0:T.value,be=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===G.operation[J.GoogleSheetsCreateFilter].inputs.sortOrder.id}),Ce=(g=be==null?void 0:be.value)==null?void 0:g.value,Oe={Authorization:`Bearer ${await I.getAccessToken()}`},Le=`${(b=I.env)==null?void 0:b.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${I.projectId}/${Zt["google-sheet"]}/${Z}`,Fe=async pt=>Ht.post(Le,pt,{headers:Oe}),tt=await Ha(z,"Id",async()=>(await Fe({method:"GET",endpoint:`/v4/spreadsheets/${Y}?fields=sheets.properties(sheetId,title)`})).data.sheets.map(Me=>({id:Me.properties.sheetId,name:Me.properties.title}))),We=ps(tt,{errorPrefix:`${P}The ${x(ie,"Range","range")} input `}),et={range:We},qe={},ot=typeof re=="string"?re:String(re||""),st=CRn[ot]||(re?String(re).toUpperCase():void 0);if(st){const pt=Array.isArray(le)?le.map(Me=>({userEnteredValue:String(Me)})):le!=null&&le!==""?[{userEnteredValue:String(le)}]:void 0;qe.condition={type:st,...pt?{values:pt}:{}}}Array.isArray(ce)&&ce.length>0&&(qe.hiddenValues=ce.map(pt=>String(pt))),Object.keys(qe).length>0&&(et.criteria={[te]:qe});const ft=typeof Ce=="string"?Ce:String(Ce||""),Et=wRn[ft]||(Ce?String(Ce).toUpperCase():void 0);if(Et){const pt=We.startColumnIndex??0,Me=te>=1?pt+(te-1):pt+te;et.sortSpecs=[{dimensionIndex:Me,sortOrder:Et}]}return await Fe({method:"POST",endpoint:`/v4/spreadsheets/${Y}:batchUpdate`,data:{requests:[{setBasicFilter:{filter:et}}]}}),{value:K.Success,result:null,error:null}}catch(I){const A=((R=I.response)==null?void 0:R.data)||I.message||I;return pe.Logger.log("[Google Sheets] error:",A),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:A,result:null}}}})}}class u1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsRemoveFilter,version:"1.0.0",description:"Remove Filter Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsRemoveFilter);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"removeFilter"),b="["+Ve(t,t.project,"Remove filter")+": `"+T+"`] ",R=(te,X,re)=>{const ae=Ve(te==null?void 0:te.valueOwner,m==null?void 0:m.logic,X),le=Be(te==null?void 0:te.valueOwner,m==null?void 0:m.logic,re);return`"${ae}" (\`${le}\`)`},I=n.find(te=>{var X;return((X=te.valueOwner.declaration)==null?void 0:X.id)===G.operation[J.GoogleSheetsRemoveFilter].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(A);if(!O)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(te=>{var X;return((X=te.valueOwner.declaration)==null?void 0:X.id)===G.operation[J.GoogleSheetsRemoveFilter].inputs.spreadsheetId.id}),x=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(x,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(te=>{var X;return((X=te.valueOwner.declaration)==null?void 0:X.id)===G.operation[J.GoogleSheetsRemoveFilter].inputs.range.id}),Z=(e=U==null?void 0:U.value)==null?void 0:e.value;if(Z==null)throw new Error(`${b}The ${R(U,"Range","range")} input is missing.`);const H={Authorization:`Bearer ${await m.getAccessToken()}`},Y=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${O}`,ie=async te=>Ht.post(Y,te,{headers:H}),z=await Ha(Z,"Id",async()=>(await ie({method:"GET",endpoint:`/v4/spreadsheets/${$}?fields=sheets.properties(sheetId,title)`})).data.sheets.map(X=>({id:X.properties.sheetId,name:X.properties.title}))),ee=ps(z,{errorPrefix:`${b}The ${R(U,"Range","range")} input `}).sheetId;return await ie({method:"POST",endpoint:`/v4/spreadsheets/${$}:batchUpdate`,data:{requests:[{clearBasicFilter:{sheetId:ee}}]}}),{value:K.Success,result:null,error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class c1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsUpdateSpreadsheetProperties,version:"1.0.0",description:"Update Spreadsheet Properties Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsUpdateSpreadsheetProperties);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I;try{const A=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!A||!A.env)throw new Error("Editor context or environment missing");const O=Be(t,t.project,"updateSpreadsheetProperties"),x="["+Ve(t,t.project,"Update spreadsheet properties")+": `"+O+"`] ",$=(st,ft,Et)=>{const pt=Ve(st==null?void 0:st.valueOwner,A==null?void 0:A.logic,ft),Me=Be(st==null?void 0:st.valueOwner,A==null?void 0:A.logic,Et);return`"${pt}" (\`${Me}\`)`},U=n.find(st=>{var ft;return((ft=st.valueOwner.declaration)==null?void 0:ft.id)===G.operation[J.GoogleSheetsUpdateSpreadsheetProperties].inputs.connection.id}),Z=(s=U==null?void 0:U.value)==null?void 0:s.valueAsType;if(!Z||!Z.id||!Z.name||Z.type!==r.DefinitionEntity)throw new Error(`${x}The ${$(U,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const q=ui(Z);if(!q)throw new Error(`${x}The ${$(U,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const H=n.find(st=>{var ft;return((ft=st.valueOwner.declaration)==null?void 0:ft.id)===G.operation[J.GoogleSheetsUpdateSpreadsheetProperties].inputs.spreadsheetId.id}),Y=(u=H==null?void 0:H.value)==null?void 0:u.value,ie=ln(Y,{errorPrefix:`${x}The ${$(H,"Spreadsheet ID","spreadsheetId")} input `}),z=n.find(st=>{var ft;return((ft=st.valueOwner.declaration)==null?void 0:ft.id)===G.operation[J.GoogleSheetsUpdateSpreadsheetProperties].inputs.title.id}),W=(e=z==null?void 0:z.value)==null?void 0:e.value;if(W!=null&&typeof W!="string")throw new Error(`${x}The ${$(z,"Title","title")} input value is invalid. If present, it must be a string. E.g. "My Spreadsheet"`);const ee=n.find(st=>{var ft;return((ft=st.valueOwner.declaration)==null?void 0:ft.id)===G.operation[J.GoogleSheetsUpdateSpreadsheetProperties].inputs.locale.id}),te=(f=ee==null?void 0:ee.value)==null?void 0:f.value;if(te!=null&&typeof te!="string")throw new Error(`${x}The ${$(ee,"Locale","locale")} input value is invalid. If present, it must be a string. E.g. "en_US"`);const X=n.find(st=>{var ft;return((ft=st.valueOwner.declaration)==null?void 0:ft.id)===G.operation[J.GoogleSheetsUpdateSpreadsheetProperties].inputs.timeZone.id}),re=(y=X==null?void 0:X.value)==null?void 0:y.value;if(re!=null&&typeof re!="string")throw new Error(`${x}The ${$(X,"Time Zone","timeZone")} input value is invalid. If present, it must be a string. E.g. "America/New_York"`);const ae=n.find(st=>{var ft;return((ft=st.valueOwner.declaration)==null?void 0:ft.id)===G.operation[J.GoogleSheetsUpdateSpreadsheetProperties].inputs.autoRecalc.id}),le=(m=ae==null?void 0:ae.value)==null?void 0:m.value;if(le!=null&&typeof le!="string")throw new Error(`${x}The ${$(ae,"Auto Recalculation","autoRecalc")} input value is invalid. If present, it must be a string enum value. E.g. "ON_CHANGE"`);const oe=n.find(st=>{var ft;return((ft=st.valueOwner.declaration)==null?void 0:ft.id)===G.operation[J.GoogleSheetsUpdateSpreadsheetProperties].inputs.defaultFormat.id}),ce=(T=oe==null?void 0:oe.value)==null?void 0:T.value;if(ce!=null&&(typeof ce!="object"||Array.isArray(ce)))throw new Error(`${x}The ${$(oe,"Default Format","defaultFormat")} input value is invalid. If present, it must be an object representing the CellFormat.`);const be=n.find(st=>{var ft;return((ft=st.valueOwner.declaration)==null?void 0:ft.id)===G.operation[J.GoogleSheetsUpdateSpreadsheetProperties].inputs.iterativeCalculationSettings.id}),Ce=(g=be==null?void 0:be.value)==null?void 0:g.value;if(Ce!=null&&(typeof Ce!="object"||Array.isArray(Ce)))throw new Error(`${x}The ${$(be,"Iterative Calculation Settings","iterativeCalculationSettings")} input value is invalid. If present, it must be an object.`);const Ee=n.find(st=>{var ft;return((ft=st.valueOwner.declaration)==null?void 0:ft.id)===G.operation[J.GoogleSheetsUpdateSpreadsheetProperties].inputs.spreadsheetTheme.id}),Oe=(b=Ee==null?void 0:Ee.value)==null?void 0:b.value;if(Oe!=null&&(typeof Oe!="object"||Array.isArray(Oe)))throw new Error(`${x}The ${$(Ee,"Spreadsheet Theme","spreadsheetTheme")} input value is invalid. If present, it must be an object.`);const Le={};if(W!=null&&(Le.title=W),te!=null&&(Le.locale=te),re!=null&&(Le.timeZone=re),le!=null){const st={"On change":"ON_CHANGE","Every minute":"MINUTE","Every hour":"HOUR"};Le.autoRecalc=st[le]||le.toUpperCase()}ce!=null&&(Le.defaultFormat=ce),Ce!=null&&(Le.iterativeCalculationSettings=Ce),Oe!=null&&(Le.spreadsheetTheme=Oe);const Fe=(st,ft="")=>{let Et=[];for(const pt in st){if(!Object.prototype.hasOwnProperty.call(st,pt))continue;const Me=st[pt],Je=ft?`${ft}.${pt}`:pt;Me!==null&&typeof Me=="object"&&!Array.isArray(Me)&&Object.keys(Me).length>0?Et.push(...Fe(Me,Je)):Et.push(Je)}return Et},tt=Fe(Le);if(tt.length===0)throw new Error(`${x}At least one property must be provided to update.`);const et={Authorization:`Bearer ${await A.getAccessToken()}`},qe=`${(R=A.env)==null?void 0:R.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${A.projectId}/${Zt["google-sheet"]}/${q}`;return await(async st=>Ht.post(qe,st,{headers:et}))({method:"POST",endpoint:`/v4/spreadsheets/${ie}:batchUpdate`,data:{requests:[{updateSpreadsheetProperties:{properties:Le,fields:tt.join(",")}}]}}),{value:K.Success,result:null,error:null}}catch(A){const O=((I=A.response)==null?void 0:I.data)||A.message||A;return pe.Logger.log("[Google Sheets] error:",O),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:O,result:null}}}})}}const g5=(a,p)=>(pe.Logger.log("[Google Sheets Clone Sheet] error:",p),{value:a.catchesError||a.errorCalls.length?K.CaughtError:K.UnhandledError,error:p,result:null});class f1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsCloneSheet,version:"1.0.0",description:"Google Sheets clone sheet operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsCloneSheet);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A,O,P;try{const x=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0],$=Be(t,t.project,"cloneSheet"),Z="["+Ve(t,t.project,"Clone Sheet")+": `"+$+"`] ",q=(qe,ot,st)=>{const ft=Ve(qe==null?void 0:qe.valueOwner,x==null?void 0:x.logic,ot),Et=Be(qe==null?void 0:qe.valueOwner,x==null?void 0:x.logic,st);return`"${ft}" (\`${Et}\`)`},H=G.operation[J.GoogleSheetsCloneSheet],Y=n.find(qe=>{var ot,st;return((st=(ot=qe.valueOwner)==null?void 0:ot.declaration)==null?void 0:st.id)===H.inputs.connection.id}),ie=((s=Y==null?void 0:Y.value)==null?void 0:s.valueAsType)??((u=Y==null?void 0:Y.value)==null?void 0:u.value);if(!ie||!ie.id||!ie.name||ie.type!==r.DefinitionEntity)throw new Error(`${Z}The ${q(Y,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const z=ui(ie);if(!z)throw new Error(`${Z}The ${q(Y,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const W=n.find(qe=>{var ot,st;return((st=(ot=qe.valueOwner)==null?void 0:ot.declaration)==null?void 0:st.id)===H.inputs.spreadsheetId.id}),ee=(e=W==null?void 0:W.value)==null?void 0:e.value,te=ln(ee,{errorPrefix:`${Z}The ${q(W,"Spreadsheet ID","spreadsheetId")} input `}),X=n.find(qe=>{var ot,st;return((st=(ot=qe.valueOwner)==null?void 0:ot.declaration)==null?void 0:st.id)===H.inputs.sheet.id}),re=(f=X==null?void 0:X.value)==null?void 0:f.value;if(re==null||re==="")throw new Error(`${Z}The ${q(X,"Sheet","sheet")} input is missing.`);const ae=(m=(y=n.find(qe=>{var ot,st;return((st=(ot=qe.valueOwner)==null?void 0:ot.declaration)==null?void 0:st.id)===H.inputs.newSheetName.id}))==null?void 0:y.value)==null?void 0:m.value,le=(g=(T=n.find(qe=>{var ot,st;return((st=(ot=qe.valueOwner)==null?void 0:ot.declaration)==null?void 0:st.id)===H.inputs.insertIndex.id}))==null?void 0:T.value)==null?void 0:g.value,ce={Authorization:`Bearer ${await x.getAccessToken()}`},be=`${(b=x.env)==null?void 0:b.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${x.projectId}/${Zt["google-sheet"]}/${z}`,Ce=async qe=>Ht.post(be,qe,{headers:ce});let Ee;if(!isNaN(Number(re)))Ee=Number(re);else{const st=(((R=(await Ce({method:"GET",endpoint:`/v4/spreadsheets/${te}`})).data)==null?void 0:R.sheets)||[]).find(ft=>{var Et;return((Et=ft.properties)==null?void 0:Et.title)===String(re)});if(!st)return g5(t,`Could not find sheet with name "${re}"`);Ee=st.properties.sheetId}const Oe={sourceSheetId:Ee};ae&&(Oe.newSheetName=ae),typeof le=="number"&&(Oe.insertSheetIndex=le);const tt=((O=(A=(I=((await Ce({method:"POST",endpoint:`/v4/spreadsheets/${te}:batchUpdate`,data:{requests:[{duplicateSheet:Oe}]}})).data||{}).replies)==null?void 0:I[0])==null?void 0:A.duplicateSheet)==null?void 0:O.properties)||{},We=tt.gridProperties||{},et={sheetId:tt.sheetId,title:tt.title,index:tt.index,sheetType:tt.sheetType,rowCount:We.rowCount,columnCount:We.columnCount,frozenRowCount:We.frozenRowCount,frozenColumnCount:We.frozenColumnCount,hideGridlines:We.hideGridlines??!1,rowGroupControlAfter:We.rowGroupControlAfter??!1,columnGroupControlAfter:We.columnGroupControlAfter??!1,hidden:tt.hidden??!1,rightToLeft:tt.rightToLeft??!1,tabColor:tt.tabColor?{red:tt.tabColor.red??0,green:tt.tabColor.green??0,blue:tt.tabColor.blue??0,alpha:tt.tabColor.alpha??1}:null,basicFilter:null,protectedRanges:[],bandedRanges:[],charts:[],conditionalFormatRules:[],mergedCells:[]};return{value:K.Success,error:null,result:et}}catch(x){const $=((P=x.response)==null?void 0:P.data)||x.message||x;return g5(t,$)}}})}}class y1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsDeleteChart,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsDeleteChart);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"deleteChart"),b="["+Ve(t,t.project,"Delete Chart")+": `"+T+"`] ",R=(ee,te,X)=>{const re=Ve(ee==null?void 0:ee.valueOwner,m==null?void 0:m.logic,te),ae=Be(ee==null?void 0:ee.valueOwner,m==null?void 0:m.logic,X);return`"${re}" (\`${ae}\`)`},I=n.find(ee=>{var te;return((te=ee.valueOwner.declaration)==null?void 0:te.id)===G.operation[J.GoogleSheetsDeleteChart].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(A);if(!O)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(ee=>{var te;return((te=ee.valueOwner.declaration)==null?void 0:te.id)===G.operation[J.GoogleSheetsDeleteChart].inputs.spreadsheetId.id}),x=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(x,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(ee=>{var te;return((te=ee.valueOwner.declaration)==null?void 0:te.id)===G.operation[J.GoogleSheetsDeleteChart].inputs.chartId.id}),Z=(e=U==null?void 0:U.value)==null?void 0:e.value;let q=typeof Z=="number"?Z:typeof Z=="string"?parseInt(Z,10):NaN;if(isNaN(q))throw new Error(`${b}The ${R(U,"Chart ID","chartId")} input is missing or invalid. Expected a numeric chart ID.`);const Y={Authorization:`Bearer ${await m.getAccessToken()}`},ie=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${O}`,z=async ee=>Ht.post(ie,ee,{headers:Y});let W={};return W.deleteEmbeddedObject={objectId:q},await z({method:"POST",endpoint:`/v4/spreadsheets/${$}:batchUpdate`,data:{requests:[W]}}),{value:K.Success,result:null,error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class h1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsDeletePivotTable,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsDeletePivotTable);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"deletePivotTable"),b="["+Ve(t,t.project,"Delete Pivot Table")+": `"+T+"`] ",R=(re,ae,le)=>{const oe=Ve(re==null?void 0:re.valueOwner,m==null?void 0:m.logic,ae),ce=Be(re==null?void 0:re.valueOwner,m==null?void 0:m.logic,le);return`"${oe}" (\`${ce}\`)`},I=n.find(re=>{var ae;return((ae=re.valueOwner.declaration)==null?void 0:ae.id)===G.operation[J.GoogleSheetsDeletePivotTable].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(A);if(!O)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(re=>{var ae;return((ae=re.valueOwner.declaration)==null?void 0:ae.id)===G.operation[J.GoogleSheetsDeletePivotTable].inputs.spreadsheetId.id}),x=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(x,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(re=>{var ae;return((ae=re.valueOwner.declaration)==null?void 0:ae.id)===G.operation[J.GoogleSheetsDeletePivotTable].inputs.destination.id}),Z=(e=U==null?void 0:U.value)==null?void 0:e.value;if(Z==null)throw new Error(`${b}The ${R(U,"destination","destination")} input is missing.`);const H={Authorization:`Bearer ${await m.getAccessToken()}`},Y=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${O}`,ie=async re=>Ht.post(Y,re,{headers:H});let z=[];try{z=(await ie({method:"GET",endpoint:`/v4/spreadsheets/${$}?fields=sheets(properties(sheetId,title))`})).data.sheets||[]}catch{}const W=await Ha(Z,"Id",async()=>z.map(re=>({id:re.properties.sheetId,name:re.properties.title}))),ee=ps(W,{errorPrefix:`${b}The ${R(U,"destination","destination")} input `});let X={updateCells:{start:{sheetId:ee.sheetId??0,rowIndex:ee.startRowIndex??0,columnIndex:ee.startColumnIndex??0},rows:[{values:[{pivotTable:null}]}],fields:"pivotTable"}};return await ie({method:"POST",endpoint:`/v4/spreadsheets/${$}:batchUpdate`,data:{requests:[X]}}),{value:K.Success,result:null,error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class m1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsDeleteDimension,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsDeleteDimension);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b;try{const R=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!R||!R.env)throw new Error("Editor context or environment missing");const I=Be(t,t.project,"deleteDimension"),O="["+Ve(t,t.project,"Delete Dimension")+": `"+I+"`] ",P=(Fe,tt,We)=>{const et=Ve(Fe==null?void 0:Fe.valueOwner,R==null?void 0:R.logic,tt),qe=Be(Fe==null?void 0:Fe.valueOwner,R==null?void 0:R.logic,We);return`"${et}" (\`${qe}\`)`},x=n.find(Fe=>{var tt;return((tt=Fe.valueOwner.declaration)==null?void 0:tt.id)===G.operation[J.GoogleSheetsDeleteDimension].inputs.connection.id}),$=(s=x==null?void 0:x.value)==null?void 0:s.valueAsType;if(!$||!$.id||!$.name||$.type!==r.DefinitionEntity)throw new Error(`${O}The ${P(x,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const U=ui($);if(!U)throw new Error(`${O}The ${P(x,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const Z=n.find(Fe=>{var tt;return((tt=Fe.valueOwner.declaration)==null?void 0:tt.id)===G.operation[J.GoogleSheetsDeleteDimension].inputs.spreadsheetId.id}),q=(u=Z==null?void 0:Z.value)==null?void 0:u.value,H=ln(q,{errorPrefix:`${O}The ${P(Z,"Spreadsheet ID","spreadsheetId")} input `}),Y=n.find(Fe=>{var tt,We;return((tt=Fe.valueOwner.declaration)==null?void 0:tt.id)===((We=G.operation[J.GoogleSheetsDeleteDimension].inputs.sheet)==null?void 0:We.id)}),ie=(e=Y==null?void 0:Y.value)==null?void 0:e.value,z=n.find(Fe=>{var tt,We;return((tt=Fe.valueOwner.declaration)==null?void 0:tt.id)===((We=G.operation[J.GoogleSheetsDeleteDimension].inputs.dimension)==null?void 0:We.id)}),W=(f=z==null?void 0:z.value)==null?void 0:f.value,ee=n.find(Fe=>{var tt,We;return((tt=Fe.valueOwner.declaration)==null?void 0:tt.id)===((We=G.operation[J.GoogleSheetsDeleteDimension].inputs.startIndex)==null?void 0:We.id)}),te=(y=ee==null?void 0:ee.value)==null?void 0:y.value,X=n.find(Fe=>{var tt,We;return((tt=Fe.valueOwner.declaration)==null?void 0:tt.id)===((We=G.operation[J.GoogleSheetsDeleteDimension].inputs.endIndex)==null?void 0:We.id)}),re=(m=X==null?void 0:X.value)==null?void 0:m.value,le={Authorization:`Bearer ${await R.getAccessToken()}`},oe=`${(T=R.env)==null?void 0:T.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${R.projectId}/${Zt["google-sheet"]}/${U}`,ce=async Fe=>Ht.post(oe,Fe,{headers:le});if(ie==null||ie==="")throw new Error(`${O}The ${P(Y,"Sheet","sheet")} input is missing.`);if(W==null||W==="")throw new Error(`${O}The ${P(z,"Dimension","dimension")} input is missing.`);const be=String(W).trim().toUpperCase();if(be!=="ROWS"&&be!=="COLUMNS")throw new Error(`${O}The ${P(z,"Dimension","dimension")} input is invalid. Expected "Rows" or "Columns".`);const Ce=typeof te=="number"?te:parseInt(String(te),10);if(isNaN(Ce)||Ce<1)throw new Error(`${O}The ${P(ee,"Start index","startIndex")} input is missing or invalid. Expected a positive integer starting at 1.`);let Ee=Ce;if(re!=null&&re!==""&&(Ee=typeof re=="number"?re:parseInt(String(re),10),isNaN(Ee)||Ee<Ce))throw new Error(`${O}The ${P(X,"End index","endIndex")} input is invalid. Expected an integer greater than or equal to Start index.`);let Oe;if(typeof ie=="number"||/^\d+$/.test(String(ie).trim()))Oe=Number(ie);else{const We=(((g=(await ce({method:"GET",endpoint:`/v4/spreadsheets/${H}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:g.sheets)||[]).find(et=>{var qe;return String((qe=et.properties)==null?void 0:qe.title).trim().toLowerCase()===String(ie).trim().toLowerCase()});if(!We)throw new Error(`${O}The ${P(Y,"Sheet","sheet")} input "${ie}" was not found in spreadsheet.`);Oe=We.properties.sheetId}let Le={};return Le.deleteDimension={range:{sheetId:Oe,dimension:be,startIndex:Ce-1,endIndex:Ee}},await ce({method:"POST",endpoint:`/v4/spreadsheets/${H}:batchUpdate`,data:{requests:[Le]}}),{value:K.Success,result:null,error:null}}catch(R){const I=((b=R.response)==null?void 0:b.data)||R.message||R;return pe.Logger.log("[Google Sheets] error:",I),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:I,result:null}}}})}}class T1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsDeleteProtectedRange,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsDeleteProtectedRange);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"deleteProtectedRange"),b="["+Ve(t,t.project,"Delete Protected Range")+": `"+T+"`] ",R=(W,ee,te)=>{const X=Ve(W==null?void 0:W.valueOwner,m==null?void 0:m.logic,ee),re=Be(W==null?void 0:W.valueOwner,m==null?void 0:m.logic,te);return`"${X}" (\`${re}\`)`},I=n.find(W=>{var ee;return((ee=W.valueOwner.declaration)==null?void 0:ee.id)===G.operation[J.GoogleSheetsDeleteProtectedRange].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(A);if(!O)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(W=>{var ee;return((ee=W.valueOwner.declaration)==null?void 0:ee.id)===G.operation[J.GoogleSheetsDeleteProtectedRange].inputs.spreadsheetId.id}),x=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(x,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(W=>{var ee;return((ee=W.valueOwner.declaration)==null?void 0:ee.id)===G.operation[J.GoogleSheetsDeleteProtectedRange].inputs.protectedRangeId.id}),Z=(e=U==null?void 0:U.value)==null?void 0:e.value;if(Z==null)throw new Error(`${b}The ${R(U,"protectedRangeId","protectedRangeId")} input is missing.`);const H={Authorization:`Bearer ${await m.getAccessToken()}`},Y=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${O}`,ie=async W=>Ht.post(Y,W,{headers:H});let z={};return z.deleteProtectedRange={protectedRangeId:typeof Z=="string"&&Z.trim().startsWith("{")?JSON.parse(Z):Z},await ie({method:"POST",endpoint:`/v4/spreadsheets/${$}:batchUpdate`,data:{requests:[z]}}),{value:K.Success,result:null,error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class v1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsAddBanding,version:"1.0.0",description:"Add Banding Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsAddBanding);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A,O,P,x,$,U;try{const Z=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!Z||!Z.env)throw new Error("Editor context or environment missing");const q=Be(t,t.project,"addBanding"),Y="["+Ve(t,t.project,"Add Banding")+": `"+q+"`] ",ie=(di,bt,dt)=>{const It=Ve(di==null?void 0:di.valueOwner,Z==null?void 0:Z.logic,bt),Wt=Be(di==null?void 0:di.valueOwner,Z==null?void 0:Z.logic,dt);return`"${It}" (\`${Wt}\`)`},z=n.find(di=>{var bt;return((bt=di.valueOwner.declaration)==null?void 0:bt.id)===G.operation[J.GoogleSheetsAddBanding].inputs.connection.id}),W=(s=z==null?void 0:z.value)==null?void 0:s.valueAsType;if(!W||!W.id||!W.name||W.type!==r.DefinitionEntity)throw new Error(`${Y}The ${ie(z,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const ee=ui(W);if(!ee)throw new Error(`${Y}The ${ie(z,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const te=n.find(di=>{var bt;return((bt=di.valueOwner.declaration)==null?void 0:bt.id)===G.operation[J.GoogleSheetsAddBanding].inputs.spreadsheetId.id}),X=(u=te==null?void 0:te.value)==null?void 0:u.value,re=ln(X,{errorPrefix:`${Y}The ${ie(te,"Spreadsheet ID","spreadsheetId")} input `}),ae=n.find(di=>{var bt;return((bt=di.valueOwner.declaration)==null?void 0:bt.id)===G.operation[J.GoogleSheetsAddBanding].inputs.bandedRange.id}),le=(e=ae==null?void 0:ae.value)==null?void 0:e.value;if(le==null)throw new Error(`${Y}The ${ie(ae,"bandedRange","bandedRange")} input is missing.`);const oe=n.find(di=>{var bt,dt;return((bt=di.valueOwner.declaration)==null?void 0:bt.id)===((dt=G.operation[J.GoogleSheetsAddBanding].inputs.bandingOrientation)==null?void 0:dt.id)}),ce=(f=oe==null?void 0:oe.value)==null?void 0:f.value,be=typeof ce=="string"?ce:"Rows";if(!["Rows","Columns","Grid"].includes(be))throw new Error(`${Y}The ${ie(oe,"Banding Orientation","bandingOrientation")} input must be one of "Rows", "Columns", or "Grid". Received: "${be}".`);const Ce=n.find(di=>{var bt,dt;return((bt=di.valueOwner.declaration)==null?void 0:bt.id)===((dt=G.operation[J.GoogleSheetsAddBanding].inputs.headerColor)==null?void 0:dt.id)}),Ee=(y=Ce==null?void 0:Ce.value)==null?void 0:y.value,Oe=n.find(di=>{var bt,dt;return((bt=di.valueOwner.declaration)==null?void 0:bt.id)===((dt=G.operation[J.GoogleSheetsAddBanding].inputs.firstBandColor)==null?void 0:dt.id)}),Le=(m=Oe==null?void 0:Oe.value)==null?void 0:m.value,Fe=n.find(di=>{var bt,dt;return((bt=di.valueOwner.declaration)==null?void 0:bt.id)===((dt=G.operation[J.GoogleSheetsAddBanding].inputs.secondBandColor)==null?void 0:dt.id)}),tt=(T=Fe==null?void 0:Fe.value)==null?void 0:T.value,We=n.find(di=>{var bt,dt;return((bt=di.valueOwner.declaration)==null?void 0:bt.id)===((dt=G.operation[J.GoogleSheetsAddBanding].inputs.footerColor)==null?void 0:dt.id)}),et=(g=We==null?void 0:We.value)==null?void 0:g.value,qe=n.find(di=>{var bt,dt;return((bt=di.valueOwner.declaration)==null?void 0:bt.id)===((dt=G.operation[J.GoogleSheetsAddBanding].inputs.gridBandColor)==null?void 0:dt.id)}),ot=(b=qe==null?void 0:qe.value)==null?void 0:b.value,st=n.find(di=>{var bt,dt;return((bt=di.valueOwner.declaration)==null?void 0:bt.id)===((dt=G.operation[J.GoogleSheetsAddBanding].inputs.deleteConflictingBanding)==null?void 0:dt.id)}),ft=((R=st==null?void 0:st.value)==null?void 0:R.value)??!0,pt={Authorization:`Bearer ${await Z.getAccessToken()}`},Me=`${(I=Z.env)==null?void 0:I.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${Z.projectId}/${Zt["google-sheet"]}/${ee}`,Je=async di=>Ht.post(Me,di,{headers:pt});let ke=[],lt=[];try{lt=(await Je({method:"GET",endpoint:`/v4/spreadsheets/${re}?fields=sheets(properties(sheetId,title),bandedRanges)`})).data.sheets||[]}catch{}const Pt=await Ha(le,"Id",async()=>lt.map(di=>({id:di.properties.sheetId,name:di.properties.title}))),Gt=ps(Pt,{errorPrefix:`${Y}The ${ie(ae,"bandedRange","bandedRange")} input `});let si=null;if(Gt.sheetId!==void 0&&Gt.sheetId!==null)si=lt.find(di=>{var bt;return((bt=di.properties)==null?void 0:bt.sheetId)===Gt.sheetId});else if(Pt&&Pt.sheet!==void 0&&Pt.sheet!==null&&Pt.sheet!==""){const di=String(Pt.sheet).trim().toLowerCase();if(si=lt.find(bt=>{var dt,It;return String((dt=bt.properties)==null?void 0:dt.title).trim().toLowerCase()===di||String((It=bt.properties)==null?void 0:It.sheetId)===di}),!si)throw new Error(`${Y}Sheet "${Pt.sheet}" was not found in the spreadsheet.`);Gt.sheetId=si.properties.sheetId}else si=lt[0],Gt.sheetId=((A=si==null?void 0:si.properties)==null?void 0:A.sheetId)??0;Gt.startRowIndex===void 0&&Gt.endRowIndex===void 0&&Gt.startColumnIndex===void 0&&Gt.endColumnIndex===void 0&&(Gt.startRowIndex=0,Gt.endRowIndex=100,Gt.startColumnIndex=0,Gt.endColumnIndex=26),si!=null&&si.bandedRanges&&(ke=si.bandedRanges);const pi={range:Gt},kt=fo(Ee),Ct=fo(Le),xi=fo(tt),wn=fo(et),Yr=fo(ot),Jr={firstBandColor:Ct||{red:1,green:1,blue:1,alpha:1},secondBandColor:xi||{red:.95,green:.95,blue:.95,alpha:1}};kt&&(Jr.headerColor=kt),wn&&(Jr.footerColor=wn);const hi={firstBandColor:be==="Grid"?Yr||Ct||{red:1,green:1,blue:1,alpha:1}:Ct||{red:1,green:1,blue:1,alpha:1},secondBandColor:be==="Grid"?Yr||xi||{red:.95,green:.95,blue:.95,alpha:1}:xi||{red:.95,green:.95,blue:.95,alpha:1}};kt&&(hi.headerColor=kt),wn&&(hi.footerColor=wn),be==="Grid"?(pi.rowProperties=Jr,pi.columnProperties=hi):be==="Columns"?pi.columnProperties=hi:pi.rowProperties=Jr;const $t=[];if(ft)for(const di of ke)di.bandedRangeId!==void 0&&$t.push({deleteBanding:{bandedRangeId:di.bandedRangeId}});$t.push({addBanding:{bandedRange:pi}});const ci=(P=(O=(await Je({method:"POST",endpoint:`/v4/spreadsheets/${re}:batchUpdate`,data:{requests:$t}})).data)==null?void 0:O.replies)==null?void 0:P.find(di=>di.addBanding),oi=($=(x=ci==null?void 0:ci.addBanding)==null?void 0:x.bandedRange)==null?void 0:$.bandedRangeId;return{value:K.Success,result:{bandedRangeId:oi},error:null}}catch(Z){const q=((U=Z.response)==null?void 0:U.data)||Z.message||Z;return pe.Logger.log("[Google Sheets] error:",q),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:q,result:null}}}})}}class ORn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsUpdateBanding,version:"1.0.0",description:"Update Banding Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsUpdateBanding);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A;try{const O=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!O||!O.env)throw new Error("Editor context or environment missing");const P=Be(t,t.project,"updateBanding"),$="["+Ve(t,t.project,"Update Banding")+": `"+P+"`] ",U=(ci,oi,di)=>{const bt=Ve(ci==null?void 0:ci.valueOwner,O==null?void 0:O.logic,oi),dt=Be(ci==null?void 0:ci.valueOwner,O==null?void 0:O.logic,di);return`"${bt}" (\`${dt}\`)`},Z=n.find(ci=>{var oi;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===G.operation[J.GoogleSheetsUpdateBanding].inputs.connection.id}),q=(s=Z==null?void 0:Z.value)==null?void 0:s.valueAsType;if(!q||!q.id||!q.name||q.type!==r.DefinitionEntity)throw new Error(`${$}The ${U(Z,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const H=ui(q);if(!H)throw new Error(`${$}The ${U(Z,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const Y=n.find(ci=>{var oi;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===G.operation[J.GoogleSheetsUpdateBanding].inputs.spreadsheetId.id}),ie=(u=Y==null?void 0:Y.value)==null?void 0:u.value,z=ln(ie,{errorPrefix:`${$}The ${U(Y,"Spreadsheet ID","spreadsheetId")} input `}),W=n.find(ci=>{var oi;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===G.operation[J.GoogleSheetsUpdateBanding].inputs.bandedRangeId.id}),ee=(e=W==null?void 0:W.value)==null?void 0:e.value;if(ee==null||ee==="")throw new Error(`${$}The ${U(W,"Banded Range ID","bandedRangeId")} input is missing.`);const te=Number(ee),X=n.find(ci=>{var oi,di;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===((di=G.operation[J.GoogleSheetsUpdateBanding].inputs.bandedRange)==null?void 0:di.id)}),re=(f=X==null?void 0:X.value)==null?void 0:f.value,ae=n.find(ci=>{var oi,di;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===((di=G.operation[J.GoogleSheetsUpdateBanding].inputs.bandingOrientation)==null?void 0:di.id)}),le=(y=ae==null?void 0:ae.value)==null?void 0:y.value,oe=n.find(ci=>{var oi,di;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===((di=G.operation[J.GoogleSheetsUpdateBanding].inputs.headerColor)==null?void 0:di.id)}),ce=(m=oe==null?void 0:oe.value)==null?void 0:m.value,be=n.find(ci=>{var oi,di;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===((di=G.operation[J.GoogleSheetsUpdateBanding].inputs.firstBandColor)==null?void 0:di.id)}),Ce=(T=be==null?void 0:be.value)==null?void 0:T.value,Ee=n.find(ci=>{var oi,di;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===((di=G.operation[J.GoogleSheetsUpdateBanding].inputs.secondBandColor)==null?void 0:di.id)}),Oe=(g=Ee==null?void 0:Ee.value)==null?void 0:g.value,Le=n.find(ci=>{var oi,di;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===((di=G.operation[J.GoogleSheetsUpdateBanding].inputs.footerColor)==null?void 0:di.id)}),Fe=(b=Le==null?void 0:Le.value)==null?void 0:b.value,tt=n.find(ci=>{var oi,di;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===((di=G.operation[J.GoogleSheetsUpdateBanding].inputs.gridBandColor)==null?void 0:di.id)}),We=(R=tt==null?void 0:tt.value)==null?void 0:R.value,qe={Authorization:`Bearer ${await O.getAccessToken()}`},ot=`${(I=O.env)==null?void 0:I.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${O.projectId}/${Zt["google-sheet"]}/${H}`,st=async ci=>Ht.post(ot,ci,{headers:qe});let ft=[];try{ft=(await st({method:"GET",endpoint:`/v4/spreadsheets/${z}?fields=sheets(properties(sheetId,title),bandedRanges)`})).data.sheets||[]}catch{}const Et=[];for(const ci of ft)if(ci.bandedRanges)for(const oi of ci.bandedRanges)Et.push({sheet:ci,band:oi});const pt=Et.find(ci=>Number(ci.band.bandedRangeId)===Number(te));if(Et.length>0&&!pt)throw new Error(`${$}No Banded Range with ID "${te}" was found in the sheet.`);const Me=pt==null?void 0:pt.band,Je={bandedRangeId:te};if(re){const ci=await Ha(re,"Id",async()=>ft.map(di=>({id:di.properties.sheetId,name:di.properties.title}))),oi=ps(ci,{errorPrefix:`${$}The ${U(X,"bandedRange","bandedRange")} input `});(oi.sheetId===void 0||oi.sheetId===null)&&(oi.sheetId=0),Je.range=oi}else Me!=null&&Me.range&&(Je.range=Me.range);const ke=Me!=null&&Me.rowProperties&&(Me!=null&&Me.columnProperties)?"Grid":Me!=null&&Me.columnProperties?"Columns":"Rows",lt=le||ke,Pt=fo(ce),Gt=fo(Ce),si=fo(Oe),pi=fo(Fe),kt=fo(We),Ct=(Me==null?void 0:Me.rowProperties)||{},xi=(Me==null?void 0:Me.columnProperties)||{},wn={firstBandColor:Gt||Ct.firstBandColor||{red:1,green:1,blue:1,alpha:1},secondBandColor:si||Ct.secondBandColor||{red:.95,green:.95,blue:.95,alpha:1}},Yr=Pt||Ct.headerColor;Yr&&(wn.headerColor=Yr);const Jr=pi||Ct.footerColor;Jr&&(wn.footerColor=Jr);const hi={firstBandColor:lt==="Grid"?kt||Gt||xi.firstBandColor||{red:1,green:1,blue:1,alpha:1}:Gt||xi.firstBandColor||{red:1,green:1,blue:1,alpha:1},secondBandColor:lt==="Grid"?kt||si||xi.secondBandColor||{red:.95,green:.95,blue:.95,alpha:1}:si||xi.secondBandColor||{red:.95,green:.95,blue:.95,alpha:1}},$t=Pt||xi.headerColor;$t&&(hi.headerColor=$t);const Nt=pi||xi.footerColor;return Nt&&(hi.footerColor=Nt),lt==="Grid"?(Je.rowProperties=wn,Je.columnProperties=hi):lt==="Columns"?Je.columnProperties=hi:Je.rowProperties=wn,await st({method:"POST",endpoint:`/v4/spreadsheets/${z}:batchUpdate`,data:{requests:[{updateBanding:{bandedRange:Je,fields:"*"}}]}}),{value:K.Success,result:null,error:null}}catch(O){const P=((A=O.response)==null?void 0:A.data)||O.message||O;return pe.Logger.log("[Google Sheets] error:",P),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:P,result:null}}}})}}class xRn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsDeleteBanding,version:"1.0.0",description:"Delete Banding Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsDeleteBanding);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"deleteBanding"),b="["+Ve(t,t.project,"Delete Banding")+": `"+T+"`] ",R=(W,ee,te)=>{const X=Ve(W==null?void 0:W.valueOwner,m==null?void 0:m.logic,ee),re=Be(W==null?void 0:W.valueOwner,m==null?void 0:m.logic,te);return`"${X}" (\`${re}\`)`},I=n.find(W=>{var ee;return((ee=W.valueOwner.declaration)==null?void 0:ee.id)===G.operation[J.GoogleSheetsDeleteBanding].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(A);if(!O)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(W=>{var ee;return((ee=W.valueOwner.declaration)==null?void 0:ee.id)===G.operation[J.GoogleSheetsDeleteBanding].inputs.spreadsheetId.id}),x=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(x,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(W=>{var ee;return((ee=W.valueOwner.declaration)==null?void 0:ee.id)===G.operation[J.GoogleSheetsDeleteBanding].inputs.bandedRangeId.id}),Z=(e=U==null?void 0:U.value)==null?void 0:e.value;if(Z==null||Z==="")throw new Error(`${b}The ${R(U,"Banded Range ID","bandedRangeId")} input is missing.`);const q=Number(Z),Y={Authorization:`Bearer ${await m.getAccessToken()}`},ie=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${O}`;return await(async W=>Ht.post(ie,W,{headers:Y}))({method:"POST",endpoint:`/v4/spreadsheets/${$}:batchUpdate`,data:{requests:[{deleteBanding:{bandedRangeId:q}}]}}),{value:K.Success,result:null,error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class g1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsAddChart,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsAddChart);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T;try{const g=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!g||!g.env)throw new Error("Editor context or environment missing");const b=Be(t,t.project,"addChart"),I="["+Ve(t,t.project,"Add Chart")+": `"+b+"`] ",A=(oe,ce,be)=>{const Ce=Ve(oe==null?void 0:oe.valueOwner,g==null?void 0:g.logic,ce),Ee=Be(oe==null?void 0:oe.valueOwner,g==null?void 0:g.logic,be);return`"${Ce}" (\`${Ee}\`)`},O=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[J.GoogleSheetsAddChart].inputs.connection.id}),P=(s=O==null?void 0:O.value)==null?void 0:s.valueAsType;if(!P||!P.id||!P.name||P.type!==r.DefinitionEntity)throw new Error(`${I}The ${A(O,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=ui(P);if(!x)throw new Error(`${I}The ${A(O,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const $=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[J.GoogleSheetsAddChart].inputs.spreadsheetId.id}),U=(u=$==null?void 0:$.value)==null?void 0:u.value,Z=ln(U,{errorPrefix:`${I}The ${A($,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[J.GoogleSheetsAddChart].inputs.chart.id}),H=(e=q==null?void 0:q.value)==null?void 0:e.value;if(H==null||typeof H!="object")throw new Error(`${I}The ${A(q,"Chart","chart")} input is missing or invalid. Expected a valid chart object.`);const ie={Authorization:`Bearer ${await g.getAccessToken()}`},z=`${(f=g.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${g.projectId}/${Zt["google-sheet"]}/${x}`,W=async oe=>Ht.post(z,oe,{headers:ie});let ee={};ee.addChart={chart:H};const X=(await W({method:"POST",endpoint:`/v4/spreadsheets/${Z}:batchUpdate`,data:{requests:[ee]}})).data,re=(m=(y=X==null?void 0:X.replies)==null?void 0:y[0])==null?void 0:m.addChart,ae=(re==null?void 0:re.chart)??null,le=(ae==null?void 0:ae.chartId)??null;return{value:K.Success,result:{chartId:le,chart:ae},error:null}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return pe.Logger.log("[Google Sheets] error:",b),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:b,result:null}}}})}}function PRn(a){return{"Number greater than":"NUMBER_GREATER","Number greater than or equal":"NUMBER_GREATER_THAN_EQ","Number less than":"NUMBER_LESS","Number less than or equal":"NUMBER_LESS_THAN_EQ","Number equal to":"NUMBER_EQ","Number not equal to":"NUMBER_NOT_EQ","Number between":"NUMBER_BETWEEN","Number not between":"NUMBER_NOT_BETWEEN","Text contains":"TEXT_CONTAINS","Text does not contain":"TEXT_NOT_CONTAINS","Text starts with":"TEXT_STARTS_WITH","Text ends with":"TEXT_ENDS_WITH","Text equals":"TEXT_EQ","Date is":"DATE_EQ","Date is before":"DATE_BEFORE","Date is after":"DATE_AFTER","Date is on or before":"DATE_ON_OR_BEFORE","Date is on or after":"DATE_ON_OR_AFTER","Cell is empty":"BLANK","Cell is not empty":"NOT_BLANK","Custom formula":"CUSTOM_FORMULA"}[a]||a}class b1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsAddConditionalFormatRule,version:"1.0.0",description:"Add Conditional Format Rule Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsAddConditionalFormatRule);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"addConditionalFormatRule"),b="["+Ve(t,t.project,"Add Conditional Format Rule")+": `"+T+"`] ",R=(pt,Me,Je)=>{const ke=Ve(pt==null?void 0:pt.valueOwner,m==null?void 0:m.logic,Me),lt=Be(pt==null?void 0:pt.valueOwner,m==null?void 0:m.logic,Je);return`"${ke}" (\`${lt}\`)`},I=G.operation[J.GoogleSheetsAddConditionalFormatRule].inputs,A=pt=>{var Je;const Me=n.find(ke=>{var lt;return((lt=ke.valueOwner.declaration)==null?void 0:lt.id)===pt});return(Je=Me==null?void 0:Me.value)==null?void 0:Je.value},O=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===I.connection.id}),P=(s=O==null?void 0:O.value)==null?void 0:s.valueAsType;if(!P||!P.id||!P.name||P.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(O,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=ui(P);if(!x)throw new Error(`${b}The ${R(O,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const $=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===I.spreadsheetId.id}),U=(u=$==null?void 0:$.value)==null?void 0:u.value,Z=ln(U,{errorPrefix:`${b}The ${R($,"Spreadsheet ID","spreadsheetId")} input `}),H={Authorization:`Bearer ${await m.getAccessToken()}`},Y=`${(e=m.env)==null?void 0:e.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${x}`,ie=async pt=>Ht.post(Y,pt,{headers:H}),z=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===I.range.id}),W=A(I.range.id),ee=A(I.conditionType.id),te=A(I.conditionValues.id),X=A(I.backgroundColor.id),re=A(I.textColor.id),ae=A(I.bold.id),le=A(I.italic.id),oe=A(I.strikethrough.id),ce=A(I.underline.id),be=A(I.index.id),Ce=A(I.fontSize.id),Ee=A(I.fontFamily.id),Oe=A(I.horizontalAlignment.id),Le=A(I.verticalAlignment.id),Fe=A(I.wrapStrategy.id);if(!W)throw new Error(`${b}The ${R(z,"Range","range")} input must be provided.`);let tt=ps(W,{errorPrefix:`${b}The Range input `});if(tt.sheetId===void 0){let pt;if(typeof W=="object"&&W!==null&&"sheet"in W?pt=String(W.sheet):typeof W=="string"&&W.includes("!")&&(pt=W.split("!")[0].replace(/^'|'$/g,"")),pt)if(/^\d+$/.test(pt.trim()))tt.sheetId=Number(pt.trim());else{const ke=(((f=(await ie({method:"GET",endpoint:`/v4/spreadsheets/${Z}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:f.sheets)||[]).find(lt=>{var Pt;return String((Pt=lt.properties)==null?void 0:Pt.title).trim().toLowerCase()===pt.trim().toLowerCase()});ke&&(tt.sheetId=ke.properties.sheetId)}}const We=PRn(String(ee||"BLANK"));let et=[];Array.isArray(te)?et=te.map(pt=>({userEnteredValue:String(pt)})):te!=null&&te!==""&&(et=[{userEnteredValue:String(te)}]);const qe={},ot=fo(X);ot&&(qe.backgroundColor=ot);const st=fo(re);if(st&&(qe.textFormat=qe.textFormat||{},qe.textFormat.foregroundColor=st),(ae===!0||ae==="true")&&(qe.textFormat=qe.textFormat||{},qe.textFormat.bold=!0),(le===!0||le==="true")&&(qe.textFormat=qe.textFormat||{},qe.textFormat.italic=!0),(oe===!0||oe==="true")&&(qe.textFormat=qe.textFormat||{},qe.textFormat.strikethrough=!0),(ce===!0||ce==="true")&&(qe.textFormat=qe.textFormat||{},qe.textFormat.underline=!0),Ce!=null&&Ce!==""){const pt=typeof Ce=="number"?Ce:parseInt(String(Ce),10);isNaN(pt)||(qe.textFormat=qe.textFormat||{},qe.textFormat.fontSize=pt)}if(typeof Ee=="string"&&Ee.trim()!==""&&(qe.textFormat=qe.textFormat||{},qe.textFormat.fontFamily=Ee.trim()),typeof Oe=="string"&&Oe!==""){const pt={Left:"LEFT",Center:"CENTER",Right:"RIGHT",Justify:"JUSTIFY"};qe.horizontalAlignment=pt[Oe]||Oe.toUpperCase()}if(typeof Le=="string"&&Le!==""){const pt={Top:"TOP",Middle:"MIDDLE",Bottom:"BOTTOM"};qe.verticalAlignment=pt[Le]||Le.toUpperCase()}if(typeof Fe=="string"&&Fe!==""){const pt={Overflow:"OVERFLOW_CELL",Wrap:"WRAP",Clip:"CLIP"};qe.wrapStrategy=pt[Fe]||Fe.toUpperCase()}const Et={rule:{ranges:[tt],booleanRule:{condition:{type:We,...et.length?{values:et}:{}},format:qe}}};if(be!=null&&be!==""){const pt=typeof be=="number"?be:parseInt(String(be),10);if(isNaN(pt)||pt<1)throw new Error(`${b}The Index input must be a 1-based positive integer.`);Et.index=pt-1}return await ie({method:"POST",endpoint:`/v4/spreadsheets/${Z}:batchUpdate`,data:{requests:[{addConditionalFormatRule:Et}]}}),{value:K.Success,result:null,error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class E1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsAddProtectedRange,version:"1.0.0",description:"Add Protected Range Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsAddProtectedRange);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A,O,P,x,$;try{const U=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!U||!U.env)throw new Error("Editor context or environment missing");const Z=Be(t,t.project,"addProtectedRange"),H="["+Ve(t,t.project,"Add Protected Range")+": `"+Z+"`] ",Y=(Pt,Gt,si)=>{const pi=Ve(Pt==null?void 0:Pt.valueOwner,U==null?void 0:U.logic,Gt),kt=Be(Pt==null?void 0:Pt.valueOwner,U==null?void 0:U.logic,si);return`"${pi}" (\`${kt}\`)`},ie=n.find(Pt=>{var Gt;return((Gt=Pt.valueOwner.declaration)==null?void 0:Gt.id)===G.operation[J.GoogleSheetsAddProtectedRange].inputs.connection.id}),z=(s=ie==null?void 0:ie.value)==null?void 0:s.valueAsType;if(!z||!z.id||!z.name||z.type!==r.DefinitionEntity)throw new Error(`${H}The ${Y(ie,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const W=ui(z);if(!W)throw new Error(`${H}The ${Y(ie,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const ee=n.find(Pt=>{var Gt;return((Gt=Pt.valueOwner.declaration)==null?void 0:Gt.id)===G.operation[J.GoogleSheetsAddProtectedRange].inputs.spreadsheetId.id}),te=(u=ee==null?void 0:ee.value)==null?void 0:u.value,X=ln(te,{errorPrefix:`${H}The ${Y(ee,"Spreadsheet ID","spreadsheetId")} input `}),re=n.find(Pt=>{var Gt;return((Gt=Pt.valueOwner.declaration)==null?void 0:Gt.id)===G.operation[J.GoogleSheetsAddProtectedRange].inputs.range.id}),ae=(e=re==null?void 0:re.value)==null?void 0:e.value;if(ae==null)throw new Error(`${H}The ${Y(re,"Protected Range","range")} input is missing.`);const le=n.find(Pt=>{var Gt;return((Gt=Pt.valueOwner.declaration)==null?void 0:Gt.id)===G.operation[J.GoogleSheetsAddProtectedRange].inputs.description.id}),oe=(f=le==null?void 0:le.value)==null?void 0:f.value,ce=n.find(Pt=>{var Gt;return((Gt=Pt.valueOwner.declaration)==null?void 0:Gt.id)===G.operation[J.GoogleSheetsAddProtectedRange].inputs.warningOnly.id}),be=(y=ce==null?void 0:ce.value)==null?void 0:y.value,Ce=n.find(Pt=>{var Gt;return((Gt=Pt.valueOwner.declaration)==null?void 0:Gt.id)===G.operation[J.GoogleSheetsAddProtectedRange].inputs.editors.id}),Ee=(m=Ce==null?void 0:Ce.value)==null?void 0:m.value,Oe=n.find(Pt=>{var Gt;return((Gt=Pt.valueOwner.declaration)==null?void 0:Gt.id)===G.operation[J.GoogleSheetsAddProtectedRange].inputs.domainUsersCanEdit.id}),Le=(T=Oe==null?void 0:Oe.value)==null?void 0:T.value,tt={Authorization:`Bearer ${await U.getAccessToken()}`},We=`${(g=U.env)==null?void 0:g.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${U.projectId}/${Zt["google-sheet"]}/${W}`,et=async Pt=>Ht.post(We,Pt,{headers:tt});let qe=[];try{qe=((b=(await et({method:"GET",endpoint:`/v4/spreadsheets/${X}?fields=sheets(properties(sheetId,title))`})).data)==null?void 0:b.sheets)||[]}catch{}const ot=await Ha(ae,"Id",async()=>qe.map(Pt=>{var Gt,si;return{id:(Gt=Pt.properties)==null?void 0:Gt.sheetId,name:(si=Pt.properties)==null?void 0:si.title}})),ft={range:ps(ot,{errorPrefix:`${H}The ${Y(re,"Protected Range","range")} input `})};oe!=null&&oe!==""&&(ft.description=oe);const Et=Array.isArray(Ee)&&Ee.length>0,pt=typeof Le=="boolean";if(be===!0&&Et)throw new Error(`${H}When ${Y(ce,"Warning Only","warningOnly")} is enabled (true), ${Y(Ce,"Editors","editors")} cannot be specified.`);if(be===!0&&pt)throw new Error(`${H}When ${Y(ce,"Warning Only","warningOnly")} is enabled (true), ${Y(Oe,"Domain Users Can Edit","domainUsersCanEdit")} cannot be specified.`);if(typeof be=="boolean"&&(ft.warningOnly=be),!ft.warningOnly&&(Et||pt)){const Pt={};Et&&(Pt.users=Ee),pt&&(Pt.domainUsersCanEdit=Le),ft.editors=Pt}const Me=n.find(Pt=>{var Gt;return((Gt=Pt.valueOwner.declaration)==null?void 0:Gt.id)===G.operation[J.GoogleSheetsAddProtectedRange].inputs.unprotectedRanges.id}),Je=(R=Me==null?void 0:Me.value)==null?void 0:R.value;if(Array.isArray(Je)&&Je.length>0){const Pt=await Promise.all(Je.map(async Gt=>{const si=await Ha(Gt,"Id",async()=>qe.map(pi=>{var kt,Ct;return{id:(kt=pi.properties)==null?void 0:kt.sheetId,name:(Ct=pi.properties)==null?void 0:Ct.title}}));return ps(si,{errorPrefix:`${H}The ${Y(Me,"Exception ranges","unprotectedRanges")} input `})}));ft.unprotectedRanges=Pt}const lt=(x=(P=(O=(A=(I=(await et({method:"POST",endpoint:`/v4/spreadsheets/${X}:batchUpdate`,data:{requests:[{addProtectedRange:{protectedRange:ft}}]}})).data)==null?void 0:I.replies)==null?void 0:A[0])==null?void 0:O.addProtectedRange)==null?void 0:P.protectedRange)==null?void 0:x.protectedRangeId;return{value:K.Success,result:{protectedRangeId:lt},error:null}}catch(U){const Z=(($=U.response)==null?void 0:$.data)||U.message||U;return pe.Logger.log("[Google Sheets] error:",Z),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:Z,result:null}}}})}}class I1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsUpdateChartSpec,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsUpdateChartSpec);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=Be(t,t.project,"updateChartSpec"),R="["+Ve(t,t.project,"Update Chart Spec")+": `"+g+"`] ",I=(ae,le,oe)=>{const ce=Ve(ae==null?void 0:ae.valueOwner,T==null?void 0:T.logic,le),be=Be(ae==null?void 0:ae.valueOwner,T==null?void 0:T.logic,oe);return`"${ce}" (\`${be}\`)`},A=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[J.GoogleSheetsUpdateChartSpec].inputs.connection.id}),O=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${R}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const P=ui(O);if(!P)throw new Error(`${R}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[J.GoogleSheetsUpdateChartSpec].inputs.spreadsheetId.id}),$=(u=x==null?void 0:x.value)==null?void 0:u.value,U=ln($,{errorPrefix:`${R}The ${I(x,"Spreadsheet ID","spreadsheetId")} input `}),Z=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[J.GoogleSheetsUpdateChartSpec].inputs.chartId.id}),q=(e=Z==null?void 0:Z.value)==null?void 0:e.value;let H=typeof q=="number"?q:typeof q=="string"?parseInt(q,10):NaN;if(isNaN(H))throw new Error(`${R}The ${I(Z,"Chart ID","chartId")} input is missing or invalid. Expected a numeric chart ID.`);const Y=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[J.GoogleSheetsUpdateChartSpec].inputs.chart.id}),ie=(f=Y==null?void 0:Y.value)==null?void 0:f.value;if(ie==null||typeof ie!="object")throw new Error(`${R}The ${I(Y,"Chart Spec","chart")} input is missing or invalid. Expected a valid chart object.`);const W={Authorization:`Bearer ${await T.getAccessToken()}`},ee=`${(y=T.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${T.projectId}/${Zt["google-sheet"]}/${P}`,te=async ae=>Ht.post(ee,ae,{headers:W}),X=ie.spec?ie.spec:ie;let re={};return re.updateChartSpec={chartId:H,spec:X},await te({method:"POST",endpoint:`/v4/spreadsheets/${U}:batchUpdate`,data:{requests:[re]}}),{value:K.Success,result:null,error:null}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return pe.Logger.log("[Google Sheets] error:",g),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:g,result:null}}}})}}class R1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsCreatePivotTable,version:"1.0.0",description:"Create Pivot Table Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsCreatePivotTable);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R;try{const I=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!I||!I.env)throw new Error("Editor context or environment missing");const A=Be(t,t.project,"createPivotTable"),P="["+Ve(t,t.project,"Create Pivot Table")+": `"+A+"`] ",x=(ke,lt,Pt)=>{const Gt=Ve(ke==null?void 0:ke.valueOwner,I==null?void 0:I.logic,lt),si=Be(ke==null?void 0:ke.valueOwner,I==null?void 0:I.logic,Pt);return`"${Gt}" (\`${si}\`)`},$=n.find(ke=>{var lt;return((lt=ke.valueOwner.declaration)==null?void 0:lt.id)===G.operation[J.GoogleSheetsCreatePivotTable].inputs.connection.id}),U=(s=$==null?void 0:$.value)==null?void 0:s.valueAsType;if(!U||!U.id||!U.name||U.type!==r.DefinitionEntity)throw new Error(`${P}The ${x($,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const Z=ui(U);if(!Z)throw new Error(`${P}The ${x($,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const q=n.find(ke=>{var lt;return((lt=ke.valueOwner.declaration)==null?void 0:lt.id)===G.operation[J.GoogleSheetsCreatePivotTable].inputs.spreadsheetId.id}),H=(u=q==null?void 0:q.value)==null?void 0:u.value,Y=ln(H,{errorPrefix:`${P}The ${x(q,"Spreadsheet ID","spreadsheetId")} input `}),ie=n.find(ke=>{var lt;return((lt=ke.valueOwner.declaration)==null?void 0:lt.id)===G.operation[J.GoogleSheetsCreatePivotTable].inputs.destination.id}),z=(e=ie==null?void 0:ie.value)==null?void 0:e.value;if(z==null)throw new Error(`${P}The ${x(ie,"Destination","destination")} input is missing.`);const W=n.find(ke=>{var lt;return((lt=ke.valueOwner.declaration)==null?void 0:lt.id)===G.operation[J.GoogleSheetsCreatePivotTable].inputs.source.id}),ee=(f=W==null?void 0:W.value)==null?void 0:f.value;if(ee==null)throw new Error(`${P}The ${x(W,"Data range","source")} input is missing.`);const te=n.find(ke=>{var lt;return((lt=ke.valueOwner.declaration)==null?void 0:lt.id)===G.operation[J.GoogleSheetsCreatePivotTable].inputs.rows.id}),X=((y=te==null?void 0:te.value)==null?void 0:y.value)||[],re=n.find(ke=>{var lt;return((lt=ke.valueOwner.declaration)==null?void 0:lt.id)===G.operation[J.GoogleSheetsCreatePivotTable].inputs.columns.id}),ae=((m=re==null?void 0:re.value)==null?void 0:m.value)||[],le=n.find(ke=>{var lt;return((lt=ke.valueOwner.declaration)==null?void 0:lt.id)===G.operation[J.GoogleSheetsCreatePivotTable].inputs.values.id}),oe=((T=le==null?void 0:le.value)==null?void 0:T.value)||[],ce=n.find(ke=>{var lt;return((lt=ke.valueOwner.declaration)==null?void 0:lt.id)===G.operation[J.GoogleSheetsCreatePivotTable].inputs.valueLayout.id}),be=((g=ce==null?void 0:ce.value)==null?void 0:g.value)||"HORIZONTAL",Ee={Authorization:`Bearer ${await I.getAccessToken()}`},Oe=`${(b=I.env)==null?void 0:b.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${I.projectId}/${Zt["google-sheet"]}/${Z}`,Le=async ke=>Ht.post(Oe,ke,{headers:Ee});let Fe=[];try{Fe=(await Le({method:"GET",endpoint:`/v4/spreadsheets/${Y}?fields=sheets(properties(sheetId,title))`})).data.sheets||[]}catch{}const tt=await Ha(z,"Id",async()=>Fe.map(ke=>({id:ke.properties.sheetId,name:ke.properties.title}))),We=ps(tt,{errorPrefix:`${P}The ${x(ie,"Destination","destination")} input `}),et={sheetId:We.sheetId??0,rowIndex:We.startRowIndex??0,columnIndex:We.startColumnIndex??0},qe=await Ha(ee,"Id",async()=>Fe.map(ke=>({id:ke.properties.sheetId,name:ke.properties.title}))),ot=ps(qe,{errorPrefix:`${P}The ${x(W,"Data range","source")} input `});(ot.sheetId===void 0||ot.sheetId===null)&&(ot.sheetId=0);const st=ke=>{if(Array.isArray(ke))return ke;if(typeof ke=="string"){const lt=ke.trim();if(lt.startsWith("["))try{return JSON.parse(lt)}catch{}}return[]},ft=st(X),Et=st(ae),pt=st(oe),Me={source:ot,rows:ft.map(ke=>({sourceColumnOffset:Number((ke==null?void 0:ke.sourceColumnOffset)??0),sortOrder:(ke==null?void 0:ke.sortOrder)||"ASCENDING",showTotals:(ke==null?void 0:ke.showTotals)!==!1})),columns:Et.map(ke=>({sourceColumnOffset:Number((ke==null?void 0:ke.sourceColumnOffset)??0),sortOrder:(ke==null?void 0:ke.sortOrder)||"ASCENDING",showTotals:(ke==null?void 0:ke.showTotals)!==!1})),values:pt.map(ke=>{const lt={sourceColumnOffset:Number((ke==null?void 0:ke.sourceColumnOffset)??0),summarizeFunction:(ke==null?void 0:ke.summarizeFunction)||"SUM"};return ke!=null&&ke.name&&(lt.name=ke.name),ke!=null&&ke.calculatedDisplayType&&(lt.calculatedDisplayType=ke.calculatedDisplayType),lt}),valueLayout:be||"HORIZONTAL"};let Je={updateCells:{start:et,rows:[{values:[{pivotTable:Me}]}],fields:"pivotTable"}};return await Le({method:"POST",endpoint:`/v4/spreadsheets/${Y}:batchUpdate`,data:{requests:[Je]}}),{value:K.Success,result:null,error:null}}catch(I){const A=((R=I.response)==null?void 0:R.data)||I.message||I;return pe.Logger.log("[Google Sheets] error:",A),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:A,result:null}}}})}}class A1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsInsertDimension,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsInsertDimension);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R;try{const I=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!I||!I.env)throw new Error("Editor context or environment missing");const A=Be(t,t.project,"insertDimension"),P="["+Ve(t,t.project,"Insert Dimension")+": `"+A+"`] ",x=(qe,ot,st)=>{const ft=Ve(qe==null?void 0:qe.valueOwner,I==null?void 0:I.logic,ot),Et=Be(qe==null?void 0:qe.valueOwner,I==null?void 0:I.logic,st);return`"${ft}" (\`${Et}\`)`},$=n.find(qe=>{var ot;return((ot=qe.valueOwner.declaration)==null?void 0:ot.id)===G.operation[J.GoogleSheetsInsertDimension].inputs.connection.id}),U=(s=$==null?void 0:$.value)==null?void 0:s.valueAsType;if(!U||!U.id||!U.name||U.type!==r.DefinitionEntity)throw new Error(`${P}The ${x($,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const Z=ui(U);if(!Z)throw new Error(`${P}The ${x($,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const q=n.find(qe=>{var ot;return((ot=qe.valueOwner.declaration)==null?void 0:ot.id)===G.operation[J.GoogleSheetsInsertDimension].inputs.spreadsheetId.id}),H=(u=q==null?void 0:q.value)==null?void 0:u.value,Y=ln(H,{errorPrefix:`${P}The ${x(q,"Spreadsheet ID","spreadsheetId")} input `}),ie=n.find(qe=>{var ot,st;return((ot=qe.valueOwner.declaration)==null?void 0:ot.id)===((st=G.operation[J.GoogleSheetsInsertDimension].inputs.sheet)==null?void 0:st.id)}),z=(e=ie==null?void 0:ie.value)==null?void 0:e.value,W=n.find(qe=>{var ot,st;return((ot=qe.valueOwner.declaration)==null?void 0:ot.id)===((st=G.operation[J.GoogleSheetsInsertDimension].inputs.dimension)==null?void 0:st.id)}),ee=(f=W==null?void 0:W.value)==null?void 0:f.value,te=n.find(qe=>{var ot,st;return((ot=qe.valueOwner.declaration)==null?void 0:ot.id)===((st=G.operation[J.GoogleSheetsInsertDimension].inputs.startIndex)==null?void 0:st.id)}),X=(y=te==null?void 0:te.value)==null?void 0:y.value,re=n.find(qe=>{var ot,st;return((ot=qe.valueOwner.declaration)==null?void 0:ot.id)===((st=G.operation[J.GoogleSheetsInsertDimension].inputs.endIndex)==null?void 0:st.id)}),ae=(m=re==null?void 0:re.value)==null?void 0:m.value,le=n.find(qe=>{var ot,st;return((ot=qe.valueOwner.declaration)==null?void 0:ot.id)===((st=G.operation[J.GoogleSheetsInsertDimension].inputs.inheritFormatting)==null?void 0:st.id)}),oe=(T=le==null?void 0:le.value)==null?void 0:T.value;let ce;if(typeof oe=="string"){const qe=oe.trim().toLowerCase();qe==="before"?ce=!0:qe==="after"&&(ce=!1)}const Ce={Authorization:`Bearer ${await I.getAccessToken()}`},Ee=`${(g=I.env)==null?void 0:g.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${I.projectId}/${Zt["google-sheet"]}/${Z}`,Oe=async qe=>Ht.post(Ee,qe,{headers:Ce});if(z==null||z==="")throw new Error(`${P}The ${x(ie,"Sheet","sheet")} input is missing.`);if(ee==null||ee==="")throw new Error(`${P}The ${x(W,"Dimension","dimension")} input is missing.`);const Le=String(ee).trim().toUpperCase();if(Le!=="ROWS"&&Le!=="COLUMNS")throw new Error(`${P}The ${x(W,"Dimension","dimension")} input is invalid. Expected "Rows" or "Columns".`);const Fe=typeof X=="number"?X:parseInt(String(X),10);if(isNaN(Fe)||Fe<1)throw new Error(`${P}The ${x(te,"Start index","startIndex")} input is missing or invalid. Expected a positive integer starting at 1.`);let tt=Fe;if(ae!=null&&ae!==""&&(tt=typeof ae=="number"?ae:parseInt(String(ae),10),isNaN(tt)||tt<Fe))throw new Error(`${P}The ${x(re,"End index","endIndex")} input is invalid. Expected an integer greater than or equal to Start index.`);let We;if(typeof z=="number"||/^\d+$/.test(String(z).trim()))We=Number(z);else{const st=(((b=(await Oe({method:"GET",endpoint:`/v4/spreadsheets/${Y}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:b.sheets)||[]).find(ft=>{var Et;return String((Et=ft.properties)==null?void 0:Et.title).trim().toLowerCase()===String(z).trim().toLowerCase()});if(!st)throw new Error(`${P}The ${x(ie,"Sheet","sheet")} input "${z}" was not found in spreadsheet.`);We=st.properties.sheetId}const et={range:{sheetId:We,dimension:Le,startIndex:Fe-1,endIndex:tt}};return typeof ce=="boolean"&&(et.inheritFromBefore=ce),await Oe({method:"POST",endpoint:`/v4/spreadsheets/${Y}:batchUpdate`,data:{requests:[{insertDimension:et}]}}),{value:K.Success,result:null,error:null}}catch(I){const A=((R=I.response)==null?void 0:R.data)||I.message||I;return pe.Logger.log("[Google Sheets] error:",A),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:A,result:null}}}})}}class D1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsMoveDimension,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsMoveDimension);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R;try{const I=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!I||!I.env)throw new Error("Editor context or environment missing");const A=Be(t,t.project,"moveDimension"),P="["+Ve(t,t.project,"Move Dimension")+": `"+A+"`] ",x=(et,qe,ot)=>{const st=Ve(et==null?void 0:et.valueOwner,I==null?void 0:I.logic,qe),ft=Be(et==null?void 0:et.valueOwner,I==null?void 0:I.logic,ot);return`"${st}" (\`${ft}\`)`},$=n.find(et=>{var qe;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===G.operation[J.GoogleSheetsMoveDimension].inputs.connection.id}),U=(s=$==null?void 0:$.value)==null?void 0:s.valueAsType;if(!U||!U.id||!U.name||U.type!==r.DefinitionEntity)throw new Error(`${P}The ${x($,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const Z=ui(U);if(!Z)throw new Error(`${P}The ${x($,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const q=n.find(et=>{var qe;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===G.operation[J.GoogleSheetsMoveDimension].inputs.spreadsheetId.id}),H=(u=q==null?void 0:q.value)==null?void 0:u.value,Y=ln(H,{errorPrefix:`${P}The ${x(q,"Spreadsheet ID","spreadsheetId")} input `}),ie=n.find(et=>{var qe,ot;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===((ot=G.operation[J.GoogleSheetsMoveDimension].inputs.sheet)==null?void 0:ot.id)}),z=(e=ie==null?void 0:ie.value)==null?void 0:e.value,W=n.find(et=>{var qe,ot;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===((ot=G.operation[J.GoogleSheetsMoveDimension].inputs.dimension)==null?void 0:ot.id)}),ee=(f=W==null?void 0:W.value)==null?void 0:f.value,te=n.find(et=>{var qe,ot;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===((ot=G.operation[J.GoogleSheetsMoveDimension].inputs.startIndex)==null?void 0:ot.id)}),X=(y=te==null?void 0:te.value)==null?void 0:y.value,re=n.find(et=>{var qe,ot;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===((ot=G.operation[J.GoogleSheetsMoveDimension].inputs.endIndex)==null?void 0:ot.id)}),ae=(m=re==null?void 0:re.value)==null?void 0:m.value,le=n.find(et=>{var qe,ot;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===((ot=G.operation[J.GoogleSheetsMoveDimension].inputs.destinationIndex)==null?void 0:ot.id)}),oe=(T=le==null?void 0:le.value)==null?void 0:T.value,be={Authorization:`Bearer ${await I.getAccessToken()}`},Ce=`${(g=I.env)==null?void 0:g.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${I.projectId}/${Zt["google-sheet"]}/${Z}`,Ee=async et=>Ht.post(Ce,et,{headers:be});if(z==null||z==="")throw new Error(`${P}The ${x(ie,"Sheet","sheet")} input is missing.`);if(ee==null||ee==="")throw new Error(`${P}The ${x(W,"Dimension","dimension")} input is missing.`);const Oe=String(ee).trim().toUpperCase();if(Oe!=="ROWS"&&Oe!=="COLUMNS")throw new Error(`${P}The ${x(W,"Dimension","dimension")} input is invalid. Expected "Rows" or "Columns".`);const Le=typeof X=="number"?X:parseInt(String(X),10);if(isNaN(Le)||Le<1)throw new Error(`${P}The ${x(te,"Start index","startIndex")} input is missing or invalid. Expected a positive integer starting at 1.`);let Fe=Le;if(ae!=null&&ae!==""&&(Fe=typeof ae=="number"?ae:parseInt(String(ae),10),isNaN(Fe)||Fe<Le))throw new Error(`${P}The ${x(re,"End index","endIndex")} input is invalid. Expected an integer greater than or equal to Start index.`);const tt=typeof oe=="number"?oe:parseInt(String(oe),10);if(isNaN(tt)||tt<1)throw new Error(`${P}The ${x(le,"Destination index","destinationIndex")} input is missing or invalid. Expected a positive integer starting at 1.`);let We;if(typeof z=="number"||/^\d+$/.test(String(z).trim()))We=Number(z);else{const ot=(((b=(await Ee({method:"GET",endpoint:`/v4/spreadsheets/${Y}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:b.sheets)||[]).find(st=>{var ft;return String((ft=st.properties)==null?void 0:ft.title).trim().toLowerCase()===String(z).trim().toLowerCase()});if(!ot)throw new Error(`${P}The ${x(ie,"Sheet","sheet")} input "${z}" was not found in spreadsheet.`);We=ot.properties.sheetId}return await Ee({method:"POST",endpoint:`/v4/spreadsheets/${Y}:batchUpdate`,data:{requests:[{moveDimension:{source:{sheetId:We,dimension:Oe,startIndex:Le-1,endIndex:Fe},destinationIndex:tt-1}}]}}),{value:K.Success,result:null,error:null}}catch(I){const A=((R=I.response)==null?void 0:R.data)||I.message||I;return pe.Logger.log("[Google Sheets] error:",A),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:A,result:null}}}})}}function VRn(a){return{"Number greater than":"NUMBER_GREATER","Number greater than or equal":"NUMBER_GREATER_THAN_EQ","Number less than":"NUMBER_LESS","Number less than or equal":"NUMBER_LESS_THAN_EQ","Number equal to":"NUMBER_EQ","Number not equal to":"NUMBER_NOT_EQ","Number between":"NUMBER_BETWEEN","Number not between":"NUMBER_NOT_BETWEEN","Text contains":"TEXT_CONTAINS","Text does not contain":"TEXT_NOT_CONTAINS","Text starts with":"TEXT_STARTS_WITH","Text ends with":"TEXT_ENDS_WITH","Text equals":"TEXT_EQ","Date is":"DATE_EQ","Date is before":"DATE_BEFORE","Date is after":"DATE_AFTER","Date is on or before":"DATE_ON_OR_BEFORE","Date is on or after":"DATE_ON_OR_AFTER","Cell is empty":"BLANK","Cell is not empty":"NOT_BLANK","Custom formula":"CUSTOM_FORMULA"}[a]||a}class C1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsUpdateConditionalFormatRule,version:"1.0.0",description:"Update Conditional Format Rule Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsUpdateConditionalFormatRule);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A,O,P;try{const x=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!x||!x.env)throw new Error("Editor context or environment missing");const $=Be(t,t.project,"updateConditionalFormatRule"),Z="["+Ve(t,t.project,"Update Conditional Format Rule")+": `"+$+"`] ",q=(hi,$t,Nt)=>{const ci=Ve(hi==null?void 0:hi.valueOwner,x==null?void 0:x.logic,$t),oi=Be(hi==null?void 0:hi.valueOwner,x==null?void 0:x.logic,Nt);return`"${ci}" (\`${oi}\`)`},H=G.operation[J.GoogleSheetsUpdateConditionalFormatRule].inputs,Y=hi=>{var Nt;const $t=n.find(ci=>{var oi;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===hi});return(Nt=$t==null?void 0:$t.value)==null?void 0:Nt.value},ie=n.find(hi=>{var $t;return(($t=hi.valueOwner.declaration)==null?void 0:$t.id)===H.connection.id}),z=(s=ie==null?void 0:ie.value)==null?void 0:s.valueAsType;if(!z||!z.id||!z.name||z.type!==r.DefinitionEntity)throw new Error(`${Z}The ${q(ie,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const W=ui(z);if(!W)throw new Error(`${Z}The ${q(ie,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const ee=n.find(hi=>{var $t;return(($t=hi.valueOwner.declaration)==null?void 0:$t.id)===H.spreadsheetId.id}),te=(u=ee==null?void 0:ee.value)==null?void 0:u.value,X=ln(te,{errorPrefix:`${Z}The ${q(ee,"Spreadsheet ID","spreadsheetId")} input `}),re=n.find(hi=>{var $t;return(($t=hi.valueOwner.declaration)==null?void 0:$t.id)===H.sheet.id}),ae=(e=re==null?void 0:re.value)==null?void 0:e.value;if(ae==null||ae==="")throw new Error(`${Z}The ${q(re,"Sheet","sheet")} input is missing.`);const le=n.find(hi=>{var $t;return(($t=hi.valueOwner.declaration)==null?void 0:$t.id)===H.index.id}),oe=(f=le==null?void 0:le.value)==null?void 0:f.value;if(oe==null||oe==="")throw new Error(`${Z}The ${q(le,"Index","index")} input is missing.`);const ce=typeof oe=="number"?oe:parseInt(String(oe),10);if(isNaN(ce)||ce<1)throw new Error(`${Z}The ${q(le,"Index","index")} input must be a 1-based positive integer.`);const Ce={Authorization:`Bearer ${await x.getAccessToken()}`},Ee=`${(y=x.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${x.projectId}/${Zt["google-sheet"]}/${W}`,Oe=async hi=>Ht.post(Ee,hi,{headers:Ce});let Le;if(typeof ae=="number"||/^\d+$/.test(String(ae).trim()))Le=Number(ae);else{const Nt=(((m=(await Oe({method:"GET",endpoint:`/v4/spreadsheets/${X}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:m.sheets)||[]).find(ci=>{var oi;return String((oi=ci.properties)==null?void 0:oi.title).trim().toLowerCase()===String(ae).trim().toLowerCase()});if(!Nt)throw new Error(`${Z}The ${q(re,"Sheet","sheet")} input "${ae}" was not found in spreadsheet.`);Le=Nt.properties.sheetId}const Fe=Y(H.newIndex.id),tt=Y(H.range.id),We=Y(H.conditionType.id),et=Y(H.conditionValues.id),qe=Y(H.backgroundColor.id),ot=Y(H.textColor.id),st=Y(H.bold.id),ft=Y(H.italic.id),Et=Y(H.strikethrough.id),pt=Y(H.underline.id),Me=Y(H.fontSize.id),Je=Y(H.fontFamily.id),ke=Y(H.horizontalAlignment.id),lt=Y(H.verticalAlignment.id),Pt=Y(H.wrapStrategy.id);let Gt=null;try{const Nt=(((T=(await Oe({method:"GET",endpoint:`/v4/spreadsheets/${X}?fields=sheets(properties(sheetId),conditionalFormats)`})).data)==null?void 0:T.sheets)||[]).find(ci=>{var oi;return Number((oi=ci.properties)==null?void 0:oi.sheetId)===Number(Le)});if(Nt&&Array.isArray(Nt.conditionalFormats)){const ci=ce-1;ci>=0&&ci<Nt.conditionalFormats.length&&(Gt=Nt.conditionalFormats[ci])}}catch{}let si=null;tt&&(si=ps(tt,{errorPrefix:`${Z}The Range input `}),si.sheetId===void 0&&(si.sheetId=Le));const pi=si?[si]:Gt&&Gt.ranges||[{sheetId:Le}];let kt=null;if(We!=null&&String(We).trim()!==""){const hi=VRn(String(We));let $t=[];Array.isArray(et)?$t=et.map(Nt=>({userEnteredValue:String(Nt)})):et!=null&&et!==""?$t=[{userEnteredValue:String(et)}]:((b=(g=Gt==null?void 0:Gt.booleanRule)==null?void 0:g.condition)==null?void 0:b.type)===hi&&Array.isArray((I=(R=Gt==null?void 0:Gt.booleanRule)==null?void 0:R.condition)==null?void 0:I.values)&&($t=Gt.booleanRule.condition.values),kt={type:hi,...$t.length?{values:$t}:{}}}else if((A=Gt==null?void 0:Gt.booleanRule)!=null&&A.condition)kt=JSON.parse(JSON.stringify(Gt.booleanRule.condition));else{const hi="BLANK";let $t=[];Array.isArray(et)?$t=et.map(Nt=>({userEnteredValue:String(Nt)})):et!=null&&et!==""&&($t=[{userEnteredValue:String(et)}]),kt={type:hi,...$t.length?{values:$t}:{}}}const Ct=(O=Gt==null?void 0:Gt.booleanRule)!=null&&O.format?JSON.parse(JSON.stringify(Gt.booleanRule.format)):{},xi=fo(qe);xi&&(Ct.backgroundColor=xi);const wn=fo(ot);if(wn&&(Ct.textFormat=Ct.textFormat||{},Ct.textFormat.foregroundColor=wn),st===!0||st==="true"?(Ct.textFormat=Ct.textFormat||{},Ct.textFormat.bold=!0):(st===!1||st==="false")&&Ct.textFormat&&(Ct.textFormat.bold=!1),ft===!0||ft==="true"?(Ct.textFormat=Ct.textFormat||{},Ct.textFormat.italic=!0):(ft===!1||ft==="false")&&Ct.textFormat&&(Ct.textFormat.italic=!1),Et===!0||Et==="true"?(Ct.textFormat=Ct.textFormat||{},Ct.textFormat.strikethrough=!0):(Et===!1||Et==="false")&&Ct.textFormat&&(Ct.textFormat.strikethrough=!1),pt===!0||pt==="true"?(Ct.textFormat=Ct.textFormat||{},Ct.textFormat.underline=!0):(pt===!1||pt==="false")&&Ct.textFormat&&(Ct.textFormat.underline=!1),Me!=null&&Me!==""){const hi=typeof Me=="number"?Me:parseInt(String(Me),10);isNaN(hi)||(Ct.textFormat=Ct.textFormat||{},Ct.textFormat.fontSize=hi)}if(typeof Je=="string"&&Je.trim()!==""&&(Ct.textFormat=Ct.textFormat||{},Ct.textFormat.fontFamily=Je.trim()),typeof ke=="string"&&ke!==""){const hi={Left:"LEFT",Center:"CENTER",Right:"RIGHT",Justify:"JUSTIFY"};Ct.horizontalAlignment=hi[ke]||ke.toUpperCase()}if(typeof lt=="string"&&lt!==""){const hi={Top:"TOP",Middle:"MIDDLE",Bottom:"BOTTOM"};Ct.verticalAlignment=hi[lt]||lt.toUpperCase()}if(typeof Pt=="string"&&Pt!==""){const hi={Overflow:"OVERFLOW_CELL",Wrap:"WRAP",Clip:"CLIP"};Ct.wrapStrategy=hi[Pt]||Pt.toUpperCase()}const Yr={...Gt||{},ranges:pi,booleanRule:{...(Gt==null?void 0:Gt.booleanRule)||{},condition:kt,format:Ct}},Jr={sheetId:Le,index:ce-1,rule:Yr};if(Fe!=null&&Fe!==""){const hi=typeof Fe=="number"?Fe:parseInt(String(Fe),10);!isNaN(hi)&&hi>=1&&(Jr.newIndex=hi-1)}return await Oe({method:"POST",endpoint:`/v4/spreadsheets/${X}:batchUpdate`,data:{requests:[{updateConditionalFormatRule:Jr}]}}),{value:K.Success,result:null,error:null}}catch(x){const $=((P=x.response)==null?void 0:P.data)||x.message||x;return pe.Logger.log("[Google Sheets] error:",$),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:$,result:null}}}})}}class w1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsUpdateProtectedRange,version:"1.0.0",description:"Update Protected Range Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsUpdateProtectedRange);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A,O;try{const P=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!P||!P.env)throw new Error("Editor context or environment missing");const x=Be(t,t.project,"updateProtectedRange"),U="["+Ve(t,t.project,"Update Protected Range")+": `"+x+"`] ",Z=(Me,Je,ke)=>{const lt=Ve(Me==null?void 0:Me.valueOwner,P==null?void 0:P.logic,Je),Pt=Be(Me==null?void 0:Me.valueOwner,P==null?void 0:P.logic,ke);return`"${lt}" (\`${Pt}\`)`},q=n.find(Me=>{var Je;return((Je=Me.valueOwner.declaration)==null?void 0:Je.id)===G.operation[J.GoogleSheetsUpdateProtectedRange].inputs.connection.id}),H=(s=q==null?void 0:q.value)==null?void 0:s.valueAsType;if(!H||!H.id||!H.name||H.type!==r.DefinitionEntity)throw new Error(`${U}The ${Z(q,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const Y=ui(H);if(!Y)throw new Error(`${U}The ${Z(q,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const ie=n.find(Me=>{var Je;return((Je=Me.valueOwner.declaration)==null?void 0:Je.id)===G.operation[J.GoogleSheetsUpdateProtectedRange].inputs.spreadsheetId.id}),z=(u=ie==null?void 0:ie.value)==null?void 0:u.value,W=ln(z,{errorPrefix:`${U}The ${Z(ie,"Spreadsheet ID","spreadsheetId")} input `}),ee=n.find(Me=>{var Je;return((Je=Me.valueOwner.declaration)==null?void 0:Je.id)===G.operation[J.GoogleSheetsUpdateProtectedRange].inputs.protectedRangeId.id}),te=(e=ee==null?void 0:ee.value)==null?void 0:e.value;if(te==null)throw new Error(`${U}The ${Z(ee,"Protected Range ID","protectedRangeId")} input is missing.`);const X=n.find(Me=>{var Je;return((Je=Me.valueOwner.declaration)==null?void 0:Je.id)===G.operation[J.GoogleSheetsUpdateProtectedRange].inputs.range.id}),re=(f=X==null?void 0:X.value)==null?void 0:f.value,ae=n.find(Me=>{var Je;return((Je=Me.valueOwner.declaration)==null?void 0:Je.id)===G.operation[J.GoogleSheetsUpdateProtectedRange].inputs.description.id}),le=(y=ae==null?void 0:ae.value)==null?void 0:y.value,oe=n.find(Me=>{var Je;return((Je=Me.valueOwner.declaration)==null?void 0:Je.id)===G.operation[J.GoogleSheetsUpdateProtectedRange].inputs.warningOnly.id}),ce=(m=oe==null?void 0:oe.value)==null?void 0:m.value,be=n.find(Me=>{var Je;return((Je=Me.valueOwner.declaration)==null?void 0:Je.id)===G.operation[J.GoogleSheetsUpdateProtectedRange].inputs.editors.id}),Ce=(T=be==null?void 0:be.value)==null?void 0:T.value,Ee=n.find(Me=>{var Je;return((Je=Me.valueOwner.declaration)==null?void 0:Je.id)===G.operation[J.GoogleSheetsUpdateProtectedRange].inputs.domainUsersCanEdit.id}),Oe=(g=Ee==null?void 0:Ee.value)==null?void 0:g.value,Fe={Authorization:`Bearer ${await P.getAccessToken()}`},tt=`${(b=P.env)==null?void 0:b.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${P.projectId}/${Zt["google-sheet"]}/${Y}`,We=async Me=>Ht.post(tt,Me,{headers:Fe}),et={protectedRangeId:typeof te=="number"?te:Number(te)},qe=[];if(re!=null){let Me=[];try{Me=((R=(await We({method:"GET",endpoint:`/v4/spreadsheets/${W}?fields=sheets(properties(sheetId,title))`})).data)==null?void 0:R.sheets)||[]}catch{}const Je=await Ha(re,"Id",async()=>Me.map(ke=>{var lt,Pt;return{id:(lt=ke.properties)==null?void 0:lt.sheetId,name:(Pt=ke.properties)==null?void 0:Pt.title}}));et.range=ps(Je,{errorPrefix:`${U}The ${Z(X,"Protected Range","range")} input `}),qe.push("range")}le!=null&&(et.description=le,qe.push("description"));const ot=Array.isArray(Ce)&&Ce.length>0,st=typeof Oe=="boolean";if(ce===!0&&ot)throw new Error(`${U}When ${Z(oe,"Warning Only","warningOnly")} is enabled (true), ${Z(be,"Editors","editors")} cannot be specified.`);if(ce===!0&&st)throw new Error(`${U}When ${Z(oe,"Warning Only","warningOnly")} is enabled (true), ${Z(Ee,"Domain Users Can Edit","domainUsersCanEdit")} cannot be specified.`);if(typeof ce=="boolean"&&(et.warningOnly=ce,qe.push("warningOnly")),!et.warningOnly&&(ot||st)){const Me={};ot&&(Me.users=Ce),st&&(Me.domainUsersCanEdit=Oe),et.editors=Me,qe.push("editors")}const ft=n.find(Me=>{var Je;return((Je=Me.valueOwner.declaration)==null?void 0:Je.id)===G.operation[J.GoogleSheetsUpdateProtectedRange].inputs.unprotectedRanges.id}),Et=(I=ft==null?void 0:ft.value)==null?void 0:I.value;if(Array.isArray(Et)&&Et.length>0){let Me=[];try{Me=((A=(await We({method:"GET",endpoint:`/v4/spreadsheets/${W}?fields=sheets(properties(sheetId,title))`})).data)==null?void 0:A.sheets)||[]}catch{}const Je=await Promise.all(Et.map(async ke=>{const lt=await Ha(ke,"Id",async()=>Me.map(Pt=>{var Gt,si;return{id:(Gt=Pt.properties)==null?void 0:Gt.sheetId,name:(si=Pt.properties)==null?void 0:si.title}}));return ps(lt,{errorPrefix:`${U}The ${Z(ft,"Exception ranges","unprotectedRanges")} input `})}));et.unprotectedRanges=Je,qe.push("unprotectedRanges")}const pt=qe.length>0?qe.join(","):"*";return await We({method:"POST",endpoint:`/v4/spreadsheets/${W}:batchUpdate`,data:{requests:[{updateProtectedRange:{protectedRange:et,fields:pt}}]}}),{value:K.Success,result:null,error:null}}catch(P){const x=((O=P.response)==null?void 0:O.data)||P.message||P;return pe.Logger.log("[Google Sheets] error:",x),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:x,result:null}}}})}}class O1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsAddNamedRange,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsAddNamedRange);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g;try{const b=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!b||!b.env)throw new Error("Editor context or environment missing");const R=Be(t,t.project,"addNamedRange"),A="["+Ve(t,t.project,"Add Named Range")+": `"+R+"`] ",O=(Ee,Oe,Le)=>{const Fe=Ve(Ee==null?void 0:Ee.valueOwner,b==null?void 0:b.logic,Oe),tt=Be(Ee==null?void 0:Ee.valueOwner,b==null?void 0:b.logic,Le);return`"${Fe}" (\`${tt}\`)`},P=n.find(Ee=>{var Oe;return((Oe=Ee.valueOwner.declaration)==null?void 0:Oe.id)===G.operation[J.GoogleSheetsAddNamedRange].inputs.connection.id}),x=(s=P==null?void 0:P.value)==null?void 0:s.valueAsType;if(!x||!x.id||!x.name||x.type!==r.DefinitionEntity)throw new Error(`${A}The ${O(P,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const $=ui(x);if(!$)throw new Error(`${A}The ${O(P,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const U=n.find(Ee=>{var Oe;return((Oe=Ee.valueOwner.declaration)==null?void 0:Oe.id)===G.operation[J.GoogleSheetsAddNamedRange].inputs.spreadsheetId.id}),Z=(u=U==null?void 0:U.value)==null?void 0:u.value,q=ln(Z,{errorPrefix:`${A}The ${O(U,"Spreadsheet ID","spreadsheetId")} input `}),H=n.find(Ee=>{var Oe;return((Oe=Ee.valueOwner.declaration)==null?void 0:Oe.id)===G.operation[J.GoogleSheetsAddNamedRange].inputs.name.id}),Y=(e=H==null?void 0:H.value)==null?void 0:e.value;if(Y==null)throw new Error(`${A}The ${O(H,"name","name")} input is missing.`);const ie=n.find(Ee=>{var Oe;return((Oe=Ee.valueOwner.declaration)==null?void 0:Oe.id)===G.operation[J.GoogleSheetsAddNamedRange].inputs.range.id}),z=(f=ie==null?void 0:ie.value)==null?void 0:f.value;if(z==null)throw new Error(`${A}The ${O(ie,"range","range")} input is missing.`);const ee={Authorization:`Bearer ${await b.getAccessToken()}`},te=`${(y=b.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${b.projectId}/${Zt["google-sheet"]}/${$}`,X=async Ee=>Ht.post(te,Ee,{headers:ee}),re=await Ha(z,"Id",async()=>{var Oe;return(((Oe=(await X({method:"GET",endpoint:`/v4/spreadsheets/${q}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:Oe.sheets)||[]).map(Le=>{var Fe,tt;return{id:(Fe=Le.properties)==null?void 0:Fe.sheetId,name:(tt=Le.properties)==null?void 0:tt.title}})});let ae={};ae.addNamedRange={namedRange:{name:typeof Y=="string"&&Y.trim().startsWith("{")?JSON.parse(Y):Y,range:ps(re,{errorPrefix:`${A}The ${O(ie,"Range","range")} input `})}};const oe=(await X({method:"POST",endpoint:`/v4/spreadsheets/${q}:batchUpdate`,data:{requests:[ae]}})).data,ce=(T=(m=oe==null?void 0:oe.replies)==null?void 0:m[0])==null?void 0:T.addNamedRange,be=(ce==null?void 0:ce.namedRange)??null,Ce=(be==null?void 0:be.namedRangeId)??null;return{value:K.Success,result:{namedRangeId:Ce},error:null}}catch(b){const R=((g=b.response)==null?void 0:g.data)||b.message||b;return pe.Logger.log("[Google Sheets] error:",R),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:R,result:null}}}})}}class x1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsSetCellNote,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsSetCellNote);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=Be(t,t.project,"setCellNote"),R="["+Ve(t,t.project,"Set Cell Note")+": `"+g+"`] ",I=(re,ae,le)=>{const oe=Ve(re==null?void 0:re.valueOwner,T==null?void 0:T.logic,ae),ce=Be(re==null?void 0:re.valueOwner,T==null?void 0:T.logic,le);return`"${oe}" (\`${ce}\`)`},A=n.find(re=>{var ae;return((ae=re.valueOwner.declaration)==null?void 0:ae.id)===G.operation[J.GoogleSheetsSetCellNote].inputs.connection.id}),O=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${R}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const P=ui(O);if(!P)throw new Error(`${R}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(re=>{var ae;return((ae=re.valueOwner.declaration)==null?void 0:ae.id)===G.operation[J.GoogleSheetsSetCellNote].inputs.spreadsheetId.id}),$=(u=x==null?void 0:x.value)==null?void 0:u.value,U=ln($,{errorPrefix:`${R}The ${I(x,"Spreadsheet ID","spreadsheetId")} input `}),Z=n.find(re=>{var ae;return((ae=re.valueOwner.declaration)==null?void 0:ae.id)===G.operation[J.GoogleSheetsSetCellNote].inputs.range.id}),q=(e=Z==null?void 0:Z.value)==null?void 0:e.value;if(q==null)throw new Error(`${R}The ${I(Z,"range","range")} input is missing.`);const H=n.find(re=>{var ae;return((ae=re.valueOwner.declaration)==null?void 0:ae.id)===G.operation[J.GoogleSheetsSetCellNote].inputs.note.id}),Y=(f=H==null?void 0:H.value)==null?void 0:f.value;if(Y==null)throw new Error(`${R}The ${I(H,"note","note")} input is missing.`);const z={Authorization:`Bearer ${await T.getAccessToken()}`},W=`${(y=T.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${T.projectId}/${Zt["google-sheet"]}/${P}`,ee=async re=>Ht.post(W,re,{headers:z}),te=await Ha(q,"Id",async()=>(await ee({method:"GET",endpoint:`/v4/spreadsheets/${U}?fields=sheets.properties(sheetId,title)`})).data.sheets.map(ae=>({id:ae.properties.sheetId,name:ae.properties.title})));let X={repeatCell:{range:ps(te,{errorPrefix:`${R}The ${I(Z,"Range","range")} input `}),cell:{note:typeof Y=="string"&&Y.trim().startsWith("{")?JSON.parse(Y):Y},fields:"note"}};return await ee({method:"POST",endpoint:`/v4/spreadsheets/${U}:batchUpdate`,data:{requests:[X]}}),{value:K.Success,result:null,error:null}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return pe.Logger.log("[Google Sheets] error:",g),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:g,result:null}}}})}}class P1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsDeleteConditionalFormatRule,version:"1.0.0",description:"Delete Conditional Format Rule Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsDeleteConditionalFormatRule);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T;try{const g=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!g||!g.env)throw new Error("Editor context or environment missing");const b=Be(t,t.project,"deleteConditionalFormatRule"),I="["+Ve(t,t.project,"Delete Conditional Format Rule")+": `"+b+"`] ",A=(le,oe,ce)=>{const be=Ve(le==null?void 0:le.valueOwner,g==null?void 0:g.logic,oe),Ce=Be(le==null?void 0:le.valueOwner,g==null?void 0:g.logic,ce);return`"${be}" (\`${Ce}\`)`},O=G.operation[J.GoogleSheetsDeleteConditionalFormatRule].inputs,P=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===O.connection.id}),x=(s=P==null?void 0:P.value)==null?void 0:s.valueAsType;if(!x||!x.id||!x.name||x.type!==r.DefinitionEntity)throw new Error(`${I}The ${A(P,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const $=ui(x);if(!$)throw new Error(`${I}The ${A(P,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const U=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===O.spreadsheetId.id}),Z=(u=U==null?void 0:U.value)==null?void 0:u.value,q=ln(Z,{errorPrefix:`${I}The ${A(U,"Spreadsheet ID","spreadsheetId")} input `}),H=n.find(le=>{var oe,ce;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===((ce=O.sheet)==null?void 0:ce.id)}),Y=(e=H==null?void 0:H.value)==null?void 0:e.value;if(Y==null||Y==="")throw new Error(`${I}The ${A(H,"Sheet","sheet")} input is missing.`);const ie=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===O.index.id}),z=(f=ie==null?void 0:ie.value)==null?void 0:f.value;if(z==null||z==="")throw new Error(`${I}The ${A(ie,"Index","index")} input is missing.`);const W=typeof z=="number"?z:parseInt(String(z),10);if(isNaN(W)||W<1)throw new Error(`${I}The ${A(ie,"Index","index")} input must be a 1-based positive integer.`);const te={Authorization:`Bearer ${await g.getAccessToken()}`},X=`${(y=g.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${g.projectId}/${Zt["google-sheet"]}/${$}`,re=async le=>Ht.post(X,le,{headers:te});let ae;if(typeof Y=="number"||/^\d+$/.test(String(Y).trim()))ae=Number(Y);else{const ce=(((m=(await re({method:"GET",endpoint:`/v4/spreadsheets/${q}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:m.sheets)||[]).find(be=>{var Ce;return String((Ce=be.properties)==null?void 0:Ce.title).trim().toLowerCase()===String(Y).trim().toLowerCase()});if(!ce)throw new Error(`${I}The ${A(H,"Sheet","sheet")} input "${Y}" was not found in spreadsheet.`);ae=ce.properties.sheetId}return await re({method:"POST",endpoint:`/v4/spreadsheets/${q}:batchUpdate`,data:{requests:[{deleteConditionalFormatRule:{sheetId:ae,index:W-1}}]}}),{value:K.Success,result:null,error:null}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return pe.Logger.log("[Google Sheets] error:",b),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:b,result:null}}}})}}function NRn(a){return{NUMBER_GREATER:"Number greater than",NUMBER_GREATER_THAN_EQ:"Number greater than or equal",NUMBER_LESS:"Number less than",NUMBER_LESS_THAN_EQ:"Number less than or equal",NUMBER_EQ:"Number equal to",NUMBER_NOT_EQ:"Number not equal to",NUMBER_BETWEEN:"Number between",NUMBER_NOT_BETWEEN:"Number not between",TEXT_CONTAINS:"Text contains",TEXT_NOT_CONTAINS:"Text does not contain",TEXT_STARTS_WITH:"Text starts with",TEXT_ENDS_WITH:"Text ends with",TEXT_EQ:"Text equals",DATE_EQ:"Date is",DATE_BEFORE:"Date is before",DATE_AFTER:"Date is after",DATE_ON_OR_BEFORE:"Date is on or before",DATE_ON_OR_AFTER:"Date is on or after",BLANK:"Cell is empty",NOT_BLANK:"Cell is not empty",CUSTOM_FORMULA:"Custom formula"}[a]||a}function b5(a){let p,t="",n=a+1;for(;n>0;)p=(n-1)%26,t=String.fromCharCode(65+p)+t,n=(n-p-1)/26;return t}function _Rn(a,p){if(!a)return"";let t=p?`'${p}'!`:"";const n=a.startColumnIndex!==void 0?b5(a.startColumnIndex):"",s=a.startRowIndex!==void 0?String(a.startRowIndex+1):"",u=a.endColumnIndex!==void 0?b5(a.endColumnIndex-1):"",e=a.endRowIndex!==void 0?String(a.endRowIndex):"";return n&&s&&u&&e?n===u&&s===e?`${t}${n}${s}`:`${t}${n}${s}:${u}${e}`:n&&u&&!s&&!e?`${t}${n}:${u}`:s&&e&&!n&&!u?`${t}${s}:${e}`:`${t}${n}${s}:${u}${e}`.replace(/:$/,"")}class V1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsGetConditionalFormatRules,version:"1.0.0",description:"Get Conditional Format Rules Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsGetConditionalFormatRules);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T;try{const g=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!g||!g.env)throw new Error("Editor context or environment missing");const b=Be(t,t.project,"getConditionalFormatRules"),I="["+Ve(t,t.project,"Get Conditional Format Rules")+": `"+b+"`] ",A=(le,oe,ce)=>{const be=Ve(le==null?void 0:le.valueOwner,g==null?void 0:g.logic,oe),Ce=Be(le==null?void 0:le.valueOwner,g==null?void 0:g.logic,ce);return`"${be}" (\`${Ce}\`)`},O=G.operation[J.GoogleSheetsGetConditionalFormatRules].inputs,P=le=>{var ce;const oe=n.find(be=>{var Ce;return((Ce=be.valueOwner.declaration)==null?void 0:Ce.id)===le});return(ce=oe==null?void 0:oe.value)==null?void 0:ce.value},x=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===O.connection.id}),$=(s=x==null?void 0:x.value)==null?void 0:s.valueAsType;if(!$||!$.id||!$.name||$.type!==r.DefinitionEntity)throw new Error(`${I}The ${A(x,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const U=ui($);if(!U)throw new Error(`${I}The ${A(x,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const Z=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===O.spreadsheetId.id}),q=(u=Z==null?void 0:Z.value)==null?void 0:u.value,H=ln(q,{errorPrefix:`${I}The ${A(Z,"Spreadsheet ID","spreadsheetId")} input `}),Y=P(O.sheet.id),ie=typeof Y=="string"&&Y.trim()!==""?Y.trim():null,W={Authorization:`Bearer ${await g.getAccessToken()}`},ee=`${(e=g.env)==null?void 0:e.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${g.projectId}/${Zt["google-sheet"]}/${U}`,re=((f=(await(async le=>Ht.post(ee,le,{headers:W}))({method:"GET",endpoint:`/v4/spreadsheets/${H}?fields=sheets(properties(sheetId,title),conditionalFormats)`})).data)==null?void 0:f.sheets)||[],ae=[];for(const le of re){const oe=((y=le.properties)==null?void 0:y.title)||"",ce=(m=le.properties)==null?void 0:m.sheetId;if(ie&&oe.toLowerCase()!==ie.toLowerCase())continue;(le.conditionalFormats||[]).forEach((Ce,Ee)=>{const Oe=Ee+1,Le=(Ce.ranges||[]).map(ot=>_Rn(ot,oe)),Fe=Ce.booleanRule||{},tt=Fe.condition||{},We=NRn(tt.type||""),et=(tt.values||[]).map(ot=>ot.userEnteredValue||""),qe=Fe.format||{};ae.push({index:Oe,sheet:oe,sheetId:ce,ranges:Le,conditionType:We,conditionValues:et,format:qe})})}return{value:K.Success,error:null,result:ae}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return pe.Logger.log("[Google Sheets] error:",b),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:b,result:null}}}})}}function E5(a){let p,t="",n=a+1;for(;n>0;)p=(n-1)%26,t=String.fromCharCode(65+p)+t,n=(n-p-1)/26;return t}function $Rn(a,p){if(!a)return"";let t=p?`'${p}'!`:"";const n=a.startColumnIndex!==void 0?E5(a.startColumnIndex):"",s=a.startRowIndex!==void 0?String(a.startRowIndex+1):"",u=a.endColumnIndex!==void 0?E5(a.endColumnIndex-1):"",e=a.endRowIndex!==void 0?String(a.endRowIndex):"";return n&&s&&u&&e?n===u&&s===e?`${t}${n}${s}`:`${t}${n}${s}:${u}${e}`:n&&u&&!s&&!e?`${t}${n}:${u}`:s&&e&&!n&&!u?`${t}${s}:${e}`:`${t}${n}${s}:${u}${e}`.replace(/:$/,"")}class N1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsGetProtectedRanges,version:"1.0.0",description:"Get Protected Ranges Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsGetProtectedRanges);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g;try{const b=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!b||!b.env)throw new Error("Editor context or environment missing");const R=Be(t,t.project,"getProtectedRanges"),A="["+Ve(t,t.project,"Get protected ranges")+": `"+R+"`] ",O=(ae,le,oe)=>{const ce=Ve(ae==null?void 0:ae.valueOwner,b==null?void 0:b.logic,le),be=Be(ae==null?void 0:ae.valueOwner,b==null?void 0:b.logic,oe);return`"${ce}" (\`${be}\`)`},P=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[J.GoogleSheetsGetProtectedRanges].inputs.connection.id}),x=(s=P==null?void 0:P.value)==null?void 0:s.valueAsType;if(!x||!x.id||!x.name||x.type!==r.DefinitionEntity)throw new Error(`${A}The ${O(P,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const $=ui(x);if(!$)throw new Error(`${A}The ${O(P,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const U=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[J.GoogleSheetsGetProtectedRanges].inputs.spreadsheetId.id}),Z=(u=U==null?void 0:U.value)==null?void 0:u.value,q=ln(Z,{errorPrefix:`${A}The ${O(U,"Spreadsheet ID","spreadsheetId")} input `}),H=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[J.GoogleSheetsGetProtectedRanges].inputs.sheet.id}),Y=(e=H==null?void 0:H.value)!=null&&e.value?String(H.value.value).trim():null,z={Authorization:`Bearer ${await b.getAccessToken()}`},W=`${(f=b.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${b.projectId}/${Zt["google-sheet"]}/${$}`,X=((y=(await(async ae=>Ht.post(W,ae,{headers:z}))({method:"GET",endpoint:`/v4/spreadsheets/${q}`})).data)==null?void 0:y.sheets)||[],re=[];for(const ae of X){const le=(m=ae.properties)==null?void 0:m.title,oe=(T=ae.properties)==null?void 0:T.sheetId;if(Y&&le!==Y)continue;const ce=ae.protectedRanges||[];for(const be of ce){const Ce=$Rn(be.range,le);re.push({protectedRangeId:be.protectedRangeId,sheet:le,sheetId:oe,range:Ce,description:be.description||"",warningOnly:be.warningOnly??!1,requestingUserCanEdit:be.requestingUserCanEdit??!0})}}return{value:K.Success,error:null,result:re}}catch(b){const R=((g=b.response)==null?void 0:g.data)||b.message||b;return pe.Logger.log("[Google Sheets] error:",R),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:R,result:null}}}})}}function bh(a){if(!a)return null;const p=Math.round((a.red||0)*255),t=Math.round((a.green||0)*255),n=Math.round((a.blue||0)*255),s=u=>u.toString(16).padStart(2,"0");return`#${s(p)}${s(t)}${s(n)}`}function I5(a){let p,t="",n=a+1;for(;n>0;)p=(n-1)%26,t=String.fromCharCode(65+p)+t,n=(n-p-1)/26;return t}function GRn(a,p){if(!a)return"";let t=p?`'${p}'!`:"";const n=a.startColumnIndex!==void 0?I5(a.startColumnIndex):"",s=a.startRowIndex!==void 0?String(a.startRowIndex+1):"",u=a.endColumnIndex!==void 0?I5(a.endColumnIndex-1):"",e=a.endRowIndex!==void 0?String(a.endRowIndex):"";return n&&s&&u&&e?n===u&&s===e?`${t}${n}${s}`:`${t}${n}${s}:${u}${e}`:n&&u&&!s&&!e?`${t}${n}:${u}`:s&&e&&!n&&!u?`${t}${s}:${e}`:`${t}${n}${s}:${u}${e}`.replace(/:$/,"")}class _1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsGetBandedRanges,version:"1.0.0",description:"Get Banded Ranges Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsGetBandedRanges);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A;try{const O=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!O||!O.env)throw new Error("Editor context or environment missing");const P=Be(t,t.project,"getBandedRanges"),$="["+Ve(t,t.project,"Get banded ranges")+": `"+P+"`] ",U=(be,Ce,Ee)=>{const Oe=Ve(be==null?void 0:be.valueOwner,O==null?void 0:O.logic,Ce),Le=Be(be==null?void 0:be.valueOwner,O==null?void 0:O.logic,Ee);return`"${Oe}" (\`${Le}\`)`},Z=n.find(be=>{var Ce;return((Ce=be.valueOwner.declaration)==null?void 0:Ce.id)===G.operation[J.GoogleSheetsGetBandedRanges].inputs.connection.id}),q=(s=Z==null?void 0:Z.value)==null?void 0:s.valueAsType;if(!q||!q.id||!q.name||q.type!==r.DefinitionEntity)throw new Error(`${$}The ${U(Z,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const H=ui(q);if(!H)throw new Error(`${$}The ${U(Z,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const Y=n.find(be=>{var Ce;return((Ce=be.valueOwner.declaration)==null?void 0:Ce.id)===G.operation[J.GoogleSheetsGetBandedRanges].inputs.spreadsheetId.id}),ie=(u=Y==null?void 0:Y.value)==null?void 0:u.value,z=ln(ie,{errorPrefix:`${$}The ${U(Y,"Spreadsheet ID","spreadsheetId")} input `}),W=n.find(be=>{var Ce;return((Ce=be.valueOwner.declaration)==null?void 0:Ce.id)===G.operation[J.GoogleSheetsGetBandedRanges].inputs.sheet.id}),ee=(e=W==null?void 0:W.value)!=null&&e.value?String(W.value.value).trim():null,X={Authorization:`Bearer ${await O.getAccessToken()}`},re=`${(f=O.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${O.projectId}/${Zt["google-sheet"]}/${H}`,oe=((y=(await(async be=>Ht.post(re,be,{headers:X}))({method:"GET",endpoint:`/v4/spreadsheets/${z}`})).data)==null?void 0:y.sheets)||[],ce=[];for(const be of oe){const Ce=(m=be.properties)==null?void 0:m.title,Ee=(T=be.properties)==null?void 0:T.sheetId;if(ee&&Ce!==ee)continue;const Oe=be.bandedRanges||[];for(const Le of Oe){const Fe=GRn(Le.range,Ce),tt=Le.rowProperties||{};ce.push({bandedRangeId:Le.bandedRangeId,sheet:Ce,sheetId:Ee,range:Fe,headerRowColor:bh(tt.headerColor)||bh((g=tt.headerColorStyle)==null?void 0:g.rgbColor),firstRowColor:bh(tt.firstBandColor)||bh((b=tt.firstBandColorStyle)==null?void 0:b.rgbColor),secondRowColor:bh(tt.secondBandColor)||bh((R=tt.secondBandColorStyle)==null?void 0:R.rgbColor),footerRowColor:bh(tt.footerColor)||bh((I=tt.footerColorStyle)==null?void 0:I.rgbColor)})}}return{value:K.Success,error:null,result:ce}}catch(O){const P=((A=O.response)==null?void 0:A.data)||O.message||O;return pe.Logger.log("[Google Sheets] error:",P),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:P,result:null}}}})}}function R5(a){let p,t="",n=a+1;for(;n>0;)p=(n-1)%26,t=String.fromCharCode(65+p)+t,n=(n-p-1)/26;return t}function LRn(a,p){if(!a)return"";let t=p?`'${p}'!`:"";const n=a.startColumnIndex!==void 0?R5(a.startColumnIndex):"",s=a.startRowIndex!==void 0?String(a.startRowIndex+1):"",u=a.endColumnIndex!==void 0?R5(a.endColumnIndex-1):"",e=a.endRowIndex!==void 0?String(a.endRowIndex):"";return n&&s&&u&&e?n===u&&s===e?`${t}${n}${s}`:`${t}${n}${s}:${u}${e}`:n&&u&&!s&&!e?`${t}${n}:${u}`:s&&e&&!n&&!u?`${t}${s}:${e}`:`${t}${n}${s}:${u}${e}`.replace(/:$/,"")}class $1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsGetNamedRanges,version:"1.0.0",description:"Get Named Ranges Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsGetNamedRanges);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=Be(t,t.project,"getNamedRanges"),R="["+Ve(t,t.project,"Get named ranges")+": `"+g+"`] ",I=(te,X,re)=>{const ae=Ve(te==null?void 0:te.valueOwner,T==null?void 0:T.logic,X),le=Be(te==null?void 0:te.valueOwner,T==null?void 0:T.logic,re);return`"${ae}" (\`${le}\`)`},A=n.find(te=>{var X;return((X=te.valueOwner.declaration)==null?void 0:X.id)===G.operation[J.GoogleSheetsGetNamedRanges].inputs.connection.id}),O=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${R}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const P=ui(O);if(!P)throw new Error(`${R}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(te=>{var X;return((X=te.valueOwner.declaration)==null?void 0:X.id)===G.operation[J.GoogleSheetsGetNamedRanges].inputs.spreadsheetId.id}),$=(u=x==null?void 0:x.value)==null?void 0:u.value,U=ln($,{errorPrefix:`${R}The ${I(x,"Spreadsheet ID","spreadsheetId")} input `}),q={Authorization:`Bearer ${await T.getAccessToken()}`},H=`${(e=T.env)==null?void 0:e.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${T.projectId}/${Zt["google-sheet"]}/${P}`,ie=await(async te=>Ht.post(H,te,{headers:q}))({method:"GET",endpoint:`/v4/spreadsheets/${U}`}),z={};(((f=ie.data)==null?void 0:f.sheets)||[]).forEach(te=>{var X;((X=te.properties)==null?void 0:X.sheetId)!==void 0&&(z[te.properties.sheetId]=te.properties.title||"")});const ee=(((y=ie.data)==null?void 0:y.namedRanges)||[]).map(te=>{var ae;const X=z[(ae=te.range)==null?void 0:ae.sheetId]||"",re=LRn(te.range,X);return{namedRangeId:te.namedRangeId,name:te.name,sheet:X,range:re}});return{value:K.Success,error:null,result:ee}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return pe.Logger.log("[Google Sheets] error:",g),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:g,result:null}}}})}}class G1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsGetSheets,version:"1.0.0",description:"Get Sheets Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsGetSheets);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"getSheets"),b="["+Ve(t,t.project,"Get sheets")+": `"+T+"`] ",R=(W,ee,te)=>{const X=Ve(W==null?void 0:W.valueOwner,m==null?void 0:m.logic,ee),re=Be(W==null?void 0:W.valueOwner,m==null?void 0:m.logic,te);return`"${X}" (\`${re}\`)`},I=n.find(W=>{var ee;return((ee=W.valueOwner.declaration)==null?void 0:ee.id)===G.operation[J.GoogleSheetsGetSheets].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(A);if(!O)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(W=>{var ee;return((ee=W.valueOwner.declaration)==null?void 0:ee.id)===G.operation[J.GoogleSheetsGetSheets].inputs.spreadsheetId.id}),x=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(x,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),Z={Authorization:`Bearer ${await m.getAccessToken()}`},q=`${(e=m.env)==null?void 0:e.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${O}`,z=(((f=(await(async W=>Ht.post(q,W,{headers:Z}))({method:"GET",endpoint:`/v4/spreadsheets/${$}`})).data)==null?void 0:f.sheets)||[]).map(W=>{var ee,te,X,re,ae,le,oe,ce,be,Ce,Ee,Oe,Le;return{sheetId:(ee=W.properties)==null?void 0:ee.sheetId,title:(te=W.properties)==null?void 0:te.title,index:(X=W.properties)==null?void 0:X.index,sheetType:(re=W.properties)==null?void 0:re.sheetType,rowCount:(le=(ae=W.properties)==null?void 0:ae.gridProperties)==null?void 0:le.rowCount,columnCount:(ce=(oe=W.properties)==null?void 0:oe.gridProperties)==null?void 0:ce.columnCount,frozenRowCount:(Ce=(be=W.properties)==null?void 0:be.gridProperties)==null?void 0:Ce.frozenRowCount,frozenColumnCount:(Oe=(Ee=W.properties)==null?void 0:Ee.gridProperties)==null?void 0:Oe.frozenColumnCount,hidden:((Le=W.properties)==null?void 0:Le.hidden)??!1}});return{value:K.Success,error:null,result:z}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class L1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsGetSheet,version:"1.0.0",description:"Get Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsGetSheet);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=Be(t,t.project,"getSheet"),R="["+Ve(t,t.project,"Get sheet")+": `"+g+"`] ",I=(le,oe,ce)=>{const be=Ve(le==null?void 0:le.valueOwner,T==null?void 0:T.logic,oe),Ce=Be(le==null?void 0:le.valueOwner,T==null?void 0:T.logic,ce);return`"${be}" (\`${Ce}\`)`},A=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[J.GoogleSheetsGetSheet].inputs.connection.id}),O=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${R}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const P=ui(O);if(!P)throw new Error(`${R}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[J.GoogleSheetsGetSheet].inputs.spreadsheetId.id}),$=(u=x==null?void 0:x.value)==null?void 0:u.value,U=ln($,{errorPrefix:`${R}The ${I(x,"Spreadsheet ID","spreadsheetId")} input `}),Z=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[J.GoogleSheetsGetSheet].inputs.sheet.id}),q=(e=Z==null?void 0:Z.value)==null?void 0:e.value;if(q==null||q==="")throw new Error(`${R}The ${I(Z,"Sheet","sheet")} input is missing.`);const Y={Authorization:`Bearer ${await T.getAccessToken()}`},ie=`${(f=T.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${T.projectId}/${Zt["google-sheet"]}/${P}`,ee=((y=(await(async le=>Ht.post(ie,le,{headers:Y}))({method:"GET",endpoint:`/v4/spreadsheets/${U}`})).data)==null?void 0:y.sheets)||[];let te=null;if(typeof q=="number")te=ee.find(le=>{var oe;return Number((oe=le.properties)==null?void 0:oe.sheetId)===q});else if(typeof q=="string"){const le=q.trim();te=ee.find(oe=>{var ce,be;return((ce=oe.properties)==null?void 0:ce.title)===le||String((be=oe.properties)==null?void 0:be.sheetId)===le})}if(!te)throw new Error(`${R}Sheet "${q}" was not found in spreadsheet.`);const X=te.properties||{},re=X.gridProperties||{},ae={sheetId:X.sheetId,title:X.title,index:X.index,sheetType:X.sheetType,rowCount:re.rowCount,columnCount:re.columnCount,frozenRowCount:re.frozenRowCount,frozenColumnCount:re.frozenColumnCount,hideGridlines:re.hideGridlines??!1,rowGroupControlAfter:re.rowGroupControlAfter??!1,columnGroupControlAfter:re.columnGroupControlAfter??!1,hidden:X.hidden??!1,rightToLeft:X.rightToLeft??!1,tabColor:X.tabColor?{red:X.tabColor.red??0,green:X.tabColor.green??0,blue:X.tabColor.blue??0,alpha:X.tabColor.alpha??1}:null,basicFilter:te.basicFilter?{range:te.basicFilter.range}:null,protectedRanges:(te.protectedRanges||[]).map(le=>({protectedRangeId:le.protectedRangeId,range:le.range,description:le.description??"",warningOnly:le.warningOnly??!1,requestingUserCanEdit:le.requestingUserCanEdit??!1,namedRangeId:le.namedRangeId??null})),bandedRanges:(te.bandedRanges||[]).map(le=>({bandedRangeId:le.bandedRangeId,range:le.range})),charts:(te.charts||[]).map(le=>{var oe,ce;return{chartId:le.chartId,title:((oe=le.spec)==null?void 0:oe.title)??"",chartType:((ce=le.spec)==null?void 0:ce.chartType)??""}}),conditionalFormatRules:(te.conditionalFormats||[]).map((le,oe)=>{var ce;return{ruleIndex:oe,range:(ce=le.ranges)!=null&&ce[0]?`${le.ranges[0].startRowIndex}:${le.ranges[0].endRowIndex}`:""}}),mergedCells:(te.merges||[]).map(le=>`${le.startRowIndex}:${le.endRowIndex}`)};return{value:K.Success,error:null,result:ae}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return pe.Logger.log("[Google Sheets] error:",g),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:g,result:null}}}})}}function A5(a){let p,t="",n=a+1;for(;n>0;)p=(n-1)%26,t=String.fromCharCode(65+p)+t,n=(n-p-1)/26;return t}function BRn(a,p){if(!a)return"";let t=p?`'${p}'!`:"";const n=a.startColumnIndex!==void 0?A5(a.startColumnIndex):"",s=a.startRowIndex!==void 0?String(a.startRowIndex+1):"",u=a.endColumnIndex!==void 0?A5(a.endColumnIndex-1):"",e=a.endRowIndex!==void 0?String(a.endRowIndex):"";return n&&s&&u&&e?n===u&&s===e?`${t}${n}${s}`:`${t}${n}${s}:${u}${e}`:n&&u&&!s&&!e?`${t}${n}:${u}`:s&&e&&!n&&!u?`${t}${s}:${e}`:`${t}${n}${s}:${u}${e}`.replace(/:$/,"")}class B1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsGetCharts,version:"1.0.0",description:"Get Charts Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsGetCharts);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I;try{const A=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!A||!A.env)throw new Error("Editor context or environment missing");const O=Be(t,t.project,"getCharts"),x="["+Ve(t,t.project,"Get charts")+": `"+O+"`] ",$=(ce,be,Ce)=>{const Ee=Ve(ce==null?void 0:ce.valueOwner,A==null?void 0:A.logic,be),Oe=Be(ce==null?void 0:ce.valueOwner,A==null?void 0:A.logic,Ce);return`"${Ee}" (\`${Oe}\`)`},U=n.find(ce=>{var be;return((be=ce.valueOwner.declaration)==null?void 0:be.id)===G.operation[J.GoogleSheetsGetCharts].inputs.connection.id}),Z=(s=U==null?void 0:U.value)==null?void 0:s.valueAsType;if(!Z||!Z.id||!Z.name||Z.type!==r.DefinitionEntity)throw new Error(`${x}The ${$(U,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const q=ui(Z);if(!q)throw new Error(`${x}The ${$(U,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const H=n.find(ce=>{var be;return((be=ce.valueOwner.declaration)==null?void 0:be.id)===G.operation[J.GoogleSheetsGetCharts].inputs.spreadsheetId.id}),Y=(u=H==null?void 0:H.value)==null?void 0:u.value,ie=ln(Y,{errorPrefix:`${x}The ${$(H,"Spreadsheet ID","spreadsheetId")} input `}),z=n.find(ce=>{var be;return((be=ce.valueOwner.declaration)==null?void 0:be.id)===G.operation[J.GoogleSheetsGetCharts].inputs.sheet.id}),W=(e=z==null?void 0:z.value)!=null&&e.value?String(z.value.value).trim():null,te={Authorization:`Bearer ${await A.getAccessToken()}`},X=`${(f=A.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${A.projectId}/${Zt["google-sheet"]}/${q}`,le=((y=(await(async ce=>Ht.post(X,ce,{headers:te}))({method:"GET",endpoint:`/v4/spreadsheets/${ie}`})).data)==null?void 0:y.sheets)||[],oe=[];for(const ce of le){const be=(m=ce.properties)==null?void 0:m.title,Ce=(T=ce.properties)==null?void 0:T.sheetId;if(W&&be!==W)continue;const Ee=ce.charts||[];for(const Oe of Ee){const Le=Oe.spec||{},Fe=Le.title||"",tt=((g=Le.basicChart)==null?void 0:g.chartType)||(Le.pieChart?"PIE":"UNKNOWN"),We=BRn((R=(b=Oe.position)==null?void 0:b.overlayPosition)==null?void 0:R.anchorCell,be);oe.push({chartId:Oe.chartId,sheet:be,sheetId:Ce,title:Fe,chartType:tt,positionRange:We})}}return{value:K.Success,error:null,result:oe}}catch(A){const O=((I=A.response)==null?void 0:I.data)||A.message||A;return pe.Logger.log("[Google Sheets] error:",O),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:O,result:null}}}})}}function D5(a){let p,t="",n=a+1;for(;n>0;)p=(n-1)%26,t=String.fromCharCode(65+p)+t,n=(n-p-1)/26;return t}function C5(a,p){if(!a)return"";let t=p?`'${p}'!`:"";const n=a.startColumnIndex!==void 0?D5(a.startColumnIndex):"",s=a.startRowIndex!==void 0?String(a.startRowIndex+1):"",u=a.endColumnIndex!==void 0?D5(a.endColumnIndex-1):"",e=a.endRowIndex!==void 0?String(a.endRowIndex):"";return n&&s&&u&&e?n===u&&s===e?`${t}${n}${s}`:`${t}${n}${s}:${u}${e}`:n&&u&&!s&&!e?`${t}${n}:${u}`:s&&e&&!n&&!u?`${t}${s}:${e}`:`${t}${n}${s}:${u}${e}`.replace(/:$/,"")}class S1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsGetFilter,version:"1.0.0",description:"Get Filter Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsGetFilter);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g;try{const b=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!b||!b.env)throw new Error("Editor context or environment missing");const R=Be(t,t.project,"getFilter"),A="["+Ve(t,t.project,"Get filter")+": `"+R+"`] ",O=(Ce,Ee,Oe)=>{const Le=Ve(Ce==null?void 0:Ce.valueOwner,b==null?void 0:b.logic,Ee),Fe=Be(Ce==null?void 0:Ce.valueOwner,b==null?void 0:b.logic,Oe);return`"${Le}" (\`${Fe}\`)`},P=n.find(Ce=>{var Ee;return((Ee=Ce.valueOwner.declaration)==null?void 0:Ee.id)===G.operation[J.GoogleSheetsGetFilter].inputs.connection.id}),x=(s=P==null?void 0:P.value)==null?void 0:s.valueAsType;if(!x||!x.id||!x.name||x.type!==r.DefinitionEntity)throw new Error(`${A}The ${O(P,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const $=ui(x);if(!$)throw new Error(`${A}The ${O(P,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const U=n.find(Ce=>{var Ee;return((Ee=Ce.valueOwner.declaration)==null?void 0:Ee.id)===G.operation[J.GoogleSheetsGetFilter].inputs.spreadsheetId.id}),Z=(u=U==null?void 0:U.value)==null?void 0:u.value,q=ln(Z,{errorPrefix:`${A}The ${O(U,"Spreadsheet ID","spreadsheetId")} input `}),H=n.find(Ce=>{var Ee;return((Ee=Ce.valueOwner.declaration)==null?void 0:Ee.id)===G.operation[J.GoogleSheetsGetFilter].inputs.sheet.id}),Y=(e=H==null?void 0:H.value)!=null&&e.value?String(H.value.value).trim():null,z={Authorization:`Bearer ${await b.getAccessToken()}`},W=`${(f=b.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${b.projectId}/${Zt["google-sheet"]}/${$}`,X=((y=(await(async Ce=>Ht.post(W,Ce,{headers:z}))({method:"GET",endpoint:`/v4/spreadsheets/${q}`})).data)==null?void 0:y.sheets)||[];let re=X[0];Y&&(re=X.find(Ce=>{var Ee;return((Ee=Ce.properties)==null?void 0:Ee.title)===Y})||re);const ae=((m=re==null?void 0:re.properties)==null?void 0:m.title)||"",le=((T=re==null?void 0:re.properties)==null?void 0:T.sheetId)??0,oe=re==null?void 0:re.basicFilter,ce=oe?C5(oe.range,ae):null,be=((re==null?void 0:re.filterViews)||[]).map(Ce=>({filterViewId:Ce.filterViewId,title:Ce.title,range:C5(Ce.range,ae)}));return{value:K.Success,error:null,result:{sheet:ae,sheetId:le,filterRange:ce,filterViews:be}}}catch(b){const R=((g=b.response)==null?void 0:g.data)||b.message||b;return pe.Logger.log("[Google Sheets] error:",R),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:R,result:null}}}})}}function w5(a){let p,t="",n=a+1;for(;n>0;)p=(n-1)%26,t=String.fromCharCode(65+p)+t,n=(n-p-1)/26;return t}function SRn(a,p){if(!a)return"";let t=p?`'${p}'!`:"";const n=a.startColumnIndex!==void 0?w5(a.startColumnIndex):"",s=a.startRowIndex!==void 0?String(a.startRowIndex+1):"",u=a.endColumnIndex!==void 0?w5(a.endColumnIndex-1):"",e=a.endRowIndex!==void 0?String(a.endRowIndex):"";return n&&s&&u&&e?n===u&&s===e?`${t}${n}${s}`:`${t}${n}${s}:${u}${e}`:n&&u&&!s&&!e?`${t}${n}:${u}`:s&&e&&!n&&!u?`${t}${s}:${e}`:`${t}${n}${s}:${u}${e}`.replace(/:$/,"")}class M1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsGetMergedCells,version:"1.0.0",description:"Get Merged Cells Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsGetMergedCells);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g;try{const b=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!b||!b.env)throw new Error("Editor context or environment missing");const R=Be(t,t.project,"getMergedCells"),A="["+Ve(t,t.project,"Get merged cells")+": `"+R+"`] ",O=(ae,le,oe)=>{const ce=Ve(ae==null?void 0:ae.valueOwner,b==null?void 0:b.logic,le),be=Be(ae==null?void 0:ae.valueOwner,b==null?void 0:b.logic,oe);return`"${ce}" (\`${be}\`)`},P=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[J.GoogleSheetsGetMergedCells].inputs.connection.id}),x=(s=P==null?void 0:P.value)==null?void 0:s.valueAsType;if(!x||!x.id||!x.name||x.type!==r.DefinitionEntity)throw new Error(`${A}The ${O(P,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const $=ui(x);if(!$)throw new Error(`${A}The ${O(P,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const U=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[J.GoogleSheetsGetMergedCells].inputs.spreadsheetId.id}),Z=(u=U==null?void 0:U.value)==null?void 0:u.value,q=ln(Z,{errorPrefix:`${A}The ${O(U,"Spreadsheet ID","spreadsheetId")} input `}),H=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[J.GoogleSheetsGetMergedCells].inputs.sheet.id}),Y=(e=H==null?void 0:H.value)!=null&&e.value?String(H.value.value).trim():null,z={Authorization:`Bearer ${await b.getAccessToken()}`},W=`${(f=b.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${b.projectId}/${Zt["google-sheet"]}/${$}`,X=((y=(await(async ae=>Ht.post(W,ae,{headers:z}))({method:"GET",endpoint:`/v4/spreadsheets/${q}`})).data)==null?void 0:y.sheets)||[],re=[];for(const ae of X){const le=(m=ae.properties)==null?void 0:m.title,oe=(T=ae.properties)==null?void 0:T.sheetId;if(Y&&le!==Y)continue;const ce=ae.merges||[];for(const be of ce){const Ce=SRn(be,le);re.push({sheet:le,sheetId:oe,range:Ce})}}return{value:K.Success,error:null,result:re}}catch(b){const R=((g=b.response)==null?void 0:g.data)||b.message||b;return pe.Logger.log("[Google Sheets] error:",R),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:R,result:null}}}})}}class F1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsResizeDimension,version:"1.0.0",description:"Resize Dimension Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsResizeDimension);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T;try{const g=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!g||!g.env)throw new Error("Editor context or environment missing");const b=Be(t,t.project,"resizeDimension"),I="["+Ve(t,t.project,"Resize dimension")+": `"+b+"`] ",A=(ce,be,Ce)=>{const Ee=Ve(ce==null?void 0:ce.valueOwner,g==null?void 0:g.logic,be),Oe=Be(ce==null?void 0:ce.valueOwner,g==null?void 0:g.logic,Ce);return`"${Ee}" (\`${Oe}\`)`},O=n.find(ce=>{var be;return((be=ce.valueOwner.declaration)==null?void 0:be.id)===G.operation[J.GoogleSheetsResizeDimension].inputs.connection.id}),P=(s=O==null?void 0:O.value)==null?void 0:s.valueAsType;if(!P||!P.id||!P.name||P.type!==r.DefinitionEntity)throw new Error(`${I}The ${A(O,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=ui(P);if(!x)throw new Error(`${I}The ${A(O,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const $=n.find(ce=>{var be;return((be=ce.valueOwner.declaration)==null?void 0:be.id)===G.operation[J.GoogleSheetsResizeDimension].inputs.spreadsheetId.id}),U=(u=$==null?void 0:$.value)==null?void 0:u.value,Z=ln(U,{errorPrefix:`${I}The ${A($,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(ce=>{var be;return((be=ce.valueOwner.declaration)==null?void 0:be.id)===G.operation[J.GoogleSheetsResizeDimension].inputs.range.id}),H=(e=q==null?void 0:q.value)==null?void 0:e.value;if(H==null)throw new Error(`${I}The ${A(q,"Range","range")} input is missing.`);const Y=n.find(ce=>{var be;return((be=ce.valueOwner.declaration)==null?void 0:be.id)===G.operation[J.GoogleSheetsResizeDimension].inputs.dimension.id}),ie=((f=Y==null?void 0:Y.value)==null?void 0:f.value)||"Both",z=n.find(ce=>{var be;return((be=ce.valueOwner.declaration)==null?void 0:be.id)===G.operation[J.GoogleSheetsResizeDimension].inputs.pixelSize.id}),W=(y=z==null?void 0:z.value)==null?void 0:y.value;if(W==null||typeof W!="number"||isNaN(W)||W<0)throw new Error(`${I}The ${A(z,"Pixel size","pixelSize")} input is missing or invalid. Expected a non-negative number in pixels.`);const te={Authorization:`Bearer ${await g.getAccessToken()}`},X=`${(m=g.env)==null?void 0:m.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${g.projectId}/${Zt["google-sheet"]}/${x}`,re=async ce=>Ht.post(X,ce,{headers:te}),ae=await Ha(H,"Id",async()=>{var be;return(((be=(await re({method:"GET",endpoint:`/v4/spreadsheets/${Z}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:be.sheets)||[]).map(Ce=>{var Ee,Oe;return{id:(Ee=Ce.properties)==null?void 0:Ee.sheetId,name:(Oe=Ce.properties)==null?void 0:Oe.title}})}),oe=S4(ae,typeof ie=="string"?ie:void 0,{errorPrefix:`${I}The ${A(q,"Range","range")} input `}).map(ce=>({updateDimensionProperties:{range:ce,properties:{pixelSize:W},fields:"pixelSize"}}));return await re({method:"POST",endpoint:`/v4/spreadsheets/${Z}:batchUpdate`,data:{requests:oe}}),{value:K.Success,result:null,error:null}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return pe.Logger.log("[Google Sheets] error:",b),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:b,result:null}}}})}}class k1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsClearFormatting,version:"1.0.0",description:"Clear Formatting Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsClearFormatting);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"clearFormatting"),b="["+Ve(t,t.project,"Clear formatting")+": `"+T+"`] ",R=(ee,te,X)=>{const re=Ve(ee==null?void 0:ee.valueOwner,m==null?void 0:m.logic,te),ae=Be(ee==null?void 0:ee.valueOwner,m==null?void 0:m.logic,X);return`"${re}" (\`${ae}\`)`},I=n.find(ee=>{var te;return((te=ee.valueOwner.declaration)==null?void 0:te.id)===G.operation[J.GoogleSheetsClearFormatting].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(A);if(!O)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(ee=>{var te;return((te=ee.valueOwner.declaration)==null?void 0:te.id)===G.operation[J.GoogleSheetsClearFormatting].inputs.spreadsheetId.id}),x=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(x,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(ee=>{var te;return((te=ee.valueOwner.declaration)==null?void 0:te.id)===G.operation[J.GoogleSheetsClearFormatting].inputs.range.id}),Z=(e=U==null?void 0:U.value)==null?void 0:e.value;if(!Z||Z==="")throw new Error(`${b}The ${R(U,"Range","range")} input is missing.`);const H={Authorization:`Bearer ${await m.getAccessToken()}`},Y=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${O}`,ie=async ee=>Ht.post(Y,ee,{headers:H}),z=await Ha(Z,"Id",async()=>{var te;return(((te=(await ie({method:"GET",endpoint:`/v4/spreadsheets/${$}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:te.sheets)||[]).map(X=>{var re,ae;return{id:(re=X.properties)==null?void 0:re.sheetId,name:(ae=X.properties)==null?void 0:ae.title}})}),W=ps(z,{errorPrefix:`${b}The ${R(U,"Range","range")} input `});return await ie({method:"POST",endpoint:`/v4/spreadsheets/${$}:batchUpdate`,data:{requests:[{repeatCell:{range:W,cell:{userEnteredFormat:{}},fields:"userEnteredFormat"}}]}}),{value:K.Success,error:null,result:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class U1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_UPLOAD_FILE,version:"1.0.0",description:"Cloud File System: Upload File",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic);if(!n)return;const s=n.get(Ye.UploadFile);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"uploadFile"),b="["+Ve(t,t.project,"Upload file")+": `"+T+"`] ",R=n.find(te=>{var X,re;return((re=(X=te.valueOwner)==null?void 0:X.declaration)==null?void 0:re.id)===G.operation[Ye.UploadFile].inputs.bucket.id}),I=(s=R==null?void 0:R.value)==null?void 0:s.valueAsType;if(!I||!I.id||!I.name||I.type!==r.DefinitionEntity)throw new Error(`${b}Invalid input "${Ve(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"Storage")}" (\`${Be(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const A=ul(I==null?void 0:I.id,((u=m.branchHead)==null?void 0:u.identifier)||"main");if(!((m==null?void 0:m.liveResources)||[]).find(te=>te.resourceId===A))throw new Error(`${b}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const P=n.find(te=>{var X,re;return((re=(X=te.valueOwner)==null?void 0:X.declaration)==null?void 0:re.id)===G.operation[Ye.UploadFile].inputs.key.id}),x=(e=P==null?void 0:P.value)==null?void 0:e.value;if(!x||x==="")throw new Error(`${b}The "${Ve(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"key")}\`) input is missing.`);if(typeof x!="string")throw new Error(`${b}The "${Ve(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const $=n.find(te=>{var X,re;return((re=(X=te.valueOwner)==null?void 0:X.declaration)==null?void 0:re.id)===G.operation[Ye.UploadFile].inputs.file.id}),U=(f=$==null?void 0:$.value)==null?void 0:f.value;if(!U)throw new Error(`${b}The "${Ve($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"File")}" (\`${Be($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"file")}\`) input is missing'`);if(typeof U!="object"||!U.uri||typeof U.uri!="string")throw new Error(`${b}The "${Ve($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"File")}" (\`${Be($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"file")}\`) input is invalid, should be an object with a text 'uri' property.`);const Z=U.uri,q=U.mimeType||"application/octet-stream",H=x,ie=(y=(await Ht.post(`${m.env.API_BASE_URL}/cloud-files-service/v1/files?bucket=${A}&key=${encodeURIComponent(H)}&contentType=${encodeURIComponent(q)}`,{},{headers:{Authorization:`Bearer ${await m.getAccessToken()}`}})).data)==null?void 0:y.uploadUrl;if(!ie)throw new Error(`${b}Failed to retrieve pre-signed upload URL.`);let z;try{z=await L4(Z,()=>m.getAccessToken())}catch(te){throw new Error(`${b}Failed to fetch file content from '${Z}': ${(te==null?void 0:te.message)||te}`)}await Ht.put(ie,z,{headers:{"Content-Type":q}});const ee={uri:`${m.env.API_BASE_URL}/cloud-files-service/v1/files/download?bucket=${A}&key=${encodeURIComponent(H)}`,name:H.split("/").pop()||H,mimeType:q,size:z.length};return{value:K.Success,error:null,result:ee}}catch(m){return{value:K.UnhandledError,error:m,result:null}}}})}}class K1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_GET_FILE,version:"1.0.0",description:"Cloud File System: Get File",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic);if(!n)return;const s=n.get(Ye.GetFile);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e;try{const f=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!f||!f.env)throw new Error("Editor context or environment missing");const y=Be(t,t.project,"getFile"),T="["+Ve(t,t.project,"Get file")+": `"+y+"`] ",g=n.find($=>{var U,Z;return((Z=(U=$.valueOwner)==null?void 0:U.declaration)==null?void 0:Z.id)===G.operation[Ye.GetFile].inputs.bucket.id}),b=(s=g==null?void 0:g.value)==null?void 0:s.valueAsType;if(!b||!b.id||!b.name||b.type!==r.DefinitionEntity)throw new Error(`${T}Invalid input "${Ve(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"Storage")}" (\`${Be(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const R=ul(b==null?void 0:b.id,((u=f.branchHead)==null?void 0:u.identifier)||"main");if(!((f==null?void 0:f.liveResources)||[]).find($=>$.resourceId===R))throw new Error(`${T}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const A=n.find($=>{var U,Z;return((Z=(U=$.valueOwner)==null?void 0:U.declaration)==null?void 0:Z.id)===G.operation[Ye.GetFile].inputs.key.id}),O=(e=A==null?void 0:A.value)==null?void 0:e.value;if(!O||O==="")throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"key")}\`) input is missing.`);if(typeof O!="string")throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const x=(await Ht.get(`${f.env.API_BASE_URL}/cloud-files-service/v1/files/metadata?bucket=${R}&key=${encodeURIComponent(O)}`,{headers:{Authorization:`Bearer ${await f.getAccessToken()}`}})).data;return{value:K.Success,error:null,result:{uri:x.uri,name:x.name,key:x.key,size:x.size,mimeType:x.mimeType,access:x.access,lastModified:x.lastModified}}}catch(f){return{value:K.UnhandledError,error:f,result:null}}}})}}class j1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_LIST_FILES,version:"1.0.0",description:"Cloud File System: List Files",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic);if(!n)return;const s=n.get(Ye.ListFiles);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"listFiles"),b="["+Ve(t,t.project,"List files")+": `"+T+"`] ",R=n.find(ae=>{var le,oe;return((oe=(le=ae.valueOwner)==null?void 0:le.declaration)==null?void 0:oe.id)===G.operation[Ye.ListFiles].inputs.bucket.id}),I=(s=R==null?void 0:R.value)==null?void 0:s.valueAsType;if(!I||!I.id||!I.name||I.type!==r.DefinitionEntity)throw new Error(`${b}Invalid input "${Ve(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"Storage")}" (\`${Be(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const A=ul(I==null?void 0:I.id,((u=m.branchHead)==null?void 0:u.identifier)||"main");if(!((m==null?void 0:m.liveResources)||[]).find(ae=>ae.resourceId===A))throw new Error(`${b}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const P=n.find(ae=>{var le,oe;return((oe=(le=ae.valueOwner)==null?void 0:le.declaration)==null?void 0:oe.id)===G.operation[Ye.ListFiles].inputs.path.id}),x=(e=P==null?void 0:P.value)==null?void 0:e.value;if(x!==void 0&&typeof x!="string")throw new Error(`${b}The "${Ve(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"Path")}" (\`${Be(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"path")}\`) input value is invalid, if present, it must be a string.`);const $=n.find(ae=>{var le,oe;return((oe=(le=ae.valueOwner)==null?void 0:le.declaration)==null?void 0:oe.id)===G.operation[Ye.ListFiles].inputs.maxKeys.id}),U=(f=$==null?void 0:$.value)==null?void 0:f.value;if(U!==void 0&&(typeof U!="number"||U<=0))throw new Error(`${b}The "${Ve($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"Max results")}" (\`${Be($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"maxKeys")}\`) input value is invalid, if present, it must be a number greater than 0.`);const Z=n.find(ae=>{var le,oe;return((oe=(le=ae.valueOwner)==null?void 0:le.declaration)==null?void 0:oe.id)===G.operation[Ye.ListFiles].inputs.startAfter.id}),q=(y=Z==null?void 0:Z.value)==null?void 0:y.value;if(q!==void 0&&(typeof q!="string"||q===""))throw new Error(`${b}The "${Ve(Z==null?void 0:Z.valueOwner,m==null?void 0:m.logic,"Start after")}" (\`${Be(Z==null?void 0:Z.valueOwner,m==null?void 0:m.logic,"startAfter")}\`) input value is invalid, if present, it must be a non-empty string.`);let H=`${m.env.API_BASE_URL}/cloud-files-service/v1/files?bucket=${A}`;x&&(H+=`&path=${encodeURIComponent(x)}`),U&&(H+=`&maxKeys=${U}`),q&&(H+=`&startAfter=${encodeURIComponent(q)}`);const Y=await Ht.get(H,{headers:{Authorization:`Bearer ${await m.getAccessToken()}`}}),ie=ae=>{var be;if(!ae)return"application/octet-stream";const le=ae.split(".");if(le.length<=1)return"application/octet-stream";const oe=(be=le.pop())==null?void 0:be.toLowerCase();return oe&&{png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",svg:"image/svg+xml",pdf:"application/pdf",txt:"text/plain",html:"text/html",css:"text/css",js:"application/javascript",json:"application/json",csv:"text/csv",xml:"application/xml",zip:"application/zip",mp3:"audio/mpeg",mp4:"video/mp4",mov:"video/quicktime",wav:"audio/wav"}[oe]||"application/octet-stream"},W=(Y.data.items||Y.data.files||[]).map(ae=>({uri:ae.uri||ae.url||`${m.env.API_BASE_URL}/cloud-files-service/v1/files/download?bucket=${A}&key=${encodeURIComponent(ae.key)}`,name:ae.name,key:ae.key,mimeType:ae.mimeType||ie(ae.key),size:ae.size||0,lastModified:ae.lastModified,access:ae.access})),ee=Y.data.total!==void 0?Y.data.total:W.length,te=Y.data.size!==void 0?Y.data.size:W.reduce((ae,le)=>ae+(le.size||0),0),X=Y.data.nextStartAfter!==void 0?Y.data.nextStartAfter:null,re=Y.data.hasMore!==void 0?Y.data.hasMore:!1;return{value:K.Success,error:null,result:{items:W,total:ee,size:te,nextStartAfter:X,hasMore:re}}}catch(m){return{value:K.UnhandledError,error:m,result:null}}}})}}class q1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_DELETE_FILES,version:"1.0.0",description:"Cloud File System: Delete Files",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic);if(!n)return;const s=n.get(Ye.DeleteFiles);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e;try{const f=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!f||!f.env)throw new Error("Editor context or environment missing");const y=Be(t,t.project,"deleteFiles"),T="["+Ve(t,t.project,"Delete files")+": `"+y+"`] ",g=n.find(U=>{var Z,q;return((q=(Z=U.valueOwner)==null?void 0:Z.declaration)==null?void 0:q.id)===G.operation[Ye.DeleteFiles].inputs.bucket.id}),b=(s=g==null?void 0:g.value)==null?void 0:s.valueAsType;if(!b||!b.id||!b.name||b.type!==r.DefinitionEntity)throw new Error(`${T}Invalid input "${Ve(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"Storage")}" (\`${Be(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const R=ul(b==null?void 0:b.id,((u=f.branchHead)==null?void 0:u.identifier)||"main");if(!((f==null?void 0:f.liveResources)||[]).find(U=>U.resourceId===R))throw new Error(`${T}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const A=n.find(U=>{var Z,q;return((q=(Z=U.valueOwner)==null?void 0:Z.declaration)==null?void 0:q.id)===G.operation[Ye.DeleteFiles].inputs.keys.id}),O=(e=A==null?void 0:A.value)==null?void 0:e.value,P=Array.isArray(O)?O:typeof O=="string"&&O!==""?[O]:[];if(!P||P.length===0)throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Keys")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"keys")}\`) input is missing.`);if(!Array.isArray(P)||P.some(U=>typeof U!="string"||U===""))throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Keys")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"keys")}\`) input value is invalid, if present, it must be a list of non-empty strings.`);const $=(await Ht.delete(`${f.env.API_BASE_URL}/cloud-files-service/v1/files`,{headers:{Authorization:`Bearer ${await f.getAccessToken()}`},data:{bucket:R,keys:P}})).data;return{value:K.Success,error:null,result:null}}catch(f){return{value:K.UnhandledError,error:f,result:null}}}})}}class Z1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_COPY_FILE,version:"1.0.0",description:"Cloud File System: Copy File",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic);if(!n)return;const s=n.get(Ye.CopyFile);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=Be(t,t.project,"copyFile"),R="["+Ve(t,t.project,"Copy file")+": `"+g+"`] ",I=n.find(te=>{var X,re;return((re=(X=te.valueOwner)==null?void 0:X.declaration)==null?void 0:re.id)===G.operation[Ye.CopyFile].inputs.bucket.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${R}Invalid input "${Ve(I==null?void 0:I.valueOwner,T==null?void 0:T.logic,"Storage")}" (\`${Be(I==null?void 0:I.valueOwner,T==null?void 0:T.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const O=ul(A==null?void 0:A.id,((u=T.branchHead)==null?void 0:u.identifier)||"main");if(!((T==null?void 0:T.liveResources)||[]).find(te=>te.resourceId===O))throw new Error(`${R}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const x=n.find(te=>{var X,re;return((re=(X=te.valueOwner)==null?void 0:X.declaration)==null?void 0:re.id)===G.operation[Ye.CopyFile].inputs.sourceKey.id}),$=(e=x==null?void 0:x.value)==null?void 0:e.value;if(!$||$==="")throw new Error(`${R}The "${Ve(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"Source key")}" (\`${Be(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"sourceKey")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${R}The "${Ve(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"Source key")}" (\`${Be(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"sourceKey")}\`) input value is invalid, if present, it must be a non-empty string.`);const U=n.find(te=>{var X,re;return((re=(X=te.valueOwner)==null?void 0:X.declaration)==null?void 0:re.id)===G.operation[Ye.CopyFile].inputs.destinationKey.id}),Z=(f=U==null?void 0:U.value)==null?void 0:f.value;if(!Z||Z==="")throw new Error(`${R}The "${Ve(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"Destination key")}" (\`${Be(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"destinationKey")}\`) input is missing.`);if(typeof Z!="string")throw new Error(`${R}The "${Ve(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"Destination key")}" (\`${Be(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"destinationKey")}\`) input value is invalid, if present, it must be a non-empty string.`);const q=n.find(te=>{var X,re;return((re=(X=te.valueOwner)==null?void 0:X.declaration)==null?void 0:re.id)===G.operation[Ye.CopyFile].inputs.destinationBucket.id}),H=(y=q==null?void 0:q.value)==null?void 0:y.valueAsType;if(H&&(!H.id||!H.name||H.type!==r.DefinitionEntity))throw new Error(`${R}Invalid input "${Ve(q==null?void 0:q.valueOwner,T==null?void 0:T.logic,"Destination Storage")}" (\`${Be(q==null?void 0:q.valueOwner,T==null?void 0:T.logic,"destinationBucket")}\`), expected a valid "Cloud file system" node.`);const Y=H!=null&&H.id?ul(H.id,((m=T.branchHead)==null?void 0:m.identifier)||"main"):O;if(!((T==null?void 0:T.liveResources)||[]).find(te=>te.resourceId===Y))throw new Error(`${R}The destination "Cloud file system" is not live. Publish the project first, then try again to run the operation node.`);const z={headers:{Authorization:`Bearer ${await T.getAccessToken()}`}},ee=(await Ht.post(`${T.env.API_BASE_URL}/cloud-files-service/v1/files/copy`,{bucket:O,destinationBucket:Y,sourceKey:$,destinationKey:Z},z)).data;return{value:K.Success,error:null,result:null}}catch(T){return{value:K.UnhandledError,error:T,result:null}}}})}}class H1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_MOVE_FILE,version:"1.0.0",description:"Cloud File System: Move File",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic);if(!n)return;const s=n.get(Ye.MoveFile);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=Be(t,t.project,"moveFile"),R="["+Ve(t,t.project,"Move file")+": `"+g+"`] ",I=n.find(te=>{var X,re;return((re=(X=te.valueOwner)==null?void 0:X.declaration)==null?void 0:re.id)===G.operation[Ye.MoveFile].inputs.bucket.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${R}Invalid input "${Ve(I==null?void 0:I.valueOwner,T==null?void 0:T.logic,"Storage")}" (\`${Be(I==null?void 0:I.valueOwner,T==null?void 0:T.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const O=ul(A==null?void 0:A.id,((u=T.branchHead)==null?void 0:u.identifier)||"main");if(!((T==null?void 0:T.liveResources)||[]).find(te=>te.resourceId===O))throw new Error(`${R}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const x=n.find(te=>{var X,re;return((re=(X=te.valueOwner)==null?void 0:X.declaration)==null?void 0:re.id)===G.operation[Ye.MoveFile].inputs.sourceKey.id}),$=(e=x==null?void 0:x.value)==null?void 0:e.value;if(!$||$==="")throw new Error(`${R}The "${Ve(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"Source key")}" (\`${Be(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"sourceKey")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${R}The "${Ve(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"Source key")}" (\`${Be(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"sourceKey")}\`) input value is invalid, if present, it must be a non-empty string.`);const U=n.find(te=>{var X,re;return((re=(X=te.valueOwner)==null?void 0:X.declaration)==null?void 0:re.id)===G.operation[Ye.MoveFile].inputs.destinationKey.id}),Z=(f=U==null?void 0:U.value)==null?void 0:f.value;if(!Z||Z==="")throw new Error(`${R}The "${Ve(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"Destination key")}" (\`${Be(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"destinationKey")}\`) input is missing.`);if(typeof Z!="string")throw new Error(`${R}The "${Ve(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"Destination key")}" (\`${Be(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"destinationKey")}\`) input value is invalid, if present, it must be a non-empty string.`);const q=n.find(te=>{var X,re;return((re=(X=te.valueOwner)==null?void 0:X.declaration)==null?void 0:re.id)===G.operation[Ye.MoveFile].inputs.destinationBucket.id}),H=(y=q==null?void 0:q.value)==null?void 0:y.valueAsType;if(H&&(!H.id||!H.name||H.type!==r.DefinitionEntity))throw new Error(`${R}Invalid input "${Ve(q==null?void 0:q.valueOwner,T==null?void 0:T.logic,"Destination storage")}" (\`${Be(q==null?void 0:q.valueOwner,T==null?void 0:T.logic,"destinationBucket")}\`), expected a valid "Cloud file system" node.`);const Y=H!=null&&H.id?ul(H.id,((m=T.branchHead)==null?void 0:m.identifier)||"main"):O;if(!((T==null?void 0:T.liveResources)||[]).find(te=>te.resourceId===Y))throw new Error(`${R}The destination "Cloud file system" is not live. Publish the project first, then try again to run the operation node.`);const z={headers:{Authorization:`Bearer ${await T.getAccessToken()}`}},ee=(await Ht.post(`${T.env.API_BASE_URL}/cloud-files-service/v1/files/move`,{bucket:O,destinationBucket:Y,sourceKey:$,destinationKey:Z},z)).data;return{value:K.Success,error:null,result:null}}catch(T){return{value:K.UnhandledError,error:T,result:null}}}})}}class W1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_RENAME_FILE,version:"1.0.0",description:"Cloud File System: Rename File",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic);if(!n)return;const s=n.get(Ye.RenameFile);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f;try{const y=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!y||!y.env)throw new Error("Editor context or environment missing");const m=Be(t,t.project,"renameFile"),g="["+Ve(t,t.project,"Rename file")+": `"+m+"`] ",b=n.find(ie=>{var z,W;return((W=(z=ie.valueOwner)==null?void 0:z.declaration)==null?void 0:W.id)===G.operation[Ye.RenameFile].inputs.bucket.id}),R=(s=b==null?void 0:b.value)==null?void 0:s.valueAsType;if(!R||!R.id||!R.name||R.type!==r.DefinitionEntity)throw new Error(`${g}Invalid input "${Ve(b==null?void 0:b.valueOwner,y==null?void 0:y.logic,"Storage")}" (\`${Be(b==null?void 0:b.valueOwner,y==null?void 0:y.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const I=ul(R==null?void 0:R.id,((u=y.branchHead)==null?void 0:u.identifier)||"main");if(!((y==null?void 0:y.liveResources)||[]).find(ie=>ie.resourceId===I))throw new Error(`${g}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const O=n.find(ie=>{var z,W;return((W=(z=ie.valueOwner)==null?void 0:z.declaration)==null?void 0:W.id)===G.operation[Ye.RenameFile].inputs.key.id}),P=(e=O==null?void 0:O.value)==null?void 0:e.value;if(!P||P==="")throw new Error(`${g}The "${Ve(O==null?void 0:O.valueOwner,y==null?void 0:y.logic,"Key")}" (\`${Be(O==null?void 0:O.valueOwner,y==null?void 0:y.logic,"key")}\`) input is missing.`);if(typeof P!="string")throw new Error(`${g}The "${Ve(O==null?void 0:O.valueOwner,y==null?void 0:y.logic,"Key")}" (\`${Be(O==null?void 0:O.valueOwner,y==null?void 0:y.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const x=n.find(ie=>{var z,W;return((W=(z=ie.valueOwner)==null?void 0:z.declaration)==null?void 0:W.id)===G.operation[Ye.RenameFile].inputs.newName.id}),$=(f=x==null?void 0:x.value)==null?void 0:f.value;if(!$||$==="")throw new Error(`${g}The "${Ve(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"New name")}" (\`${Be(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"newName")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${g}The "${Ve(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"New name")}" (\`${Be(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"newName")}\`) input value is invalid, if present, it must be a non-empty string.`);const U=P.lastIndexOf("/"),q=`${U!==-1?P.substring(0,U+1):""}${$}`,H={headers:{Authorization:`Bearer ${await y.getAccessToken()}`}},Y=await Ht.post(`${y.env.API_BASE_URL}/cloud-files-service/v1/files/rename`,{bucket:I,key:P,newName:$},H);return{value:K.Success,error:null,result:Y.data||{key:P,newName:$,destinationKey:q}}}catch(y){return{value:K.UnhandledError,error:y,result:null}}}})}}class z1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_GET_FILE_METADATA,version:"1.0.0",description:"Cloud File System: Get File Metadata",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic);if(!n)return;const s=n.get(Ye.GetFileMetadata);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e;try{const f=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!f||!f.env)throw new Error("Editor context or environment missing");const y=Be(t,t.project,"getFileMetadata"),T="["+Ve(t,t.project,"Get file metadata")+": `"+y+"`] ",g=n.find(x=>{var $,U;return((U=($=x.valueOwner)==null?void 0:$.declaration)==null?void 0:U.id)===G.operation[Ye.GetFileMetadata].inputs.bucket.id}),b=(s=g==null?void 0:g.value)==null?void 0:s.valueAsType;if(!b||!b.id||!b.name||b.type!==r.DefinitionEntity)throw new Error(`${T}Invalid input "${Ve(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"Storage")}" (\`${Be(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const R=ul(b==null?void 0:b.id,((u=f.branchHead)==null?void 0:u.identifier)||"main");if(!((f==null?void 0:f.liveResources)||[]).find(x=>x.resourceId===R))throw new Error(`${T}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const A=n.find(x=>{var $,U;return((U=($=x.valueOwner)==null?void 0:$.declaration)==null?void 0:U.id)===G.operation[Ye.GetFileMetadata].inputs.key.id}),O=(e=A==null?void 0:A.value)==null?void 0:e.value;if(!O||O==="")throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"key")}\`) input is missing.`);if(typeof O!="string")throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const P=await Ht.get(`${f.env.API_BASE_URL}/cloud-files-service/v1/files/metadata?bucket=${R}&key=${encodeURIComponent(O)}`,{headers:{Authorization:`Bearer ${await f.getAccessToken()}`}});return{value:K.Success,error:null,result:P.data}}catch(f){return{value:K.UnhandledError,error:f,result:null}}}})}}class Y1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_CHECK_FILE_EXISTS,version:"1.0.0",description:"Cloud File System: Check File Exists",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic);if(!n)return;const s=n.get(Ye.CheckFileExists);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e;try{const f=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!f||!f.env)throw new Error("Editor context or environment missing");const y=Be(t,t.project,"checkFileExists"),T="["+Ve(t,t.project,"Check File Exists")+": `"+y+"`] ",g=n.find(x=>{var $,U;return((U=($=x.valueOwner)==null?void 0:$.declaration)==null?void 0:U.id)===G.operation[Ye.CheckFileExists].inputs.bucket.id}),b=(s=g==null?void 0:g.value)==null?void 0:s.valueAsType;if(!b||!b.id||!b.name||b.type!==r.DefinitionEntity)throw new Error(`${T}Invalid input "${Ve(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"Storage")}" (\`${Be(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const R=ul(b==null?void 0:b.id,((u=f.branchHead)==null?void 0:u.identifier)||"main");if(!((f==null?void 0:f.liveResources)||[]).find(x=>x.resourceId===R))throw new Error(`${T}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const A=n.find(x=>{var $,U;return((U=($=x.valueOwner)==null?void 0:$.declaration)==null?void 0:U.id)===G.operation[Ye.CheckFileExists].inputs.key.id}),O=(e=A==null?void 0:A.value)==null?void 0:e.value;if(!O||O==="")throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"key")}\`) input is missing.`);if(typeof O!="string")throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const P=await Ht.get(`${f.env.API_BASE_URL}/cloud-files-service/v1/files/exists?bucket=${R}&key=${encodeURIComponent(O)}`,{headers:{Authorization:`Bearer ${await f.getAccessToken()}`}});return{value:K.Success,error:null,result:P.data.exists}}catch(f){return{value:K.UnhandledError,error:f,result:!1}}}})}}class J1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_GET_PRESIGNED_URL,version:"1.0.0",description:"Cloud File System: Get Pre-signed URL",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic);if(!n)return;const s=n.get(Ye.GetPresignedUrl);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"getPresignedUrl"),b="["+Ve(t,t.project,"Get pre-signed URL")+": `"+T+"`] ",R=n.find(W=>{var ee,te;return((te=(ee=W.valueOwner)==null?void 0:ee.declaration)==null?void 0:te.id)===G.operation[Ye.GetPresignedUrl].inputs.bucket.id}),I=(s=R==null?void 0:R.value)==null?void 0:s.valueAsType;if(!I||!I.id||!I.name||I.type!==r.DefinitionEntity)throw new Error(`${b}Invalid input "${Ve(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"Storage")}" (\`${Be(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const A=ul(I==null?void 0:I.id,((u=m.branchHead)==null?void 0:u.identifier)||"main");if(!((m==null?void 0:m.liveResources)||[]).find(W=>W.resourceId===A))throw new Error(`${b}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const P=n.find(W=>{var ee,te;return((te=(ee=W.valueOwner)==null?void 0:ee.declaration)==null?void 0:te.id)===G.operation[Ye.GetPresignedUrl].inputs.key.id}),x=(e=P==null?void 0:P.value)==null?void 0:e.value;if(!x||x==="")throw new Error(`${b}The "${Ve(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"key")}\`) input is missing.`);if(typeof x!="string")throw new Error(`${b}The "${Ve(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const $=n.find(W=>{var ee,te;return((te=(ee=W.valueOwner)==null?void 0:ee.declaration)==null?void 0:te.id)===G.operation[Ye.GetPresignedUrl].inputs.action.id}),U=(f=$==null?void 0:$.value)==null?void 0:f.value,Z=(U||"read").toLowerCase(),q=["read","write","delete","metadata","upload","putobject","head","headobject","getobject","get"];if(!U||U==="")throw new Error(`${b}The "${Ve($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"Action")}" (\`${Be($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"action")}\`) input is missing.`);if(!q.includes(Z))throw new Error(`${b}Invalid "${Ve($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"Action")}" (\`${Be($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"action")}\`) input value, must be one of "read", "write", "delete" or "metadata".`);const H=n.find(W=>{var ee,te;return((te=(ee=W.valueOwner)==null?void 0:ee.declaration)==null?void 0:te.id)===G.operation[Ye.GetPresignedUrl].inputs.expiresInSeconds.id}),Y=(y=H==null?void 0:H.value)==null?void 0:y.value,ie=Y!=null?Number(Y):3600;if(isNaN(ie)||ie<=0)throw new Error(`${b}Invalid "${Ve(H==null?void 0:H.valueOwner,m==null?void 0:m.logic,"Expires in seconds")}" (\`${Be(H==null?void 0:H.valueOwner,m==null?void 0:m.logic,"expiresInSeconds")}\`) input value, expected a positive number.`);const z=await Ht.get(`${m.env.API_BASE_URL}/cloud-files-service/v1/files/presigned-url?bucket=${A}&key=${encodeURIComponent(x)}&action=${Z}&expiresInSeconds=${ie}`,{headers:{Authorization:`Bearer ${await m.getAccessToken()}`}});return{value:K.Success,error:null,result:z.data}}catch(m){return{value:K.UnhandledError,error:m,result:null}}}})}}class Q1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_SET_FILE_ACCESS,version:"1.0.0",description:"Cloud File System: Set File Access",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic);if(!n)return;const s=n.get(Ye.SetFileAccess);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f;try{const y=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!y||!y.env)throw new Error("Editor context or environment missing");const m=Be(t,t.project,"setFileAccess"),g="["+Ve(t,t.project,"Set file access")+": `"+m+"`] ",b=n.find(U=>{var Z,q;return((q=(Z=U.valueOwner)==null?void 0:Z.declaration)==null?void 0:q.id)===G.operation[Ye.SetFileAccess].inputs.bucket.id}),R=(s=b==null?void 0:b.value)==null?void 0:s.valueAsType;if(!R||!R.id||!R.name||R.type!==r.DefinitionEntity)throw new Error(`${g}Invalid input "${Ve(b==null?void 0:b.valueOwner,y==null?void 0:y.logic,"Storage")}" (\`${Be(b==null?void 0:b.valueOwner,y==null?void 0:y.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const I=ul(R==null?void 0:R.id,((u=y.branchHead)==null?void 0:u.identifier)||"main");if(!((y==null?void 0:y.liveResources)||[]).find(U=>U.resourceId===I))throw new Error(`${g}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const O=n.find(U=>{var Z,q;return((q=(Z=U.valueOwner)==null?void 0:Z.declaration)==null?void 0:q.id)===G.operation[Ye.SetFileAccess].inputs.key.id}),P=(e=O==null?void 0:O.value)==null?void 0:e.value;if(!P||P==="")throw new Error(`${g}The "${Ve(O==null?void 0:O.valueOwner,y==null?void 0:y.logic,"Key")}" (\`${Be(O==null?void 0:O.valueOwner,y==null?void 0:y.logic,"key")}\`) input is missing.`);if(typeof P!="string")throw new Error(`${g}The "${Ve(O==null?void 0:O.valueOwner,y==null?void 0:y.logic,"Key")}" (\`${Be(O==null?void 0:O.valueOwner,y==null?void 0:y.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const x=n.find(U=>{var Z,q;return((q=(Z=U.valueOwner)==null?void 0:Z.declaration)==null?void 0:q.id)===G.operation[Ye.SetFileAccess].inputs.access.id}),$=((f=x==null?void 0:x.value)==null?void 0:f.value)??"private";if(!$||$==="")throw new Error(`${g}The "${Ve(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"Access")}" (\`${Be(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"access")}\`) input is missing.`);if(typeof $!="string"||!["public","private"].includes($))throw new Error(`${g}The "${Ve(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"Access")}" (\`${Be(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"access")}\`) input value is invalid, if present, it must be exactly the "public" or "private" text values.`);return await Ht.post(`${y.env.API_BASE_URL}/cloud-files-service/v1/files/access`,{bucket:I,key:P,access:$},{headers:{Authorization:`Bearer ${await y.getAccessToken()}`}}),{value:K.Success,error:null,result:null}}catch(y){return{value:K.UnhandledError,error:y,result:null}}}})}}class X1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_CREATE_FOLDER,version:"1.0.0",description:"Cloud File System: Create Folder",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic);if(!n)return;const s=n.get(Ye.CreateFolder);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e;try{const f=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!f||!f.env)throw new Error("Editor context or environment missing");const y=Be(t,t.project,"createFolder"),T="["+Ve(t,t.project,"Create folder")+": `"+y+"`] ",g=n.find($=>{var U,Z;return((Z=(U=$.valueOwner)==null?void 0:U.declaration)==null?void 0:Z.id)===G.operation[Ye.CreateFolder].inputs.bucket.id}),b=(s=g==null?void 0:g.value)==null?void 0:s.valueAsType;if(!b||!b.id||!b.name||b.type!==r.DefinitionEntity)throw new Error(`${T}Invalid input "${Ve(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"Storage")}" (\`${Be(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const R=ul(b==null?void 0:b.id,((u=f.branchHead)==null?void 0:u.identifier)||"main");if(!((f==null?void 0:f.liveResources)||[]).find($=>$.resourceId===R))throw new Error(`${T}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const A=n.find($=>{var U,Z;return((Z=(U=$.valueOwner)==null?void 0:U.declaration)==null?void 0:Z.id)===G.operation[Ye.CreateFolder].inputs.folderPath.id}),O=(e=A==null?void 0:A.value)==null?void 0:e.value;if(!O||O==="")throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Folder path")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"folderPath")}\`) input is missing.`);if(typeof O!="string")throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Folder path")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"folderPath")}\`) input value is invalid, if present, it must be a non-empty string.`);const x=(await Ht.post(`${f.env.API_BASE_URL}/cloud-files-service/v1/files/folders`,{bucket:R,folderPath:O},{headers:{Authorization:`Bearer ${await f.getAccessToken()}`}})).data;return{value:K.Success,error:null,result:null}}catch(f){return{value:K.UnhandledError,error:f,result:null}}}})}}class eDt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_DELETE_FOLDERS,version:"1.0.0",description:"Cloud File System: Delete Folders",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic);if(!n)return;const s=n.get(Ye.DeleteFolders);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e;try{const f=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!f||!f.env)throw new Error("Editor context or environment missing");const y=Be(t,t.project,"deleteFolders"),T="["+Ve(t,t.project,"Delete folders")+": `"+y+"`] ",g=n.find(U=>{var Z,q;return((q=(Z=U.valueOwner)==null?void 0:Z.declaration)==null?void 0:q.id)===G.operation[Ye.DeleteFolders].inputs.bucket.id}),b=(s=g==null?void 0:g.value)==null?void 0:s.valueAsType;if(!b||!b.id||!b.name||b.type!==r.DefinitionEntity)throw new Error(`${T}Invalid input "${Ve(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"Storage")}" (\`${Be(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const R=ul(b==null?void 0:b.id,((u=f.branchHead)==null?void 0:u.identifier)||"main");if(!((f==null?void 0:f.liveResources)||[]).find(U=>U.resourceId===R))throw new Error(`${T}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const A=n.find(U=>{var Z,q;return((q=(Z=U.valueOwner)==null?void 0:Z.declaration)==null?void 0:q.id)===G.operation[Ye.DeleteFolders].inputs.folderPaths.id}),O=(e=A==null?void 0:A.value)==null?void 0:e.value,P=Array.isArray(O)?O:typeof O=="string"&&O!==""?[O]:[];if(!P||P.length===0)throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Folder paths")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"folderPaths")}\`) input is missing.`);if(!Array.isArray(P)||P.some(U=>typeof U!="string"||U===""))throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Folder paths")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"folderPaths")}\`) input value is invalid, if present, it must be a list of non-empty strings.`);const $=(await Ht.delete(`${f.env.API_BASE_URL}/cloud-files-service/v1/files/folders`,{headers:{Authorization:`Bearer ${await f.getAccessToken()}`},data:{bucket:R,folderPaths:P}})).data;return{value:K.Success,error:null,result:null}}catch(f){return{value:K.UnhandledError,error:f,result:null}}}})}}class tDt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_CREATE_MULTIPART_UPLOAD,version:"1.0.0",description:"Cloud File System: Create Multipart Upload",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic);if(!n)return;const s=n.get(Ye.CreateMultipartUpload);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"createMultipartUpload"),b="["+Ve(t,t.project,"Create multipart upload")+": `"+T+"`] ",R=n.find(Z=>{var q,H;return((H=(q=Z.valueOwner)==null?void 0:q.declaration)==null?void 0:H.id)===G.operation[Ye.CreateMultipartUpload].inputs.bucket.id}),I=(s=R==null?void 0:R.value)==null?void 0:s.valueAsType;if(!I||!I.id||!I.name||I.type!==r.DefinitionEntity)throw new Error(`${b}Invalid input "${Ve(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"Storage")}" (\`${Be(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const A=ul(I==null?void 0:I.id,((u=m.branchHead)==null?void 0:u.identifier)||"main"),O=n.find(Z=>{var q,H;return((H=(q=Z.valueOwner)==null?void 0:q.declaration)==null?void 0:H.id)===G.operation[Ye.CreateMultipartUpload].inputs.key.id}),P=(e=O==null?void 0:O.value)==null?void 0:e.value;if(!P||P==="")throw new Error(`${b}The "${Ve(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"key")}\`) input is missing.`);if(typeof P!="string")throw new Error(`${b}The "${Ve(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const x=n.find(Z=>{var q,H;return((H=(q=Z.valueOwner)==null?void 0:q.declaration)==null?void 0:H.id)===G.operation[Ye.CreateMultipartUpload].inputs.contentType.id}),$=((f=x==null?void 0:x.value)==null?void 0:f.value)||"application/octet-stream";if(!$||$==="")throw new Error(`${b}The "${Ve(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"Content Type")}" (\`${Be(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"contentType")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${b}The "${Ve(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"Content Type")}" (\`${Be(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"contentType")}\`) input value is invalid, if present, it must be a non-empty string.`);const U=await Ht.post(`${m.env.API_BASE_URL}/cloud-files-service/v1/files/multipart?bucket=${A}&key=${encodeURIComponent(P)}&contentType=${encodeURIComponent($)}`,{},{headers:{Authorization:`Bearer ${await m.getAccessToken()}`}});return{value:K.Success,error:null,result:{uploadId:typeof U.data=="object"&&((y=U.data)!=null&&y.uploadId)?U.data.uploadId:U.data}}}catch(m){return{value:K.UnhandledError,error:m,result:null}}}})}}class iDt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_GET_UPLOAD_PART_PRESIGNED_URL,version:"1.0.0",description:"Cloud File System: Get Upload Part Pre-signed URL",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic);if(!n)return;const s=n.get(Ye.GetUploadPartPresignedUrl);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"getUploadPartPresignedUrl"),b="["+Ve(t,t.project,"Get upload part pre-signed URL")+": `"+T+"`] ",R=n.find(H=>{var Y,ie;return((ie=(Y=H.valueOwner)==null?void 0:Y.declaration)==null?void 0:ie.id)===G.operation[Ye.GetUploadPartPresignedUrl].inputs.bucket.id}),I=(s=R==null?void 0:R.value)==null?void 0:s.valueAsType;if(!I||!I.id||!I.name||I.type!==r.DefinitionEntity)throw new Error(`${b}${b}Invalid input "${Ve(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"Storage")}" (\`${Be(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const A=ul(I==null?void 0:I.id,((u=m.branchHead)==null?void 0:u.identifier)||"main"),O=n.find(H=>{var Y,ie;return((ie=(Y=H.valueOwner)==null?void 0:Y.declaration)==null?void 0:ie.id)===G.operation[Ye.GetUploadPartPresignedUrl].inputs.key.id}),P=(e=O==null?void 0:O.value)==null?void 0:e.value;if(!P||P==="")throw new Error(`${b}The "${Ve(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"key")}\`) input is missing.`);if(typeof P!="string")throw new Error(`${b}The "${Ve(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const x=n.find(H=>{var Y,ie;return((ie=(Y=H.valueOwner)==null?void 0:Y.declaration)==null?void 0:ie.id)===G.operation[Ye.GetUploadPartPresignedUrl].inputs.uploadId.id}),$=(f=x==null?void 0:x.value)==null?void 0:f.value;if(!$||$==="")throw new Error(`${b}The "${Ve(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"Upload ID")}" (\`${Be(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"uploadId")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${b}The "${Ve(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"Upload ID")}" (\`${Be(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"uploadId")}\`) input value is invalid, if present, it must be a non-empty string.`);const U=n.find(H=>{var Y,ie;return((ie=(Y=H.valueOwner)==null?void 0:Y.declaration)==null?void 0:ie.id)===G.operation[Ye.GetUploadPartPresignedUrl].inputs.partNumber.id}),Z=Number((y=U==null?void 0:U.value)==null?void 0:y.value);if(isNaN(Z)||Z<=0)throw new Error(`${b}The "${Ve(U==null?void 0:U.valueOwner,m==null?void 0:m.logic,"Part number")}" (\`${Be(U==null?void 0:U.valueOwner,m==null?void 0:m.logic,"partNumber")}\`) input is missing or invalid.`);const q=await Ht.get(`${m.env.API_BASE_URL}/cloud-files-service/v1/files/multipart/${$}?bucket=${A}&key=${encodeURIComponent(P)}&partNumber=${Z}`,{headers:{Authorization:`Bearer ${await m.getAccessToken()}`}});return{value:K.Success,error:null,result:q.data}}catch(m){return{value:K.UnhandledError,error:m,result:null}}}})}}class nDt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_COMPLETE_MULTIPART_UPLOAD,version:"1.0.0",description:"Cloud File System: Complete Multipart Upload",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic);if(!n)return;const s=n.get(Ye.CompleteMultipartUpload);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"completeMultipartUpload"),b="["+Ve(t,t.project,"Complete multipart upload")+": `"+T+"`] ",R=n.find(Y=>{var ie,z;return((z=(ie=Y.valueOwner)==null?void 0:ie.declaration)==null?void 0:z.id)===G.operation[Ye.CompleteMultipartUpload].inputs.bucket.id}),I=(s=R==null?void 0:R.value)==null?void 0:s.valueAsType;if(!I||!I.id||!I.name||I.type!==r.DefinitionEntity)throw new Error(`${b}Invalid input "${Ve(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"Storage")}" (\`${Be(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const A=ul(I==null?void 0:I.id,((u=m.branchHead)==null?void 0:u.identifier)||"main"),O=n.find(Y=>{var ie,z;return((z=(ie=Y.valueOwner)==null?void 0:ie.declaration)==null?void 0:z.id)===G.operation[Ye.CompleteMultipartUpload].inputs.key.id}),P=(e=O==null?void 0:O.value)==null?void 0:e.value;if(!P||P==="")throw new Error(`${b}The "${Ve(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"key")}\`) input is missing.`);if(typeof P!="string")throw new Error(`${b}The "${Ve(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const x=n.find(Y=>{var ie,z;return((z=(ie=Y.valueOwner)==null?void 0:ie.declaration)==null?void 0:z.id)===G.operation[Ye.CompleteMultipartUpload].inputs.uploadId.id}),$=(f=x==null?void 0:x.value)==null?void 0:f.value;if(!$||$==="")throw new Error(`${b}The "${Ve(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"Upload ID")}" (\`${Be(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"uploadId")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${b}The "${Ve(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"Upload ID")}" (\`${Be(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"uploadId")}\`) input value is invalid, if present, it must be a non-empty string.`);const U=n.find(Y=>{var ie,z;return((z=(ie=Y.valueOwner)==null?void 0:ie.declaration)==null?void 0:z.id)===G.operation[Ye.CompleteMultipartUpload].inputs.parts.id}),Z=(y=U==null?void 0:U.value)==null?void 0:y.value;if(!Array.isArray(Z)||Z.length===0)throw new Error(`${b}The "${Ve(U==null?void 0:U.valueOwner,m==null?void 0:m.logic,"Parts")}" (\`${Be(U==null?void 0:U.valueOwner,m==null?void 0:m.logic,"parts")}\`) input is missing or empty.`);if(Z.some(Y=>{let ie=!1,z=!1;return(Y.partNumber&&Number(Y.partNumber)>0||Y.PartNumber&&Number(Y.PartNumber)>0)&&(ie=!0),(Y.etag&&typeof Y.etag=="string"||Y.ETag&&typeof Y.ETag=="string")&&(z=!0),!ie||!z}))throw new Error(`${b}The "${Ve(U==null?void 0:U.valueOwner,m==null?void 0:m.logic,"Parts")}" (\`${Be(U==null?void 0:U.valueOwner,m==null?void 0:m.logic,"parts")}\`) input value is invalid, if present, it must be an array of objects with "partNumber" and "etag" properties.`);const H=(await Ht.post(`${m.env.API_BASE_URL}/cloud-files-service/v1/files/multipart/${$}/complete?bucket=${A}&key=${encodeURIComponent(P)}`,{parts:Z},{headers:{Authorization:`Bearer ${await m.getAccessToken()}`}})).data||{};return{value:K.Success,error:null,result:{location:H.location||H.Location||P,key:H.key||H.Key||P,etag:H.etag||H.ETag||null}}}catch(m){return{value:K.UnhandledError,error:m,result:null}}}})}}class rDt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_ABORT_MULTIPART_UPLOAD,version:"1.0.0",description:"Cloud File System: Abort Multipart Upload",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic);if(!n)return;const s=n.get(Ye.AbortMultipartUpload);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f;try{const y=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!y||!y.env)throw new Error("Editor context or environment missing");const m=Be(t,t.project,"abortMultipartUpload"),g="["+Ve(t,t.project,"Abort multipart upload")+": `"+m+"`] ",b=n.find(Z=>{var q,H;return((H=(q=Z.valueOwner)==null?void 0:q.declaration)==null?void 0:H.id)===G.operation[Ye.AbortMultipartUpload].inputs.bucket.id}),R=(s=b==null?void 0:b.value)==null?void 0:s.valueAsType;if(!R||!R.id||!R.name||R.type!==r.DefinitionEntity)throw new Error(`${g}Invalid input "${Ve(b==null?void 0:b.valueOwner,y==null?void 0:y.logic,"Storage")}" (\`${Be(b==null?void 0:b.valueOwner,y==null?void 0:y.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const I=ul(R==null?void 0:R.id,((u=y.branchHead)==null?void 0:u.identifier)||"main"),A=n.find(Z=>{var q,H;return((H=(q=Z.valueOwner)==null?void 0:q.declaration)==null?void 0:H.id)===G.operation[Ye.AbortMultipartUpload].inputs.key.id}),O=(e=A==null?void 0:A.value)==null?void 0:e.value;if(!O||O==="")throw new Error(`${g}The "${Ve(A==null?void 0:A.valueOwner,y==null?void 0:y.logic,"Key")}" (\`${Be(A==null?void 0:A.valueOwner,y==null?void 0:y.logic,"key")}\`) input is missing.`);if(typeof O!="string")throw new Error(`${g}The "${Ve(A==null?void 0:A.valueOwner,y==null?void 0:y.logic,"Key")}" (\`${Be(A==null?void 0:A.valueOwner,y==null?void 0:y.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const P=n.find(Z=>{var q,H;return((H=(q=Z.valueOwner)==null?void 0:q.declaration)==null?void 0:H.id)===G.operation[Ye.AbortMultipartUpload].inputs.uploadId.id}),x=(f=P==null?void 0:P.value)==null?void 0:f.value;if(!x||x==="")throw new Error(`${g}The "${Ve(P==null?void 0:P.valueOwner,y==null?void 0:y.logic,"Upload ID")}" (\`${Be(P==null?void 0:P.valueOwner,y==null?void 0:y.logic,"uploadId")}\`) input is missing.`);if(typeof x!="string")throw new Error(`${g}The "${Ve(P==null?void 0:P.valueOwner,y==null?void 0:y.logic,"Upload ID")}" (\`${Be(P==null?void 0:P.valueOwner,y==null?void 0:y.logic,"uploadId")}\`) input value is invalid, if present, it must be a non-empty string.`);const U=(await Ht.delete(`${y.env.API_BASE_URL}/cloud-files-service/v1/files/multipart/${x}?bucket=${I}&key=${encodeURIComponent(O)}`,{headers:{Authorization:`Bearer ${await y.getAccessToken()}`}})).data;return{value:K.Success,error:null,result:null}}catch(y){return{value:K.UnhandledError,error:y,result:null}}}})}}class MRn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_UPLOAD_FILE_PART,version:"1.0.0",description:"Cloud File System: Upload File Part",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic);if(!n)return;const s=n.get(Ye.UploadFilePart);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b;try{const R=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!R||!R.env)throw new Error("Editor context or environment missing");const I=Be(t,t.project,"uploadFilePart"),O="["+Ve(t,t.project,"Upload file part")+": `"+I+"`] ",P=n.find(oe=>{var ce,be;return((be=(ce=oe.valueOwner)==null?void 0:ce.declaration)==null?void 0:be.id)===G.operation[Ye.UploadFilePart].inputs.bucket.id}),x=(s=P==null?void 0:P.value)==null?void 0:s.valueAsType;if(!x||!x.id||!x.name||x.type!==r.DefinitionEntity)throw new Error(`${O}Invalid input "${Ve(P==null?void 0:P.valueOwner,R==null?void 0:R.logic,"Storage")}" (\`${Be(P==null?void 0:P.valueOwner,R==null?void 0:R.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const $=ul(x==null?void 0:x.id,((u=R.branchHead)==null?void 0:u.identifier)||"main");if(!((R==null?void 0:R.liveResources)||[]).find(oe=>oe.resourceId===$))throw new Error(`${O}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const Z=n.find(oe=>{var ce,be;return((be=(ce=oe.valueOwner)==null?void 0:ce.declaration)==null?void 0:be.id)===G.operation[Ye.UploadFilePart].inputs.key.id}),q=(e=Z==null?void 0:Z.value)==null?void 0:e.value;if(!q||q==="")throw new Error(`${O}The "${Ve(Z==null?void 0:Z.valueOwner,R==null?void 0:R.logic,"Key")}" (\`${Be(Z==null?void 0:Z.valueOwner,R==null?void 0:R.logic,"key")}\`) input is missing.`);if(typeof q!="string")throw new Error(`${O}The "${Ve(Z==null?void 0:Z.valueOwner,R==null?void 0:R.logic,"Key")}" (\`${Be(Z==null?void 0:Z.valueOwner,R==null?void 0:R.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const H=n.find(oe=>{var ce,be;return((be=(ce=oe.valueOwner)==null?void 0:ce.declaration)==null?void 0:be.id)===G.operation[Ye.UploadFilePart].inputs.uploadId.id}),Y=(f=H==null?void 0:H.value)==null?void 0:f.value;if(!Y||Y==="")throw new Error(`${O}The "${Ve(H==null?void 0:H.valueOwner,R==null?void 0:R.logic,"Upload ID")}" (\`${Be(H==null?void 0:H.valueOwner,R==null?void 0:R.logic,"uploadId")}\`) input is missing.`);if(typeof Y!="string")throw new Error(`${O}The "${Ve(H==null?void 0:H.valueOwner,R==null?void 0:R.logic,"Upload ID")}" (\`${Be(H==null?void 0:H.valueOwner,R==null?void 0:R.logic,"uploadId")}\`) input value is invalid, if present, it must be a non-empty string.`);const ie=n.find(oe=>{var ce,be;return((be=(ce=oe.valueOwner)==null?void 0:ce.declaration)==null?void 0:be.id)===G.operation[Ye.UploadFilePart].inputs.partNumber.id}),z=Number((y=ie==null?void 0:ie.value)==null?void 0:y.value);if(((m=ie==null?void 0:ie.value)==null?void 0:m.value)===void 0||((T=ie==null?void 0:ie.value)==null?void 0:T.value)===null||isNaN(z)||z<=0)throw new Error(`${O}The "${Ve(ie==null?void 0:ie.valueOwner,R==null?void 0:R.logic,"Part number")}" (\`${Be(ie==null?void 0:ie.valueOwner,R==null?void 0:R.logic,"partNumber")}\`) input is missing or invalid.`);const W=n.find(oe=>{var ce,be;return((be=(ce=oe.valueOwner)==null?void 0:ce.declaration)==null?void 0:be.id)===G.operation[Ye.UploadFilePart].inputs.bytes.id}),ee=(g=W==null?void 0:W.value)==null?void 0:g.value;if(ee==null)throw new Error(`${O}The "${Ve(W==null?void 0:W.valueOwner,R==null?void 0:R.logic,"Bytes")}" (\`${Be(W==null?void 0:W.valueOwner,R==null?void 0:R.logic,"bytes")}\`) input is missing.`);const X=(b=(await Ht.get(`${R.env.API_BASE_URL}/cloud-files-service/v1/files/multipart/${Y}?bucket=${$}&key=${encodeURIComponent(q)}&partNumber=${z}`,{headers:{Authorization:`Bearer ${await R.getAccessToken()}`}})).data)==null?void 0:b.uploadUrl;if(!X)throw new Error(`${O}Failed to obtain presigned upload URL for part ${z}.`);const re=await Ht.put(X,ee,{headers:{"Content-Type":"application/octet-stream"}}),ae=re.headers.etag||re.headers.ETag||"",le=typeof ae=="string"?ae.replace(/"/g,""):"";return{value:K.Success,error:null,result:{partNumber:z,etag:le}}}catch(R){return{value:K.UnhandledError,error:R,result:null}}}})}}class QL extends cV{constructor(p,t,n=t.projectId){super(p,Q.Editor),this._editor=t,this.id=n}get ready(){return this._editor.ready}get env(){return this._editor.env}get hasLoadedLogic(){return this._editor.hasLoadedLogic}get destroyed(){return this._editor.destroyed}get logicLoadingPromise(){return this._editor.logicLoadingPromise}get logic(){return this._editor.logic}get lastPublishedProjectState(){return this._editor.lastPublishedProjectState}get branchHead(){return this._editor.branchHead}get branchHeadPromise(){return this._editor.branchHeadPromise}get projectId(){return this._editor.projectId}get sessionId(){return this._editor.sessionId}get userAuthorId(){return this._editor.userAuthorId}get peerConnections(){return this._editor.peerConnections}get test(){return this._editor.test}get localTestValues(){return this._editor.localTestValues}get resolvedValues(){return this._editor.resolvedValues}get persistedExecutionResults(){return this._editor.persistedExecutionResults}get publication(){return this._editor.publication}get livePublishedVersions(){return this._editor.livePublishedVersions}get publications(){return this._editor.publications}get liveResources(){return this._editor.liveResources}get execution(){return this._editor.execution}get project(){return this._editor.logic}get lastExecutionResults(){return this._editor.lastExecutionResults}get undoableStackValueIndex(){return this._editor.undoableStackValueIndex}set undoableStackValueIndex(p){this._editor.undoableStackValueIndex=p}get activeWorkspace(){return this._editor.activeWorkspace}get branches(){return this._editor.branches}get roles(){return this._editor.roles}get READ_ONLY(){return this._editor.READ_ONLY}get isViewingNonHead(){return this._editor.isViewingNonHead}get canEdit(){return this._editor.canEdit}get PROJECT_NOTIFICATIONS_CHANNEL(){return this._editor.PROJECT_NOTIFICATIONS_CHANNEL}getAccessToken(){return this._editor.getAccessToken()}getRefreshToken(){return this._editor.getRefreshToken()}removeValueByOwnerId(p){return this._editor.removeValueByOwnerId(p)}removeValue(p){return this._editor.removeValue(p)}undo(){return this._editor.undo()}redo(){return this._editor.redo()}initTest(p,t){return this._editor.initTest(p,t)}removeTest(p){return this._editor.removeTest(p)}async copyEntities(p,t={}){return this._editor.copyEntities(p,t)}resolveInitialChildrenPositions(p,t,n){return this._editor.resolveInitialChildrenPositions(p,t,n)}publish(){return this._editor.publish()}loadGivenPublication(p){return this._editor.loadGivenPublication(p)}validateProjectState(p){return this._editor.validateProjectState(p)}requestActiveDynamicValue(p,t=!1){return this._editor.requestActiveDynamicValue(p,t)}getValueTypePreference(p){return this._editor.getValueTypePreference(p)}setValueTypePreference(p,t){return this._editor.setValueTypePreference(p,t)}implementFeature(p){return this._editor.implementFeature(p)}getProjectRoles(){return this._editor.getProjectRoles()}getLastPublishedVersionLogic(p){return this._editor.getLastPublishedVersionLogic(p)}initialLoads(p){return this._editor.initialLoads(p)}moveBranchHeadToVersion(p,t,n){return this._editor.moveBranchHeadToVersion(p,t,n)}loadInitialBranchHead(){return this._editor.loadInitialBranchHead()}}function FRn(a,p){return p instanceof QL?p:new QL(a,p)}class XL extends cV{constructor(p,t){super(p,Q.PublicationRun),this._publicationRun=t}get id(){return this._publicationRun.id}get projectAutoIncrementPublicationCount(){return this._publicationRun.projectAutoIncrementPublicationCount}get projectPublishedSemanticVersion(){return this._publicationRun.projectPublishedSemanticVersion}get envIdentifier(){return this._publicationRun.envIdentifier}get projectVersion(){return this._publicationRun.projectVersion}get projectBranchId(){return this._publicationRun.projectBranchId}get projectId(){return this._publicationRun.projectId}get triggeredBy(){return this._publicationRun.triggeredBy}get createdAt(){return this._publicationRun.createdAt}get updatedAt(){return this._publicationRun.updatedAt}get status(){return this._publicationRun.status}get steps(){return this._publicationRun.steps}get cleanupSteps(){return this._publicationRun.cleanupSteps}get editor(){return this._publicationRun.editor}get explicitResources(){return this._publicationRun.explicitResources}get implicitGlobalResources(){return this._publicationRun.implicitGlobalResources}get finalGlobalEvent(){return this._publicationRun.finalGlobalEvent}get finalStatus(){return this._publicationRun.finalStatus}}function kRn(a,p){return p instanceof XL?p:new XL(a,p)}const zG={spec:{title:"Sales Overview",basicChart:{chartType:"COLUMN",legendPosition:"BOTTOM_LEGEND",axis:[{position:"BOTTOM_AXIS",title:"Categories"},{position:"LEFT_AXIS",title:"Values"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"LEFT_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}},URn={spec:{title:"Revenue Comparison",basicChart:{chartType:"BAR",legendPosition:"BOTTOM_LEGEND",axis:[{position:"LEFT_AXIS",title:"Products"},{position:"BOTTOM_AXIS",title:"Revenue ($)"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"BOTTOM_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}},KRn={spec:{title:"Monthly Performance Trend",basicChart:{chartType:"LINE",legendPosition:"RIGHT_LEGEND",interpolateNulls:!0,axis:[{position:"BOTTOM_AXIS",title:"Month"},{position:"LEFT_AXIS",title:"Active Users"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:12,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:12,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"LEFT_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}},jRn={spec:{title:"Traffic Channels Distribution",basicChart:{chartType:"AREA",legendPosition:"TOP_LEGEND",stackedType:"STACKED",axis:[{position:"BOTTOM_AXIS",title:"Quarter"},{position:"LEFT_AXIS",title:"Visits"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:4,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:4,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"LEFT_AXIS"},{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:4,startColumnIndex:2,endColumnIndex:3}]}},targetAxis:"LEFT_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}},qRn={spec:{title:"Market Share Breakdown",pieChart:{legendPosition:"RIGHT_LEGEND",threeDimensional:!1,pieHole:0,domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:0,endColumnIndex:1}]}},series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:1,endColumnIndex:2}]}}}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:500,heightPixels:350}}},ZRn={spec:{title:"Budget Allocation",pieChart:{legendPosition:"BOTTOM_LEGEND",threeDimensional:!1,pieHole:.4,domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:6,startColumnIndex:0,endColumnIndex:1}]}},series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:6,startColumnIndex:1,endColumnIndex:2}]}}}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:500,heightPixels:350}}},HRn={spec:{title:"Quarterly Revenue KPI",scorecardChart:{keyValueData:{sourceRange:{sources:[{sheetId:0,startRowIndex:1,endRowIndex:2,startColumnIndex:1,endColumnIndex:2}]}},baselineValueData:{sourceRange:{sources:[{sheetId:0,startRowIndex:2,endRowIndex:3,startColumnIndex:1,endColumnIndex:2}]}}}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:400,heightPixels:250}}},WRn={spec:{title:"Regional Sales (3D)",basicChart:{chartType:"BAR",legendPosition:"RIGHT_LEGEND",headerCount:1,threeDimensional:!0,axis:[{position:"LEFT_AXIS",title:"Region"},{position:"BOTTOM_AXIS",title:"Units Sold"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"BOTTOM_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}};class zRn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][J.GoogleSheetsAddChart].inputs.chart.id,version:"1.0.0",description:'Gives options for and generates useful example values for the chart input of the "Add chart" Google Sheets operation',initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{getOptions:async t=>[{key:"column-chart",label:"Column Chart",disabledReasons:[],hidden:!1},{key:"bar-chart",label:"Bar Chart",disabledReasons:[],hidden:!1},{key:"line-chart",label:"Line Chart",disabledReasons:[],hidden:!1},{key:"area-chart",label:"Stacked Area Chart",disabledReasons:[],hidden:!1},{key:"pie-chart",label:"Pie Chart",disabledReasons:[],hidden:!1},{key:"donut-chart",label:"Donut Chart",disabledReasons:[],hidden:!1},{key:"scorecard-chart",label:"Scorecard KPI Chart",disabledReasons:[],hidden:!1},{key:"3d-bar-chart",label:"3D Bar Chart",disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{const s=n==null?void 0:n.valueKey;if(!s)return{value:zG};switch(s){case"column-chart":case"basic-chart":return{value:zG};case"bar-chart":return{value:URn};case"line-chart":return{value:KRn};case"area-chart":return{value:jRn};case"pie-chart":return{value:qRn};case"donut-chart":return{value:ZRn};case"scorecard-chart":return{value:HRn};case"3d-bar-chart":case"3d-column-chart":return{value:WRn}}return{value:zG}}})}}const YG={spec:{title:"Sales Overview",basicChart:{chartType:"COLUMN",legendPosition:"BOTTOM_LEGEND",axis:[{position:"BOTTOM_AXIS",title:"Categories"},{position:"LEFT_AXIS",title:"Values"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"LEFT_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}},YRn={spec:{title:"Revenue Comparison",basicChart:{chartType:"BAR",legendPosition:"BOTTOM_LEGEND",axis:[{position:"LEFT_AXIS",title:"Products"},{position:"BOTTOM_AXIS",title:"Revenue ($)"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"BOTTOM_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}},JRn={spec:{title:"Monthly Performance Trend",basicChart:{chartType:"LINE",legendPosition:"RIGHT_LEGEND",interpolateNulls:!0,axis:[{position:"BOTTOM_AXIS",title:"Month"},{position:"LEFT_AXIS",title:"Active Users"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:12,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:12,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"LEFT_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}},QRn={spec:{title:"Traffic Channels Distribution",basicChart:{chartType:"AREA",legendPosition:"TOP_LEGEND",stackedType:"STACKED",axis:[{position:"BOTTOM_AXIS",title:"Quarter"},{position:"LEFT_AXIS",title:"Visits"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:4,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:4,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"LEFT_AXIS"},{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:4,startColumnIndex:2,endColumnIndex:3}]}},targetAxis:"LEFT_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}},XRn={spec:{title:"Market Share Breakdown",pieChart:{legendPosition:"RIGHT_LEGEND",threeDimensional:!1,pieHole:0,domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:0,endColumnIndex:1}]}},series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:1,endColumnIndex:2}]}}}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:500,heightPixels:350}}},eAn={spec:{title:"Budget Allocation",pieChart:{legendPosition:"BOTTOM_LEGEND",threeDimensional:!1,pieHole:.4,domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:6,startColumnIndex:0,endColumnIndex:1}]}},series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:6,startColumnIndex:1,endColumnIndex:2}]}}}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:500,heightPixels:350}}},tAn={spec:{title:"Quarterly Revenue KPI",scorecardChart:{keyValueData:{sourceRange:{sources:[{sheetId:0,startRowIndex:1,endRowIndex:2,startColumnIndex:1,endColumnIndex:2}]}},baselineValueData:{sourceRange:{sources:[{sheetId:0,startRowIndex:2,endRowIndex:3,startColumnIndex:1,endColumnIndex:2}]}}}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:400,heightPixels:250}}},iAn={spec:{title:"Regional Sales (3D)",basicChart:{chartType:"BAR",legendPosition:"RIGHT_LEGEND",headerCount:1,threeDimensional:!0,axis:[{position:"LEFT_AXIS",title:"Region"},{position:"BOTTOM_AXIS",title:"Units Sold"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"BOTTOM_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}};class nAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][J.GoogleSheetsUpdateChartSpec].inputs.chart.id,version:"1.0.0",description:'Gives options for and generates useful example values for the chart input of the "Update chart spec" Google Sheets operation',initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{getOptions:async t=>[{key:"column-chart",label:"Column Chart",disabledReasons:[],hidden:!1},{key:"bar-chart",label:"Bar Chart",disabledReasons:[],hidden:!1},{key:"line-chart",label:"Line Chart",disabledReasons:[],hidden:!1},{key:"area-chart",label:"Stacked Area Chart",disabledReasons:[],hidden:!1},{key:"pie-chart",label:"Pie Chart",disabledReasons:[],hidden:!1},{key:"donut-chart",label:"Donut Chart",disabledReasons:[],hidden:!1},{key:"scorecard-chart",label:"Scorecard KPI Chart",disabledReasons:[],hidden:!1},{key:"3d-bar-chart",label:"3D Bar Chart",disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{const s=n==null?void 0:n.valueKey;if(!s)return{value:YG};switch(s){case"column-chart":case"basic-chart":return{value:YG};case"bar-chart":return{value:YRn};case"line-chart":return{value:JRn};case"area-chart":return{value:QRn};case"pie-chart":return{value:XRn};case"donut-chart":return{value:eAn};case"scorecard-chart":return{value:tAn};case"3d-bar-chart":case"3d-column-chart":return{value:iAn}}return{value:YG}}})}}const rAn="Sheet2!A1",aAn='"Copy of Blahhh"!A1';class sAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][J.GoogleSheetsCreatePivotTable].inputs.destination.id,version:"1.0.0",description:'Gives options for and generates useful example values for the destination input of the "Create pivot table" Google Sheets operation',initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{getOptions:async t=>[{key:"sheet2-a1",label:"Sheet2!A1",disabledReasons:[],hidden:!1},{key:"copy-of-blahhh-a1",label:'"Copy of Blahhh"!A1',disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{switch(n==null?void 0:n.valueKey){case"copy-of-blahhh-a1":return{value:aAn};case"sheet2-a1":default:return{value:rAn}}}})}}const lAn="Sheet1!A1:D100",oAn="Sheet1!A1:G500";class dAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][J.GoogleSheetsCreatePivotTable].inputs.source.id,version:"1.0.0",description:'Gives options for and generates useful example values for the source input of the "Create pivot table" Google Sheets operation',initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{getOptions:async t=>[{key:"sales-data",label:"Sales Data Range (Sheet1!A1:D100)",disabledReasons:[],hidden:!1},{key:"financial-data",label:"Financial Data Range (Sheet1!A1:G500)",disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{switch(n==null?void 0:n.valueKey){case"financial-data":return{value:oAn};case"sales-data":default:return{value:lAn}}}})}}const pAn=[{sourceColumnOffset:0,sortOrder:"ASCENDING",showTotals:!0}],uAn=[{sourceColumnOffset:0,sortOrder:"ASCENDING",showTotals:!0},{sourceColumnOffset:1,sortOrder:"ASCENDING",showTotals:!0}];class cAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][J.GoogleSheetsCreatePivotTable].inputs.rows.id,version:"1.0.0",description:'Gives options for and generates useful example values for the rows input of the "Create pivot table" Google Sheets operation',initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{getOptions:async t=>[{key:"single-row-group",label:"Group by First Column (Column 0)",disabledReasons:[],hidden:!1},{key:"multi-row-group",label:"Group by First & Second Columns (Columns 0 & 1)",disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{switch(n==null?void 0:n.valueKey){case"multi-row-group":return{value:uAn};case"single-row-group":default:return{value:pAn}}}})}}const fAn=[{sourceColumnOffset:1,sortOrder:"ASCENDING",showTotals:!0}],yAn=[{sourceColumnOffset:1,sortOrder:"ASCENDING",showTotals:!0},{sourceColumnOffset:2,sortOrder:"ASCENDING",showTotals:!0}];class hAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][J.GoogleSheetsCreatePivotTable].inputs.columns.id,version:"1.0.0",description:'Gives options for and generates useful example values for the columns input of the "Create pivot table" Google Sheets operation',initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{getOptions:async t=>[{key:"single-column-group",label:"Group by Second Column (Column 1)",disabledReasons:[],hidden:!1},{key:"multi-column-group",label:"Group by Second & Third Columns (Columns 1 & 2)",disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{switch(n==null?void 0:n.valueKey){case"multi-column-group":return{value:yAn};case"single-column-group":default:return{value:fAn}}}})}}const mAn=[{sourceColumnOffset:3,summarizeFunction:"SUM",name:"Total Revenue"}],TAn=[{sourceColumnOffset:2,summarizeFunction:"COUNTA",name:"Total Orders"},{sourceColumnOffset:3,summarizeFunction:"SUM",name:"Total Revenue"}],vAn=[{sourceColumnOffset:4,summarizeFunction:"AVERAGE",name:"Average Profit"}];class gAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][J.GoogleSheetsCreatePivotTable].inputs.values.id,version:"1.0.0",description:'Gives options for and generates useful example values for the values input of the "Create pivot table" Google Sheets operation',initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{getOptions:async t=>[{key:"sum-revenue",label:"SUM Revenue (Column 3)",disabledReasons:[],hidden:!1},{key:"sum-and-count",label:"COUNTA Orders (Col 2) & SUM Revenue (Col 3)",disabledReasons:[],hidden:!1},{key:"average-profit",label:"AVERAGE Profit (Column 4)",disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{switch(n==null?void 0:n.valueKey){case"sum-and-count":return{value:TAn};case"average-profit":return{value:vAn};case"sum-revenue":default:return{value:mAn}}}})}}const bAn="Sheet2!A1",EAn='"Copy of Blahhh"!A1';class IAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][J.GoogleSheetsDeletePivotTable].inputs.destination.id,version:"1.0.0",description:'Gives options for and generates useful example values for the destination input of the "Delete pivot table" Google Sheets operation',initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{getOptions:async t=>[{key:"sheet2-a1",label:"Sheet2!A1",disabledReasons:[],hidden:!1},{key:"copy-of-blahhh-a1",label:'"Copy of Blahhh"!A1',disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{switch(n==null?void 0:n.valueKey){case"copy-of-blahhh-a1":return{value:EAn};case"sheet2-a1":default:return{value:bAn}}}})}}const O5={"Number greater than":"NUMBER_GREATER","Number greater than or equal":"NUMBER_GREATER_THAN_EQ","Number less than":"NUMBER_LESS","Number less than or equal":"NUMBER_LESS_THAN_EQ","Number equal to":"NUMBER_EQ","Number not equal to":"NUMBER_NOT_EQ","Number between":"NUMBER_BETWEEN","Number not between":"NUMBER_NOT_BETWEEN","Text contains":"TEXT_CONTAINS","Text does not contain":"TEXT_NOT_CONTAINS","Text starts with":"TEXT_STARTS_WITH","Text ends with":"TEXT_ENDS_WITH","Text equals":"TEXT_EQ","Date is":"DATE_EQ","Date is before":"DATE_BEFORE","Date is after":"DATE_AFTER","Date is on or before":"DATE_ON_OR_BEFORE","Date is on or after":"DATE_ON_OR_AFTER","Cell is empty":"BLANK","Cell is not empty":"NOT_BLANK","Custom formula":"CUSTOM_FORMULA"};function aDt(a){if(!a||typeof a!="string")return null;const p=a.trim();return p?O5[p]?O5[p]:p.toUpperCase().replace(/\s+/g,"_"):null}function sDt(a,p,t,n){if(p==null)return;let s=[];if(Array.isArray(p))s=p;else if(typeof p=="string"){const e=p.trim();if(!e)return;if(e.startsWith("["))try{const f=JSON.parse(e);Array.isArray(f)?s=f:s=[e]}catch{s=[e]}else s=[e]}const u=aDt(a);if(u==="BLANK"||u==="NOT_BLANK"){s.length>0&&n.push(new ht({id:`${t.id}--${uo.ConditionValuesNoValuesRequired}`,message:`Condition "${a}" does not require any condition values.`,severity:Ie.Error,code:uo.ConditionValuesNoValuesRequired,entity:t}));return}if(u==="CUSTOM_FORMULA"){if(s.length===0)n.push(new ht({id:`${t.id}--${uo.ConditionValuesInvalidFormula}`,message:'Custom formula condition requires a formula string starting with "=" (e.g. ["=A1>100"]).',severity:Ie.Error,code:uo.ConditionValuesInvalidFormula,entity:t}));else for(const e of s){const f=String(e).trim();f.startsWith("=")||n.push(new ht({id:`${t.id}--${uo.ConditionValuesInvalidFormula}`,message:`Custom formula "${f}" must start with "=".`,severity:Ie.Error,code:uo.ConditionValuesInvalidFormula,entity:t}))}return}if(u==="NUMBER_BETWEEN"||u==="NUMBER_NOT_BETWEEN"){s.length!==2&&n.push(new ht({id:`${t.id}--${uo.ConditionValuesTwoNumbersRequired}`,message:`Condition "${a}" requires exactly 2 values (min and max, e.g. ["1", "100"]).`,severity:Ie.Error,code:uo.ConditionValuesTwoNumbersRequired,entity:t}));return}if(u==="NUMBER_GREATER"||u==="NUMBER_GREATER_THAN_EQ"||u==="NUMBER_LESS"||u==="NUMBER_LESS_THAN_EQ"||u==="NUMBER_EQ"||u==="NUMBER_NOT_EQ"){s.length!==1&&n.push(new ht({id:`${t.id}--${uo.ConditionValuesSingleNumberRequired}`,message:`Condition "${a}" requires exactly 1 threshold value (e.g. ["100"]).`,severity:Ie.Error,code:uo.ConditionValuesSingleNumberRequired,entity:t}));return}if(u==="TEXT_CONTAINS"||u==="TEXT_NOT_CONTAINS"||u==="TEXT_STARTS_WITH"||u==="TEXT_ENDS_WITH"||u==="TEXT_EQ"){s.length!==1&&n.push(new ht({id:`${t.id}--${uo.ConditionValuesSingleTextRequired}`,message:`Condition "${a}" requires exactly 1 text string value (e.g. ["Approved"]).`,severity:Ie.Error,code:uo.ConditionValuesSingleTextRequired,entity:t}));return}}const yw={num_100:["100"],num_0:["0"],num_1000:["1000"],between_1_100:["1","100"],between_0_50:["0","50"],between_50_100:["50","100"],text_approved:["Approved"],text_pending:["Pending"],text_rejected:["Rejected"],text_urgent:["Urgent"],date_2026_01_01:["2026-01-01"],date_today:["2026-08-08"],formula_above_avg:["=A1>AVERAGE($A$1:$A$100)"],formula_even:["=ISEVEN(A1)"],formula_duplicates:["=COUNTIF($A$1:$A$100, A1)>1"],default_100:["100"],default_approved:["Approved"],default_formula:["=A1>0"]};function M4(a){const p=aDt(a),t=(n,s)=>({key:n,label:s,disabledReasons:[],hidden:!1});return p==="NUMBER_GREATER"||p==="NUMBER_GREATER_THAN_EQ"||p==="NUMBER_LESS"||p==="NUMBER_LESS_THAN_EQ"||p==="NUMBER_EQ"||p==="NUMBER_NOT_EQ"?[t("num_100","100 (Single threshold)"),t("num_0","0 (Zero threshold)"),t("num_1000","1000 (High threshold)")]:p==="NUMBER_BETWEEN"||p==="NUMBER_NOT_BETWEEN"?[t("between_1_100","Between 1 and 100"),t("between_0_50","Between 0 and 50"),t("between_50_100","Between 50 and 100")]:p==="TEXT_CONTAINS"||p==="TEXT_NOT_CONTAINS"||p==="TEXT_STARTS_WITH"||p==="TEXT_ENDS_WITH"||p==="TEXT_EQ"?[t("text_approved","Approved"),t("text_pending","Pending"),t("text_rejected","Rejected"),t("text_urgent","Urgent")]:p==="DATE_EQ"||p==="DATE_BEFORE"||p==="DATE_AFTER"||p==="DATE_ON_OR_BEFORE"||p==="DATE_ON_OR_AFTER"?[t("date_2026_01_01","Start of 2026 (2026-01-01)"),t("date_today","Current Date (2026-08-08)")]:p==="CUSTOM_FORMULA"?[t("formula_above_avg","Greater than average (=A1>AVERAGE($A$1:$A$100))"),t("formula_even","Even numbers (=ISEVEN(A1))"),t("formula_duplicates","Highlight duplicates (=COUNTIF($A$1:$A$100, A1)>1)")]:p==="BLANK"||p==="NOT_BLANK"?[]:[t("default_100","100"),t("default_approved","Approved"),t("default_formula","Formula (=A1>0)")]}function lDt(a,p){const t=p==null?void 0:p.valueKey;if(t&&yw[t])return{value:yw[t]};const n=M4(a);if(n.length>0){const s=n[0].key;if(yw[s])return{value:yw[s]}}return{value:["100"]}}function x5(a){var u,e;const p=(u=G[r.Operation])==null?void 0:u[J.GoogleSheetsAddConditionalFormatRule];if(!p)return null;const t=a.parent;if(!t)return null;const s=(t.inputs||t.outputs||[]).find(f=>{var y;return((y=f.declaration)==null?void 0:y.id)===p.inputs.conditionType.id||f.id===p.inputs.conditionType.id});return((e=s==null?void 0:s.defaultValue)==null?void 0:e.value)??null}class RAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][J.GoogleSheetsAddConditionalFormatRule].inputs.conditionValues.id,version:"1.0.0",description:'Gives options for and generates useful example values for conditionValues input of "Add conditional format rule" Google Sheets operation',initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{getOptions:async t=>{const n=x5(t);return M4(n)},getValue:async(t,n)=>{const s=x5(t);return lDt(s,n)}})}}function P5(a){var u,e;const p=(u=G[r.Operation])==null?void 0:u[J.GoogleSheetsUpdateConditionalFormatRule];if(!p)return null;const t=a.parent;if(!t)return null;const s=(t.inputs||t.outputs||[]).find(f=>{var y;return((y=f.declaration)==null?void 0:y.id)===p.inputs.conditionType.id||f.id===p.inputs.conditionType.id});return((e=s==null?void 0:s.defaultValue)==null?void 0:e.value)??null}class AAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][J.GoogleSheetsUpdateConditionalFormatRule].inputs.conditionValues.id,version:"1.0.0",description:'Gives options for and generates useful example values for conditionValues input of "Update conditional format rule" Google Sheets operation',initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{getOptions:async t=>{const n=P5(t);return M4(n)},getValue:async(t,n)=>{const s=P5(t);return lDt(s,n)}})}}const RV=[["Name","Age","Is Active","Notes"],["Alice",30,!0,"New user"],["Bob",25,!1,null],["Charlie",null,!0,"No age provided"]],Mp="1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms",CE={sheetId:0,startRowIndex:0,endRowIndex:10,startColumnIndex:0,endColumnIndex:5},DAn=["Sheet1!A1:B10","Sheet2!C1:D5"],CAn=["Option 1","Option 2","Option 3"],wAn=[{updateSpreadsheetProperties:{properties:{title:"My Renamed Spreadsheet",locale:"en_US",timeZone:"America/New_York"},fields:"title,locale,timeZone"}},{addSheet:{properties:{title:"New Custom Sheet",gridProperties:{rowCount:100,columnCount:20}}}},{mergeCells:{range:{sheetId:0,startRowIndex:0,endRowIndex:2,startColumnIndex:0,endColumnIndex:4},mergeType:"MERGE_ALL"}},{repeatCell:{range:{sheetId:0,startRowIndex:0,endRowIndex:1,startColumnIndex:0,endColumnIndex:5},cell:{userEnteredFormat:{backgroundColor:{red:.2,green:.4,blue:.8},textFormat:{bold:!0,foregroundColor:{red:1,green:1,blue:1}}}},fields:"userEnteredFormat(backgroundColor,textFormat)"}},{findReplace:{find:"Old Value",replacement:"New Value",allSheets:!0,matchCase:!1}}],OAn=[["Date","Product","Revenue ($)","Units Sold"],["2026-01-15","Pro Subscription",299,1],["2026-01-16","Enterprise Add-On",1250.5,2]],xAn=[["Alice Smith","alice@example.com","Engineer","Active"]],PAn=[[null]];class VAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][J.GoogleSheetsAppendRows].inputs.values.id,version:"1.0.0",description:'Gives options for and generates useful example values for the values input of the "Append rows" Google Sheets operation',initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{getOptions:async t=>[{key:"sample-users",label:"Sample User Directory (3 Rows, 4 Columns)",disabledReasons:[],hidden:!1},{key:"sales-report",label:"Sales Report (2 Rows, 4 Columns)",disabledReasons:[],hidden:!1},{key:"single-row",label:"Single Row Entry (1 Row, 4 Columns)",disabledReasons:[],hidden:!1},{key:"empty-grid",label:"Empty Placeholder (1 Row, 1 Column)",disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{switch(n==null?void 0:n.valueKey){case"sales-report":return{value:OAn};case"single-row":return{value:xAn};case"empty-grid":return{value:PAn};case"sample-users":default:return{value:RV}}}})}}const NAn=[["Date","Product","Revenue ($)","Units Sold"],["2026-01-15","Pro Subscription",299,1],["2026-01-16","Enterprise Add-On",1250.5,2]],_An=[["Alice Smith","alice@example.com","Engineer","Active"]],$An=[[null]];class GAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][J.GoogleSheetsUpdateRangeValues].inputs.values.id,version:"1.0.0",description:'Gives options for and generates useful example values for the values input of the "Update range values" Google Sheets operation',initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{getOptions:async t=>[{key:"sample-users",label:"Sample User Directory (3 Rows, 4 Columns)",disabledReasons:[],hidden:!1},{key:"sales-report",label:"Sales Report (2 Rows, 4 Columns)",disabledReasons:[],hidden:!1},{key:"single-row",label:"Single Row Entry (1 Row, 4 Columns)",disabledReasons:[],hidden:!1},{key:"empty-grid",label:"Empty Placeholder (1 Row, 1 Column)",disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{switch(n==null?void 0:n.valueKey){case"sales-report":return{value:NAn};case"single-row":return{value:_An};case"empty-grid":return{value:$An};case"sample-users":default:return{value:RV}}}})}}function LAn(a){a.register(new fTt(a)),a.register(new cTt(a)),a.register(new oTt(a)),a.register(new pTt(a)),a.register(new uTt(a)),a.register(new dTt(a)),a.register(new HEt(a)),a.register(new WEt(a)),a.register(new zEt(a)),a.register(new JEt(a)),a.register(new YEt(a)),a.register(new QEt(a)),a.register(new SRt(a)),a.register(new MRt(a)),a.register(new FRt(a)),a.register(new kRt(a)),a.register(new URt(a)),a.register(new KRt(a)),a.register(new jRt(a)),a.register(new qRt(a)),a.register(new ZRt(a)),a.register(new HRt(a)),a.register(new Zbt(a)),a.register(new Hbt(a)),a.register(new Wbt(a)),a.register(new zbt(a)),a.register(new Ybt(a)),a.register(new Jbt(a)),a.register(new Qbt(a)),a.register(new Xbt(a)),a.register(new eEt(a)),a.register(new tEt(a)),a.register(new iEt(a)),a.register(new nEt(a)),a.register(new rEt(a)),a.register(new aEt(a)),a.register(new sEt(a)),a.register(new lEt(a)),a.register(new oEt(a)),a.register(new dEt(a)),a.register(new pEt(a)),a.register(new fEt(a)),a.register(new yEt(a)),a.register(new hEt(a)),a.register(new cbt(a)),a.register(new fbt(a)),a.register(new ybt(a)),a.register(new hbt(a)),a.register(new mbt(a)),a.register(new Tbt(a)),a.register(new vbt(a)),a.register(new gbt(a)),a.register(new bbt(a)),a.register(new Ibt(a)),a.register(new Rbt(a)),a.register(new Abt(a)),a.register(new Dbt(a)),a.register(new Cbt(a)),a.register(new Vgt(a)),a.register(new iRt(a)),a.register(new eRt(a)),a.register(new tRt(a)),a.register(new Pvt(a)),a.register(new Vvt(a)),a.register(new Nvt(a)),a.register(new _vt(a)),a.register(new $vt(a)),a.register(new Gvt(a)),a.register(new Lvt(a)),a.register(new Bvt(a)),a.register(new Svt(a)),a.register(new Jvt(a)),a.register(new Ogt(a)),a.register(new xgt(a)),a.register(new Pgt(a)),a.register(new Mvt(a)),a.register(new Fvt(a)),a.register(new kvt(a)),a.register(new Uvt(a)),a.register(new Kvt(a)),a.register(new jvt(a)),a.register(new qvt(a)),a.register(new Zvt(a)),a.register(new Hvt(a)),a.register(new Wvt(a)),a.register(new zvt(a)),a.register(new Yvt(a)),a.register(new Qvt(a)),a.register(new Xvt(a)),a.register(new egt(a)),a.register(new tgt(a)),a.register(new igt(a)),a.register(new ngt(a)),a.register(new rgt(a)),a.register(new agt(a)),a.register(new sgt(a)),a.register(new lgt(a)),a.register(new ogt(a)),a.register(new dgt(a)),a.register(new vgt(a)),a.register(new ggt(a)),a.register(new bgt(a)),a.register(new pgt(a)),a.register(new ugt(a)),a.register(new cgt(a)),a.register(new fgt(a)),a.register(new ygt(a)),a.register(new hgt(a)),a.register(new mgt(a)),a.register(new Tgt(a)),a.register(new sRt(a)),a.register(new lRt(a)),a.register(new oRt(a)),a.register(new dRt(a)),a.register(new nRt(a)),a.register(new rRt(a)),a.register(new aRt(a)),a.register(new pRt(a)),a.register(new cRt(a)),a.register(new yRt(a)),a.register(new uRt(a)),a.register(new fRt(a)),a.register(new hRt(a)),a.register(new vRt(a)),a.register(new mRt(a)),a.register(new TRt(a)),a.register(new wbt(a)),a.register(new Vbt(a)),a.register(new Nbt(a)),a.register(new Gbt(a)),a.register(new Lbt(a)),a.register(new Bbt(a)),a.register(new Sbt(a)),a.register(new Mbt(a)),a.register(new Fbt(a)),a.register(new kbt(a)),a.register(new Ubt(a)),a.register(new _bt(a)),a.register(new $bt(a)),a.register(new U1t(a)),a.register(new K1t(a)),a.register(new j1t(a)),a.register(new q1t(a)),a.register(new Z1t(a)),a.register(new H1t(a)),a.register(new W1t(a)),a.register(new z1t(a)),a.register(new Y1t(a)),a.register(new J1t(a)),a.register(new Q1t(a)),a.register(new X1t(a)),a.register(new eDt(a)),a.register(new tDt(a)),a.register(new iDt(a)),a.register(new nDt(a)),a.register(new rDt(a)),a.register(new xbt(a)),a.register(new Pbt(a)),a.register(new Obt(a)),a.register(new Ebt(a)),a.register(new jbt(a)),a.register(new qbt(a)),a.register(new Kbt(a)),a.register(new eIt(a)),a.register(new AIt(a)),a.register(new RIt(a)),a.register(new DIt(a)),a.register(new CIt(a)),a.register(new nIt(a)),a.register(new rIt(a)),a.register(new pIt(a)),a.register(new oIt(a)),a.register(new EIt(a)),a.register(new hIt(a)),a.register(new TIt(a)),a.register(new gIt(a)),a.register(new vIt(a)),a.register(new dIt(a)),a.register(new cIt(a)),a.register(new fIt(a)),a.register(new uIt(a)),a.register(new XEt(a)),a.register(new aIt(a)),a.register(new mIt(a)),a.register(new xIt(a)),a.register(new KL(a)),a.register(new iIt(a)),a.register(new sIt(a)),a.register(new tIt(a)),a.register(new bIt(a)),a.register(new lIt(a)),a.register(new yIt(a)),a.register(new IIt(a)),a.register(new OIt(a)),a.register(new wIt(a)),a.register(new PIt(a)),a.register(new KL(a)),a.register(new NIt(a)),a.register(new VIt(a)),a.register(new _It(a)),a.register(new PEt(a)),a.register(new VEt(a)),a.register(new NEt(a)),a.register(new TEt(a)),a.register(new cEt(a)),a.register(new EEt(a)),a.register(new DEt(a)),a.register(new uEt(a)),a.register(new CEt(a)),a.register(new xEt(a)),a.register(new REt(a)),a.register(new IEt(a)),a.register(new Xw(a)),a.register(new _Et(a)),a.register(new $Et(a)),a.register(new AEt(a)),a.register(new OEt(a)),a.register(new wEt(a)),a.register(new bEt(a)),a.register(new gEt(a)),a.register(new vEt(a)),a.register(new mEt(a)),a.register(new BEt(a)),a.register(new LEt(a)),a.register(new SEt(a)),a.register(new GEt(a)),a.register(new Agt(a)),a.register(new Egt(a)),a.register(new Rgt(a)),a.register(new Dgt(a)),a.register(new Cgt(a)),a.register(new Igt(a)),a.register(new wgt(a)),a.register(new YRt(a)),a.register(new iAt(a)),a.register(new rAt(a)),a.register(new sAt(a)),a.register(new lAt(a)),a.register(new oAt(a)),a.register(new dAt(a)),a.register(new tAt(a)),a.register(new nAt(a)),a.register(new aAt(a)),a.register(new eAt(a)),a.register(new XRt(a)),a.register(new QRt(a)),a.register(new JRt(a)),a.register(new WRt(a)),a.register(new zRt(a)),a.register(new yAt(a)),a.register(new hAt(a)),a.register(new cAt(a)),a.register(new fAt(a)),a.register(new BRt(a)),a.register(new pAt(a)),a.register(new uAt(a)),a.register(new TAt(a)),a.register(new mAt(a)),a.register(new vAt(a)),a.register(new gAt(a)),a.register(new bAt(a)),a.register(new yTt(a)),a.register(new hTt(a)),a.register(new Jw(a)),a.register(new Qw(a)),a.register(new DAt(a)),a.register(new CAt(a)),a.register(new xAt(a)),a.register(new FAt(a)),a.register(new VAt(a)),a.register(new wAt(a)),a.register(new OAt(a)),a.register(new NAt(a)),a.register(new PAt(a)),a.register(new _At(a)),a.register(new $At(a)),a.register(new GAt(a)),a.register(new LAt(a)),a.register(new BAt(a)),a.register(new SAt(a)),a.register(new MAt(a)),a.register(new kAt(a)),a.register(new KAt(a)),a.register(new jAt(a)),a.register(new qAt(a)),a.register(new ZAt(a)),a.register(new HAt(a)),a.register(new WAt(a)),a.register(new zAt(a)),a.register(new k1t(a)),a.register(new YAt(a)),a.register(new JAt(a)),a.register(new c1t(a)),a.register(new QAt(a)),a.register(new XAt(a)),a.register(new e1t(a)),a.register(new t1t(a)),a.register(new i1t(a)),a.register(new n1t(a)),a.register(new r1t(a)),a.register(new a1t(a)),a.register(new s1t(a)),a.register(new o1t(a)),a.register(new d1t(a)),a.register(new p1t(a)),a.register(new u1t(a)),a.register(new f1t(a)),a.register(new F1t(a)),a.register(new h1t(a)),a.register(new A1t(a)),a.register(new b1t(a)),a.register(new E1t(a)),a.register(new g1t(a)),a.register(new w1t(a)),a.register(new y1t(a)),a.register(new m1t(a)),a.register(new O1t(a)),a.register(new C1t(a)),a.register(new P1t(a)),a.register(new V1t(a)),a.register(new N1t(a)),a.register(new _1t(a)),a.register(new $1t(a)),a.register(new G1t(a)),a.register(new L1t(a)),a.register(new B1t(a)),a.register(new S1t(a)),a.register(new M1t(a)),a.register(new v1t(a)),a.register(new T1t(a)),a.register(new I1t(a)),a.register(new x1t(a)),a.register(new D1t(a)),a.register(new R1t(a)),a.register(new EAt(a)),a.register(new IAt(a)),a.register(new zRn(a)),a.register(new nAn(a)),a.register(new sAn(a)),a.register(new dAn(a)),a.register(new cAn(a)),a.register(new hAn(a)),a.register(new gAn(a)),a.register(new IAn(a)),a.register(new RAn(a)),a.register(new AAn(a)),a.register(new VAn(a)),a.register(new GAn(a))}class F4{constructor(p=new pe.Events("extensions-registry-fallback-events")){C(this,"extensionsRegistry",new Map);C(this,"initialized",new Set);C(this,"initializedContexts",new Set);C(this,"onResolveEditorContextCallback",()=>null);C(this,"onResolveProjectLogicContextCallback",()=>null);C(this,"onResolveEditorGUIContextCallback",()=>null);C(this,"onResolveGUIContextCallback",()=>null);C(this,"onResolveCompileContextCallback",()=>null);C(this,"onResolvePublicationRunContextCallback",()=>null);this.events=p,this.off=this.events.off.bind(this.events),this.on=this.events.on.bind(this.events),this.emit=this.events.emit.bind(this.events),this.emitAsync=this.events.emitAsync.bind(this.events),this.emitAsyncAll=this.events.emitAsyncAll.bind(this.events),this.emitAsyncAllSettled=this.events.emitAsyncAllSettled.bind(this.events),this.emitAsyncSequentially=this.events.emitAsyncSequentially.bind(this.events),this.emitAsyncSequentiallyAll=this.events.emitAsyncSequentiallyAll.bind(this.events),this.emitAsyncSequentiallyAllSettled=this.events.emitAsyncSequentiallyAllSettled.bind(this.events)}onResolveEditorContext(p){this.onResolveEditorContextCallback=p}onResolveProjectLogicContext(p){this.onResolveProjectLogicContextCallback=p}onResolveGUIContext(p){this.onResolveGUIContextCallback=p}onResolveEditorGUIContext(p){this.onResolveEditorGUIContextCallback=p}onResolveCompileContext(p){this.onResolveCompileContextCallback=p}onResolvePublicationRunContext(p){this.onResolvePublicationRunContextCallback=p}get extensionInOrder(){return Array.from(this.extensionsRegistry.values()).sort((p,t)=>(p.manifest.initPriority||_e.Normal)-(t.manifest.initPriority||_e.Normal))}async setup(){LAn(this),pe.Logger.log("Initializing extensions without context..."),this.initForReady()}requestContext(p){switch(p){case Q.Editor:return this.onResolveEditorContextCallback();case Q.Logic:return this.onResolveProjectLogicContextCallback();case Q.EditorGUI:return this.onResolveEditorGUIContextCallback();case Q.Compile:return this.onResolveCompileContextCallback();case Q.PublicationRun:return this.onResolvePublicationRunContextCallback();case Q.GUI:return this.onResolveGUIContextCallback();case Q.EditorGUI:return this.onResolveEditorGUIContextCallback();default:throw new Error(`Unknown context type: ${p}`)}}requestContexts(p,t=[]){const n=[];t.length===0&&(t=p.manifest.contexts);for(const s of t){const u=this.requestContext(s);u&&n.push(u)}return n}requestExtension(p){const t=this.extensionsRegistry.get(p);if(t)return t;throw new Error(`Unknown extension: ${p}`)}register(p){this.extensionsRegistry.set(p.manifest.id,p)}async initAll(){for(const p of this.extensionInOrder){if(this.initialized.has(p.manifest.id))continue;const t=this.requestContexts(p);p.manifest.contexts.every(s=>!!t.find(u=>u.contextType===s))&&(p.module.init&&await p.module.init(t),this.initialized.add(p.manifest.id))}}async initForReady(){pe.Logger.log("Initializing extensions for ready contexts...");for(const p of this.extensionInOrder){if(this.initialized.has(p.manifest.id))continue;const t=this.requestContexts(p);p.manifest.contexts.every(s=>!!t.find(u=>u.contextType===s))?(p.module.init?(pe.Logger.debug("Initializing "+p.manifest.id+" extension..."),await p.module.init(t)):pe.Logger.log("Set "+p.manifest.id+" extension as ready (no init method)..."),this.initialized.add(p.manifest.id)):pe.Logger.warn(`Skipping initialization of ${p.manifest.id} extension, not all contexts are ready.`,`Required contexts: ${p.manifest.contexts.join(", ")}`,`Available contexts: ${t.map(s=>s.contextType).join(", ")}`)}}async destroyAll(){for(const p of[...this.extensionInOrder].reverse())p.module.destroy&&await p.module.destroy();this.events.destroy()}on(p,t){this.events.on(p,t)}emit(p,...t){this.events.emit(p,...t)}off(p,t){this.events.off(p,t)}emitAsync(p,...t){return this.events.emitAsync(p,...t)}emitAsyncAll(p,...t){return this.events.emitAsyncAll(p,...t)}emitAsyncAllSettled(p,...t){return this.events.emitAsyncAllSettled(p,...t)}emitAsyncSequentially(p,...t){return this.events.emitAsyncSequentially(p,...t)}emitAsyncSequentiallyAll(p,...t){return this.events.emitAsyncSequentiallyAll(p,...t)}emitAsyncSequentiallyAllSettled(p,...t){return this.events.emitAsyncSequentiallyAllSettled(p,...t)}async contextAvailable(p){if(this.initializedContexts.has(p)){pe.Logger.warn(`Context ${p} is already initialized. Skipping re-initialization.`);return}switch(this.initializedContexts.add(p),p){case Q.Editor:{if(!this.onResolveEditorContextCallback)throw new Error("No editor context resolver callback set. Call onResolveEditorContext first.");break}case Q.Logic:{if(!this.onResolveProjectLogicContextCallback)throw new Error("No project logic context resolver callback set. Call onResolveProjectLogicContext first.");break}}pe.Logger.log(`Context ${p} is now available. Initializing extensions for this context...`),await this.initForReady()}getValueTypePreference(p){return window.localStorage.getItem("dynamic-value-type-preference--"+p)||null}setValueTypePreference(p,t){window.localStorage.setItem("dynamic-value-type-preference--"+p,(t==null?void 0:t.toString())||""),this.emit(p,{})}}let hw=null;const k4={requestExtension:a=>(hw||(hw=new F4,hw.setup()),hw.requestExtension(a))};function Eh(a){return!(a instanceof Error)&&typeof a=="object"&&a!==null?a:a instanceof Error?{name:a.name,message:a.message,stack:a.stack,...a}:a}function V5(a){var p,t,n;if(a&&typeof a=="object"&&"value"in a){const s=a;return{single:((p=s.value)==null?void 0:p.valueAsTypeSingle)??((t=s.value)==null?void 0:t.value),list:((n=s.value)==null?void 0:n.valueAsTypeList)??null}}return{single:a,list:Array.isArray(a)?a:null}}const Ih={onBeforeEntityExecution:async()=>{},onEntityExecuted:async()=>{}};class e2 extends Error{constructor(){super("Execution was stopped"),this.name="ExecutionStoppedError"}}var U4=(a=>(a.FinishedSuccess="finished-success",a.FinishedError="finished-error",a.Running="running",a.Paused="paused",a.Stopped="stopped",a.NotStarted="not-started",a))(U4||{});const oDt={...k4,getValueTypePreference:()=>null,setValueTypePreference:()=>{}};class vg extends pe.Events{constructor(t,n,s,u=null,e=oDt){super();C(this,"project");C(this,"entryPoint");C(this,"state","not-started");C(this,"events",new pe.Events("fe-exec-inst-events"));C(this,"entities",[]);C(this,"parentExecution",null);C(this,"executing",[]);C(this,"executed",[]);C(this,"skipped",[]);C(this,"scheduled",[]);C(this,"localTestValues");C(this,"resolvedValues");C(this,"persistedExecutionResults");C(this,"lastExecutionResults");C(this,"onAddToSkippedListCallback",null);C(this,"onRemoveFromSkippedListCallback",null);C(this,"onAddEntityCallback",null);C(this,"onRemoveEntityCallback",null);C(this,"onAbortExecutionCallback",null);this.parentContext=e,this.entities=n,this.entryPoint=s,this.project=t,this.parentExecution=u,this.localTestValues=new VR(M.UUID.uuid(),this.project),this.resolvedValues=new VR(M.UUID.uuid(),this.project),this.persistedExecutionResults=new VR(M.UUID.uuid(),this.project),this.lastExecutionResults=new VR(M.UUID.uuid(),this.project)}get valueResolutionContext(){return{execution:this,project:this.project,localTestValues:this.localTestValues,resolvedValues:this.resolvedValues,persistedExecutionResults:this.persistedExecutionResults,lastExecutionResults:this.lastExecutionResults,getValueTypePreference:this.parentContext.getValueTypePreference,setValueTypePreference:this.parentContext.setValueTypePreference}}get rootExecution(){let t=this;for(;t.parentExecution;)t=t.parentExecution;return t}get rootState(){return this.rootExecution.state}isStopped(){return this.state==="stopped"||this.rootExecution.state==="stopped"}isPaused(){return this.state==="paused"||this.rootExecution.state==="paused"}async checkStateAndPause(){if(this.isStopped())throw new e2;for(;this.isPaused();){if(this.isStopped())throw new e2;await new Promise(t=>setTimeout(t,100))}}skip(t){this.hasEntity(t)&&(this.removeFromScheduledList(t),!this.skipped.includes(t)&&(this.skipped.push(t),this.onAddToSkippedListCallback&&this.onAddToSkippedListCallback(t),Pr.includes(t.type)&&ri(t).forEach(n=>this.skip(n))))}async schedule(t,n,s){if(this.hasExecuted(t))return null;if(Xi.includes(t.type))return this.executeBranch(t,s,n);if(Vr.includes(t.type)){if(t.calledBy.every(e=>this.hasExecuted(e)||!this.hasEntity(e)))return this.executeBranch(t,s,n);this.scheduled.includes(t)||this.scheduled.push(t)}return null}mergeExernalValuesWithInternalInputs(t,n){const s=[];return Yi.includes(n.type)?s.push(...n.inputs.filter(e=>vT(e))):[...Li,...Xi].includes(n.type)?s.push(...n.inputs):Ni.includes(n.type)&&s.push(...n.outputs.filter(e=>vT(e))),s.map(e=>{var y;let f=t.find(m=>m.valueOwner.id===e.id);if(f)return f;if(!f&&Xi.includes(n.type)&&(f=t.find(m=>{var T;return((T=m.valueOwner.declaration)==null?void 0:T.id)===e.id})),f){const m=(y=f.value)==null?void 0:y.clone(null);return m==null||m.setStandaloneParent(e,null),{...f,valueOwner:e,value:m||null,inheritanceLink:{sources:[f],target:e}}}return ls.includes(e.type)?Xp(e,this.valueResolutionContext):Qu(e,this.valueResolutionContext)}).reduce((e,f)=>{const y=uf(f==null?void 0:f.valueOwner,this.project),m=f?[f]:[];return y.forEach(T=>{var R,I,A;if(T.id===(f==null?void 0:f.valueOwner.id))return;const g=Pn(T.getDataType(null),T,this.project);g==null||g.metaSync({value:(R=f==null?void 0:f.value)==null?void 0:R.value},null),g==null||g.setValueAsTypeList(((I=f==null?void 0:f.value)==null?void 0:I.valueAsTypeList)||null),g==null||g.setValueAsTypeSingle(((A=f==null?void 0:f.value)==null?void 0:A.valueAsTypeSingle)||null);const b={...f,valueOwner:T,value:g};m.push(b)}),[...e,...m]},[]).sort((e,f)=>e.valueOwner.index-f.valueOwner.index)}inheritValuesFromContext(t){this.localTestValues=t.localTestValues,this.resolvedValues=t.resolvedValues,this.persistedExecutionResults=t.persistedExecutionResults}async executeInternalCall(t,n,s,u={}){var f,y;this.logBeforeExecution("executeInternalCall",t,n);const e={...Ih,...u};try{let m={value:K.Success,error:null,result:null};if(n.sort((A,O)=>A.valueOwner.index-O.valueOwner.index),Object.values(ja).includes(t.declaration.id)){const A=this.parentContext.requestExtension(vi+t.declaration.id).module.main;A?m=await A(t,n,this):pe.Logger.warn(`No implementation found for built-in function: ${t.declaration.id}`)}else{const A=await this.executeDetachedFullFunctionDeclarationLogic(t.declaration,n,s,e);m={value:A.value,error:A.error,result:A.result}}let T=null;if(m.error&&t.error){pe.Logger.warn("Raw error executing entity: ",m.error);const{single:A,list:O}=V5(m.error),P=Eh(A),x=(f=t.error)==null?void 0:f.getDataType(null),$=Pn(x||null,t.error,s);x!=null&&x.asType?O!==null?$==null||$.setValueAsTypeList(O):$==null||$.setValueAsTypeSingle(A):$==null||$.metaSync({value:P},null),T={valueOwner:t.error,type:rt.ExecutionResult,inheritanceLink:null,value:$}}const g=t==null?void 0:t.getDataType(null),b=Pn(g,t,s),{single:R,list:I}=V5(m.result);return g!=null&&g.asType?I!==null?b==null||b.setValueAsTypeList(I):b==null||b.setValueAsTypeSingle(R):b==null||b.metaSync({value:R},null),{value:m.value,entity:t,error:T,result:{value:b||null,valueOwner:t,type:rt.ExecutionResult,inheritanceLink:null}}}catch(m){if(m&&(m.name==="ExecutionStoppedError"||m.message==="Execution was stopped"))throw m;pe.Logger.warn("Internal call execution error: ",m);let T=null;if(t.error){const g=Eh(m),b=(y=t.error)==null?void 0:y.getDataType(null),R=Pn(b,t.error,s);b!=null&&b.asType?R==null||R.setValueAsTypeSingle(m):R==null||R.metaSync({value:g},null),T={valueOwner:t.error,type:rt.ExecutionResult,inheritanceLink:null,value:R}}return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,entity:t,error:T,result:null}}}static async executeOperation(t,n,s,u){var e,f;u?u.logBeforeExecution("executeOperation",t,n):console.log(`executeOperation (${t.type}) -> [${De(t,s)}] Inputs:${n.length?`
61
+ `),p}class _At extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleDriveUploadFile,version:"2.0.0",description:"Upload a file to Google Drive (media / import+copy) with auto content detection and simplified inputs.",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleDriveUploadFile);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A,O,P,x,$,U,Z,q,H,Y,ie,z,W,ee,te;try{const X=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0],re=Be(t,t.project,"uploadFile"),le="["+Ve(t,t.project,"Upload Google Drive File")+": `"+re+"`] ",oe=G.operation[J.GoogleDriveUploadFile],ce=n.find(kt=>{var Ct,xi;return((xi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:xi.id)===oe.inputs.connection.id}),be=((s=ce==null?void 0:ce.value)==null?void 0:s.valueAsType)??((u=ce==null?void 0:ce.value)==null?void 0:u.value);if(!be||!be.id||!be.name||be.type!==r.DefinitionEntity)throw new Error(`${le}Invalid input "${Ve(ce==null?void 0:ce.valueOwner,X==null?void 0:X.logic,"Connection")}" (\`${Be(ce==null?void 0:ce.valueOwner,X==null?void 0:X.logic,"connection")}\`), expected a valid connection node.`);const Ce=n.find(kt=>{var Ct,xi;return((xi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:xi.id)===oe.inputs.content.id}),Ee=((e=Ce==null?void 0:Ce.value)==null?void 0:e.valueAsType)??((f=Ce==null?void 0:Ce.value)==null?void 0:f.value),Oe=n.find(kt=>{var Ct,xi;return((xi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:xi.id)===oe.inputs.name.id}),Le=(m=(y=Oe==null?void 0:Oe.value)==null?void 0:y.value)==null?void 0:m.trim();if(!Le||Le==="")throw new Error(`${le}The "${Ve(Oe==null?void 0:Oe.valueOwner,X==null?void 0:X.logic,"File Name")}" (\`${Be(Oe==null?void 0:Oe.valueOwner,X==null?void 0:X.logic,"name")}\`) input is missing.`);const Fe=(((g=(T=n.find(kt=>{var Ct,xi;return((xi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:xi.id)===G.operation[J.GoogleDriveUploadFile].inputs.mimeType.id}))==null?void 0:T.value)==null?void 0:g.valueAsType)??((R=(b=n.find(kt=>{var Ct,xi;return((xi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:xi.id)===G.operation[J.GoogleDriveUploadFile].inputs.mimeType.id}))==null?void 0:b.value)==null?void 0:R.value))||"application/octet-stream",tt=(((A=(I=n.find(kt=>{var Ct,xi;return((xi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:xi.id)===G.operation[J.GoogleDriveUploadFile].inputs.folderId.id}))==null?void 0:I.value)==null?void 0:A.valueAsType)??((P=(O=n.find(kt=>{var Ct,xi;return((xi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:xi.id)===G.operation[J.GoogleDriveUploadFile].inputs.folderId.id}))==null?void 0:O.value)==null?void 0:P.value))||void 0,We=((($=(x=n.find(kt=>{var Ct,xi;return((xi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:xi.id)===G.operation[J.GoogleDriveUploadFile].inputs.description.id}))==null?void 0:x.value)==null?void 0:$.valueAsType)??((Z=(U=n.find(kt=>{var Ct,xi;return((xi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:xi.id)===G.operation[J.GoogleDriveUploadFile].inputs.description.id}))==null?void 0:U.value)==null?void 0:Z.value))||void 0,et=(((H=(q=n.find(kt=>{var Ct,xi;return((xi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:xi.id)===G.operation[J.GoogleDriveUploadFile].inputs.importMimeType.id}))==null?void 0:q.value)==null?void 0:H.valueAsType)??((ie=(Y=n.find(kt=>{var Ct,xi;return((xi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:xi.id)===G.operation[J.GoogleDriveUploadFile].inputs.importMimeType.id}))==null?void 0:Y.value)==null?void 0:ie.value))||"text/plain";if(!Le)return ay(t,"Missing required input: name");const qe=ui(be),st={Authorization:`Bearer ${await X.getAccessToken()}`},ft=`${((z=X.env)==null?void 0:z.API_BASE_URL)+"/editor-runtime"}/v2/external-integrations/proxy/${X.projectId}/${Zt["google-drive"]}/${qe}`,Et=async(kt,Ct,{params:xi,body:wn,contentType:Yr,providerHeaders:Jr,responseType:hi}={})=>{const $t=`${ft}/${ZIn(Ct)}`,Nt={...st};return Yr&&(Nt["Content-Type"]=Yr),(Jr||hi)&&(Nt[qIn]=JSON.stringify({...Jr?{headers:Jr}:{},...hi?{responseType:hi}:{}})),Ht.request({method:kt,url:$t,params:xi,data:wn,responseType:hi||"json",headers:Nt})},pt=typeof Fe=="string"&&Fe.startsWith("application/vnd.google-apps.");if(pt&&(Ee==null||Ee==="")){const kt={name:Le,mimeType:Fe};tt&&(kt.parents=[tt]),typeof We=="string"&&(kt.description=We);const Ct=await Et("POST","/drive/v3/files",{params:{supportsAllDrives:"true",fields:_R},body:JSON.stringify(kt),contentType:"application/json"});return Ct.status!==200&&Ct.status!==201?ay(t,`Drive create failed (status=${Ct.status})`):WG({file:Ct.data})}if(pt&&Ee!=null){let kt=await WIn(Ee);const xi=((hi,$t)=>$t||(hi==="application/vnd.google-apps.spreadsheet"?"text/csv":hi==="application/vnd.google-apps.document"||hi==="application/vnd.google-apps.presentation"?"text/html":"text/plain"))(Fe,et),wn=xi.startsWith("text/")&&!/charset=/i.test(xi)?`${xi}; charset=UTF-8`:xi;xi.startsWith("text/csv")&&(kt=zIn(kt));const Yr=new TextEncoder().encode(kt);if(Yr.byteLength>v5)return ay(t,`Text body exceeds simple upload limit (${Yr.byteLength} bytes).`);let Jr;try{const hi=await Et("POST","/upload/drive/v3/files",{params:{uploadType:"media",supportsAllDrives:"true",fields:_R},body:Yr,contentType:wn});if(hi.status!==200&&hi.status!==201)return ay(t,`Drive media upload failed (status=${hi.status})`);if(Jr=(W=hi.data)==null?void 0:W.id,!Jr)return ay(t,"Drive media upload did not return an id");const $t={name:Le,mimeType:Fe};tt&&($t.parents=[tt]),typeof We=="string"&&($t.description=We);const Nt=await Et("POST",`/drive/v3/files/${encodeURIComponent(Jr)}/copy`,{params:{supportsAllDrives:"true",fields:_R},body:JSON.stringify($t),contentType:"application/json"});return Nt.status!==200&&Nt.status!==201?ay(t,`Drive copy-convert failed (status=${Nt.status})`):WG({file:Nt.data})}finally{if(Jr)try{await Et("DELETE",`/drive/v3/files/${encodeURIComponent(Jr)}`,{params:{supportsAllDrives:"true"}})}catch{}}}if(Ee==null)return ay(t,"Missing content for non-native upload");const{bytes:Me,inferredMime:Je,isBinary:ke}=await HIn(Ee),lt=Me.byteLength;if(lt>v5)return ay(t,`File too large for simple upload (${lt} bytes).`);const Gt=await Et("POST","/upload/drive/v3/files",{params:{uploadType:"media",supportsAllDrives:"true",fields:_R},body:Me,contentType:Fe||Je||(ke?"application/octet-stream":"text/plain; charset=UTF-8")});if(Gt.status!==200&&Gt.status!==201)return ay(t,`Drive media upload failed (status=${Gt.status})`);let si=Gt.data;const pi=(ee=Gt.data)==null?void 0:ee.id;return pi&&(tt||Le||We)&&(si=await YIn(Et,pi,Le,We,tt)),WG({file:si})}catch(X){const re=((te=X.response)==null?void 0:te.data)||X.message||X;return pe.Logger.error("[Google Drive] Upload document failed:",re),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:re,result:null}}}})}}function WG(a){return{value:K.Success,error:null,result:a}}function ay(a,p){return pe.Logger.log("[Google Drive] Upload error:",p),{value:a.catchesError||a.errorCalls.length?K.CaughtError:K.UnhandledError,error:p,result:null}}async function YIn(a,p,t,n,s){const u={};t&&(u.name=t),typeof n=="string"&&(u.description=n);const e={supportsAllDrives:"true",fields:_R},f={...e};s&&(f.addParents=s,f.removeParents="root");let y=await a("PATCH",`/drive/v3/files/${encodeURIComponent(p)}`,{params:f,body:JSON.stringify(u),contentType:"application/json"});if(y.status>=400&&s&&(y=await a("PATCH",`/drive/v3/files/${encodeURIComponent(p)}`,{params:{...e,addParents:s},body:JSON.stringify(u),contentType:"application/json"})),y.status!==200)throw new Error(`Drive metadata update failed (status=${y.status})`);return y.data}const JIn="id,name,mimeType,webViewLink",QIn="X-Elyx-Proxy-Config";function XIn(a){return a.startsWith("/")?a.slice(1):a}const eRn=(a,p)=>(pe.Logger.log("[Google Drive Clone Document] error:",p),{value:a.catchesError||a.errorCalls.length?K.CaughtError:K.UnhandledError,error:p,result:null});class $At extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleDriveCloneDocument,version:"1.0.0",description:"Google Drive clone document operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleDriveCloneDocument);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A,O;try{const P=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0],x=G.operation[J.GoogleDriveCloneDocument],$=Be(t,t.project,"cloneDocument"),Z="["+Ve(t,t.project,"Clone document")+": `"+$+"`] ",q=n.find(Ee=>{var Oe,Le;return((Le=(Oe=Ee.valueOwner)==null?void 0:Oe.declaration)==null?void 0:Le.id)===x.inputs.connection.id}),H=((s=q==null?void 0:q.value)==null?void 0:s.valueAsType)??((u=q==null?void 0:q.value)==null?void 0:u.value);if(!H||!H.id||!H.name||H.type!==r.DefinitionEntity)throw new Error(`${Z}Invalid input "${Ve(q==null?void 0:q.valueOwner,P==null?void 0:P.logic,"Connection")}" (\`${Be(q==null?void 0:q.valueOwner,P==null?void 0:P.logic,"connection")}\`), expected a valid connection node.`);const Y=ui(H);if(!Y)throw new Error(`${Z}The "${Ve(q==null?void 0:q.valueOwner,P==null?void 0:P.logic,"Connection")}" (\`${Be(q==null?void 0:q.valueOwner,P==null?void 0:P.logic,"connection")}\`) input is invalid, missing underlying Connection ID value.`);const ie=n.find(Ee=>{var Oe,Le;return((Le=(Oe=Ee.valueOwner)==null?void 0:Oe.declaration)==null?void 0:Le.id)===x.inputs.documentId.id}),z=(e=ie==null?void 0:ie.value)==null?void 0:e.value;if(!z||z==="")throw new Error(`${Z}The "${Ve(ie==null?void 0:ie.valueOwner,P==null?void 0:P.logic,"Document ID")}" (\`${Be(ie==null?void 0:ie.valueOwner,P==null?void 0:P.logic,"documentId")}\`) input is missing.`);if(typeof z!="string")throw new Error(`${Z}The "${Ve(ie==null?void 0:ie.valueOwner,P==null?void 0:P.logic,"Document ID")}" (\`${Be(ie==null?void 0:ie.valueOwner,P==null?void 0:P.logic,"documentId")}\`) input value is invalid, if present, it must be a non-empty string.`);const W=(y=(f=n.find(Ee=>{var Oe,Le;return((Le=(Oe=Ee.valueOwner)==null?void 0:Oe.declaration)==null?void 0:Le.id)===x.inputs.newName.id}))==null?void 0:f.value)==null?void 0:y.value,ee=(T=(m=n.find(Ee=>{var Oe,Le;return((Le=(Oe=Ee.valueOwner)==null?void 0:Oe.declaration)==null?void 0:Le.id)===x.inputs.parentFolderIds.id}))==null?void 0:m.value)==null?void 0:T.value,te=(b=(g=n.find(Ee=>{var Oe,Le;return((Le=(Oe=Ee.valueOwner)==null?void 0:Oe.declaration)==null?void 0:Le.id)===x.inputs.description.id}))==null?void 0:g.value)==null?void 0:b.value,X=(I=(R=n.find(Ee=>{var Oe,Le;return((Le=(Oe=Ee.valueOwner)==null?void 0:Oe.declaration)==null?void 0:Le.id)===x.inputs.starred.id}))==null?void 0:R.value)==null?void 0:I.value;ui(H);const ae={Authorization:`Bearer ${await P.getAccessToken()}`},le=`${((A=P.env)==null?void 0:A.API_BASE_URL)+"/editor-runtime"}/v2/external-integrations/proxy/${P.projectId}/${Zt["google-drive"]}/${Y}`,oe=async(Ee,Oe,{params:Le,body:Fe,contentType:tt,providerHeaders:We,responseType:et}={})=>{const qe=`${le}/${XIn(Oe)}`,ot={...ae};return tt&&(ot["Content-Type"]=tt),(We||et)&&(ot[QIn]=JSON.stringify({...We?{headers:We}:{},...et?{responseType:et}:{}})),Ht({method:Ee,url:qe,headers:ot,params:Le,data:Fe,responseType:et||"json"})},ce={};W&&(ce.name=W),ee&&ee.length>0&&(ce.parents=ee),te&&(ce.description=te),X!==void 0&&(ce.starred=X);const Ce=(await oe("POST",`/drive/v3/files/${z}/copy`,{params:{fields:JIn,supportsAllDrives:!0},body:ce,contentType:"application/json"})).data;return{value:K.Success,error:null,result:{id:Ce.id,name:Ce.name,mimeType:Ce.mimeType,webViewLink:Ce.webViewLink}}}catch(P){const x=((O=P.response)==null?void 0:O.data)||P.message||P;return eRn(t,x)}}})}}const tRn="X-Elyx-Proxy-Config";function iRn(a){return a.startsWith("/")?a.slice(1):a}const nRn=(a,p)=>(pe.Logger.log("[Google Drive Delete Document] error:",p),{value:a.catchesError||a.errorCalls.length?K.CaughtError:K.UnhandledError,error:p,result:null});class GAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleDriveDeleteDocument,version:"1.0.0",description:"Google Drive delete document operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleDriveDeleteDocument);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T;try{const g=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0],b=G.operation[J.GoogleDriveDeleteDocument],R=Be(t,t.project,"deleteDocument"),A="["+Ve(t,t.project,"Delete document")+": `"+R+"`] ",O=n.find(z=>{var W,ee;return((ee=(W=z.valueOwner)==null?void 0:W.declaration)==null?void 0:ee.id)===b.inputs.connection.id}),P=((s=O==null?void 0:O.value)==null?void 0:s.valueAsType)??((u=O==null?void 0:O.value)==null?void 0:u.value);if(!P||!P.id||!P.name||P.type!==r.DefinitionEntity)throw new Error(`${A}Invalid input "${Ve(O==null?void 0:O.valueOwner,g==null?void 0:g.logic,"Connection")}" (\`${Be(O==null?void 0:O.valueOwner,g==null?void 0:g.logic,"connection")}\`), expected a valid connection node.`);const x=ui(P);if(!x)throw new Error(`${A}The "${Ve(O==null?void 0:O.valueOwner,g==null?void 0:g.logic,"Connection")}" (\`${Be(O==null?void 0:O.valueOwner,g==null?void 0:g.logic,"connection")}\`) input is invalid, missing underlying Connection ID value.`);const $=n.find(z=>{var W,ee;return((ee=(W=z.valueOwner)==null?void 0:W.declaration)==null?void 0:ee.id)===b.inputs.documentId.id}),U=(e=$==null?void 0:$.value)==null?void 0:e.value;if(!U||U==="")throw new Error(`${A}The "${Ve($==null?void 0:$.valueOwner,g==null?void 0:g.logic,"Document ID")}" (\`${Be($==null?void 0:$.valueOwner,g==null?void 0:g.logic,"documentId")}\`) input is missing.`);if(typeof U!="string")throw new Error(`${A}The "${Ve($==null?void 0:$.valueOwner,g==null?void 0:g.logic,"Document ID")}" (\`${Be($==null?void 0:$.valueOwner,g==null?void 0:g.logic,"documentId")}\`) input value is invalid, if present, it must be a non-empty string.`);const Z=(y=(f=n.find(z=>{var W,ee;return((ee=(W=z.valueOwner)==null?void 0:W.declaration)==null?void 0:ee.id)===b.inputs.permanent.id}))==null?void 0:f.value)==null?void 0:y.value;ui(P);const H={Authorization:`Bearer ${await g.getAccessToken()}`},Y=`${((m=g.env)==null?void 0:m.API_BASE_URL)+"/editor-runtime"}/v2/external-integrations/proxy/${g.projectId}/${Zt["google-drive"]}/${x}`,ie=async(z,W,{params:ee,body:te,contentType:X,providerHeaders:re,responseType:ae}={})=>{const le=`${Y}/${iRn(W)}`,oe={...H};return X&&(oe["Content-Type"]=X),(re||ae)&&(oe[tRn]=JSON.stringify({...re?{headers:re}:{},...ae?{responseType:ae}:{}})),Ht({method:z,url:le,headers:oe,params:ee,data:te,responseType:ae||"json"})};return Z?await ie("DELETE",`/drive/v3/files/${U}`,{params:{supportsAllDrives:!0}}):await ie("PATCH",`/drive/v3/files/${U}`,{params:{supportsAllDrives:!0},body:{trashed:!0},contentType:"application/json"}),{value:K.Success,error:null,result:null}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return nRn(t,b)}}})}}const rRn="X-Elyx-Proxy-Config";function aRn(a){return a.startsWith("/")?a.slice(1):a}const sRn=(a,p)=>(pe.Logger.log("[Google Drive Create Permission] error:",p),{value:a.catchesError||a.errorCalls.length?K.CaughtError:K.UnhandledError,error:p,result:null});class LAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleDriveCreatePermission,version:"1.0.0",description:"Google Drive create permission operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleDriveCreatePermission);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A,O,P,x,$,U,Z;try{const q=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0],H=G.operation[J.GoogleDriveCreatePermission],Y=Be(t,t.project,"createPermission"),z="["+Ve(t,t.project,"Create permission")+": `"+Y+"`] ",W=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===H.inputs.connection.id}),ee=((s=W==null?void 0:W.value)==null?void 0:s.valueAsType)??((u=W==null?void 0:W.value)==null?void 0:u.value);if(!ee||!ee.id||!ee.name||ee.type!==r.DefinitionEntity)throw new Error(`${z}Invalid input "${Ve(W==null?void 0:W.valueOwner,q==null?void 0:q.logic,"Connection")}" (\`${Be(W==null?void 0:W.valueOwner,q==null?void 0:q.logic,"connection")}\`), expected a valid connection node.`);const te=ui(ee);if(!te)throw new Error(`${z}The "${Ve(W==null?void 0:W.valueOwner,q==null?void 0:q.logic,"Connection")}" (\`${Be(W==null?void 0:W.valueOwner,q==null?void 0:q.logic,"connection")}\`) input is invalid, missing underlying Connection ID value.`);const X=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===H.inputs.fileId.id}),re=(e=X==null?void 0:X.value)==null?void 0:e.value;if(!re||re==="")throw new Error(`${z}The "${Ve(X==null?void 0:X.valueOwner,q==null?void 0:q.logic,"File ID")}" (\`${Be(X==null?void 0:X.valueOwner,q==null?void 0:q.logic,"fileId")}\`) input is missing.`);if(typeof re!="string")throw new Error(`${z}The "${Ve(X==null?void 0:X.valueOwner,q==null?void 0:q.logic,"File ID")}" (\`${Be(X==null?void 0:X.valueOwner,q==null?void 0:q.logic,"fileId")}\`) input value is invalid, if present, it must be a non-empty string.`);const ae=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===H.inputs.role.id}),le=(f=ae==null?void 0:ae.value)==null?void 0:f.value;if(!le||le==="")throw new Error(`${z}The "${Ve(ae==null?void 0:ae.valueOwner,q==null?void 0:q.logic,"Role")}" (\`${Be(ae==null?void 0:ae.valueOwner,q==null?void 0:q.logic,"role")}\`) input is missing.`);if(typeof le!="string")throw new Error(`${z}The "${Ve(ae==null?void 0:ae.valueOwner,q==null?void 0:q.logic,"Role")}" (\`${Be(ae==null?void 0:ae.valueOwner,q==null?void 0:q.logic,"role")}\`) input value is invalid, if present, it must be a non-empty string.`);const oe=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===H.inputs.type.id}),ce=(y=oe==null?void 0:oe.value)==null?void 0:y.value;if(!ce||ce==="")throw new Error(`${z}The "${Ve(oe==null?void 0:oe.valueOwner,q==null?void 0:q.logic,"Type")}" (\`${Be(oe==null?void 0:oe.valueOwner,q==null?void 0:q.logic,"type")}\`) input is missing.`);if(typeof ce!="string")throw new Error(`${z}The "${Ve(oe==null?void 0:oe.valueOwner,q==null?void 0:q.logic,"Type")}" (\`${Be(oe==null?void 0:oe.valueOwner,q==null?void 0:q.logic,"type")}\`) input value is invalid, if present, it must be a non-empty string.`);const be=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===H.inputs.emailAddress.id}),Ce=(m=be==null?void 0:be.value)==null?void 0:m.value,Ee=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===H.inputs.domain.id}),Oe=(T=Ee==null?void 0:Ee.value)==null?void 0:T.value;if((ce==="user"||ce==="group")&&(!Ce||Ce.trim()===""))throw new Error(`${z}The "${Ve(be==null?void 0:be.valueOwner,q==null?void 0:q.logic,"Email address")}" (\`${Be(be==null?void 0:be.valueOwner,q==null?void 0:q.logic,"emailAddress")}\`) input is required when type is "${ce}".`);if(ce==="domain"&&(!Oe||Oe.trim()===""))throw new Error(`${z}The "${Ve(Ee==null?void 0:Ee.valueOwner,q==null?void 0:q.logic,"Domain")}" (\`${Be(Ee==null?void 0:Ee.valueOwner,q==null?void 0:q.logic,"domain")}\`) input is required when type is "domain".`);const Le=(b=(g=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===H.inputs.sendNotificationEmail.id}))==null?void 0:g.value)==null?void 0:b.value,Fe=(I=(R=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===H.inputs.emailMessage.id}))==null?void 0:R.value)==null?void 0:I.value,tt=(O=(A=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===H.inputs.allowFileDiscovery.id}))==null?void 0:A.value)==null?void 0:O.value,We=(x=(P=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===H.inputs.transferOwnership.id}))==null?void 0:P.value)==null?void 0:x.value;ui(ee);const qe={Authorization:`Bearer ${await q.getAccessToken()}`},ot=`${(($=q.env)==null?void 0:$.API_BASE_URL)+"/editor-runtime"}/v2/external-integrations/proxy/${q.projectId}/${Zt["google-drive"]}/${te}`,st=async(Je,ke,{params:lt,body:Pt,contentType:Gt,providerHeaders:si,responseType:pi}={})=>{const kt=`${ot}/${aRn(ke)}`,Ct={...qe};return Gt&&(Ct["Content-Type"]=Gt),(si||pi)&&(Ct[rRn]=JSON.stringify({...si?{headers:si}:{},...pi?{responseType:pi}:{}})),Ht({method:Je,url:kt,headers:Ct,params:lt,data:Pt,responseType:pi||"json"})},ft={supportsAllDrives:!0,fields:"id,type,role,emailAddress,domain,displayName"};Le!==void 0&&(ft.sendNotificationEmail=Le),Fe&&(ft.emailMessage=Fe),We!==void 0&&(ft.transferOwnership=We);const Et={role:le,type:ce};Ce&&(Et.emailAddress=Ce),Oe&&(Et.domain=Oe),tt!==void 0&&(Et.allowFileDiscovery=tt);const pt=await st("POST",`/drive/v3/files/${re}/permissions`,{params:ft,body:Et,contentType:"application/json"}),Me=((U=pt.data)==null?void 0:U.data)??pt.data;return{value:K.Success,error:null,result:{id:(Me==null?void 0:Me.id)??"",type:(Me==null?void 0:Me.type)??ce,role:(Me==null?void 0:Me.role)??le,emailAddress:(Me==null?void 0:Me.emailAddress)??Ce??"",domain:(Me==null?void 0:Me.domain)??Oe??"",displayName:(Me==null?void 0:Me.displayName)??""}}}catch(q){const H=((Z=q.response)==null?void 0:Z.data)||q.message||q;return sRn(t,typeof H=="object"?JSON.stringify(H):String(H))}}})}}const lRn="X-Elyx-Proxy-Config";function oRn(a){return a.startsWith("/")?a.slice(1):a}const dRn=(a,p)=>(pe.Logger.log("[Google Drive Delete Permission] error:",p),{value:a.catchesError||a.errorCalls.length?K.CaughtError:K.UnhandledError,error:p,result:null});class BAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleDriveDeletePermission,version:"1.0.0",description:"Google Drive delete permission operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleDriveDeletePermission);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0],g=G.operation[J.GoogleDriveDeletePermission],b=Be(t,t.project,"deletePermission"),I="["+Ve(t,t.project,"Delete permission")+": `"+b+"`] ",A=n.find(z=>{var W,ee;return((ee=(W=z.valueOwner)==null?void 0:W.declaration)==null?void 0:ee.id)===g.inputs.connection.id}),O=((s=A==null?void 0:A.value)==null?void 0:s.valueAsType)??((u=A==null?void 0:A.value)==null?void 0:u.value);if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${I}Invalid input "${Ve(A==null?void 0:A.valueOwner,T==null?void 0:T.logic,"Connection")}" (\`${Be(A==null?void 0:A.valueOwner,T==null?void 0:T.logic,"connection")}\`), expected a valid connection node.`);const P=ui(O);if(!P)throw new Error(`${I}The "${Ve(A==null?void 0:A.valueOwner,T==null?void 0:T.logic,"Connection")}" (\`${Be(A==null?void 0:A.valueOwner,T==null?void 0:T.logic,"connection")}\`) input is invalid, missing underlying Connection ID value.`);const x=n.find(z=>{var W,ee;return((ee=(W=z.valueOwner)==null?void 0:W.declaration)==null?void 0:ee.id)===g.inputs.fileId.id}),$=(e=x==null?void 0:x.value)==null?void 0:e.value;if(!$||$==="")throw new Error(`${I}The "${Ve(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"File ID")}" (\`${Be(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"fileId")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${I}The "${Ve(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"File ID")}" (\`${Be(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"fileId")}\`) input value is invalid, if present, it must be a non-empty string.`);const U=n.find(z=>{var W,ee;return((ee=(W=z.valueOwner)==null?void 0:W.declaration)==null?void 0:ee.id)===g.inputs.permissionId.id}),Z=(f=U==null?void 0:U.value)==null?void 0:f.value;if(!Z||Z==="")throw new Error(`${I}The "${Ve(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"Permission ID")}" (\`${Be(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"permissionId")}\`) input is missing.`);if(typeof Z!="string")throw new Error(`${I}The "${Ve(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"Permission ID")}" (\`${Be(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"permissionId")}\`) input value is invalid, if present, it must be a non-empty string.`);ui(O);const H={Authorization:`Bearer ${await T.getAccessToken()}`},Y=`${((y=T.env)==null?void 0:y.API_BASE_URL)+"/editor-runtime"}/v2/external-integrations/proxy/${T.projectId}/${Zt["google-drive"]}/${P}`;return await(async(z,W,{params:ee,body:te,contentType:X,providerHeaders:re,responseType:ae}={})=>{const le=`${Y}/${oRn(W)}`,oe={...H};return X&&(oe["Content-Type"]=X),(re||ae)&&(oe[lRn]=JSON.stringify({...re?{headers:re}:{},...ae?{responseType:ae}:{}})),Ht({method:z,url:le,headers:oe,params:ee,data:te,responseType:ae||"json"})})("DELETE",`/drive/v3/files/${$}/permissions/${Z}`,{params:{supportsAllDrives:!0}}),{value:K.Success,error:null,result:void 0}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return dRn(t,typeof g=="object"?JSON.stringify(g):String(g))}}})}}const pRn="X-Elyx-Proxy-Config";function uRn(a){return a.startsWith("/")?a.slice(1):a}const cRn=(a,p)=>(pe.Logger.log("[Google Drive List Permissions] error:",p),{value:a.catchesError||a.errorCalls.length?K.CaughtError:K.UnhandledError,error:p,result:null});class SAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleDriveListPermissions,version:"1.0.0",description:"Google Drive list permissions operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleDriveListPermissions);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R;try{const I=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0],A=G.operation[J.GoogleDriveListPermissions],O=Be(t,t.project,"listPermissions"),x="["+Ve(t,t.project,"List permissions")+": `"+O+"`] ",$=n.find(ce=>{var be,Ce;return((Ce=(be=ce.valueOwner)==null?void 0:be.declaration)==null?void 0:Ce.id)===A.inputs.connection.id}),U=((s=$==null?void 0:$.value)==null?void 0:s.valueAsType)??((u=$==null?void 0:$.value)==null?void 0:u.value);if(!U||!U.id||!U.name||U.type!==r.DefinitionEntity)throw new Error(`${x}Invalid input "${Ve($==null?void 0:$.valueOwner,I==null?void 0:I.logic,"Connection")}" (\`${Be($==null?void 0:$.valueOwner,I==null?void 0:I.logic,"connection")}\`), expected a valid connection node.`);const Z=ui(U);if(!Z)throw new Error(`${x}The "${Ve($==null?void 0:$.valueOwner,I==null?void 0:I.logic,"Connection")}" (\`${Be($==null?void 0:$.valueOwner,I==null?void 0:I.logic,"connection")}\`) input is invalid, missing underlying Connection ID value.`);const q=n.find(ce=>{var be,Ce;return((Ce=(be=ce.valueOwner)==null?void 0:be.declaration)==null?void 0:Ce.id)===A.inputs.fileId.id}),H=(e=q==null?void 0:q.value)==null?void 0:e.value;if(!H||H==="")throw new Error(`${x}The "${Ve(q==null?void 0:q.valueOwner,I==null?void 0:I.logic,"File ID")}" (\`${Be(q==null?void 0:q.valueOwner,I==null?void 0:I.logic,"fileId")}\`) input is missing.`);if(typeof H!="string")throw new Error(`${x}The "${Ve(q==null?void 0:q.valueOwner,I==null?void 0:I.logic,"File ID")}" (\`${Be(q==null?void 0:q.valueOwner,I==null?void 0:I.logic,"fileId")}\`) input value is invalid, if present, it must be a non-empty string.`);const Y=(y=(f=n.find(ce=>{var be,Ce;return((Ce=(be=ce.valueOwner)==null?void 0:be.declaration)==null?void 0:Ce.id)===A.inputs.pageSize.id}))==null?void 0:f.value)==null?void 0:y.value,ie=(T=(m=n.find(ce=>{var be,Ce;return((Ce=(be=ce.valueOwner)==null?void 0:be.declaration)==null?void 0:Ce.id)===A.inputs.pageToken.id}))==null?void 0:m.value)==null?void 0:T.value;ui(U);const W={Authorization:`Bearer ${await I.getAccessToken()}`},ee=`${((g=I.env)==null?void 0:g.API_BASE_URL)+"/editor-runtime"}/v2/external-integrations/proxy/${I.projectId}/${Zt["google-drive"]}/${Z}`,te=async(ce,be,{params:Ce,body:Ee,contentType:Oe,providerHeaders:Le,responseType:Fe}={})=>{const tt=`${ee}/${uRn(be)}`,We={...W};return Oe&&(We["Content-Type"]=Oe),(Le||Fe)&&(We[pRn]=JSON.stringify({...Le?{headers:Le}:{},...Fe?{responseType:Fe}:{}})),Ht({method:ce,url:tt,headers:We,params:Ce,data:Ee,responseType:Fe||"json"})},X={supportsAllDrives:!0,fields:"nextPageToken,permissions(id,type,role,emailAddress,domain,displayName)"};Y!=null&&(X.pageSize=Y),ie&&(X.pageToken=ie);const re=await te("GET",`/drive/v3/files/${H}/permissions`,{params:X}),ae=((b=re.data)==null?void 0:b.data)??re.data,oe=(Array.isArray(ae==null?void 0:ae.permissions)?ae.permissions:[]).map(ce=>({id:(ce==null?void 0:ce.id)??"",type:(ce==null?void 0:ce.type)??"",role:(ce==null?void 0:ce.role)??"",emailAddress:(ce==null?void 0:ce.emailAddress)??"",domain:(ce==null?void 0:ce.domain)??"",displayName:(ce==null?void 0:ce.displayName)??""}));return{value:K.Success,error:null,result:{permissions:oe,nextPageToken:(ae==null?void 0:ae.nextPageToken)??""}}}catch(I){const A=((R=I.response)==null?void 0:R.data)||I.message||I;return cRn(t,typeof A=="object"?JSON.stringify(A):String(A))}}})}}const fRn="X-Elyx-Proxy-Config";function yRn(a){return a.startsWith("/")?a.slice(1):a}const hRn=(a,p)=>(pe.Logger.log("[Google Drive Update Permission] error:",p),{value:a.catchesError||a.errorCalls.length?K.CaughtError:K.UnhandledError,error:p,result:null});class MAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleDriveUpdatePermission,version:"1.0.0",description:"Google Drive update permission operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleDriveUpdatePermission);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R;try{const I=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0],A=G.operation[J.GoogleDriveUpdatePermission],O=Be(t,t.project,"updatePermission"),x="["+Ve(t,t.project,"Update permission")+": `"+O+"`] ",$=n.find(be=>{var Ce,Ee;return((Ee=(Ce=be.valueOwner)==null?void 0:Ce.declaration)==null?void 0:Ee.id)===A.inputs.connection.id}),U=((s=$==null?void 0:$.value)==null?void 0:s.valueAsType)??((u=$==null?void 0:$.value)==null?void 0:u.value);if(!U||!U.id||!U.name||U.type!==r.DefinitionEntity)throw new Error(`${x}Invalid input "${Ve($==null?void 0:$.valueOwner,I==null?void 0:I.logic,"Connection")}" (\`${Be($==null?void 0:$.valueOwner,I==null?void 0:I.logic,"connection")}\`), expected a valid connection node.`);const Z=ui(U);if(!Z)throw new Error(`${x}The "${Ve($==null?void 0:$.valueOwner,I==null?void 0:I.logic,"Connection")}" (\`${Be($==null?void 0:$.valueOwner,I==null?void 0:I.logic,"connection")}\`) input is invalid, missing underlying Connection ID value.`);const q=n.find(be=>{var Ce,Ee;return((Ee=(Ce=be.valueOwner)==null?void 0:Ce.declaration)==null?void 0:Ee.id)===A.inputs.fileId.id}),H=(e=q==null?void 0:q.value)==null?void 0:e.value;if(!H||H==="")throw new Error(`${x}The "${Ve(q==null?void 0:q.valueOwner,I==null?void 0:I.logic,"File ID")}" (\`${Be(q==null?void 0:q.valueOwner,I==null?void 0:I.logic,"fileId")}\`) input is missing.`);if(typeof H!="string")throw new Error(`${x}The "${Ve(q==null?void 0:q.valueOwner,I==null?void 0:I.logic,"File ID")}" (\`${Be(q==null?void 0:q.valueOwner,I==null?void 0:I.logic,"fileId")}\`) input value is invalid, if present, it must be a non-empty string.`);const Y=n.find(be=>{var Ce,Ee;return((Ee=(Ce=be.valueOwner)==null?void 0:Ce.declaration)==null?void 0:Ee.id)===A.inputs.permissionId.id}),ie=(f=Y==null?void 0:Y.value)==null?void 0:f.value;if(!ie||ie==="")throw new Error(`${x}The "${Ve(Y==null?void 0:Y.valueOwner,I==null?void 0:I.logic,"Permission ID")}" (\`${Be(Y==null?void 0:Y.valueOwner,I==null?void 0:I.logic,"permissionId")}\`) input is missing.`);if(typeof ie!="string")throw new Error(`${x}The "${Ve(Y==null?void 0:Y.valueOwner,I==null?void 0:I.logic,"Permission ID")}" (\`${Be(Y==null?void 0:Y.valueOwner,I==null?void 0:I.logic,"permissionId")}\`) input value is invalid, if present, it must be a non-empty string.`);const z=n.find(be=>{var Ce,Ee;return((Ee=(Ce=be.valueOwner)==null?void 0:Ce.declaration)==null?void 0:Ee.id)===A.inputs.role.id}),W=(y=z==null?void 0:z.value)==null?void 0:y.value;if(!W||W==="")throw new Error(`${x}The "${Ve(z==null?void 0:z.valueOwner,I==null?void 0:I.logic,"Role")}" (\`${Be(z==null?void 0:z.valueOwner,I==null?void 0:I.logic,"role")}\`) input is missing.`);if(typeof W!="string")throw new Error(`${x}The "${Ve(z==null?void 0:z.valueOwner,I==null?void 0:I.logic,"Role")}" (\`${Be(z==null?void 0:z.valueOwner,I==null?void 0:I.logic,"role")}\`) input value is invalid, if present, it must be a non-empty string.`);const ee=(T=(m=n.find(be=>{var Ce,Ee;return((Ee=(Ce=be.valueOwner)==null?void 0:Ce.declaration)==null?void 0:Ee.id)===A.inputs.transferOwnership.id}))==null?void 0:m.value)==null?void 0:T.value;ui(U);const X={Authorization:`Bearer ${await I.getAccessToken()}`},re=`${((g=I.env)==null?void 0:g.API_BASE_URL)+"/editor-runtime"}/v2/external-integrations/proxy/${I.projectId}/${Zt["google-drive"]}/${Z}`,ae=async(be,Ce,{params:Ee,body:Oe,contentType:Le,providerHeaders:Fe,responseType:tt}={})=>{const We=`${re}/${yRn(Ce)}`,et={...X};return Le&&(et["Content-Type"]=Le),(Fe||tt)&&(et[fRn]=JSON.stringify({...Fe?{headers:Fe}:{},...tt?{responseType:tt}:{}})),Ht({method:be,url:We,headers:et,params:Ee,data:Oe,responseType:tt||"json"})},le={supportsAllDrives:!0,fields:"id,type,role,emailAddress,domain,displayName"};ee!=null&&(le.transferOwnership=ee);const oe=await ae("PATCH",`/drive/v3/files/${H}/permissions/${ie}`,{params:le,body:{role:W},contentType:"application/json"}),ce=((b=oe.data)==null?void 0:b.data)??oe.data;return{value:K.Success,error:null,result:{id:(ce==null?void 0:ce.id)??ie,type:(ce==null?void 0:ce.type)??"",role:(ce==null?void 0:ce.role)??W,emailAddress:(ce==null?void 0:ce.emailAddress)??"",domain:(ce==null?void 0:ce.domain)??"",displayName:(ce==null?void 0:ce.displayName)??""}}}catch(I){const A=((R=I.response)==null?void 0:R.data)||I.message||I;return hRn(t,typeof A=="object"?JSON.stringify(A):String(A))}}})}}class FAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleGeminiGenerateContent,version:"1.0.0",description:"Send Gmail email operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleGeminiGenerateContent);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0],g=Be(t,t.project,"generateContent"),R="["+Ve(t,t.project,"Generate content")+": `"+g+"`] ",I=G.operation[J.GoogleGeminiGenerateContent],A=n.find(H=>{var Y,ie;return((ie=(Y=H.valueOwner)==null?void 0:Y.declaration)==null?void 0:ie.id)===I.inputs.connection.id}),O=((s=A==null?void 0:A.value)==null?void 0:s.valueAsType)??((u=A==null?void 0:A.value)==null?void 0:u.value);if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${R}Invalid input "${Ve(A==null?void 0:A.valueOwner,T==null?void 0:T.logic,"Connection")}" (\`${Be(A==null?void 0:A.valueOwner,T==null?void 0:T.logic,"connection")}\`), expected a valid connection node.`);const P=ui(O);if(!P)throw new Error(`${R}The "${Ve(A==null?void 0:A.valueOwner,T==null?void 0:T.logic,"Connection")}" (\`${Be(A==null?void 0:A.valueOwner,T==null?void 0:T.logic,"connection")}\`) input is invalid, missing underlying Connection ID value.`);const x=n.find(H=>{var Y,ie;return((ie=(Y=H.valueOwner)==null?void 0:Y.declaration)==null?void 0:ie.id)===I.inputs.prompt.id}),$=(e=x==null?void 0:x.value)==null?void 0:e.value;if($==null||$==="")throw new Error(`${R}The "${Ve(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"Prompt")}" (\`${Be(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"prompt")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${R}The "${Ve(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"Prompt")}" (\`${Be(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"prompt")}\`) input value is invalid, if present, it must be a non-empty string.`);const U=n.find(H=>{var Y,ie;return((ie=(Y=H.valueOwner)==null?void 0:Y.declaration)==null?void 0:ie.id)===I.inputs.model.id}),Z=(f=U==null?void 0:U.value)==null?void 0:f.value;if(Z==null||Z==="")throw new Error(`${R}The "${Ve(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"Model")}" (\`${Be(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"model")}\`) input is missing.`);if(typeof Z!="string")throw new Error(`${R}The "${Ve(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"Model")}" (\`${Be(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"model")}\`) input value is invalid, if present, it must be a non-empty string.`);ui(O),console.log("Triggering Google Gemini generate content action with connectionId:",P);const q=await(await Ht.post(`${(y=T.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v1/external-integrations/trigger-action/${Zt["google-gemini"]}/${P}/generate-content`,{payload:{prompt:$,model:Z}},{headers:{"Content-Type":"application/json",Authorization:`Bearer ${await T.getAccessToken()}`}})).data;return pe.Logger.log("[Google Gemini] Generate content action response:",q),{value:K.Success,error:null,result:{content:q.content}}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return pe.Logger.error("[Google Gemini] Generate content failed:",g),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:g,result:null}}}})}}class kAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsCreateSpreadsheet,version:"1.0.0",description:"Create Spreadsheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsCreateSpreadsheet);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f;try{const y=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!y||!y.env)throw new Error("Editor context or environment missing");const m=Be(t,t.project,"createSpreadsheet"),g="["+Ve(t,t.project,"Create spreadsheet")+": `"+m+"`] ",b=(ie,z,W)=>{const ee=Ve(ie==null?void 0:ie.valueOwner,y==null?void 0:y.logic,z),te=Be(ie==null?void 0:ie.valueOwner,y==null?void 0:y.logic,W);return`"${ee}" (\`${te}\`)`},R=n.find(ie=>{var z;return((z=ie.valueOwner.declaration)==null?void 0:z.id)===G.operation[J.GoogleSheetsCreateSpreadsheet].inputs.connection.id}),I=(s=R==null?void 0:R.value)==null?void 0:s.valueAsType;if(!I||!I.id||!I.name||I.type!==r.DefinitionEntity)throw new Error(`${g}The ${b(R,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const A=ui(I);if(!A)throw new Error(`${g}The ${b(R,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const O=n.find(ie=>{var z;return((z=ie.valueOwner.declaration)==null?void 0:z.id)===G.operation[J.GoogleSheetsCreateSpreadsheet].inputs.title.id}),P=(u=O==null?void 0:O.value)==null?void 0:u.value;if(P&&typeof P!="string")throw new Error(`${g}The ${b(O,"Title","title")} input value is invalid. If present, it must be a non-empty string. E.g. "My Spreadsheet"`);const $={Authorization:`Bearer ${await y.getAccessToken()}`},U=`${(e=y.env)==null?void 0:e.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${y.projectId}/${Zt["google-sheet"]}/${A}`,Z=async ie=>Ht.post(U,ie,{headers:$}),q={};P&&(q.properties={title:P});const Y=(await Z({method:"POST",endpoint:"/v4/spreadsheets",data:q})).data||{};return{value:K.Success,error:null,result:{spreadsheetId:Y.spreadsheetId,spreadsheetUrl:Y.spreadsheetUrl}}}catch(y){const m=((f=y.response)==null?void 0:f.data)||y.message||y;return pe.Logger.log("[Google Sheets] error:",m),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:m,result:null}}}})}}function zL(a){let p="",t=a;for(;t>0;){const n=(t-1)%26;p=String.fromCharCode(65+n)+p,t=Math.floor((t-n)/26)}return p}function IV(a){if(!/^[A-Z]{1,3}$/.test(a))return NaN;let p=0;for(let t=0;t<a.length;t++)p=p*26+(a.charCodeAt(t)-64);return p}function cA(a,p){const t=(p==null?void 0:p.errorPrefix)||"";if(typeof a!="string")throw new Error(`${t}Input must be a string.`);let n,s=a;if(a.includes("!")){const R=a.split("!");let I=R.slice(0,-1).join("!");s=R[R.length-1],I.startsWith("'")&&I.endsWith("'")&&(I=I.slice(1,-1)),n=I}const u=/^(\$?[A-Z]{1,3})?(\$?\d+)?(?::(\$?[A-Z]{1,3})?(\$?\d+)?)?$/i,e=s.match(u);if(!e)throw new Error(`${t}Invalid A1 notation format: ${a}`);const[f,y,m,T,g]=e,b={sheet:n};return y&&(b.startColumn=y.toUpperCase()),m&&(b.startRow=m),T&&(b.endColumn=T.toUpperCase()),g&&(b.endRow=g),b}function B4(a,p){const t=p!=null&&p.errorPrefix?p.errorPrefix:"",n=T=>{if(typeof T=="string"){const g=T.replace("$","");return/^\d+$/.test(g)?parseInt(g,10):NaN}return T},s=T=>{if(typeof T=="string"){const g=T.replace("$","").toUpperCase();return/^\d+$/.test(g)?parseInt(g,10):IV(g)}return T},u=n(a.startRow),e=n(a.endRow),f=s(a.startColumn),y=s(a.endColumn),m=T=>typeof T=="string"&&T.includes("{{")&&T.includes("}}");if(a.startRow!==void 0&&a.startRow!==null&&a.startRow!==""&&isNaN(u)&&!m(a.startRow))throw new Error(`${t}Start Row is invalid.`);if(a.endRow!==void 0&&a.endRow!==null&&a.endRow!==""&&isNaN(e)&&!m(a.endRow))throw new Error(`${t}End Row is invalid.`);if(a.startColumn!==void 0&&a.startColumn!==null&&a.startColumn!==""&&isNaN(f)&&!m(a.startColumn))throw new Error(`${t}Start Column is invalid.`);if(a.endColumn!==void 0&&a.endColumn!==null&&a.endColumn!==""&&isNaN(y)&&!m(a.endColumn))throw new Error(`${t}End Column is invalid.`);if(u!=null&&!isNaN(u)&&u<1)throw new Error(`${t}Start Row must be greater than or equal to 1.`);if(e!=null&&!isNaN(e)&&e<1)throw new Error(`${t}End Row must be greater than or equal to 1.`);if(f!=null&&!isNaN(f)&&f<1)throw new Error(`${t}Start Column must be greater than or equal to 1.`);if(y!=null&&!isNaN(y)&&y<1)throw new Error(`${t}End Column must be greater than or equal to 1.`);if(u!=null&&!isNaN(u)&&e!==void 0&&e!==null&&!isNaN(e)&&u>e)throw new Error(`${t}Start Row must be less than or equal to End Row.`);if(f!=null&&!isNaN(f)&&y!==void 0&&y!==null&&!isNaN(y)&&f>y)throw new Error(`${t}Start Column must be less than or equal to End Column.`);if(typeof a.sheet=="number"&&a.sheet<0)throw new Error(`${t}Sheet ID must be greater than or equal to 0.`)}async function Ha(a,p,t){if(!a)return a;let n=a;if(typeof a=="string"){const f=a.trim();if(f.startsWith("{"))try{n=new Function("return "+f)()}catch{try{n=JSON.parse(f)}catch{}}else try{n=cA(f,{errorPrefix:"Internal"})}catch{}}else if(typeof a=="object"&&a!==null)try{n=JSON.parse(JSON.stringify(a))}catch{n={...a}}if(n.sheet===void 0||n.sheet===null||n.sheet==="")return n;const s=typeof n.sheet=="string",u=typeof n.sheet=="number";if(p==="Name"&&s)return n;if(p==="Id"&&u)return n._resolvedSheetId=n.sheet,n;const e=n.sheet;try{const f=await t();for(const y of f){const m=y.id,T=y.name,g=String(T).trim().toLowerCase()===String(e).trim().toLowerCase(),b=String(m)===String(e);if(g||b)return n._resolvedSheetId=m,n._resolvedSheetName=T,n}}catch{}return n}function lv(a,p){if(!a)return"";if(typeof a=="string")return a;let t=a;if(typeof a=="string"&&a.trim().startsWith("{"))try{t=JSON.parse(a)}catch{}if(B4(t,p),t.namedRange&&t.namedRange.trim()!=="")return t.namedRange;const n=t._resolvedSheetName!==void 0?t._resolvedSheetName:typeof t.sheet=="string"?t.sheet:void 0,s=n?`'${n}'!`:"",u=R=>{if(typeof R=="number")return zL(R);if(typeof R=="string"){const I=R.replace("$","");if(/^\d+$/.test(I))return(R.startsWith("$")?"$":"")+zL(parseInt(I,10))}return R||""},e=u(t.startColumn),f=typeof t.startRow=="number"?t.startRow.toString():t.startRow||"",y=u(t.endColumn),m=typeof t.endRow=="number"?t.endRow.toString():t.endRow||"",T=`${e}${f}`,g=`${y}${m}`;if(T&&g)return`${s}${T}:${g}`;if(T)return`${s}${T}`;const b=s.replace(/!$/,"");return b||"A1"}function ps(a,p){if(!a)return{};let t=a;if(typeof a=="string"){const g=a.trim();if(g.startsWith("{"))try{t=new Function("return "+g)()}catch{try{t=JSON.parse(g)}catch{}}else try{t=cA(g,p)}catch{}}B4(t,p);const n={},s=t._resolvedSheetId!==void 0?t._resolvedSheetId:typeof t.sheet=="number"?t.sheet:/^\d+$/.test(String(t.sheet||""))?Number(t.sheet):void 0;s!=null&&!isNaN(s)&&(n.sheetId=s);const u=g=>{if(g==null)return null;if(typeof g=="string"){const b=g.trim().replace("$","");return b===""?null:/^\d+$/.test(b)?parseInt(b,10):NaN}return typeof g=="number"?g:null},e=g=>{if(g==null)return null;if(typeof g=="string"){const b=g.trim().replace("$","").toUpperCase();return b===""?null:/^\d+$/.test(b)?parseInt(b,10):IV(b)}return typeof g=="number"?g:null},f=u(t.startRow),y=u(t.endRow),m=e(t.startColumn),T=e(t.endColumn);return f!=null&&(n.startRowIndex=f-1),y!=null&&(n.endRowIndex=y),m!=null&&(n.startColumnIndex=m-1),T!=null&&(n.endColumnIndex=T),n}function YL(a,p){if(!a)return{};let t=a;if(typeof a=="string")if(a.trim().startsWith("{"))try{t=JSON.parse(a)}catch{t=cA(a,{errorPrefix:"Internal"})}else t=cA(a,{errorPrefix:"Internal"});B4(t,p);const n={},s=t._resolvedSheetId!==void 0?t._resolvedSheetId:typeof t.sheet=="number"?t.sheet:void 0;s!=null&&(n.sheetId=s);const u=g=>{if(g==null)return null;if(typeof g=="string"){const b=g.trim().replace("$","");return b===""?null:/^\d+$/.test(b)?parseInt(b,10):NaN}return typeof g=="number"?g:null},e=g=>{if(g==null)return null;if(typeof g=="string"){const b=g.trim().replace("$","").toUpperCase();return b===""?null:/^\d+$/.test(b)?parseInt(b,10):IV(b)}return typeof g=="number"?g:null},f=u(t.startRow),y=u(t.endRow),m=e(t.startColumn),T=e(t.endColumn);return f!=null&&(!isNaN(f)||y===null&&m===null&&T===null)?(n.dimension="ROWS",n.startIndex=isNaN(f)?NaN:f-1,y!=null?n.endIndex=y:n.endIndex=isNaN(f)?NaN:f):m!=null?(n.dimension="COLUMNS",n.startIndex=isNaN(m)?NaN:m-1,T!=null?n.endIndex=T:n.endIndex=isNaN(m)?NaN:m):f!=null&&(n.dimension="ROWS",n.startIndex=isNaN(f)?NaN:f-1,y!=null?n.endIndex=y:n.endIndex=isNaN(f)?NaN:f),n}function ln(a,p){const t=(p==null?void 0:p.errorPrefix)||"";if(typeof a!="string")throw new Error(`${t}Spreadsheet ID must be a string.`);const n=a.trim();if(n.length===0)throw new Error(`${t}Spreadsheet ID cannot be empty.`);if(n.includes("docs.google.com")||n.startsWith("http://")||n.startsWith("https://")||n.startsWith("www.google.com")){const u=n.match(/\/spreadsheets\/d\/e\/([a-zA-Z0-9-_]+)/);if(u&&u[1])return u[1];const e=n.match(/\/spreadsheets\/d\/([a-zA-Z0-9-_]+)/);if(e&&e[1])return e[1];throw new Error(`${t}Invalid Google Sheet URL format. Could not extract a valid Spreadsheet ID from the URL.`)}if(n.includes(" "))throw new Error(`${t}Spreadsheet ID cannot contain spaces.`);if(/[^a-zA-Z0-9-_]/.test(n))throw new Error(`${t}Spreadsheet ID contains invalid characters. Only alphanumeric characters, dashes, and underscores are allowed.`);return n}function UAt(a){if(!a)return"A1";const p=lv(a);if(!p)return"A1";const t=p.split("!");return t[t.length-1].trim().split(":")[0].trim().replace(/\$/g,"")||"A1"}function S4(a,p,t){if(!p){const f=YL(a,t);return f?[f]:[]}const n=ps(a,t),s=n.sheetId,u=f=>{const y={dimension:f};return s!=null&&(y.sheetId=s),f==="COLUMNS"?(n.startColumnIndex!==void 0&&n.startColumnIndex!==null&&(y.startIndex=n.startColumnIndex),n.endColumnIndex!==void 0&&n.endColumnIndex!==null&&(y.endIndex=n.endColumnIndex)):(n.startRowIndex!==void 0&&n.startRowIndex!==null&&(y.startIndex=n.startRowIndex),n.endRowIndex!==void 0&&n.endRowIndex!==null&&(y.endIndex=n.endRowIndex)),y},e=String(p).trim().toUpperCase();return e==="COLUMNS"?[u("COLUMNS")]:e==="ROWS"?[u("ROWS")]:e==="BOTH"?[u("COLUMNS"),u("ROWS")]:[YL(a,t)]}class KAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsGetSpreadsheet,version:"1.0.0",description:"Get Spreadsheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsGetSpreadsheet);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g;try{const b=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!b||!b.env)throw new Error("Editor context or environment missing");const R=Be(t,t.project,"getSpreadsheet"),A="["+Ve(t,t.project,"Get spreadsheet")+": `"+R+"`] ",O=(X,re,ae)=>{const le=Ve(X==null?void 0:X.valueOwner,b==null?void 0:b.logic,re),oe=Be(X==null?void 0:X.valueOwner,b==null?void 0:b.logic,ae);return`"${le}" (\`${oe}\`)`},P=n.find(X=>{var re;return((re=X.valueOwner.declaration)==null?void 0:re.id)===G.operation[J.GoogleSheetsGetSpreadsheet].inputs.connection.id}),x=(s=P==null?void 0:P.value)==null?void 0:s.valueAsType;if(!x||!x.id||!x.name||x.type!==r.DefinitionEntity)throw new Error(`${A}The ${O(P,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const $=ui(x);if(!$)throw new Error(`${A}The ${O(P,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const U=n.find(X=>{var re;return((re=X.valueOwner.declaration)==null?void 0:re.id)===G.operation[J.GoogleSheetsGetSpreadsheet].inputs.spreadsheetId.id}),Z=(u=U==null?void 0:U.value)==null?void 0:u.value,q=ln(Z,{errorPrefix:`${A}The ${O(U,"Spreadsheet ID","spreadsheetId")} input `}),Y={Authorization:`Bearer ${await b.getAccessToken()}`},ie=`${(e=b.env)==null?void 0:e.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${b.projectId}/${Zt["google-sheet"]}/${$}`,ee=(await(async X=>Ht.post(ie,X,{headers:Y}))({method:"GET",endpoint:`/v4/spreadsheets/${q}`})).data||{},te=(ee.sheets||[]).map(X=>{var re,ae,le,oe,ce,be,Ce,Ee,Oe,Le,Fe,tt,We;return{sheetId:(re=X.properties)==null?void 0:re.sheetId,title:(ae=X.properties)==null?void 0:ae.title,index:(le=X.properties)==null?void 0:le.index,sheetType:(oe=X.properties)==null?void 0:oe.sheetType,rowCount:(be=(ce=X.properties)==null?void 0:ce.gridProperties)==null?void 0:be.rowCount,columnCount:(Ee=(Ce=X.properties)==null?void 0:Ce.gridProperties)==null?void 0:Ee.columnCount,frozenRowCount:(Le=(Oe=X.properties)==null?void 0:Oe.gridProperties)==null?void 0:Le.frozenRowCount,frozenColumnCount:(tt=(Fe=X.properties)==null?void 0:Fe.gridProperties)==null?void 0:tt.frozenColumnCount,hidden:((We=X.properties)==null?void 0:We.hidden)??!1}});return{value:K.Success,error:null,result:{spreadsheetId:ee.spreadsheetId,title:(f=ee.properties)==null?void 0:f.title,spreadsheetUrl:ee.spreadsheetUrl,locale:(y=ee.properties)==null?void 0:y.locale,timeZone:(m=ee.properties)==null?void 0:m.timeZone,autoRecalc:(T=ee.properties)==null?void 0:T.autoRecalc,sheets:te}}}catch(b){const R=((g=b.response)==null?void 0:g.data)||b.message||b;return pe.Logger.log("[Google Sheets] error:",R),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:R,result:null}}}})}}class jAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsAddSheet,version:"1.0.0",description:"Add Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsAddSheet);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g;try{const b=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!b||!b.env)throw new Error("Editor context or environment missing");const R=Be(t,t.project,"addSheet"),A="["+Ve(t,t.project,"Add sheet")+": `"+R+"`] ",O=(oe,ce,be)=>{const Ce=Ve(oe==null?void 0:oe.valueOwner,b==null?void 0:b.logic,ce),Ee=Be(oe==null?void 0:oe.valueOwner,b==null?void 0:b.logic,be);return`"${Ce}" (\`${Ee}\`)`},P=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[J.GoogleSheetsAddSheet].inputs.connection.id}),x=(s=P==null?void 0:P.value)==null?void 0:s.valueAsType;if(!x||!x.id||!x.name||x.type!==r.DefinitionEntity)throw new Error(`${A}The ${O(P,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const $=ui(x);if(!$)throw new Error(`${A}The ${O(P,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const U=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[J.GoogleSheetsAddSheet].inputs.spreadsheetId.id}),Z=(u=U==null?void 0:U.value)==null?void 0:u.value,q=ln(Z,{errorPrefix:`${A}The ${O(U,"Spreadsheet ID","spreadsheetId")} input `}),H=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[J.GoogleSheetsAddSheet].inputs.title.id}),Y=(e=H==null?void 0:H.value)==null?void 0:e.value;if(Y!=null&&typeof Y!="string")throw new Error(`${A}The ${O(H,"Title","title")} input value is invalid. If present, it must be a string. E.g. "New Sheet"`);const z={Authorization:`Bearer ${await b.getAccessToken()}`},W=`${(f=b.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${b.projectId}/${Zt["google-sheet"]}/${$}`,re=((T=(m=(y=((await(async oe=>Ht.post(W,oe,{headers:z}))({method:"POST",endpoint:`/v4/spreadsheets/${q}:batchUpdate`,data:{requests:[{addSheet:{properties:{title:Y}}}]}})).data||{}).replies)==null?void 0:y[0])==null?void 0:m.addSheet)==null?void 0:T.properties)||{},ae=re.gridProperties||{},le={sheetId:re.sheetId,title:re.title,index:re.index,sheetType:re.sheetType,rowCount:ae.rowCount,columnCount:ae.columnCount,frozenRowCount:ae.frozenRowCount,frozenColumnCount:ae.frozenColumnCount,hideGridlines:ae.hideGridlines??!1,rowGroupControlAfter:ae.rowGroupControlAfter??!1,columnGroupControlAfter:ae.columnGroupControlAfter??!1,hidden:re.hidden??!1,rightToLeft:re.rightToLeft??!1,tabColor:re.tabColor?{red:re.tabColor.red??0,green:re.tabColor.green??0,blue:re.tabColor.blue??0,alpha:re.tabColor.alpha??1}:null,basicFilter:null,protectedRanges:[],bandedRanges:[],charts:[],conditionalFormatRules:[],mergedCells:[]};return{value:K.Success,error:null,result:le}}catch(b){const R=((g=b.response)==null?void 0:g.data)||b.message||b;return pe.Logger.log("[Google Sheets] error:",R),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:R,result:null}}}})}}class qAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsDeleteSheet,version:"1.0.0",description:"Delete Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsDeleteSheet);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T;try{const g=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!g||!g.env)throw new Error("Editor context or environment missing");const b=Be(t,t.project,"deleteSheet"),I="["+Ve(t,t.project,"Delete sheet")+": `"+b+"`] ",A=(te,X,re)=>{const ae=Ve(te==null?void 0:te.valueOwner,g==null?void 0:g.logic,X),le=Be(te==null?void 0:te.valueOwner,g==null?void 0:g.logic,re);return`"${ae}" (\`${le}\`)`},O=n.find(te=>{var X;return((X=te.valueOwner.declaration)==null?void 0:X.id)===G.operation[J.GoogleSheetsDeleteSheet].inputs.connection.id}),P=(s=O==null?void 0:O.value)==null?void 0:s.valueAsType;if(!P||!P.id||!P.name||P.type!==r.DefinitionEntity)throw new Error(`${I}The ${A(O,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=ui(P);if(!x)throw new Error(`${I}The ${A(O,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const $=n.find(te=>{var X;return((X=te.valueOwner.declaration)==null?void 0:X.id)===G.operation[J.GoogleSheetsDeleteSheet].inputs.spreadsheetId.id}),U=(u=$==null?void 0:$.value)==null?void 0:u.value,Z=ln(U,{errorPrefix:`${I}The ${A($,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(te=>{var X;return((X=te.valueOwner.declaration)==null?void 0:X.id)===G.operation[J.GoogleSheetsDeleteSheet].inputs.sheetId.id}),H=(e=q==null?void 0:q.value)==null?void 0:e.value;if(H==null||H==="")throw new Error(`${I}The ${A(q,"Sheet (ID or name)","sheetId")} input is missing.`);const ie={Authorization:`Bearer ${await g.getAccessToken()}`},z=`${(f=g.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${g.projectId}/${Zt["google-sheet"]}/${x}`,W=async te=>Ht.post(z,te,{headers:ie});let ee;if(typeof H=="number")ee=H;else if(typeof H=="string"){const te=H.trim(),X=await W({method:"GET",endpoint:`/v4/spreadsheets/${Z}?fields=sheets.properties(sheetId,title)`}).catch(()=>null),ae=(((y=X==null?void 0:X.data)==null?void 0:y.sheets)||[]).find(le=>{var oe,ce;return((oe=le.properties)==null?void 0:oe.title)===te||String((ce=le.properties)==null?void 0:ce.sheetId)===te});if(ae&&((m=ae.properties)==null?void 0:m.sheetId)!==void 0)ee=ae.properties.sheetId;else if(/^\d+$/.test(te))ee=parseInt(te,10);else throw new Error(`${I}Sheet "${H}" was not found in the spreadsheet.`)}else throw new Error(`${I}The ${A(q,"Sheet (ID or name)","sheetId")} input value is invalid. It must be a number or string.`);return await W({method:"POST",endpoint:`/v4/spreadsheets/${Z}:batchUpdate`,data:{requests:[{deleteSheet:{sheetId:ee}}]}}),{value:K.Success,error:null,result:null}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return pe.Logger.log("[Google Sheets] error:",b),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:b,result:null}}}})}}class ZAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsAppendRows,version:"1.0.0",description:"Append Row(s) Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsAppendRows);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T;try{const g=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!g||!g.env)throw new Error("Editor context or environment missing");const b=Be(t,t.project,"appendRows"),I="["+Ve(t,t.project,"Append rows")+": `"+b+"`] ",A=(oe,ce,be)=>{const Ce=Ve(oe==null?void 0:oe.valueOwner,g==null?void 0:g.logic,ce),Ee=Be(oe==null?void 0:oe.valueOwner,g==null?void 0:g.logic,be);return`"${Ce}" (\`${Ee}\`)`},O=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[J.GoogleSheetsAppendRows].inputs.connection.id}),P=(s=O==null?void 0:O.value)==null?void 0:s.valueAsType;if(!P||!P.id||!P.name||P.type!==r.DefinitionEntity)throw new Error(`${I}The ${A(O,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=ui(P);if(!x)throw new Error(`${I}The ${A(O,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const $=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[J.GoogleSheetsAppendRows].inputs.spreadsheetId.id}),U=(u=$==null?void 0:$.value)==null?void 0:u.value,Z=ln(U,{errorPrefix:`${I}The ${A($,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[J.GoogleSheetsAppendRows].inputs.range.id}),H=(e=q==null?void 0:q.value)==null?void 0:e.value;if(!H||H==="")throw new Error(`${I}The ${A(q,"Range","range")} input is missing.`);const Y=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[J.GoogleSheetsAppendRows].inputs.values.id}),ie=(f=Y==null?void 0:Y.value)==null?void 0:f.value;if(ie==null)throw new Error(`${I}The ${A(Y,"Values","values")} input is missing.`);const W={Authorization:`Bearer ${await g.getAccessToken()}`},ee=`${(y=g.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${g.projectId}/${Zt["google-sheet"]}/${x}`,te=async oe=>Ht.post(ee,oe,{headers:W});let X=ie;if(typeof ie=="string")try{X=JSON.parse(ie)}catch{}const re=await Ha(H,"Name",async()=>{var ce;return(((ce=(await te({method:"GET",endpoint:`/v4/spreadsheets/${Z}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:ce.sheets)||[]).map(be=>{var Ce,Ee;return{id:(Ce=be.properties)==null?void 0:Ce.sheetId,name:(Ee=be.properties)==null?void 0:Ee.title}})}),le=(await te({method:"POST",endpoint:`/v4/spreadsheets/${Z}/values/${lv(re,{errorPrefix:`${I}The ${A(q,"Range","range")} input `})}:append`,params:{valueInputOption:"USER_ENTERED"},data:{values:Array.isArray(X)?X:[X]}})).data||{};return{value:K.Success,error:null,result:{updatedRange:(m=le.updates)==null?void 0:m.updatedRange}}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return pe.Logger.log("[Google Sheets] error:",b),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:b,result:null}}}})}}class HAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsGetRangeValues,version:"1.0.0",description:"Get Range Values Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsGetRangeValues);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"getRangeValues"),b="["+Ve(t,t.project,"Get range values")+": `"+T+"`] ",R=(X,re,ae)=>{const le=Ve(X==null?void 0:X.valueOwner,m==null?void 0:m.logic,re),oe=Be(X==null?void 0:X.valueOwner,m==null?void 0:m.logic,ae);return`"${le}" (\`${oe}\`)`},I=n.find(X=>{var re;return((re=X.valueOwner.declaration)==null?void 0:re.id)===G.operation[J.GoogleSheetsGetRangeValues].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(A);if(!O)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(X=>{var re;return((re=X.valueOwner.declaration)==null?void 0:re.id)===G.operation[J.GoogleSheetsGetRangeValues].inputs.spreadsheetId.id}),x=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(x,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(X=>{var re;return((re=X.valueOwner.declaration)==null?void 0:re.id)===G.operation[J.GoogleSheetsGetRangeValues].inputs.range.id}),Z=(e=U==null?void 0:U.value)==null?void 0:e.value;if(!Z||Z==="")throw new Error(`${b}The ${R(U,"Range","range")} input is missing.`);const H={Authorization:`Bearer ${await m.getAccessToken()}`},Y=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${O}`,ie=async X=>Ht.post(Y,X,{headers:H}),z=await Ha(Z,"Name",async()=>{var re;return(((re=(await ie({method:"GET",endpoint:`/v4/spreadsheets/${$}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:re.sheets)||[]).map(ae=>{var le,oe;return{id:(le=ae.properties)==null?void 0:le.sheetId,name:(oe=ae.properties)==null?void 0:oe.title}})}),W=lv(z,{errorPrefix:`${b}The ${R(U,"Range","range")} input `}),te=(await ie({method:"GET",endpoint:`/v4/spreadsheets/${$}/values/${encodeURIComponent(W)}`})).data||{};return{value:K.Success,error:null,result:{values:te.values}}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class WAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsUpdateRangeValues,version:"1.0.0",description:"Update Range Values Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsUpdateRangeValues);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=Be(t,t.project,"updateRangeValues"),R="["+Ve(t,t.project,"Update range values")+": `"+g+"`] ",I=(le,oe,ce)=>{const be=Ve(le==null?void 0:le.valueOwner,T==null?void 0:T.logic,oe),Ce=Be(le==null?void 0:le.valueOwner,T==null?void 0:T.logic,ce);return`"${be}" (\`${Ce}\`)`},A=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[J.GoogleSheetsUpdateRangeValues].inputs.connection.id}),O=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${R}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const P=ui(O);if(!P)throw new Error(`${R}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[J.GoogleSheetsUpdateRangeValues].inputs.spreadsheetId.id}),$=(u=x==null?void 0:x.value)==null?void 0:u.value,U=ln($,{errorPrefix:`${R}The ${I(x,"Spreadsheet ID","spreadsheetId")} input `}),Z=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[J.GoogleSheetsUpdateRangeValues].inputs.range.id}),q=(e=Z==null?void 0:Z.value)==null?void 0:e.value;if(!q||q==="")throw new Error(`${R}The ${I(Z,"Range","range")} input is missing.`);const H=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[J.GoogleSheetsUpdateRangeValues].inputs.values.id}),Y=(f=H==null?void 0:H.value)==null?void 0:f.value;if(Y==null)throw new Error(`${R}The ${I(H,"Values","values")} input is missing.`);const z={Authorization:`Bearer ${await T.getAccessToken()}`},W=`${(y=T.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${T.projectId}/${Zt["google-sheet"]}/${P}`,ee=async le=>Ht.post(W,le,{headers:z});let te=Y;if(typeof Y=="string")try{te=JSON.parse(Y)}catch{}const X=await Ha(q,"Name",async()=>{var oe;return(((oe=(await ee({method:"GET",endpoint:`/v4/spreadsheets/${U}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:oe.sheets)||[]).map(ce=>{var be,Ce;return{id:(be=ce.properties)==null?void 0:be.sheetId,name:(Ce=ce.properties)==null?void 0:Ce.title}})}),ae=(await ee({method:"PUT",endpoint:`/v4/spreadsheets/${U}/values/${lv(X,{errorPrefix:`${R}The ${I(Z,"Range","range")} input `})}`,params:{valueInputOption:"USER_ENTERED"},data:{values:Array.isArray(te)?te:[te]}})).data||{};return{value:K.Success,error:null,result:{updatedRange:ae.updatedRange}}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return pe.Logger.log("[Google Sheets] error:",g),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:g,result:null}}}})}}class zAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsClearRange,version:"1.0.0",description:"Clear Range Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsClearRange);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"clearRange"),b="["+Ve(t,t.project,"Clear range")+": `"+T+"`] ",R=(te,X,re)=>{const ae=Ve(te==null?void 0:te.valueOwner,m==null?void 0:m.logic,X),le=Be(te==null?void 0:te.valueOwner,m==null?void 0:m.logic,re);return`"${ae}" (\`${le}\`)`},I=n.find(te=>{var X;return((X=te.valueOwner.declaration)==null?void 0:X.id)===G.operation[J.GoogleSheetsClearRange].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(A);if(!O)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(te=>{var X;return((X=te.valueOwner.declaration)==null?void 0:X.id)===G.operation[J.GoogleSheetsClearRange].inputs.spreadsheetId.id}),x=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(x,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(te=>{var X;return((X=te.valueOwner.declaration)==null?void 0:X.id)===G.operation[J.GoogleSheetsClearRange].inputs.range.id}),Z=(e=U==null?void 0:U.value)==null?void 0:e.value;if(!Z||Z==="")throw new Error(`${b}The ${R(U,"Range","range")} input is missing.`);const H={Authorization:`Bearer ${await m.getAccessToken()}`},Y=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${O}`,ie=async te=>Ht.post(Y,te,{headers:H}),z=await Ha(Z,"Name",async()=>{var X;return(((X=(await ie({method:"GET",endpoint:`/v4/spreadsheets/${$}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:X.sheets)||[]).map(re=>{var ae,le;return{id:(ae=re.properties)==null?void 0:ae.sheetId,name:(le=re.properties)==null?void 0:le.title}})}),ee=(await ie({method:"POST",endpoint:`/v4/spreadsheets/${$}/values/${lv(z,{errorPrefix:`${b}The ${R(U,"Range","range")} input `})}:clear`,data:{}})).data||{};return{value:K.Success,error:null,result:{clearedRange:ee.clearedRange}}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class YAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsBatchUpdateSpreadsheet,version:"1.0.0",description:"Batch Update Spreadsheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsBatchUpdateSpreadsheet);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"batchUpdateSpreadsheet"),b="["+Ve(t,t.project,"Batch update spreadsheet")+": `"+T+"`] ",R=(te,X,re)=>{const ae=Ve(te==null?void 0:te.valueOwner,m==null?void 0:m.logic,X),le=Be(te==null?void 0:te.valueOwner,m==null?void 0:m.logic,re);return`"${ae}" (\`${le}\`)`},I=n.find(te=>{var X;return((X=te.valueOwner.declaration)==null?void 0:X.id)===G.operation[J.GoogleSheetsBatchUpdateSpreadsheet].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(A);if(!O)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(te=>{var X;return((X=te.valueOwner.declaration)==null?void 0:X.id)===G.operation[J.GoogleSheetsBatchUpdateSpreadsheet].inputs.spreadsheetId.id}),x=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(x,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(te=>{var X;return((X=te.valueOwner.declaration)==null?void 0:X.id)===G.operation[J.GoogleSheetsBatchUpdateSpreadsheet].inputs.requests.id}),Z=(e=U==null?void 0:U.value)==null?void 0:e.value;if(Z==null||Z==="")throw new Error(`${b}The ${R(U,"Requests","requests")} input is missing.`);let q=Z;if(typeof Z=="string")try{q=JSON.parse(Z)}catch{}if(Array.isArray(q)||(q=[q]),q.length===0)throw new Error(`${b}The ${R(U,"Requests","requests")} input evaluated to an empty array. E.g. [{ addSheet: { properties: { title: "New Sheet" } } }]`);const Y={Authorization:`Bearer ${await m.getAccessToken()}`},ie=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${O}`,ee=(await(async te=>Ht.post(ie,te,{headers:Y}))({method:"POST",endpoint:`/v4/spreadsheets/${$}:batchUpdate`,data:{requests:q}})).data||{};return{value:K.Success,result:{replies:ee.replies||[]},error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class JAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsRenameSheet,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsRenameSheet);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g;try{const b=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!b||!b.env)throw new Error("Editor context or environment missing");const R=Be(t,t.project,"renameSheet"),A="["+Ve(t,t.project,"Rename sheet")+": `"+R+"`] ",O=(oe,ce,be)=>{const Ce=Ve(oe==null?void 0:oe.valueOwner,b==null?void 0:b.logic,ce),Ee=Be(oe==null?void 0:oe.valueOwner,b==null?void 0:b.logic,be);return`"${Ce}" (\`${Ee}\`)`},P=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[J.GoogleSheetsRenameSheet].inputs.connection.id}),x=(s=P==null?void 0:P.value)==null?void 0:s.valueAsType;if(!x||!x.id||!x.name||x.type!==r.DefinitionEntity)throw new Error(`${A}The ${O(P,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const $=ui(x);if(!$)throw new Error(`${A}The ${O(P,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const U=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[J.GoogleSheetsRenameSheet].inputs.spreadsheetId.id}),Z=(u=U==null?void 0:U.value)==null?void 0:u.value,q=ln(Z,{errorPrefix:`${A}The ${O(U,"Spreadsheet ID","spreadsheetId")} input `}),H=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[J.GoogleSheetsRenameSheet].inputs.sheetId.id}),Y=(e=H==null?void 0:H.value)==null?void 0:e.value;if(Y==null||Y==="")throw new Error(`${A}The ${O(H,"Sheet (ID or name)","sheetId")} input is missing.`);const ie=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[J.GoogleSheetsRenameSheet].inputs.title.id}),z=(f=ie==null?void 0:ie.value)==null?void 0:f.value;if(z!=null&&typeof z!="string")throw new Error(`${A}The ${O(ie,"Title","title")} input value is invalid, if present, it must be a string.`);const ee={Authorization:`Bearer ${await b.getAccessToken()}`},te=`${(y=b.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${b.projectId}/${Zt["google-sheet"]}/${$}`,X=async oe=>Ht.post(te,oe,{headers:ee});let re;if(typeof Y=="number")re=Y;else if(typeof Y=="string"){const oe=Y.trim(),ce=await X({method:"GET",endpoint:`/v4/spreadsheets/${q}?fields=sheets.properties(sheetId,title)`}).catch(()=>null),Ce=(((m=ce==null?void 0:ce.data)==null?void 0:m.sheets)||[]).find(Ee=>{var Oe,Le;return((Oe=Ee.properties)==null?void 0:Oe.title)===oe||String((Le=Ee.properties)==null?void 0:Le.sheetId)===oe});if(Ce&&((T=Ce.properties)==null?void 0:T.sheetId)!==void 0)re=Ce.properties.sheetId;else if(/^\d+$/.test(oe))re=parseInt(oe,10);else throw new Error(`${A}Sheet "${Y}" was not found in the spreadsheet.`)}else throw new Error(`${A}The ${O(H,"Sheet (ID or name)","sheetId")} input value is invalid. It must be a number or string.`);const ae={sheetId:re},le=[];return ae.title=z||"",le.push("title"),await X({method:"POST",endpoint:`/v4/spreadsheets/${q}:batchUpdate`,data:{requests:[{updateSheetProperties:{properties:ae,fields:le.join(",")}}]}}),{value:K.Success,result:null,error:null}}catch(b){const R=((g=b.response)==null?void 0:g.data)||b.message||b;return pe.Logger.log("[Google Sheets] error:",R),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:R,result:null}}}})}}class QAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsCopySheet,version:"1.0.0",description:"Copy Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsCopySheet);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b;try{const R=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!R||!R.env)throw new Error("Editor context or environment missing");const I=Be(t,t.project,"copySheet"),O="["+Ve(t,t.project,"Copy sheet")+": `"+I+"`] ",P=(Oe,Le,Fe)=>{const tt=Ve(Oe==null?void 0:Oe.valueOwner,R==null?void 0:R.logic,Le),We=Be(Oe==null?void 0:Oe.valueOwner,R==null?void 0:R.logic,Fe);return`"${tt}" (\`${We}\`)`},x=n.find(Oe=>{var Le;return((Le=Oe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[J.GoogleSheetsCopySheet].inputs.connection.id}),$=(s=x==null?void 0:x.value)==null?void 0:s.valueAsType;if(!$||!$.id||!$.name||$.type!==r.DefinitionEntity)throw new Error(`${O}The ${P(x,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const U=ui($);if(!U)throw new Error(`${O}The ${P(x,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const Z=n.find(Oe=>{var Le;return((Le=Oe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[J.GoogleSheetsCopySheet].inputs.spreadsheetId.id}),q=(u=Z==null?void 0:Z.value)==null?void 0:u.value,H=ln(q,{errorPrefix:`${O}The ${P(Z,"Spreadsheet ID","spreadsheetId")} input `}),Y=n.find(Oe=>{var Le;return((Le=Oe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[J.GoogleSheetsCopySheet].inputs.sheetId.id}),ie=(e=Y==null?void 0:Y.value)==null?void 0:e.value;if(ie==null||ie==="")throw new Error(`${O}The ${P(Y,"Sheet (ID or name)","sheetId")} input is missing.`);const z=n.find(Oe=>{var Le;return((Le=Oe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[J.GoogleSheetsCopySheet].inputs.destinationSpreadsheetId.id}),W=(f=z==null?void 0:z.value)==null?void 0:f.value;let ee=H;if(W!=null&&String(W).trim()!==""){if(typeof W!="string")throw new Error(`${O}The ${P(z,"Destination Spreadsheet ID","destinationSpreadsheetId")} input value is invalid, if present, it must be a string.`);ee=ln(W,{errorPrefix:`${O}The ${P(z,"Destination Spreadsheet ID","destinationSpreadsheetId")} input `})}const te=n.find(Oe=>{var Le;return((Le=Oe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[J.GoogleSheetsCopySheet].inputs.newSheetName.id}),X=(y=te==null?void 0:te.value)==null?void 0:y.value;if(X!=null&&typeof X!="string")throw new Error(`${O}The ${P(te,"New Sheet Name","newSheetName")} input value is invalid, if present, it must be a string.`);const ae={Authorization:`Bearer ${await R.getAccessToken()}`},le=`${(m=R.env)==null?void 0:m.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${R.projectId}/${Zt["google-sheet"]}/${U}`,oe=async Oe=>Ht.post(le,Oe,{headers:ae});let ce;if(typeof ie=="number")ce=ie;else if(typeof ie=="string"){const Oe=ie.trim(),Le=await oe({method:"GET",endpoint:`/v4/spreadsheets/${H}?fields=sheets.properties(sheetId,title)`}).catch(()=>null),tt=(((T=Le==null?void 0:Le.data)==null?void 0:T.sheets)||[]).find(We=>{var et,qe;return((et=We.properties)==null?void 0:et.title)===Oe||String((qe=We.properties)==null?void 0:qe.sheetId)===Oe});if(tt&&((g=tt.properties)==null?void 0:g.sheetId)!==void 0)ce=tt.properties.sheetId;else if(/^\d+$/.test(Oe))ce=parseInt(Oe,10);else throw new Error(`${O}Sheet "${ie}" was not found in the source spreadsheet.`)}else throw new Error(`${O}The ${P(Y,"Sheet (ID or name)","sheetId")} input value is invalid. It must be a number or string.`);const Ee=((await oe({method:"POST",endpoint:`/v4/spreadsheets/${H}/sheets/${ce}:copyTo`,data:{destinationSpreadsheetId:ee}})).data||{}).sheetId;return X&&typeof X=="string"&&X.trim()!==""&&await oe({method:"POST",endpoint:`/v4/spreadsheets/${ee}:batchUpdate`,data:{requests:[{updateSheetProperties:{properties:{sheetId:Ee,title:X.trim()},fields:"title"}}]}}),{value:K.Success,result:{newSheetId:Ee},error:null}}catch(R){const I=((b=R.response)==null?void 0:b.data)||R.message||R;return pe.Logger.log("[Google Sheets] error:",I),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:I,result:null}}}})}}class XAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsClearSheet,version:"1.0.0",description:"Clear Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsClearSheet);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b;try{const R=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!R||!R.env)throw new Error("Editor context or environment missing");const I=Be(t,t.project,"clearSheet"),O="["+Ve(t,t.project,"Clear sheet")+": `"+I+"`] ",P=(le,oe,ce)=>{const be=Ve(le==null?void 0:le.valueOwner,R==null?void 0:R.logic,oe),Ce=Be(le==null?void 0:le.valueOwner,R==null?void 0:R.logic,ce);return`"${be}" (\`${Ce}\`)`},x=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[J.GoogleSheetsClearSheet].inputs.connection.id}),$=(s=x==null?void 0:x.value)==null?void 0:s.valueAsType;if(!$||!$.id||!$.name||$.type!==r.DefinitionEntity)throw new Error(`${O}The ${P(x,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const U=ui($);if(!U)throw new Error(`${O}The ${P(x,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const Z=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[J.GoogleSheetsClearSheet].inputs.spreadsheetId.id}),q=(u=Z==null?void 0:Z.value)==null?void 0:u.value,H=ln(q,{errorPrefix:`${O}The ${P(Z,"Spreadsheet ID","spreadsheetId")} input `}),Y=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[J.GoogleSheetsClearSheet].inputs.sheetName.id}),ie=(e=Y==null?void 0:Y.value)==null?void 0:e.value;if(ie==null||ie==="")throw new Error(`${O}The ${P(Y,"Sheet (ID or name)","sheetName")} input is missing.`);const W={Authorization:`Bearer ${await R.getAccessToken()}`},ee=`${(f=R.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${R.projectId}/${Zt["google-sheet"]}/${U}`,te=async le=>Ht.post(ee,le,{headers:W});let X;if(typeof ie=="string"){const le=ie.trim();if(/^\d+$/.test(le)){const oe=await te({method:"GET",endpoint:`/v4/spreadsheets/${H}?fields=sheets.properties(sheetId,title)`}).catch(()=>null),be=(((y=oe==null?void 0:oe.data)==null?void 0:y.sheets)||[]).find(Ce=>{var Ee,Oe;return String((Ee=Ce.properties)==null?void 0:Ee.sheetId)===le||((Oe=Ce.properties)==null?void 0:Oe.title)===le});X=((m=be==null?void 0:be.properties)==null?void 0:m.title)||le}else X=le}else if(typeof ie=="number"){const ce=(((T=(await te({method:"GET",endpoint:`/v4/spreadsheets/${H}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:T.sheets)||[]).find(be=>{var Ce;return Number((Ce=be.properties)==null?void 0:Ce.sheetId)===ie});if(!ce||!((g=ce.properties)!=null&&g.title))throw new Error(`${O}Sheet with ID ${ie} was not found in the spreadsheet.`);X=ce.properties.title}else throw new Error(`${O}The ${P(Y,"Sheet (ID or name)","sheetName")} input value is invalid. It must be a number or string.`);const ae=(await te({method:"POST",endpoint:`/v4/spreadsheets/${H}/values/${encodeURIComponent(X)}:clear`,data:{}})).data||{};return{value:K.Success,result:{clearedRange:ae.clearedRange},error:null}}catch(R){const I=((b=R.response)==null?void 0:b.data)||R.message||R;return pe.Logger.log("[Google Sheets] error:",I),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:I,result:null}}}})}}class e1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsBatchGetValues,version:"1.0.0",description:"Batch Get Values Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsBatchGetValues);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T;try{const g=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!g||!g.env)throw new Error("Editor context or environment missing");const b=Be(t,t.project,"batchGetValues"),I="["+Ve(t,t.project,"Batch get values")+": `"+b+"`] ",A=(ce,be,Ce)=>{const Ee=Ve(ce==null?void 0:ce.valueOwner,g==null?void 0:g.logic,be),Oe=Be(ce==null?void 0:ce.valueOwner,g==null?void 0:g.logic,Ce);return`"${Ee}" (\`${Oe}\`)`},O=n.find(ce=>{var be;return((be=ce.valueOwner.declaration)==null?void 0:be.id)===G.operation[J.GoogleSheetsBatchGetValues].inputs.connection.id}),P=(s=O==null?void 0:O.value)==null?void 0:s.valueAsType;if(!P||!P.id||!P.name||P.type!==r.DefinitionEntity)throw new Error(`${I}The ${A(O,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=ui(P);if(!x)throw new Error(`${I}The ${A(O,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const $=n.find(ce=>{var be;return((be=ce.valueOwner.declaration)==null?void 0:be.id)===G.operation[J.GoogleSheetsBatchGetValues].inputs.spreadsheetId.id}),U=(u=$==null?void 0:$.value)==null?void 0:u.value,Z=ln(U,{errorPrefix:`${I}The ${A($,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(ce=>{var be;return((be=ce.valueOwner.declaration)==null?void 0:be.id)===G.operation[J.GoogleSheetsBatchGetValues].inputs.ranges.id}),H=(e=q==null?void 0:q.value)==null?void 0:e.value;if(H==null||H==="")throw new Error(`${I}The ${A(q,"Ranges","ranges")} input is missing.`);const ie={Authorization:`Bearer ${await g.getAccessToken()}`},z=`${(f=g.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${g.projectId}/${Zt["google-sheet"]}/${x}`,W=async ce=>Ht.post(z,ce,{headers:ie});let ee=Array.isArray(H)?H:[H];if(ee.length===0)throw new Error(`${I}The ${A(q,"Ranges","ranges")} input evaluated to an empty array. E.g. ["Sheet1!A1:B2"]`);let te=new Set;try{const be=((y=(await W({method:"GET",endpoint:`/v4/spreadsheets/${Z}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:y.sheets)||[];te=new Set(be.map(Ce=>{var Ee;return(Ee=Ce.properties)==null?void 0:Ee.title}).filter(Boolean))}catch{}const X=ce=>{const be=ce.indexOf("!");if(be>-1){let Ce=ce.substring(0,be).trim();return Ce.startsWith("'")&&Ce.endsWith("'")&&(Ce=Ce.slice(1,-1)),Ce}return null},re=[],ae=[];for(const ce of ee){const be=lv(ce,{errorPrefix:`${I}The ${A(q,"Ranges","ranges")} input `}),Ce=X(be);Ce&&te.size>0&&!te.has(Ce)?ae.push({range:be,majorDimension:"ROWS",values:[]}):re.push({a1Range:be})}let le=[];re.length>0&&(le=(((m=(await W({method:"POST",endpoint:`/v4/spreadsheets/${Z}/values:batchGetByDataFilter`,data:{dataFilters:re}})).data)==null?void 0:m.valueRanges)||[]).map(Ce=>Ce.valueRange||Ce));const oe=[...le,...ae];return{value:K.Success,result:{valueRanges:oe},error:null}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return pe.Logger.log("[Google Sheets] error:",b),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:b,result:null}}}})}}function fo(a){if(!a||typeof a!="object")return;const p={};return typeof a.red=="number"&&(p.red=a.red>1?a.red/255:a.red),typeof a.green=="number"&&(p.green=a.green>1?a.green/255:a.green),typeof a.blue=="number"&&(p.blue=a.blue>1?a.blue/255:a.blue),typeof a.alpha=="number"&&(p.alpha=a.alpha),Object.keys(p).length>0?p:void 0}class t1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsFormatCells,version:"1.0.0",description:"Format Cells Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsFormatCells);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"formatCells"),b="["+Ve(t,t.project,"Format cells")+": `"+T+"`] ",R=(ft,Et,pt)=>{const Me=Ve(ft==null?void 0:ft.valueOwner,m==null?void 0:m.logic,Et),Je=Be(ft==null?void 0:ft.valueOwner,m==null?void 0:m.logic,pt);return`"${Me}" (\`${Je}\`)`},I=n.find(ft=>{var Et;return((Et=ft.valueOwner.declaration)==null?void 0:Et.id)===G.operation[J.GoogleSheetsFormatCells].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(A);if(!O)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(ft=>{var Et;return((Et=ft.valueOwner.declaration)==null?void 0:Et.id)===G.operation[J.GoogleSheetsFormatCells].inputs.spreadsheetId.id}),x=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(x,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(ft=>{var Et;return((Et=ft.valueOwner.declaration)==null?void 0:Et.id)===G.operation[J.GoogleSheetsFormatCells].inputs.range.id}),Z=(e=U==null?void 0:U.value)==null?void 0:e.value;if(Z==null)throw new Error(`${b}The ${R(U,"Range","range")} input is missing.`);const H={Authorization:`Bearer ${await m.getAccessToken()}`},Y=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${O}`,ie=async ft=>Ht.post(Y,ft,{headers:H}),z=await Ha(Z,"Id",async()=>(await ie({method:"GET",endpoint:`/v4/spreadsheets/${$}?fields=sheets.properties(sheetId,title)`})).data.sheets.map(Et=>({id:Et.properties.sheetId,name:Et.properties.title}))),W=ps(z,{errorPrefix:`${b}The ${R(U,"Range","range")} input `}),ee=G.operation[J.GoogleSheetsFormatCells].inputs,te=ft=>{var pt;const Et=n.find(Me=>{var Je;return((Je=Me.valueOwner.declaration)==null?void 0:Je.id)===ft});return(pt=Et==null?void 0:Et.value)==null?void 0:pt.value},X=te(ee.bold.id),re=te(ee.italic.id),ae=te(ee.underline.id),le=te(ee.strikethrough.id),oe=te(ee.fontSize.id),ce=te(ee.fontFamily.id),be=te(ee.textColor.id),Ce=te(ee.backgroundColor.id),Ee=te(ee.horizontalAlignment.id),Oe=te(ee.verticalAlignment.id),Le=te(ee.wrapStrategy.id),Fe={},tt=[],We={},et=[];typeof X=="boolean"&&(We.bold=X,et.push("bold")),typeof re=="boolean"&&(We.italic=re,et.push("italic")),typeof ae=="boolean"&&(We.underline=ae,et.push("underline")),typeof le=="boolean"&&(We.strikethrough=le,et.push("strikethrough")),typeof oe=="number"&&!isNaN(oe)&&(We.fontSize=oe,et.push("fontSize")),typeof ce=="string"&&ce.trim()!==""&&(We.fontFamily=ce.trim(),et.push("fontFamily"));const qe=fo(be);qe&&(We.foregroundColor=qe,et.push("foregroundColor")),et.length>0&&(Fe.textFormat=We,tt.push(`userEnteredFormat.textFormat(${et.join(",")})`));const ot=fo(Ce);if(ot&&(Fe.backgroundColor=ot,tt.push("userEnteredFormat.backgroundColor")),typeof Ee=="string"&&Ee!==""){const ft={Left:"LEFT",Center:"CENTER",Right:"RIGHT",Justify:"JUSTIFY"};Fe.horizontalAlignment=ft[Ee]||Ee.toUpperCase(),tt.push("userEnteredFormat.horizontalAlignment")}if(typeof Oe=="string"&&Oe!==""){const ft={Top:"TOP",Middle:"MIDDLE",Bottom:"BOTTOM"};Fe.verticalAlignment=ft[Oe]||Oe.toUpperCase(),tt.push("userEnteredFormat.verticalAlignment")}if(typeof Le=="string"&&Le!==""){const ft={"Overflow cell":"OVERFLOW_CELL","Wrap text":"WRAP","Clip text":"CLIP"};Fe.wrapStrategy=ft[Le]||Le.toUpperCase(),tt.push("userEnteredFormat.wrapStrategy")}if(tt.length===0)return{value:K.Success,result:null,error:null};const st={repeatCell:{range:W,cell:{userEnteredFormat:Fe},fields:tt.join(",")}};return await ie({method:"POST",endpoint:`/v4/spreadsheets/${$}:batchUpdate`,data:{requests:[st]}}),{value:K.Success,result:null,error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class i1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsSetNumberFormat,version:"1.0.0",description:"Set Number Format Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsSetNumberFormat);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=Be(t,t.project,"setNumberFormat"),R="["+Ve(t,t.project,"Set number format")+": `"+g+"`] ",I=(ae,le,oe)=>{const ce=Ve(ae==null?void 0:ae.valueOwner,T==null?void 0:T.logic,le),be=Be(ae==null?void 0:ae.valueOwner,T==null?void 0:T.logic,oe);return`"${ce}" (\`${be}\`)`},A=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[J.GoogleSheetsSetNumberFormat].inputs.connection.id}),O=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${R}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const P=ui(O);if(!P)throw new Error(`${R}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[J.GoogleSheetsSetNumberFormat].inputs.spreadsheetId.id}),$=(u=x==null?void 0:x.value)==null?void 0:u.value,U=ln($,{errorPrefix:`${R}The ${I(x,"Spreadsheet ID","spreadsheetId")} input `}),Z=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[J.GoogleSheetsSetNumberFormat].inputs.range.id}),q=(e=Z==null?void 0:Z.value)==null?void 0:e.value;if(q==null)throw new Error(`${R}The ${I(Z,"Range","range")} input is missing.`);const Y={Authorization:`Bearer ${await T.getAccessToken()}`},ie=`${(f=T.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${T.projectId}/${Zt["google-sheet"]}/${P}`,z=async ae=>Ht.post(ie,ae,{headers:Y}),W=await Ha(q,"Id",async()=>(await z({method:"GET",endpoint:`/v4/spreadsheets/${U}?fields=sheets.properties(sheetId,title)`})).data.sheets.map(le=>({id:le.properties.sheetId,name:le.properties.title}))),ee=ps(W,{errorPrefix:`${R}The ${I(Z,"Range","range")} input `}),te=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[J.GoogleSheetsSetNumberFormat].inputs.pattern.id}),X=(y=te==null?void 0:te.value)==null?void 0:y.value;if(X==null||X==="")throw new Error(`${R}The ${I(te,"Pattern","pattern")} input is missing.`);if(typeof X!="string")throw new Error(`${R}The ${I(te,"Pattern","pattern")} input value is invalid. It must be a string.`);const re={repeatCell:{range:ee,cell:{userEnteredFormat:{numberFormat:{type:"CUSTOM",pattern:X}}},fields:"userEnteredFormat.numberFormat"}};return await z({method:"POST",endpoint:`/v4/spreadsheets/${U}:batchUpdate`,data:{requests:[re]}}),{value:K.Success,result:null,error:null}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return pe.Logger.log("[Google Sheets] error:",g),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:g,result:null}}}})}}class n1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsMergeCells,version:"1.0.0",description:"Merge Cells Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsMergeCells);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=Be(t,t.project,"mergeCells"),R="["+Ve(t,t.project,"Merge cells")+": `"+g+"`] ",I=(oe,ce,be)=>{const Ce=Ve(oe==null?void 0:oe.valueOwner,T==null?void 0:T.logic,ce),Ee=Be(oe==null?void 0:oe.valueOwner,T==null?void 0:T.logic,be);return`"${Ce}" (\`${Ee}\`)`},A=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[J.GoogleSheetsMergeCells].inputs.connection.id}),O=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${R}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const P=ui(O);if(!P)throw new Error(`${R}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[J.GoogleSheetsMergeCells].inputs.spreadsheetId.id}),$=(u=x==null?void 0:x.value)==null?void 0:u.value,U=ln($,{errorPrefix:`${R}The ${I(x,"Spreadsheet ID","spreadsheetId")} input `}),Z=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[J.GoogleSheetsMergeCells].inputs.range.id}),q=(e=Z==null?void 0:Z.value)==null?void 0:e.value;if(!q||q==="")throw new Error(`${R}The ${I(Z,"Range","range")} input is missing.`);const H=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[J.GoogleSheetsMergeCells].inputs.mergeType.id}),Y=(f=H==null?void 0:H.value)==null?void 0:f.value,ie={Columns:"MERGE_COLUMNS",Rows:"MERGE_ROWS",Both:"MERGE_ALL","All (combine entire range)":"MERGE_ALL","Columns (merge within columns)":"MERGE_COLUMNS","Rows (merge within rows)":"MERGE_ROWS",MERGE_ALL:"MERGE_ALL",MERGE_COLUMNS:"MERGE_COLUMNS",MERGE_ROWS:"MERGE_ROWS"},z=typeof Y=="string"?Y:String(Y||""),W=ie[z]||(Y?String(Y).toUpperCase():"MERGE_ALL"),te={Authorization:`Bearer ${await T.getAccessToken()}`},X=`${(y=T.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${T.projectId}/${Zt["google-sheet"]}/${P}`,re=async oe=>Ht.post(X,oe,{headers:te}),ae=await Ha(q,"Id",async()=>{var ce;return(((ce=(await re({method:"GET",endpoint:`/v4/spreadsheets/${U}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:ce.sheets)||[]).map(be=>{var Ce,Ee;return{id:(Ce=be.properties)==null?void 0:Ce.sheetId,name:(Ee=be.properties)==null?void 0:Ee.title}})}),le=ps(ae,{errorPrefix:`${R}The ${I(Z,"Range","range")} input `});return await re({method:"POST",endpoint:`/v4/spreadsheets/${U}:batchUpdate`,data:{requests:[{mergeCells:{range:le,mergeType:W}}]}}),{value:K.Success,error:null,result:null}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return pe.Logger.log("[Google Sheets] error:",g),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:g,result:null}}}})}}class r1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsUnmergeCells,version:"1.0.0",description:"Unmerge Cells Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsUnmergeCells);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"unmergeCells"),b="["+Ve(t,t.project,"Unmerge cells")+": `"+T+"`] ",R=(ee,te,X)=>{const re=Ve(ee==null?void 0:ee.valueOwner,m==null?void 0:m.logic,te),ae=Be(ee==null?void 0:ee.valueOwner,m==null?void 0:m.logic,X);return`"${re}" (\`${ae}\`)`},I=n.find(ee=>{var te;return((te=ee.valueOwner.declaration)==null?void 0:te.id)===G.operation[J.GoogleSheetsUnmergeCells].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(A);if(!O)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(ee=>{var te;return((te=ee.valueOwner.declaration)==null?void 0:te.id)===G.operation[J.GoogleSheetsUnmergeCells].inputs.spreadsheetId.id}),x=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(x,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(ee=>{var te;return((te=ee.valueOwner.declaration)==null?void 0:te.id)===G.operation[J.GoogleSheetsUnmergeCells].inputs.range.id}),Z=(e=U==null?void 0:U.value)==null?void 0:e.value;if(!Z||Z==="")throw new Error(`${b}The ${R(U,"Range","range")} input is missing.`);const H={Authorization:`Bearer ${await m.getAccessToken()}`},Y=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${O}`,ie=async ee=>Ht.post(Y,ee,{headers:H}),z=await Ha(Z,"Id",async()=>{var te;return(((te=(await ie({method:"GET",endpoint:`/v4/spreadsheets/${$}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:te.sheets)||[]).map(X=>{var re,ae;return{id:(re=X.properties)==null?void 0:re.sheetId,name:(ae=X.properties)==null?void 0:ae.title}})}),W=ps(z,{errorPrefix:`${b}The ${R(U,"Range","range")} input `});return await ie({method:"POST",endpoint:`/v4/spreadsheets/${$}:batchUpdate`,data:{requests:[{unmergeCells:{range:W}}]}}),{value:K.Success,error:null,result:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class a1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsAutoResizeDimensions,version:"1.0.0",description:"Auto-Resize Dimensions Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsAutoResizeDimensions);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=Be(t,t.project,"autoResizeDimensions"),R="["+Ve(t,t.project,"Auto-resize dimensions")+": `"+g+"`] ",I=(ae,le,oe)=>{const ce=Ve(ae==null?void 0:ae.valueOwner,T==null?void 0:T.logic,le),be=Be(ae==null?void 0:ae.valueOwner,T==null?void 0:T.logic,oe);return`"${ce}" (\`${be}\`)`},A=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[J.GoogleSheetsAutoResizeDimensions].inputs.connection.id}),O=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${R}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const P=ui(O);if(!P)throw new Error(`${R}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[J.GoogleSheetsAutoResizeDimensions].inputs.spreadsheetId.id}),$=(u=x==null?void 0:x.value)==null?void 0:u.value,U=ln($,{errorPrefix:`${R}The ${I(x,"Spreadsheet ID","spreadsheetId")} input `}),Z=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[J.GoogleSheetsAutoResizeDimensions].inputs.range.id}),q=(e=Z==null?void 0:Z.value)==null?void 0:e.value;if(q==null)throw new Error(`${R}The ${I(Z,"Range","range")} input is missing.`);const H=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[J.GoogleSheetsAutoResizeDimensions].inputs.dimension.id}),Y=((f=H==null?void 0:H.value)==null?void 0:f.value)||"Both",z={Authorization:`Bearer ${await T.getAccessToken()}`},W=`${(y=T.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${T.projectId}/${Zt["google-sheet"]}/${P}`,ee=async ae=>Ht.post(W,ae,{headers:z}),te=await Ha(q,"Id",async()=>{var le;return(((le=(await ee({method:"GET",endpoint:`/v4/spreadsheets/${U}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:le.sheets)||[]).map(oe=>{var ce,be;return{id:(ce=oe.properties)==null?void 0:ce.sheetId,name:(be=oe.properties)==null?void 0:be.title}})}),re=S4(te,typeof Y=="string"?Y:void 0,{errorPrefix:`${R}The ${I(Z,"Range","range")} input `}).map(ae=>({autoResizeDimensions:{dimensions:ae}}));return await ee({method:"POST",endpoint:`/v4/spreadsheets/${U}:batchUpdate`,data:{requests:re}}),{value:K.Success,result:null,error:null}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return pe.Logger.log("[Google Sheets] error:",g),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:g,result:null}}}})}}class s1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsFindAndReplace,version:"1.0.0",description:"Find and Replace Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsFindAndReplace);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A;try{const O=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!O||!O.env)throw new Error("Editor context or environment missing");const P=Be(t,t.project,"findAndReplace"),$="["+Ve(t,t.project,"Find and replace")+": `"+P+"`] ",U=(et,qe,ot)=>{const st=Ve(et==null?void 0:et.valueOwner,O==null?void 0:O.logic,qe),ft=Be(et==null?void 0:et.valueOwner,O==null?void 0:O.logic,ot);return`"${st}" (\`${ft}\`)`},Z=n.find(et=>{var qe;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===G.operation[J.GoogleSheetsFindAndReplace].inputs.connection.id}),q=(s=Z==null?void 0:Z.value)==null?void 0:s.valueAsType;if(!q||!q.id||!q.name||q.type!==r.DefinitionEntity)throw new Error(`${$}The ${U(Z,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const H=ui(q);if(!H)throw new Error(`${$}The ${U(Z,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const Y=n.find(et=>{var qe;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===G.operation[J.GoogleSheetsFindAndReplace].inputs.spreadsheetId.id}),ie=(u=Y==null?void 0:Y.value)==null?void 0:u.value,z=ln(ie,{errorPrefix:`${$}The ${U(Y,"Spreadsheet ID","spreadsheetId")} input `}),W=n.find(et=>{var qe;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===G.operation[J.GoogleSheetsFindAndReplace].inputs.range.id}),ee=(e=W==null?void 0:W.value)==null?void 0:e.value;if(ee==null)throw new Error(`${$}The ${U(W,"Range","range")} input is missing.`);const te=n.find(et=>{var qe;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===G.operation[J.GoogleSheetsFindAndReplace].inputs.find.id}),X=(f=te==null?void 0:te.value)==null?void 0:f.value;if(!X||X==="")throw new Error(`${$}The ${U(te,"Find","find")} input is missing.`);if(typeof X!="string")throw new Error(`${$}The ${U(te,"Find","find")} input value is invalid. It must be a non-empty string.`);const re=n.find(et=>{var qe;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===G.operation[J.GoogleSheetsFindAndReplace].inputs.replace.id}),ae=((y=re==null?void 0:re.value)==null?void 0:y.value)||"";if(typeof ae!="string")throw new Error(`${$}The ${U(re,"Replace","replace")} input value is invalid. It must be a string.`);const le=n.find(et=>{var qe;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===G.operation[J.GoogleSheetsFindAndReplace].inputs.matchCase.id}),oe=!!((m=le==null?void 0:le.value)!=null&&m.value),ce=n.find(et=>{var qe;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===G.operation[J.GoogleSheetsFindAndReplace].inputs.matchEntireCell.id}),be=!!((T=ce==null?void 0:ce.value)!=null&&T.value),Ee={Authorization:`Bearer ${await O.getAccessToken()}`},Oe=`${(g=O.env)==null?void 0:g.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${O.projectId}/${Zt["google-sheet"]}/${H}`,Le=async et=>Ht.post(Oe,et,{headers:Ee}),Fe={findReplace:{range:ps(ee,{errorPrefix:`${$}The ${U(W,"Range","range")} input `}),find:X,replacement:ae,matchCase:oe,matchEntireCell:be}},We=(await Le({method:"POST",endpoint:`/v4/spreadsheets/${z}:batchUpdate`,data:{requests:[Fe]}})).data||{};return{value:K.Success,result:{occurrencesChanged:((I=(R=(b=We.replies)==null?void 0:b[0])==null?void 0:R.findReplace)==null?void 0:I.occurrencesChanged)||0},error:null}}catch(O){const P=((A=O.response)==null?void 0:A.data)||O.message||O;return pe.Logger.log("[Google Sheets] error:",P),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:P,result:null}}}})}}const JL={"List of items":"ONE_OF_LIST","List from cell range":"ONE_OF_RANGE","Number greater than":"NUMBER_GREATER","Number greater than or equal":"NUMBER_GREATER_THAN_EQ","Number less than":"NUMBER_LESS","Number less than or equal":"NUMBER_LESS_THAN_EQ","Number equal to":"NUMBER_EQ","Number not equal to":"NUMBER_NOT_EQ","Number between":"NUMBER_BETWEEN","Number not between":"NUMBER_NOT_BETWEEN","Text contains":"TEXT_CONTAINS","Text does not contain":"TEXT_NOT_CONTAINS","Text starts with":"TEXT_STARTS_WITH","Text ends with":"TEXT_ENDS_WITH","Text equals":"TEXT_EQ","Text is valid email":"TEXT_IS_EMAIL","Text is valid URL":"TEXT_IS_URL","Date is":"DATE_EQ","Date is before":"DATE_BEFORE","Date is after":"DATE_AFTER","Date is on or before":"DATE_ON_OR_BEFORE","Date is on or after":"DATE_ON_OR_AFTER","Date is between":"DATE_BETWEEN","Date is not between":"DATE_NOT_BETWEEN","Date is valid":"DATE_IS_VALID",Checkbox:"BOOLEAN","Custom formula":"CUSTOM_FORMULA"},nO={NUMBER_EQUAL:"NUMBER_EQ",NUMBER_NOT_EQUAL:"NUMBER_NOT_EQ",TEXT_DOES_NOT_CONTAIN:"TEXT_NOT_CONTAINS",TEXT_EQUAL:"TEXT_EQ",DATE_TIME_EQUAL:"DATE_EQ",DATE_EQUAL:"DATE_EQ"},mRn=new Set([...Object.values(JL),...Object.keys(nO),...Object.values(nO)]);function l1t(a){if(!a||typeof a!="string")return null;const p=a.trim();if(!p)return null;if(JL[p])return JL[p];const t=p.toUpperCase().replace(/\s+/g,"_");return nO[t]?nO[t]:(mRn.has(t),t)}function TRn(a,p,t){if(a.length===0){t.push(new ht({id:`${p.id}--${Nr.ConditionValuesInvalidFormula}`,message:'Custom formula condition requires a formula string starting with "=" (e.g., ["=SUM(A1:A10)>100"]).',severity:Ie.Error,code:Nr.ConditionValuesInvalidFormula,entity:p}));return}a.length>1&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesInvalidFormula}-count`,message:`Custom formula condition rule accepts only 1 formula string (e.g., ["=SUM(A1:A10)>100"]). You provided ${a.length} items.`,severity:Ie.Error,code:Nr.ConditionValuesInvalidFormula,entity:p}));for(let n=0;n<a.length;n++){const s=String(a[n]).trim();s.startsWith("=")||t.push(new ht({id:`${p.id}--${Nr.ConditionValuesInvalidFormula}-${n}`,message:`Custom formula "${s}" ${a.length>1?`(at index ${n}) `:""}is invalid. A custom formula must start with "=" (e.g., "=A1>100" or "=ISNUMBER(A1)").`,severity:Ie.Error,code:Nr.ConditionValuesInvalidFormula,entity:p}))}}function vRn(a,p,t){if(a.length===0){t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleNumberRequired}`,message:'This numeric condition rule requires 1 numeric target value (e.g., ["100"]).',severity:Ie.Error,code:Nr.ConditionValuesSingleNumberRequired,entity:p}));return}a.length>1&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleNumberRequired}-count`,message:`This numeric condition rule accepts only 1 numeric target value (e.g., ["100"]). You provided ${a.length} items.`,severity:Ie.Error,code:Nr.ConditionValuesSingleNumberRequired,entity:p}));for(let n=0;n<a.length;n++){const s=String(a[n]).trim();(s===""||isNaN(Number(s)))&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleNumberRequired}-${n}`,message:`Condition value "${s}" ${a.length>1?`(at index ${n}) `:""}is invalid. It must be a valid number (e.g., "100").`,severity:Ie.Error,code:Nr.ConditionValuesSingleNumberRequired,entity:p}))}}function gRn(a,p,t){a.length!==2&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesTwoNumbersRequired}`,message:`A "between" condition rule requires exactly 2 boundary values (e.g., ["10", "50"] or ["2024-01-01", "2024-12-31"]). You provided ${a.length} items.`,severity:Ie.Error,code:Nr.ConditionValuesTwoNumbersRequired,entity:p}))}function bRn(a,p,t){if(a.length===0){t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleRangeRequired}`,message:'The "List from cell range" rule requires a valid cell range in A1 notation (e.g., ["Sheet1!A1:A50"]).',severity:Ie.Error,code:Nr.ConditionValuesSingleRangeRequired,entity:p}));return}a.length>1&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleRangeRequired}-count`,message:`The "List from cell range" rule accepts only 1 cell range in A1 notation (e.g., ["Sheet1!A1:A50"]). You provided ${a.length} items.`,severity:Ie.Error,code:Nr.ConditionValuesSingleRangeRequired,entity:p}))}function ERn(a,p,t){a.length===0&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesListEmpty}`,message:'The "List of items" rule requires at least one choice item (e.g., ["Pending", "Approved", "Rejected"]).',severity:Ie.Error,code:Nr.ConditionValuesListEmpty,entity:p}))}function IRn(a,p,t){if(a.length===0){t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleTextRequired}`,message:'This text condition rule requires a non-empty text target value (e.g., ["important"]).',severity:Ie.Error,code:Nr.ConditionValuesSingleTextRequired,entity:p}));return}a.length>1&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleTextRequired}-count`,message:`This text condition rule accepts only 1 text target value (e.g., ["important"]). You provided ${a.length} items.`,severity:Ie.Error,code:Nr.ConditionValuesSingleTextRequired,entity:p}));for(let n=0;n<a.length;n++)String(a[n]).trim()===""&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleTextRequired}-${n}`,message:`Text target value ${a.length>1?`(at index ${n}) `:""}is empty. Expected a non-empty text string.`,severity:Ie.Error,code:Nr.ConditionValuesSingleTextRequired,entity:p}))}function RRn(a,p,t){if(a.length===0){t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleTextRequired}`,message:'This date condition rule requires a target date or relative date string (e.g., ["2024-01-01"]).',severity:Ie.Error,code:Nr.ConditionValuesSingleTextRequired,entity:p}));return}a.length>1&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleTextRequired}-count`,message:`This date condition rule accepts only 1 target date string (e.g., ["2024-01-01"]). You provided ${a.length} items.`,severity:Ie.Error,code:Nr.ConditionValuesSingleTextRequired,entity:p}))}function ARn(a,p,t){a.length>0&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesNoValuesRequired}`,message:`This condition rule does not take any argument values (must be empty list []). You provided ${a.length} items.`,severity:Ie.Error,code:Nr.ConditionValuesNoValuesRequired,entity:p}))}function DRn(a,p,t,n){if(!p&&p!==0&&p!==!1)return;let s=[];if(typeof p=="string")try{const e=JSON.parse(p);s=Array.isArray(e)?e:[p]}catch{s=p.split(",").map(e=>e.trim()).filter(Boolean)}else Array.isArray(p)?s=p:s=[p];const u=l1t(a);if(u)switch(u){case"CUSTOM_FORMULA":TRn(s,t,n);break;case"ONE_OF_LIST":ERn(s,t,n);break;case"ONE_OF_RANGE":bRn(s,t,n);break;case"NUMBER_GREATER":case"NUMBER_GREATER_THAN_EQ":case"NUMBER_LESS":case"NUMBER_LESS_THAN_EQ":case"NUMBER_EQUAL":case"NUMBER_NOT_EQUAL":vRn(s,t,n);break;case"NUMBER_BETWEEN":case"NUMBER_NOT_BETWEEN":case"DATE_BETWEEN":case"DATE_NOT_BETWEEN":gRn(s,t,n);break;case"TEXT_CONTAINS":case"TEXT_NOT_CONTAINS":case"TEXT_DOES_NOT_CONTAIN":case"TEXT_STARTS_WITH":case"TEXT_ENDS_WITH":case"TEXT_EQ":case"TEXT_EQUAL":IRn(s,t,n);break;case"DATE_EQ":case"DATE_TIME_EQUAL":case"DATE_BEFORE":case"DATE_AFTER":case"DATE_ON_OR_BEFORE":case"DATE_ON_OR_AFTER":RRn(s,t,n);break;case"TEXT_IS_EMAIL":case"TEXT_IS_URL":case"DATE_IS_VALID":case"BOOLEAN":ARn(s,t,n);break}}class o1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsAddDataValidation,version:"1.0.0",description:"Add Data Validation Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsAddDataValidation);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T;try{const g=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!g||!g.env)throw new Error("Editor context or environment missing");const b=Be(t,t.project,"addDataValidation"),I="["+Ve(t,t.project,"Add data validation")+": `"+b+"`] ",A=(Oe,Le,Fe)=>{const tt=Ve(Oe==null?void 0:Oe.valueOwner,g==null?void 0:g.logic,Le),We=Be(Oe==null?void 0:Oe.valueOwner,g==null?void 0:g.logic,Fe);return`"${tt}" (\`${We}\`)`},O=n.find(Oe=>{var Le;return((Le=Oe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[J.GoogleSheetsAddDataValidation].inputs.connection.id}),P=(s=O==null?void 0:O.value)==null?void 0:s.valueAsType;if(!P||!P.id||!P.name||P.type!==r.DefinitionEntity)throw new Error(`${I}The ${A(O,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=ui(P);if(!x)throw new Error(`${I}The ${A(O,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const $=n.find(Oe=>{var Le;return((Le=Oe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[J.GoogleSheetsAddDataValidation].inputs.spreadsheetId.id}),U=(u=$==null?void 0:$.value)==null?void 0:u.value,Z=ln(U,{errorPrefix:`${I}The ${A($,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(Oe=>{var Le;return((Le=Oe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[J.GoogleSheetsAddDataValidation].inputs.range.id}),H=(e=q==null?void 0:q.value)==null?void 0:e.value;if(H==null)throw new Error(`${I}The ${A(q,"Range","range")} input is missing.`);const ie={Authorization:`Bearer ${await g.getAccessToken()}`},z=`${(f=g.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${g.projectId}/${Zt["google-sheet"]}/${x}`,W=async Oe=>Ht.post(z,Oe,{headers:ie}),ee=await Ha(H,"Id",async()=>(await W({method:"GET",endpoint:`/v4/spreadsheets/${Z}?fields=sheets.properties(sheetId,title)`})).data.sheets.map(Le=>({id:Le.properties.sheetId,name:Le.properties.title}))),te=ps(ee,{errorPrefix:`${I}The ${A(q,"Range","range")} input `}),X=n.find(Oe=>{var Le;return((Le=Oe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[J.GoogleSheetsAddDataValidation].inputs.conditionType.id}),re=(y=X==null?void 0:X.value)==null?void 0:y.value;if(!re||re==="")throw new Error(`${I}The ${A(X,"Condition Type","conditionType")} input is missing.`);if(typeof re!="string")throw new Error(`${I}The ${A(X,"Condition Type","conditionType")} input value is invalid. It must be a non-empty string.`);const ae=l1t(re)||re,le=n.find(Oe=>{var Le;return((Le=Oe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[J.GoogleSheetsAddDataValidation].inputs.conditionValues.id}),oe=(m=le==null?void 0:le.value)==null?void 0:m.value;let ce=oe;if(typeof oe=="string")try{ce=JSON.parse(oe)}catch{ce=oe.split(",").map(Le=>Le.trim())}Array.isArray(ce)||(ce=ce?[ce]:[]);let be=ae,Ce=ce.map(Oe=>({userEnteredValue:String(Oe)}));if(ae==="TEXT_STARTS_WITH"||ae==="TEXT_ENDS_WITH"){const Oe=UAt(H),Le=ce.length>0?String(ce[0]):"",Fe=Le.replace(/"/g,'""'),tt=ae==="TEXT_STARTS_WITH"?`=LEFT(${Oe}, ${Le.length})="${Fe}"`:`=RIGHT(${Oe}, ${Le.length})="${Fe}"`;be="CUSTOM_FORMULA",Ce=[{userEnteredValue:tt}]}const Ee={setDataValidation:{range:te,rule:{condition:{type:be,values:Ce},showCustomUi:!0}}};return await W({method:"POST",endpoint:`/v4/spreadsheets/${Z}:batchUpdate`,data:{requests:[Ee]}}),{value:K.Success,result:null,error:null}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return pe.Logger.log("[Google Sheets] error:",b),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:b,result:null}}}})}}class d1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsSortRange,version:"1.0.0",description:"Sort Range Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsSortRange);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T;try{const g=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!g||!g.env)throw new Error("Editor context or environment missing");const b=Be(t,t.project,"sortRange"),I="["+Ve(t,t.project,"Sort range")+": `"+b+"`] ",A=(Le,Fe,tt)=>{const We=Ve(Le==null?void 0:Le.valueOwner,g==null?void 0:g.logic,Fe),et=Be(Le==null?void 0:Le.valueOwner,g==null?void 0:g.logic,tt);return`"${We}" (\`${et}\`)`},O=n.find(Le=>{var Fe;return((Fe=Le.valueOwner.declaration)==null?void 0:Fe.id)===G.operation[J.GoogleSheetsSortRange].inputs.connection.id}),P=(s=O==null?void 0:O.value)==null?void 0:s.valueAsType;if(!P||!P.id||!P.name||P.type!==r.DefinitionEntity)throw new Error(`${I}The ${A(O,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=ui(P);if(!x)throw new Error(`${I}The ${A(O,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const $=n.find(Le=>{var Fe;return((Fe=Le.valueOwner.declaration)==null?void 0:Fe.id)===G.operation[J.GoogleSheetsSortRange].inputs.spreadsheetId.id}),U=(u=$==null?void 0:$.value)==null?void 0:u.value,Z=ln(U,{errorPrefix:`${I}The ${A($,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(Le=>{var Fe;return((Fe=Le.valueOwner.declaration)==null?void 0:Fe.id)===G.operation[J.GoogleSheetsSortRange].inputs.range.id}),H=(e=q==null?void 0:q.value)==null?void 0:e.value;if(H==null)throw new Error(`${I}The ${A(q,"Range","range")} input is missing.`);const ie={Authorization:`Bearer ${await g.getAccessToken()}`},z=`${(f=g.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${g.projectId}/${Zt["google-sheet"]}/${x}`,W=async Le=>Ht.post(z,Le,{headers:ie}),ee=await Ha(H,"Id",async()=>(await W({method:"GET",endpoint:`/v4/spreadsheets/${Z}?fields=sheets.properties(sheetId,title)`})).data.sheets.map(Fe=>({id:Fe.properties.sheetId,name:Fe.properties.title}))),te=ps(ee,{errorPrefix:`${I}The ${A(q,"Range","range")} input `}),X=n.find(Le=>{var Fe;return((Fe=Le.valueOwner.declaration)==null?void 0:Fe.id)===G.operation[J.GoogleSheetsSortRange].inputs.sortColumnIndex.id}),re=(y=X==null?void 0:X.value)==null?void 0:y.value;if(re==null)throw new Error(`${I}The ${A(X,"Sort Column Index","sortColumnIndex")} input is missing.`);if(typeof re!="number")throw new Error(`${I}The ${A(X,"Sort Column Index","sortColumnIndex")} input value is invalid. It must be a number.`);const ae=n.find(Le=>{var Fe;return((Fe=Le.valueOwner.declaration)==null?void 0:Fe.id)===G.operation[J.GoogleSheetsSortRange].inputs.sortOrder.id}),le=(m=ae==null?void 0:ae.value)==null?void 0:m.value;if(le==null||le==="")throw new Error(`${I}The ${A(ae,"Sort Order","sortOrder")} input is missing.`);if(typeof le!="string")throw new Error(`${I}The ${A(ae,"Sort Order","sortOrder")} input value is invalid. It must be a string.`);const ce={"Ascending (A-Z, 0-9)":"ASCENDING","Descending (Z-A, 9-0)":"DESCENDING",Ascending:"ASCENDING",Descending:"DESCENDING"}[le]||le.toUpperCase(),be=te.startColumnIndex??0,Ce=te.endColumnIndex;let Ee;if(re>=1?Ee=be+(re-1):Ee=be+re,Ce!==void 0&&(Ee<be||Ee>=Ce)){const Le=Ce-be;throw new Error(`${I}The ${A(X,"Sort Column Index","sortColumnIndex")} input value (${re}) is out of bounds for the specified range. The range contains ${Le} column(s).`)}const Oe={sortRange:{range:te,sortSpecs:[{dimensionIndex:Ee,sortOrder:ce}]}};return await W({method:"POST",endpoint:`/v4/spreadsheets/${Z}:batchUpdate`,data:{requests:[Oe]}}),{value:K.Success,result:null,error:null}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return pe.Logger.log("[Google Sheets] error:",b),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:b,result:null}}}})}}const CRn={"Is empty":"BLANK","Is not empty":"NOT_BLANK","Text contains":"TEXT_CONTAINS","Text does not contain":"TEXT_NOT_CONTAINS","Text starts with":"TEXT_STARTS_WITH","Text ends with":"TEXT_ENDS_WITH","Text is exactly":"TEXT_EQ","Greater than":"NUMBER_GREATER","Greater than or equal to":"NUMBER_GREATER_THAN_EQ","Less than":"NUMBER_LESS","Less than or equal to":"NUMBER_LESS_THAN_EQ","Is equal to":"NUMBER_EQUAL","Is not equal to":"NUMBER_NOT_EQUAL","Is between":"NUMBER_BETWEEN","Is not between":"NUMBER_NOT_BETWEEN","Custom formula":"CUSTOM_FORMULA"},wRn={"Ascending (A-Z, 0-9)":"ASCENDING","Descending (Z-A, 9-0)":"DESCENDING",Ascending:"ASCENDING",Descending:"DESCENDING"};class p1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsCreateFilter,version:"1.0.0",description:"Create Filter Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsCreateFilter);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R;try{const I=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!I||!I.env)throw new Error("Editor context or environment missing");const A=Be(t,t.project,"createFilter"),P="["+Ve(t,t.project,"Create filter")+": `"+A+"`] ",x=(pt,Me,Je)=>{const ke=Ve(pt==null?void 0:pt.valueOwner,I==null?void 0:I.logic,Me),lt=Be(pt==null?void 0:pt.valueOwner,I==null?void 0:I.logic,Je);return`"${ke}" (\`${lt}\`)`},$=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===G.operation[J.GoogleSheetsCreateFilter].inputs.connection.id}),U=(s=$==null?void 0:$.value)==null?void 0:s.valueAsType;if(!U||!U.id||!U.name||U.type!==r.DefinitionEntity)throw new Error(`${P}The ${x($,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const Z=ui(U);if(!Z)throw new Error(`${P}The ${x($,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const q=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===G.operation[J.GoogleSheetsCreateFilter].inputs.spreadsheetId.id}),H=(u=q==null?void 0:q.value)==null?void 0:u.value,Y=ln(H,{errorPrefix:`${P}The ${x(q,"Spreadsheet ID","spreadsheetId")} input `}),ie=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===G.operation[J.GoogleSheetsCreateFilter].inputs.range.id}),z=(e=ie==null?void 0:ie.value)==null?void 0:e.value;if(z==null)throw new Error(`${P}The ${x(ie,"Range","range")} input is missing.`);const W=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===G.operation[J.GoogleSheetsCreateFilter].inputs.columnIndex.id}),ee=(f=W==null?void 0:W.value)==null?void 0:f.value,te=typeof ee=="number"?ee:0,X=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===G.operation[J.GoogleSheetsCreateFilter].inputs.conditionType.id}),re=(y=X==null?void 0:X.value)==null?void 0:y.value,ae=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===G.operation[J.GoogleSheetsCreateFilter].inputs.conditionValues.id}),le=(m=ae==null?void 0:ae.value)==null?void 0:m.value,oe=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===G.operation[J.GoogleSheetsCreateFilter].inputs.hiddenValues.id}),ce=(T=oe==null?void 0:oe.value)==null?void 0:T.value,be=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===G.operation[J.GoogleSheetsCreateFilter].inputs.sortOrder.id}),Ce=(g=be==null?void 0:be.value)==null?void 0:g.value,Oe={Authorization:`Bearer ${await I.getAccessToken()}`},Le=`${(b=I.env)==null?void 0:b.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${I.projectId}/${Zt["google-sheet"]}/${Z}`,Fe=async pt=>Ht.post(Le,pt,{headers:Oe}),tt=await Ha(z,"Id",async()=>(await Fe({method:"GET",endpoint:`/v4/spreadsheets/${Y}?fields=sheets.properties(sheetId,title)`})).data.sheets.map(Me=>({id:Me.properties.sheetId,name:Me.properties.title}))),We=ps(tt,{errorPrefix:`${P}The ${x(ie,"Range","range")} input `}),et={range:We},qe={},ot=typeof re=="string"?re:String(re||""),st=CRn[ot]||(re?String(re).toUpperCase():void 0);if(st){const pt=Array.isArray(le)?le.map(Me=>({userEnteredValue:String(Me)})):le!=null&&le!==""?[{userEnteredValue:String(le)}]:void 0;qe.condition={type:st,...pt?{values:pt}:{}}}Array.isArray(ce)&&ce.length>0&&(qe.hiddenValues=ce.map(pt=>String(pt))),Object.keys(qe).length>0&&(et.criteria={[te]:qe});const ft=typeof Ce=="string"?Ce:String(Ce||""),Et=wRn[ft]||(Ce?String(Ce).toUpperCase():void 0);if(Et){const pt=We.startColumnIndex??0,Me=te>=1?pt+(te-1):pt+te;et.sortSpecs=[{dimensionIndex:Me,sortOrder:Et}]}return await Fe({method:"POST",endpoint:`/v4/spreadsheets/${Y}:batchUpdate`,data:{requests:[{setBasicFilter:{filter:et}}]}}),{value:K.Success,result:null,error:null}}catch(I){const A=((R=I.response)==null?void 0:R.data)||I.message||I;return pe.Logger.log("[Google Sheets] error:",A),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:A,result:null}}}})}}class u1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsRemoveFilter,version:"1.0.0",description:"Remove Filter Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsRemoveFilter);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"removeFilter"),b="["+Ve(t,t.project,"Remove filter")+": `"+T+"`] ",R=(te,X,re)=>{const ae=Ve(te==null?void 0:te.valueOwner,m==null?void 0:m.logic,X),le=Be(te==null?void 0:te.valueOwner,m==null?void 0:m.logic,re);return`"${ae}" (\`${le}\`)`},I=n.find(te=>{var X;return((X=te.valueOwner.declaration)==null?void 0:X.id)===G.operation[J.GoogleSheetsRemoveFilter].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(A);if(!O)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(te=>{var X;return((X=te.valueOwner.declaration)==null?void 0:X.id)===G.operation[J.GoogleSheetsRemoveFilter].inputs.spreadsheetId.id}),x=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(x,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(te=>{var X;return((X=te.valueOwner.declaration)==null?void 0:X.id)===G.operation[J.GoogleSheetsRemoveFilter].inputs.range.id}),Z=(e=U==null?void 0:U.value)==null?void 0:e.value;if(Z==null)throw new Error(`${b}The ${R(U,"Range","range")} input is missing.`);const H={Authorization:`Bearer ${await m.getAccessToken()}`},Y=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${O}`,ie=async te=>Ht.post(Y,te,{headers:H}),z=await Ha(Z,"Id",async()=>(await ie({method:"GET",endpoint:`/v4/spreadsheets/${$}?fields=sheets.properties(sheetId,title)`})).data.sheets.map(X=>({id:X.properties.sheetId,name:X.properties.title}))),ee=ps(z,{errorPrefix:`${b}The ${R(U,"Range","range")} input `}).sheetId;return await ie({method:"POST",endpoint:`/v4/spreadsheets/${$}:batchUpdate`,data:{requests:[{clearBasicFilter:{sheetId:ee}}]}}),{value:K.Success,result:null,error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class c1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsUpdateSpreadsheetProperties,version:"1.0.0",description:"Update Spreadsheet Properties Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsUpdateSpreadsheetProperties);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I;try{const A=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!A||!A.env)throw new Error("Editor context or environment missing");const O=Be(t,t.project,"updateSpreadsheetProperties"),x="["+Ve(t,t.project,"Update spreadsheet properties")+": `"+O+"`] ",$=(st,ft,Et)=>{const pt=Ve(st==null?void 0:st.valueOwner,A==null?void 0:A.logic,ft),Me=Be(st==null?void 0:st.valueOwner,A==null?void 0:A.logic,Et);return`"${pt}" (\`${Me}\`)`},U=n.find(st=>{var ft;return((ft=st.valueOwner.declaration)==null?void 0:ft.id)===G.operation[J.GoogleSheetsUpdateSpreadsheetProperties].inputs.connection.id}),Z=(s=U==null?void 0:U.value)==null?void 0:s.valueAsType;if(!Z||!Z.id||!Z.name||Z.type!==r.DefinitionEntity)throw new Error(`${x}The ${$(U,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const q=ui(Z);if(!q)throw new Error(`${x}The ${$(U,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const H=n.find(st=>{var ft;return((ft=st.valueOwner.declaration)==null?void 0:ft.id)===G.operation[J.GoogleSheetsUpdateSpreadsheetProperties].inputs.spreadsheetId.id}),Y=(u=H==null?void 0:H.value)==null?void 0:u.value,ie=ln(Y,{errorPrefix:`${x}The ${$(H,"Spreadsheet ID","spreadsheetId")} input `}),z=n.find(st=>{var ft;return((ft=st.valueOwner.declaration)==null?void 0:ft.id)===G.operation[J.GoogleSheetsUpdateSpreadsheetProperties].inputs.title.id}),W=(e=z==null?void 0:z.value)==null?void 0:e.value;if(W!=null&&typeof W!="string")throw new Error(`${x}The ${$(z,"Title","title")} input value is invalid. If present, it must be a string. E.g. "My Spreadsheet"`);const ee=n.find(st=>{var ft;return((ft=st.valueOwner.declaration)==null?void 0:ft.id)===G.operation[J.GoogleSheetsUpdateSpreadsheetProperties].inputs.locale.id}),te=(f=ee==null?void 0:ee.value)==null?void 0:f.value;if(te!=null&&typeof te!="string")throw new Error(`${x}The ${$(ee,"Locale","locale")} input value is invalid. If present, it must be a string. E.g. "en_US"`);const X=n.find(st=>{var ft;return((ft=st.valueOwner.declaration)==null?void 0:ft.id)===G.operation[J.GoogleSheetsUpdateSpreadsheetProperties].inputs.timeZone.id}),re=(y=X==null?void 0:X.value)==null?void 0:y.value;if(re!=null&&typeof re!="string")throw new Error(`${x}The ${$(X,"Time Zone","timeZone")} input value is invalid. If present, it must be a string. E.g. "America/New_York"`);const ae=n.find(st=>{var ft;return((ft=st.valueOwner.declaration)==null?void 0:ft.id)===G.operation[J.GoogleSheetsUpdateSpreadsheetProperties].inputs.autoRecalc.id}),le=(m=ae==null?void 0:ae.value)==null?void 0:m.value;if(le!=null&&typeof le!="string")throw new Error(`${x}The ${$(ae,"Auto Recalculation","autoRecalc")} input value is invalid. If present, it must be a string enum value. E.g. "ON_CHANGE"`);const oe=n.find(st=>{var ft;return((ft=st.valueOwner.declaration)==null?void 0:ft.id)===G.operation[J.GoogleSheetsUpdateSpreadsheetProperties].inputs.defaultFormat.id}),ce=(T=oe==null?void 0:oe.value)==null?void 0:T.value;if(ce!=null&&(typeof ce!="object"||Array.isArray(ce)))throw new Error(`${x}The ${$(oe,"Default Format","defaultFormat")} input value is invalid. If present, it must be an object representing the CellFormat.`);const be=n.find(st=>{var ft;return((ft=st.valueOwner.declaration)==null?void 0:ft.id)===G.operation[J.GoogleSheetsUpdateSpreadsheetProperties].inputs.iterativeCalculationSettings.id}),Ce=(g=be==null?void 0:be.value)==null?void 0:g.value;if(Ce!=null&&(typeof Ce!="object"||Array.isArray(Ce)))throw new Error(`${x}The ${$(be,"Iterative Calculation Settings","iterativeCalculationSettings")} input value is invalid. If present, it must be an object.`);const Ee=n.find(st=>{var ft;return((ft=st.valueOwner.declaration)==null?void 0:ft.id)===G.operation[J.GoogleSheetsUpdateSpreadsheetProperties].inputs.spreadsheetTheme.id}),Oe=(b=Ee==null?void 0:Ee.value)==null?void 0:b.value;if(Oe!=null&&(typeof Oe!="object"||Array.isArray(Oe)))throw new Error(`${x}The ${$(Ee,"Spreadsheet Theme","spreadsheetTheme")} input value is invalid. If present, it must be an object.`);const Le={};if(W!=null&&(Le.title=W),te!=null&&(Le.locale=te),re!=null&&(Le.timeZone=re),le!=null){const st={"On change":"ON_CHANGE","Every minute":"MINUTE","Every hour":"HOUR"};Le.autoRecalc=st[le]||le.toUpperCase()}ce!=null&&(Le.defaultFormat=ce),Ce!=null&&(Le.iterativeCalculationSettings=Ce),Oe!=null&&(Le.spreadsheetTheme=Oe);const Fe=(st,ft="")=>{let Et=[];for(const pt in st){if(!Object.prototype.hasOwnProperty.call(st,pt))continue;const Me=st[pt],Je=ft?`${ft}.${pt}`:pt;Me!==null&&typeof Me=="object"&&!Array.isArray(Me)&&Object.keys(Me).length>0?Et.push(...Fe(Me,Je)):Et.push(Je)}return Et},tt=Fe(Le);if(tt.length===0)throw new Error(`${x}At least one property must be provided to update.`);const et={Authorization:`Bearer ${await A.getAccessToken()}`},qe=`${(R=A.env)==null?void 0:R.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${A.projectId}/${Zt["google-sheet"]}/${q}`;return await(async st=>Ht.post(qe,st,{headers:et}))({method:"POST",endpoint:`/v4/spreadsheets/${ie}:batchUpdate`,data:{requests:[{updateSpreadsheetProperties:{properties:Le,fields:tt.join(",")}}]}}),{value:K.Success,result:null,error:null}}catch(A){const O=((I=A.response)==null?void 0:I.data)||A.message||A;return pe.Logger.log("[Google Sheets] error:",O),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:O,result:null}}}})}}const g5=(a,p)=>(pe.Logger.log("[Google Sheets Clone Sheet] error:",p),{value:a.catchesError||a.errorCalls.length?K.CaughtError:K.UnhandledError,error:p,result:null});class f1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsCloneSheet,version:"1.0.0",description:"Google Sheets clone sheet operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsCloneSheet);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A,O,P;try{const x=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0],$=Be(t,t.project,"cloneSheet"),Z="["+Ve(t,t.project,"Clone Sheet")+": `"+$+"`] ",q=(qe,ot,st)=>{const ft=Ve(qe==null?void 0:qe.valueOwner,x==null?void 0:x.logic,ot),Et=Be(qe==null?void 0:qe.valueOwner,x==null?void 0:x.logic,st);return`"${ft}" (\`${Et}\`)`},H=G.operation[J.GoogleSheetsCloneSheet],Y=n.find(qe=>{var ot,st;return((st=(ot=qe.valueOwner)==null?void 0:ot.declaration)==null?void 0:st.id)===H.inputs.connection.id}),ie=((s=Y==null?void 0:Y.value)==null?void 0:s.valueAsType)??((u=Y==null?void 0:Y.value)==null?void 0:u.value);if(!ie||!ie.id||!ie.name||ie.type!==r.DefinitionEntity)throw new Error(`${Z}The ${q(Y,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const z=ui(ie);if(!z)throw new Error(`${Z}The ${q(Y,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const W=n.find(qe=>{var ot,st;return((st=(ot=qe.valueOwner)==null?void 0:ot.declaration)==null?void 0:st.id)===H.inputs.spreadsheetId.id}),ee=(e=W==null?void 0:W.value)==null?void 0:e.value,te=ln(ee,{errorPrefix:`${Z}The ${q(W,"Spreadsheet ID","spreadsheetId")} input `}),X=n.find(qe=>{var ot,st;return((st=(ot=qe.valueOwner)==null?void 0:ot.declaration)==null?void 0:st.id)===H.inputs.sheet.id}),re=(f=X==null?void 0:X.value)==null?void 0:f.value;if(re==null||re==="")throw new Error(`${Z}The ${q(X,"Sheet","sheet")} input is missing.`);const ae=(m=(y=n.find(qe=>{var ot,st;return((st=(ot=qe.valueOwner)==null?void 0:ot.declaration)==null?void 0:st.id)===H.inputs.newSheetName.id}))==null?void 0:y.value)==null?void 0:m.value,le=(g=(T=n.find(qe=>{var ot,st;return((st=(ot=qe.valueOwner)==null?void 0:ot.declaration)==null?void 0:st.id)===H.inputs.insertIndex.id}))==null?void 0:T.value)==null?void 0:g.value,ce={Authorization:`Bearer ${await x.getAccessToken()}`},be=`${(b=x.env)==null?void 0:b.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${x.projectId}/${Zt["google-sheet"]}/${z}`,Ce=async qe=>Ht.post(be,qe,{headers:ce});let Ee;if(!isNaN(Number(re)))Ee=Number(re);else{const st=(((R=(await Ce({method:"GET",endpoint:`/v4/spreadsheets/${te}`})).data)==null?void 0:R.sheets)||[]).find(ft=>{var Et;return((Et=ft.properties)==null?void 0:Et.title)===String(re)});if(!st)return g5(t,`Could not find sheet with name "${re}"`);Ee=st.properties.sheetId}const Oe={sourceSheetId:Ee};ae&&(Oe.newSheetName=ae),typeof le=="number"&&(Oe.insertSheetIndex=le);const tt=((O=(A=(I=((await Ce({method:"POST",endpoint:`/v4/spreadsheets/${te}:batchUpdate`,data:{requests:[{duplicateSheet:Oe}]}})).data||{}).replies)==null?void 0:I[0])==null?void 0:A.duplicateSheet)==null?void 0:O.properties)||{},We=tt.gridProperties||{},et={sheetId:tt.sheetId,title:tt.title,index:tt.index,sheetType:tt.sheetType,rowCount:We.rowCount,columnCount:We.columnCount,frozenRowCount:We.frozenRowCount,frozenColumnCount:We.frozenColumnCount,hideGridlines:We.hideGridlines??!1,rowGroupControlAfter:We.rowGroupControlAfter??!1,columnGroupControlAfter:We.columnGroupControlAfter??!1,hidden:tt.hidden??!1,rightToLeft:tt.rightToLeft??!1,tabColor:tt.tabColor?{red:tt.tabColor.red??0,green:tt.tabColor.green??0,blue:tt.tabColor.blue??0,alpha:tt.tabColor.alpha??1}:null,basicFilter:null,protectedRanges:[],bandedRanges:[],charts:[],conditionalFormatRules:[],mergedCells:[]};return{value:K.Success,error:null,result:et}}catch(x){const $=((P=x.response)==null?void 0:P.data)||x.message||x;return g5(t,$)}}})}}class y1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsDeleteChart,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsDeleteChart);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"deleteChart"),b="["+Ve(t,t.project,"Delete Chart")+": `"+T+"`] ",R=(ee,te,X)=>{const re=Ve(ee==null?void 0:ee.valueOwner,m==null?void 0:m.logic,te),ae=Be(ee==null?void 0:ee.valueOwner,m==null?void 0:m.logic,X);return`"${re}" (\`${ae}\`)`},I=n.find(ee=>{var te;return((te=ee.valueOwner.declaration)==null?void 0:te.id)===G.operation[J.GoogleSheetsDeleteChart].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(A);if(!O)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(ee=>{var te;return((te=ee.valueOwner.declaration)==null?void 0:te.id)===G.operation[J.GoogleSheetsDeleteChart].inputs.spreadsheetId.id}),x=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(x,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(ee=>{var te;return((te=ee.valueOwner.declaration)==null?void 0:te.id)===G.operation[J.GoogleSheetsDeleteChart].inputs.chartId.id}),Z=(e=U==null?void 0:U.value)==null?void 0:e.value;let q=typeof Z=="number"?Z:typeof Z=="string"?parseInt(Z,10):NaN;if(isNaN(q))throw new Error(`${b}The ${R(U,"Chart ID","chartId")} input is missing or invalid. Expected a numeric chart ID.`);const Y={Authorization:`Bearer ${await m.getAccessToken()}`},ie=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${O}`,z=async ee=>Ht.post(ie,ee,{headers:Y});let W={};return W.deleteEmbeddedObject={objectId:q},await z({method:"POST",endpoint:`/v4/spreadsheets/${$}:batchUpdate`,data:{requests:[W]}}),{value:K.Success,result:null,error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class h1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsDeletePivotTable,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsDeletePivotTable);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"deletePivotTable"),b="["+Ve(t,t.project,"Delete Pivot Table")+": `"+T+"`] ",R=(re,ae,le)=>{const oe=Ve(re==null?void 0:re.valueOwner,m==null?void 0:m.logic,ae),ce=Be(re==null?void 0:re.valueOwner,m==null?void 0:m.logic,le);return`"${oe}" (\`${ce}\`)`},I=n.find(re=>{var ae;return((ae=re.valueOwner.declaration)==null?void 0:ae.id)===G.operation[J.GoogleSheetsDeletePivotTable].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(A);if(!O)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(re=>{var ae;return((ae=re.valueOwner.declaration)==null?void 0:ae.id)===G.operation[J.GoogleSheetsDeletePivotTable].inputs.spreadsheetId.id}),x=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(x,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(re=>{var ae;return((ae=re.valueOwner.declaration)==null?void 0:ae.id)===G.operation[J.GoogleSheetsDeletePivotTable].inputs.destination.id}),Z=(e=U==null?void 0:U.value)==null?void 0:e.value;if(Z==null)throw new Error(`${b}The ${R(U,"destination","destination")} input is missing.`);const H={Authorization:`Bearer ${await m.getAccessToken()}`},Y=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${O}`,ie=async re=>Ht.post(Y,re,{headers:H});let z=[];try{z=(await ie({method:"GET",endpoint:`/v4/spreadsheets/${$}?fields=sheets(properties(sheetId,title))`})).data.sheets||[]}catch{}const W=await Ha(Z,"Id",async()=>z.map(re=>({id:re.properties.sheetId,name:re.properties.title}))),ee=ps(W,{errorPrefix:`${b}The ${R(U,"destination","destination")} input `});let X={updateCells:{start:{sheetId:ee.sheetId??0,rowIndex:ee.startRowIndex??0,columnIndex:ee.startColumnIndex??0},rows:[{values:[{pivotTable:null}]}],fields:"pivotTable"}};return await ie({method:"POST",endpoint:`/v4/spreadsheets/${$}:batchUpdate`,data:{requests:[X]}}),{value:K.Success,result:null,error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class m1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsDeleteDimension,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsDeleteDimension);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b;try{const R=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!R||!R.env)throw new Error("Editor context or environment missing");const I=Be(t,t.project,"deleteDimension"),O="["+Ve(t,t.project,"Delete Dimension")+": `"+I+"`] ",P=(Fe,tt,We)=>{const et=Ve(Fe==null?void 0:Fe.valueOwner,R==null?void 0:R.logic,tt),qe=Be(Fe==null?void 0:Fe.valueOwner,R==null?void 0:R.logic,We);return`"${et}" (\`${qe}\`)`},x=n.find(Fe=>{var tt;return((tt=Fe.valueOwner.declaration)==null?void 0:tt.id)===G.operation[J.GoogleSheetsDeleteDimension].inputs.connection.id}),$=(s=x==null?void 0:x.value)==null?void 0:s.valueAsType;if(!$||!$.id||!$.name||$.type!==r.DefinitionEntity)throw new Error(`${O}The ${P(x,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const U=ui($);if(!U)throw new Error(`${O}The ${P(x,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const Z=n.find(Fe=>{var tt;return((tt=Fe.valueOwner.declaration)==null?void 0:tt.id)===G.operation[J.GoogleSheetsDeleteDimension].inputs.spreadsheetId.id}),q=(u=Z==null?void 0:Z.value)==null?void 0:u.value,H=ln(q,{errorPrefix:`${O}The ${P(Z,"Spreadsheet ID","spreadsheetId")} input `}),Y=n.find(Fe=>{var tt,We;return((tt=Fe.valueOwner.declaration)==null?void 0:tt.id)===((We=G.operation[J.GoogleSheetsDeleteDimension].inputs.sheet)==null?void 0:We.id)}),ie=(e=Y==null?void 0:Y.value)==null?void 0:e.value,z=n.find(Fe=>{var tt,We;return((tt=Fe.valueOwner.declaration)==null?void 0:tt.id)===((We=G.operation[J.GoogleSheetsDeleteDimension].inputs.dimension)==null?void 0:We.id)}),W=(f=z==null?void 0:z.value)==null?void 0:f.value,ee=n.find(Fe=>{var tt,We;return((tt=Fe.valueOwner.declaration)==null?void 0:tt.id)===((We=G.operation[J.GoogleSheetsDeleteDimension].inputs.startIndex)==null?void 0:We.id)}),te=(y=ee==null?void 0:ee.value)==null?void 0:y.value,X=n.find(Fe=>{var tt,We;return((tt=Fe.valueOwner.declaration)==null?void 0:tt.id)===((We=G.operation[J.GoogleSheetsDeleteDimension].inputs.endIndex)==null?void 0:We.id)}),re=(m=X==null?void 0:X.value)==null?void 0:m.value,le={Authorization:`Bearer ${await R.getAccessToken()}`},oe=`${(T=R.env)==null?void 0:T.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${R.projectId}/${Zt["google-sheet"]}/${U}`,ce=async Fe=>Ht.post(oe,Fe,{headers:le});if(ie==null||ie==="")throw new Error(`${O}The ${P(Y,"Sheet","sheet")} input is missing.`);if(W==null||W==="")throw new Error(`${O}The ${P(z,"Dimension","dimension")} input is missing.`);const be=String(W).trim().toUpperCase();if(be!=="ROWS"&&be!=="COLUMNS")throw new Error(`${O}The ${P(z,"Dimension","dimension")} input is invalid. Expected "Rows" or "Columns".`);const Ce=typeof te=="number"?te:parseInt(String(te),10);if(isNaN(Ce)||Ce<1)throw new Error(`${O}The ${P(ee,"Start index","startIndex")} input is missing or invalid. Expected a positive integer starting at 1.`);let Ee=Ce;if(re!=null&&re!==""&&(Ee=typeof re=="number"?re:parseInt(String(re),10),isNaN(Ee)||Ee<Ce))throw new Error(`${O}The ${P(X,"End index","endIndex")} input is invalid. Expected an integer greater than or equal to Start index.`);let Oe;if(typeof ie=="number"||/^\d+$/.test(String(ie).trim()))Oe=Number(ie);else{const We=(((g=(await ce({method:"GET",endpoint:`/v4/spreadsheets/${H}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:g.sheets)||[]).find(et=>{var qe;return String((qe=et.properties)==null?void 0:qe.title).trim().toLowerCase()===String(ie).trim().toLowerCase()});if(!We)throw new Error(`${O}The ${P(Y,"Sheet","sheet")} input "${ie}" was not found in spreadsheet.`);Oe=We.properties.sheetId}let Le={};return Le.deleteDimension={range:{sheetId:Oe,dimension:be,startIndex:Ce-1,endIndex:Ee}},await ce({method:"POST",endpoint:`/v4/spreadsheets/${H}:batchUpdate`,data:{requests:[Le]}}),{value:K.Success,result:null,error:null}}catch(R){const I=((b=R.response)==null?void 0:b.data)||R.message||R;return pe.Logger.log("[Google Sheets] error:",I),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:I,result:null}}}})}}class T1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsDeleteProtectedRange,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsDeleteProtectedRange);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"deleteProtectedRange"),b="["+Ve(t,t.project,"Delete Protected Range")+": `"+T+"`] ",R=(W,ee,te)=>{const X=Ve(W==null?void 0:W.valueOwner,m==null?void 0:m.logic,ee),re=Be(W==null?void 0:W.valueOwner,m==null?void 0:m.logic,te);return`"${X}" (\`${re}\`)`},I=n.find(W=>{var ee;return((ee=W.valueOwner.declaration)==null?void 0:ee.id)===G.operation[J.GoogleSheetsDeleteProtectedRange].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(A);if(!O)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(W=>{var ee;return((ee=W.valueOwner.declaration)==null?void 0:ee.id)===G.operation[J.GoogleSheetsDeleteProtectedRange].inputs.spreadsheetId.id}),x=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(x,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(W=>{var ee;return((ee=W.valueOwner.declaration)==null?void 0:ee.id)===G.operation[J.GoogleSheetsDeleteProtectedRange].inputs.protectedRangeId.id}),Z=(e=U==null?void 0:U.value)==null?void 0:e.value;if(Z==null)throw new Error(`${b}The ${R(U,"protectedRangeId","protectedRangeId")} input is missing.`);const H={Authorization:`Bearer ${await m.getAccessToken()}`},Y=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${O}`,ie=async W=>Ht.post(Y,W,{headers:H});let z={};return z.deleteProtectedRange={protectedRangeId:typeof Z=="string"&&Z.trim().startsWith("{")?JSON.parse(Z):Z},await ie({method:"POST",endpoint:`/v4/spreadsheets/${$}:batchUpdate`,data:{requests:[z]}}),{value:K.Success,result:null,error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class v1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsAddBanding,version:"1.0.0",description:"Add Banding Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsAddBanding);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A,O,P,x,$,U;try{const Z=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!Z||!Z.env)throw new Error("Editor context or environment missing");const q=Be(t,t.project,"addBanding"),Y="["+Ve(t,t.project,"Add Banding")+": `"+q+"`] ",ie=(di,bt,dt)=>{const It=Ve(di==null?void 0:di.valueOwner,Z==null?void 0:Z.logic,bt),Wt=Be(di==null?void 0:di.valueOwner,Z==null?void 0:Z.logic,dt);return`"${It}" (\`${Wt}\`)`},z=n.find(di=>{var bt;return((bt=di.valueOwner.declaration)==null?void 0:bt.id)===G.operation[J.GoogleSheetsAddBanding].inputs.connection.id}),W=(s=z==null?void 0:z.value)==null?void 0:s.valueAsType;if(!W||!W.id||!W.name||W.type!==r.DefinitionEntity)throw new Error(`${Y}The ${ie(z,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const ee=ui(W);if(!ee)throw new Error(`${Y}The ${ie(z,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const te=n.find(di=>{var bt;return((bt=di.valueOwner.declaration)==null?void 0:bt.id)===G.operation[J.GoogleSheetsAddBanding].inputs.spreadsheetId.id}),X=(u=te==null?void 0:te.value)==null?void 0:u.value,re=ln(X,{errorPrefix:`${Y}The ${ie(te,"Spreadsheet ID","spreadsheetId")} input `}),ae=n.find(di=>{var bt;return((bt=di.valueOwner.declaration)==null?void 0:bt.id)===G.operation[J.GoogleSheetsAddBanding].inputs.bandedRange.id}),le=(e=ae==null?void 0:ae.value)==null?void 0:e.value;if(le==null)throw new Error(`${Y}The ${ie(ae,"bandedRange","bandedRange")} input is missing.`);const oe=n.find(di=>{var bt,dt;return((bt=di.valueOwner.declaration)==null?void 0:bt.id)===((dt=G.operation[J.GoogleSheetsAddBanding].inputs.bandingOrientation)==null?void 0:dt.id)}),ce=(f=oe==null?void 0:oe.value)==null?void 0:f.value,be=typeof ce=="string"?ce:"Rows";if(!["Rows","Columns","Grid"].includes(be))throw new Error(`${Y}The ${ie(oe,"Banding Orientation","bandingOrientation")} input must be one of "Rows", "Columns", or "Grid". Received: "${be}".`);const Ce=n.find(di=>{var bt,dt;return((bt=di.valueOwner.declaration)==null?void 0:bt.id)===((dt=G.operation[J.GoogleSheetsAddBanding].inputs.headerColor)==null?void 0:dt.id)}),Ee=(y=Ce==null?void 0:Ce.value)==null?void 0:y.value,Oe=n.find(di=>{var bt,dt;return((bt=di.valueOwner.declaration)==null?void 0:bt.id)===((dt=G.operation[J.GoogleSheetsAddBanding].inputs.firstBandColor)==null?void 0:dt.id)}),Le=(m=Oe==null?void 0:Oe.value)==null?void 0:m.value,Fe=n.find(di=>{var bt,dt;return((bt=di.valueOwner.declaration)==null?void 0:bt.id)===((dt=G.operation[J.GoogleSheetsAddBanding].inputs.secondBandColor)==null?void 0:dt.id)}),tt=(T=Fe==null?void 0:Fe.value)==null?void 0:T.value,We=n.find(di=>{var bt,dt;return((bt=di.valueOwner.declaration)==null?void 0:bt.id)===((dt=G.operation[J.GoogleSheetsAddBanding].inputs.footerColor)==null?void 0:dt.id)}),et=(g=We==null?void 0:We.value)==null?void 0:g.value,qe=n.find(di=>{var bt,dt;return((bt=di.valueOwner.declaration)==null?void 0:bt.id)===((dt=G.operation[J.GoogleSheetsAddBanding].inputs.gridBandColor)==null?void 0:dt.id)}),ot=(b=qe==null?void 0:qe.value)==null?void 0:b.value,st=n.find(di=>{var bt,dt;return((bt=di.valueOwner.declaration)==null?void 0:bt.id)===((dt=G.operation[J.GoogleSheetsAddBanding].inputs.deleteConflictingBanding)==null?void 0:dt.id)}),ft=((R=st==null?void 0:st.value)==null?void 0:R.value)??!0,pt={Authorization:`Bearer ${await Z.getAccessToken()}`},Me=`${(I=Z.env)==null?void 0:I.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${Z.projectId}/${Zt["google-sheet"]}/${ee}`,Je=async di=>Ht.post(Me,di,{headers:pt});let ke=[],lt=[];try{lt=(await Je({method:"GET",endpoint:`/v4/spreadsheets/${re}?fields=sheets(properties(sheetId,title),bandedRanges)`})).data.sheets||[]}catch{}const Pt=await Ha(le,"Id",async()=>lt.map(di=>({id:di.properties.sheetId,name:di.properties.title}))),Gt=ps(Pt,{errorPrefix:`${Y}The ${ie(ae,"bandedRange","bandedRange")} input `});let si=null;if(Gt.sheetId!==void 0&&Gt.sheetId!==null)si=lt.find(di=>{var bt;return((bt=di.properties)==null?void 0:bt.sheetId)===Gt.sheetId});else if(Pt&&Pt.sheet!==void 0&&Pt.sheet!==null&&Pt.sheet!==""){const di=String(Pt.sheet).trim().toLowerCase();if(si=lt.find(bt=>{var dt,It;return String((dt=bt.properties)==null?void 0:dt.title).trim().toLowerCase()===di||String((It=bt.properties)==null?void 0:It.sheetId)===di}),!si)throw new Error(`${Y}Sheet "${Pt.sheet}" was not found in the spreadsheet.`);Gt.sheetId=si.properties.sheetId}else si=lt[0],Gt.sheetId=((A=si==null?void 0:si.properties)==null?void 0:A.sheetId)??0;Gt.startRowIndex===void 0&&Gt.endRowIndex===void 0&&Gt.startColumnIndex===void 0&&Gt.endColumnIndex===void 0&&(Gt.startRowIndex=0,Gt.endRowIndex=100,Gt.startColumnIndex=0,Gt.endColumnIndex=26),si!=null&&si.bandedRanges&&(ke=si.bandedRanges);const pi={range:Gt},kt=fo(Ee),Ct=fo(Le),xi=fo(tt),wn=fo(et),Yr=fo(ot),Jr={firstBandColor:Ct||{red:1,green:1,blue:1,alpha:1},secondBandColor:xi||{red:.95,green:.95,blue:.95,alpha:1}};kt&&(Jr.headerColor=kt),wn&&(Jr.footerColor=wn);const hi={firstBandColor:be==="Grid"?Yr||Ct||{red:1,green:1,blue:1,alpha:1}:Ct||{red:1,green:1,blue:1,alpha:1},secondBandColor:be==="Grid"?Yr||xi||{red:.95,green:.95,blue:.95,alpha:1}:xi||{red:.95,green:.95,blue:.95,alpha:1}};kt&&(hi.headerColor=kt),wn&&(hi.footerColor=wn),be==="Grid"?(pi.rowProperties=Jr,pi.columnProperties=hi):be==="Columns"?pi.columnProperties=hi:pi.rowProperties=Jr;const $t=[];if(ft)for(const di of ke)di.bandedRangeId!==void 0&&$t.push({deleteBanding:{bandedRangeId:di.bandedRangeId}});$t.push({addBanding:{bandedRange:pi}});const ci=(P=(O=(await Je({method:"POST",endpoint:`/v4/spreadsheets/${re}:batchUpdate`,data:{requests:$t}})).data)==null?void 0:O.replies)==null?void 0:P.find(di=>di.addBanding),oi=($=(x=ci==null?void 0:ci.addBanding)==null?void 0:x.bandedRange)==null?void 0:$.bandedRangeId;return{value:K.Success,result:{bandedRangeId:oi},error:null}}catch(Z){const q=((U=Z.response)==null?void 0:U.data)||Z.message||Z;return pe.Logger.log("[Google Sheets] error:",q),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:q,result:null}}}})}}class ORn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsUpdateBanding,version:"1.0.0",description:"Update Banding Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsUpdateBanding);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A;try{const O=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!O||!O.env)throw new Error("Editor context or environment missing");const P=Be(t,t.project,"updateBanding"),$="["+Ve(t,t.project,"Update Banding")+": `"+P+"`] ",U=(ci,oi,di)=>{const bt=Ve(ci==null?void 0:ci.valueOwner,O==null?void 0:O.logic,oi),dt=Be(ci==null?void 0:ci.valueOwner,O==null?void 0:O.logic,di);return`"${bt}" (\`${dt}\`)`},Z=n.find(ci=>{var oi;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===G.operation[J.GoogleSheetsUpdateBanding].inputs.connection.id}),q=(s=Z==null?void 0:Z.value)==null?void 0:s.valueAsType;if(!q||!q.id||!q.name||q.type!==r.DefinitionEntity)throw new Error(`${$}The ${U(Z,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const H=ui(q);if(!H)throw new Error(`${$}The ${U(Z,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const Y=n.find(ci=>{var oi;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===G.operation[J.GoogleSheetsUpdateBanding].inputs.spreadsheetId.id}),ie=(u=Y==null?void 0:Y.value)==null?void 0:u.value,z=ln(ie,{errorPrefix:`${$}The ${U(Y,"Spreadsheet ID","spreadsheetId")} input `}),W=n.find(ci=>{var oi;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===G.operation[J.GoogleSheetsUpdateBanding].inputs.bandedRangeId.id}),ee=(e=W==null?void 0:W.value)==null?void 0:e.value;if(ee==null||ee==="")throw new Error(`${$}The ${U(W,"Banded Range ID","bandedRangeId")} input is missing.`);const te=Number(ee),X=n.find(ci=>{var oi,di;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===((di=G.operation[J.GoogleSheetsUpdateBanding].inputs.bandedRange)==null?void 0:di.id)}),re=(f=X==null?void 0:X.value)==null?void 0:f.value,ae=n.find(ci=>{var oi,di;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===((di=G.operation[J.GoogleSheetsUpdateBanding].inputs.bandingOrientation)==null?void 0:di.id)}),le=(y=ae==null?void 0:ae.value)==null?void 0:y.value,oe=n.find(ci=>{var oi,di;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===((di=G.operation[J.GoogleSheetsUpdateBanding].inputs.headerColor)==null?void 0:di.id)}),ce=(m=oe==null?void 0:oe.value)==null?void 0:m.value,be=n.find(ci=>{var oi,di;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===((di=G.operation[J.GoogleSheetsUpdateBanding].inputs.firstBandColor)==null?void 0:di.id)}),Ce=(T=be==null?void 0:be.value)==null?void 0:T.value,Ee=n.find(ci=>{var oi,di;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===((di=G.operation[J.GoogleSheetsUpdateBanding].inputs.secondBandColor)==null?void 0:di.id)}),Oe=(g=Ee==null?void 0:Ee.value)==null?void 0:g.value,Le=n.find(ci=>{var oi,di;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===((di=G.operation[J.GoogleSheetsUpdateBanding].inputs.footerColor)==null?void 0:di.id)}),Fe=(b=Le==null?void 0:Le.value)==null?void 0:b.value,tt=n.find(ci=>{var oi,di;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===((di=G.operation[J.GoogleSheetsUpdateBanding].inputs.gridBandColor)==null?void 0:di.id)}),We=(R=tt==null?void 0:tt.value)==null?void 0:R.value,qe={Authorization:`Bearer ${await O.getAccessToken()}`},ot=`${(I=O.env)==null?void 0:I.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${O.projectId}/${Zt["google-sheet"]}/${H}`,st=async ci=>Ht.post(ot,ci,{headers:qe});let ft=[];try{ft=(await st({method:"GET",endpoint:`/v4/spreadsheets/${z}?fields=sheets(properties(sheetId,title),bandedRanges)`})).data.sheets||[]}catch{}const Et=[];for(const ci of ft)if(ci.bandedRanges)for(const oi of ci.bandedRanges)Et.push({sheet:ci,band:oi});const pt=Et.find(ci=>Number(ci.band.bandedRangeId)===Number(te));if(Et.length>0&&!pt)throw new Error(`${$}No Banded Range with ID "${te}" was found in the sheet.`);const Me=pt==null?void 0:pt.band,Je={bandedRangeId:te};if(re){const ci=await Ha(re,"Id",async()=>ft.map(di=>({id:di.properties.sheetId,name:di.properties.title}))),oi=ps(ci,{errorPrefix:`${$}The ${U(X,"bandedRange","bandedRange")} input `});(oi.sheetId===void 0||oi.sheetId===null)&&(oi.sheetId=0),Je.range=oi}else Me!=null&&Me.range&&(Je.range=Me.range);const ke=Me!=null&&Me.rowProperties&&(Me!=null&&Me.columnProperties)?"Grid":Me!=null&&Me.columnProperties?"Columns":"Rows",lt=le||ke,Pt=fo(ce),Gt=fo(Ce),si=fo(Oe),pi=fo(Fe),kt=fo(We),Ct=(Me==null?void 0:Me.rowProperties)||{},xi=(Me==null?void 0:Me.columnProperties)||{},wn={firstBandColor:Gt||Ct.firstBandColor||{red:1,green:1,blue:1,alpha:1},secondBandColor:si||Ct.secondBandColor||{red:.95,green:.95,blue:.95,alpha:1}},Yr=Pt||Ct.headerColor;Yr&&(wn.headerColor=Yr);const Jr=pi||Ct.footerColor;Jr&&(wn.footerColor=Jr);const hi={firstBandColor:lt==="Grid"?kt||Gt||xi.firstBandColor||{red:1,green:1,blue:1,alpha:1}:Gt||xi.firstBandColor||{red:1,green:1,blue:1,alpha:1},secondBandColor:lt==="Grid"?kt||si||xi.secondBandColor||{red:.95,green:.95,blue:.95,alpha:1}:si||xi.secondBandColor||{red:.95,green:.95,blue:.95,alpha:1}},$t=Pt||xi.headerColor;$t&&(hi.headerColor=$t);const Nt=pi||xi.footerColor;return Nt&&(hi.footerColor=Nt),lt==="Grid"?(Je.rowProperties=wn,Je.columnProperties=hi):lt==="Columns"?Je.columnProperties=hi:Je.rowProperties=wn,await st({method:"POST",endpoint:`/v4/spreadsheets/${z}:batchUpdate`,data:{requests:[{updateBanding:{bandedRange:Je,fields:"*"}}]}}),{value:K.Success,result:null,error:null}}catch(O){const P=((A=O.response)==null?void 0:A.data)||O.message||O;return pe.Logger.log("[Google Sheets] error:",P),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:P,result:null}}}})}}class xRn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsDeleteBanding,version:"1.0.0",description:"Delete Banding Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsDeleteBanding);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"deleteBanding"),b="["+Ve(t,t.project,"Delete Banding")+": `"+T+"`] ",R=(W,ee,te)=>{const X=Ve(W==null?void 0:W.valueOwner,m==null?void 0:m.logic,ee),re=Be(W==null?void 0:W.valueOwner,m==null?void 0:m.logic,te);return`"${X}" (\`${re}\`)`},I=n.find(W=>{var ee;return((ee=W.valueOwner.declaration)==null?void 0:ee.id)===G.operation[J.GoogleSheetsDeleteBanding].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(A);if(!O)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(W=>{var ee;return((ee=W.valueOwner.declaration)==null?void 0:ee.id)===G.operation[J.GoogleSheetsDeleteBanding].inputs.spreadsheetId.id}),x=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(x,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(W=>{var ee;return((ee=W.valueOwner.declaration)==null?void 0:ee.id)===G.operation[J.GoogleSheetsDeleteBanding].inputs.bandedRangeId.id}),Z=(e=U==null?void 0:U.value)==null?void 0:e.value;if(Z==null||Z==="")throw new Error(`${b}The ${R(U,"Banded Range ID","bandedRangeId")} input is missing.`);const q=Number(Z),Y={Authorization:`Bearer ${await m.getAccessToken()}`},ie=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${O}`;return await(async W=>Ht.post(ie,W,{headers:Y}))({method:"POST",endpoint:`/v4/spreadsheets/${$}:batchUpdate`,data:{requests:[{deleteBanding:{bandedRangeId:q}}]}}),{value:K.Success,result:null,error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class g1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsAddChart,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsAddChart);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T;try{const g=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!g||!g.env)throw new Error("Editor context or environment missing");const b=Be(t,t.project,"addChart"),I="["+Ve(t,t.project,"Add Chart")+": `"+b+"`] ",A=(oe,ce,be)=>{const Ce=Ve(oe==null?void 0:oe.valueOwner,g==null?void 0:g.logic,ce),Ee=Be(oe==null?void 0:oe.valueOwner,g==null?void 0:g.logic,be);return`"${Ce}" (\`${Ee}\`)`},O=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[J.GoogleSheetsAddChart].inputs.connection.id}),P=(s=O==null?void 0:O.value)==null?void 0:s.valueAsType;if(!P||!P.id||!P.name||P.type!==r.DefinitionEntity)throw new Error(`${I}The ${A(O,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=ui(P);if(!x)throw new Error(`${I}The ${A(O,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const $=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[J.GoogleSheetsAddChart].inputs.spreadsheetId.id}),U=(u=$==null?void 0:$.value)==null?void 0:u.value,Z=ln(U,{errorPrefix:`${I}The ${A($,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[J.GoogleSheetsAddChart].inputs.chart.id}),H=(e=q==null?void 0:q.value)==null?void 0:e.value;if(H==null||typeof H!="object")throw new Error(`${I}The ${A(q,"Chart","chart")} input is missing or invalid. Expected a valid chart object.`);const ie={Authorization:`Bearer ${await g.getAccessToken()}`},z=`${(f=g.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${g.projectId}/${Zt["google-sheet"]}/${x}`,W=async oe=>Ht.post(z,oe,{headers:ie});let ee={};ee.addChart={chart:H};const X=(await W({method:"POST",endpoint:`/v4/spreadsheets/${Z}:batchUpdate`,data:{requests:[ee]}})).data,re=(m=(y=X==null?void 0:X.replies)==null?void 0:y[0])==null?void 0:m.addChart,ae=(re==null?void 0:re.chart)??null,le=(ae==null?void 0:ae.chartId)??null;return{value:K.Success,result:{chartId:le,chart:ae},error:null}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return pe.Logger.log("[Google Sheets] error:",b),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:b,result:null}}}})}}function PRn(a){return{"Number greater than":"NUMBER_GREATER","Number greater than or equal":"NUMBER_GREATER_THAN_EQ","Number less than":"NUMBER_LESS","Number less than or equal":"NUMBER_LESS_THAN_EQ","Number equal to":"NUMBER_EQ","Number not equal to":"NUMBER_NOT_EQ","Number between":"NUMBER_BETWEEN","Number not between":"NUMBER_NOT_BETWEEN","Text contains":"TEXT_CONTAINS","Text does not contain":"TEXT_NOT_CONTAINS","Text starts with":"TEXT_STARTS_WITH","Text ends with":"TEXT_ENDS_WITH","Text equals":"TEXT_EQ","Date is":"DATE_EQ","Date is before":"DATE_BEFORE","Date is after":"DATE_AFTER","Date is on or before":"DATE_ON_OR_BEFORE","Date is on or after":"DATE_ON_OR_AFTER","Cell is empty":"BLANK","Cell is not empty":"NOT_BLANK","Custom formula":"CUSTOM_FORMULA"}[a]||a}class b1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsAddConditionalFormatRule,version:"1.0.0",description:"Add Conditional Format Rule Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsAddConditionalFormatRule);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"addConditionalFormatRule"),b="["+Ve(t,t.project,"Add Conditional Format Rule")+": `"+T+"`] ",R=(pt,Me,Je)=>{const ke=Ve(pt==null?void 0:pt.valueOwner,m==null?void 0:m.logic,Me),lt=Be(pt==null?void 0:pt.valueOwner,m==null?void 0:m.logic,Je);return`"${ke}" (\`${lt}\`)`},I=G.operation[J.GoogleSheetsAddConditionalFormatRule].inputs,A=pt=>{var Je;const Me=n.find(ke=>{var lt;return((lt=ke.valueOwner.declaration)==null?void 0:lt.id)===pt});return(Je=Me==null?void 0:Me.value)==null?void 0:Je.value},O=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===I.connection.id}),P=(s=O==null?void 0:O.value)==null?void 0:s.valueAsType;if(!P||!P.id||!P.name||P.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(O,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=ui(P);if(!x)throw new Error(`${b}The ${R(O,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const $=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===I.spreadsheetId.id}),U=(u=$==null?void 0:$.value)==null?void 0:u.value,Z=ln(U,{errorPrefix:`${b}The ${R($,"Spreadsheet ID","spreadsheetId")} input `}),H={Authorization:`Bearer ${await m.getAccessToken()}`},Y=`${(e=m.env)==null?void 0:e.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${x}`,ie=async pt=>Ht.post(Y,pt,{headers:H}),z=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===I.range.id}),W=A(I.range.id),ee=A(I.conditionType.id),te=A(I.conditionValues.id),X=A(I.backgroundColor.id),re=A(I.textColor.id),ae=A(I.bold.id),le=A(I.italic.id),oe=A(I.strikethrough.id),ce=A(I.underline.id),be=A(I.index.id),Ce=A(I.fontSize.id),Ee=A(I.fontFamily.id),Oe=A(I.horizontalAlignment.id),Le=A(I.verticalAlignment.id),Fe=A(I.wrapStrategy.id);if(!W)throw new Error(`${b}The ${R(z,"Range","range")} input must be provided.`);let tt=ps(W,{errorPrefix:`${b}The Range input `});if(tt.sheetId===void 0){let pt;if(typeof W=="object"&&W!==null&&"sheet"in W?pt=String(W.sheet):typeof W=="string"&&W.includes("!")&&(pt=W.split("!")[0].replace(/^'|'$/g,"")),pt)if(/^\d+$/.test(pt.trim()))tt.sheetId=Number(pt.trim());else{const ke=(((f=(await ie({method:"GET",endpoint:`/v4/spreadsheets/${Z}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:f.sheets)||[]).find(lt=>{var Pt;return String((Pt=lt.properties)==null?void 0:Pt.title).trim().toLowerCase()===pt.trim().toLowerCase()});ke&&(tt.sheetId=ke.properties.sheetId)}}const We=PRn(String(ee||"BLANK"));let et=[];Array.isArray(te)?et=te.map(pt=>({userEnteredValue:String(pt)})):te!=null&&te!==""&&(et=[{userEnteredValue:String(te)}]);const qe={},ot=fo(X);ot&&(qe.backgroundColor=ot);const st=fo(re);if(st&&(qe.textFormat=qe.textFormat||{},qe.textFormat.foregroundColor=st),(ae===!0||ae==="true")&&(qe.textFormat=qe.textFormat||{},qe.textFormat.bold=!0),(le===!0||le==="true")&&(qe.textFormat=qe.textFormat||{},qe.textFormat.italic=!0),(oe===!0||oe==="true")&&(qe.textFormat=qe.textFormat||{},qe.textFormat.strikethrough=!0),(ce===!0||ce==="true")&&(qe.textFormat=qe.textFormat||{},qe.textFormat.underline=!0),Ce!=null&&Ce!==""){const pt=typeof Ce=="number"?Ce:parseInt(String(Ce),10);isNaN(pt)||(qe.textFormat=qe.textFormat||{},qe.textFormat.fontSize=pt)}if(typeof Ee=="string"&&Ee.trim()!==""&&(qe.textFormat=qe.textFormat||{},qe.textFormat.fontFamily=Ee.trim()),typeof Oe=="string"&&Oe!==""){const pt={Left:"LEFT",Center:"CENTER",Right:"RIGHT",Justify:"JUSTIFY"};qe.horizontalAlignment=pt[Oe]||Oe.toUpperCase()}if(typeof Le=="string"&&Le!==""){const pt={Top:"TOP",Middle:"MIDDLE",Bottom:"BOTTOM"};qe.verticalAlignment=pt[Le]||Le.toUpperCase()}if(typeof Fe=="string"&&Fe!==""){const pt={Overflow:"OVERFLOW_CELL",Wrap:"WRAP",Clip:"CLIP"};qe.wrapStrategy=pt[Fe]||Fe.toUpperCase()}const Et={rule:{ranges:[tt],booleanRule:{condition:{type:We,...et.length?{values:et}:{}},format:qe}}};if(be!=null&&be!==""){const pt=typeof be=="number"?be:parseInt(String(be),10);if(isNaN(pt)||pt<1)throw new Error(`${b}The Index input must be a 1-based positive integer.`);Et.index=pt-1}return await ie({method:"POST",endpoint:`/v4/spreadsheets/${Z}:batchUpdate`,data:{requests:[{addConditionalFormatRule:Et}]}}),{value:K.Success,result:null,error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class E1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsAddProtectedRange,version:"1.0.0",description:"Add Protected Range Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsAddProtectedRange);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A,O,P,x,$;try{const U=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!U||!U.env)throw new Error("Editor context or environment missing");const Z=Be(t,t.project,"addProtectedRange"),H="["+Ve(t,t.project,"Add Protected Range")+": `"+Z+"`] ",Y=(Pt,Gt,si)=>{const pi=Ve(Pt==null?void 0:Pt.valueOwner,U==null?void 0:U.logic,Gt),kt=Be(Pt==null?void 0:Pt.valueOwner,U==null?void 0:U.logic,si);return`"${pi}" (\`${kt}\`)`},ie=n.find(Pt=>{var Gt;return((Gt=Pt.valueOwner.declaration)==null?void 0:Gt.id)===G.operation[J.GoogleSheetsAddProtectedRange].inputs.connection.id}),z=(s=ie==null?void 0:ie.value)==null?void 0:s.valueAsType;if(!z||!z.id||!z.name||z.type!==r.DefinitionEntity)throw new Error(`${H}The ${Y(ie,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const W=ui(z);if(!W)throw new Error(`${H}The ${Y(ie,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const ee=n.find(Pt=>{var Gt;return((Gt=Pt.valueOwner.declaration)==null?void 0:Gt.id)===G.operation[J.GoogleSheetsAddProtectedRange].inputs.spreadsheetId.id}),te=(u=ee==null?void 0:ee.value)==null?void 0:u.value,X=ln(te,{errorPrefix:`${H}The ${Y(ee,"Spreadsheet ID","spreadsheetId")} input `}),re=n.find(Pt=>{var Gt;return((Gt=Pt.valueOwner.declaration)==null?void 0:Gt.id)===G.operation[J.GoogleSheetsAddProtectedRange].inputs.range.id}),ae=(e=re==null?void 0:re.value)==null?void 0:e.value;if(ae==null)throw new Error(`${H}The ${Y(re,"Protected Range","range")} input is missing.`);const le=n.find(Pt=>{var Gt;return((Gt=Pt.valueOwner.declaration)==null?void 0:Gt.id)===G.operation[J.GoogleSheetsAddProtectedRange].inputs.description.id}),oe=(f=le==null?void 0:le.value)==null?void 0:f.value,ce=n.find(Pt=>{var Gt;return((Gt=Pt.valueOwner.declaration)==null?void 0:Gt.id)===G.operation[J.GoogleSheetsAddProtectedRange].inputs.warningOnly.id}),be=(y=ce==null?void 0:ce.value)==null?void 0:y.value,Ce=n.find(Pt=>{var Gt;return((Gt=Pt.valueOwner.declaration)==null?void 0:Gt.id)===G.operation[J.GoogleSheetsAddProtectedRange].inputs.editors.id}),Ee=(m=Ce==null?void 0:Ce.value)==null?void 0:m.value,Oe=n.find(Pt=>{var Gt;return((Gt=Pt.valueOwner.declaration)==null?void 0:Gt.id)===G.operation[J.GoogleSheetsAddProtectedRange].inputs.domainUsersCanEdit.id}),Le=(T=Oe==null?void 0:Oe.value)==null?void 0:T.value,tt={Authorization:`Bearer ${await U.getAccessToken()}`},We=`${(g=U.env)==null?void 0:g.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${U.projectId}/${Zt["google-sheet"]}/${W}`,et=async Pt=>Ht.post(We,Pt,{headers:tt});let qe=[];try{qe=((b=(await et({method:"GET",endpoint:`/v4/spreadsheets/${X}?fields=sheets(properties(sheetId,title))`})).data)==null?void 0:b.sheets)||[]}catch{}const ot=await Ha(ae,"Id",async()=>qe.map(Pt=>{var Gt,si;return{id:(Gt=Pt.properties)==null?void 0:Gt.sheetId,name:(si=Pt.properties)==null?void 0:si.title}})),ft={range:ps(ot,{errorPrefix:`${H}The ${Y(re,"Protected Range","range")} input `})};oe!=null&&oe!==""&&(ft.description=oe);const Et=Array.isArray(Ee)&&Ee.length>0,pt=typeof Le=="boolean";if(be===!0&&Et)throw new Error(`${H}When ${Y(ce,"Warning Only","warningOnly")} is enabled (true), ${Y(Ce,"Editors","editors")} cannot be specified.`);if(be===!0&&pt)throw new Error(`${H}When ${Y(ce,"Warning Only","warningOnly")} is enabled (true), ${Y(Oe,"Domain Users Can Edit","domainUsersCanEdit")} cannot be specified.`);if(typeof be=="boolean"&&(ft.warningOnly=be),!ft.warningOnly&&(Et||pt)){const Pt={};Et&&(Pt.users=Ee),pt&&(Pt.domainUsersCanEdit=Le),ft.editors=Pt}const Me=n.find(Pt=>{var Gt;return((Gt=Pt.valueOwner.declaration)==null?void 0:Gt.id)===G.operation[J.GoogleSheetsAddProtectedRange].inputs.unprotectedRanges.id}),Je=(R=Me==null?void 0:Me.value)==null?void 0:R.value;if(Array.isArray(Je)&&Je.length>0){const Pt=await Promise.all(Je.map(async Gt=>{const si=await Ha(Gt,"Id",async()=>qe.map(pi=>{var kt,Ct;return{id:(kt=pi.properties)==null?void 0:kt.sheetId,name:(Ct=pi.properties)==null?void 0:Ct.title}}));return ps(si,{errorPrefix:`${H}The ${Y(Me,"Exception ranges","unprotectedRanges")} input `})}));ft.unprotectedRanges=Pt}const lt=(x=(P=(O=(A=(I=(await et({method:"POST",endpoint:`/v4/spreadsheets/${X}:batchUpdate`,data:{requests:[{addProtectedRange:{protectedRange:ft}}]}})).data)==null?void 0:I.replies)==null?void 0:A[0])==null?void 0:O.addProtectedRange)==null?void 0:P.protectedRange)==null?void 0:x.protectedRangeId;return{value:K.Success,result:{protectedRangeId:lt},error:null}}catch(U){const Z=(($=U.response)==null?void 0:$.data)||U.message||U;return pe.Logger.log("[Google Sheets] error:",Z),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:Z,result:null}}}})}}class I1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsUpdateChartSpec,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsUpdateChartSpec);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=Be(t,t.project,"updateChartSpec"),R="["+Ve(t,t.project,"Update Chart Spec")+": `"+g+"`] ",I=(ae,le,oe)=>{const ce=Ve(ae==null?void 0:ae.valueOwner,T==null?void 0:T.logic,le),be=Be(ae==null?void 0:ae.valueOwner,T==null?void 0:T.logic,oe);return`"${ce}" (\`${be}\`)`},A=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[J.GoogleSheetsUpdateChartSpec].inputs.connection.id}),O=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${R}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const P=ui(O);if(!P)throw new Error(`${R}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[J.GoogleSheetsUpdateChartSpec].inputs.spreadsheetId.id}),$=(u=x==null?void 0:x.value)==null?void 0:u.value,U=ln($,{errorPrefix:`${R}The ${I(x,"Spreadsheet ID","spreadsheetId")} input `}),Z=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[J.GoogleSheetsUpdateChartSpec].inputs.chartId.id}),q=(e=Z==null?void 0:Z.value)==null?void 0:e.value;let H=typeof q=="number"?q:typeof q=="string"?parseInt(q,10):NaN;if(isNaN(H))throw new Error(`${R}The ${I(Z,"Chart ID","chartId")} input is missing or invalid. Expected a numeric chart ID.`);const Y=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[J.GoogleSheetsUpdateChartSpec].inputs.chart.id}),ie=(f=Y==null?void 0:Y.value)==null?void 0:f.value;if(ie==null||typeof ie!="object")throw new Error(`${R}The ${I(Y,"Chart Spec","chart")} input is missing or invalid. Expected a valid chart object.`);const W={Authorization:`Bearer ${await T.getAccessToken()}`},ee=`${(y=T.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${T.projectId}/${Zt["google-sheet"]}/${P}`,te=async ae=>Ht.post(ee,ae,{headers:W}),X=ie.spec?ie.spec:ie;let re={};return re.updateChartSpec={chartId:H,spec:X},await te({method:"POST",endpoint:`/v4/spreadsheets/${U}:batchUpdate`,data:{requests:[re]}}),{value:K.Success,result:null,error:null}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return pe.Logger.log("[Google Sheets] error:",g),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:g,result:null}}}})}}class R1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsCreatePivotTable,version:"1.0.0",description:"Create Pivot Table Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsCreatePivotTable);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R;try{const I=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!I||!I.env)throw new Error("Editor context or environment missing");const A=Be(t,t.project,"createPivotTable"),P="["+Ve(t,t.project,"Create Pivot Table")+": `"+A+"`] ",x=(ke,lt,Pt)=>{const Gt=Ve(ke==null?void 0:ke.valueOwner,I==null?void 0:I.logic,lt),si=Be(ke==null?void 0:ke.valueOwner,I==null?void 0:I.logic,Pt);return`"${Gt}" (\`${si}\`)`},$=n.find(ke=>{var lt;return((lt=ke.valueOwner.declaration)==null?void 0:lt.id)===G.operation[J.GoogleSheetsCreatePivotTable].inputs.connection.id}),U=(s=$==null?void 0:$.value)==null?void 0:s.valueAsType;if(!U||!U.id||!U.name||U.type!==r.DefinitionEntity)throw new Error(`${P}The ${x($,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const Z=ui(U);if(!Z)throw new Error(`${P}The ${x($,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const q=n.find(ke=>{var lt;return((lt=ke.valueOwner.declaration)==null?void 0:lt.id)===G.operation[J.GoogleSheetsCreatePivotTable].inputs.spreadsheetId.id}),H=(u=q==null?void 0:q.value)==null?void 0:u.value,Y=ln(H,{errorPrefix:`${P}The ${x(q,"Spreadsheet ID","spreadsheetId")} input `}),ie=n.find(ke=>{var lt;return((lt=ke.valueOwner.declaration)==null?void 0:lt.id)===G.operation[J.GoogleSheetsCreatePivotTable].inputs.destination.id}),z=(e=ie==null?void 0:ie.value)==null?void 0:e.value;if(z==null)throw new Error(`${P}The ${x(ie,"Destination","destination")} input is missing.`);const W=n.find(ke=>{var lt;return((lt=ke.valueOwner.declaration)==null?void 0:lt.id)===G.operation[J.GoogleSheetsCreatePivotTable].inputs.source.id}),ee=(f=W==null?void 0:W.value)==null?void 0:f.value;if(ee==null)throw new Error(`${P}The ${x(W,"Data range","source")} input is missing.`);const te=n.find(ke=>{var lt;return((lt=ke.valueOwner.declaration)==null?void 0:lt.id)===G.operation[J.GoogleSheetsCreatePivotTable].inputs.rows.id}),X=((y=te==null?void 0:te.value)==null?void 0:y.value)||[],re=n.find(ke=>{var lt;return((lt=ke.valueOwner.declaration)==null?void 0:lt.id)===G.operation[J.GoogleSheetsCreatePivotTable].inputs.columns.id}),ae=((m=re==null?void 0:re.value)==null?void 0:m.value)||[],le=n.find(ke=>{var lt;return((lt=ke.valueOwner.declaration)==null?void 0:lt.id)===G.operation[J.GoogleSheetsCreatePivotTable].inputs.values.id}),oe=((T=le==null?void 0:le.value)==null?void 0:T.value)||[],ce=n.find(ke=>{var lt;return((lt=ke.valueOwner.declaration)==null?void 0:lt.id)===G.operation[J.GoogleSheetsCreatePivotTable].inputs.valueLayout.id}),be=((g=ce==null?void 0:ce.value)==null?void 0:g.value)||"HORIZONTAL",Ee={Authorization:`Bearer ${await I.getAccessToken()}`},Oe=`${(b=I.env)==null?void 0:b.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${I.projectId}/${Zt["google-sheet"]}/${Z}`,Le=async ke=>Ht.post(Oe,ke,{headers:Ee});let Fe=[];try{Fe=(await Le({method:"GET",endpoint:`/v4/spreadsheets/${Y}?fields=sheets(properties(sheetId,title))`})).data.sheets||[]}catch{}const tt=await Ha(z,"Id",async()=>Fe.map(ke=>({id:ke.properties.sheetId,name:ke.properties.title}))),We=ps(tt,{errorPrefix:`${P}The ${x(ie,"Destination","destination")} input `}),et={sheetId:We.sheetId??0,rowIndex:We.startRowIndex??0,columnIndex:We.startColumnIndex??0},qe=await Ha(ee,"Id",async()=>Fe.map(ke=>({id:ke.properties.sheetId,name:ke.properties.title}))),ot=ps(qe,{errorPrefix:`${P}The ${x(W,"Data range","source")} input `});(ot.sheetId===void 0||ot.sheetId===null)&&(ot.sheetId=0);const st=ke=>{if(Array.isArray(ke))return ke;if(typeof ke=="string"){const lt=ke.trim();if(lt.startsWith("["))try{return JSON.parse(lt)}catch{}}return[]},ft=st(X),Et=st(ae),pt=st(oe),Me={source:ot,rows:ft.map(ke=>({sourceColumnOffset:Number((ke==null?void 0:ke.sourceColumnOffset)??0),sortOrder:(ke==null?void 0:ke.sortOrder)||"ASCENDING",showTotals:(ke==null?void 0:ke.showTotals)!==!1})),columns:Et.map(ke=>({sourceColumnOffset:Number((ke==null?void 0:ke.sourceColumnOffset)??0),sortOrder:(ke==null?void 0:ke.sortOrder)||"ASCENDING",showTotals:(ke==null?void 0:ke.showTotals)!==!1})),values:pt.map(ke=>{const lt={sourceColumnOffset:Number((ke==null?void 0:ke.sourceColumnOffset)??0),summarizeFunction:(ke==null?void 0:ke.summarizeFunction)||"SUM"};return ke!=null&&ke.name&&(lt.name=ke.name),ke!=null&&ke.calculatedDisplayType&&(lt.calculatedDisplayType=ke.calculatedDisplayType),lt}),valueLayout:be||"HORIZONTAL"};let Je={updateCells:{start:et,rows:[{values:[{pivotTable:Me}]}],fields:"pivotTable"}};return await Le({method:"POST",endpoint:`/v4/spreadsheets/${Y}:batchUpdate`,data:{requests:[Je]}}),{value:K.Success,result:null,error:null}}catch(I){const A=((R=I.response)==null?void 0:R.data)||I.message||I;return pe.Logger.log("[Google Sheets] error:",A),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:A,result:null}}}})}}class A1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsInsertDimension,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsInsertDimension);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R;try{const I=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!I||!I.env)throw new Error("Editor context or environment missing");const A=Be(t,t.project,"insertDimension"),P="["+Ve(t,t.project,"Insert Dimension")+": `"+A+"`] ",x=(qe,ot,st)=>{const ft=Ve(qe==null?void 0:qe.valueOwner,I==null?void 0:I.logic,ot),Et=Be(qe==null?void 0:qe.valueOwner,I==null?void 0:I.logic,st);return`"${ft}" (\`${Et}\`)`},$=n.find(qe=>{var ot;return((ot=qe.valueOwner.declaration)==null?void 0:ot.id)===G.operation[J.GoogleSheetsInsertDimension].inputs.connection.id}),U=(s=$==null?void 0:$.value)==null?void 0:s.valueAsType;if(!U||!U.id||!U.name||U.type!==r.DefinitionEntity)throw new Error(`${P}The ${x($,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const Z=ui(U);if(!Z)throw new Error(`${P}The ${x($,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const q=n.find(qe=>{var ot;return((ot=qe.valueOwner.declaration)==null?void 0:ot.id)===G.operation[J.GoogleSheetsInsertDimension].inputs.spreadsheetId.id}),H=(u=q==null?void 0:q.value)==null?void 0:u.value,Y=ln(H,{errorPrefix:`${P}The ${x(q,"Spreadsheet ID","spreadsheetId")} input `}),ie=n.find(qe=>{var ot,st;return((ot=qe.valueOwner.declaration)==null?void 0:ot.id)===((st=G.operation[J.GoogleSheetsInsertDimension].inputs.sheet)==null?void 0:st.id)}),z=(e=ie==null?void 0:ie.value)==null?void 0:e.value,W=n.find(qe=>{var ot,st;return((ot=qe.valueOwner.declaration)==null?void 0:ot.id)===((st=G.operation[J.GoogleSheetsInsertDimension].inputs.dimension)==null?void 0:st.id)}),ee=(f=W==null?void 0:W.value)==null?void 0:f.value,te=n.find(qe=>{var ot,st;return((ot=qe.valueOwner.declaration)==null?void 0:ot.id)===((st=G.operation[J.GoogleSheetsInsertDimension].inputs.startIndex)==null?void 0:st.id)}),X=(y=te==null?void 0:te.value)==null?void 0:y.value,re=n.find(qe=>{var ot,st;return((ot=qe.valueOwner.declaration)==null?void 0:ot.id)===((st=G.operation[J.GoogleSheetsInsertDimension].inputs.endIndex)==null?void 0:st.id)}),ae=(m=re==null?void 0:re.value)==null?void 0:m.value,le=n.find(qe=>{var ot,st;return((ot=qe.valueOwner.declaration)==null?void 0:ot.id)===((st=G.operation[J.GoogleSheetsInsertDimension].inputs.inheritFormatting)==null?void 0:st.id)}),oe=(T=le==null?void 0:le.value)==null?void 0:T.value;let ce;if(typeof oe=="string"){const qe=oe.trim().toLowerCase();qe==="before"?ce=!0:qe==="after"&&(ce=!1)}const Ce={Authorization:`Bearer ${await I.getAccessToken()}`},Ee=`${(g=I.env)==null?void 0:g.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${I.projectId}/${Zt["google-sheet"]}/${Z}`,Oe=async qe=>Ht.post(Ee,qe,{headers:Ce});if(z==null||z==="")throw new Error(`${P}The ${x(ie,"Sheet","sheet")} input is missing.`);if(ee==null||ee==="")throw new Error(`${P}The ${x(W,"Dimension","dimension")} input is missing.`);const Le=String(ee).trim().toUpperCase();if(Le!=="ROWS"&&Le!=="COLUMNS")throw new Error(`${P}The ${x(W,"Dimension","dimension")} input is invalid. Expected "Rows" or "Columns".`);const Fe=typeof X=="number"?X:parseInt(String(X),10);if(isNaN(Fe)||Fe<1)throw new Error(`${P}The ${x(te,"Start index","startIndex")} input is missing or invalid. Expected a positive integer starting at 1.`);let tt=Fe;if(ae!=null&&ae!==""&&(tt=typeof ae=="number"?ae:parseInt(String(ae),10),isNaN(tt)||tt<Fe))throw new Error(`${P}The ${x(re,"End index","endIndex")} input is invalid. Expected an integer greater than or equal to Start index.`);let We;if(typeof z=="number"||/^\d+$/.test(String(z).trim()))We=Number(z);else{const st=(((b=(await Oe({method:"GET",endpoint:`/v4/spreadsheets/${Y}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:b.sheets)||[]).find(ft=>{var Et;return String((Et=ft.properties)==null?void 0:Et.title).trim().toLowerCase()===String(z).trim().toLowerCase()});if(!st)throw new Error(`${P}The ${x(ie,"Sheet","sheet")} input "${z}" was not found in spreadsheet.`);We=st.properties.sheetId}const et={range:{sheetId:We,dimension:Le,startIndex:Fe-1,endIndex:tt}};return typeof ce=="boolean"&&(et.inheritFromBefore=ce),await Oe({method:"POST",endpoint:`/v4/spreadsheets/${Y}:batchUpdate`,data:{requests:[{insertDimension:et}]}}),{value:K.Success,result:null,error:null}}catch(I){const A=((R=I.response)==null?void 0:R.data)||I.message||I;return pe.Logger.log("[Google Sheets] error:",A),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:A,result:null}}}})}}class D1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsMoveDimension,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsMoveDimension);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R;try{const I=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!I||!I.env)throw new Error("Editor context or environment missing");const A=Be(t,t.project,"moveDimension"),P="["+Ve(t,t.project,"Move Dimension")+": `"+A+"`] ",x=(et,qe,ot)=>{const st=Ve(et==null?void 0:et.valueOwner,I==null?void 0:I.logic,qe),ft=Be(et==null?void 0:et.valueOwner,I==null?void 0:I.logic,ot);return`"${st}" (\`${ft}\`)`},$=n.find(et=>{var qe;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===G.operation[J.GoogleSheetsMoveDimension].inputs.connection.id}),U=(s=$==null?void 0:$.value)==null?void 0:s.valueAsType;if(!U||!U.id||!U.name||U.type!==r.DefinitionEntity)throw new Error(`${P}The ${x($,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const Z=ui(U);if(!Z)throw new Error(`${P}The ${x($,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const q=n.find(et=>{var qe;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===G.operation[J.GoogleSheetsMoveDimension].inputs.spreadsheetId.id}),H=(u=q==null?void 0:q.value)==null?void 0:u.value,Y=ln(H,{errorPrefix:`${P}The ${x(q,"Spreadsheet ID","spreadsheetId")} input `}),ie=n.find(et=>{var qe,ot;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===((ot=G.operation[J.GoogleSheetsMoveDimension].inputs.sheet)==null?void 0:ot.id)}),z=(e=ie==null?void 0:ie.value)==null?void 0:e.value,W=n.find(et=>{var qe,ot;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===((ot=G.operation[J.GoogleSheetsMoveDimension].inputs.dimension)==null?void 0:ot.id)}),ee=(f=W==null?void 0:W.value)==null?void 0:f.value,te=n.find(et=>{var qe,ot;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===((ot=G.operation[J.GoogleSheetsMoveDimension].inputs.startIndex)==null?void 0:ot.id)}),X=(y=te==null?void 0:te.value)==null?void 0:y.value,re=n.find(et=>{var qe,ot;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===((ot=G.operation[J.GoogleSheetsMoveDimension].inputs.endIndex)==null?void 0:ot.id)}),ae=(m=re==null?void 0:re.value)==null?void 0:m.value,le=n.find(et=>{var qe,ot;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===((ot=G.operation[J.GoogleSheetsMoveDimension].inputs.destinationIndex)==null?void 0:ot.id)}),oe=(T=le==null?void 0:le.value)==null?void 0:T.value,be={Authorization:`Bearer ${await I.getAccessToken()}`},Ce=`${(g=I.env)==null?void 0:g.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${I.projectId}/${Zt["google-sheet"]}/${Z}`,Ee=async et=>Ht.post(Ce,et,{headers:be});if(z==null||z==="")throw new Error(`${P}The ${x(ie,"Sheet","sheet")} input is missing.`);if(ee==null||ee==="")throw new Error(`${P}The ${x(W,"Dimension","dimension")} input is missing.`);const Oe=String(ee).trim().toUpperCase();if(Oe!=="ROWS"&&Oe!=="COLUMNS")throw new Error(`${P}The ${x(W,"Dimension","dimension")} input is invalid. Expected "Rows" or "Columns".`);const Le=typeof X=="number"?X:parseInt(String(X),10);if(isNaN(Le)||Le<1)throw new Error(`${P}The ${x(te,"Start index","startIndex")} input is missing or invalid. Expected a positive integer starting at 1.`);let Fe=Le;if(ae!=null&&ae!==""&&(Fe=typeof ae=="number"?ae:parseInt(String(ae),10),isNaN(Fe)||Fe<Le))throw new Error(`${P}The ${x(re,"End index","endIndex")} input is invalid. Expected an integer greater than or equal to Start index.`);const tt=typeof oe=="number"?oe:parseInt(String(oe),10);if(isNaN(tt)||tt<1)throw new Error(`${P}The ${x(le,"Destination index","destinationIndex")} input is missing or invalid. Expected a positive integer starting at 1.`);let We;if(typeof z=="number"||/^\d+$/.test(String(z).trim()))We=Number(z);else{const ot=(((b=(await Ee({method:"GET",endpoint:`/v4/spreadsheets/${Y}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:b.sheets)||[]).find(st=>{var ft;return String((ft=st.properties)==null?void 0:ft.title).trim().toLowerCase()===String(z).trim().toLowerCase()});if(!ot)throw new Error(`${P}The ${x(ie,"Sheet","sheet")} input "${z}" was not found in spreadsheet.`);We=ot.properties.sheetId}return await Ee({method:"POST",endpoint:`/v4/spreadsheets/${Y}:batchUpdate`,data:{requests:[{moveDimension:{source:{sheetId:We,dimension:Oe,startIndex:Le-1,endIndex:Fe},destinationIndex:tt-1}}]}}),{value:K.Success,result:null,error:null}}catch(I){const A=((R=I.response)==null?void 0:R.data)||I.message||I;return pe.Logger.log("[Google Sheets] error:",A),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:A,result:null}}}})}}function VRn(a){return{"Number greater than":"NUMBER_GREATER","Number greater than or equal":"NUMBER_GREATER_THAN_EQ","Number less than":"NUMBER_LESS","Number less than or equal":"NUMBER_LESS_THAN_EQ","Number equal to":"NUMBER_EQ","Number not equal to":"NUMBER_NOT_EQ","Number between":"NUMBER_BETWEEN","Number not between":"NUMBER_NOT_BETWEEN","Text contains":"TEXT_CONTAINS","Text does not contain":"TEXT_NOT_CONTAINS","Text starts with":"TEXT_STARTS_WITH","Text ends with":"TEXT_ENDS_WITH","Text equals":"TEXT_EQ","Date is":"DATE_EQ","Date is before":"DATE_BEFORE","Date is after":"DATE_AFTER","Date is on or before":"DATE_ON_OR_BEFORE","Date is on or after":"DATE_ON_OR_AFTER","Cell is empty":"BLANK","Cell is not empty":"NOT_BLANK","Custom formula":"CUSTOM_FORMULA"}[a]||a}class C1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsUpdateConditionalFormatRule,version:"1.0.0",description:"Update Conditional Format Rule Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsUpdateConditionalFormatRule);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A,O,P;try{const x=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!x||!x.env)throw new Error("Editor context or environment missing");const $=Be(t,t.project,"updateConditionalFormatRule"),Z="["+Ve(t,t.project,"Update Conditional Format Rule")+": `"+$+"`] ",q=(hi,$t,Nt)=>{const ci=Ve(hi==null?void 0:hi.valueOwner,x==null?void 0:x.logic,$t),oi=Be(hi==null?void 0:hi.valueOwner,x==null?void 0:x.logic,Nt);return`"${ci}" (\`${oi}\`)`},H=G.operation[J.GoogleSheetsUpdateConditionalFormatRule].inputs,Y=hi=>{var Nt;const $t=n.find(ci=>{var oi;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===hi});return(Nt=$t==null?void 0:$t.value)==null?void 0:Nt.value},ie=n.find(hi=>{var $t;return(($t=hi.valueOwner.declaration)==null?void 0:$t.id)===H.connection.id}),z=(s=ie==null?void 0:ie.value)==null?void 0:s.valueAsType;if(!z||!z.id||!z.name||z.type!==r.DefinitionEntity)throw new Error(`${Z}The ${q(ie,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const W=ui(z);if(!W)throw new Error(`${Z}The ${q(ie,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const ee=n.find(hi=>{var $t;return(($t=hi.valueOwner.declaration)==null?void 0:$t.id)===H.spreadsheetId.id}),te=(u=ee==null?void 0:ee.value)==null?void 0:u.value,X=ln(te,{errorPrefix:`${Z}The ${q(ee,"Spreadsheet ID","spreadsheetId")} input `}),re=n.find(hi=>{var $t;return(($t=hi.valueOwner.declaration)==null?void 0:$t.id)===H.sheet.id}),ae=(e=re==null?void 0:re.value)==null?void 0:e.value;if(ae==null||ae==="")throw new Error(`${Z}The ${q(re,"Sheet","sheet")} input is missing.`);const le=n.find(hi=>{var $t;return(($t=hi.valueOwner.declaration)==null?void 0:$t.id)===H.index.id}),oe=(f=le==null?void 0:le.value)==null?void 0:f.value;if(oe==null||oe==="")throw new Error(`${Z}The ${q(le,"Index","index")} input is missing.`);const ce=typeof oe=="number"?oe:parseInt(String(oe),10);if(isNaN(ce)||ce<1)throw new Error(`${Z}The ${q(le,"Index","index")} input must be a 1-based positive integer.`);const Ce={Authorization:`Bearer ${await x.getAccessToken()}`},Ee=`${(y=x.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${x.projectId}/${Zt["google-sheet"]}/${W}`,Oe=async hi=>Ht.post(Ee,hi,{headers:Ce});let Le;if(typeof ae=="number"||/^\d+$/.test(String(ae).trim()))Le=Number(ae);else{const Nt=(((m=(await Oe({method:"GET",endpoint:`/v4/spreadsheets/${X}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:m.sheets)||[]).find(ci=>{var oi;return String((oi=ci.properties)==null?void 0:oi.title).trim().toLowerCase()===String(ae).trim().toLowerCase()});if(!Nt)throw new Error(`${Z}The ${q(re,"Sheet","sheet")} input "${ae}" was not found in spreadsheet.`);Le=Nt.properties.sheetId}const Fe=Y(H.newIndex.id),tt=Y(H.range.id),We=Y(H.conditionType.id),et=Y(H.conditionValues.id),qe=Y(H.backgroundColor.id),ot=Y(H.textColor.id),st=Y(H.bold.id),ft=Y(H.italic.id),Et=Y(H.strikethrough.id),pt=Y(H.underline.id),Me=Y(H.fontSize.id),Je=Y(H.fontFamily.id),ke=Y(H.horizontalAlignment.id),lt=Y(H.verticalAlignment.id),Pt=Y(H.wrapStrategy.id);let Gt=null;try{const Nt=(((T=(await Oe({method:"GET",endpoint:`/v4/spreadsheets/${X}?fields=sheets(properties(sheetId),conditionalFormats)`})).data)==null?void 0:T.sheets)||[]).find(ci=>{var oi;return Number((oi=ci.properties)==null?void 0:oi.sheetId)===Number(Le)});if(Nt&&Array.isArray(Nt.conditionalFormats)){const ci=ce-1;ci>=0&&ci<Nt.conditionalFormats.length&&(Gt=Nt.conditionalFormats[ci])}}catch{}let si=null;tt&&(si=ps(tt,{errorPrefix:`${Z}The Range input `}),si.sheetId===void 0&&(si.sheetId=Le));const pi=si?[si]:Gt&&Gt.ranges||[{sheetId:Le}];let kt=null;if(We!=null&&String(We).trim()!==""){const hi=VRn(String(We));let $t=[];Array.isArray(et)?$t=et.map(Nt=>({userEnteredValue:String(Nt)})):et!=null&&et!==""?$t=[{userEnteredValue:String(et)}]:((b=(g=Gt==null?void 0:Gt.booleanRule)==null?void 0:g.condition)==null?void 0:b.type)===hi&&Array.isArray((I=(R=Gt==null?void 0:Gt.booleanRule)==null?void 0:R.condition)==null?void 0:I.values)&&($t=Gt.booleanRule.condition.values),kt={type:hi,...$t.length?{values:$t}:{}}}else if((A=Gt==null?void 0:Gt.booleanRule)!=null&&A.condition)kt=JSON.parse(JSON.stringify(Gt.booleanRule.condition));else{const hi="BLANK";let $t=[];Array.isArray(et)?$t=et.map(Nt=>({userEnteredValue:String(Nt)})):et!=null&&et!==""&&($t=[{userEnteredValue:String(et)}]),kt={type:hi,...$t.length?{values:$t}:{}}}const Ct=(O=Gt==null?void 0:Gt.booleanRule)!=null&&O.format?JSON.parse(JSON.stringify(Gt.booleanRule.format)):{},xi=fo(qe);xi&&(Ct.backgroundColor=xi);const wn=fo(ot);if(wn&&(Ct.textFormat=Ct.textFormat||{},Ct.textFormat.foregroundColor=wn),st===!0||st==="true"?(Ct.textFormat=Ct.textFormat||{},Ct.textFormat.bold=!0):(st===!1||st==="false")&&Ct.textFormat&&(Ct.textFormat.bold=!1),ft===!0||ft==="true"?(Ct.textFormat=Ct.textFormat||{},Ct.textFormat.italic=!0):(ft===!1||ft==="false")&&Ct.textFormat&&(Ct.textFormat.italic=!1),Et===!0||Et==="true"?(Ct.textFormat=Ct.textFormat||{},Ct.textFormat.strikethrough=!0):(Et===!1||Et==="false")&&Ct.textFormat&&(Ct.textFormat.strikethrough=!1),pt===!0||pt==="true"?(Ct.textFormat=Ct.textFormat||{},Ct.textFormat.underline=!0):(pt===!1||pt==="false")&&Ct.textFormat&&(Ct.textFormat.underline=!1),Me!=null&&Me!==""){const hi=typeof Me=="number"?Me:parseInt(String(Me),10);isNaN(hi)||(Ct.textFormat=Ct.textFormat||{},Ct.textFormat.fontSize=hi)}if(typeof Je=="string"&&Je.trim()!==""&&(Ct.textFormat=Ct.textFormat||{},Ct.textFormat.fontFamily=Je.trim()),typeof ke=="string"&&ke!==""){const hi={Left:"LEFT",Center:"CENTER",Right:"RIGHT",Justify:"JUSTIFY"};Ct.horizontalAlignment=hi[ke]||ke.toUpperCase()}if(typeof lt=="string"&&lt!==""){const hi={Top:"TOP",Middle:"MIDDLE",Bottom:"BOTTOM"};Ct.verticalAlignment=hi[lt]||lt.toUpperCase()}if(typeof Pt=="string"&&Pt!==""){const hi={Overflow:"OVERFLOW_CELL",Wrap:"WRAP",Clip:"CLIP"};Ct.wrapStrategy=hi[Pt]||Pt.toUpperCase()}const Yr={...Gt||{},ranges:pi,booleanRule:{...(Gt==null?void 0:Gt.booleanRule)||{},condition:kt,format:Ct}},Jr={sheetId:Le,index:ce-1,rule:Yr};if(Fe!=null&&Fe!==""){const hi=typeof Fe=="number"?Fe:parseInt(String(Fe),10);!isNaN(hi)&&hi>=1&&(Jr.newIndex=hi-1)}return await Oe({method:"POST",endpoint:`/v4/spreadsheets/${X}:batchUpdate`,data:{requests:[{updateConditionalFormatRule:Jr}]}}),{value:K.Success,result:null,error:null}}catch(x){const $=((P=x.response)==null?void 0:P.data)||x.message||x;return pe.Logger.log("[Google Sheets] error:",$),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:$,result:null}}}})}}class w1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsUpdateProtectedRange,version:"1.0.0",description:"Update Protected Range Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsUpdateProtectedRange);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A,O;try{const P=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!P||!P.env)throw new Error("Editor context or environment missing");const x=Be(t,t.project,"updateProtectedRange"),U="["+Ve(t,t.project,"Update Protected Range")+": `"+x+"`] ",Z=(Me,Je,ke)=>{const lt=Ve(Me==null?void 0:Me.valueOwner,P==null?void 0:P.logic,Je),Pt=Be(Me==null?void 0:Me.valueOwner,P==null?void 0:P.logic,ke);return`"${lt}" (\`${Pt}\`)`},q=n.find(Me=>{var Je;return((Je=Me.valueOwner.declaration)==null?void 0:Je.id)===G.operation[J.GoogleSheetsUpdateProtectedRange].inputs.connection.id}),H=(s=q==null?void 0:q.value)==null?void 0:s.valueAsType;if(!H||!H.id||!H.name||H.type!==r.DefinitionEntity)throw new Error(`${U}The ${Z(q,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const Y=ui(H);if(!Y)throw new Error(`${U}The ${Z(q,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const ie=n.find(Me=>{var Je;return((Je=Me.valueOwner.declaration)==null?void 0:Je.id)===G.operation[J.GoogleSheetsUpdateProtectedRange].inputs.spreadsheetId.id}),z=(u=ie==null?void 0:ie.value)==null?void 0:u.value,W=ln(z,{errorPrefix:`${U}The ${Z(ie,"Spreadsheet ID","spreadsheetId")} input `}),ee=n.find(Me=>{var Je;return((Je=Me.valueOwner.declaration)==null?void 0:Je.id)===G.operation[J.GoogleSheetsUpdateProtectedRange].inputs.protectedRangeId.id}),te=(e=ee==null?void 0:ee.value)==null?void 0:e.value;if(te==null)throw new Error(`${U}The ${Z(ee,"Protected Range ID","protectedRangeId")} input is missing.`);const X=n.find(Me=>{var Je;return((Je=Me.valueOwner.declaration)==null?void 0:Je.id)===G.operation[J.GoogleSheetsUpdateProtectedRange].inputs.range.id}),re=(f=X==null?void 0:X.value)==null?void 0:f.value,ae=n.find(Me=>{var Je;return((Je=Me.valueOwner.declaration)==null?void 0:Je.id)===G.operation[J.GoogleSheetsUpdateProtectedRange].inputs.description.id}),le=(y=ae==null?void 0:ae.value)==null?void 0:y.value,oe=n.find(Me=>{var Je;return((Je=Me.valueOwner.declaration)==null?void 0:Je.id)===G.operation[J.GoogleSheetsUpdateProtectedRange].inputs.warningOnly.id}),ce=(m=oe==null?void 0:oe.value)==null?void 0:m.value,be=n.find(Me=>{var Je;return((Je=Me.valueOwner.declaration)==null?void 0:Je.id)===G.operation[J.GoogleSheetsUpdateProtectedRange].inputs.editors.id}),Ce=(T=be==null?void 0:be.value)==null?void 0:T.value,Ee=n.find(Me=>{var Je;return((Je=Me.valueOwner.declaration)==null?void 0:Je.id)===G.operation[J.GoogleSheetsUpdateProtectedRange].inputs.domainUsersCanEdit.id}),Oe=(g=Ee==null?void 0:Ee.value)==null?void 0:g.value,Fe={Authorization:`Bearer ${await P.getAccessToken()}`},tt=`${(b=P.env)==null?void 0:b.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${P.projectId}/${Zt["google-sheet"]}/${Y}`,We=async Me=>Ht.post(tt,Me,{headers:Fe}),et={protectedRangeId:typeof te=="number"?te:Number(te)},qe=[];if(re!=null){let Me=[];try{Me=((R=(await We({method:"GET",endpoint:`/v4/spreadsheets/${W}?fields=sheets(properties(sheetId,title))`})).data)==null?void 0:R.sheets)||[]}catch{}const Je=await Ha(re,"Id",async()=>Me.map(ke=>{var lt,Pt;return{id:(lt=ke.properties)==null?void 0:lt.sheetId,name:(Pt=ke.properties)==null?void 0:Pt.title}}));et.range=ps(Je,{errorPrefix:`${U}The ${Z(X,"Protected Range","range")} input `}),qe.push("range")}le!=null&&(et.description=le,qe.push("description"));const ot=Array.isArray(Ce)&&Ce.length>0,st=typeof Oe=="boolean";if(ce===!0&&ot)throw new Error(`${U}When ${Z(oe,"Warning Only","warningOnly")} is enabled (true), ${Z(be,"Editors","editors")} cannot be specified.`);if(ce===!0&&st)throw new Error(`${U}When ${Z(oe,"Warning Only","warningOnly")} is enabled (true), ${Z(Ee,"Domain Users Can Edit","domainUsersCanEdit")} cannot be specified.`);if(typeof ce=="boolean"&&(et.warningOnly=ce,qe.push("warningOnly")),!et.warningOnly&&(ot||st)){const Me={};ot&&(Me.users=Ce),st&&(Me.domainUsersCanEdit=Oe),et.editors=Me,qe.push("editors")}const ft=n.find(Me=>{var Je;return((Je=Me.valueOwner.declaration)==null?void 0:Je.id)===G.operation[J.GoogleSheetsUpdateProtectedRange].inputs.unprotectedRanges.id}),Et=(I=ft==null?void 0:ft.value)==null?void 0:I.value;if(Array.isArray(Et)&&Et.length>0){let Me=[];try{Me=((A=(await We({method:"GET",endpoint:`/v4/spreadsheets/${W}?fields=sheets(properties(sheetId,title))`})).data)==null?void 0:A.sheets)||[]}catch{}const Je=await Promise.all(Et.map(async ke=>{const lt=await Ha(ke,"Id",async()=>Me.map(Pt=>{var Gt,si;return{id:(Gt=Pt.properties)==null?void 0:Gt.sheetId,name:(si=Pt.properties)==null?void 0:si.title}}));return ps(lt,{errorPrefix:`${U}The ${Z(ft,"Exception ranges","unprotectedRanges")} input `})}));et.unprotectedRanges=Je,qe.push("unprotectedRanges")}const pt=qe.length>0?qe.join(","):"*";return await We({method:"POST",endpoint:`/v4/spreadsheets/${W}:batchUpdate`,data:{requests:[{updateProtectedRange:{protectedRange:et,fields:pt}}]}}),{value:K.Success,result:null,error:null}}catch(P){const x=((O=P.response)==null?void 0:O.data)||P.message||P;return pe.Logger.log("[Google Sheets] error:",x),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:x,result:null}}}})}}class O1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsAddNamedRange,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsAddNamedRange);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g;try{const b=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!b||!b.env)throw new Error("Editor context or environment missing");const R=Be(t,t.project,"addNamedRange"),A="["+Ve(t,t.project,"Add Named Range")+": `"+R+"`] ",O=(Ee,Oe,Le)=>{const Fe=Ve(Ee==null?void 0:Ee.valueOwner,b==null?void 0:b.logic,Oe),tt=Be(Ee==null?void 0:Ee.valueOwner,b==null?void 0:b.logic,Le);return`"${Fe}" (\`${tt}\`)`},P=n.find(Ee=>{var Oe;return((Oe=Ee.valueOwner.declaration)==null?void 0:Oe.id)===G.operation[J.GoogleSheetsAddNamedRange].inputs.connection.id}),x=(s=P==null?void 0:P.value)==null?void 0:s.valueAsType;if(!x||!x.id||!x.name||x.type!==r.DefinitionEntity)throw new Error(`${A}The ${O(P,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const $=ui(x);if(!$)throw new Error(`${A}The ${O(P,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const U=n.find(Ee=>{var Oe;return((Oe=Ee.valueOwner.declaration)==null?void 0:Oe.id)===G.operation[J.GoogleSheetsAddNamedRange].inputs.spreadsheetId.id}),Z=(u=U==null?void 0:U.value)==null?void 0:u.value,q=ln(Z,{errorPrefix:`${A}The ${O(U,"Spreadsheet ID","spreadsheetId")} input `}),H=n.find(Ee=>{var Oe;return((Oe=Ee.valueOwner.declaration)==null?void 0:Oe.id)===G.operation[J.GoogleSheetsAddNamedRange].inputs.name.id}),Y=(e=H==null?void 0:H.value)==null?void 0:e.value;if(Y==null)throw new Error(`${A}The ${O(H,"name","name")} input is missing.`);const ie=n.find(Ee=>{var Oe;return((Oe=Ee.valueOwner.declaration)==null?void 0:Oe.id)===G.operation[J.GoogleSheetsAddNamedRange].inputs.range.id}),z=(f=ie==null?void 0:ie.value)==null?void 0:f.value;if(z==null)throw new Error(`${A}The ${O(ie,"range","range")} input is missing.`);const ee={Authorization:`Bearer ${await b.getAccessToken()}`},te=`${(y=b.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${b.projectId}/${Zt["google-sheet"]}/${$}`,X=async Ee=>Ht.post(te,Ee,{headers:ee}),re=await Ha(z,"Id",async()=>{var Oe;return(((Oe=(await X({method:"GET",endpoint:`/v4/spreadsheets/${q}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:Oe.sheets)||[]).map(Le=>{var Fe,tt;return{id:(Fe=Le.properties)==null?void 0:Fe.sheetId,name:(tt=Le.properties)==null?void 0:tt.title}})});let ae={};ae.addNamedRange={namedRange:{name:typeof Y=="string"&&Y.trim().startsWith("{")?JSON.parse(Y):Y,range:ps(re,{errorPrefix:`${A}The ${O(ie,"Range","range")} input `})}};const oe=(await X({method:"POST",endpoint:`/v4/spreadsheets/${q}:batchUpdate`,data:{requests:[ae]}})).data,ce=(T=(m=oe==null?void 0:oe.replies)==null?void 0:m[0])==null?void 0:T.addNamedRange,be=(ce==null?void 0:ce.namedRange)??null,Ce=(be==null?void 0:be.namedRangeId)??null;return{value:K.Success,result:{namedRangeId:Ce},error:null}}catch(b){const R=((g=b.response)==null?void 0:g.data)||b.message||b;return pe.Logger.log("[Google Sheets] error:",R),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:R,result:null}}}})}}class x1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsSetCellNote,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsSetCellNote);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=Be(t,t.project,"setCellNote"),R="["+Ve(t,t.project,"Set Cell Note")+": `"+g+"`] ",I=(re,ae,le)=>{const oe=Ve(re==null?void 0:re.valueOwner,T==null?void 0:T.logic,ae),ce=Be(re==null?void 0:re.valueOwner,T==null?void 0:T.logic,le);return`"${oe}" (\`${ce}\`)`},A=n.find(re=>{var ae;return((ae=re.valueOwner.declaration)==null?void 0:ae.id)===G.operation[J.GoogleSheetsSetCellNote].inputs.connection.id}),O=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${R}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const P=ui(O);if(!P)throw new Error(`${R}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(re=>{var ae;return((ae=re.valueOwner.declaration)==null?void 0:ae.id)===G.operation[J.GoogleSheetsSetCellNote].inputs.spreadsheetId.id}),$=(u=x==null?void 0:x.value)==null?void 0:u.value,U=ln($,{errorPrefix:`${R}The ${I(x,"Spreadsheet ID","spreadsheetId")} input `}),Z=n.find(re=>{var ae;return((ae=re.valueOwner.declaration)==null?void 0:ae.id)===G.operation[J.GoogleSheetsSetCellNote].inputs.range.id}),q=(e=Z==null?void 0:Z.value)==null?void 0:e.value;if(q==null)throw new Error(`${R}The ${I(Z,"range","range")} input is missing.`);const H=n.find(re=>{var ae;return((ae=re.valueOwner.declaration)==null?void 0:ae.id)===G.operation[J.GoogleSheetsSetCellNote].inputs.note.id}),Y=(f=H==null?void 0:H.value)==null?void 0:f.value;if(Y==null)throw new Error(`${R}The ${I(H,"note","note")} input is missing.`);const z={Authorization:`Bearer ${await T.getAccessToken()}`},W=`${(y=T.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${T.projectId}/${Zt["google-sheet"]}/${P}`,ee=async re=>Ht.post(W,re,{headers:z}),te=await Ha(q,"Id",async()=>(await ee({method:"GET",endpoint:`/v4/spreadsheets/${U}?fields=sheets.properties(sheetId,title)`})).data.sheets.map(ae=>({id:ae.properties.sheetId,name:ae.properties.title})));let X={repeatCell:{range:ps(te,{errorPrefix:`${R}The ${I(Z,"Range","range")} input `}),cell:{note:typeof Y=="string"&&Y.trim().startsWith("{")?JSON.parse(Y):Y},fields:"note"}};return await ee({method:"POST",endpoint:`/v4/spreadsheets/${U}:batchUpdate`,data:{requests:[X]}}),{value:K.Success,result:null,error:null}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return pe.Logger.log("[Google Sheets] error:",g),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:g,result:null}}}})}}class P1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsDeleteConditionalFormatRule,version:"1.0.0",description:"Delete Conditional Format Rule Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsDeleteConditionalFormatRule);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T;try{const g=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!g||!g.env)throw new Error("Editor context or environment missing");const b=Be(t,t.project,"deleteConditionalFormatRule"),I="["+Ve(t,t.project,"Delete Conditional Format Rule")+": `"+b+"`] ",A=(le,oe,ce)=>{const be=Ve(le==null?void 0:le.valueOwner,g==null?void 0:g.logic,oe),Ce=Be(le==null?void 0:le.valueOwner,g==null?void 0:g.logic,ce);return`"${be}" (\`${Ce}\`)`},O=G.operation[J.GoogleSheetsDeleteConditionalFormatRule].inputs,P=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===O.connection.id}),x=(s=P==null?void 0:P.value)==null?void 0:s.valueAsType;if(!x||!x.id||!x.name||x.type!==r.DefinitionEntity)throw new Error(`${I}The ${A(P,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const $=ui(x);if(!$)throw new Error(`${I}The ${A(P,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const U=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===O.spreadsheetId.id}),Z=(u=U==null?void 0:U.value)==null?void 0:u.value,q=ln(Z,{errorPrefix:`${I}The ${A(U,"Spreadsheet ID","spreadsheetId")} input `}),H=n.find(le=>{var oe,ce;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===((ce=O.sheet)==null?void 0:ce.id)}),Y=(e=H==null?void 0:H.value)==null?void 0:e.value;if(Y==null||Y==="")throw new Error(`${I}The ${A(H,"Sheet","sheet")} input is missing.`);const ie=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===O.index.id}),z=(f=ie==null?void 0:ie.value)==null?void 0:f.value;if(z==null||z==="")throw new Error(`${I}The ${A(ie,"Index","index")} input is missing.`);const W=typeof z=="number"?z:parseInt(String(z),10);if(isNaN(W)||W<1)throw new Error(`${I}The ${A(ie,"Index","index")} input must be a 1-based positive integer.`);const te={Authorization:`Bearer ${await g.getAccessToken()}`},X=`${(y=g.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${g.projectId}/${Zt["google-sheet"]}/${$}`,re=async le=>Ht.post(X,le,{headers:te});let ae;if(typeof Y=="number"||/^\d+$/.test(String(Y).trim()))ae=Number(Y);else{const ce=(((m=(await re({method:"GET",endpoint:`/v4/spreadsheets/${q}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:m.sheets)||[]).find(be=>{var Ce;return String((Ce=be.properties)==null?void 0:Ce.title).trim().toLowerCase()===String(Y).trim().toLowerCase()});if(!ce)throw new Error(`${I}The ${A(H,"Sheet","sheet")} input "${Y}" was not found in spreadsheet.`);ae=ce.properties.sheetId}return await re({method:"POST",endpoint:`/v4/spreadsheets/${q}:batchUpdate`,data:{requests:[{deleteConditionalFormatRule:{sheetId:ae,index:W-1}}]}}),{value:K.Success,result:null,error:null}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return pe.Logger.log("[Google Sheets] error:",b),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:b,result:null}}}})}}function NRn(a){return{NUMBER_GREATER:"Number greater than",NUMBER_GREATER_THAN_EQ:"Number greater than or equal",NUMBER_LESS:"Number less than",NUMBER_LESS_THAN_EQ:"Number less than or equal",NUMBER_EQ:"Number equal to",NUMBER_NOT_EQ:"Number not equal to",NUMBER_BETWEEN:"Number between",NUMBER_NOT_BETWEEN:"Number not between",TEXT_CONTAINS:"Text contains",TEXT_NOT_CONTAINS:"Text does not contain",TEXT_STARTS_WITH:"Text starts with",TEXT_ENDS_WITH:"Text ends with",TEXT_EQ:"Text equals",DATE_EQ:"Date is",DATE_BEFORE:"Date is before",DATE_AFTER:"Date is after",DATE_ON_OR_BEFORE:"Date is on or before",DATE_ON_OR_AFTER:"Date is on or after",BLANK:"Cell is empty",NOT_BLANK:"Cell is not empty",CUSTOM_FORMULA:"Custom formula"}[a]||a}function b5(a){let p,t="",n=a+1;for(;n>0;)p=(n-1)%26,t=String.fromCharCode(65+p)+t,n=(n-p-1)/26;return t}function _Rn(a,p){if(!a)return"";let t=p?`'${p}'!`:"";const n=a.startColumnIndex!==void 0?b5(a.startColumnIndex):"",s=a.startRowIndex!==void 0?String(a.startRowIndex+1):"",u=a.endColumnIndex!==void 0?b5(a.endColumnIndex-1):"",e=a.endRowIndex!==void 0?String(a.endRowIndex):"";return n&&s&&u&&e?n===u&&s===e?`${t}${n}${s}`:`${t}${n}${s}:${u}${e}`:n&&u&&!s&&!e?`${t}${n}:${u}`:s&&e&&!n&&!u?`${t}${s}:${e}`:`${t}${n}${s}:${u}${e}`.replace(/:$/,"")}class V1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsGetConditionalFormatRules,version:"1.0.0",description:"Get Conditional Format Rules Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsGetConditionalFormatRules);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T;try{const g=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!g||!g.env)throw new Error("Editor context or environment missing");const b=Be(t,t.project,"getConditionalFormatRules"),I="["+Ve(t,t.project,"Get Conditional Format Rules")+": `"+b+"`] ",A=(le,oe,ce)=>{const be=Ve(le==null?void 0:le.valueOwner,g==null?void 0:g.logic,oe),Ce=Be(le==null?void 0:le.valueOwner,g==null?void 0:g.logic,ce);return`"${be}" (\`${Ce}\`)`},O=G.operation[J.GoogleSheetsGetConditionalFormatRules].inputs,P=le=>{var ce;const oe=n.find(be=>{var Ce;return((Ce=be.valueOwner.declaration)==null?void 0:Ce.id)===le});return(ce=oe==null?void 0:oe.value)==null?void 0:ce.value},x=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===O.connection.id}),$=(s=x==null?void 0:x.value)==null?void 0:s.valueAsType;if(!$||!$.id||!$.name||$.type!==r.DefinitionEntity)throw new Error(`${I}The ${A(x,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const U=ui($);if(!U)throw new Error(`${I}The ${A(x,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const Z=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===O.spreadsheetId.id}),q=(u=Z==null?void 0:Z.value)==null?void 0:u.value,H=ln(q,{errorPrefix:`${I}The ${A(Z,"Spreadsheet ID","spreadsheetId")} input `}),Y=P(O.sheet.id),ie=typeof Y=="string"&&Y.trim()!==""?Y.trim():null,W={Authorization:`Bearer ${await g.getAccessToken()}`},ee=`${(e=g.env)==null?void 0:e.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${g.projectId}/${Zt["google-sheet"]}/${U}`,re=((f=(await(async le=>Ht.post(ee,le,{headers:W}))({method:"GET",endpoint:`/v4/spreadsheets/${H}?fields=sheets(properties(sheetId,title),conditionalFormats)`})).data)==null?void 0:f.sheets)||[],ae=[];for(const le of re){const oe=((y=le.properties)==null?void 0:y.title)||"",ce=(m=le.properties)==null?void 0:m.sheetId;if(ie&&oe.toLowerCase()!==ie.toLowerCase())continue;(le.conditionalFormats||[]).forEach((Ce,Ee)=>{const Oe=Ee+1,Le=(Ce.ranges||[]).map(ot=>_Rn(ot,oe)),Fe=Ce.booleanRule||{},tt=Fe.condition||{},We=NRn(tt.type||""),et=(tt.values||[]).map(ot=>ot.userEnteredValue||""),qe=Fe.format||{};ae.push({index:Oe,sheet:oe,sheetId:ce,ranges:Le,conditionType:We,conditionValues:et,format:qe})})}return{value:K.Success,error:null,result:ae}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return pe.Logger.log("[Google Sheets] error:",b),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:b,result:null}}}})}}function E5(a){let p,t="",n=a+1;for(;n>0;)p=(n-1)%26,t=String.fromCharCode(65+p)+t,n=(n-p-1)/26;return t}function $Rn(a,p){if(!a)return"";let t=p?`'${p}'!`:"";const n=a.startColumnIndex!==void 0?E5(a.startColumnIndex):"",s=a.startRowIndex!==void 0?String(a.startRowIndex+1):"",u=a.endColumnIndex!==void 0?E5(a.endColumnIndex-1):"",e=a.endRowIndex!==void 0?String(a.endRowIndex):"";return n&&s&&u&&e?n===u&&s===e?`${t}${n}${s}`:`${t}${n}${s}:${u}${e}`:n&&u&&!s&&!e?`${t}${n}:${u}`:s&&e&&!n&&!u?`${t}${s}:${e}`:`${t}${n}${s}:${u}${e}`.replace(/:$/,"")}class N1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsGetProtectedRanges,version:"1.0.0",description:"Get Protected Ranges Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsGetProtectedRanges);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g;try{const b=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!b||!b.env)throw new Error("Editor context or environment missing");const R=Be(t,t.project,"getProtectedRanges"),A="["+Ve(t,t.project,"Get protected ranges")+": `"+R+"`] ",O=(ae,le,oe)=>{const ce=Ve(ae==null?void 0:ae.valueOwner,b==null?void 0:b.logic,le),be=Be(ae==null?void 0:ae.valueOwner,b==null?void 0:b.logic,oe);return`"${ce}" (\`${be}\`)`},P=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[J.GoogleSheetsGetProtectedRanges].inputs.connection.id}),x=(s=P==null?void 0:P.value)==null?void 0:s.valueAsType;if(!x||!x.id||!x.name||x.type!==r.DefinitionEntity)throw new Error(`${A}The ${O(P,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const $=ui(x);if(!$)throw new Error(`${A}The ${O(P,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const U=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[J.GoogleSheetsGetProtectedRanges].inputs.spreadsheetId.id}),Z=(u=U==null?void 0:U.value)==null?void 0:u.value,q=ln(Z,{errorPrefix:`${A}The ${O(U,"Spreadsheet ID","spreadsheetId")} input `}),H=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[J.GoogleSheetsGetProtectedRanges].inputs.sheet.id}),Y=(e=H==null?void 0:H.value)!=null&&e.value?String(H.value.value).trim():null,z={Authorization:`Bearer ${await b.getAccessToken()}`},W=`${(f=b.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${b.projectId}/${Zt["google-sheet"]}/${$}`,X=((y=(await(async ae=>Ht.post(W,ae,{headers:z}))({method:"GET",endpoint:`/v4/spreadsheets/${q}`})).data)==null?void 0:y.sheets)||[],re=[];for(const ae of X){const le=(m=ae.properties)==null?void 0:m.title,oe=(T=ae.properties)==null?void 0:T.sheetId;if(Y&&le!==Y)continue;const ce=ae.protectedRanges||[];for(const be of ce){const Ce=$Rn(be.range,le);re.push({protectedRangeId:be.protectedRangeId,sheet:le,sheetId:oe,range:Ce,description:be.description||"",warningOnly:be.warningOnly??!1,requestingUserCanEdit:be.requestingUserCanEdit??!0})}}return{value:K.Success,error:null,result:re}}catch(b){const R=((g=b.response)==null?void 0:g.data)||b.message||b;return pe.Logger.log("[Google Sheets] error:",R),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:R,result:null}}}})}}function bh(a){if(!a)return null;const p=Math.round((a.red||0)*255),t=Math.round((a.green||0)*255),n=Math.round((a.blue||0)*255),s=u=>u.toString(16).padStart(2,"0");return`#${s(p)}${s(t)}${s(n)}`}function I5(a){let p,t="",n=a+1;for(;n>0;)p=(n-1)%26,t=String.fromCharCode(65+p)+t,n=(n-p-1)/26;return t}function GRn(a,p){if(!a)return"";let t=p?`'${p}'!`:"";const n=a.startColumnIndex!==void 0?I5(a.startColumnIndex):"",s=a.startRowIndex!==void 0?String(a.startRowIndex+1):"",u=a.endColumnIndex!==void 0?I5(a.endColumnIndex-1):"",e=a.endRowIndex!==void 0?String(a.endRowIndex):"";return n&&s&&u&&e?n===u&&s===e?`${t}${n}${s}`:`${t}${n}${s}:${u}${e}`:n&&u&&!s&&!e?`${t}${n}:${u}`:s&&e&&!n&&!u?`${t}${s}:${e}`:`${t}${n}${s}:${u}${e}`.replace(/:$/,"")}class _1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsGetBandedRanges,version:"1.0.0",description:"Get Banded Ranges Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsGetBandedRanges);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A;try{const O=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!O||!O.env)throw new Error("Editor context or environment missing");const P=Be(t,t.project,"getBandedRanges"),$="["+Ve(t,t.project,"Get banded ranges")+": `"+P+"`] ",U=(be,Ce,Ee)=>{const Oe=Ve(be==null?void 0:be.valueOwner,O==null?void 0:O.logic,Ce),Le=Be(be==null?void 0:be.valueOwner,O==null?void 0:O.logic,Ee);return`"${Oe}" (\`${Le}\`)`},Z=n.find(be=>{var Ce;return((Ce=be.valueOwner.declaration)==null?void 0:Ce.id)===G.operation[J.GoogleSheetsGetBandedRanges].inputs.connection.id}),q=(s=Z==null?void 0:Z.value)==null?void 0:s.valueAsType;if(!q||!q.id||!q.name||q.type!==r.DefinitionEntity)throw new Error(`${$}The ${U(Z,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const H=ui(q);if(!H)throw new Error(`${$}The ${U(Z,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const Y=n.find(be=>{var Ce;return((Ce=be.valueOwner.declaration)==null?void 0:Ce.id)===G.operation[J.GoogleSheetsGetBandedRanges].inputs.spreadsheetId.id}),ie=(u=Y==null?void 0:Y.value)==null?void 0:u.value,z=ln(ie,{errorPrefix:`${$}The ${U(Y,"Spreadsheet ID","spreadsheetId")} input `}),W=n.find(be=>{var Ce;return((Ce=be.valueOwner.declaration)==null?void 0:Ce.id)===G.operation[J.GoogleSheetsGetBandedRanges].inputs.sheet.id}),ee=(e=W==null?void 0:W.value)!=null&&e.value?String(W.value.value).trim():null,X={Authorization:`Bearer ${await O.getAccessToken()}`},re=`${(f=O.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${O.projectId}/${Zt["google-sheet"]}/${H}`,oe=((y=(await(async be=>Ht.post(re,be,{headers:X}))({method:"GET",endpoint:`/v4/spreadsheets/${z}`})).data)==null?void 0:y.sheets)||[],ce=[];for(const be of oe){const Ce=(m=be.properties)==null?void 0:m.title,Ee=(T=be.properties)==null?void 0:T.sheetId;if(ee&&Ce!==ee)continue;const Oe=be.bandedRanges||[];for(const Le of Oe){const Fe=GRn(Le.range,Ce),tt=Le.rowProperties||{};ce.push({bandedRangeId:Le.bandedRangeId,sheet:Ce,sheetId:Ee,range:Fe,headerRowColor:bh(tt.headerColor)||bh((g=tt.headerColorStyle)==null?void 0:g.rgbColor),firstRowColor:bh(tt.firstBandColor)||bh((b=tt.firstBandColorStyle)==null?void 0:b.rgbColor),secondRowColor:bh(tt.secondBandColor)||bh((R=tt.secondBandColorStyle)==null?void 0:R.rgbColor),footerRowColor:bh(tt.footerColor)||bh((I=tt.footerColorStyle)==null?void 0:I.rgbColor)})}}return{value:K.Success,error:null,result:ce}}catch(O){const P=((A=O.response)==null?void 0:A.data)||O.message||O;return pe.Logger.log("[Google Sheets] error:",P),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:P,result:null}}}})}}function R5(a){let p,t="",n=a+1;for(;n>0;)p=(n-1)%26,t=String.fromCharCode(65+p)+t,n=(n-p-1)/26;return t}function LRn(a,p){if(!a)return"";let t=p?`'${p}'!`:"";const n=a.startColumnIndex!==void 0?R5(a.startColumnIndex):"",s=a.startRowIndex!==void 0?String(a.startRowIndex+1):"",u=a.endColumnIndex!==void 0?R5(a.endColumnIndex-1):"",e=a.endRowIndex!==void 0?String(a.endRowIndex):"";return n&&s&&u&&e?n===u&&s===e?`${t}${n}${s}`:`${t}${n}${s}:${u}${e}`:n&&u&&!s&&!e?`${t}${n}:${u}`:s&&e&&!n&&!u?`${t}${s}:${e}`:`${t}${n}${s}:${u}${e}`.replace(/:$/,"")}class $1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsGetNamedRanges,version:"1.0.0",description:"Get Named Ranges Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsGetNamedRanges);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=Be(t,t.project,"getNamedRanges"),R="["+Ve(t,t.project,"Get named ranges")+": `"+g+"`] ",I=(te,X,re)=>{const ae=Ve(te==null?void 0:te.valueOwner,T==null?void 0:T.logic,X),le=Be(te==null?void 0:te.valueOwner,T==null?void 0:T.logic,re);return`"${ae}" (\`${le}\`)`},A=n.find(te=>{var X;return((X=te.valueOwner.declaration)==null?void 0:X.id)===G.operation[J.GoogleSheetsGetNamedRanges].inputs.connection.id}),O=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${R}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const P=ui(O);if(!P)throw new Error(`${R}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(te=>{var X;return((X=te.valueOwner.declaration)==null?void 0:X.id)===G.operation[J.GoogleSheetsGetNamedRanges].inputs.spreadsheetId.id}),$=(u=x==null?void 0:x.value)==null?void 0:u.value,U=ln($,{errorPrefix:`${R}The ${I(x,"Spreadsheet ID","spreadsheetId")} input `}),q={Authorization:`Bearer ${await T.getAccessToken()}`},H=`${(e=T.env)==null?void 0:e.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${T.projectId}/${Zt["google-sheet"]}/${P}`,ie=await(async te=>Ht.post(H,te,{headers:q}))({method:"GET",endpoint:`/v4/spreadsheets/${U}`}),z={};(((f=ie.data)==null?void 0:f.sheets)||[]).forEach(te=>{var X;((X=te.properties)==null?void 0:X.sheetId)!==void 0&&(z[te.properties.sheetId]=te.properties.title||"")});const ee=(((y=ie.data)==null?void 0:y.namedRanges)||[]).map(te=>{var ae;const X=z[(ae=te.range)==null?void 0:ae.sheetId]||"",re=LRn(te.range,X);return{namedRangeId:te.namedRangeId,name:te.name,sheet:X,range:re}});return{value:K.Success,error:null,result:ee}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return pe.Logger.log("[Google Sheets] error:",g),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:g,result:null}}}})}}class G1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsGetSheets,version:"1.0.0",description:"Get Sheets Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsGetSheets);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"getSheets"),b="["+Ve(t,t.project,"Get sheets")+": `"+T+"`] ",R=(W,ee,te)=>{const X=Ve(W==null?void 0:W.valueOwner,m==null?void 0:m.logic,ee),re=Be(W==null?void 0:W.valueOwner,m==null?void 0:m.logic,te);return`"${X}" (\`${re}\`)`},I=n.find(W=>{var ee;return((ee=W.valueOwner.declaration)==null?void 0:ee.id)===G.operation[J.GoogleSheetsGetSheets].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(A);if(!O)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(W=>{var ee;return((ee=W.valueOwner.declaration)==null?void 0:ee.id)===G.operation[J.GoogleSheetsGetSheets].inputs.spreadsheetId.id}),x=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(x,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),Z={Authorization:`Bearer ${await m.getAccessToken()}`},q=`${(e=m.env)==null?void 0:e.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${O}`,z=(((f=(await(async W=>Ht.post(q,W,{headers:Z}))({method:"GET",endpoint:`/v4/spreadsheets/${$}`})).data)==null?void 0:f.sheets)||[]).map(W=>{var ee,te,X,re,ae,le,oe,ce,be,Ce,Ee,Oe,Le;return{sheetId:(ee=W.properties)==null?void 0:ee.sheetId,title:(te=W.properties)==null?void 0:te.title,index:(X=W.properties)==null?void 0:X.index,sheetType:(re=W.properties)==null?void 0:re.sheetType,rowCount:(le=(ae=W.properties)==null?void 0:ae.gridProperties)==null?void 0:le.rowCount,columnCount:(ce=(oe=W.properties)==null?void 0:oe.gridProperties)==null?void 0:ce.columnCount,frozenRowCount:(Ce=(be=W.properties)==null?void 0:be.gridProperties)==null?void 0:Ce.frozenRowCount,frozenColumnCount:(Oe=(Ee=W.properties)==null?void 0:Ee.gridProperties)==null?void 0:Oe.frozenColumnCount,hidden:((Le=W.properties)==null?void 0:Le.hidden)??!1}});return{value:K.Success,error:null,result:z}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class L1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsGetSheet,version:"1.0.0",description:"Get Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsGetSheet);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=Be(t,t.project,"getSheet"),R="["+Ve(t,t.project,"Get sheet")+": `"+g+"`] ",I=(le,oe,ce)=>{const be=Ve(le==null?void 0:le.valueOwner,T==null?void 0:T.logic,oe),Ce=Be(le==null?void 0:le.valueOwner,T==null?void 0:T.logic,ce);return`"${be}" (\`${Ce}\`)`},A=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[J.GoogleSheetsGetSheet].inputs.connection.id}),O=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${R}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const P=ui(O);if(!P)throw new Error(`${R}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[J.GoogleSheetsGetSheet].inputs.spreadsheetId.id}),$=(u=x==null?void 0:x.value)==null?void 0:u.value,U=ln($,{errorPrefix:`${R}The ${I(x,"Spreadsheet ID","spreadsheetId")} input `}),Z=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[J.GoogleSheetsGetSheet].inputs.sheet.id}),q=(e=Z==null?void 0:Z.value)==null?void 0:e.value;if(q==null||q==="")throw new Error(`${R}The ${I(Z,"Sheet","sheet")} input is missing.`);const Y={Authorization:`Bearer ${await T.getAccessToken()}`},ie=`${(f=T.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${T.projectId}/${Zt["google-sheet"]}/${P}`,ee=((y=(await(async le=>Ht.post(ie,le,{headers:Y}))({method:"GET",endpoint:`/v4/spreadsheets/${U}`})).data)==null?void 0:y.sheets)||[];let te=null;if(typeof q=="number")te=ee.find(le=>{var oe;return Number((oe=le.properties)==null?void 0:oe.sheetId)===q});else if(typeof q=="string"){const le=q.trim();te=ee.find(oe=>{var ce,be;return((ce=oe.properties)==null?void 0:ce.title)===le||String((be=oe.properties)==null?void 0:be.sheetId)===le})}if(!te)throw new Error(`${R}Sheet "${q}" was not found in spreadsheet.`);const X=te.properties||{},re=X.gridProperties||{},ae={sheetId:X.sheetId,title:X.title,index:X.index,sheetType:X.sheetType,rowCount:re.rowCount,columnCount:re.columnCount,frozenRowCount:re.frozenRowCount,frozenColumnCount:re.frozenColumnCount,hideGridlines:re.hideGridlines??!1,rowGroupControlAfter:re.rowGroupControlAfter??!1,columnGroupControlAfter:re.columnGroupControlAfter??!1,hidden:X.hidden??!1,rightToLeft:X.rightToLeft??!1,tabColor:X.tabColor?{red:X.tabColor.red??0,green:X.tabColor.green??0,blue:X.tabColor.blue??0,alpha:X.tabColor.alpha??1}:null,basicFilter:te.basicFilter?{range:te.basicFilter.range}:null,protectedRanges:(te.protectedRanges||[]).map(le=>({protectedRangeId:le.protectedRangeId,range:le.range,description:le.description??"",warningOnly:le.warningOnly??!1,requestingUserCanEdit:le.requestingUserCanEdit??!1,namedRangeId:le.namedRangeId??null})),bandedRanges:(te.bandedRanges||[]).map(le=>({bandedRangeId:le.bandedRangeId,range:le.range})),charts:(te.charts||[]).map(le=>{var oe,ce;return{chartId:le.chartId,title:((oe=le.spec)==null?void 0:oe.title)??"",chartType:((ce=le.spec)==null?void 0:ce.chartType)??""}}),conditionalFormatRules:(te.conditionalFormats||[]).map((le,oe)=>{var ce;return{ruleIndex:oe,range:(ce=le.ranges)!=null&&ce[0]?`${le.ranges[0].startRowIndex}:${le.ranges[0].endRowIndex}`:""}}),mergedCells:(te.merges||[]).map(le=>`${le.startRowIndex}:${le.endRowIndex}`)};return{value:K.Success,error:null,result:ae}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return pe.Logger.log("[Google Sheets] error:",g),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:g,result:null}}}})}}function A5(a){let p,t="",n=a+1;for(;n>0;)p=(n-1)%26,t=String.fromCharCode(65+p)+t,n=(n-p-1)/26;return t}function BRn(a,p){if(!a)return"";let t=p?`'${p}'!`:"";const n=a.startColumnIndex!==void 0?A5(a.startColumnIndex):"",s=a.startRowIndex!==void 0?String(a.startRowIndex+1):"",u=a.endColumnIndex!==void 0?A5(a.endColumnIndex-1):"",e=a.endRowIndex!==void 0?String(a.endRowIndex):"";return n&&s&&u&&e?n===u&&s===e?`${t}${n}${s}`:`${t}${n}${s}:${u}${e}`:n&&u&&!s&&!e?`${t}${n}:${u}`:s&&e&&!n&&!u?`${t}${s}:${e}`:`${t}${n}${s}:${u}${e}`.replace(/:$/,"")}class B1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsGetCharts,version:"1.0.0",description:"Get Charts Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsGetCharts);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I;try{const A=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!A||!A.env)throw new Error("Editor context or environment missing");const O=Be(t,t.project,"getCharts"),x="["+Ve(t,t.project,"Get charts")+": `"+O+"`] ",$=(ce,be,Ce)=>{const Ee=Ve(ce==null?void 0:ce.valueOwner,A==null?void 0:A.logic,be),Oe=Be(ce==null?void 0:ce.valueOwner,A==null?void 0:A.logic,Ce);return`"${Ee}" (\`${Oe}\`)`},U=n.find(ce=>{var be;return((be=ce.valueOwner.declaration)==null?void 0:be.id)===G.operation[J.GoogleSheetsGetCharts].inputs.connection.id}),Z=(s=U==null?void 0:U.value)==null?void 0:s.valueAsType;if(!Z||!Z.id||!Z.name||Z.type!==r.DefinitionEntity)throw new Error(`${x}The ${$(U,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const q=ui(Z);if(!q)throw new Error(`${x}The ${$(U,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const H=n.find(ce=>{var be;return((be=ce.valueOwner.declaration)==null?void 0:be.id)===G.operation[J.GoogleSheetsGetCharts].inputs.spreadsheetId.id}),Y=(u=H==null?void 0:H.value)==null?void 0:u.value,ie=ln(Y,{errorPrefix:`${x}The ${$(H,"Spreadsheet ID","spreadsheetId")} input `}),z=n.find(ce=>{var be;return((be=ce.valueOwner.declaration)==null?void 0:be.id)===G.operation[J.GoogleSheetsGetCharts].inputs.sheet.id}),W=(e=z==null?void 0:z.value)!=null&&e.value?String(z.value.value).trim():null,te={Authorization:`Bearer ${await A.getAccessToken()}`},X=`${(f=A.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${A.projectId}/${Zt["google-sheet"]}/${q}`,le=((y=(await(async ce=>Ht.post(X,ce,{headers:te}))({method:"GET",endpoint:`/v4/spreadsheets/${ie}`})).data)==null?void 0:y.sheets)||[],oe=[];for(const ce of le){const be=(m=ce.properties)==null?void 0:m.title,Ce=(T=ce.properties)==null?void 0:T.sheetId;if(W&&be!==W)continue;const Ee=ce.charts||[];for(const Oe of Ee){const Le=Oe.spec||{},Fe=Le.title||"",tt=((g=Le.basicChart)==null?void 0:g.chartType)||(Le.pieChart?"PIE":"UNKNOWN"),We=BRn((R=(b=Oe.position)==null?void 0:b.overlayPosition)==null?void 0:R.anchorCell,be);oe.push({chartId:Oe.chartId,sheet:be,sheetId:Ce,title:Fe,chartType:tt,positionRange:We})}}return{value:K.Success,error:null,result:oe}}catch(A){const O=((I=A.response)==null?void 0:I.data)||A.message||A;return pe.Logger.log("[Google Sheets] error:",O),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:O,result:null}}}})}}function D5(a){let p,t="",n=a+1;for(;n>0;)p=(n-1)%26,t=String.fromCharCode(65+p)+t,n=(n-p-1)/26;return t}function C5(a,p){if(!a)return"";let t=p?`'${p}'!`:"";const n=a.startColumnIndex!==void 0?D5(a.startColumnIndex):"",s=a.startRowIndex!==void 0?String(a.startRowIndex+1):"",u=a.endColumnIndex!==void 0?D5(a.endColumnIndex-1):"",e=a.endRowIndex!==void 0?String(a.endRowIndex):"";return n&&s&&u&&e?n===u&&s===e?`${t}${n}${s}`:`${t}${n}${s}:${u}${e}`:n&&u&&!s&&!e?`${t}${n}:${u}`:s&&e&&!n&&!u?`${t}${s}:${e}`:`${t}${n}${s}:${u}${e}`.replace(/:$/,"")}class S1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsGetFilter,version:"1.0.0",description:"Get Filter Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsGetFilter);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g;try{const b=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!b||!b.env)throw new Error("Editor context or environment missing");const R=Be(t,t.project,"getFilter"),A="["+Ve(t,t.project,"Get filter")+": `"+R+"`] ",O=(Ce,Ee,Oe)=>{const Le=Ve(Ce==null?void 0:Ce.valueOwner,b==null?void 0:b.logic,Ee),Fe=Be(Ce==null?void 0:Ce.valueOwner,b==null?void 0:b.logic,Oe);return`"${Le}" (\`${Fe}\`)`},P=n.find(Ce=>{var Ee;return((Ee=Ce.valueOwner.declaration)==null?void 0:Ee.id)===G.operation[J.GoogleSheetsGetFilter].inputs.connection.id}),x=(s=P==null?void 0:P.value)==null?void 0:s.valueAsType;if(!x||!x.id||!x.name||x.type!==r.DefinitionEntity)throw new Error(`${A}The ${O(P,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const $=ui(x);if(!$)throw new Error(`${A}The ${O(P,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const U=n.find(Ce=>{var Ee;return((Ee=Ce.valueOwner.declaration)==null?void 0:Ee.id)===G.operation[J.GoogleSheetsGetFilter].inputs.spreadsheetId.id}),Z=(u=U==null?void 0:U.value)==null?void 0:u.value,q=ln(Z,{errorPrefix:`${A}The ${O(U,"Spreadsheet ID","spreadsheetId")} input `}),H=n.find(Ce=>{var Ee;return((Ee=Ce.valueOwner.declaration)==null?void 0:Ee.id)===G.operation[J.GoogleSheetsGetFilter].inputs.sheet.id}),Y=(e=H==null?void 0:H.value)!=null&&e.value?String(H.value.value).trim():null,z={Authorization:`Bearer ${await b.getAccessToken()}`},W=`${(f=b.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${b.projectId}/${Zt["google-sheet"]}/${$}`,X=((y=(await(async Ce=>Ht.post(W,Ce,{headers:z}))({method:"GET",endpoint:`/v4/spreadsheets/${q}`})).data)==null?void 0:y.sheets)||[];let re=X[0];Y&&(re=X.find(Ce=>{var Ee;return((Ee=Ce.properties)==null?void 0:Ee.title)===Y})||re);const ae=((m=re==null?void 0:re.properties)==null?void 0:m.title)||"",le=((T=re==null?void 0:re.properties)==null?void 0:T.sheetId)??0,oe=re==null?void 0:re.basicFilter,ce=oe?C5(oe.range,ae):null,be=((re==null?void 0:re.filterViews)||[]).map(Ce=>({filterViewId:Ce.filterViewId,title:Ce.title,range:C5(Ce.range,ae)}));return{value:K.Success,error:null,result:{sheet:ae,sheetId:le,filterRange:ce,filterViews:be}}}catch(b){const R=((g=b.response)==null?void 0:g.data)||b.message||b;return pe.Logger.log("[Google Sheets] error:",R),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:R,result:null}}}})}}function w5(a){let p,t="",n=a+1;for(;n>0;)p=(n-1)%26,t=String.fromCharCode(65+p)+t,n=(n-p-1)/26;return t}function SRn(a,p){if(!a)return"";let t=p?`'${p}'!`:"";const n=a.startColumnIndex!==void 0?w5(a.startColumnIndex):"",s=a.startRowIndex!==void 0?String(a.startRowIndex+1):"",u=a.endColumnIndex!==void 0?w5(a.endColumnIndex-1):"",e=a.endRowIndex!==void 0?String(a.endRowIndex):"";return n&&s&&u&&e?n===u&&s===e?`${t}${n}${s}`:`${t}${n}${s}:${u}${e}`:n&&u&&!s&&!e?`${t}${n}:${u}`:s&&e&&!n&&!u?`${t}${s}:${e}`:`${t}${n}${s}:${u}${e}`.replace(/:$/,"")}class M1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsGetMergedCells,version:"1.0.0",description:"Get Merged Cells Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsGetMergedCells);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g;try{const b=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!b||!b.env)throw new Error("Editor context or environment missing");const R=Be(t,t.project,"getMergedCells"),A="["+Ve(t,t.project,"Get merged cells")+": `"+R+"`] ",O=(ae,le,oe)=>{const ce=Ve(ae==null?void 0:ae.valueOwner,b==null?void 0:b.logic,le),be=Be(ae==null?void 0:ae.valueOwner,b==null?void 0:b.logic,oe);return`"${ce}" (\`${be}\`)`},P=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[J.GoogleSheetsGetMergedCells].inputs.connection.id}),x=(s=P==null?void 0:P.value)==null?void 0:s.valueAsType;if(!x||!x.id||!x.name||x.type!==r.DefinitionEntity)throw new Error(`${A}The ${O(P,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const $=ui(x);if(!$)throw new Error(`${A}The ${O(P,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const U=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[J.GoogleSheetsGetMergedCells].inputs.spreadsheetId.id}),Z=(u=U==null?void 0:U.value)==null?void 0:u.value,q=ln(Z,{errorPrefix:`${A}The ${O(U,"Spreadsheet ID","spreadsheetId")} input `}),H=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[J.GoogleSheetsGetMergedCells].inputs.sheet.id}),Y=(e=H==null?void 0:H.value)!=null&&e.value?String(H.value.value).trim():null,z={Authorization:`Bearer ${await b.getAccessToken()}`},W=`${(f=b.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${b.projectId}/${Zt["google-sheet"]}/${$}`,X=((y=(await(async ae=>Ht.post(W,ae,{headers:z}))({method:"GET",endpoint:`/v4/spreadsheets/${q}`})).data)==null?void 0:y.sheets)||[],re=[];for(const ae of X){const le=(m=ae.properties)==null?void 0:m.title,oe=(T=ae.properties)==null?void 0:T.sheetId;if(Y&&le!==Y)continue;const ce=ae.merges||[];for(const be of ce){const Ce=SRn(be,le);re.push({sheet:le,sheetId:oe,range:Ce})}}return{value:K.Success,error:null,result:re}}catch(b){const R=((g=b.response)==null?void 0:g.data)||b.message||b;return pe.Logger.log("[Google Sheets] error:",R),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:R,result:null}}}})}}class F1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsResizeDimension,version:"1.0.0",description:"Resize Dimension Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsResizeDimension);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T;try{const g=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!g||!g.env)throw new Error("Editor context or environment missing");const b=Be(t,t.project,"resizeDimension"),I="["+Ve(t,t.project,"Resize dimension")+": `"+b+"`] ",A=(ce,be,Ce)=>{const Ee=Ve(ce==null?void 0:ce.valueOwner,g==null?void 0:g.logic,be),Oe=Be(ce==null?void 0:ce.valueOwner,g==null?void 0:g.logic,Ce);return`"${Ee}" (\`${Oe}\`)`},O=n.find(ce=>{var be;return((be=ce.valueOwner.declaration)==null?void 0:be.id)===G.operation[J.GoogleSheetsResizeDimension].inputs.connection.id}),P=(s=O==null?void 0:O.value)==null?void 0:s.valueAsType;if(!P||!P.id||!P.name||P.type!==r.DefinitionEntity)throw new Error(`${I}The ${A(O,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=ui(P);if(!x)throw new Error(`${I}The ${A(O,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const $=n.find(ce=>{var be;return((be=ce.valueOwner.declaration)==null?void 0:be.id)===G.operation[J.GoogleSheetsResizeDimension].inputs.spreadsheetId.id}),U=(u=$==null?void 0:$.value)==null?void 0:u.value,Z=ln(U,{errorPrefix:`${I}The ${A($,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(ce=>{var be;return((be=ce.valueOwner.declaration)==null?void 0:be.id)===G.operation[J.GoogleSheetsResizeDimension].inputs.range.id}),H=(e=q==null?void 0:q.value)==null?void 0:e.value;if(H==null)throw new Error(`${I}The ${A(q,"Range","range")} input is missing.`);const Y=n.find(ce=>{var be;return((be=ce.valueOwner.declaration)==null?void 0:be.id)===G.operation[J.GoogleSheetsResizeDimension].inputs.dimension.id}),ie=((f=Y==null?void 0:Y.value)==null?void 0:f.value)||"Both",z=n.find(ce=>{var be;return((be=ce.valueOwner.declaration)==null?void 0:be.id)===G.operation[J.GoogleSheetsResizeDimension].inputs.pixelSize.id}),W=(y=z==null?void 0:z.value)==null?void 0:y.value;if(W==null||typeof W!="number"||isNaN(W)||W<0)throw new Error(`${I}The ${A(z,"Pixel size","pixelSize")} input is missing or invalid. Expected a non-negative number in pixels.`);const te={Authorization:`Bearer ${await g.getAccessToken()}`},X=`${(m=g.env)==null?void 0:m.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${g.projectId}/${Zt["google-sheet"]}/${x}`,re=async ce=>Ht.post(X,ce,{headers:te}),ae=await Ha(H,"Id",async()=>{var be;return(((be=(await re({method:"GET",endpoint:`/v4/spreadsheets/${Z}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:be.sheets)||[]).map(Ce=>{var Ee,Oe;return{id:(Ee=Ce.properties)==null?void 0:Ee.sheetId,name:(Oe=Ce.properties)==null?void 0:Oe.title}})}),oe=S4(ae,typeof ie=="string"?ie:void 0,{errorPrefix:`${I}The ${A(q,"Range","range")} input `}).map(ce=>({updateDimensionProperties:{range:ce,properties:{pixelSize:W},fields:"pixelSize"}}));return await re({method:"POST",endpoint:`/v4/spreadsheets/${Z}:batchUpdate`,data:{requests:oe}}),{value:K.Success,result:null,error:null}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return pe.Logger.log("[Google Sheets] error:",b),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:b,result:null}}}})}}class k1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+J.GoogleSheetsClearFormatting,version:"1.0.0",description:"Clear Formatting Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===Q.Logic);if(n){const s=n.get(J.GoogleSheetsClearFormatting);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"clearFormatting"),b="["+Ve(t,t.project,"Clear formatting")+": `"+T+"`] ",R=(ee,te,X)=>{const re=Ve(ee==null?void 0:ee.valueOwner,m==null?void 0:m.logic,te),ae=Be(ee==null?void 0:ee.valueOwner,m==null?void 0:m.logic,X);return`"${re}" (\`${ae}\`)`},I=n.find(ee=>{var te;return((te=ee.valueOwner.declaration)==null?void 0:te.id)===G.operation[J.GoogleSheetsClearFormatting].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(A);if(!O)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(ee=>{var te;return((te=ee.valueOwner.declaration)==null?void 0:te.id)===G.operation[J.GoogleSheetsClearFormatting].inputs.spreadsheetId.id}),x=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(x,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(ee=>{var te;return((te=ee.valueOwner.declaration)==null?void 0:te.id)===G.operation[J.GoogleSheetsClearFormatting].inputs.range.id}),Z=(e=U==null?void 0:U.value)==null?void 0:e.value;if(!Z||Z==="")throw new Error(`${b}The ${R(U,"Range","range")} input is missing.`);const H={Authorization:`Bearer ${await m.getAccessToken()}`},Y=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${O}`,ie=async ee=>Ht.post(Y,ee,{headers:H}),z=await Ha(Z,"Id",async()=>{var te;return(((te=(await ie({method:"GET",endpoint:`/v4/spreadsheets/${$}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:te.sheets)||[]).map(X=>{var re,ae;return{id:(re=X.properties)==null?void 0:re.sheetId,name:(ae=X.properties)==null?void 0:ae.title}})}),W=ps(z,{errorPrefix:`${b}The ${R(U,"Range","range")} input `});return await ie({method:"POST",endpoint:`/v4/spreadsheets/${$}:batchUpdate`,data:{requests:[{repeatCell:{range:W,cell:{userEnteredFormat:{}},fields:"userEnteredFormat"}}]}}),{value:K.Success,error:null,result:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class U1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_UPLOAD_FILE,version:"1.0.0",description:"Cloud File System: Upload File",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic);if(!n)return;const s=n.get(Ye.UploadFile);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"uploadFile"),b="["+Ve(t,t.project,"Upload file")+": `"+T+"`] ",R=n.find(te=>{var X,re;return((re=(X=te.valueOwner)==null?void 0:X.declaration)==null?void 0:re.id)===G.operation[Ye.UploadFile].inputs.bucket.id}),I=(s=R==null?void 0:R.value)==null?void 0:s.valueAsType;if(!I||!I.id||!I.name||I.type!==r.DefinitionEntity)throw new Error(`${b}Invalid input "${Ve(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"Storage")}" (\`${Be(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const A=ul(I==null?void 0:I.id,((u=m.branchHead)==null?void 0:u.identifier)||"main");if(!((m==null?void 0:m.liveResources)||[]).find(te=>te.resourceId===A))throw new Error(`${b}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const P=n.find(te=>{var X,re;return((re=(X=te.valueOwner)==null?void 0:X.declaration)==null?void 0:re.id)===G.operation[Ye.UploadFile].inputs.key.id}),x=(e=P==null?void 0:P.value)==null?void 0:e.value;if(!x||x==="")throw new Error(`${b}The "${Ve(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"key")}\`) input is missing.`);if(typeof x!="string")throw new Error(`${b}The "${Ve(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const $=n.find(te=>{var X,re;return((re=(X=te.valueOwner)==null?void 0:X.declaration)==null?void 0:re.id)===G.operation[Ye.UploadFile].inputs.file.id}),U=(f=$==null?void 0:$.value)==null?void 0:f.value;if(!U)throw new Error(`${b}The "${Ve($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"File")}" (\`${Be($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"file")}\`) input is missing'`);if(typeof U!="object"||!U.uri||typeof U.uri!="string")throw new Error(`${b}The "${Ve($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"File")}" (\`${Be($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"file")}\`) input is invalid, should be an object with a text 'uri' property.`);const Z=U.uri,q=U.mimeType||"application/octet-stream",H=x,ie=(y=(await Ht.post(`${m.env.API_BASE_URL}/cloud-files-service/v1/files?bucket=${A}&key=${encodeURIComponent(H)}&contentType=${encodeURIComponent(q)}`,{},{headers:{Authorization:`Bearer ${await m.getAccessToken()}`}})).data)==null?void 0:y.uploadUrl;if(!ie)throw new Error(`${b}Failed to retrieve pre-signed upload URL.`);let z;try{z=await L4(Z,()=>m.getAccessToken())}catch(te){throw new Error(`${b}Failed to fetch file content from '${Z}': ${(te==null?void 0:te.message)||te}`)}await Ht.put(ie,z,{headers:{"Content-Type":q}});const ee={uri:`${m.env.API_BASE_URL}/cloud-files-service/v1/files/download?bucket=${A}&key=${encodeURIComponent(H)}`,name:H.split("/").pop()||H,mimeType:q,size:z.length};return{value:K.Success,error:null,result:ee}}catch(m){return{value:K.UnhandledError,error:m,result:null}}}})}}class K1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_GET_FILE,version:"1.0.0",description:"Cloud File System: Get File",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic);if(!n)return;const s=n.get(Ye.GetFile);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e;try{const f=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!f||!f.env)throw new Error("Editor context or environment missing");const y=Be(t,t.project,"getFile"),T="["+Ve(t,t.project,"Get file")+": `"+y+"`] ",g=n.find($=>{var U,Z;return((Z=(U=$.valueOwner)==null?void 0:U.declaration)==null?void 0:Z.id)===G.operation[Ye.GetFile].inputs.bucket.id}),b=(s=g==null?void 0:g.value)==null?void 0:s.valueAsType;if(!b||!b.id||!b.name||b.type!==r.DefinitionEntity)throw new Error(`${T}Invalid input "${Ve(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"Storage")}" (\`${Be(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const R=ul(b==null?void 0:b.id,((u=f.branchHead)==null?void 0:u.identifier)||"main");if(!((f==null?void 0:f.liveResources)||[]).find($=>$.resourceId===R))throw new Error(`${T}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const A=n.find($=>{var U,Z;return((Z=(U=$.valueOwner)==null?void 0:U.declaration)==null?void 0:Z.id)===G.operation[Ye.GetFile].inputs.key.id}),O=(e=A==null?void 0:A.value)==null?void 0:e.value;if(!O||O==="")throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"key")}\`) input is missing.`);if(typeof O!="string")throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const x=(await Ht.get(`${f.env.API_BASE_URL}/cloud-files-service/v1/files/metadata?bucket=${R}&key=${encodeURIComponent(O)}`,{headers:{Authorization:`Bearer ${await f.getAccessToken()}`}})).data;return{value:K.Success,error:null,result:{uri:x.uri,name:x.name,key:x.key,size:x.size,mimeType:x.mimeType,access:x.access,lastModified:x.lastModified}}}catch(f){return{value:K.UnhandledError,error:f,result:null}}}})}}class j1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_LIST_FILES,version:"1.0.0",description:"Cloud File System: List Files",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic);if(!n)return;const s=n.get(Ye.ListFiles);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"listFiles"),b="["+Ve(t,t.project,"List files")+": `"+T+"`] ",R=n.find(ae=>{var le,oe;return((oe=(le=ae.valueOwner)==null?void 0:le.declaration)==null?void 0:oe.id)===G.operation[Ye.ListFiles].inputs.bucket.id}),I=(s=R==null?void 0:R.value)==null?void 0:s.valueAsType;if(!I||!I.id||!I.name||I.type!==r.DefinitionEntity)throw new Error(`${b}Invalid input "${Ve(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"Storage")}" (\`${Be(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const A=ul(I==null?void 0:I.id,((u=m.branchHead)==null?void 0:u.identifier)||"main");if(!((m==null?void 0:m.liveResources)||[]).find(ae=>ae.resourceId===A))throw new Error(`${b}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const P=n.find(ae=>{var le,oe;return((oe=(le=ae.valueOwner)==null?void 0:le.declaration)==null?void 0:oe.id)===G.operation[Ye.ListFiles].inputs.path.id}),x=(e=P==null?void 0:P.value)==null?void 0:e.value;if(x!==void 0&&typeof x!="string")throw new Error(`${b}The "${Ve(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"Path")}" (\`${Be(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"path")}\`) input value is invalid, if present, it must be a string.`);const $=n.find(ae=>{var le,oe;return((oe=(le=ae.valueOwner)==null?void 0:le.declaration)==null?void 0:oe.id)===G.operation[Ye.ListFiles].inputs.maxKeys.id}),U=(f=$==null?void 0:$.value)==null?void 0:f.value;if(U!==void 0&&(typeof U!="number"||U<=0))throw new Error(`${b}The "${Ve($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"Max results")}" (\`${Be($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"maxKeys")}\`) input value is invalid, if present, it must be a number greater than 0.`);const Z=n.find(ae=>{var le,oe;return((oe=(le=ae.valueOwner)==null?void 0:le.declaration)==null?void 0:oe.id)===G.operation[Ye.ListFiles].inputs.startAfter.id}),q=(y=Z==null?void 0:Z.value)==null?void 0:y.value;if(q!==void 0&&(typeof q!="string"||q===""))throw new Error(`${b}The "${Ve(Z==null?void 0:Z.valueOwner,m==null?void 0:m.logic,"Start after")}" (\`${Be(Z==null?void 0:Z.valueOwner,m==null?void 0:m.logic,"startAfter")}\`) input value is invalid, if present, it must be a non-empty string.`);let H=`${m.env.API_BASE_URL}/cloud-files-service/v1/files?bucket=${A}`;x&&(H+=`&path=${encodeURIComponent(x)}`),U&&(H+=`&maxKeys=${U}`),q&&(H+=`&startAfter=${encodeURIComponent(q)}`);const Y=await Ht.get(H,{headers:{Authorization:`Bearer ${await m.getAccessToken()}`}}),ie=ae=>{var be;if(!ae)return"application/octet-stream";const le=ae.split(".");if(le.length<=1)return"application/octet-stream";const oe=(be=le.pop())==null?void 0:be.toLowerCase();return oe&&{png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",svg:"image/svg+xml",pdf:"application/pdf",txt:"text/plain",html:"text/html",css:"text/css",js:"application/javascript",json:"application/json",csv:"text/csv",xml:"application/xml",zip:"application/zip",mp3:"audio/mpeg",mp4:"video/mp4",mov:"video/quicktime",wav:"audio/wav"}[oe]||"application/octet-stream"},W=(Y.data.items||Y.data.files||[]).map(ae=>({uri:ae.uri||ae.url||`${m.env.API_BASE_URL}/cloud-files-service/v1/files/download?bucket=${A}&key=${encodeURIComponent(ae.key)}`,name:ae.name,key:ae.key,mimeType:ae.mimeType||ie(ae.key),size:ae.size||0,lastModified:ae.lastModified,access:ae.access})),ee=Y.data.total!==void 0?Y.data.total:W.length,te=Y.data.size!==void 0?Y.data.size:W.reduce((ae,le)=>ae+(le.size||0),0),X=Y.data.nextStartAfter!==void 0?Y.data.nextStartAfter:null,re=Y.data.hasMore!==void 0?Y.data.hasMore:!1;return{value:K.Success,error:null,result:{items:W,total:ee,size:te,nextStartAfter:X,hasMore:re}}}catch(m){return{value:K.UnhandledError,error:m,result:null}}}})}}class q1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_DELETE_FILES,version:"1.0.0",description:"Cloud File System: Delete Files",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic);if(!n)return;const s=n.get(Ye.DeleteFiles);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e;try{const f=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!f||!f.env)throw new Error("Editor context or environment missing");const y=Be(t,t.project,"deleteFiles"),T="["+Ve(t,t.project,"Delete files")+": `"+y+"`] ",g=n.find(U=>{var Z,q;return((q=(Z=U.valueOwner)==null?void 0:Z.declaration)==null?void 0:q.id)===G.operation[Ye.DeleteFiles].inputs.bucket.id}),b=(s=g==null?void 0:g.value)==null?void 0:s.valueAsType;if(!b||!b.id||!b.name||b.type!==r.DefinitionEntity)throw new Error(`${T}Invalid input "${Ve(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"Storage")}" (\`${Be(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const R=ul(b==null?void 0:b.id,((u=f.branchHead)==null?void 0:u.identifier)||"main");if(!((f==null?void 0:f.liveResources)||[]).find(U=>U.resourceId===R))throw new Error(`${T}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const A=n.find(U=>{var Z,q;return((q=(Z=U.valueOwner)==null?void 0:Z.declaration)==null?void 0:q.id)===G.operation[Ye.DeleteFiles].inputs.keys.id}),O=(e=A==null?void 0:A.value)==null?void 0:e.value,P=Array.isArray(O)?O:typeof O=="string"&&O!==""?[O]:[];if(!P||P.length===0)throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Keys")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"keys")}\`) input is missing.`);if(!Array.isArray(P)||P.some(U=>typeof U!="string"||U===""))throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Keys")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"keys")}\`) input value is invalid, if present, it must be a list of non-empty strings.`);const $=(await Ht.delete(`${f.env.API_BASE_URL}/cloud-files-service/v1/files`,{headers:{Authorization:`Bearer ${await f.getAccessToken()}`},data:{bucket:R,keys:P}})).data;return{value:K.Success,error:null,result:null}}catch(f){return{value:K.UnhandledError,error:f,result:null}}}})}}class Z1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_COPY_FILE,version:"1.0.0",description:"Cloud File System: Copy File",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic);if(!n)return;const s=n.get(Ye.CopyFile);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=Be(t,t.project,"copyFile"),R="["+Ve(t,t.project,"Copy file")+": `"+g+"`] ",I=n.find(te=>{var X,re;return((re=(X=te.valueOwner)==null?void 0:X.declaration)==null?void 0:re.id)===G.operation[Ye.CopyFile].inputs.bucket.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${R}Invalid input "${Ve(I==null?void 0:I.valueOwner,T==null?void 0:T.logic,"Storage")}" (\`${Be(I==null?void 0:I.valueOwner,T==null?void 0:T.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const O=ul(A==null?void 0:A.id,((u=T.branchHead)==null?void 0:u.identifier)||"main");if(!((T==null?void 0:T.liveResources)||[]).find(te=>te.resourceId===O))throw new Error(`${R}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const x=n.find(te=>{var X,re;return((re=(X=te.valueOwner)==null?void 0:X.declaration)==null?void 0:re.id)===G.operation[Ye.CopyFile].inputs.sourceKey.id}),$=(e=x==null?void 0:x.value)==null?void 0:e.value;if(!$||$==="")throw new Error(`${R}The "${Ve(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"Source key")}" (\`${Be(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"sourceKey")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${R}The "${Ve(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"Source key")}" (\`${Be(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"sourceKey")}\`) input value is invalid, if present, it must be a non-empty string.`);const U=n.find(te=>{var X,re;return((re=(X=te.valueOwner)==null?void 0:X.declaration)==null?void 0:re.id)===G.operation[Ye.CopyFile].inputs.destinationKey.id}),Z=(f=U==null?void 0:U.value)==null?void 0:f.value;if(!Z||Z==="")throw new Error(`${R}The "${Ve(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"Destination key")}" (\`${Be(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"destinationKey")}\`) input is missing.`);if(typeof Z!="string")throw new Error(`${R}The "${Ve(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"Destination key")}" (\`${Be(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"destinationKey")}\`) input value is invalid, if present, it must be a non-empty string.`);const q=n.find(te=>{var X,re;return((re=(X=te.valueOwner)==null?void 0:X.declaration)==null?void 0:re.id)===G.operation[Ye.CopyFile].inputs.destinationBucket.id}),H=(y=q==null?void 0:q.value)==null?void 0:y.valueAsType;if(H&&(!H.id||!H.name||H.type!==r.DefinitionEntity))throw new Error(`${R}Invalid input "${Ve(q==null?void 0:q.valueOwner,T==null?void 0:T.logic,"Destination Storage")}" (\`${Be(q==null?void 0:q.valueOwner,T==null?void 0:T.logic,"destinationBucket")}\`), expected a valid "Cloud file system" node.`);const Y=H!=null&&H.id?ul(H.id,((m=T.branchHead)==null?void 0:m.identifier)||"main"):O;if(!((T==null?void 0:T.liveResources)||[]).find(te=>te.resourceId===Y))throw new Error(`${R}The destination "Cloud file system" is not live. Publish the project first, then try again to run the operation node.`);const z={headers:{Authorization:`Bearer ${await T.getAccessToken()}`}},ee=(await Ht.post(`${T.env.API_BASE_URL}/cloud-files-service/v1/files/copy`,{bucket:O,destinationBucket:Y,sourceKey:$,destinationKey:Z},z)).data;return{value:K.Success,error:null,result:null}}catch(T){return{value:K.UnhandledError,error:T,result:null}}}})}}class H1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_MOVE_FILE,version:"1.0.0",description:"Cloud File System: Move File",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic);if(!n)return;const s=n.get(Ye.MoveFile);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=Be(t,t.project,"moveFile"),R="["+Ve(t,t.project,"Move file")+": `"+g+"`] ",I=n.find(te=>{var X,re;return((re=(X=te.valueOwner)==null?void 0:X.declaration)==null?void 0:re.id)===G.operation[Ye.MoveFile].inputs.bucket.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${R}Invalid input "${Ve(I==null?void 0:I.valueOwner,T==null?void 0:T.logic,"Storage")}" (\`${Be(I==null?void 0:I.valueOwner,T==null?void 0:T.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const O=ul(A==null?void 0:A.id,((u=T.branchHead)==null?void 0:u.identifier)||"main");if(!((T==null?void 0:T.liveResources)||[]).find(te=>te.resourceId===O))throw new Error(`${R}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const x=n.find(te=>{var X,re;return((re=(X=te.valueOwner)==null?void 0:X.declaration)==null?void 0:re.id)===G.operation[Ye.MoveFile].inputs.sourceKey.id}),$=(e=x==null?void 0:x.value)==null?void 0:e.value;if(!$||$==="")throw new Error(`${R}The "${Ve(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"Source key")}" (\`${Be(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"sourceKey")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${R}The "${Ve(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"Source key")}" (\`${Be(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"sourceKey")}\`) input value is invalid, if present, it must be a non-empty string.`);const U=n.find(te=>{var X,re;return((re=(X=te.valueOwner)==null?void 0:X.declaration)==null?void 0:re.id)===G.operation[Ye.MoveFile].inputs.destinationKey.id}),Z=(f=U==null?void 0:U.value)==null?void 0:f.value;if(!Z||Z==="")throw new Error(`${R}The "${Ve(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"Destination key")}" (\`${Be(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"destinationKey")}\`) input is missing.`);if(typeof Z!="string")throw new Error(`${R}The "${Ve(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"Destination key")}" (\`${Be(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"destinationKey")}\`) input value is invalid, if present, it must be a non-empty string.`);const q=n.find(te=>{var X,re;return((re=(X=te.valueOwner)==null?void 0:X.declaration)==null?void 0:re.id)===G.operation[Ye.MoveFile].inputs.destinationBucket.id}),H=(y=q==null?void 0:q.value)==null?void 0:y.valueAsType;if(H&&(!H.id||!H.name||H.type!==r.DefinitionEntity))throw new Error(`${R}Invalid input "${Ve(q==null?void 0:q.valueOwner,T==null?void 0:T.logic,"Destination storage")}" (\`${Be(q==null?void 0:q.valueOwner,T==null?void 0:T.logic,"destinationBucket")}\`), expected a valid "Cloud file system" node.`);const Y=H!=null&&H.id?ul(H.id,((m=T.branchHead)==null?void 0:m.identifier)||"main"):O;if(!((T==null?void 0:T.liveResources)||[]).find(te=>te.resourceId===Y))throw new Error(`${R}The destination "Cloud file system" is not live. Publish the project first, then try again to run the operation node.`);const z={headers:{Authorization:`Bearer ${await T.getAccessToken()}`}},ee=(await Ht.post(`${T.env.API_BASE_URL}/cloud-files-service/v1/files/move`,{bucket:O,destinationBucket:Y,sourceKey:$,destinationKey:Z},z)).data;return{value:K.Success,error:null,result:null}}catch(T){return{value:K.UnhandledError,error:T,result:null}}}})}}class W1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_RENAME_FILE,version:"1.0.0",description:"Cloud File System: Rename File",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic);if(!n)return;const s=n.get(Ye.RenameFile);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f;try{const y=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!y||!y.env)throw new Error("Editor context or environment missing");const m=Be(t,t.project,"renameFile"),g="["+Ve(t,t.project,"Rename file")+": `"+m+"`] ",b=n.find(ie=>{var z,W;return((W=(z=ie.valueOwner)==null?void 0:z.declaration)==null?void 0:W.id)===G.operation[Ye.RenameFile].inputs.bucket.id}),R=(s=b==null?void 0:b.value)==null?void 0:s.valueAsType;if(!R||!R.id||!R.name||R.type!==r.DefinitionEntity)throw new Error(`${g}Invalid input "${Ve(b==null?void 0:b.valueOwner,y==null?void 0:y.logic,"Storage")}" (\`${Be(b==null?void 0:b.valueOwner,y==null?void 0:y.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const I=ul(R==null?void 0:R.id,((u=y.branchHead)==null?void 0:u.identifier)||"main");if(!((y==null?void 0:y.liveResources)||[]).find(ie=>ie.resourceId===I))throw new Error(`${g}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const O=n.find(ie=>{var z,W;return((W=(z=ie.valueOwner)==null?void 0:z.declaration)==null?void 0:W.id)===G.operation[Ye.RenameFile].inputs.key.id}),P=(e=O==null?void 0:O.value)==null?void 0:e.value;if(!P||P==="")throw new Error(`${g}The "${Ve(O==null?void 0:O.valueOwner,y==null?void 0:y.logic,"Key")}" (\`${Be(O==null?void 0:O.valueOwner,y==null?void 0:y.logic,"key")}\`) input is missing.`);if(typeof P!="string")throw new Error(`${g}The "${Ve(O==null?void 0:O.valueOwner,y==null?void 0:y.logic,"Key")}" (\`${Be(O==null?void 0:O.valueOwner,y==null?void 0:y.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const x=n.find(ie=>{var z,W;return((W=(z=ie.valueOwner)==null?void 0:z.declaration)==null?void 0:W.id)===G.operation[Ye.RenameFile].inputs.newName.id}),$=(f=x==null?void 0:x.value)==null?void 0:f.value;if(!$||$==="")throw new Error(`${g}The "${Ve(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"New name")}" (\`${Be(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"newName")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${g}The "${Ve(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"New name")}" (\`${Be(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"newName")}\`) input value is invalid, if present, it must be a non-empty string.`);const U=P.lastIndexOf("/"),q=`${U!==-1?P.substring(0,U+1):""}${$}`,H={headers:{Authorization:`Bearer ${await y.getAccessToken()}`}},Y=await Ht.post(`${y.env.API_BASE_URL}/cloud-files-service/v1/files/rename`,{bucket:I,key:P,newName:$},H);return{value:K.Success,error:null,result:Y.data||{key:P,newName:$,destinationKey:q}}}catch(y){return{value:K.UnhandledError,error:y,result:null}}}})}}class z1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_GET_FILE_METADATA,version:"1.0.0",description:"Cloud File System: Get File Metadata",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic);if(!n)return;const s=n.get(Ye.GetFileMetadata);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e;try{const f=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!f||!f.env)throw new Error("Editor context or environment missing");const y=Be(t,t.project,"getFileMetadata"),T="["+Ve(t,t.project,"Get file metadata")+": `"+y+"`] ",g=n.find(x=>{var $,U;return((U=($=x.valueOwner)==null?void 0:$.declaration)==null?void 0:U.id)===G.operation[Ye.GetFileMetadata].inputs.bucket.id}),b=(s=g==null?void 0:g.value)==null?void 0:s.valueAsType;if(!b||!b.id||!b.name||b.type!==r.DefinitionEntity)throw new Error(`${T}Invalid input "${Ve(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"Storage")}" (\`${Be(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const R=ul(b==null?void 0:b.id,((u=f.branchHead)==null?void 0:u.identifier)||"main");if(!((f==null?void 0:f.liveResources)||[]).find(x=>x.resourceId===R))throw new Error(`${T}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const A=n.find(x=>{var $,U;return((U=($=x.valueOwner)==null?void 0:$.declaration)==null?void 0:U.id)===G.operation[Ye.GetFileMetadata].inputs.key.id}),O=(e=A==null?void 0:A.value)==null?void 0:e.value;if(!O||O==="")throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"key")}\`) input is missing.`);if(typeof O!="string")throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const P=await Ht.get(`${f.env.API_BASE_URL}/cloud-files-service/v1/files/metadata?bucket=${R}&key=${encodeURIComponent(O)}`,{headers:{Authorization:`Bearer ${await f.getAccessToken()}`}});return{value:K.Success,error:null,result:P.data}}catch(f){return{value:K.UnhandledError,error:f,result:null}}}})}}class Y1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_CHECK_FILE_EXISTS,version:"1.0.0",description:"Cloud File System: Check File Exists",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic);if(!n)return;const s=n.get(Ye.CheckFileExists);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e;try{const f=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!f||!f.env)throw new Error("Editor context or environment missing");const y=Be(t,t.project,"checkFileExists"),T="["+Ve(t,t.project,"Check File Exists")+": `"+y+"`] ",g=n.find(x=>{var $,U;return((U=($=x.valueOwner)==null?void 0:$.declaration)==null?void 0:U.id)===G.operation[Ye.CheckFileExists].inputs.bucket.id}),b=(s=g==null?void 0:g.value)==null?void 0:s.valueAsType;if(!b||!b.id||!b.name||b.type!==r.DefinitionEntity)throw new Error(`${T}Invalid input "${Ve(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"Storage")}" (\`${Be(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const R=ul(b==null?void 0:b.id,((u=f.branchHead)==null?void 0:u.identifier)||"main");if(!((f==null?void 0:f.liveResources)||[]).find(x=>x.resourceId===R))throw new Error(`${T}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const A=n.find(x=>{var $,U;return((U=($=x.valueOwner)==null?void 0:$.declaration)==null?void 0:U.id)===G.operation[Ye.CheckFileExists].inputs.key.id}),O=(e=A==null?void 0:A.value)==null?void 0:e.value;if(!O||O==="")throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"key")}\`) input is missing.`);if(typeof O!="string")throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const P=await Ht.get(`${f.env.API_BASE_URL}/cloud-files-service/v1/files/exists?bucket=${R}&key=${encodeURIComponent(O)}`,{headers:{Authorization:`Bearer ${await f.getAccessToken()}`}});return{value:K.Success,error:null,result:P.data.exists}}catch(f){return{value:K.UnhandledError,error:f,result:!1}}}})}}class J1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_GET_PRESIGNED_URL,version:"1.0.0",description:"Cloud File System: Get Pre-signed URL",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic);if(!n)return;const s=n.get(Ye.GetPresignedUrl);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"getPresignedUrl"),b="["+Ve(t,t.project,"Get pre-signed URL")+": `"+T+"`] ",R=n.find(W=>{var ee,te;return((te=(ee=W.valueOwner)==null?void 0:ee.declaration)==null?void 0:te.id)===G.operation[Ye.GetPresignedUrl].inputs.bucket.id}),I=(s=R==null?void 0:R.value)==null?void 0:s.valueAsType;if(!I||!I.id||!I.name||I.type!==r.DefinitionEntity)throw new Error(`${b}Invalid input "${Ve(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"Storage")}" (\`${Be(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const A=ul(I==null?void 0:I.id,((u=m.branchHead)==null?void 0:u.identifier)||"main");if(!((m==null?void 0:m.liveResources)||[]).find(W=>W.resourceId===A))throw new Error(`${b}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const P=n.find(W=>{var ee,te;return((te=(ee=W.valueOwner)==null?void 0:ee.declaration)==null?void 0:te.id)===G.operation[Ye.GetPresignedUrl].inputs.key.id}),x=(e=P==null?void 0:P.value)==null?void 0:e.value;if(!x||x==="")throw new Error(`${b}The "${Ve(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"key")}\`) input is missing.`);if(typeof x!="string")throw new Error(`${b}The "${Ve(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const $=n.find(W=>{var ee,te;return((te=(ee=W.valueOwner)==null?void 0:ee.declaration)==null?void 0:te.id)===G.operation[Ye.GetPresignedUrl].inputs.action.id}),U=(f=$==null?void 0:$.value)==null?void 0:f.value,Z=(U||"read").toLowerCase(),q=["read","write","delete","metadata","upload","putobject","head","headobject","getobject","get"];if(!U||U==="")throw new Error(`${b}The "${Ve($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"Action")}" (\`${Be($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"action")}\`) input is missing.`);if(!q.includes(Z))throw new Error(`${b}Invalid "${Ve($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"Action")}" (\`${Be($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"action")}\`) input value, must be one of "read", "write", "delete" or "metadata".`);const H=n.find(W=>{var ee,te;return((te=(ee=W.valueOwner)==null?void 0:ee.declaration)==null?void 0:te.id)===G.operation[Ye.GetPresignedUrl].inputs.expiresInSeconds.id}),Y=(y=H==null?void 0:H.value)==null?void 0:y.value,ie=Y!=null?Number(Y):3600;if(isNaN(ie)||ie<=0)throw new Error(`${b}Invalid "${Ve(H==null?void 0:H.valueOwner,m==null?void 0:m.logic,"Expires in seconds")}" (\`${Be(H==null?void 0:H.valueOwner,m==null?void 0:m.logic,"expiresInSeconds")}\`) input value, expected a positive number.`);const z=await Ht.get(`${m.env.API_BASE_URL}/cloud-files-service/v1/files/presigned-url?bucket=${A}&key=${encodeURIComponent(x)}&action=${Z}&expiresInSeconds=${ie}`,{headers:{Authorization:`Bearer ${await m.getAccessToken()}`}});return{value:K.Success,error:null,result:z.data}}catch(m){return{value:K.UnhandledError,error:m,result:null}}}})}}class Q1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_SET_FILE_ACCESS,version:"1.0.0",description:"Cloud File System: Set File Access",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic);if(!n)return;const s=n.get(Ye.SetFileAccess);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f;try{const y=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!y||!y.env)throw new Error("Editor context or environment missing");const m=Be(t,t.project,"setFileAccess"),g="["+Ve(t,t.project,"Set file access")+": `"+m+"`] ",b=n.find(U=>{var Z,q;return((q=(Z=U.valueOwner)==null?void 0:Z.declaration)==null?void 0:q.id)===G.operation[Ye.SetFileAccess].inputs.bucket.id}),R=(s=b==null?void 0:b.value)==null?void 0:s.valueAsType;if(!R||!R.id||!R.name||R.type!==r.DefinitionEntity)throw new Error(`${g}Invalid input "${Ve(b==null?void 0:b.valueOwner,y==null?void 0:y.logic,"Storage")}" (\`${Be(b==null?void 0:b.valueOwner,y==null?void 0:y.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const I=ul(R==null?void 0:R.id,((u=y.branchHead)==null?void 0:u.identifier)||"main");if(!((y==null?void 0:y.liveResources)||[]).find(U=>U.resourceId===I))throw new Error(`${g}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const O=n.find(U=>{var Z,q;return((q=(Z=U.valueOwner)==null?void 0:Z.declaration)==null?void 0:q.id)===G.operation[Ye.SetFileAccess].inputs.key.id}),P=(e=O==null?void 0:O.value)==null?void 0:e.value;if(!P||P==="")throw new Error(`${g}The "${Ve(O==null?void 0:O.valueOwner,y==null?void 0:y.logic,"Key")}" (\`${Be(O==null?void 0:O.valueOwner,y==null?void 0:y.logic,"key")}\`) input is missing.`);if(typeof P!="string")throw new Error(`${g}The "${Ve(O==null?void 0:O.valueOwner,y==null?void 0:y.logic,"Key")}" (\`${Be(O==null?void 0:O.valueOwner,y==null?void 0:y.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const x=n.find(U=>{var Z,q;return((q=(Z=U.valueOwner)==null?void 0:Z.declaration)==null?void 0:q.id)===G.operation[Ye.SetFileAccess].inputs.access.id}),$=((f=x==null?void 0:x.value)==null?void 0:f.value)??"private";if(!$||$==="")throw new Error(`${g}The "${Ve(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"Access")}" (\`${Be(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"access")}\`) input is missing.`);if(typeof $!="string"||!["public","private"].includes($))throw new Error(`${g}The "${Ve(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"Access")}" (\`${Be(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"access")}\`) input value is invalid, if present, it must be exactly the "public" or "private" text values.`);return await Ht.post(`${y.env.API_BASE_URL}/cloud-files-service/v1/files/access`,{bucket:I,key:P,access:$},{headers:{Authorization:`Bearer ${await y.getAccessToken()}`}}),{value:K.Success,error:null,result:null}}catch(y){return{value:K.UnhandledError,error:y,result:null}}}})}}class X1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_CREATE_FOLDER,version:"1.0.0",description:"Cloud File System: Create Folder",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic);if(!n)return;const s=n.get(Ye.CreateFolder);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e;try{const f=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!f||!f.env)throw new Error("Editor context or environment missing");const y=Be(t,t.project,"createFolder"),T="["+Ve(t,t.project,"Create folder")+": `"+y+"`] ",g=n.find($=>{var U,Z;return((Z=(U=$.valueOwner)==null?void 0:U.declaration)==null?void 0:Z.id)===G.operation[Ye.CreateFolder].inputs.bucket.id}),b=(s=g==null?void 0:g.value)==null?void 0:s.valueAsType;if(!b||!b.id||!b.name||b.type!==r.DefinitionEntity)throw new Error(`${T}Invalid input "${Ve(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"Storage")}" (\`${Be(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const R=ul(b==null?void 0:b.id,((u=f.branchHead)==null?void 0:u.identifier)||"main");if(!((f==null?void 0:f.liveResources)||[]).find($=>$.resourceId===R))throw new Error(`${T}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const A=n.find($=>{var U,Z;return((Z=(U=$.valueOwner)==null?void 0:U.declaration)==null?void 0:Z.id)===G.operation[Ye.CreateFolder].inputs.folderPath.id}),O=(e=A==null?void 0:A.value)==null?void 0:e.value;if(!O||O==="")throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Folder path")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"folderPath")}\`) input is missing.`);if(typeof O!="string")throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Folder path")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"folderPath")}\`) input value is invalid, if present, it must be a non-empty string.`);const x=(await Ht.post(`${f.env.API_BASE_URL}/cloud-files-service/v1/files/folders`,{bucket:R,folderPath:O},{headers:{Authorization:`Bearer ${await f.getAccessToken()}`}})).data;return{value:K.Success,error:null,result:null}}catch(f){return{value:K.UnhandledError,error:f,result:null}}}})}}class eDt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_DELETE_FOLDERS,version:"1.0.0",description:"Cloud File System: Delete Folders",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic);if(!n)return;const s=n.get(Ye.DeleteFolders);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e;try{const f=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!f||!f.env)throw new Error("Editor context or environment missing");const y=Be(t,t.project,"deleteFolders"),T="["+Ve(t,t.project,"Delete folders")+": `"+y+"`] ",g=n.find(U=>{var Z,q;return((q=(Z=U.valueOwner)==null?void 0:Z.declaration)==null?void 0:q.id)===G.operation[Ye.DeleteFolders].inputs.bucket.id}),b=(s=g==null?void 0:g.value)==null?void 0:s.valueAsType;if(!b||!b.id||!b.name||b.type!==r.DefinitionEntity)throw new Error(`${T}Invalid input "${Ve(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"Storage")}" (\`${Be(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const R=ul(b==null?void 0:b.id,((u=f.branchHead)==null?void 0:u.identifier)||"main");if(!((f==null?void 0:f.liveResources)||[]).find(U=>U.resourceId===R))throw new Error(`${T}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const A=n.find(U=>{var Z,q;return((q=(Z=U.valueOwner)==null?void 0:Z.declaration)==null?void 0:q.id)===G.operation[Ye.DeleteFolders].inputs.folderPaths.id}),O=(e=A==null?void 0:A.value)==null?void 0:e.value,P=Array.isArray(O)?O:typeof O=="string"&&O!==""?[O]:[];if(!P||P.length===0)throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Folder paths")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"folderPaths")}\`) input is missing.`);if(!Array.isArray(P)||P.some(U=>typeof U!="string"||U===""))throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Folder paths")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"folderPaths")}\`) input value is invalid, if present, it must be a list of non-empty strings.`);const $=(await Ht.delete(`${f.env.API_BASE_URL}/cloud-files-service/v1/files/folders`,{headers:{Authorization:`Bearer ${await f.getAccessToken()}`},data:{bucket:R,folderPaths:P}})).data;return{value:K.Success,error:null,result:null}}catch(f){return{value:K.UnhandledError,error:f,result:null}}}})}}class tDt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_CREATE_MULTIPART_UPLOAD,version:"1.0.0",description:"Cloud File System: Create Multipart Upload",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic);if(!n)return;const s=n.get(Ye.CreateMultipartUpload);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"createMultipartUpload"),b="["+Ve(t,t.project,"Create multipart upload")+": `"+T+"`] ",R=n.find(Z=>{var q,H;return((H=(q=Z.valueOwner)==null?void 0:q.declaration)==null?void 0:H.id)===G.operation[Ye.CreateMultipartUpload].inputs.bucket.id}),I=(s=R==null?void 0:R.value)==null?void 0:s.valueAsType;if(!I||!I.id||!I.name||I.type!==r.DefinitionEntity)throw new Error(`${b}Invalid input "${Ve(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"Storage")}" (\`${Be(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const A=ul(I==null?void 0:I.id,((u=m.branchHead)==null?void 0:u.identifier)||"main"),O=n.find(Z=>{var q,H;return((H=(q=Z.valueOwner)==null?void 0:q.declaration)==null?void 0:H.id)===G.operation[Ye.CreateMultipartUpload].inputs.key.id}),P=(e=O==null?void 0:O.value)==null?void 0:e.value;if(!P||P==="")throw new Error(`${b}The "${Ve(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"key")}\`) input is missing.`);if(typeof P!="string")throw new Error(`${b}The "${Ve(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const x=n.find(Z=>{var q,H;return((H=(q=Z.valueOwner)==null?void 0:q.declaration)==null?void 0:H.id)===G.operation[Ye.CreateMultipartUpload].inputs.contentType.id}),$=((f=x==null?void 0:x.value)==null?void 0:f.value)||"application/octet-stream";if(!$||$==="")throw new Error(`${b}The "${Ve(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"Content Type")}" (\`${Be(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"contentType")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${b}The "${Ve(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"Content Type")}" (\`${Be(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"contentType")}\`) input value is invalid, if present, it must be a non-empty string.`);const U=await Ht.post(`${m.env.API_BASE_URL}/cloud-files-service/v1/files/multipart?bucket=${A}&key=${encodeURIComponent(P)}&contentType=${encodeURIComponent($)}`,{},{headers:{Authorization:`Bearer ${await m.getAccessToken()}`}});return{value:K.Success,error:null,result:{uploadId:typeof U.data=="object"&&((y=U.data)!=null&&y.uploadId)?U.data.uploadId:U.data}}}catch(m){return{value:K.UnhandledError,error:m,result:null}}}})}}class iDt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_GET_UPLOAD_PART_PRESIGNED_URL,version:"1.0.0",description:"Cloud File System: Get Upload Part Pre-signed URL",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic);if(!n)return;const s=n.get(Ye.GetUploadPartPresignedUrl);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"getUploadPartPresignedUrl"),b="["+Ve(t,t.project,"Get upload part pre-signed URL")+": `"+T+"`] ",R=n.find(H=>{var Y,ie;return((ie=(Y=H.valueOwner)==null?void 0:Y.declaration)==null?void 0:ie.id)===G.operation[Ye.GetUploadPartPresignedUrl].inputs.bucket.id}),I=(s=R==null?void 0:R.value)==null?void 0:s.valueAsType;if(!I||!I.id||!I.name||I.type!==r.DefinitionEntity)throw new Error(`${b}${b}Invalid input "${Ve(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"Storage")}" (\`${Be(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const A=ul(I==null?void 0:I.id,((u=m.branchHead)==null?void 0:u.identifier)||"main"),O=n.find(H=>{var Y,ie;return((ie=(Y=H.valueOwner)==null?void 0:Y.declaration)==null?void 0:ie.id)===G.operation[Ye.GetUploadPartPresignedUrl].inputs.key.id}),P=(e=O==null?void 0:O.value)==null?void 0:e.value;if(!P||P==="")throw new Error(`${b}The "${Ve(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"key")}\`) input is missing.`);if(typeof P!="string")throw new Error(`${b}The "${Ve(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const x=n.find(H=>{var Y,ie;return((ie=(Y=H.valueOwner)==null?void 0:Y.declaration)==null?void 0:ie.id)===G.operation[Ye.GetUploadPartPresignedUrl].inputs.uploadId.id}),$=(f=x==null?void 0:x.value)==null?void 0:f.value;if(!$||$==="")throw new Error(`${b}The "${Ve(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"Upload ID")}" (\`${Be(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"uploadId")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${b}The "${Ve(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"Upload ID")}" (\`${Be(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"uploadId")}\`) input value is invalid, if present, it must be a non-empty string.`);const U=n.find(H=>{var Y,ie;return((ie=(Y=H.valueOwner)==null?void 0:Y.declaration)==null?void 0:ie.id)===G.operation[Ye.GetUploadPartPresignedUrl].inputs.partNumber.id}),Z=Number((y=U==null?void 0:U.value)==null?void 0:y.value);if(isNaN(Z)||Z<=0)throw new Error(`${b}The "${Ve(U==null?void 0:U.valueOwner,m==null?void 0:m.logic,"Part number")}" (\`${Be(U==null?void 0:U.valueOwner,m==null?void 0:m.logic,"partNumber")}\`) input is missing or invalid.`);const q=await Ht.get(`${m.env.API_BASE_URL}/cloud-files-service/v1/files/multipart/${$}?bucket=${A}&key=${encodeURIComponent(P)}&partNumber=${Z}`,{headers:{Authorization:`Bearer ${await m.getAccessToken()}`}});return{value:K.Success,error:null,result:q.data}}catch(m){return{value:K.UnhandledError,error:m,result:null}}}})}}class nDt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_COMPLETE_MULTIPART_UPLOAD,version:"1.0.0",description:"Cloud File System: Complete Multipart Upload",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic);if(!n)return;const s=n.get(Ye.CompleteMultipartUpload);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"completeMultipartUpload"),b="["+Ve(t,t.project,"Complete multipart upload")+": `"+T+"`] ",R=n.find(Y=>{var ie,z;return((z=(ie=Y.valueOwner)==null?void 0:ie.declaration)==null?void 0:z.id)===G.operation[Ye.CompleteMultipartUpload].inputs.bucket.id}),I=(s=R==null?void 0:R.value)==null?void 0:s.valueAsType;if(!I||!I.id||!I.name||I.type!==r.DefinitionEntity)throw new Error(`${b}Invalid input "${Ve(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"Storage")}" (\`${Be(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const A=ul(I==null?void 0:I.id,((u=m.branchHead)==null?void 0:u.identifier)||"main"),O=n.find(Y=>{var ie,z;return((z=(ie=Y.valueOwner)==null?void 0:ie.declaration)==null?void 0:z.id)===G.operation[Ye.CompleteMultipartUpload].inputs.key.id}),P=(e=O==null?void 0:O.value)==null?void 0:e.value;if(!P||P==="")throw new Error(`${b}The "${Ve(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"key")}\`) input is missing.`);if(typeof P!="string")throw new Error(`${b}The "${Ve(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const x=n.find(Y=>{var ie,z;return((z=(ie=Y.valueOwner)==null?void 0:ie.declaration)==null?void 0:z.id)===G.operation[Ye.CompleteMultipartUpload].inputs.uploadId.id}),$=(f=x==null?void 0:x.value)==null?void 0:f.value;if(!$||$==="")throw new Error(`${b}The "${Ve(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"Upload ID")}" (\`${Be(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"uploadId")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${b}The "${Ve(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"Upload ID")}" (\`${Be(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"uploadId")}\`) input value is invalid, if present, it must be a non-empty string.`);const U=n.find(Y=>{var ie,z;return((z=(ie=Y.valueOwner)==null?void 0:ie.declaration)==null?void 0:z.id)===G.operation[Ye.CompleteMultipartUpload].inputs.parts.id}),Z=(y=U==null?void 0:U.value)==null?void 0:y.value;if(!Array.isArray(Z)||Z.length===0)throw new Error(`${b}The "${Ve(U==null?void 0:U.valueOwner,m==null?void 0:m.logic,"Parts")}" (\`${Be(U==null?void 0:U.valueOwner,m==null?void 0:m.logic,"parts")}\`) input is missing or empty.`);if(Z.some(Y=>{let ie=!1,z=!1;return(Y.partNumber&&Number(Y.partNumber)>0||Y.PartNumber&&Number(Y.PartNumber)>0)&&(ie=!0),(Y.etag&&typeof Y.etag=="string"||Y.ETag&&typeof Y.ETag=="string")&&(z=!0),!ie||!z}))throw new Error(`${b}The "${Ve(U==null?void 0:U.valueOwner,m==null?void 0:m.logic,"Parts")}" (\`${Be(U==null?void 0:U.valueOwner,m==null?void 0:m.logic,"parts")}\`) input value is invalid, if present, it must be an array of objects with "partNumber" and "etag" properties.`);const H=(await Ht.post(`${m.env.API_BASE_URL}/cloud-files-service/v1/files/multipart/${$}/complete?bucket=${A}&key=${encodeURIComponent(P)}`,{parts:Z},{headers:{Authorization:`Bearer ${await m.getAccessToken()}`}})).data||{};return{value:K.Success,error:null,result:{location:H.location||H.Location||P,key:H.key||H.Key||P,etag:H.etag||H.ETag||null}}}catch(m){return{value:K.UnhandledError,error:m,result:null}}}})}}class rDt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_ABORT_MULTIPART_UPLOAD,version:"1.0.0",description:"Cloud File System: Abort Multipart Upload",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic);if(!n)return;const s=n.get(Ye.AbortMultipartUpload);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f;try{const y=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!y||!y.env)throw new Error("Editor context or environment missing");const m=Be(t,t.project,"abortMultipartUpload"),g="["+Ve(t,t.project,"Abort multipart upload")+": `"+m+"`] ",b=n.find(Z=>{var q,H;return((H=(q=Z.valueOwner)==null?void 0:q.declaration)==null?void 0:H.id)===G.operation[Ye.AbortMultipartUpload].inputs.bucket.id}),R=(s=b==null?void 0:b.value)==null?void 0:s.valueAsType;if(!R||!R.id||!R.name||R.type!==r.DefinitionEntity)throw new Error(`${g}Invalid input "${Ve(b==null?void 0:b.valueOwner,y==null?void 0:y.logic,"Storage")}" (\`${Be(b==null?void 0:b.valueOwner,y==null?void 0:y.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const I=ul(R==null?void 0:R.id,((u=y.branchHead)==null?void 0:u.identifier)||"main"),A=n.find(Z=>{var q,H;return((H=(q=Z.valueOwner)==null?void 0:q.declaration)==null?void 0:H.id)===G.operation[Ye.AbortMultipartUpload].inputs.key.id}),O=(e=A==null?void 0:A.value)==null?void 0:e.value;if(!O||O==="")throw new Error(`${g}The "${Ve(A==null?void 0:A.valueOwner,y==null?void 0:y.logic,"Key")}" (\`${Be(A==null?void 0:A.valueOwner,y==null?void 0:y.logic,"key")}\`) input is missing.`);if(typeof O!="string")throw new Error(`${g}The "${Ve(A==null?void 0:A.valueOwner,y==null?void 0:y.logic,"Key")}" (\`${Be(A==null?void 0:A.valueOwner,y==null?void 0:y.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const P=n.find(Z=>{var q,H;return((H=(q=Z.valueOwner)==null?void 0:q.declaration)==null?void 0:H.id)===G.operation[Ye.AbortMultipartUpload].inputs.uploadId.id}),x=(f=P==null?void 0:P.value)==null?void 0:f.value;if(!x||x==="")throw new Error(`${g}The "${Ve(P==null?void 0:P.valueOwner,y==null?void 0:y.logic,"Upload ID")}" (\`${Be(P==null?void 0:P.valueOwner,y==null?void 0:y.logic,"uploadId")}\`) input is missing.`);if(typeof x!="string")throw new Error(`${g}The "${Ve(P==null?void 0:P.valueOwner,y==null?void 0:y.logic,"Upload ID")}" (\`${Be(P==null?void 0:P.valueOwner,y==null?void 0:y.logic,"uploadId")}\`) input value is invalid, if present, it must be a non-empty string.`);const U=(await Ht.delete(`${y.env.API_BASE_URL}/cloud-files-service/v1/files/multipart/${x}?bucket=${I}&key=${encodeURIComponent(O)}`,{headers:{Authorization:`Bearer ${await y.getAccessToken()}`}})).data;return{value:K.Success,error:null,result:null}}catch(y){return{value:K.UnhandledError,error:y,result:null}}}})}}class MRn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_UPLOAD_FILE_PART,version:"1.0.0",description:"Cloud File System: Upload File Part",initPriority:_e.High,permissions:[$e.All],contexts:[Q.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===Q.Logic);if(!n)return;const s=n.get(Ye.UploadFilePart);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b;try{const R=this.extensionsRegistry.requestContexts(this,[Q.Editor])[0];if(!R||!R.env)throw new Error("Editor context or environment missing");const I=Be(t,t.project,"uploadFilePart"),O="["+Ve(t,t.project,"Upload file part")+": `"+I+"`] ",P=n.find(oe=>{var ce,be;return((be=(ce=oe.valueOwner)==null?void 0:ce.declaration)==null?void 0:be.id)===G.operation[Ye.UploadFilePart].inputs.bucket.id}),x=(s=P==null?void 0:P.value)==null?void 0:s.valueAsType;if(!x||!x.id||!x.name||x.type!==r.DefinitionEntity)throw new Error(`${O}Invalid input "${Ve(P==null?void 0:P.valueOwner,R==null?void 0:R.logic,"Storage")}" (\`${Be(P==null?void 0:P.valueOwner,R==null?void 0:R.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const $=ul(x==null?void 0:x.id,((u=R.branchHead)==null?void 0:u.identifier)||"main");if(!((R==null?void 0:R.liveResources)||[]).find(oe=>oe.resourceId===$))throw new Error(`${O}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const Z=n.find(oe=>{var ce,be;return((be=(ce=oe.valueOwner)==null?void 0:ce.declaration)==null?void 0:be.id)===G.operation[Ye.UploadFilePart].inputs.key.id}),q=(e=Z==null?void 0:Z.value)==null?void 0:e.value;if(!q||q==="")throw new Error(`${O}The "${Ve(Z==null?void 0:Z.valueOwner,R==null?void 0:R.logic,"Key")}" (\`${Be(Z==null?void 0:Z.valueOwner,R==null?void 0:R.logic,"key")}\`) input is missing.`);if(typeof q!="string")throw new Error(`${O}The "${Ve(Z==null?void 0:Z.valueOwner,R==null?void 0:R.logic,"Key")}" (\`${Be(Z==null?void 0:Z.valueOwner,R==null?void 0:R.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const H=n.find(oe=>{var ce,be;return((be=(ce=oe.valueOwner)==null?void 0:ce.declaration)==null?void 0:be.id)===G.operation[Ye.UploadFilePart].inputs.uploadId.id}),Y=(f=H==null?void 0:H.value)==null?void 0:f.value;if(!Y||Y==="")throw new Error(`${O}The "${Ve(H==null?void 0:H.valueOwner,R==null?void 0:R.logic,"Upload ID")}" (\`${Be(H==null?void 0:H.valueOwner,R==null?void 0:R.logic,"uploadId")}\`) input is missing.`);if(typeof Y!="string")throw new Error(`${O}The "${Ve(H==null?void 0:H.valueOwner,R==null?void 0:R.logic,"Upload ID")}" (\`${Be(H==null?void 0:H.valueOwner,R==null?void 0:R.logic,"uploadId")}\`) input value is invalid, if present, it must be a non-empty string.`);const ie=n.find(oe=>{var ce,be;return((be=(ce=oe.valueOwner)==null?void 0:ce.declaration)==null?void 0:be.id)===G.operation[Ye.UploadFilePart].inputs.partNumber.id}),z=Number((y=ie==null?void 0:ie.value)==null?void 0:y.value);if(((m=ie==null?void 0:ie.value)==null?void 0:m.value)===void 0||((T=ie==null?void 0:ie.value)==null?void 0:T.value)===null||isNaN(z)||z<=0)throw new Error(`${O}The "${Ve(ie==null?void 0:ie.valueOwner,R==null?void 0:R.logic,"Part number")}" (\`${Be(ie==null?void 0:ie.valueOwner,R==null?void 0:R.logic,"partNumber")}\`) input is missing or invalid.`);const W=n.find(oe=>{var ce,be;return((be=(ce=oe.valueOwner)==null?void 0:ce.declaration)==null?void 0:be.id)===G.operation[Ye.UploadFilePart].inputs.bytes.id}),ee=(g=W==null?void 0:W.value)==null?void 0:g.value;if(ee==null)throw new Error(`${O}The "${Ve(W==null?void 0:W.valueOwner,R==null?void 0:R.logic,"Bytes")}" (\`${Be(W==null?void 0:W.valueOwner,R==null?void 0:R.logic,"bytes")}\`) input is missing.`);const X=(b=(await Ht.get(`${R.env.API_BASE_URL}/cloud-files-service/v1/files/multipart/${Y}?bucket=${$}&key=${encodeURIComponent(q)}&partNumber=${z}`,{headers:{Authorization:`Bearer ${await R.getAccessToken()}`}})).data)==null?void 0:b.uploadUrl;if(!X)throw new Error(`${O}Failed to obtain presigned upload URL for part ${z}.`);const re=await Ht.put(X,ee,{headers:{"Content-Type":"application/octet-stream"}}),ae=re.headers.etag||re.headers.ETag||"",le=typeof ae=="string"?ae.replace(/"/g,""):"";return{value:K.Success,error:null,result:{partNumber:z,etag:le}}}catch(R){return{value:K.UnhandledError,error:R,result:null}}}})}}class QL extends cV{constructor(p,t,n=t.projectId){super(p,Q.Editor),this._editor=t,this.id=n}get ready(){return this._editor.ready}get env(){return this._editor.env}get hasLoadedLogic(){return this._editor.hasLoadedLogic}get destroyed(){return this._editor.destroyed}get logicLoadingPromise(){return this._editor.logicLoadingPromise}get logic(){return this._editor.logic}get lastPublishedProjectState(){return this._editor.lastPublishedProjectState}get branchHead(){return this._editor.branchHead}get branchHeadPromise(){return this._editor.branchHeadPromise}get projectId(){return this._editor.projectId}get sessionId(){return this._editor.sessionId}get userAuthorId(){return this._editor.userAuthorId}get peerConnections(){return this._editor.peerConnections}get test(){return this._editor.test}get localTestValues(){return this._editor.localTestValues}get resolvedValues(){return this._editor.resolvedValues}get persistedExecutionResults(){return this._editor.persistedExecutionResults}get publication(){return this._editor.publication}get livePublishedVersions(){return this._editor.livePublishedVersions}get publications(){return this._editor.publications}get liveResources(){return this._editor.liveResources}get execution(){return this._editor.execution}get project(){return this._editor.logic}get lastExecutionResults(){return this._editor.lastExecutionResults}get undoableStackValueIndex(){return this._editor.undoableStackValueIndex}set undoableStackValueIndex(p){this._editor.undoableStackValueIndex=p}get activeWorkspace(){return this._editor.activeWorkspace}get branches(){return this._editor.branches}get roles(){return this._editor.roles}get READ_ONLY(){return this._editor.READ_ONLY}get isViewingNonHead(){return this._editor.isViewingNonHead}get canEdit(){return this._editor.canEdit}get PROJECT_NOTIFICATIONS_CHANNEL(){return this._editor.PROJECT_NOTIFICATIONS_CHANNEL}getAccessToken(){return this._editor.getAccessToken()}getRefreshToken(){return this._editor.getRefreshToken()}removeValueByOwnerId(p){return this._editor.removeValueByOwnerId(p)}removeValue(p){return this._editor.removeValue(p)}undo(){return this._editor.undo()}redo(){return this._editor.redo()}initTest(p,t){return this._editor.initTest(p,t)}removeTest(p){return this._editor.removeTest(p)}async copyEntities(p,t={}){return this._editor.copyEntities(p,t)}resolveInitialChildrenPositions(p,t,n){return this._editor.resolveInitialChildrenPositions(p,t,n)}publish(){return this._editor.publish()}loadGivenPublication(p){return this._editor.loadGivenPublication(p)}validateProjectState(p){return this._editor.validateProjectState(p)}requestActiveDynamicValue(p,t=!1){return this._editor.requestActiveDynamicValue(p,t)}getValueTypePreference(p){return this._editor.getValueTypePreference(p)}setValueTypePreference(p,t){return this._editor.setValueTypePreference(p,t)}implementFeature(p){return this._editor.implementFeature(p)}getProjectRoles(){return this._editor.getProjectRoles()}getLastPublishedVersionLogic(p){return this._editor.getLastPublishedVersionLogic(p)}initialLoads(p){return this._editor.initialLoads(p)}moveBranchHeadToVersion(p,t,n){return this._editor.moveBranchHeadToVersion(p,t,n)}loadInitialBranchHead(){return this._editor.loadInitialBranchHead()}}function FRn(a,p){return p instanceof QL?p:new QL(a,p)}class XL extends cV{constructor(p,t){super(p,Q.PublicationRun),this._publicationRun=t}get id(){return this._publicationRun.id}get projectAutoIncrementPublicationCount(){return this._publicationRun.projectAutoIncrementPublicationCount}get projectPublishedSemanticVersion(){return this._publicationRun.projectPublishedSemanticVersion}get envIdentifier(){return this._publicationRun.envIdentifier}get projectVersion(){return this._publicationRun.projectVersion}get projectBranchId(){return this._publicationRun.projectBranchId}get projectId(){return this._publicationRun.projectId}get triggeredBy(){return this._publicationRun.triggeredBy}get createdAt(){return this._publicationRun.createdAt}get updatedAt(){return this._publicationRun.updatedAt}get status(){return this._publicationRun.status}get steps(){return this._publicationRun.steps}get cleanupSteps(){return this._publicationRun.cleanupSteps}get editor(){return this._publicationRun.editor}get explicitResources(){return this._publicationRun.explicitResources}get implicitGlobalResources(){return this._publicationRun.implicitGlobalResources}get finalGlobalEvent(){return this._publicationRun.finalGlobalEvent}get finalStatus(){return this._publicationRun.finalStatus}}function kRn(a,p){return p instanceof XL?p:new XL(a,p)}const zG={spec:{title:"Sales Overview",basicChart:{chartType:"COLUMN",legendPosition:"BOTTOM_LEGEND",axis:[{position:"BOTTOM_AXIS",title:"Categories"},{position:"LEFT_AXIS",title:"Values"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"LEFT_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}},URn={spec:{title:"Revenue Comparison",basicChart:{chartType:"BAR",legendPosition:"BOTTOM_LEGEND",axis:[{position:"LEFT_AXIS",title:"Products"},{position:"BOTTOM_AXIS",title:"Revenue ($)"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"BOTTOM_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}},KRn={spec:{title:"Monthly Performance Trend",basicChart:{chartType:"LINE",legendPosition:"RIGHT_LEGEND",interpolateNulls:!0,axis:[{position:"BOTTOM_AXIS",title:"Month"},{position:"LEFT_AXIS",title:"Active Users"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:12,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:12,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"LEFT_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}},jRn={spec:{title:"Traffic Channels Distribution",basicChart:{chartType:"AREA",legendPosition:"TOP_LEGEND",stackedType:"STACKED",axis:[{position:"BOTTOM_AXIS",title:"Quarter"},{position:"LEFT_AXIS",title:"Visits"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:4,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:4,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"LEFT_AXIS"},{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:4,startColumnIndex:2,endColumnIndex:3}]}},targetAxis:"LEFT_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}},qRn={spec:{title:"Market Share Breakdown",pieChart:{legendPosition:"RIGHT_LEGEND",threeDimensional:!1,pieHole:0,domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:0,endColumnIndex:1}]}},series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:1,endColumnIndex:2}]}}}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:500,heightPixels:350}}},ZRn={spec:{title:"Budget Allocation",pieChart:{legendPosition:"BOTTOM_LEGEND",threeDimensional:!1,pieHole:.4,domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:6,startColumnIndex:0,endColumnIndex:1}]}},series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:6,startColumnIndex:1,endColumnIndex:2}]}}}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:500,heightPixels:350}}},HRn={spec:{title:"Quarterly Revenue KPI",scorecardChart:{keyValueData:{sourceRange:{sources:[{sheetId:0,startRowIndex:1,endRowIndex:2,startColumnIndex:1,endColumnIndex:2}]}},baselineValueData:{sourceRange:{sources:[{sheetId:0,startRowIndex:2,endRowIndex:3,startColumnIndex:1,endColumnIndex:2}]}}}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:400,heightPixels:250}}},WRn={spec:{title:"Regional Sales (3D)",basicChart:{chartType:"BAR",legendPosition:"RIGHT_LEGEND",headerCount:1,threeDimensional:!0,axis:[{position:"LEFT_AXIS",title:"Region"},{position:"BOTTOM_AXIS",title:"Units Sold"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"BOTTOM_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}};class zRn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][J.GoogleSheetsAddChart].inputs.chart.id,version:"1.0.0",description:'Gives options for and generates useful example values for the chart input of the "Add chart" Google Sheets operation',initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{getOptions:async t=>[{key:"column-chart",label:"Column Chart",disabledReasons:[],hidden:!1},{key:"bar-chart",label:"Bar Chart",disabledReasons:[],hidden:!1},{key:"line-chart",label:"Line Chart",disabledReasons:[],hidden:!1},{key:"area-chart",label:"Stacked Area Chart",disabledReasons:[],hidden:!1},{key:"pie-chart",label:"Pie Chart",disabledReasons:[],hidden:!1},{key:"donut-chart",label:"Donut Chart",disabledReasons:[],hidden:!1},{key:"scorecard-chart",label:"Scorecard KPI Chart",disabledReasons:[],hidden:!1},{key:"3d-bar-chart",label:"3D Bar Chart",disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{const s=n==null?void 0:n.valueKey;if(!s)return{value:zG};switch(s){case"column-chart":case"basic-chart":return{value:zG};case"bar-chart":return{value:URn};case"line-chart":return{value:KRn};case"area-chart":return{value:jRn};case"pie-chart":return{value:qRn};case"donut-chart":return{value:ZRn};case"scorecard-chart":return{value:HRn};case"3d-bar-chart":case"3d-column-chart":return{value:WRn}}return{value:zG}}})}}const YG={spec:{title:"Sales Overview",basicChart:{chartType:"COLUMN",legendPosition:"BOTTOM_LEGEND",axis:[{position:"BOTTOM_AXIS",title:"Categories"},{position:"LEFT_AXIS",title:"Values"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"LEFT_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}},YRn={spec:{title:"Revenue Comparison",basicChart:{chartType:"BAR",legendPosition:"BOTTOM_LEGEND",axis:[{position:"LEFT_AXIS",title:"Products"},{position:"BOTTOM_AXIS",title:"Revenue ($)"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"BOTTOM_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}},JRn={spec:{title:"Monthly Performance Trend",basicChart:{chartType:"LINE",legendPosition:"RIGHT_LEGEND",interpolateNulls:!0,axis:[{position:"BOTTOM_AXIS",title:"Month"},{position:"LEFT_AXIS",title:"Active Users"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:12,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:12,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"LEFT_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}},QRn={spec:{title:"Traffic Channels Distribution",basicChart:{chartType:"AREA",legendPosition:"TOP_LEGEND",stackedType:"STACKED",axis:[{position:"BOTTOM_AXIS",title:"Quarter"},{position:"LEFT_AXIS",title:"Visits"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:4,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:4,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"LEFT_AXIS"},{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:4,startColumnIndex:2,endColumnIndex:3}]}},targetAxis:"LEFT_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}},XRn={spec:{title:"Market Share Breakdown",pieChart:{legendPosition:"RIGHT_LEGEND",threeDimensional:!1,pieHole:0,domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:0,endColumnIndex:1}]}},series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:1,endColumnIndex:2}]}}}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:500,heightPixels:350}}},eAn={spec:{title:"Budget Allocation",pieChart:{legendPosition:"BOTTOM_LEGEND",threeDimensional:!1,pieHole:.4,domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:6,startColumnIndex:0,endColumnIndex:1}]}},series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:6,startColumnIndex:1,endColumnIndex:2}]}}}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:500,heightPixels:350}}},tAn={spec:{title:"Quarterly Revenue KPI",scorecardChart:{keyValueData:{sourceRange:{sources:[{sheetId:0,startRowIndex:1,endRowIndex:2,startColumnIndex:1,endColumnIndex:2}]}},baselineValueData:{sourceRange:{sources:[{sheetId:0,startRowIndex:2,endRowIndex:3,startColumnIndex:1,endColumnIndex:2}]}}}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:400,heightPixels:250}}},iAn={spec:{title:"Regional Sales (3D)",basicChart:{chartType:"BAR",legendPosition:"RIGHT_LEGEND",headerCount:1,threeDimensional:!0,axis:[{position:"LEFT_AXIS",title:"Region"},{position:"BOTTOM_AXIS",title:"Units Sold"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"BOTTOM_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}};class nAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][J.GoogleSheetsUpdateChartSpec].inputs.chart.id,version:"1.0.0",description:'Gives options for and generates useful example values for the chart input of the "Update chart spec" Google Sheets operation',initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{getOptions:async t=>[{key:"column-chart",label:"Column Chart",disabledReasons:[],hidden:!1},{key:"bar-chart",label:"Bar Chart",disabledReasons:[],hidden:!1},{key:"line-chart",label:"Line Chart",disabledReasons:[],hidden:!1},{key:"area-chart",label:"Stacked Area Chart",disabledReasons:[],hidden:!1},{key:"pie-chart",label:"Pie Chart",disabledReasons:[],hidden:!1},{key:"donut-chart",label:"Donut Chart",disabledReasons:[],hidden:!1},{key:"scorecard-chart",label:"Scorecard KPI Chart",disabledReasons:[],hidden:!1},{key:"3d-bar-chart",label:"3D Bar Chart",disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{const s=n==null?void 0:n.valueKey;if(!s)return{value:YG};switch(s){case"column-chart":case"basic-chart":return{value:YG};case"bar-chart":return{value:YRn};case"line-chart":return{value:JRn};case"area-chart":return{value:QRn};case"pie-chart":return{value:XRn};case"donut-chart":return{value:eAn};case"scorecard-chart":return{value:tAn};case"3d-bar-chart":case"3d-column-chart":return{value:iAn}}return{value:YG}}})}}const rAn="Sheet2!A1",aAn='"Copy of Blahhh"!A1';class sAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][J.GoogleSheetsCreatePivotTable].inputs.destination.id,version:"1.0.0",description:'Gives options for and generates useful example values for the destination input of the "Create pivot table" Google Sheets operation',initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{getOptions:async t=>[{key:"sheet2-a1",label:"Sheet2!A1",disabledReasons:[],hidden:!1},{key:"copy-of-blahhh-a1",label:'"Copy of Blahhh"!A1',disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{switch(n==null?void 0:n.valueKey){case"copy-of-blahhh-a1":return{value:aAn};case"sheet2-a1":default:return{value:rAn}}}})}}const lAn="Sheet1!A1:D100",oAn="Sheet1!A1:G500";class dAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][J.GoogleSheetsCreatePivotTable].inputs.source.id,version:"1.0.0",description:'Gives options for and generates useful example values for the source input of the "Create pivot table" Google Sheets operation',initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{getOptions:async t=>[{key:"sales-data",label:"Sales Data Range (Sheet1!A1:D100)",disabledReasons:[],hidden:!1},{key:"financial-data",label:"Financial Data Range (Sheet1!A1:G500)",disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{switch(n==null?void 0:n.valueKey){case"financial-data":return{value:oAn};case"sales-data":default:return{value:lAn}}}})}}const pAn=[{sourceColumnOffset:0,sortOrder:"ASCENDING",showTotals:!0}],uAn=[{sourceColumnOffset:0,sortOrder:"ASCENDING",showTotals:!0},{sourceColumnOffset:1,sortOrder:"ASCENDING",showTotals:!0}];class cAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][J.GoogleSheetsCreatePivotTable].inputs.rows.id,version:"1.0.0",description:'Gives options for and generates useful example values for the rows input of the "Create pivot table" Google Sheets operation',initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{getOptions:async t=>[{key:"single-row-group",label:"Group by First Column (Column 0)",disabledReasons:[],hidden:!1},{key:"multi-row-group",label:"Group by First & Second Columns (Columns 0 & 1)",disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{switch(n==null?void 0:n.valueKey){case"multi-row-group":return{value:uAn};case"single-row-group":default:return{value:pAn}}}})}}const fAn=[{sourceColumnOffset:1,sortOrder:"ASCENDING",showTotals:!0}],yAn=[{sourceColumnOffset:1,sortOrder:"ASCENDING",showTotals:!0},{sourceColumnOffset:2,sortOrder:"ASCENDING",showTotals:!0}];class hAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][J.GoogleSheetsCreatePivotTable].inputs.columns.id,version:"1.0.0",description:'Gives options for and generates useful example values for the columns input of the "Create pivot table" Google Sheets operation',initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{getOptions:async t=>[{key:"single-column-group",label:"Group by Second Column (Column 1)",disabledReasons:[],hidden:!1},{key:"multi-column-group",label:"Group by Second & Third Columns (Columns 1 & 2)",disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{switch(n==null?void 0:n.valueKey){case"multi-column-group":return{value:yAn};case"single-column-group":default:return{value:fAn}}}})}}const mAn=[{sourceColumnOffset:3,summarizeFunction:"SUM",name:"Total Revenue"}],TAn=[{sourceColumnOffset:2,summarizeFunction:"COUNTA",name:"Total Orders"},{sourceColumnOffset:3,summarizeFunction:"SUM",name:"Total Revenue"}],vAn=[{sourceColumnOffset:4,summarizeFunction:"AVERAGE",name:"Average Profit"}];class gAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][J.GoogleSheetsCreatePivotTable].inputs.values.id,version:"1.0.0",description:'Gives options for and generates useful example values for the values input of the "Create pivot table" Google Sheets operation',initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{getOptions:async t=>[{key:"sum-revenue",label:"SUM Revenue (Column 3)",disabledReasons:[],hidden:!1},{key:"sum-and-count",label:"COUNTA Orders (Col 2) & SUM Revenue (Col 3)",disabledReasons:[],hidden:!1},{key:"average-profit",label:"AVERAGE Profit (Column 4)",disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{switch(n==null?void 0:n.valueKey){case"sum-and-count":return{value:TAn};case"average-profit":return{value:vAn};case"sum-revenue":default:return{value:mAn}}}})}}const bAn="Sheet2!A1",EAn='"Copy of Blahhh"!A1';class IAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][J.GoogleSheetsDeletePivotTable].inputs.destination.id,version:"1.0.0",description:'Gives options for and generates useful example values for the destination input of the "Delete pivot table" Google Sheets operation',initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{getOptions:async t=>[{key:"sheet2-a1",label:"Sheet2!A1",disabledReasons:[],hidden:!1},{key:"copy-of-blahhh-a1",label:'"Copy of Blahhh"!A1',disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{switch(n==null?void 0:n.valueKey){case"copy-of-blahhh-a1":return{value:EAn};case"sheet2-a1":default:return{value:bAn}}}})}}const O5={"Number greater than":"NUMBER_GREATER","Number greater than or equal":"NUMBER_GREATER_THAN_EQ","Number less than":"NUMBER_LESS","Number less than or equal":"NUMBER_LESS_THAN_EQ","Number equal to":"NUMBER_EQ","Number not equal to":"NUMBER_NOT_EQ","Number between":"NUMBER_BETWEEN","Number not between":"NUMBER_NOT_BETWEEN","Text contains":"TEXT_CONTAINS","Text does not contain":"TEXT_NOT_CONTAINS","Text starts with":"TEXT_STARTS_WITH","Text ends with":"TEXT_ENDS_WITH","Text equals":"TEXT_EQ","Date is":"DATE_EQ","Date is before":"DATE_BEFORE","Date is after":"DATE_AFTER","Date is on or before":"DATE_ON_OR_BEFORE","Date is on or after":"DATE_ON_OR_AFTER","Cell is empty":"BLANK","Cell is not empty":"NOT_BLANK","Custom formula":"CUSTOM_FORMULA"};function aDt(a){if(!a||typeof a!="string")return null;const p=a.trim();return p?O5[p]?O5[p]:p.toUpperCase().replace(/\s+/g,"_"):null}function sDt(a,p,t,n){if(p==null)return;let s=[];if(Array.isArray(p))s=p;else if(typeof p=="string"){const e=p.trim();if(!e)return;if(e.startsWith("["))try{const f=JSON.parse(e);Array.isArray(f)?s=f:s=[e]}catch{s=[e]}else s=[e]}const u=aDt(a);if(u==="BLANK"||u==="NOT_BLANK"){s.length>0&&n.push(new ht({id:`${t.id}--${uo.ConditionValuesNoValuesRequired}`,message:`Condition "${a}" does not require any condition values.`,severity:Ie.Error,code:uo.ConditionValuesNoValuesRequired,entity:t}));return}if(u==="CUSTOM_FORMULA"){if(s.length===0)n.push(new ht({id:`${t.id}--${uo.ConditionValuesInvalidFormula}`,message:'Custom formula condition requires a formula string starting with "=" (e.g. ["=A1>100"]).',severity:Ie.Error,code:uo.ConditionValuesInvalidFormula,entity:t}));else for(const e of s){const f=String(e).trim();f.startsWith("=")||n.push(new ht({id:`${t.id}--${uo.ConditionValuesInvalidFormula}`,message:`Custom formula "${f}" must start with "=".`,severity:Ie.Error,code:uo.ConditionValuesInvalidFormula,entity:t}))}return}if(u==="NUMBER_BETWEEN"||u==="NUMBER_NOT_BETWEEN"){s.length!==2&&n.push(new ht({id:`${t.id}--${uo.ConditionValuesTwoNumbersRequired}`,message:`Condition "${a}" requires exactly 2 values (min and max, e.g. ["1", "100"]).`,severity:Ie.Error,code:uo.ConditionValuesTwoNumbersRequired,entity:t}));return}if(u==="NUMBER_GREATER"||u==="NUMBER_GREATER_THAN_EQ"||u==="NUMBER_LESS"||u==="NUMBER_LESS_THAN_EQ"||u==="NUMBER_EQ"||u==="NUMBER_NOT_EQ"){s.length!==1&&n.push(new ht({id:`${t.id}--${uo.ConditionValuesSingleNumberRequired}`,message:`Condition "${a}" requires exactly 1 threshold value (e.g. ["100"]).`,severity:Ie.Error,code:uo.ConditionValuesSingleNumberRequired,entity:t}));return}if(u==="TEXT_CONTAINS"||u==="TEXT_NOT_CONTAINS"||u==="TEXT_STARTS_WITH"||u==="TEXT_ENDS_WITH"||u==="TEXT_EQ"){s.length!==1&&n.push(new ht({id:`${t.id}--${uo.ConditionValuesSingleTextRequired}`,message:`Condition "${a}" requires exactly 1 text string value (e.g. ["Approved"]).`,severity:Ie.Error,code:uo.ConditionValuesSingleTextRequired,entity:t}));return}}const yw={num_100:["100"],num_0:["0"],num_1000:["1000"],between_1_100:["1","100"],between_0_50:["0","50"],between_50_100:["50","100"],text_approved:["Approved"],text_pending:["Pending"],text_rejected:["Rejected"],text_urgent:["Urgent"],date_2026_01_01:["2026-01-01"],date_today:["2026-08-08"],formula_above_avg:["=A1>AVERAGE($A$1:$A$100)"],formula_even:["=ISEVEN(A1)"],formula_duplicates:["=COUNTIF($A$1:$A$100, A1)>1"],default_100:["100"],default_approved:["Approved"],default_formula:["=A1>0"]};function M4(a){const p=aDt(a),t=(n,s)=>({key:n,label:s,disabledReasons:[],hidden:!1});return p==="NUMBER_GREATER"||p==="NUMBER_GREATER_THAN_EQ"||p==="NUMBER_LESS"||p==="NUMBER_LESS_THAN_EQ"||p==="NUMBER_EQ"||p==="NUMBER_NOT_EQ"?[t("num_100","100 (Single threshold)"),t("num_0","0 (Zero threshold)"),t("num_1000","1000 (High threshold)")]:p==="NUMBER_BETWEEN"||p==="NUMBER_NOT_BETWEEN"?[t("between_1_100","Between 1 and 100"),t("between_0_50","Between 0 and 50"),t("between_50_100","Between 50 and 100")]:p==="TEXT_CONTAINS"||p==="TEXT_NOT_CONTAINS"||p==="TEXT_STARTS_WITH"||p==="TEXT_ENDS_WITH"||p==="TEXT_EQ"?[t("text_approved","Approved"),t("text_pending","Pending"),t("text_rejected","Rejected"),t("text_urgent","Urgent")]:p==="DATE_EQ"||p==="DATE_BEFORE"||p==="DATE_AFTER"||p==="DATE_ON_OR_BEFORE"||p==="DATE_ON_OR_AFTER"?[t("date_2026_01_01","Start of 2026 (2026-01-01)"),t("date_today","Current Date (2026-08-08)")]:p==="CUSTOM_FORMULA"?[t("formula_above_avg","Greater than average (=A1>AVERAGE($A$1:$A$100))"),t("formula_even","Even numbers (=ISEVEN(A1))"),t("formula_duplicates","Highlight duplicates (=COUNTIF($A$1:$A$100, A1)>1)")]:p==="BLANK"||p==="NOT_BLANK"?[]:[t("default_100","100"),t("default_approved","Approved"),t("default_formula","Formula (=A1>0)")]}function lDt(a,p){const t=p==null?void 0:p.valueKey;if(t&&yw[t])return{value:yw[t]};const n=M4(a);if(n.length>0){const s=n[0].key;if(yw[s])return{value:yw[s]}}return{value:["100"]}}function x5(a){var u,e;const p=(u=G[r.Operation])==null?void 0:u[J.GoogleSheetsAddConditionalFormatRule];if(!p)return null;const t=a.parent;if(!t)return null;const s=(t.inputs||t.outputs||[]).find(f=>{var y;return((y=f.declaration)==null?void 0:y.id)===p.inputs.conditionType.id||f.id===p.inputs.conditionType.id});return((e=s==null?void 0:s.defaultValue)==null?void 0:e.value)??null}class RAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][J.GoogleSheetsAddConditionalFormatRule].inputs.conditionValues.id,version:"1.0.0",description:'Gives options for and generates useful example values for conditionValues input of "Add conditional format rule" Google Sheets operation',initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{getOptions:async t=>{const n=x5(t);return M4(n)},getValue:async(t,n)=>{const s=x5(t);return lDt(s,n)}})}}function P5(a){var u,e;const p=(u=G[r.Operation])==null?void 0:u[J.GoogleSheetsUpdateConditionalFormatRule];if(!p)return null;const t=a.parent;if(!t)return null;const s=(t.inputs||t.outputs||[]).find(f=>{var y;return((y=f.declaration)==null?void 0:y.id)===p.inputs.conditionType.id||f.id===p.inputs.conditionType.id});return((e=s==null?void 0:s.defaultValue)==null?void 0:e.value)??null}class AAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][J.GoogleSheetsUpdateConditionalFormatRule].inputs.conditionValues.id,version:"1.0.0",description:'Gives options for and generates useful example values for conditionValues input of "Update conditional format rule" Google Sheets operation',initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{getOptions:async t=>{const n=P5(t);return M4(n)},getValue:async(t,n)=>{const s=P5(t);return lDt(s,n)}})}}const RV=[["Name","Age","Is Active","Notes"],["Alice",30,!0,"New user"],["Bob",25,!1,null],["Charlie",null,!0,"No age provided"]],Mp="1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms",CE={sheetId:0,startRowIndex:0,endRowIndex:10,startColumnIndex:0,endColumnIndex:5},DAn=["Sheet1!A1:B10","Sheet2!C1:D5"],CAn=["Option 1","Option 2","Option 3"],wAn=[{updateSpreadsheetProperties:{properties:{title:"My Renamed Spreadsheet",locale:"en_US",timeZone:"America/New_York"},fields:"title,locale,timeZone"}},{addSheet:{properties:{title:"New Custom Sheet",gridProperties:{rowCount:100,columnCount:20}}}},{mergeCells:{range:{sheetId:0,startRowIndex:0,endRowIndex:2,startColumnIndex:0,endColumnIndex:4},mergeType:"MERGE_ALL"}},{repeatCell:{range:{sheetId:0,startRowIndex:0,endRowIndex:1,startColumnIndex:0,endColumnIndex:5},cell:{userEnteredFormat:{backgroundColor:{red:.2,green:.4,blue:.8},textFormat:{bold:!0,foregroundColor:{red:1,green:1,blue:1}}}},fields:"userEnteredFormat(backgroundColor,textFormat)"}},{findReplace:{find:"Old Value",replacement:"New Value",allSheets:!0,matchCase:!1}}],OAn=[["Date","Product","Revenue ($)","Units Sold"],["2026-01-15","Pro Subscription",299,1],["2026-01-16","Enterprise Add-On",1250.5,2]],xAn=[["Alice Smith","alice@example.com","Engineer","Active"]],PAn=[[null]];class VAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][J.GoogleSheetsAppendRows].inputs.values.id,version:"1.0.0",description:'Gives options for and generates useful example values for the values input of the "Append rows" Google Sheets operation',initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{getOptions:async t=>[{key:"sample-users",label:"Sample User Directory (3 Rows, 4 Columns)",disabledReasons:[],hidden:!1},{key:"sales-report",label:"Sales Report (2 Rows, 4 Columns)",disabledReasons:[],hidden:!1},{key:"single-row",label:"Single Row Entry (1 Row, 4 Columns)",disabledReasons:[],hidden:!1},{key:"empty-grid",label:"Empty Placeholder (1 Row, 1 Column)",disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{switch(n==null?void 0:n.valueKey){case"sales-report":return{value:OAn};case"single-row":return{value:xAn};case"empty-grid":return{value:PAn};case"sample-users":default:return{value:RV}}}})}}const NAn=[["Date","Product","Revenue ($)","Units Sold"],["2026-01-15","Pro Subscription",299,1],["2026-01-16","Enterprise Add-On",1250.5,2]],_An=[["Alice Smith","alice@example.com","Engineer","Active"]],$An=[[null]];class GAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][J.GoogleSheetsUpdateRangeValues].inputs.values.id,version:"1.0.0",description:'Gives options for and generates useful example values for the values input of the "Update range values" Google Sheets operation',initPriority:_e.High,permissions:[$e.All],contexts:[Q.Editor,Q.Logic]});C(this,"module",{getOptions:async t=>[{key:"sample-users",label:"Sample User Directory (3 Rows, 4 Columns)",disabledReasons:[],hidden:!1},{key:"sales-report",label:"Sales Report (2 Rows, 4 Columns)",disabledReasons:[],hidden:!1},{key:"single-row",label:"Single Row Entry (1 Row, 4 Columns)",disabledReasons:[],hidden:!1},{key:"empty-grid",label:"Empty Placeholder (1 Row, 1 Column)",disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{switch(n==null?void 0:n.valueKey){case"sales-report":return{value:NAn};case"single-row":return{value:_An};case"empty-grid":return{value:$An};case"sample-users":default:return{value:RV}}}})}}function LAn(a){a.register(new fTt(a)),a.register(new cTt(a)),a.register(new oTt(a)),a.register(new pTt(a)),a.register(new uTt(a)),a.register(new dTt(a)),a.register(new HEt(a)),a.register(new WEt(a)),a.register(new zEt(a)),a.register(new JEt(a)),a.register(new YEt(a)),a.register(new QEt(a)),a.register(new SRt(a)),a.register(new MRt(a)),a.register(new FRt(a)),a.register(new kRt(a)),a.register(new URt(a)),a.register(new KRt(a)),a.register(new jRt(a)),a.register(new qRt(a)),a.register(new ZRt(a)),a.register(new HRt(a)),a.register(new Zbt(a)),a.register(new Hbt(a)),a.register(new Wbt(a)),a.register(new zbt(a)),a.register(new Ybt(a)),a.register(new Jbt(a)),a.register(new Qbt(a)),a.register(new Xbt(a)),a.register(new eEt(a)),a.register(new tEt(a)),a.register(new iEt(a)),a.register(new nEt(a)),a.register(new rEt(a)),a.register(new aEt(a)),a.register(new sEt(a)),a.register(new lEt(a)),a.register(new oEt(a)),a.register(new dEt(a)),a.register(new pEt(a)),a.register(new fEt(a)),a.register(new yEt(a)),a.register(new hEt(a)),a.register(new cbt(a)),a.register(new fbt(a)),a.register(new ybt(a)),a.register(new hbt(a)),a.register(new mbt(a)),a.register(new Tbt(a)),a.register(new vbt(a)),a.register(new gbt(a)),a.register(new bbt(a)),a.register(new Ibt(a)),a.register(new Rbt(a)),a.register(new Abt(a)),a.register(new Dbt(a)),a.register(new Cbt(a)),a.register(new Vgt(a)),a.register(new iRt(a)),a.register(new eRt(a)),a.register(new tRt(a)),a.register(new Pvt(a)),a.register(new Vvt(a)),a.register(new Nvt(a)),a.register(new _vt(a)),a.register(new $vt(a)),a.register(new Gvt(a)),a.register(new Lvt(a)),a.register(new Bvt(a)),a.register(new Svt(a)),a.register(new Jvt(a)),a.register(new Ogt(a)),a.register(new xgt(a)),a.register(new Pgt(a)),a.register(new Mvt(a)),a.register(new Fvt(a)),a.register(new kvt(a)),a.register(new Uvt(a)),a.register(new Kvt(a)),a.register(new jvt(a)),a.register(new qvt(a)),a.register(new Zvt(a)),a.register(new Hvt(a)),a.register(new Wvt(a)),a.register(new zvt(a)),a.register(new Yvt(a)),a.register(new Qvt(a)),a.register(new Xvt(a)),a.register(new egt(a)),a.register(new tgt(a)),a.register(new igt(a)),a.register(new ngt(a)),a.register(new rgt(a)),a.register(new agt(a)),a.register(new sgt(a)),a.register(new lgt(a)),a.register(new ogt(a)),a.register(new dgt(a)),a.register(new vgt(a)),a.register(new ggt(a)),a.register(new bgt(a)),a.register(new pgt(a)),a.register(new ugt(a)),a.register(new cgt(a)),a.register(new fgt(a)),a.register(new ygt(a)),a.register(new hgt(a)),a.register(new mgt(a)),a.register(new Tgt(a)),a.register(new sRt(a)),a.register(new lRt(a)),a.register(new oRt(a)),a.register(new dRt(a)),a.register(new nRt(a)),a.register(new rRt(a)),a.register(new aRt(a)),a.register(new pRt(a)),a.register(new cRt(a)),a.register(new yRt(a)),a.register(new uRt(a)),a.register(new fRt(a)),a.register(new hRt(a)),a.register(new vRt(a)),a.register(new mRt(a)),a.register(new TRt(a)),a.register(new wbt(a)),a.register(new Vbt(a)),a.register(new Nbt(a)),a.register(new Gbt(a)),a.register(new Lbt(a)),a.register(new Bbt(a)),a.register(new Sbt(a)),a.register(new Mbt(a)),a.register(new Fbt(a)),a.register(new kbt(a)),a.register(new Ubt(a)),a.register(new _bt(a)),a.register(new $bt(a)),a.register(new U1t(a)),a.register(new K1t(a)),a.register(new j1t(a)),a.register(new q1t(a)),a.register(new Z1t(a)),a.register(new H1t(a)),a.register(new W1t(a)),a.register(new z1t(a)),a.register(new Y1t(a)),a.register(new J1t(a)),a.register(new Q1t(a)),a.register(new X1t(a)),a.register(new eDt(a)),a.register(new tDt(a)),a.register(new iDt(a)),a.register(new nDt(a)),a.register(new rDt(a)),a.register(new xbt(a)),a.register(new Pbt(a)),a.register(new Obt(a)),a.register(new Ebt(a)),a.register(new jbt(a)),a.register(new qbt(a)),a.register(new Kbt(a)),a.register(new eIt(a)),a.register(new AIt(a)),a.register(new RIt(a)),a.register(new DIt(a)),a.register(new CIt(a)),a.register(new nIt(a)),a.register(new rIt(a)),a.register(new pIt(a)),a.register(new oIt(a)),a.register(new EIt(a)),a.register(new hIt(a)),a.register(new TIt(a)),a.register(new gIt(a)),a.register(new vIt(a)),a.register(new dIt(a)),a.register(new cIt(a)),a.register(new fIt(a)),a.register(new uIt(a)),a.register(new XEt(a)),a.register(new aIt(a)),a.register(new mIt(a)),a.register(new xIt(a)),a.register(new KL(a)),a.register(new iIt(a)),a.register(new sIt(a)),a.register(new tIt(a)),a.register(new bIt(a)),a.register(new lIt(a)),a.register(new yIt(a)),a.register(new IIt(a)),a.register(new OIt(a)),a.register(new wIt(a)),a.register(new PIt(a)),a.register(new KL(a)),a.register(new NIt(a)),a.register(new VIt(a)),a.register(new _It(a)),a.register(new PEt(a)),a.register(new VEt(a)),a.register(new NEt(a)),a.register(new TEt(a)),a.register(new cEt(a)),a.register(new EEt(a)),a.register(new DEt(a)),a.register(new uEt(a)),a.register(new CEt(a)),a.register(new xEt(a)),a.register(new REt(a)),a.register(new IEt(a)),a.register(new Xw(a)),a.register(new _Et(a)),a.register(new $Et(a)),a.register(new AEt(a)),a.register(new OEt(a)),a.register(new wEt(a)),a.register(new bEt(a)),a.register(new gEt(a)),a.register(new vEt(a)),a.register(new mEt(a)),a.register(new BEt(a)),a.register(new LEt(a)),a.register(new SEt(a)),a.register(new GEt(a)),a.register(new Agt(a)),a.register(new Egt(a)),a.register(new Rgt(a)),a.register(new Dgt(a)),a.register(new Cgt(a)),a.register(new Igt(a)),a.register(new wgt(a)),a.register(new YRt(a)),a.register(new iAt(a)),a.register(new rAt(a)),a.register(new sAt(a)),a.register(new lAt(a)),a.register(new oAt(a)),a.register(new dAt(a)),a.register(new tAt(a)),a.register(new nAt(a)),a.register(new aAt(a)),a.register(new eAt(a)),a.register(new XRt(a)),a.register(new QRt(a)),a.register(new JRt(a)),a.register(new WRt(a)),a.register(new zRt(a)),a.register(new yAt(a)),a.register(new hAt(a)),a.register(new cAt(a)),a.register(new fAt(a)),a.register(new BRt(a)),a.register(new pAt(a)),a.register(new uAt(a)),a.register(new TAt(a)),a.register(new mAt(a)),a.register(new vAt(a)),a.register(new gAt(a)),a.register(new bAt(a)),a.register(new yTt(a)),a.register(new hTt(a)),a.register(new Jw(a)),a.register(new Qw(a)),a.register(new DAt(a)),a.register(new CAt(a)),a.register(new xAt(a)),a.register(new FAt(a)),a.register(new VAt(a)),a.register(new wAt(a)),a.register(new OAt(a)),a.register(new NAt(a)),a.register(new PAt(a)),a.register(new _At(a)),a.register(new $At(a)),a.register(new GAt(a)),a.register(new LAt(a)),a.register(new BAt(a)),a.register(new SAt(a)),a.register(new MAt(a)),a.register(new kAt(a)),a.register(new KAt(a)),a.register(new jAt(a)),a.register(new qAt(a)),a.register(new ZAt(a)),a.register(new HAt(a)),a.register(new WAt(a)),a.register(new zAt(a)),a.register(new k1t(a)),a.register(new YAt(a)),a.register(new JAt(a)),a.register(new c1t(a)),a.register(new QAt(a)),a.register(new XAt(a)),a.register(new e1t(a)),a.register(new t1t(a)),a.register(new i1t(a)),a.register(new n1t(a)),a.register(new r1t(a)),a.register(new a1t(a)),a.register(new s1t(a)),a.register(new o1t(a)),a.register(new d1t(a)),a.register(new p1t(a)),a.register(new u1t(a)),a.register(new f1t(a)),a.register(new F1t(a)),a.register(new h1t(a)),a.register(new A1t(a)),a.register(new b1t(a)),a.register(new E1t(a)),a.register(new g1t(a)),a.register(new w1t(a)),a.register(new y1t(a)),a.register(new m1t(a)),a.register(new O1t(a)),a.register(new C1t(a)),a.register(new P1t(a)),a.register(new V1t(a)),a.register(new N1t(a)),a.register(new _1t(a)),a.register(new $1t(a)),a.register(new G1t(a)),a.register(new L1t(a)),a.register(new B1t(a)),a.register(new S1t(a)),a.register(new M1t(a)),a.register(new v1t(a)),a.register(new T1t(a)),a.register(new I1t(a)),a.register(new x1t(a)),a.register(new D1t(a)),a.register(new R1t(a)),a.register(new EAt(a)),a.register(new IAt(a)),a.register(new zRn(a)),a.register(new nAn(a)),a.register(new sAn(a)),a.register(new dAn(a)),a.register(new cAn(a)),a.register(new hAn(a)),a.register(new gAn(a)),a.register(new IAn(a)),a.register(new RAn(a)),a.register(new AAn(a)),a.register(new VAn(a)),a.register(new GAn(a))}class F4{constructor(p=new pe.Events("extensions-registry-fallback-events")){C(this,"extensionsRegistry",new Map);C(this,"commandsRegistryMap",new Map);C(this,"commandsListCache",null);C(this,"initialized",new Set);C(this,"initializedContexts",new Set);C(this,"onResolveEditorContextCallback",()=>null);C(this,"onResolveProjectLogicContextCallback",()=>null);C(this,"onResolveEditorGUIContextCallback",()=>null);C(this,"onResolveGUIContextCallback",()=>null);C(this,"onResolveCompileContextCallback",()=>null);C(this,"onResolvePublicationRunContextCallback",()=>null);this.events=p,this.off=this.events.off.bind(this.events),this.on=this.events.on.bind(this.events),this.emit=this.events.emit.bind(this.events),this.emitAsync=this.events.emitAsync.bind(this.events),this.emitAsyncAll=this.events.emitAsyncAll.bind(this.events),this.emitAsyncAllSettled=this.events.emitAsyncAllSettled.bind(this.events),this.emitAsyncSequentially=this.events.emitAsyncSequentially.bind(this.events),this.emitAsyncSequentiallyAll=this.events.emitAsyncSequentiallyAll.bind(this.events),this.emitAsyncSequentiallyAllSettled=this.events.emitAsyncSequentiallyAllSettled.bind(this.events)}onResolveEditorContext(p){this.onResolveEditorContextCallback=p}onResolveProjectLogicContext(p){this.onResolveProjectLogicContextCallback=p}onResolveGUIContext(p){this.onResolveGUIContextCallback=p}onResolveEditorGUIContext(p){this.onResolveEditorGUIContextCallback=p}onResolveCompileContext(p){this.onResolveCompileContextCallback=p}onResolvePublicationRunContext(p){this.onResolvePublicationRunContextCallback=p}get extensionInOrder(){return Array.from(this.extensionsRegistry.values()).sort((p,t)=>(p.manifest.initPriority||_e.Normal)-(t.manifest.initPriority||_e.Normal))}async setup(){LAn(this),pe.Logger.log("Initializing extensions without context..."),this.initForReady()}requestContext(p){switch(p){case Q.Editor:return this.onResolveEditorContextCallback();case Q.Logic:return this.onResolveProjectLogicContextCallback();case Q.EditorGUI:return this.onResolveEditorGUIContextCallback();case Q.Compile:return this.onResolveCompileContextCallback();case Q.PublicationRun:return this.onResolvePublicationRunContextCallback();case Q.GUI:return this.onResolveGUIContextCallback();case Q.EditorGUI:return this.onResolveEditorGUIContextCallback();default:throw new Error(`Unknown context type: ${p}`)}}requestContexts(p,t=[]){const n=[];t.length===0&&(t=p.manifest.contexts);for(const s of t){const u=this.requestContext(s);u&&n.push(u)}return n}requestExtension(p){const t=this.extensionsRegistry.get(p);if(t)return t;throw new Error(`Unknown extension: ${p}`)}register(p){this.extensionsRegistry.set(p.manifest.id,p),p.command&&p.command.command&&(this.commandsRegistryMap.set(p.command.command.toLowerCase(),p),this.commandsListCache=null)}getCommands(p){if(this.commandsListCache||(this.commandsListCache=Array.from(this.commandsRegistryMap.values())),!p)return this.commandsListCache;const{contextType:t,globalOnly:n}=p;return this.commandsListCache.filter(s=>{var u;return n?!s.manifest.contexts||s.manifest.contexts.length===0:t?(u=s.manifest.contexts)==null?void 0:u.includes(t):!0})}async initAll(){for(const p of this.extensionInOrder){if(this.initialized.has(p.manifest.id))continue;const t=this.requestContexts(p);p.manifest.contexts.every(s=>!!t.find(u=>u.contextType===s))&&(p.module.init&&await p.module.init(t),this.initialized.add(p.manifest.id))}}async initForReady(){pe.Logger.log("Initializing extensions for ready contexts...");for(const p of this.extensionInOrder){if(this.initialized.has(p.manifest.id))continue;const t=this.requestContexts(p);p.manifest.contexts.every(s=>!!t.find(u=>u.contextType===s))?(p.module.init?(pe.Logger.debug("Initializing "+p.manifest.id+" extension..."),await p.module.init(t)):pe.Logger.log("Set "+p.manifest.id+" extension as ready (no init method)..."),this.initialized.add(p.manifest.id)):pe.Logger.warn(`Skipping initialization of ${p.manifest.id} extension, not all contexts are ready.`,`Required contexts: ${p.manifest.contexts.join(", ")}`,`Available contexts: ${t.map(s=>s.contextType).join(", ")}`)}}async destroyAll(){for(const p of[...this.extensionInOrder].reverse())p.module.destroy&&await p.module.destroy();this.events.destroy()}on(p,t){this.events.on(p,t)}emit(p,...t){this.events.emit(p,...t)}off(p,t){this.events.off(p,t)}emitAsync(p,...t){return this.events.emitAsync(p,...t)}emitAsyncAll(p,...t){return this.events.emitAsyncAll(p,...t)}emitAsyncAllSettled(p,...t){return this.events.emitAsyncAllSettled(p,...t)}emitAsyncSequentially(p,...t){return this.events.emitAsyncSequentially(p,...t)}emitAsyncSequentiallyAll(p,...t){return this.events.emitAsyncSequentiallyAll(p,...t)}emitAsyncSequentiallyAllSettled(p,...t){return this.events.emitAsyncSequentiallyAllSettled(p,...t)}async contextAvailable(p){if(this.initializedContexts.has(p)){pe.Logger.warn(`Context ${p} is already initialized. Skipping re-initialization.`);return}switch(this.initializedContexts.add(p),p){case Q.Editor:{if(!this.onResolveEditorContextCallback)throw new Error("No editor context resolver callback set. Call onResolveEditorContext first.");break}case Q.Logic:{if(!this.onResolveProjectLogicContextCallback)throw new Error("No project logic context resolver callback set. Call onResolveProjectLogicContext first.");break}}pe.Logger.log(`Context ${p} is now available. Initializing extensions for this context...`),await this.initForReady()}getValueTypePreference(p){return window.localStorage.getItem("dynamic-value-type-preference--"+p)||null}setValueTypePreference(p,t){window.localStorage.setItem("dynamic-value-type-preference--"+p,(t==null?void 0:t.toString())||""),this.emit(p,{})}}let hw=null;const k4={requestExtension:a=>(hw||(hw=new F4,hw.setup()),hw.requestExtension(a))};function Eh(a){return!(a instanceof Error)&&typeof a=="object"&&a!==null?a:a instanceof Error?{name:a.name,message:a.message,stack:a.stack,...a}:a}function V5(a){var p,t,n;if(a&&typeof a=="object"&&"value"in a){const s=a;return{single:((p=s.value)==null?void 0:p.valueAsTypeSingle)??((t=s.value)==null?void 0:t.value),list:((n=s.value)==null?void 0:n.valueAsTypeList)??null}}return{single:a,list:Array.isArray(a)?a:null}}const Ih={onBeforeEntityExecution:async()=>{},onEntityExecuted:async()=>{}};class e2 extends Error{constructor(){super("Execution was stopped"),this.name="ExecutionStoppedError"}}var U4=(a=>(a.FinishedSuccess="finished-success",a.FinishedError="finished-error",a.Running="running",a.Paused="paused",a.Stopped="stopped",a.NotStarted="not-started",a))(U4||{});const oDt={...k4,getValueTypePreference:()=>null,setValueTypePreference:()=>{}};class vg extends pe.Events{constructor(t,n,s,u=null,e=oDt){super();C(this,"project");C(this,"entryPoint");C(this,"state","not-started");C(this,"events",new pe.Events("fe-exec-inst-events"));C(this,"entities",[]);C(this,"parentExecution",null);C(this,"executing",[]);C(this,"executed",[]);C(this,"skipped",[]);C(this,"scheduled",[]);C(this,"localTestValues");C(this,"resolvedValues");C(this,"persistedExecutionResults");C(this,"lastExecutionResults");C(this,"onAddToSkippedListCallback",null);C(this,"onRemoveFromSkippedListCallback",null);C(this,"onAddEntityCallback",null);C(this,"onRemoveEntityCallback",null);C(this,"onAbortExecutionCallback",null);this.parentContext=e,this.entities=n,this.entryPoint=s,this.project=t,this.parentExecution=u,this.localTestValues=new VR(M.UUID.uuid(),this.project),this.resolvedValues=new VR(M.UUID.uuid(),this.project),this.persistedExecutionResults=new VR(M.UUID.uuid(),this.project),this.lastExecutionResults=new VR(M.UUID.uuid(),this.project)}get valueResolutionContext(){return{execution:this,project:this.project,localTestValues:this.localTestValues,resolvedValues:this.resolvedValues,persistedExecutionResults:this.persistedExecutionResults,lastExecutionResults:this.lastExecutionResults,getValueTypePreference:this.parentContext.getValueTypePreference,setValueTypePreference:this.parentContext.setValueTypePreference}}get rootExecution(){let t=this;for(;t.parentExecution;)t=t.parentExecution;return t}get rootState(){return this.rootExecution.state}isStopped(){return this.state==="stopped"||this.rootExecution.state==="stopped"}isPaused(){return this.state==="paused"||this.rootExecution.state==="paused"}async checkStateAndPause(){if(this.isStopped())throw new e2;for(;this.isPaused();){if(this.isStopped())throw new e2;await new Promise(t=>setTimeout(t,100))}}skip(t){this.hasEntity(t)&&(this.removeFromScheduledList(t),!this.skipped.includes(t)&&(this.skipped.push(t),this.onAddToSkippedListCallback&&this.onAddToSkippedListCallback(t),Pr.includes(t.type)&&ri(t).forEach(n=>this.skip(n))))}async schedule(t,n,s){if(this.hasExecuted(t))return null;if(Xi.includes(t.type))return this.executeBranch(t,s,n);if(Vr.includes(t.type)){if(t.calledBy.every(e=>this.hasExecuted(e)||!this.hasEntity(e)))return this.executeBranch(t,s,n);this.scheduled.includes(t)||this.scheduled.push(t)}return null}mergeExernalValuesWithInternalInputs(t,n){const s=[];return Yi.includes(n.type)?s.push(...n.inputs.filter(e=>vT(e))):[...Li,...Xi].includes(n.type)?s.push(...n.inputs):Ni.includes(n.type)&&s.push(...n.outputs.filter(e=>vT(e))),s.map(e=>{var y;let f=t.find(m=>m.valueOwner.id===e.id);if(f)return f;if(!f&&Xi.includes(n.type)&&(f=t.find(m=>{var T;return((T=m.valueOwner.declaration)==null?void 0:T.id)===e.id})),f){const m=(y=f.value)==null?void 0:y.clone(null);return m==null||m.setStandaloneParent(e,null),{...f,valueOwner:e,value:m||null,inheritanceLink:{sources:[f],target:e}}}return ls.includes(e.type)?Xp(e,this.valueResolutionContext):Qu(e,this.valueResolutionContext)}).reduce((e,f)=>{const y=uf(f==null?void 0:f.valueOwner,this.project),m=f?[f]:[];return y.forEach(T=>{var R,I,A;if(T.id===(f==null?void 0:f.valueOwner.id))return;const g=Pn(T.getDataType(null),T,this.project);g==null||g.metaSync({value:(R=f==null?void 0:f.value)==null?void 0:R.value},null),g==null||g.setValueAsTypeList(((I=f==null?void 0:f.value)==null?void 0:I.valueAsTypeList)||null),g==null||g.setValueAsTypeSingle(((A=f==null?void 0:f.value)==null?void 0:A.valueAsTypeSingle)||null);const b={...f,valueOwner:T,value:g};m.push(b)}),[...e,...m]},[]).sort((e,f)=>e.valueOwner.index-f.valueOwner.index)}inheritValuesFromContext(t){this.localTestValues=t.localTestValues,this.resolvedValues=t.resolvedValues,this.persistedExecutionResults=t.persistedExecutionResults}async executeInternalCall(t,n,s,u={}){var f,y;this.logBeforeExecution("executeInternalCall",t,n);const e={...Ih,...u};try{let m={value:K.Success,error:null,result:null};if(n.sort((A,O)=>A.valueOwner.index-O.valueOwner.index),Object.values(ja).includes(t.declaration.id)){const A=this.parentContext.requestExtension(vi+t.declaration.id).module.main;A?m=await A(t,n,this):pe.Logger.warn(`No implementation found for built-in function: ${t.declaration.id}`)}else{const A=await this.executeDetachedFullFunctionDeclarationLogic(t.declaration,n,s,e);m={value:A.value,error:A.error,result:A.result}}let T=null;if(m.error&&t.error){pe.Logger.warn("Raw error executing entity: ",m.error);const{single:A,list:O}=V5(m.error),P=Eh(A),x=(f=t.error)==null?void 0:f.getDataType(null),$=Pn(x||null,t.error,s);x!=null&&x.asType?O!==null?$==null||$.setValueAsTypeList(O):$==null||$.setValueAsTypeSingle(A):$==null||$.metaSync({value:P},null),T={valueOwner:t.error,type:rt.ExecutionResult,inheritanceLink:null,value:$}}const g=t==null?void 0:t.getDataType(null),b=Pn(g,t,s),{single:R,list:I}=V5(m.result);return g!=null&&g.asType?I!==null?b==null||b.setValueAsTypeList(I):b==null||b.setValueAsTypeSingle(R):b==null||b.metaSync({value:R},null),{value:m.value,entity:t,error:T,result:{value:b||null,valueOwner:t,type:rt.ExecutionResult,inheritanceLink:null}}}catch(m){if(m&&(m.name==="ExecutionStoppedError"||m.message==="Execution was stopped"))throw m;pe.Logger.warn("Internal call execution error: ",m);let T=null;if(t.error){const g=Eh(m),b=(y=t.error)==null?void 0:y.getDataType(null),R=Pn(b,t.error,s);b!=null&&b.asType?R==null||R.setValueAsTypeSingle(m):R==null||R.metaSync({value:g},null),T={valueOwner:t.error,type:rt.ExecutionResult,inheritanceLink:null,value:R}}return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,entity:t,error:T,result:null}}}static async executeOperation(t,n,s,u){var e,f;u?u.logBeforeExecution("executeOperation",t,n):console.log(`executeOperation (${t.type}) -> [${De(t,s)}] Inputs:${n.length?`
62
62
  `:""}${n.map(y=>{var m,T,g;return`${(m=y.valueOwner)==null?void 0:m.type} (${(T=y.valueOwner)==null?void 0:T.id}) "${De(y.valueOwner,s)}": ${JSON.stringify((g=y.value)==null?void 0:g.value,null,2)}`}).join(`
63
63
  `)}
64
64
  `);try{let y={value:K.Success,error:null,result:null};n.sort((b,R)=>b.valueOwner.index-R.valueOwner.index),t.declaration.implementation&&(y=await t.declaration.implementation(t,n.sort((b,R)=>b.valueOwner.index-R.valueOwner.index)));let m=null;if(y.error&&t.error){const b=Eh(y.error),R=((e=t.error)==null?void 0:e.getDataType(null))||null,I=Pn(R,t.error,s);R!=null&&R.asType?I==null||I.setValueAsTypeSingle(y.error):I==null||I.metaSync({value:b},null),m={valueOwner:t.error,type:rt.ExecutionResult,inheritanceLink:null,value:I}}const T=t==null?void 0:t.getDataType(null),g=Pn(T,t,s);return T!=null&&T.asType?g==null||g.setValueAsTypeSingle(y.result):g==null||g.metaSync({value:y.result},null),{value:y.value,entity:t,error:m,result:{value:g||null,valueOwner:t,type:rt.ExecutionResult,inheritanceLink:null}}}catch(y){if(y&&(y.name==="ExecutionStoppedError"||y.message==="Execution was stopped"))throw y;console.warn("Operation execution error: ",y);let m=null;if(t.error){const T=Eh(y),g=(f=t.error)==null?void 0:f.getDataType(null),b=Pn(g,t.error,s);g!=null&&g.asType?b==null||b.setValueAsTypeSingle(y):b==null||b.metaSync({value:T},null),m={valueOwner:t.error,type:rt.ExecutionResult,inheritanceLink:null,value:b}}return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,entity:t,error:m,result:null}}}async executeSearch(t,n,s){var u;this.logBeforeExecution("executeSearch",t,n);try{let e={value:K.Success,error:null,result:null};const f=await(await this.parentContext.requestExtension(je.SEARCH_NODE_IMPLEMENTATION)).module.main(t,n),y=t==null?void 0:t.getDataType(null),m=Pn(y,t,s);return m==null||m.metaSync({value:f},null),f.error?{value:K.UnhandledError,entity:t,error:{valueOwner:t,type:rt.ExecutionResult,inheritanceLink:null,value:m},result:null}:{value:e.value,entity:t,error:null,result:{value:m,valueOwner:t,type:rt.ExecutionResult,inheritanceLink:null}}}catch(e){if(e&&(e.name==="ExecutionStoppedError"||e.message==="Execution was stopped"))throw e;if(pe.Logger.warn(`Search node execution error: ${e}`),!t.error)return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,entity:t,error:null,result:null};const f=Eh(e),y=(u=t.error)==null?void 0:u.getDataType(null),m=Pn(y,t.error,s);return m==null||m.metaSync({value:f},null),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,entity:t,error:{valueOwner:t.error,type:rt.ExecutionResult,inheritanceLink:null,value:m},result:null}}}async executeLoop(t,n,s,u={}){var f,y,m,T,g,b,R,I,A,O,P,x,$,U,Z,q,H;this.logBeforeExecution("executeLoop",t,n);const e={...Ih,...u};try{let Y={value:K.Success,error:null,result:null};const ie=n.map(ae=>{var le,oe;return((le=ae==null?void 0:ae.value)==null?void 0:le.valueAsType)||((oe=ae==null?void 0:ae.value)==null?void 0:oe.value)});let z={};const W=t.body.inputs.find(ae=>ae!==t.currentIterationNumberArgumentDeclaration&&ae!==t.currentValueArgumentDeclaration);if(W){const ae=W,le=Pn(ae.getDataType(null),ae,s);le==null||le.metaSync({value:((f=ae.defaultValue)==null?void 0:f.value)||null},null),z[ae.id]={value:le||null,valueOwner:ae,type:rt.ExecutionResult,inheritanceLink:null}}let ee={value:K.Success,entity:t.body,error:null,result:null};switch(t.declaration.id){case G.loop["counted-loop"].id:{const ae=ie[0];let le=1;for(;le<=ae&&le<=1e3;){await this.checkStateAndPause();const oe=t.body.inputs.map(ce=>{if(ce===t.currentIterationNumberArgumentDeclaration){const be=t.currentIterationNumberArgumentDeclaration.getDataType(null),Ce=ly(be),Ee=this.lastExecutionResults.readValue(ce.id);if(Ee){Ee.metaSync({value:le},null);const tt=Xr(Ee,ce);this.lastExecutionResults.writeValue(ce,tt);const We={value:tt,valueOwner:t.currentIterationNumberArgumentDeclaration,type:rt.ExecutionResult,inheritanceLink:null};return z[ce.id]=We,We}const Oe={id:M.UUID.uuid(),deletable:!0,editable:!0,type:r.LiteralValue,autogeneration:null,version:M.UUID.uuid(),createdAt:new Date().toISOString(),author:M.sessionAuthor,deleted:!1,previousVersion:null,value:le,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:Ce,standaloneParent:ce.toReference()},Le=Zr(Oe,s);this.lastExecutionResults.writeValue(ce,Le);const Fe={value:Le,valueOwner:t.currentIterationNumberArgumentDeclaration,type:rt.ExecutionResult,inheritanceLink:null};return z[ce.id]=Fe,Fe}else return z[ce.id]}).filter(ce=>!!ce);if(ee=await this.executeFullFunctionDeclarationLogic(t.body,oe,e),ee!=null&&ee.result&&ee.value!==K.Return){const ce=t.body.inputs.find(be=>be!==t.currentIterationNumberArgumentDeclaration&&be!==t.currentValueArgumentDeclaration);if(ce){let be=(y=ee.result.value)==null?void 0:y.value;be===void 0&&(be=null),(m=z[ce.id].value)==null||m.metaSync({value:be},null);const Ce=Xr(z[ce.id].value,ce);this.lastExecutionResults.writeValue(ce,Ce)}}if([K.CaughtError,K.UnhandledError,K.Break,K.Return].includes(ee.value))break;le++}break}case G.loop["manual-flow-loop"].id:{let ae=1;for(;ae<=50;){await this.checkStateAndPause();const le=t.body.inputs.map(oe=>{if(oe===t.currentIterationNumberArgumentDeclaration){const ce=this.lastExecutionResults.readValue(oe.id);if(ce){ce.metaSync({value:ae},null);const Oe=Xr(ce,oe);this.lastExecutionResults.writeValue(oe,Oe);const Le={value:Oe,valueOwner:oe,type:rt.ExecutionResult,inheritanceLink:null};return z[oe.id]=Le,Le}const be=t.currentIterationNumberArgumentDeclaration.getDataType(null),Ce=Pn(be,oe,s);return Ce==null||Ce.metaSync({value:ae},null),this.lastExecutionResults.writeValue(oe,Ce),{value:Ce,valueOwner:oe,type:rt.ExecutionResult,inheritanceLink:null}}else return z[oe.id]}).filter(oe=>!!oe);if(ee=await this.executeFullFunctionDeclarationLogic(t.body,le,e),ee!=null&&ee.result&&ee.value!==K.Return){const oe=t.body.inputs.find(ce=>ce!==t.currentIterationNumberArgumentDeclaration&&ce!==t.currentValueArgumentDeclaration);if(oe){let ce=(T=ee.result.value)==null?void 0:T.value;ce===void 0&&(ce=null),(g=z[oe.id].value)==null||g.metaSync({value:ce},null);const be=Xr(z[oe.id].value,oe);this.lastExecutionResults.writeValue(oe,be)}}if([K.CaughtError,K.UnhandledError,K.Break,K.Return].includes(ee.value))break;ae++}break}case G.loop["list-loop"].id:{const ae=ie[0];let le=1;const oe=ae;for(let ce=0;ce<oe.length;ce++){await this.checkStateAndPause();const be=oe[ce],Ce=t.body.inputs.map(Ee=>{if(Ee===t.currentIterationNumberArgumentDeclaration){const Oe=this.lastExecutionResults.readValue(Ee.id);if(Oe){Oe.metaSync({value:le},null);const We=Xr(Oe,Ee);return this.lastExecutionResults.writeValue(Ee,We),{value:We,valueOwner:Ee,type:rt.ExecutionResult,inheritanceLink:null}}const Le=t.currentIterationNumberArgumentDeclaration.getDataType(null),Fe=Pn(Le,Ee,s);return Fe==null||Fe.metaSync({value:le},null),this.lastExecutionResults.writeValue(Ee,Fe),{value:Fe,valueOwner:t.currentIterationNumberArgumentDeclaration,type:rt.ExecutionResult,inheritanceLink:null}}else if(Ee===t.currentValueArgumentDeclaration){const Oe=t.currentValueArgumentDeclaration.getDataType(null),Le=ly(Oe),Fe=this.lastExecutionResults.readValue(Ee.id);if(Fe){Fe.metaSync({value:be},null);const qe=Xr(Fe,Ee);return this.lastExecutionResults.writeValue(Ee,qe),{value:qe,valueOwner:Ee,type:rt.ExecutionResult,inheritanceLink:null}}const tt={id:M.UUID.uuid(),deletable:!0,editable:!0,type:r.LiteralValue,autogeneration:null,version:M.UUID.uuid(),createdAt:new Date().toISOString(),author:M.sessionAuthor,deleted:!1,previousVersion:null,value:be,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:Le,standaloneParent:Ee.toReference()},We=Zr(tt,s);return this.lastExecutionResults.writeValue(Ee,We),{value:We,valueOwner:t.currentValueArgumentDeclaration,type:rt.ExecutionResult,inheritanceLink:null}}else return z[Ee.id]}).filter(Ee=>!!Ee);if(ee=await this.executeFullFunctionDeclarationLogic(t.body,Ce,e),ee!=null&&ee.result&&ee.value!==K.Return){const Ee=t.body.inputs.find(Oe=>Oe!==t.currentIterationNumberArgumentDeclaration&&Oe!==t.currentValueArgumentDeclaration);if(Ee){let Oe=(b=ee.result.value)==null?void 0:b.value;Oe===void 0&&(Oe=null),(R=z[Ee.id].value)==null||R.metaSync({value:Oe},null);const Le=Xr(z[Ee.id].value,Ee);this.lastExecutionResults.writeValue(Ee,Le)}}if([K.CaughtError,K.UnhandledError,K.Break,K.Return].includes(ee.value))break;le++}break}case G.loop["object-keys-loop"].id:{const ae=ie[0];let le=1;const oe=ae?Object.keys(ae):[];for(let ce=0;ce<oe.length;ce++){await this.checkStateAndPause();const be=oe[ce],Ce=t.body.inputs.map(Ee=>{if(Ee===t.currentIterationNumberArgumentDeclaration){const Oe=this.lastExecutionResults.readValue(Ee.id);if(Oe){Oe.metaSync({value:le},null);const We=Xr(Oe,Ee);return this.lastExecutionResults.writeValue(Ee,We),{value:We,valueOwner:Ee,type:rt.ExecutionResult,inheritanceLink:null}}const Le=t.currentIterationNumberArgumentDeclaration.getDataType(null),Fe=Pn(Le,Ee,s);return Fe==null||Fe.metaSync({value:le},null),this.lastExecutionResults.writeValue(Ee,Fe),{value:Fe,valueOwner:t.currentIterationNumberArgumentDeclaration,type:rt.ExecutionResult,inheritanceLink:null}}else if(Ee===t.currentValueArgumentDeclaration){const Oe=t.currentValueArgumentDeclaration.getDataType(null),Le=ly(Oe),Fe=this.lastExecutionResults.readValue(Ee.id);if(Fe){Fe.metaSync({value:be},null);const qe=Xr(Fe,Ee);return this.lastExecutionResults.writeValue(Ee,qe),{value:Fe,valueOwner:Ee,type:rt.ExecutionResult,inheritanceLink:null}}const tt={id:M.UUID.uuid(),deletable:!0,editable:!0,type:r.LiteralValue,autogeneration:null,version:M.UUID.uuid(),createdAt:new Date().toISOString(),author:M.sessionAuthor,deleted:!1,previousVersion:null,value:be,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:Le,standaloneParent:Ee.toReference()},We=Zr(tt,s);return this.lastExecutionResults.writeValue(Ee,We),{value:We,valueOwner:t.currentValueArgumentDeclaration,type:rt.ExecutionResult,inheritanceLink:null}}else return z[Ee.id]}).filter(Ee=>!!Ee);if(ee=await this.executeFullFunctionDeclarationLogic(t.body,Ce,e),ee!=null&&ee.result&&ee.value!==K.Return){const Ee=t.body.inputs.find(Oe=>Oe!==t.currentIterationNumberArgumentDeclaration&&Oe!==t.currentValueArgumentDeclaration);if(Ee){let Oe=(I=ee.result.value)==null?void 0:I.value;Oe===void 0&&(Oe=null),(A=z[Ee.id].value)==null||A.metaSync({value:Oe},null);const Le=Xr(z[Ee.id].value,Ee);this.lastExecutionResults.writeValue(Ee,Le)}}if([K.CaughtError,K.UnhandledError,K.Break,K.Return].includes(ee.value))break;le++}break}case G.loop["object-values-loop"].id:{const ae=ie[0];let le=1;const oe=ae?Object.values(ae):[];for(let ce=0;ce<oe.length;ce++){await this.checkStateAndPause();const be=oe[ce],Ce=t.body.inputs.map(Ee=>{if(Ee===t.currentIterationNumberArgumentDeclaration){const Oe=this.lastExecutionResults.readValue(Ee.id);if(Oe){Oe.metaSync({value:le},null);const We=Xr(Oe,Ee);return this.lastExecutionResults.writeValue(Ee,We),{value:We,valueOwner:Ee,type:rt.ExecutionResult,inheritanceLink:null}}const Le=t.currentIterationNumberArgumentDeclaration.getDataType(null),Fe=Pn(Le,Ee,s);return Fe==null||Fe.metaSync({value:le},null),this.lastExecutionResults.writeValue(Ee,Fe),{value:Fe,valueOwner:t.currentIterationNumberArgumentDeclaration,type:rt.ExecutionResult,inheritanceLink:null}}else if(Ee===t.currentValueArgumentDeclaration){const Oe=t.currentValueArgumentDeclaration.getDataType(null),Le=ly(Oe),Fe=this.lastExecutionResults.readValue(Ee.id);if(Fe){Fe.metaSync({value:be},null);const qe=Xr(Fe,Ee);return this.lastExecutionResults.writeValue(Ee,qe),{value:Fe,valueOwner:Ee,type:rt.ExecutionResult,inheritanceLink:null}}const tt={id:M.UUID.uuid(),deletable:!0,editable:!0,type:r.LiteralValue,autogeneration:null,version:M.UUID.uuid(),createdAt:new Date().toISOString(),author:M.sessionAuthor,deleted:!1,previousVersion:null,value:be,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:Le,standaloneParent:Ee.toReference()},We=Zr(tt,s);return this.lastExecutionResults.writeValue(Ee,We),{value:We,valueOwner:t.currentValueArgumentDeclaration,type:rt.ExecutionResult,inheritanceLink:null}}else return z[Ee.id]}).filter(Ee=>!!Ee);if(ee=await this.executeFullFunctionDeclarationLogic(t.body,Ce,e),ee!=null&&ee.result&&ee.value!==K.Return){const Ee=t.body.inputs.find(Oe=>Oe!==t.currentIterationNumberArgumentDeclaration&&Oe!==t.currentValueArgumentDeclaration);if(Ee){let Oe=(O=ee.result.value)==null?void 0:O.value;Oe===void 0&&(Oe=null),(P=z[Ee.id].value)==null||P.metaSync({value:Oe},null);const Le=Xr(z[Ee.id].value,Ee);this.lastExecutionResults.writeValue(Ee,Le)}}if([K.CaughtError,K.UnhandledError,K.Break,K.Return].includes(ee.value))break;le++}break}case G.loop["string-loop"].id:{const ae=ie[0];let le=1;const oe=ae.split("");for(let ce=0;ce<oe.length;ce++){await this.checkStateAndPause();const be=oe[ce],Ce=t.body.inputs.map(Ee=>{if(Ee===t.currentIterationNumberArgumentDeclaration){const Oe=this.lastExecutionResults.readValue(Ee.id);if(Oe){Oe.metaSync({value:le},null);const We=Xr(Oe,Ee);return this.lastExecutionResults.writeValue(Ee,We),{value:We,valueOwner:Ee,type:rt.ExecutionResult,inheritanceLink:null}}const Le=t.currentIterationNumberArgumentDeclaration.getDataType(null),Fe=Pn(Le,Ee,s);return Fe==null||Fe.metaSync({value:le},null),this.lastExecutionResults.writeValue(Ee,Fe),{value:Fe,valueOwner:t.currentIterationNumberArgumentDeclaration,type:rt.ExecutionResult,inheritanceLink:null}}else if(Ee===t.currentValueArgumentDeclaration){const Oe=t.currentValueArgumentDeclaration.getDataType(null),Le=ly(Oe),Fe=this.lastExecutionResults.readValue(Ee.id);if(Fe){Fe.metaSync({value:be},null);const qe=Xr(Fe,Ee);return this.lastExecutionResults.writeValue(Ee,qe),{value:qe,valueOwner:Ee,type:rt.ExecutionResult,inheritanceLink:null}}const tt={id:M.UUID.uuid(),deletable:!0,editable:!0,type:r.LiteralValue,autogeneration:null,version:M.UUID.uuid(),createdAt:new Date().toISOString(),author:M.sessionAuthor,deleted:!1,previousVersion:null,value:be,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:Le,standaloneParent:Ee.toReference()},We=Zr(tt,s);return this.lastExecutionResults.writeValue(Ee,We),{value:We,valueOwner:t.currentValueArgumentDeclaration,type:rt.ExecutionResult,inheritanceLink:null}}else return z[Ee.id]}).filter(Ee=>!!Ee);if(ee=await this.executeFullFunctionDeclarationLogic(t.body,Ce,e),(ee.results||[]).forEach(Ee=>{var We,et,qe;if(Ee.valueOwner.type!==r.InputMap||Ni.includes(Ee.valueOwner.parent.type))return;const Oe=t.body.inputs.find(ot=>De(ot,s)===De(Ee.valueOwner,s)),Fe=[...(We=z[Oe.id].value)==null?void 0:We.value,((et=Ee.value)==null?void 0:et.value)||null];(qe=z[Oe.id].value)==null||qe.metaSync({value:Fe},null);const tt=Xr(z[Oe.id].value,Oe);this.lastExecutionResults.writeValue(Oe,tt)}),[K.CaughtError,K.UnhandledError,K.Break,K.Return].includes(ee.value))break;le++}break}}let te=K.Success;if(ee.value===K.UnhandledError?t.catchesError||t.errorCalls.length?te=K.CaughtError:te=K.UnhandledError:[K.CaughtError,K.Return].includes(ee.value)&&(te=ee.value),Y={value:te,error:(($=(x=ee.error)==null?void 0:x.value)==null?void 0:$.value)||null,result:((Z=(U=ee==null?void 0:ee.result)==null?void 0:U.value)==null?void 0:Z.value)||null},Y.value===K.UnhandledError||Y.value===K.CaughtError){let ae=null;if(t.error){const le=Eh(Y.error),oe=(q=t.error)==null?void 0:q.getDataType(null),ce=Pn(oe||null,t.error,s);oe!=null&&oe.asType?ce==null||ce.setValueAsTypeSingle(Y.error):ce==null||ce.metaSync({value:le},null),ae={valueOwner:t.error,type:rt.ExecutionResult,inheritanceLink:null,value:ce}}return{value:Y.value,entity:t,error:ae,result:null}}const X=t==null?void 0:t.getDataType(null),re=Pn(X,t,s);return X!=null&&X.asType?re==null||re.setValueAsTypeSingle(Y.result):re==null||re.metaSync({value:Y.result},null),{value:Y.value,entity:t,error:null,result:{value:re||null,valueOwner:t,type:rt.ExecutionResult,inheritanceLink:null}}}catch(Y){if(Y&&(Y.name==="ExecutionStoppedError"||Y.message==="Execution was stopped"))throw Y;if(pe.Logger.warn("Error executing loop: ",Y),t.error){const ie=Eh(Y),z=(H=t.error)==null?void 0:H.getDataType(null),W=Pn(z,t.error,s);return z!=null&&z.asType?W==null||W.setValueAsTypeSingle(Y):W==null||W.metaSync({value:ie},null),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,entity:t,error:{valueOwner:t.error,type:rt.ExecutionResult,inheritanceLink:null,value:W},result:null}}else return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,entity:t,error:null,result:null}}}async executeFunctionCall(t,n,s,u={}){var f,y,m,T,g,b,R,I,A,O,P,x,$,U,Z,q,H,Y,ie,z,W,ee,te,X,re,ae;const e={...Ih,...u};try{this.logBeforeExecution("executeFunctionCall",t,n);const le=await this.executeDetachedFullFunctionDeclarationLogic(t.declaration,n,s,e);let oe=null;if(le.error&&t.error){pe.Logger.warn("Raw error executing entity: ",le.error);const Ee=(f=t.error)==null?void 0:f.getDataType(null),Oe=Pn(Ee||null,t.error,s);Ee!=null&&Ee.asType?(m=(y=le.error)==null?void 0:y.value)!=null&&m.valueAsTypeSingle?Oe==null||Oe.setValueAsTypeSingle((g=(T=le.error)==null?void 0:T.value)==null?void 0:g.valueAsTypeSingle):(R=(b=le.error)==null?void 0:b.value)!=null&&R.valueAsTypeList&&Array.isArray((A=(I=le.error)==null?void 0:I.value)==null?void 0:A.valueAsTypeList)&&(Oe==null||Oe.setValueAsTypeList((P=(O=le.error)==null?void 0:O.value)==null?void 0:P.valueAsTypeList)):Oe==null||Oe.metaSync({value:($=(x=le.error)==null?void 0:x.value)==null?void 0:$.value},null),oe={valueOwner:t.error,type:rt.ExecutionResult,inheritanceLink:null,value:Oe}}let ce=K.Success;le.value===K.UnhandledError&&(t.catchesError||t.errorCalls.length?ce=K.CaughtError:ce=K.UnhandledError);const be=t==null?void 0:t.getDataType(null),Ce=Pn(be,t,s);return be!=null&&be.asType?(Z=(U=le.result)==null?void 0:U.value)!=null&&Z.valueAsTypeSingle?Ce==null||Ce.setValueAsTypeSingle((H=(q=le.result)==null?void 0:q.value)==null?void 0:H.valueAsTypeSingle):(ie=(Y=le.result)==null?void 0:Y.value)!=null&&ie.valueAsTypeList&&Array.isArray((W=(z=le.result)==null?void 0:z.value)==null?void 0:W.valueAsTypeList)&&(Ce==null||Ce.setValueAsTypeList((te=(ee=le.result)==null?void 0:ee.value)==null?void 0:te.valueAsTypeList)):Ce==null||Ce.metaSync({value:((re=(X=le.result)==null?void 0:X.value)==null?void 0:re.value)||null},null),{value:ce,entity:t,error:oe,result:{value:Ce||null,valueOwner:t,type:rt.ExecutionResult,inheritanceLink:null}}}catch(le){if(le&&(le.name==="ExecutionStoppedError"||le.message==="Execution was stopped"))throw le;if(!t.error)return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,entity:t,error:null,result:null};const oe=Eh(le),ce=(ae=t.error)==null?void 0:ae.getDataType(null),be=Pn(ce,t.error,s);return ce!=null&&ce.asType?be==null||be.setValueAsTypeSingle(le):be==null||be.metaSync({value:oe},null),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,entity:t,error:{valueOwner:t.error,type:rt.ExecutionResult,inheritanceLink:null,value:be},result:null}}}async executeCondition(t,n){var u,e,f,y;this.logBeforeExecution("executeCondition",t,n);let s=!1;switch(t.declaration.id){case qs.BooleanIsTrue:{const m=(e=(u=n[0])==null?void 0:u.value)==null?void 0:e.value;if(typeof m!="boolean")throw new TypeError("BooleanIsTrue expects a boolean input.");s=m===!0;break}case qs.BooleanIsFalse:{const m=(y=(f=n[0])==null?void 0:f.value)==null?void 0:y.value;if(typeof m!="boolean")throw new TypeError("BooleanIsFalse expects a boolean input.");s=m===!1;break}case $a.And:{s=(await Promise.all(t.andChildrenGroup.map(async T=>{const g=this.mergeExernalValuesWithInternalInputs(n,T);return(await this.executeCondition(T,g)).value===K.Success}))).every(T=>T);break}case $a.Or:{s=(await Promise.all(t.orChildrenGroup.map(async T=>{const g=this.mergeExernalValuesWithInternalInputs(n,T);return(await this.executeCondition(T,g)).value===K.Success}))).some(T=>T);break}default:throw new Error(`Condition declaration ${t.declaration.name} does not have an implementation.`)}return{value:s?K.Success:K.ConditionNotMet,entity:t,error:null,result:null}}async executeDetachedFullFunctionDeclarationLogic(t,n,s,u={}){this.logBeforeExecution("executeDetachedFullFunctionDeclarationLogic",t,n);const e={...Ih,...u,onBeforeEntityExecution:(m,T,g)=>{var b;return((b=u==null?void 0:u.onBeforeEntityExecution)==null?void 0:b.call(u,m,T,{...g,detached:!0}))||Promise.resolve()},onEntityExecuted:(m,T,g)=>{var b;return((b=u==null?void 0:u.onEntityExecuted)==null?void 0:b.call(u,m,T,{...g,detached:!0}))||Promise.resolve()}},f=new vg(s,[t,...bO(t)],t,this,this.parentContext);return f.inheritValuesFromContext(this),await f.execute(e,n)}async executeFullFunctionDeclarationLogic(t,n,s={}){this.logBeforeExecution("executeFullFunctionDeclarationLogic",t,n);const u={...Ih,...s},e=bO(t),f=[];e.forEach(T=>{if(T.type===r.VariableDeclaration||T.type===r.VariableInstance){const g=T;g.internalCalls&&f.push(...g.internalCalls)}}),e.push(...f),console.log(`[executeFullFunctionDeclarationLogic] Reseting children for: ${De(t,this.project)}