@elyx-code/project-logic-tree 0.0.7065 → 0.0.7066

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
@@ -58,7 +58,7 @@ This is likely an incorrect strategy, either the '${this.type}' entity doesn't n
58
58
  `)),!u.includes(" ")&&/\\t/.test(u)&&(u=u.replace(/\\t/g," ")),u=u.replace(/\r\n/g,`
59
59
  `).replace(/\r/g,`
60
60
  `),u=u.replace(/\n/g,`\r
61
- `),u}class pke extends $e{constructor(){super(...arguments);D(this,"manifest",{id:ds+je.GoogleDriveUploadFile,version:"2.0.0",description:"Upload a file to Google Drive (media / import+copy) with auto content detection and simplified inputs.",initPriority:Ve.High,permissions:[xe.All],contexts:[le.Editor,le.Logic]});D(this,"module",{init:i=>{const r=i.find(a=>a.contextType===le.Logic);if(r){const a=r.get(je.GoogleDriveUploadFile);a&&(a.implementation=this.module.main)}},main:async(i,r)=>{var a,c,e,f,h,m,v,b,A,w,R,O,$,G,x,k,W,te,ee,Q,ne,de,J,ie,se,fe,ue,me,ve,Ae,De,Ce,Le;try{const Ge=((c=(a=r.find(xi=>{var ri,ni;return((ni=(ri=xi.valueOwner)==null?void 0:ri.declaration)==null?void 0:ni.id)===j.operation[je.GoogleDriveUploadFile].inputs.connection.id}))==null?void 0:a.value)==null?void 0:c.valueAsType)??((f=(e=r.find(xi=>{var ri,ni;return((ni=(ri=xi.valueOwner)==null?void 0:ri.declaration)==null?void 0:ni.id)===j.operation[je.GoogleDriveUploadFile].inputs.connection.id}))==null?void 0:e.value)==null?void 0:f.value);if(!(Ge instanceof Kn))return qd(i,"Invalid or missing connection entity");const Ie=((m=(h=r.find(xi=>{var ri,ni;return((ni=(ri=xi.valueOwner)==null?void 0:ri.declaration)==null?void 0:ni.id)===j.operation[je.GoogleDriveUploadFile].inputs.content.id}))==null?void 0:h.value)==null?void 0:m.valueAsType)??((b=(v=r.find(xi=>{var ri,ni;return((ni=(ri=xi.valueOwner)==null?void 0:ri.declaration)==null?void 0:ni.id)===j.operation[je.GoogleDriveUploadFile].inputs.content.id}))==null?void 0:v.value)==null?void 0:b.value),Ue=($=((w=(A=r.find(xi=>{var ri,ni;return((ni=(ri=xi.valueOwner)==null?void 0:ri.declaration)==null?void 0:ni.id)===j.operation[je.GoogleDriveUploadFile].inputs.name.id}))==null?void 0:A.value)==null?void 0:w.valueAsType)??((O=(R=r.find(xi=>{var ri,ni;return((ni=(ri=xi.valueOwner)==null?void 0:ri.declaration)==null?void 0:ni.id)===j.operation[je.GoogleDriveUploadFile].inputs.name.id}))==null?void 0:R.value)==null?void 0:O.value))==null?void 0:$.trim(),We=(((x=(G=r.find(xi=>{var ri,ni;return((ni=(ri=xi.valueOwner)==null?void 0:ri.declaration)==null?void 0:ni.id)===j.operation[je.GoogleDriveUploadFile].inputs.mimeType.id}))==null?void 0:G.value)==null?void 0:x.valueAsType)??((W=(k=r.find(xi=>{var ri,ni;return((ni=(ri=xi.valueOwner)==null?void 0:ri.declaration)==null?void 0:ni.id)===j.operation[je.GoogleDriveUploadFile].inputs.mimeType.id}))==null?void 0:k.value)==null?void 0:W.value))||"application/octet-stream",Se=(((ee=(te=r.find(xi=>{var ri,ni;return((ni=(ri=xi.valueOwner)==null?void 0:ri.declaration)==null?void 0:ni.id)===j.operation[je.GoogleDriveUploadFile].inputs.folderId.id}))==null?void 0:te.value)==null?void 0:ee.valueAsType)??((ne=(Q=r.find(xi=>{var ri,ni;return((ni=(ri=xi.valueOwner)==null?void 0:ri.declaration)==null?void 0:ni.id)===j.operation[je.GoogleDriveUploadFile].inputs.folderId.id}))==null?void 0:Q.value)==null?void 0:ne.value))||void 0,ut=(((J=(de=r.find(xi=>{var ri,ni;return((ni=(ri=xi.valueOwner)==null?void 0:ri.declaration)==null?void 0:ni.id)===j.operation[je.GoogleDriveUploadFile].inputs.description.id}))==null?void 0:de.value)==null?void 0:J.valueAsType)??((se=(ie=r.find(xi=>{var ri,ni;return((ni=(ri=xi.valueOwner)==null?void 0:ri.declaration)==null?void 0:ni.id)===j.operation[je.GoogleDriveUploadFile].inputs.description.id}))==null?void 0:ie.value)==null?void 0:se.value))||void 0,Et=(((ue=(fe=r.find(xi=>{var ri,ni;return((ni=(ri=xi.valueOwner)==null?void 0:ri.declaration)==null?void 0:ni.id)===j.operation[je.GoogleDriveUploadFile].inputs.importMimeType.id}))==null?void 0:fe.value)==null?void 0:ue.valueAsType)??((ve=(me=r.find(xi=>{var ri,ni;return((ni=(ri=xi.valueOwner)==null?void 0:ri.declaration)==null?void 0:ni.id)===j.operation[je.GoogleDriveUploadFile].inputs.importMimeType.id}))==null?void 0:me.value)==null?void 0:ve.value))||"text/plain";if(!Ue)return qd(i,"Missing required input: name");const lt=this.extensionsRegistry.requestContexts(this,[le.Editor])[0],nt=Po(Ge),Di={Authorization:`Bearer ${await lt.getAccessToken()}`},ji=`${((Ae=lt.env)==null?void 0:Ae.API_BASE_URL)+"/editor-runtime"}/v2/external-integrations/proxy/${lt.projectId}/${Dr["google-drive"]}/${nt}`,Rt=async(xi,ri,{params:ni,body:ra,contentType:Un,providerHeaders:xr,responseType:Or}={})=>{const Ht=`${ji}/${Zwi(ri)}`,Ut={...Di};return Un&&(Ut["Content-Type"]=Un),(xr||Or)&&(Ut[qwi]=JSON.stringify({...xr?{headers:xr}:{},...Or?{responseType:Or}:{}})),ys.request({method:xi,url:Ht,params:ni,data:ra,responseType:Or||"json",headers:Ut})},pt=typeof We=="string"&&We.startsWith("application/vnd.google-apps.");if(pt&&(Ie==null||Ie==="")){const xi={name:Ue,mimeType:We};Se&&(xi.parents=[Se]),typeof ut=="string"&&(xi.description=ut);const ri=await Rt("POST","/drive/v3/files",{params:{supportsAllDrives:"true",fields:kv},body:JSON.stringify(xi),contentType:"application/json"});return ri.status!==200&&ri.status!==201?qd(i,`Drive create failed (status=${ri.status})`):tP({file:ri.data})}if(pt&&Ie!=null){let xi=await Wwi(Ie);const ni=((Or,Ht)=>Ht||(Or==="application/vnd.google-apps.spreadsheet"?"text/csv":Or==="application/vnd.google-apps.document"||Or==="application/vnd.google-apps.presentation"?"text/html":"text/plain"))(We,Et),ra=ni.startsWith("text/")&&!/charset=/i.test(ni)?`${ni}; charset=UTF-8`:ni;ni.startsWith("text/csv")&&(xi=zwi(xi));const Un=new TextEncoder().encode(xi);if(Un.byteLength>Jj)return qd(i,`Text body exceeds simple upload limit (${Un.byteLength} bytes).`);let xr;try{const Or=await Rt("POST","/upload/drive/v3/files",{params:{uploadType:"media",supportsAllDrives:"true",fields:kv},body:Un,contentType:ra});if(Or.status!==200&&Or.status!==201)return qd(i,`Drive media upload failed (status=${Or.status})`);if(xr=(De=Or.data)==null?void 0:De.id,!xr)return qd(i,"Drive media upload did not return an id");const Ht={name:Ue,mimeType:We};Se&&(Ht.parents=[Se]),typeof ut=="string"&&(Ht.description=ut);const Ut=await Rt("POST",`/drive/v3/files/${encodeURIComponent(xr)}/copy`,{params:{supportsAllDrives:"true",fields:kv},body:JSON.stringify(Ht),contentType:"application/json"});return Ut.status!==200&&Ut.status!==201?qd(i,`Drive copy-convert failed (status=${Ut.status})`):tP({file:Ut.data})}finally{if(xr)try{await Rt("DELETE",`/drive/v3/files/${encodeURIComponent(xr)}`,{params:{supportsAllDrives:"true"}})}catch{}}}if(Ie==null)return qd(i,"Missing content for non-native upload");const{bytes:Xt,inferredMime:it,isBinary:ht}=await Hwi(Ie),Dt=Xt.byteLength;if(Dt>Jj)return qd(i,`File too large for simple upload (${Dt} bytes).`);const Vr=await Rt("POST","/upload/drive/v3/files",{params:{uploadType:"media",supportsAllDrives:"true",fields:kv},body:Xt,contentType:We||it||(ht?"application/octet-stream":"text/plain; charset=UTF-8")});if(Vr.status!==200&&Vr.status!==201)return qd(i,`Drive media upload failed (status=${Vr.status})`);let ha=Vr.data;const ia=(Ce=Vr.data)==null?void 0:Ce.id;return ia&&(Se||Ue||ut)&&(ha=await Ywi(Rt,ia,Ue,ut,Se)),tP({file:ha})}catch(Ge){const Ie=((Le=Ge.response)==null?void 0:Le.data)||Ge.message||Ge;return X.Logger.error("[Google Drive] Upload document failed:",Ie),{value:i.catchesError||i.errorCalls.length?F.CaughtError:F.UnhandledError,error:Ie,result:null}}}})}}function tP(s){return{value:F.Success,error:null,result:s}}function qd(s,u){return X.Logger.log("[Google Drive] Upload error:",u),{value:s.catchesError||s.errorCalls.length?F.CaughtError:F.UnhandledError,error:u,result:null}}async function Ywi(s,u,i,r,a){const c={};i&&(c.name=i),typeof r=="string"&&(c.description=r);const e={supportsAllDrives:"true",fields:kv},f={...e};a&&(f.addParents=a,f.removeParents="root");let h=await s("PATCH",`/drive/v3/files/${encodeURIComponent(u)}`,{params:f,body:JSON.stringify(c),contentType:"application/json"});if(h.status>=400&&a&&(h=await s("PATCH",`/drive/v3/files/${encodeURIComponent(u)}`,{params:{...e,addParents:a},body:JSON.stringify(c),contentType:"application/json"})),h.status!==200)throw new Error(`Drive metadata update failed (status=${h.status})`);return h.data}class cke extends $e{constructor(){super(...arguments);D(this,"manifest",{id:ds+je.GoogleGeminiGenerateContent,version:"1.0.0",description:"Send Gmail email operation implementation module",initPriority:Ve.High,permissions:[xe.All],contexts:[le.Editor,le.Logic]});D(this,"module",{init:i=>{const r=i.find(a=>a.contextType===le.Logic);if(r){const a=r.get(je.GoogleGeminiGenerateContent);a&&(a.implementation=this.module.main)}},main:async(i,r)=>{var a,c,e,f,h;try{const m=r.find(x=>{var k,W;return((W=(k=x.valueOwner)==null?void 0:k.declaration)==null?void 0:W.id)===j.operation["external-integration--google-gemini--post--generate-content"].inputs.connection.id}),v=(a=m==null?void 0:m.value)==null?void 0:a.valueAsType;if(!v)return{value:i.catchesError||i.errorCalls.length?F.CaughtError:F.UnhandledError,error:"No entity template provided",result:null};if(!(v instanceof Kn))return{value:i.catchesError||i.errorCalls.length?F.CaughtError:F.UnhandledError,error:"Invalid entity template value provided",result:null};const b=r.find(x=>{var k,W;return((W=(k=x.valueOwner)==null?void 0:k.declaration)==null?void 0:W.id)===j.operation["external-integration--google-gemini--post--generate-content"].inputs.prompt.id}),A=(c=b==null?void 0:b.value)==null?void 0:c.value;if(!A||typeof A!="string")return{value:i.catchesError||i.errorCalls.length?F.CaughtError:F.UnhandledError,error:"Invalid prompt value provided",result:null};const w=r.find(x=>{var k,W;return((W=(k=x.valueOwner)==null?void 0:k.declaration)==null?void 0:W.id)===j.operation["external-integration--google-gemini--post--generate-content"].inputs.model.id}),R=(e=w==null?void 0:w.value)==null?void 0:e.value;if(!R||typeof R!="string")return{value:i.catchesError||i.errorCalls.length?F.CaughtError:F.UnhandledError,error:"Invalid model value provided",result:null};const O=this.extensionsRegistry.requestContexts(this,[le.Editor])[0],$=Po(v);console.log("Triggering Google Gemini generate content action with connectionId:",$);const G=await(await ys.post(`${(f=O.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v1/external-integrations/trigger-action/${Dr["google-gemini"]}/${$}/generate-content`,{payload:{prompt:A,model:R}},{headers:{"Content-Type":"application/json",Authorization:`Bearer ${await O.getAccessToken()}`}})).data;return X.Logger.log("[Google Gemini] Generate content action response:",G),{value:F.Success,error:null,result:{content:G.content}}}catch(m){const v=((h=m.response)==null?void 0:h.data)||m.message||m;return X.Logger.error("[Google Gemini] Generate content failed:",v),{value:i.catchesError||i.errorCalls.length?F.CaughtError:F.UnhandledError,error:v,result:null}}}})}}class qP extends DD{constructor(u,i,r=i.projectId){super(u,le.Editor),this._editor=i,this.id=r}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(u){this._editor.undoableStackValueIndex=u}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(u){return this._editor.removeValueByOwnerId(u)}removeValue(u){return this._editor.removeValue(u)}undo(){return this._editor.undo()}redo(){return this._editor.redo()}initTest(u,i){return this._editor.initTest(u,i)}removeTest(u){return this._editor.removeTest(u)}async copyEntities(u,i={}){return this._editor.copyEntities(u,i)}resolveInitialChildrenPositions(u,i,r){return this._editor.resolveInitialChildrenPositions(u,i,r)}publish(){return this._editor.publish()}loadGivenPublication(u){return this._editor.loadGivenPublication(u)}validateProjectState(u){return this._editor.validateProjectState(u)}requestActiveDynamicValue(u,i=!1){return this._editor.requestActiveDynamicValue(u,i)}getValueTypePreference(u){return this._editor.getValueTypePreference(u)}setValueTypePreference(u,i){return this._editor.setValueTypePreference(u,i)}implementFeature(u){return this._editor.implementFeature(u)}getProjectRoles(){return this._editor.getProjectRoles()}getLastPublishedVersionLogic(u){return this._editor.getLastPublishedVersionLogic(u)}initialLoads(u){return this._editor.initialLoads(u)}moveBranchHeadToVersion(u,i,r){return this._editor.moveBranchHeadToVersion(u,i,r)}loadInitialBranchHead(){return this._editor.loadInitialBranchHead()}}function Jwi(s,u){return u instanceof qP?u:new qP(s,u)}class ZP extends DD{constructor(u,i){super(u,le.PublicationRun),this._publicationRun=i}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 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 Qwi(s,u){return u instanceof ZP?u:new ZP(s,u)}function Xwi(s){s.register(new QVe(s)),s.register(new JVe(s)),s.register(new HVe(s)),s.register(new zVe(s)),s.register(new YVe(s)),s.register(new WVe(s)),s.register(new VMe(s)),s.register(new xMe(s)),s.register(new $Me(s)),s.register(new BMe(s)),s.register(new LMe(s)),s.register(new MMe(s)),s.register(new IGe(s)),s.register(new RGe(s)),s.register(new DGe(s)),s.register(new wGe(s)),s.register(new CGe(s)),s.register(new OGe(s)),s.register(new _Ge(s)),s.register(new PGe(s)),s.register(new NGe(s)),s.register(new VGe(s)),s.register(new NBe(s)),s.register(new VBe(s)),s.register(new xBe(s)),s.register(new $Be(s)),s.register(new LBe(s)),s.register(new BBe(s)),s.register(new MBe(s)),s.register(new GBe(s)),s.register(new kBe(s)),s.register(new UBe(s)),s.register(new jBe(s)),s.register(new FBe(s)),s.register(new KBe(s)),s.register(new SBe(s)),s.register(new qBe(s)),s.register(new ZBe(s)),s.register(new HBe(s)),s.register(new WBe(s)),s.register(new zBe(s)),s.register(new QBe(s)),s.register(new XBe(s)),s.register(new eMe(s)),s.register(new JLe(s)),s.register(new QLe(s)),s.register(new XLe(s)),s.register(new eBe(s)),s.register(new tBe(s)),s.register(new iBe(s)),s.register(new rBe(s)),s.register(new nBe(s)),s.register(new aBe(s)),s.register(new lBe(s)),s.register(new oBe(s)),s.register(new dBe(s)),s.register(new uBe(s)),s.register(new pBe(s)),s.register(new mLe(s)),s.register(new j2e(s)),s.register(new k2e(s)),s.register(new U2e(s)),s.register(new h$e(s)),s.register(new m$e(s)),s.register(new T$e(s)),s.register(new v$e(s)),s.register(new E$e(s)),s.register(new b$e(s)),s.register(new A$e(s)),s.register(new g$e(s)),s.register(new I$e(s)),s.register(new B$e(s)),s.register(new fLe(s)),s.register(new yLe(s)),s.register(new hLe(s)),s.register(new R$e(s)),s.register(new D$e(s)),s.register(new w$e(s)),s.register(new C$e(s)),s.register(new O$e(s)),s.register(new _$e(s)),s.register(new P$e(s)),s.register(new N$e(s)),s.register(new V$e(s)),s.register(new x$e(s)),s.register(new $$e(s)),s.register(new L$e(s)),s.register(new M$e(s)),s.register(new G$e(s)),s.register(new k$e(s)),s.register(new U$e(s)),s.register(new j$e(s)),s.register(new F$e(s)),s.register(new K$e(s)),s.register(new S$e(s)),s.register(new q$e(s)),s.register(new Z$e(s)),s.register(new H$e(s)),s.register(new W$e(s)),s.register(new rLe(s)),s.register(new nLe(s)),s.register(new aLe(s)),s.register(new z$e(s)),s.register(new Y$e(s)),s.register(new J$e(s)),s.register(new Q$e(s)),s.register(new X$e(s)),s.register(new eLe(s)),s.register(new tLe(s)),s.register(new iLe(s)),s.register(new q2e(s)),s.register(new Z2e(s)),s.register(new H2e(s)),s.register(new W2e(s)),s.register(new F2e(s)),s.register(new K2e(s)),s.register(new S2e(s)),s.register(new z2e(s)),s.register(new J2e(s)),s.register(new X2e(s)),s.register(new Y2e(s)),s.register(new Q2e(s)),s.register(new eGe(s)),s.register(new rGe(s)),s.register(new tGe(s)),s.register(new iGe(s)),s.register(new cBe(s)),s.register(new mBe(s)),s.register(new TBe(s)),s.register(new bBe(s)),s.register(new ABe(s)),s.register(new gBe(s)),s.register(new IBe(s)),s.register(new RBe(s)),s.register(new DBe(s)),s.register(new wBe(s)),s.register(new CBe(s)),s.register(new vBe(s)),s.register(new EBe(s)),s.register(new yBe(s)),s.register(new hBe(s)),s.register(new fBe(s)),s.register(new sBe(s)),s.register(new _Be(s)),s.register(new PBe(s)),s.register(new OBe(s)),s.register(new kMe(s)),s.register(new d2e(s)),s.register(new o2e(s)),s.register(new u2e(s)),s.register(new p2e(s)),s.register(new FMe(s)),s.register(new KMe(s)),s.register(new zMe(s)),s.register(new HMe(s)),s.register(new s2e(s)),s.register(new e2e(s)),s.register(new i2e(s)),s.register(new n2e(s)),s.register(new r2e(s)),s.register(new WMe(s)),s.register(new JMe(s)),s.register(new QMe(s)),s.register(new YMe(s)),s.register(new GMe(s)),s.register(new SMe(s)),s.register(new t2e(s)),s.register(new y2e(s)),s.register(new kP(s)),s.register(new jMe(s)),s.register(new qMe(s)),s.register(new UMe(s)),s.register(new a2e(s)),s.register(new ZMe(s)),s.register(new XMe(s)),s.register(new l2e(s)),s.register(new f2e(s)),s.register(new c2e(s)),s.register(new h2e(s)),s.register(new kP(s)),s.register(new T2e(s)),s.register(new m2e(s)),s.register(new v2e(s)),s.register(new hMe(s)),s.register(new mMe(s)),s.register(new TMe(s)),s.register(new iMe(s)),s.register(new JBe(s)),s.register(new sMe(s)),s.register(new uMe(s)),s.register(new YBe(s)),s.register(new pMe(s)),s.register(new yMe(s)),s.register(new oMe(s)),s.register(new lMe(s)),s.register(new UI(s)),s.register(new vMe(s)),s.register(new EMe(s)),s.register(new dMe(s)),s.register(new fMe(s)),s.register(new cMe(s)),s.register(new aMe(s)),s.register(new nMe(s)),s.register(new rMe(s)),s.register(new tMe(s)),s.register(new gMe(s)),s.register(new AMe(s)),s.register(new IMe(s)),s.register(new bMe(s)),s.register(new dLe(s)),s.register(new sLe(s)),s.register(new oLe(s)),s.register(new uLe(s)),s.register(new pLe(s)),s.register(new lLe(s)),s.register(new cLe(s)),s.register(new xGe(s)),s.register(new kGe(s)),s.register(new jGe(s)),s.register(new KGe(s)),s.register(new GGe(s)),s.register(new UGe(s)),s.register(new FGe(s)),s.register(new MGe(s)),s.register(new BGe(s)),s.register(new LGe(s)),s.register(new $Ge(s)),s.register(new WGe(s)),s.register(new zGe(s)),s.register(new ZGe(s)),s.register(new HGe(s)),s.register(new gGe(s)),s.register(new SGe(s)),s.register(new qGe(s)),s.register(new JGe(s)),s.register(new YGe(s)),s.register(new QGe(s)),s.register(new XGe(s)),s.register(new eke(s)),s.register(new XVe(s)),s.register(new exe(s)),s.register(new GI(s)),s.register(new kI(s)),s.register(new rke(s)),s.register(new nke(s)),s.register(new lke(s)),s.register(new cke(s)),s.register(new dke(s)),s.register(new ake(s)),s.register(new ske(s)),s.register(new uke(s)),s.register(new oke(s)),s.register(new pke(s))}class vL{constructor(u=new X.Events("extensions-registry-fallback-events")){D(this,"extensionsRegistry",new Map);D(this,"initialized",new Set);D(this,"initializedContexts",new Set);D(this,"onResolveEditorContextCallback",()=>null);D(this,"onResolveProjectLogicContextCallback",()=>null);D(this,"onResolveEditorGUIContextCallback",()=>null);D(this,"onResolveGUIContextCallback",()=>null);D(this,"onResolveCompileContextCallback",()=>null);D(this,"onResolvePublicationRunContextCallback",()=>null);this.events=u,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(u){this.onResolveEditorContextCallback=u}onResolveProjectLogicContext(u){this.onResolveProjectLogicContextCallback=u}onResolveGUIContext(u){this.onResolveGUIContextCallback=u}onResolveEditorGUIContext(u){this.onResolveEditorGUIContextCallback=u}onResolveCompileContext(u){this.onResolveCompileContextCallback=u}onResolvePublicationRunContext(u){this.onResolvePublicationRunContextCallback=u}get extensionInOrder(){return Array.from(this.extensionsRegistry.values()).sort((u,i)=>(u.manifest.initPriority||Ve.Normal)-(i.manifest.initPriority||Ve.Normal))}async setup(){Xwi(this),X.Logger.log("Initializing extensions without context..."),this.initForReady()}requestContext(u){switch(u){case le.Editor:return this.onResolveEditorContextCallback();case le.Logic:return this.onResolveProjectLogicContextCallback();case le.EditorGUI:return this.onResolveEditorGUIContextCallback();case le.Compile:return this.onResolveCompileContextCallback();case le.PublicationRun:return this.onResolvePublicationRunContextCallback();case le.GUI:return this.onResolveGUIContextCallback();case le.EditorGUI:return this.onResolveEditorGUIContextCallback();default:throw new Error(`Unknown context type: ${u}`)}}requestContexts(u,i=[]){const r=[];i.length===0&&(i=u.manifest.contexts);for(const a of i){const c=this.requestContext(a);c&&r.push(c)}return r}requestExtension(u){const i=this.extensionsRegistry.get(u);if(i)return i;throw new Error(`Unknown extension: ${u}`)}register(u){this.extensionsRegistry.set(u.manifest.id,u)}async initAll(){var u,i;for(const r of this.extensionInOrder)if(r.module.init&&!this.initialized.has(r.manifest.id)){const a=r.manifest.contexts.map(c=>this.requestContext(c)).filter(c=>c!==null);a.length&&(await((i=(u=r.module).init)==null?void 0:i.call(u,a)),this.initialized.add(r.manifest.id))}else!r.module.init&&!this.initialized.has(r.manifest.id)&&this.initialized.add(r.manifest.id)}async initForReady(){X.Logger.log("Initializing extensions for ready contexts...");for(const u of this.extensionInOrder)if(u.module.init&&!this.initialized.has(u.manifest.id)){X.Logger.log("Initializing "+u.manifest.id+" extension...");const i=this.requestContexts(u);u.manifest.contexts.every(a=>!!i.find(c=>c.contextType===a))?(await u.module.init(i),this.initialized.add(u.manifest.id)):X.Logger.warn(`Skipping initialization of ${u.manifest.id} extension, not all contexts are ready.`,`Required contexts: ${u.manifest.contexts.join(", ")}`,`Available contexts: ${i.map(a=>a.contextType).join(", ")}`)}else!u.module.init&&!this.initialized.has(u.manifest.id)?(X.Logger.log("Set "+u.manifest.id+" extension as initialized by default..."),this.initialized.add(u.manifest.id)):X.Logger.log(`Skipping initialization of ${u.manifest.id} extension, already initialized or no init method defined.`)}async destroyAll(){for(const u of[...this.extensionInOrder].reverse())u.module.destroy&&await u.module.destroy();this.events.destroy()}on(u,i){this.events.on(u,i)}emit(u,...i){this.events.emit(u,...i)}off(u,i){this.events.off(u,i)}emitAsync(u,...i){return this.events.emitAsync(u,...i)}emitAsyncAll(u,...i){return this.events.emitAsyncAll(u,...i)}emitAsyncAllSettled(u,...i){return this.events.emitAsyncAllSettled(u,...i)}emitAsyncSequentially(u,...i){return this.events.emitAsyncSequentially(u,...i)}emitAsyncSequentiallyAll(u,...i){return this.events.emitAsyncSequentiallyAll(u,...i)}emitAsyncSequentiallyAllSettled(u,...i){return this.events.emitAsyncSequentiallyAllSettled(u,...i)}async contextAvailable(u){if(this.initializedContexts.has(u)){X.Logger.warn(`Context ${u} is already initialized. Skipping re-initialization.`);return}switch(this.initializedContexts.add(u),u){case le.Editor:{if(!this.onResolveEditorContextCallback)throw new Error("No editor context resolver callback set. Call onResolveEditorContext first.");break}case le.Logic:{if(!this.onResolveProjectLogicContextCallback)throw new Error("No project logic context resolver callback set. Call onResolveProjectLogicContext first.");break}}X.Logger.log(`Context ${u} is now available. Initializing extensions for this context...`),await this.initForReady()}getValueTypePreference(u){return window.localStorage.getItem("dynamic-value-type-preference--"+u)||null}setValueTypePreference(u,i){window.localStorage.setItem("dynamic-value-type-preference--"+u,(i==null?void 0:i.toString())||""),this.emit(u,{})}}let oI=null;const EL={requestExtension:s=>(oI||(oI=new vL,oI.setup()),oI.requestExtension(s))};function ec(s){return!(s instanceof Error)&&typeof s=="object"&&s!==null?s:s instanceof Error?{name:s.name,message:s.message,stack:s.stack,...s}:s}function Qj(s){var u,i,r;if(s&&typeof s=="object"&&"value"in s){const a=s;return{single:((u=a.value)==null?void 0:u.valueAsTypeSingle)??((i=a.value)==null?void 0:i.value),list:((r=a.value)==null?void 0:r.valueAsTypeList)??null}}return{single:s,list:Array.isArray(s)?s:null}}const tc={onBeforeEntityExecution:async()=>{},onEntityExecuted:async()=>{}};class HP extends Error{constructor(){super("Execution was stopped"),this.name="ExecutionStoppedError"}}var bL=(s=>(s.FinishedSuccess="finished-success",s.FinishedError="finished-error",s.Running="running",s.Paused="paused",s.Stopped="stopped",s.NotStarted="not-started",s))(bL||{});const fke={...EL,getValueTypePreference:()=>null,setValueTypePreference:()=>{}};class am extends X.Events{constructor(i,r,a,c=null,e=fke){super();D(this,"project");D(this,"entryPoint");D(this,"state","not-started");D(this,"events",new X.Events("fe-exec-inst-events"));D(this,"entities",[]);D(this,"parentExecution",null);D(this,"executing",[]);D(this,"executed",[]);D(this,"skipped",[]);D(this,"scheduled",[]);D(this,"localTestValues");D(this,"resolvedValues");D(this,"persistedExecutionResults");D(this,"lastExecutionResults");D(this,"onAddToSkippedListCallback",null);D(this,"onRemoveFromSkippedListCallback",null);D(this,"onAddEntityCallback",null);D(this,"onRemoveEntityCallback",null);D(this,"onAbortExecutionCallback",null);this.parentContext=e,this.entities=r,this.entryPoint=a,this.project=i,this.parentExecution=c,this.localTestValues=new Mv(L.UUID.uuid(),this.project),this.resolvedValues=new Mv(L.UUID.uuid(),this.project),this.persistedExecutionResults=new Mv(L.UUID.uuid(),this.project),this.lastExecutionResults=new Mv(L.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 i=this;for(;i.parentExecution;)i=i.parentExecution;return i}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 HP;for(;this.isPaused();){if(this.isStopped())throw new HP;await new Promise(i=>setTimeout(i,100))}}skip(i){this.hasEntity(i)&&(this.removeFromScheduledList(i),!this.skipped.includes(i)&&(this.skipped.push(i),this.onAddToSkippedListCallback&&this.onAddToSkippedListCallback(i),Ar.includes(i.type)&&Nt(i).forEach(r=>this.skip(r))))}async schedule(i,r,a){if(this.hasExecuted(i))return null;if(Ti.includes(i.type))return this.executeBranch(i,a,r);if(gr.includes(i.type)){if(i.calledBy.every(e=>this.hasExecuted(e)||!this.hasEntity(e)))return this.executeBranch(i,a,r);this.scheduled.includes(i)||this.scheduled.push(i)}return null}mergeExernalValuesWithInternalInputs(i,r){const a=[];return mi.includes(r.type)?a.push(...r.inputs.filter(e=>Dy(e))):[...ei,...Ti].includes(r.type)?a.push(...r.inputs):Jt.includes(r.type)&&a.push(...r.outputs.filter(e=>Dy(e))),a.map(e=>{var h;let f=i.find(m=>m.valueOwner.id===e.id);if(f)return f;if(!f&&Ti.includes(r.type)&&(f=i.find(m=>{var v;return((v=m.valueOwner.declaration)==null?void 0:v.id)===e.id})),f){const m=(h=f.value)==null?void 0:h.clone(null);return m==null||m.setStandaloneParent(e,null),{...f,valueOwner:e,value:m||null,inheritanceLink:{sources:[f],target:e}}}return Cn.includes(e.type)?Fo(e,this.valueResolutionContext):Xu(e,this.valueResolutionContext)}).reduce((e,f)=>{const h=Xd(f==null?void 0:f.valueOwner,this.project),m=f?[f]:[];return h.forEach(v=>{var w,R,O;if(v.id===(f==null?void 0:f.valueOwner.id))return;const b=Bi(v.getDataType(null),v,this.project);b==null||b.metaSync({value:(w=f==null?void 0:f.value)==null?void 0:w.value},null),b==null||b.setValueAsTypeList(((R=f==null?void 0:f.value)==null?void 0:R.valueAsTypeList)||null),b==null||b.setValueAsTypeSingle(((O=f==null?void 0:f.value)==null?void 0:O.valueAsTypeSingle)||null);const A={...f,valueOwner:v,value:b};m.push(A)}),[...e,...m]},[]).sort((e,f)=>e.valueOwner.index-f.valueOwner.index)}inheritValuesFromContext(i){this.localTestValues=i.localTestValues,this.resolvedValues=i.resolvedValues,this.persistedExecutionResults=i.persistedExecutionResults}async executeInternalCall(i,r,a,c={}){var f,h;this.logBeforeExecution("executeInternalCall",i,r);const e={...tc,...c};try{let m={value:F.Success,error:null,result:null};if(r.sort((O,$)=>O.valueOwner.index-$.valueOwner.index),Object.values(yn).includes(i.declaration.id)){const O=this.parentContext.requestExtension(ds+i.declaration.id).module.main;O?m=await O(i,r,this):X.Logger.warn(`No implementation found for built-in function: ${i.declaration.id}`)}else{const O=await this.executeDetachedFullFunctionDeclarationLogic(i.declaration,r,a,e);m={value:O.value,error:O.error,result:O.result}}let v=null;if(m.error&&i.error){X.Logger.warn("Raw error executing entity: ",m.error);const{single:O,list:$}=Qj(m.error),G=ec(O),x=(f=i.error)==null?void 0:f.getDataType(null),k=Bi(x||null,i.error,a);if(x!=null&&x.asType)$!==null?k==null||k.setValueAsTypeList($):k==null||k.setValueAsTypeSingle(O);else{const W=sn(G)?JSON.stringify(G,null,2):G;k==null||k.metaSync({value:W},null)}v={valueOwner:i.error,type:Ke.ExecutionResult,inheritanceLink:null,value:k}}const b=i==null?void 0:i.getDataType(null),A=Bi(b,i,a),{single:w,list:R}=Qj(m.result);return b!=null&&b.asType?R!==null?A==null||A.setValueAsTypeList(R):A==null||A.setValueAsTypeSingle(w):A==null||A.metaSync({value:w},null),{value:m.value,entity:i,error:v,result:{value:A||null,valueOwner:i,type:Ke.ExecutionResult,inheritanceLink:null}}}catch(m){if(m&&(m.name==="ExecutionStoppedError"||m.message==="Execution was stopped"))throw m;X.Logger.warn("Internal call execution error: ",m);let v=null;if(i.error){const b=ec(m),A=(h=i.error)==null?void 0:h.getDataType(null),w=Bi(A,i.error,a);if(A!=null&&A.asType)w==null||w.setValueAsTypeSingle(m);else{const R=sn(b)?JSON.stringify(b,null,2):b;w==null||w.metaSync({value:R},null)}v={valueOwner:i.error,type:Ke.ExecutionResult,inheritanceLink:null,value:w}}return{value:i.catchesError||i.errorCalls.length?F.CaughtError:F.UnhandledError,entity:i,error:v,result:null}}}static async executeOperation(i,r,a,c){var e,f;c?c.logBeforeExecution("executeOperation",i,r):console.log(`executeOperation (${i.type}) -> [${ye(i,a)}] Inputs:${r.length?`
61
+ `),u}class pke extends $e{constructor(){super(...arguments);D(this,"manifest",{id:ds+je.GoogleDriveUploadFile,version:"2.0.0",description:"Upload a file to Google Drive (media / import+copy) with auto content detection and simplified inputs.",initPriority:Ve.High,permissions:[xe.All],contexts:[le.Editor,le.Logic]});D(this,"module",{init:i=>{const r=i.find(a=>a.contextType===le.Logic);if(r){const a=r.get(je.GoogleDriveUploadFile);a&&(a.implementation=this.module.main)}},main:async(i,r)=>{var a,c,e,f,h,m,v,b,A,w,R,O,$,G,x,k,W,te,ee,Q,ne,de,J,ie,se,fe,ue,me,ve,Ae,De,Ce,Le;try{const Ge=((c=(a=r.find(xi=>{var ri,ni;return((ni=(ri=xi.valueOwner)==null?void 0:ri.declaration)==null?void 0:ni.id)===j.operation[je.GoogleDriveUploadFile].inputs.connection.id}))==null?void 0:a.value)==null?void 0:c.valueAsType)??((f=(e=r.find(xi=>{var ri,ni;return((ni=(ri=xi.valueOwner)==null?void 0:ri.declaration)==null?void 0:ni.id)===j.operation[je.GoogleDriveUploadFile].inputs.connection.id}))==null?void 0:e.value)==null?void 0:f.value);if(!(Ge instanceof Kn))return qd(i,"Invalid or missing connection entity");const Ie=((m=(h=r.find(xi=>{var ri,ni;return((ni=(ri=xi.valueOwner)==null?void 0:ri.declaration)==null?void 0:ni.id)===j.operation[je.GoogleDriveUploadFile].inputs.content.id}))==null?void 0:h.value)==null?void 0:m.valueAsType)??((b=(v=r.find(xi=>{var ri,ni;return((ni=(ri=xi.valueOwner)==null?void 0:ri.declaration)==null?void 0:ni.id)===j.operation[je.GoogleDriveUploadFile].inputs.content.id}))==null?void 0:v.value)==null?void 0:b.value),Ue=($=((w=(A=r.find(xi=>{var ri,ni;return((ni=(ri=xi.valueOwner)==null?void 0:ri.declaration)==null?void 0:ni.id)===j.operation[je.GoogleDriveUploadFile].inputs.name.id}))==null?void 0:A.value)==null?void 0:w.valueAsType)??((O=(R=r.find(xi=>{var ri,ni;return((ni=(ri=xi.valueOwner)==null?void 0:ri.declaration)==null?void 0:ni.id)===j.operation[je.GoogleDriveUploadFile].inputs.name.id}))==null?void 0:R.value)==null?void 0:O.value))==null?void 0:$.trim(),We=(((x=(G=r.find(xi=>{var ri,ni;return((ni=(ri=xi.valueOwner)==null?void 0:ri.declaration)==null?void 0:ni.id)===j.operation[je.GoogleDriveUploadFile].inputs.mimeType.id}))==null?void 0:G.value)==null?void 0:x.valueAsType)??((W=(k=r.find(xi=>{var ri,ni;return((ni=(ri=xi.valueOwner)==null?void 0:ri.declaration)==null?void 0:ni.id)===j.operation[je.GoogleDriveUploadFile].inputs.mimeType.id}))==null?void 0:k.value)==null?void 0:W.value))||"application/octet-stream",Se=(((ee=(te=r.find(xi=>{var ri,ni;return((ni=(ri=xi.valueOwner)==null?void 0:ri.declaration)==null?void 0:ni.id)===j.operation[je.GoogleDriveUploadFile].inputs.folderId.id}))==null?void 0:te.value)==null?void 0:ee.valueAsType)??((ne=(Q=r.find(xi=>{var ri,ni;return((ni=(ri=xi.valueOwner)==null?void 0:ri.declaration)==null?void 0:ni.id)===j.operation[je.GoogleDriveUploadFile].inputs.folderId.id}))==null?void 0:Q.value)==null?void 0:ne.value))||void 0,ut=(((J=(de=r.find(xi=>{var ri,ni;return((ni=(ri=xi.valueOwner)==null?void 0:ri.declaration)==null?void 0:ni.id)===j.operation[je.GoogleDriveUploadFile].inputs.description.id}))==null?void 0:de.value)==null?void 0:J.valueAsType)??((se=(ie=r.find(xi=>{var ri,ni;return((ni=(ri=xi.valueOwner)==null?void 0:ri.declaration)==null?void 0:ni.id)===j.operation[je.GoogleDriveUploadFile].inputs.description.id}))==null?void 0:ie.value)==null?void 0:se.value))||void 0,Et=(((ue=(fe=r.find(xi=>{var ri,ni;return((ni=(ri=xi.valueOwner)==null?void 0:ri.declaration)==null?void 0:ni.id)===j.operation[je.GoogleDriveUploadFile].inputs.importMimeType.id}))==null?void 0:fe.value)==null?void 0:ue.valueAsType)??((ve=(me=r.find(xi=>{var ri,ni;return((ni=(ri=xi.valueOwner)==null?void 0:ri.declaration)==null?void 0:ni.id)===j.operation[je.GoogleDriveUploadFile].inputs.importMimeType.id}))==null?void 0:me.value)==null?void 0:ve.value))||"text/plain";if(!Ue)return qd(i,"Missing required input: name");const lt=this.extensionsRegistry.requestContexts(this,[le.Editor])[0],nt=Po(Ge),Di={Authorization:`Bearer ${await lt.getAccessToken()}`},ji=`${((Ae=lt.env)==null?void 0:Ae.API_BASE_URL)+"/editor-runtime"}/v2/external-integrations/proxy/${lt.projectId}/${Dr["google-drive"]}/${nt}`,Rt=async(xi,ri,{params:ni,body:ra,contentType:Un,providerHeaders:xr,responseType:Or}={})=>{const Ht=`${ji}/${Zwi(ri)}`,Ut={...Di};return Un&&(Ut["Content-Type"]=Un),(xr||Or)&&(Ut[qwi]=JSON.stringify({...xr?{headers:xr}:{},...Or?{responseType:Or}:{}})),ys.request({method:xi,url:Ht,params:ni,data:ra,responseType:Or||"json",headers:Ut})},pt=typeof We=="string"&&We.startsWith("application/vnd.google-apps.");if(pt&&(Ie==null||Ie==="")){const xi={name:Ue,mimeType:We};Se&&(xi.parents=[Se]),typeof ut=="string"&&(xi.description=ut);const ri=await Rt("POST","/drive/v3/files",{params:{supportsAllDrives:"true",fields:kv},body:JSON.stringify(xi),contentType:"application/json"});return ri.status!==200&&ri.status!==201?qd(i,`Drive create failed (status=${ri.status})`):tP({file:ri.data})}if(pt&&Ie!=null){let xi=await Wwi(Ie);const ni=((Or,Ht)=>Ht||(Or==="application/vnd.google-apps.spreadsheet"?"text/csv":Or==="application/vnd.google-apps.document"||Or==="application/vnd.google-apps.presentation"?"text/html":"text/plain"))(We,Et),ra=ni.startsWith("text/")&&!/charset=/i.test(ni)?`${ni}; charset=UTF-8`:ni;ni.startsWith("text/csv")&&(xi=zwi(xi));const Un=new TextEncoder().encode(xi);if(Un.byteLength>Jj)return qd(i,`Text body exceeds simple upload limit (${Un.byteLength} bytes).`);let xr;try{const Or=await Rt("POST","/upload/drive/v3/files",{params:{uploadType:"media",supportsAllDrives:"true",fields:kv},body:Un,contentType:ra});if(Or.status!==200&&Or.status!==201)return qd(i,`Drive media upload failed (status=${Or.status})`);if(xr=(De=Or.data)==null?void 0:De.id,!xr)return qd(i,"Drive media upload did not return an id");const Ht={name:Ue,mimeType:We};Se&&(Ht.parents=[Se]),typeof ut=="string"&&(Ht.description=ut);const Ut=await Rt("POST",`/drive/v3/files/${encodeURIComponent(xr)}/copy`,{params:{supportsAllDrives:"true",fields:kv},body:JSON.stringify(Ht),contentType:"application/json"});return Ut.status!==200&&Ut.status!==201?qd(i,`Drive copy-convert failed (status=${Ut.status})`):tP({file:Ut.data})}finally{if(xr)try{await Rt("DELETE",`/drive/v3/files/${encodeURIComponent(xr)}`,{params:{supportsAllDrives:"true"}})}catch{}}}if(Ie==null)return qd(i,"Missing content for non-native upload");const{bytes:Xt,inferredMime:it,isBinary:ht}=await Hwi(Ie),Dt=Xt.byteLength;if(Dt>Jj)return qd(i,`File too large for simple upload (${Dt} bytes).`);const Vr=await Rt("POST","/upload/drive/v3/files",{params:{uploadType:"media",supportsAllDrives:"true",fields:kv},body:Xt,contentType:We||it||(ht?"application/octet-stream":"text/plain; charset=UTF-8")});if(Vr.status!==200&&Vr.status!==201)return qd(i,`Drive media upload failed (status=${Vr.status})`);let ha=Vr.data;const ia=(Ce=Vr.data)==null?void 0:Ce.id;return ia&&(Se||Ue||ut)&&(ha=await Ywi(Rt,ia,Ue,ut,Se)),tP({file:ha})}catch(Ge){const Ie=((Le=Ge.response)==null?void 0:Le.data)||Ge.message||Ge;return X.Logger.error("[Google Drive] Upload document failed:",Ie),{value:i.catchesError||i.errorCalls.length?F.CaughtError:F.UnhandledError,error:Ie,result:null}}}})}}function tP(s){return{value:F.Success,error:null,result:s}}function qd(s,u){return X.Logger.log("[Google Drive] Upload error:",u),{value:s.catchesError||s.errorCalls.length?F.CaughtError:F.UnhandledError,error:u,result:null}}async function Ywi(s,u,i,r,a){const c={};i&&(c.name=i),typeof r=="string"&&(c.description=r);const e={supportsAllDrives:"true",fields:kv},f={...e};a&&(f.addParents=a,f.removeParents="root");let h=await s("PATCH",`/drive/v3/files/${encodeURIComponent(u)}`,{params:f,body:JSON.stringify(c),contentType:"application/json"});if(h.status>=400&&a&&(h=await s("PATCH",`/drive/v3/files/${encodeURIComponent(u)}`,{params:{...e,addParents:a},body:JSON.stringify(c),contentType:"application/json"})),h.status!==200)throw new Error(`Drive metadata update failed (status=${h.status})`);return h.data}class cke extends $e{constructor(){super(...arguments);D(this,"manifest",{id:ds+je.GoogleGeminiGenerateContent,version:"1.0.0",description:"Send Gmail email operation implementation module",initPriority:Ve.High,permissions:[xe.All],contexts:[le.Editor,le.Logic]});D(this,"module",{init:i=>{const r=i.find(a=>a.contextType===le.Logic);if(r){const a=r.get(je.GoogleGeminiGenerateContent);a&&(a.implementation=this.module.main)}},main:async(i,r)=>{var a,c,e,f,h;try{const m=r.find(x=>{var k,W;return((W=(k=x.valueOwner)==null?void 0:k.declaration)==null?void 0:W.id)===j.operation["external-integration--google-gemini--post--generate-content"].inputs.connection.id}),v=(a=m==null?void 0:m.value)==null?void 0:a.valueAsType;if(!v)return{value:i.catchesError||i.errorCalls.length?F.CaughtError:F.UnhandledError,error:"No entity template provided",result:null};if(!(v instanceof Kn))return{value:i.catchesError||i.errorCalls.length?F.CaughtError:F.UnhandledError,error:"Invalid entity template value provided",result:null};const b=r.find(x=>{var k,W;return((W=(k=x.valueOwner)==null?void 0:k.declaration)==null?void 0:W.id)===j.operation["external-integration--google-gemini--post--generate-content"].inputs.prompt.id}),A=(c=b==null?void 0:b.value)==null?void 0:c.value;if(!A||typeof A!="string")return{value:i.catchesError||i.errorCalls.length?F.CaughtError:F.UnhandledError,error:"Invalid prompt value provided",result:null};const w=r.find(x=>{var k,W;return((W=(k=x.valueOwner)==null?void 0:k.declaration)==null?void 0:W.id)===j.operation["external-integration--google-gemini--post--generate-content"].inputs.model.id}),R=(e=w==null?void 0:w.value)==null?void 0:e.value;if(!R||typeof R!="string")return{value:i.catchesError||i.errorCalls.length?F.CaughtError:F.UnhandledError,error:"Invalid model value provided",result:null};const O=this.extensionsRegistry.requestContexts(this,[le.Editor])[0],$=Po(v);console.log("Triggering Google Gemini generate content action with connectionId:",$);const G=await(await ys.post(`${(f=O.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v1/external-integrations/trigger-action/${Dr["google-gemini"]}/${$}/generate-content`,{payload:{prompt:A,model:R}},{headers:{"Content-Type":"application/json",Authorization:`Bearer ${await O.getAccessToken()}`}})).data;return X.Logger.log("[Google Gemini] Generate content action response:",G),{value:F.Success,error:null,result:{content:G.content}}}catch(m){const v=((h=m.response)==null?void 0:h.data)||m.message||m;return X.Logger.error("[Google Gemini] Generate content failed:",v),{value:i.catchesError||i.errorCalls.length?F.CaughtError:F.UnhandledError,error:v,result:null}}}})}}class qP extends DD{constructor(u,i,r=i.projectId){super(u,le.Editor),this._editor=i,this.id=r}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(u){this._editor.undoableStackValueIndex=u}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(u){return this._editor.removeValueByOwnerId(u)}removeValue(u){return this._editor.removeValue(u)}undo(){return this._editor.undo()}redo(){return this._editor.redo()}initTest(u,i){return this._editor.initTest(u,i)}removeTest(u){return this._editor.removeTest(u)}async copyEntities(u,i={}){return this._editor.copyEntities(u,i)}resolveInitialChildrenPositions(u,i,r){return this._editor.resolveInitialChildrenPositions(u,i,r)}publish(){return this._editor.publish()}loadGivenPublication(u){return this._editor.loadGivenPublication(u)}validateProjectState(u){return this._editor.validateProjectState(u)}requestActiveDynamicValue(u,i=!1){return this._editor.requestActiveDynamicValue(u,i)}getValueTypePreference(u){return this._editor.getValueTypePreference(u)}setValueTypePreference(u,i){return this._editor.setValueTypePreference(u,i)}implementFeature(u){return this._editor.implementFeature(u)}getProjectRoles(){return this._editor.getProjectRoles()}getLastPublishedVersionLogic(u){return this._editor.getLastPublishedVersionLogic(u)}initialLoads(u){return this._editor.initialLoads(u)}moveBranchHeadToVersion(u,i,r){return this._editor.moveBranchHeadToVersion(u,i,r)}loadInitialBranchHead(){return this._editor.loadInitialBranchHead()}}function Jwi(s,u){return u instanceof qP?u:new qP(s,u)}class ZP extends DD{constructor(u,i){super(u,le.PublicationRun),this._publicationRun=i}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 Qwi(s,u){return u instanceof ZP?u:new ZP(s,u)}function Xwi(s){s.register(new QVe(s)),s.register(new JVe(s)),s.register(new HVe(s)),s.register(new zVe(s)),s.register(new YVe(s)),s.register(new WVe(s)),s.register(new VMe(s)),s.register(new xMe(s)),s.register(new $Me(s)),s.register(new BMe(s)),s.register(new LMe(s)),s.register(new MMe(s)),s.register(new IGe(s)),s.register(new RGe(s)),s.register(new DGe(s)),s.register(new wGe(s)),s.register(new CGe(s)),s.register(new OGe(s)),s.register(new _Ge(s)),s.register(new PGe(s)),s.register(new NGe(s)),s.register(new VGe(s)),s.register(new NBe(s)),s.register(new VBe(s)),s.register(new xBe(s)),s.register(new $Be(s)),s.register(new LBe(s)),s.register(new BBe(s)),s.register(new MBe(s)),s.register(new GBe(s)),s.register(new kBe(s)),s.register(new UBe(s)),s.register(new jBe(s)),s.register(new FBe(s)),s.register(new KBe(s)),s.register(new SBe(s)),s.register(new qBe(s)),s.register(new ZBe(s)),s.register(new HBe(s)),s.register(new WBe(s)),s.register(new zBe(s)),s.register(new QBe(s)),s.register(new XBe(s)),s.register(new eMe(s)),s.register(new JLe(s)),s.register(new QLe(s)),s.register(new XLe(s)),s.register(new eBe(s)),s.register(new tBe(s)),s.register(new iBe(s)),s.register(new rBe(s)),s.register(new nBe(s)),s.register(new aBe(s)),s.register(new lBe(s)),s.register(new oBe(s)),s.register(new dBe(s)),s.register(new uBe(s)),s.register(new pBe(s)),s.register(new mLe(s)),s.register(new j2e(s)),s.register(new k2e(s)),s.register(new U2e(s)),s.register(new h$e(s)),s.register(new m$e(s)),s.register(new T$e(s)),s.register(new v$e(s)),s.register(new E$e(s)),s.register(new b$e(s)),s.register(new A$e(s)),s.register(new g$e(s)),s.register(new I$e(s)),s.register(new B$e(s)),s.register(new fLe(s)),s.register(new yLe(s)),s.register(new hLe(s)),s.register(new R$e(s)),s.register(new D$e(s)),s.register(new w$e(s)),s.register(new C$e(s)),s.register(new O$e(s)),s.register(new _$e(s)),s.register(new P$e(s)),s.register(new N$e(s)),s.register(new V$e(s)),s.register(new x$e(s)),s.register(new $$e(s)),s.register(new L$e(s)),s.register(new M$e(s)),s.register(new G$e(s)),s.register(new k$e(s)),s.register(new U$e(s)),s.register(new j$e(s)),s.register(new F$e(s)),s.register(new K$e(s)),s.register(new S$e(s)),s.register(new q$e(s)),s.register(new Z$e(s)),s.register(new H$e(s)),s.register(new W$e(s)),s.register(new rLe(s)),s.register(new nLe(s)),s.register(new aLe(s)),s.register(new z$e(s)),s.register(new Y$e(s)),s.register(new J$e(s)),s.register(new Q$e(s)),s.register(new X$e(s)),s.register(new eLe(s)),s.register(new tLe(s)),s.register(new iLe(s)),s.register(new q2e(s)),s.register(new Z2e(s)),s.register(new H2e(s)),s.register(new W2e(s)),s.register(new F2e(s)),s.register(new K2e(s)),s.register(new S2e(s)),s.register(new z2e(s)),s.register(new J2e(s)),s.register(new X2e(s)),s.register(new Y2e(s)),s.register(new Q2e(s)),s.register(new eGe(s)),s.register(new rGe(s)),s.register(new tGe(s)),s.register(new iGe(s)),s.register(new cBe(s)),s.register(new mBe(s)),s.register(new TBe(s)),s.register(new bBe(s)),s.register(new ABe(s)),s.register(new gBe(s)),s.register(new IBe(s)),s.register(new RBe(s)),s.register(new DBe(s)),s.register(new wBe(s)),s.register(new CBe(s)),s.register(new vBe(s)),s.register(new EBe(s)),s.register(new yBe(s)),s.register(new hBe(s)),s.register(new fBe(s)),s.register(new sBe(s)),s.register(new _Be(s)),s.register(new PBe(s)),s.register(new OBe(s)),s.register(new kMe(s)),s.register(new d2e(s)),s.register(new o2e(s)),s.register(new u2e(s)),s.register(new p2e(s)),s.register(new FMe(s)),s.register(new KMe(s)),s.register(new zMe(s)),s.register(new HMe(s)),s.register(new s2e(s)),s.register(new e2e(s)),s.register(new i2e(s)),s.register(new n2e(s)),s.register(new r2e(s)),s.register(new WMe(s)),s.register(new JMe(s)),s.register(new QMe(s)),s.register(new YMe(s)),s.register(new GMe(s)),s.register(new SMe(s)),s.register(new t2e(s)),s.register(new y2e(s)),s.register(new kP(s)),s.register(new jMe(s)),s.register(new qMe(s)),s.register(new UMe(s)),s.register(new a2e(s)),s.register(new ZMe(s)),s.register(new XMe(s)),s.register(new l2e(s)),s.register(new f2e(s)),s.register(new c2e(s)),s.register(new h2e(s)),s.register(new kP(s)),s.register(new T2e(s)),s.register(new m2e(s)),s.register(new v2e(s)),s.register(new hMe(s)),s.register(new mMe(s)),s.register(new TMe(s)),s.register(new iMe(s)),s.register(new JBe(s)),s.register(new sMe(s)),s.register(new uMe(s)),s.register(new YBe(s)),s.register(new pMe(s)),s.register(new yMe(s)),s.register(new oMe(s)),s.register(new lMe(s)),s.register(new UI(s)),s.register(new vMe(s)),s.register(new EMe(s)),s.register(new dMe(s)),s.register(new fMe(s)),s.register(new cMe(s)),s.register(new aMe(s)),s.register(new nMe(s)),s.register(new rMe(s)),s.register(new tMe(s)),s.register(new gMe(s)),s.register(new AMe(s)),s.register(new IMe(s)),s.register(new bMe(s)),s.register(new dLe(s)),s.register(new sLe(s)),s.register(new oLe(s)),s.register(new uLe(s)),s.register(new pLe(s)),s.register(new lLe(s)),s.register(new cLe(s)),s.register(new xGe(s)),s.register(new kGe(s)),s.register(new jGe(s)),s.register(new KGe(s)),s.register(new GGe(s)),s.register(new UGe(s)),s.register(new FGe(s)),s.register(new MGe(s)),s.register(new BGe(s)),s.register(new LGe(s)),s.register(new $Ge(s)),s.register(new WGe(s)),s.register(new zGe(s)),s.register(new ZGe(s)),s.register(new HGe(s)),s.register(new gGe(s)),s.register(new SGe(s)),s.register(new qGe(s)),s.register(new JGe(s)),s.register(new YGe(s)),s.register(new QGe(s)),s.register(new XGe(s)),s.register(new eke(s)),s.register(new XVe(s)),s.register(new exe(s)),s.register(new GI(s)),s.register(new kI(s)),s.register(new rke(s)),s.register(new nke(s)),s.register(new lke(s)),s.register(new cke(s)),s.register(new dke(s)),s.register(new ake(s)),s.register(new ske(s)),s.register(new uke(s)),s.register(new oke(s)),s.register(new pke(s))}class vL{constructor(u=new X.Events("extensions-registry-fallback-events")){D(this,"extensionsRegistry",new Map);D(this,"initialized",new Set);D(this,"initializedContexts",new Set);D(this,"onResolveEditorContextCallback",()=>null);D(this,"onResolveProjectLogicContextCallback",()=>null);D(this,"onResolveEditorGUIContextCallback",()=>null);D(this,"onResolveGUIContextCallback",()=>null);D(this,"onResolveCompileContextCallback",()=>null);D(this,"onResolvePublicationRunContextCallback",()=>null);this.events=u,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(u){this.onResolveEditorContextCallback=u}onResolveProjectLogicContext(u){this.onResolveProjectLogicContextCallback=u}onResolveGUIContext(u){this.onResolveGUIContextCallback=u}onResolveEditorGUIContext(u){this.onResolveEditorGUIContextCallback=u}onResolveCompileContext(u){this.onResolveCompileContextCallback=u}onResolvePublicationRunContext(u){this.onResolvePublicationRunContextCallback=u}get extensionInOrder(){return Array.from(this.extensionsRegistry.values()).sort((u,i)=>(u.manifest.initPriority||Ve.Normal)-(i.manifest.initPriority||Ve.Normal))}async setup(){Xwi(this),X.Logger.log("Initializing extensions without context..."),this.initForReady()}requestContext(u){switch(u){case le.Editor:return this.onResolveEditorContextCallback();case le.Logic:return this.onResolveProjectLogicContextCallback();case le.EditorGUI:return this.onResolveEditorGUIContextCallback();case le.Compile:return this.onResolveCompileContextCallback();case le.PublicationRun:return this.onResolvePublicationRunContextCallback();case le.GUI:return this.onResolveGUIContextCallback();case le.EditorGUI:return this.onResolveEditorGUIContextCallback();default:throw new Error(`Unknown context type: ${u}`)}}requestContexts(u,i=[]){const r=[];i.length===0&&(i=u.manifest.contexts);for(const a of i){const c=this.requestContext(a);c&&r.push(c)}return r}requestExtension(u){const i=this.extensionsRegistry.get(u);if(i)return i;throw new Error(`Unknown extension: ${u}`)}register(u){this.extensionsRegistry.set(u.manifest.id,u)}async initAll(){var u,i;for(const r of this.extensionInOrder)if(r.module.init&&!this.initialized.has(r.manifest.id)){const a=r.manifest.contexts.map(c=>this.requestContext(c)).filter(c=>c!==null);a.length&&(await((i=(u=r.module).init)==null?void 0:i.call(u,a)),this.initialized.add(r.manifest.id))}else!r.module.init&&!this.initialized.has(r.manifest.id)&&this.initialized.add(r.manifest.id)}async initForReady(){X.Logger.log("Initializing extensions for ready contexts...");for(const u of this.extensionInOrder)if(u.module.init&&!this.initialized.has(u.manifest.id)){X.Logger.log("Initializing "+u.manifest.id+" extension...");const i=this.requestContexts(u);u.manifest.contexts.every(a=>!!i.find(c=>c.contextType===a))?(await u.module.init(i),this.initialized.add(u.manifest.id)):X.Logger.warn(`Skipping initialization of ${u.manifest.id} extension, not all contexts are ready.`,`Required contexts: ${u.manifest.contexts.join(", ")}`,`Available contexts: ${i.map(a=>a.contextType).join(", ")}`)}else!u.module.init&&!this.initialized.has(u.manifest.id)?(X.Logger.log("Set "+u.manifest.id+" extension as initialized by default..."),this.initialized.add(u.manifest.id)):X.Logger.log(`Skipping initialization of ${u.manifest.id} extension, already initialized or no init method defined.`)}async destroyAll(){for(const u of[...this.extensionInOrder].reverse())u.module.destroy&&await u.module.destroy();this.events.destroy()}on(u,i){this.events.on(u,i)}emit(u,...i){this.events.emit(u,...i)}off(u,i){this.events.off(u,i)}emitAsync(u,...i){return this.events.emitAsync(u,...i)}emitAsyncAll(u,...i){return this.events.emitAsyncAll(u,...i)}emitAsyncAllSettled(u,...i){return this.events.emitAsyncAllSettled(u,...i)}emitAsyncSequentially(u,...i){return this.events.emitAsyncSequentially(u,...i)}emitAsyncSequentiallyAll(u,...i){return this.events.emitAsyncSequentiallyAll(u,...i)}emitAsyncSequentiallyAllSettled(u,...i){return this.events.emitAsyncSequentiallyAllSettled(u,...i)}async contextAvailable(u){if(this.initializedContexts.has(u)){X.Logger.warn(`Context ${u} is already initialized. Skipping re-initialization.`);return}switch(this.initializedContexts.add(u),u){case le.Editor:{if(!this.onResolveEditorContextCallback)throw new Error("No editor context resolver callback set. Call onResolveEditorContext first.");break}case le.Logic:{if(!this.onResolveProjectLogicContextCallback)throw new Error("No project logic context resolver callback set. Call onResolveProjectLogicContext first.");break}}X.Logger.log(`Context ${u} is now available. Initializing extensions for this context...`),await this.initForReady()}getValueTypePreference(u){return window.localStorage.getItem("dynamic-value-type-preference--"+u)||null}setValueTypePreference(u,i){window.localStorage.setItem("dynamic-value-type-preference--"+u,(i==null?void 0:i.toString())||""),this.emit(u,{})}}let oI=null;const EL={requestExtension:s=>(oI||(oI=new vL,oI.setup()),oI.requestExtension(s))};function ec(s){return!(s instanceof Error)&&typeof s=="object"&&s!==null?s:s instanceof Error?{name:s.name,message:s.message,stack:s.stack,...s}:s}function Qj(s){var u,i,r;if(s&&typeof s=="object"&&"value"in s){const a=s;return{single:((u=a.value)==null?void 0:u.valueAsTypeSingle)??((i=a.value)==null?void 0:i.value),list:((r=a.value)==null?void 0:r.valueAsTypeList)??null}}return{single:s,list:Array.isArray(s)?s:null}}const tc={onBeforeEntityExecution:async()=>{},onEntityExecuted:async()=>{}};class HP extends Error{constructor(){super("Execution was stopped"),this.name="ExecutionStoppedError"}}var bL=(s=>(s.FinishedSuccess="finished-success",s.FinishedError="finished-error",s.Running="running",s.Paused="paused",s.Stopped="stopped",s.NotStarted="not-started",s))(bL||{});const fke={...EL,getValueTypePreference:()=>null,setValueTypePreference:()=>{}};class am extends X.Events{constructor(i,r,a,c=null,e=fke){super();D(this,"project");D(this,"entryPoint");D(this,"state","not-started");D(this,"events",new X.Events("fe-exec-inst-events"));D(this,"entities",[]);D(this,"parentExecution",null);D(this,"executing",[]);D(this,"executed",[]);D(this,"skipped",[]);D(this,"scheduled",[]);D(this,"localTestValues");D(this,"resolvedValues");D(this,"persistedExecutionResults");D(this,"lastExecutionResults");D(this,"onAddToSkippedListCallback",null);D(this,"onRemoveFromSkippedListCallback",null);D(this,"onAddEntityCallback",null);D(this,"onRemoveEntityCallback",null);D(this,"onAbortExecutionCallback",null);this.parentContext=e,this.entities=r,this.entryPoint=a,this.project=i,this.parentExecution=c,this.localTestValues=new Mv(L.UUID.uuid(),this.project),this.resolvedValues=new Mv(L.UUID.uuid(),this.project),this.persistedExecutionResults=new Mv(L.UUID.uuid(),this.project),this.lastExecutionResults=new Mv(L.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 i=this;for(;i.parentExecution;)i=i.parentExecution;return i}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 HP;for(;this.isPaused();){if(this.isStopped())throw new HP;await new Promise(i=>setTimeout(i,100))}}skip(i){this.hasEntity(i)&&(this.removeFromScheduledList(i),!this.skipped.includes(i)&&(this.skipped.push(i),this.onAddToSkippedListCallback&&this.onAddToSkippedListCallback(i),Ar.includes(i.type)&&Nt(i).forEach(r=>this.skip(r))))}async schedule(i,r,a){if(this.hasExecuted(i))return null;if(Ti.includes(i.type))return this.executeBranch(i,a,r);if(gr.includes(i.type)){if(i.calledBy.every(e=>this.hasExecuted(e)||!this.hasEntity(e)))return this.executeBranch(i,a,r);this.scheduled.includes(i)||this.scheduled.push(i)}return null}mergeExernalValuesWithInternalInputs(i,r){const a=[];return mi.includes(r.type)?a.push(...r.inputs.filter(e=>Dy(e))):[...ei,...Ti].includes(r.type)?a.push(...r.inputs):Jt.includes(r.type)&&a.push(...r.outputs.filter(e=>Dy(e))),a.map(e=>{var h;let f=i.find(m=>m.valueOwner.id===e.id);if(f)return f;if(!f&&Ti.includes(r.type)&&(f=i.find(m=>{var v;return((v=m.valueOwner.declaration)==null?void 0:v.id)===e.id})),f){const m=(h=f.value)==null?void 0:h.clone(null);return m==null||m.setStandaloneParent(e,null),{...f,valueOwner:e,value:m||null,inheritanceLink:{sources:[f],target:e}}}return Cn.includes(e.type)?Fo(e,this.valueResolutionContext):Xu(e,this.valueResolutionContext)}).reduce((e,f)=>{const h=Xd(f==null?void 0:f.valueOwner,this.project),m=f?[f]:[];return h.forEach(v=>{var w,R,O;if(v.id===(f==null?void 0:f.valueOwner.id))return;const b=Bi(v.getDataType(null),v,this.project);b==null||b.metaSync({value:(w=f==null?void 0:f.value)==null?void 0:w.value},null),b==null||b.setValueAsTypeList(((R=f==null?void 0:f.value)==null?void 0:R.valueAsTypeList)||null),b==null||b.setValueAsTypeSingle(((O=f==null?void 0:f.value)==null?void 0:O.valueAsTypeSingle)||null);const A={...f,valueOwner:v,value:b};m.push(A)}),[...e,...m]},[]).sort((e,f)=>e.valueOwner.index-f.valueOwner.index)}inheritValuesFromContext(i){this.localTestValues=i.localTestValues,this.resolvedValues=i.resolvedValues,this.persistedExecutionResults=i.persistedExecutionResults}async executeInternalCall(i,r,a,c={}){var f,h;this.logBeforeExecution("executeInternalCall",i,r);const e={...tc,...c};try{let m={value:F.Success,error:null,result:null};if(r.sort((O,$)=>O.valueOwner.index-$.valueOwner.index),Object.values(yn).includes(i.declaration.id)){const O=this.parentContext.requestExtension(ds+i.declaration.id).module.main;O?m=await O(i,r,this):X.Logger.warn(`No implementation found for built-in function: ${i.declaration.id}`)}else{const O=await this.executeDetachedFullFunctionDeclarationLogic(i.declaration,r,a,e);m={value:O.value,error:O.error,result:O.result}}let v=null;if(m.error&&i.error){X.Logger.warn("Raw error executing entity: ",m.error);const{single:O,list:$}=Qj(m.error),G=ec(O),x=(f=i.error)==null?void 0:f.getDataType(null),k=Bi(x||null,i.error,a);if(x!=null&&x.asType)$!==null?k==null||k.setValueAsTypeList($):k==null||k.setValueAsTypeSingle(O);else{const W=sn(G)?JSON.stringify(G,null,2):G;k==null||k.metaSync({value:W},null)}v={valueOwner:i.error,type:Ke.ExecutionResult,inheritanceLink:null,value:k}}const b=i==null?void 0:i.getDataType(null),A=Bi(b,i,a),{single:w,list:R}=Qj(m.result);return b!=null&&b.asType?R!==null?A==null||A.setValueAsTypeList(R):A==null||A.setValueAsTypeSingle(w):A==null||A.metaSync({value:w},null),{value:m.value,entity:i,error:v,result:{value:A||null,valueOwner:i,type:Ke.ExecutionResult,inheritanceLink:null}}}catch(m){if(m&&(m.name==="ExecutionStoppedError"||m.message==="Execution was stopped"))throw m;X.Logger.warn("Internal call execution error: ",m);let v=null;if(i.error){const b=ec(m),A=(h=i.error)==null?void 0:h.getDataType(null),w=Bi(A,i.error,a);if(A!=null&&A.asType)w==null||w.setValueAsTypeSingle(m);else{const R=sn(b)?JSON.stringify(b,null,2):b;w==null||w.metaSync({value:R},null)}v={valueOwner:i.error,type:Ke.ExecutionResult,inheritanceLink:null,value:w}}return{value:i.catchesError||i.errorCalls.length?F.CaughtError:F.UnhandledError,entity:i,error:v,result:null}}}static async executeOperation(i,r,a,c){var e,f;c?c.logBeforeExecution("executeOperation",i,r):console.log(`executeOperation (${i.type}) -> [${ye(i,a)}] Inputs:${r.length?`
62
62
  `:""}${r.map(h=>{var m,v,b;return`${(m=h.valueOwner)==null?void 0:m.type} (${(v=h.valueOwner)==null?void 0:v.id}) "${ye(h.valueOwner,a)}": ${JSON.stringify((b=h.value)==null?void 0:b.value,null,2)}`}).join(`
63
63
  `)}
64
64
  `);try{let h={value:F.Success,error:null,result:null};r.sort((A,w)=>A.valueOwner.index-w.valueOwner.index),i.declaration.implementation&&(h=await i.declaration.implementation(i,r.sort((A,w)=>A.valueOwner.index-w.valueOwner.index)));let m=null;if(h.error&&i.error){const A=ec(h.error),w=((e=i.error)==null?void 0:e.getDataType(null))||null,R=Bi(w,i.error,a);if(w!=null&&w.asType)R==null||R.setValueAsTypeSingle(h.error);else{const O=sn(A)?JSON.stringify(A,null,2):A;R==null||R.metaSync({value:O},null)}m={valueOwner:i.error,type:Ke.ExecutionResult,inheritanceLink:null,value:R}}const v=i==null?void 0:i.getDataType(null),b=Bi(v,i,a);return v!=null&&v.asType?b==null||b.setValueAsTypeSingle(h.result):b==null||b.metaSync({value:h.result},null),{value:h.value,entity:i,error:m,result:{value:b||null,valueOwner:i,type:Ke.ExecutionResult,inheritanceLink:null}}}catch(h){if(h&&(h.name==="ExecutionStoppedError"||h.message==="Execution was stopped"))throw h;console.warn("Operation execution error: ",h);let m=null;if(i.error){const v=ec(h),b=(f=i.error)==null?void 0:f.getDataType(null),A=Bi(b,i.error,a);if(b!=null&&b.asType)A==null||A.setValueAsTypeSingle(h);else{const w=sn(v)?JSON.stringify(v,null,2):v;A==null||A.metaSync({value:w},null)}m={valueOwner:i.error,type:Ke.ExecutionResult,inheritanceLink:null,value:A}}return{value:i.catchesError||i.errorCalls.length?F.CaughtError:F.UnhandledError,entity:i,error:m,result:null}}}async executeSearch(i,r,a){var c;this.logBeforeExecution("executeSearch",i,r);try{let e={value:F.Success,error:null,result:null};const f=await(await this.parentContext.requestExtension(Be.SEARCH_NODE_IMPLEMENTATION)).module.main(i,r),h=i==null?void 0:i.getDataType(null),m=Bi(h,i,a);return m==null||m.metaSync({value:f},null),f.error?{value:F.UnhandledError,entity:i,error:{valueOwner:i,type:Ke.ExecutionResult,inheritanceLink:null,value:m},result:null}:{value:e.value,entity:i,error:null,result:{value:m,valueOwner:i,type:Ke.ExecutionResult,inheritanceLink:null}}}catch(e){if(e&&(e.name==="ExecutionStoppedError"||e.message==="Execution was stopped"))throw e;if(X.Logger.warn(`Search node execution error: ${e}`),!i.error)return{value:i.catchesError||i.errorCalls.length?F.CaughtError:F.UnhandledError,entity:i,error:null,result:null};const f=ec(e),h=(c=i.error)==null?void 0:c.getDataType(null),m=Bi(h,i.error,a),v=sn(f)?JSON.stringify(f,null,2):f;return m==null||m.metaSync({value:v},null),{value:i.catchesError||i.errorCalls.length?F.CaughtError:F.UnhandledError,entity:i,error:{valueOwner:i.error,type:Ke.ExecutionResult,inheritanceLink:null,value:m},result:null}}}async executeLoop(i,r,a,c={}){var f,h,m,v,b,A,w,R,O,$,G,x,k,W,te,ee,Q;this.logBeforeExecution("executeLoop",i,r);const e={...tc,...c};try{let ne={value:F.Success,error:null,result:null};const de=r.map(ve=>{var Ae,De;return((Ae=ve==null?void 0:ve.value)==null?void 0:Ae.valueAsType)||((De=ve==null?void 0:ve.value)==null?void 0:De.value)});let J={};const ie=i.body.inputs.find(ve=>ve!==i.currentIterationNumberArgumentDeclaration&&ve!==i.currentValueArgumentDeclaration);if(ie){const ve=ie,Ae=Bi(ve.getDataType(null),ve,a);Ae==null||Ae.metaSync({value:((f=ve.defaultValue)==null?void 0:f.value)||null},null),J[ve.id]={value:Ae||null,valueOwner:ve,type:Ke.ExecutionResult,inheritanceLink:null}}let se={value:F.Success,entity:i.body,error:null,result:null};switch(i.declaration.id){case j.loop["counted-loop"].id:{const ve=de[0];let Ae=1;for(;Ae<=ve&&Ae<=1e3;){await this.checkStateAndPause();const De=i.body.inputs.map(Ce=>{if(Ce===i.currentIterationNumberArgumentDeclaration){const Le=i.currentIterationNumberArgumentDeclaration.getDataType(null),Ge=Wu(Le),Ie=this.lastExecutionResults.readValue(Ce.id);if(Ie){Ie.metaSync({value:Ae},null);const ut=Ur(Ie,Ce);this.lastExecutionResults.writeValue(Ce,ut);const Et={value:ut,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Ke.ExecutionResult,inheritanceLink:null};return J[Ce.id]=Et,Et}const Ue={id:L.UUID.uuid(),deletable:!0,editable:!0,type:d.LiteralValue,autogeneration:null,version:L.UUID.uuid(),createdAt:new Date().toISOString(),author:L.sessionAuthor,deleted:!1,previousVersion:null,value:Ae,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:Ge,standaloneParent:Ce.toReference()},We=Lr(Ue,a);this.lastExecutionResults.writeValue(Ce,We);const Se={value:We,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Ke.ExecutionResult,inheritanceLink:null};return J[Ce.id]=Se,Se}else return J[Ce.id]}).filter(Ce=>!!Ce);if(se=await this.executeFullFunctionDeclarationLogic(i.body,De,e),se!=null&&se.result&&se.value!==F.Return){const Ce=i.body.inputs.find(Le=>Le!==i.currentIterationNumberArgumentDeclaration&&Le!==i.currentValueArgumentDeclaration);if(Ce){let Le=(h=se.result.value)==null?void 0:h.value;Le===void 0&&(Le=null),(m=J[Ce.id].value)==null||m.metaSync({value:Le},null);const Ge=Ur(J[Ce.id].value,Ce);this.lastExecutionResults.writeValue(Ce,Ge)}}if([F.CaughtError,F.UnhandledError,F.Break,F.Return].includes(se.value))break;Ae++}break}case j.loop["manual-flow-loop"].id:{let ve=1;for(;ve<=50;){await this.checkStateAndPause();const Ae=i.body.inputs.map(De=>{if(De===i.currentIterationNumberArgumentDeclaration){const Ce=this.lastExecutionResults.readValue(De.id);if(Ce){Ce.metaSync({value:ve},null);const Ue=Ur(Ce,De);this.lastExecutionResults.writeValue(De,Ue);const We={value:Ue,valueOwner:De,type:Ke.ExecutionResult,inheritanceLink:null};return J[De.id]=We,We}const Le=i.currentIterationNumberArgumentDeclaration.getDataType(null),Ge=Bi(Le,De,a);return Ge==null||Ge.metaSync({value:ve},null),this.lastExecutionResults.writeValue(De,Ge),{value:Ge,valueOwner:De,type:Ke.ExecutionResult,inheritanceLink:null}}else return J[De.id]}).filter(De=>!!De);if(se=await this.executeFullFunctionDeclarationLogic(i.body,Ae,e),se!=null&&se.result&&se.value!==F.Return){const De=i.body.inputs.find(Ce=>Ce!==i.currentIterationNumberArgumentDeclaration&&Ce!==i.currentValueArgumentDeclaration);if(De){let Ce=(v=se.result.value)==null?void 0:v.value;Ce===void 0&&(Ce=null),(b=J[De.id].value)==null||b.metaSync({value:Ce},null);const Le=Ur(J[De.id].value,De);this.lastExecutionResults.writeValue(De,Le)}}if([F.CaughtError,F.UnhandledError,F.Break,F.Return].includes(se.value))break;ve++}break}case j.loop["list-loop"].id:{const ve=de[0];let Ae=1;const De=ve;for(let Ce=0;Ce<De.length;Ce++){await this.checkStateAndPause();const Le=De[Ce],Ge=i.body.inputs.map(Ie=>{if(Ie===i.currentIterationNumberArgumentDeclaration){const Ue=this.lastExecutionResults.readValue(Ie.id);if(Ue){Ue.metaSync({value:Ae},null);const Et=Ur(Ue,Ie);return this.lastExecutionResults.writeValue(Ie,Et),{value:Et,valueOwner:Ie,type:Ke.ExecutionResult,inheritanceLink:null}}const We=i.currentIterationNumberArgumentDeclaration.getDataType(null),Se=Bi(We,Ie,a);return Se==null||Se.metaSync({value:Ae},null),this.lastExecutionResults.writeValue(Ie,Se),{value:Se,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Ke.ExecutionResult,inheritanceLink:null}}else if(Ie===i.currentValueArgumentDeclaration){const Ue=i.currentValueArgumentDeclaration.getDataType(null),We=Wu(Ue),Se=this.lastExecutionResults.readValue(Ie.id);if(Se){Se.metaSync({value:Le},null);const nt=Ur(Se,Ie);return this.lastExecutionResults.writeValue(Ie,nt),{value:nt,valueOwner:Ie,type:Ke.ExecutionResult,inheritanceLink:null}}const ut={id:L.UUID.uuid(),deletable:!0,editable:!0,type:d.LiteralValue,autogeneration:null,version:L.UUID.uuid(),createdAt:new Date().toISOString(),author:L.sessionAuthor,deleted:!1,previousVersion:null,value:Le,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:We,standaloneParent:Ie.toReference()},Et=Lr(ut,a);return this.lastExecutionResults.writeValue(Ie,Et),{value:Et,valueOwner:i.currentValueArgumentDeclaration,type:Ke.ExecutionResult,inheritanceLink:null}}else return J[Ie.id]}).filter(Ie=>!!Ie);if(se=await this.executeFullFunctionDeclarationLogic(i.body,Ge,e),se!=null&&se.result&&se.value!==F.Return){const Ie=i.body.inputs.find(Ue=>Ue!==i.currentIterationNumberArgumentDeclaration&&Ue!==i.currentValueArgumentDeclaration);if(Ie){let Ue=(A=se.result.value)==null?void 0:A.value;Ue===void 0&&(Ue=null),(w=J[Ie.id].value)==null||w.metaSync({value:Ue},null);const We=Ur(J[Ie.id].value,Ie);this.lastExecutionResults.writeValue(Ie,We)}}if([F.CaughtError,F.UnhandledError,F.Break,F.Return].includes(se.value))break;Ae++}break}case j.loop["object-keys-loop"].id:{const ve=de[0];let Ae=1;const De=ve?Object.keys(ve):[];for(let Ce=0;Ce<De.length;Ce++){await this.checkStateAndPause();const Le=De[Ce],Ge=i.body.inputs.map(Ie=>{if(Ie===i.currentIterationNumberArgumentDeclaration){const Ue=this.lastExecutionResults.readValue(Ie.id);if(Ue){Ue.metaSync({value:Ae},null);const Et=Ur(Ue,Ie);return this.lastExecutionResults.writeValue(Ie,Et),{value:Et,valueOwner:Ie,type:Ke.ExecutionResult,inheritanceLink:null}}const We=i.currentIterationNumberArgumentDeclaration.getDataType(null),Se=Bi(We,Ie,a);return Se==null||Se.metaSync({value:Ae},null),this.lastExecutionResults.writeValue(Ie,Se),{value:Se,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Ke.ExecutionResult,inheritanceLink:null}}else if(Ie===i.currentValueArgumentDeclaration){const Ue=i.currentValueArgumentDeclaration.getDataType(null),We=Wu(Ue),Se=this.lastExecutionResults.readValue(Ie.id);if(Se){Se.metaSync({value:Le},null);const nt=Ur(Se,Ie);return this.lastExecutionResults.writeValue(Ie,nt),{value:Se,valueOwner:Ie,type:Ke.ExecutionResult,inheritanceLink:null}}const ut={id:L.UUID.uuid(),deletable:!0,editable:!0,type:d.LiteralValue,autogeneration:null,version:L.UUID.uuid(),createdAt:new Date().toISOString(),author:L.sessionAuthor,deleted:!1,previousVersion:null,value:Le,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:We,standaloneParent:Ie.toReference()},Et=Lr(ut,a);return this.lastExecutionResults.writeValue(Ie,Et),{value:Et,valueOwner:i.currentValueArgumentDeclaration,type:Ke.ExecutionResult,inheritanceLink:null}}else return J[Ie.id]}).filter(Ie=>!!Ie);if(se=await this.executeFullFunctionDeclarationLogic(i.body,Ge,e),se!=null&&se.result&&se.value!==F.Return){const Ie=i.body.inputs.find(Ue=>Ue!==i.currentIterationNumberArgumentDeclaration&&Ue!==i.currentValueArgumentDeclaration);if(Ie){let Ue=(R=se.result.value)==null?void 0:R.value;Ue===void 0&&(Ue=null),(O=J[Ie.id].value)==null||O.metaSync({value:Ue},null);const We=Ur(J[Ie.id].value,Ie);this.lastExecutionResults.writeValue(Ie,We)}}if([F.CaughtError,F.UnhandledError,F.Break,F.Return].includes(se.value))break;Ae++}break}case j.loop["object-values-loop"].id:{const ve=de[0];let Ae=1;const De=ve?Object.values(ve):[];for(let Ce=0;Ce<De.length;Ce++){await this.checkStateAndPause();const Le=De[Ce],Ge=i.body.inputs.map(Ie=>{if(Ie===i.currentIterationNumberArgumentDeclaration){const Ue=this.lastExecutionResults.readValue(Ie.id);if(Ue){Ue.metaSync({value:Ae},null);const Et=Ur(Ue,Ie);return this.lastExecutionResults.writeValue(Ie,Et),{value:Et,valueOwner:Ie,type:Ke.ExecutionResult,inheritanceLink:null}}const We=i.currentIterationNumberArgumentDeclaration.getDataType(null),Se=Bi(We,Ie,a);return Se==null||Se.metaSync({value:Ae},null),this.lastExecutionResults.writeValue(Ie,Se),{value:Se,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Ke.ExecutionResult,inheritanceLink:null}}else if(Ie===i.currentValueArgumentDeclaration){const Ue=i.currentValueArgumentDeclaration.getDataType(null),We=Wu(Ue),Se=this.lastExecutionResults.readValue(Ie.id);if(Se){Se.metaSync({value:Le},null);const nt=Ur(Se,Ie);return this.lastExecutionResults.writeValue(Ie,nt),{value:Se,valueOwner:Ie,type:Ke.ExecutionResult,inheritanceLink:null}}const ut={id:L.UUID.uuid(),deletable:!0,editable:!0,type:d.LiteralValue,autogeneration:null,version:L.UUID.uuid(),createdAt:new Date().toISOString(),author:L.sessionAuthor,deleted:!1,previousVersion:null,value:Le,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:We,standaloneParent:Ie.toReference()},Et=Lr(ut,a);return this.lastExecutionResults.writeValue(Ie,Et),{value:Et,valueOwner:i.currentValueArgumentDeclaration,type:Ke.ExecutionResult,inheritanceLink:null}}else return J[Ie.id]}).filter(Ie=>!!Ie);if(se=await this.executeFullFunctionDeclarationLogic(i.body,Ge,e),se!=null&&se.result&&se.value!==F.Return){const Ie=i.body.inputs.find(Ue=>Ue!==i.currentIterationNumberArgumentDeclaration&&Ue!==i.currentValueArgumentDeclaration);if(Ie){let Ue=($=se.result.value)==null?void 0:$.value;Ue===void 0&&(Ue=null),(G=J[Ie.id].value)==null||G.metaSync({value:Ue},null);const We=Ur(J[Ie.id].value,Ie);this.lastExecutionResults.writeValue(Ie,We)}}if([F.CaughtError,F.UnhandledError,F.Break,F.Return].includes(se.value))break;Ae++}break}case j.loop["string-loop"].id:{const ve=de[0];let Ae=1;const De=ve.split("");for(let Ce=0;Ce<De.length;Ce++){await this.checkStateAndPause();const Le=De[Ce],Ge=i.body.inputs.map(Ie=>{if(Ie===i.currentIterationNumberArgumentDeclaration){const Ue=this.lastExecutionResults.readValue(Ie.id);if(Ue){Ue.metaSync({value:Ae},null);const Et=Ur(Ue,Ie);return this.lastExecutionResults.writeValue(Ie,Et),{value:Et,valueOwner:Ie,type:Ke.ExecutionResult,inheritanceLink:null}}const We=i.currentIterationNumberArgumentDeclaration.getDataType(null),Se=Bi(We,Ie,a);return Se==null||Se.metaSync({value:Ae},null),this.lastExecutionResults.writeValue(Ie,Se),{value:Se,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Ke.ExecutionResult,inheritanceLink:null}}else if(Ie===i.currentValueArgumentDeclaration){const Ue=i.currentValueArgumentDeclaration.getDataType(null),We=Wu(Ue),Se=this.lastExecutionResults.readValue(Ie.id);if(Se){Se.metaSync({value:Le},null);const nt=Ur(Se,Ie);return this.lastExecutionResults.writeValue(Ie,nt),{value:nt,valueOwner:Ie,type:Ke.ExecutionResult,inheritanceLink:null}}const ut={id:L.UUID.uuid(),deletable:!0,editable:!0,type:d.LiteralValue,autogeneration:null,version:L.UUID.uuid(),createdAt:new Date().toISOString(),author:L.sessionAuthor,deleted:!1,previousVersion:null,value:Le,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:We,standaloneParent:Ie.toReference()},Et=Lr(ut,a);return this.lastExecutionResults.writeValue(Ie,Et),{value:Et,valueOwner:i.currentValueArgumentDeclaration,type:Ke.ExecutionResult,inheritanceLink:null}}else return J[Ie.id]}).filter(Ie=>!!Ie);if(se=await this.executeFullFunctionDeclarationLogic(i.body,Ge,e),(se.results||[]).forEach(Ie=>{var Et,lt,nt;if(Ie.valueOwner.type!==d.InputMap||Jt.includes(Ie.valueOwner.parent.type))return;const Ue=i.body.inputs.find(ot=>ye(ot,a)===ye(Ie.valueOwner,a)),Se=[...(Et=J[Ue.id].value)==null?void 0:Et.value,((lt=Ie.value)==null?void 0:lt.value)||null];(nt=J[Ue.id].value)==null||nt.metaSync({value:Se},null);const ut=Ur(J[Ue.id].value,Ue);this.lastExecutionResults.writeValue(Ue,ut)}),[F.CaughtError,F.UnhandledError,F.Break,F.Return].includes(se.value))break;Ae++}break}}let fe=F.Success;if(se.value===F.UnhandledError?i.catchesError||i.errorCalls.length?fe=F.CaughtError:fe=F.UnhandledError:[F.CaughtError,F.Return].includes(se.value)&&(fe=se.value),ne={value:fe,error:((k=(x=se.error)==null?void 0:x.value)==null?void 0:k.value)||null,result:((te=(W=se==null?void 0:se.result)==null?void 0:W.value)==null?void 0:te.value)||null},ne.value===F.UnhandledError||ne.value===F.CaughtError){let ve=null;if(i.error){const Ae=ec(ne.error),De=(ee=i.error)==null?void 0:ee.getDataType(null),Ce=Bi(De||null,i.error,a);if(De!=null&&De.asType)Ce==null||Ce.setValueAsTypeSingle(ne.error);else{const Le=sn(Ae)?JSON.stringify(Ae,null,2):Ae;Ce==null||Ce.metaSync({value:Le},null)}ve={valueOwner:i.error,type:Ke.ExecutionResult,inheritanceLink:null,value:Ce}}return{value:ne.value,entity:i,error:ve,result:null}}const ue=i==null?void 0:i.getDataType(null),me=Bi(ue,i,a);return ue!=null&&ue.asType?me==null||me.setValueAsTypeSingle(ne.result):me==null||me.metaSync({value:ne.result},null),{value:ne.value,entity:i,error:null,result:{value:me||null,valueOwner:i,type:Ke.ExecutionResult,inheritanceLink:null}}}catch(ne){if(ne&&(ne.name==="ExecutionStoppedError"||ne.message==="Execution was stopped"))throw ne;if(X.Logger.warn("Error executing loop: ",ne),i.error){const de=ec(ne),J=(Q=i.error)==null?void 0:Q.getDataType(null),ie=Bi(J,i.error,a);if(J!=null&&J.asType)ie==null||ie.setValueAsTypeSingle(ne);else{const se=sn(de)?JSON.stringify(de,null,2):de;ie==null||ie.metaSync({value:se},null)}return{value:i.catchesError||i.errorCalls.length?F.CaughtError:F.UnhandledError,entity:i,error:{valueOwner:i.error,type:Ke.ExecutionResult,inheritanceLink:null,value:ie},result:null}}else return{value:i.catchesError||i.errorCalls.length?F.CaughtError:F.UnhandledError,entity:i,error:null,result:null}}}async executeFunctionCall(i,r,a,c={}){var f,h,m,v,b,A,w,R,O,$,G,x,k,W,te,ee,Q,ne,de,J,ie,se,fe,ue,me,ve;const e={...tc,...c};try{this.logBeforeExecution("executeFunctionCall",i,r);const Ae=await this.executeDetachedFullFunctionDeclarationLogic(i.declaration,r,a,e);let De=null;if(Ae.error&&i.error){X.Logger.warn("Raw error executing entity: ",Ae.error);const Ie=(f=i.error)==null?void 0:f.getDataType(null),Ue=Bi(Ie||null,i.error,a);Ie!=null&&Ie.asType?(m=(h=Ae.error)==null?void 0:h.value)!=null&&m.valueAsTypeSingle?Ue==null||Ue.setValueAsTypeSingle((b=(v=Ae.error)==null?void 0:v.value)==null?void 0:b.valueAsTypeSingle):(w=(A=Ae.error)==null?void 0:A.value)!=null&&w.valueAsTypeList&&Array.isArray((O=(R=Ae.error)==null?void 0:R.value)==null?void 0:O.valueAsTypeList)&&(Ue==null||Ue.setValueAsTypeList((G=($=Ae.error)==null?void 0:$.value)==null?void 0:G.valueAsTypeList)):Ue==null||Ue.metaSync({value:(k=(x=Ae.error)==null?void 0:x.value)==null?void 0:k.value},null),De={valueOwner:i.error,type:Ke.ExecutionResult,inheritanceLink:null,value:Ue}}let Ce=F.Success;Ae.value===F.UnhandledError&&(i.catchesError||i.errorCalls.length?Ce=F.CaughtError:Ce=F.UnhandledError);const Le=i==null?void 0:i.getDataType(null),Ge=Bi(Le,i,a);return Le!=null&&Le.asType?(te=(W=Ae.result)==null?void 0:W.value)!=null&&te.valueAsTypeSingle?Ge==null||Ge.setValueAsTypeSingle((Q=(ee=Ae.result)==null?void 0:ee.value)==null?void 0:Q.valueAsTypeSingle):(de=(ne=Ae.result)==null?void 0:ne.value)!=null&&de.valueAsTypeList&&Array.isArray((ie=(J=Ae.result)==null?void 0:J.value)==null?void 0:ie.valueAsTypeList)&&(Ge==null||Ge.setValueAsTypeList((fe=(se=Ae.result)==null?void 0:se.value)==null?void 0:fe.valueAsTypeList)):Ge==null||Ge.metaSync({value:((me=(ue=Ae.result)==null?void 0:ue.value)==null?void 0:me.value)||null},null),{value:Ce,entity:i,error:De,result:{value:Ge||null,valueOwner:i,type:Ke.ExecutionResult,inheritanceLink:null}}}catch(Ae){if(Ae&&(Ae.name==="ExecutionStoppedError"||Ae.message==="Execution was stopped"))throw Ae;if(!i.error)return{value:i.catchesError||i.errorCalls.length?F.CaughtError:F.UnhandledError,entity:i,error:null,result:null};const De=ec(Ae),Ce=(ve=i.error)==null?void 0:ve.getDataType(null),Le=Bi(Ce,i.error,a);if(Ce!=null&&Ce.asType)Le==null||Le.setValueAsTypeSingle(Ae);else{const Ge=sn(De)?JSON.stringify(De,null,2):De;Le==null||Le.metaSync({value:Ge},null)}return{value:i.catchesError||i.errorCalls.length?F.CaughtError:F.UnhandledError,entity:i,error:{valueOwner:i.error,type:Ke.ExecutionResult,inheritanceLink:null,value:Le},result:null}}}async executeCondition(i,r){var c,e,f,h;this.logBeforeExecution("executeCondition",i,r);let a=!1;switch(i.declaration.id){case Jn.BooleanIsTrue:{const m=(e=(c=r[0])==null?void 0:c.value)==null?void 0:e.value;if(typeof m!="boolean")throw new TypeError("BooleanIsTrue expects a boolean input.");a=m===!0;break}case Jn.BooleanIsFalse:{const m=(h=(f=r[0])==null?void 0:f.value)==null?void 0:h.value;if(typeof m!="boolean")throw new TypeError("BooleanIsFalse expects a boolean input.");a=m===!1;break}case ln.And:{a=(await Promise.all(i.andChildrenGroup.map(async v=>{const b=this.mergeExernalValuesWithInternalInputs(r,v);return(await this.executeCondition(v,b)).value===F.Success}))).every(v=>v);break}case ln.Or:{a=(await Promise.all(i.orChildrenGroup.map(async v=>{const b=this.mergeExernalValuesWithInternalInputs(r,v);return(await this.executeCondition(v,b)).value===F.Success}))).some(v=>v);break}default:throw new Error(`Condition declaration ${i.declaration.name} does not have an implementation.`)}return{value:a?F.Success:F.ConditionNotMet,entity:i,error:null,result:null}}async executeDetachedFullFunctionDeclarationLogic(i,r,a,c={}){this.logBeforeExecution("executeDetachedFullFunctionDeclarationLogic",i,r);const e={...tc,...c,onBeforeEntityExecution:(m,v,b)=>{var A;return((A=c==null?void 0:c.onBeforeEntityExecution)==null?void 0:A.call(c,m,v,{...b,detached:!0}))||Promise.resolve()},onEntityExecuted:(m,v,b)=>{var A;return((A=c==null?void 0:c.onEntityExecuted)==null?void 0:A.call(c,m,v,{...b,detached:!0}))||Promise.resolve()}},f=new am(a,[i,...sR(i)],i,this,this.parentContext);return f.inheritValuesFromContext(this),await f.execute(e,r)}async executeFullFunctionDeclarationLogic(i,r,a={}){this.logBeforeExecution("executeFullFunctionDeclarationLogic",i,r);const c={...tc,...a},e=sR(i),f=[];e.forEach(v=>{if(v.type===d.VariableDeclaration||v.type===d.VariableInstance){const b=v;b.internalCalls&&f.push(...b.internalCalls)}}),e.push(...f),console.log(`[executeFullFunctionDeclarationLogic] Reseting children for: ${ye(i,this.project)}
@@ -69,7 +69,7 @@ Children:`,e.map(v=>`${v.type} "${ye(v,this.project)}"`).join(", ")),e.forEach(v
69
69
  ${m.error?`Error: ${JSON.stringify((v=m.error.value)==null?void 0:v.value,null,2)}`:`Value: ${JSON.stringify((A=(b=m.result)==null?void 0:b.value)==null?void 0:A.value,null,2)}`}`),this.removeFromExecutingList(i),this.addToAlreadyExecutedList(i),this.storeLastExecutionValues(m),await((w=e.onEntityExecuted)==null?void 0:w.call(e,i,m,f)),m.value===F.Success){const R=(i.successCalls||i.calls||[]).filter(k=>this.hasEntity(k));(i.errorCalls||[]).forEach(k=>{this.skip(k)});let $=[];const G=(await Promise.all(R.map(k=>this.schedule(k,[],e)))).filter(k=>!!k),x=G.filter(k=>!!k).find(k=>k.value===F.CaughtError||k.value===F.Return||k.value===F.Break||k.value===F.Continue);return x||($=[...$,...G],m)}else if(m.value===F.CaughtError||m.value===F.ConditionNotMet){const R=(i.errorCalls||[]).filter(k=>this.hasEntity(k));(i.successCalls||i.calls||[]).forEach(k=>{this.skip(k)});let $=[];const G=(await Promise.all(R.map(k=>this.schedule(k,[],e)))).filter(k=>!!k),x=G.filter(k=>!!k).find(k=>k.value===F.CaughtError||k.value===F.UnhandledError||k.value===F.Return||k.value===F.Break||k.value===F.Continue);return x||($=[...$,...G],m)}else{if(m.value===F.UnhandledError)return this.executing.forEach(R=>{this.skip(R)}),this.scheduled.forEach(R=>{this.skip(R)}),Ar.includes(m.entity.type)&&Nt(m.entity).forEach(R=>{this.skip(R)}),m;if(m.value===F.Return)return m;if(m.value===F.Break)return m;if(m.value===F.Continue)return m}return m}async execute(i={},r=[]){console.log(`%cexecute -> [Execution] initialExternalValues:
70
70
  ${r.map(e=>{var f,h,m;return`${(f=e.valueOwner)==null?void 0:f.type} (${(h=e.valueOwner)==null?void 0:h.id}) "${ye(e.valueOwner,this.project)}": ${JSON.stringify((m=e.value)==null?void 0:m.value,null,2)}`}).join(`
71
71
  `)}
72
- `,"color: #3b82f6; font-weight: bold;");const a={...tc,...i};this.state="running";const c=this.project.activeExecution;this.project.activeExecution=this;try{const e=await this.executeBranch(this.entryPoint,a,r);return this.state="finished-success",e}finally{this.project.activeExecution=c}}getExecutionLevels(){const i=[];let r=this;for(;r;){const a=r.entryPoint,c=a?ye(a,this.project):"Unknown",e=a?a.type:"unknown";i.unshift(`${e} "${c}"`),r=r.parentExecution}return i.join(" -> ")}logBeforeExecution(i,r,a){var v,b;const c=this.getExecutionLevels(),e=ci(r,this.project),f=e?ye(e,this.project):"Project",h=e?e.type:"Project",m=ye(r,this.project);if(console.log(`%c[Execution: ${c}] %c[Scope: ${h} "${f}"]`,"color: #3b82f6; font-weight: bold;","color: #10b981; font-weight: bold;"),console.log(`%c${i} (${r.type}) -> [${m}]%c Inputs:`,"font-weight: bold; color: #224370ff;","color: #9ca3af;"),a.length?a.forEach(A=>{var R,O,$;const w=ye(A.valueOwner,this.project);console.log(` %c${(R=A.valueOwner)==null?void 0:R.type}%c (${(O=A.valueOwner)==null?void 0:O.id}) %c"${w}"%c:`,"color: #8b5cf6; font-weight: bold;","color: #9ca3af;","color: #10b981; font-weight: bold;","color: #667a9bff;",($=A.value)==null?void 0:$.value)}):console.log(" (none)"),r.type===d.VariableInstance||r.type===d.VariableDeclaration){const A=zr(r),w=Xu(A,this.valueResolutionContext);console.log(` %cExisting Value%c of [${ye(A,this.project)}]:`,"color: #ec4899; font-weight: bold;","color: #667a9bff;",(v=w==null?void 0:w.value)==null?void 0:v.value)}if(r.type===d.InternalCall){const A=r.parent;if(A){const w=Xu(A,this.valueResolutionContext);console.log(` %cParent Variable%c [${ye(A,this.project)}] Value:`,"color: #f59e0b; font-weight: bold;","color: #667a9bff;",(b=w==null?void 0:w.value)==null?void 0:b.value)}}}addEntity(i){var r;this.entities.includes(i)||(this.entities.push(i),(r=this.onAddEntityCallback)==null||r.call(this,i,{}))}async addEntityAsync(i,r={}){var a;this.entities.includes(i)||(this.entities.push(i),await((a=this.onAddEntityCallback)==null?void 0:a.call(this,i,r)))}addEntities(i){i.forEach(r=>this.addEntity(r))}async addEntitiesAsync(i,r={}){const a=X.YieldTracker.from(r),c=[];for(const e of i)c.push(this.addEntityAsync(e,r)),await a.tick();await Promise.all(c)}removeEntity(i){var r;if(i!==this.entryPoint){const a=this.entities.indexOf(i);a>-1&&(this.entities.splice(a,1),(r=this.onRemoveEntityCallback)==null||r.call(this,i,{}))}}hasEntity(i){var r;return this.entities.includes(i)?!0:i.parent&&((r=i.parent)==null?void 0:r.id)!==(i==null?void 0:i.id)?this.hasEntity(i.parent):!1}removeScheduled(i){const r=this.scheduled.indexOf(i);r>-1&&this.scheduled.splice(r,1)}hasScheduled(i){return!!this.scheduled.includes(i)}hasSkipped(i){return!!this.skipped.includes(i)}hasExecuted(i){return!!this.executed.includes(i)}hasEntityWithId(i){const r=this.project.get(i);return r?this.hasEntity(r):!1}onAddToSkippedList(i){this.onAddToSkippedListCallback=i}onAbortExecution(i){this.onAbortExecutionCallback=i}onAddEntity(i){this.onAddEntityCallback=i}onRemoveFromSkippedList(i){this.onRemoveFromSkippedListCallback=i}onRemoveEntity(i){this.onRemoveEntityCallback=i}addToExecutingList(i){this.executing.includes(i)||this.executing.push(i)}addToScheduledList(i){this.scheduled.includes(i)||this.scheduled.push(i)}removeFromScheduledList(i){const r=this.scheduled.indexOf(i);r>-1&&this.scheduled.splice(r,1)}removeFromExecutingList(i){var a;const r=this.executing.indexOf(i);r>-1&&(this.executing.splice(r,1),(a=this.onAbortExecutionCallback)==null||a.call(this,i,{}))}removeFromAlreadyExecutedList(i){const r=this.executed.indexOf(i);r>-1&&this.executed.splice(r,1)}removeFromSkippedList(i){var a;const r=this.skipped.indexOf(i);r>-1&&(this.skipped.splice(r,1),(a=this.onRemoveFromSkippedListCallback)==null||a.call(this,i,{}))}addToAlreadyExecutedList(i){this.executed.includes(i)||this.executed.push(i)}addToSkippedList(i){var r;this.skipped.includes(i)||(this.skipped.push(i),(r=this.onAddToSkippedListCallback)==null||r.call(this,i,{}))}getValueTypePreference(i){return this.parentContext.getValueTypePreference(i)||null}setValueTypePreference(i,r){this.parentContext.setValueTypePreference(i,r),this.emit(i,{})}}function eCi(s){var u,i;if(s.isList)return"list";if(((u=s.entity)==null?void 0:u.type)===d.DefinitionEntity)return"definition-entity";switch((i=s.entity)==null?void 0:i.name){case he.Number:return"number";case he.String:return"text";case he.Boolean:return"boolean";case he.UUID:return"uuid";case he.Date:return"date-time";default:return"definition-entity"}}const Qs={[d.PrimitiveEntity]:{singular:"Primitive",plural:"Primitives",shortSingular:"Primitive",shortPlural:"Primitives"},[d.DefinitionEntity]:{singular:"Definition",plural:"Definitions",shortSingular:"Definition",shortPlural:"Definitions"},[d.BuiltInBaseEntity]:{singular:"Base",plural:"Bases",shortSingular:"Base definition",shortPlural:"Base definitions"},[d.Property]:{singular:"Property",plural:"Properties",shortSingular:"Property",shortPlural:"Properties"},[d.FunctionDeclaration]:{singular:"Custom trigger",plural:"Custom triggers",shortSingular:"Trigger",shortPlural:"Triggers"},[d.FunctionCall]:{singular:"Execute trigger",plural:"Execute trigger",shortSingular:"Execute",shortPlural:"Execute"},[d.GlobalEvent]:{singular:"System trigger",plural:"System triggers",shortSingular:"Trigger",shortPlural:"Triggers"},[d.Project]:{singular:"Project",plural:"Projects",shortSingular:"Project",shortPlural:"Projects"},[d.VariableDeclaration]:{singular:"Variable",plural:"Variables",shortSingular:"Variable",shortPlural:"Variables"},[d.VariableInstance]:{singular:"Variable",plural:"Variables",shortSingular:"Variable",shortPlural:"Variables"},[d.Condition]:{singular:"Condition",plural:"Conditions",shortSingular:"Condition",shortPlural:"Conditions"},[d.Operation]:{singular:"Operation",plural:"Operations",shortSingular:"Operation",shortPlural:"Operations"},[d.ReturnStatement]:{singular:"Termination",plural:"Terminations",shortSingular:"Termination",shortPlural:"Terminations"},[d.InstalledProject]:{singular:"Installed project",plural:"Installed projects",shortSingular:"Project",shortPlural:"Projects"},[d.Search]:{singular:"Search",plural:"Searches",shortSingular:"Search",shortPlural:"Searches"},[d.Loop]:{singular:"Loop",plural:"Loops",shortSingular:"Loop",shortPlural:"Loops"},[d.ActionDescriptor]:{singular:"Action descriptor",plural:"Action descriptors",shortSingular:"Action descriptor",shortPlural:"Action descriptors"},[d.InternalCall]:{singular:"Internal call",plural:"Internal calls",shortSingular:"Internal call",shortPlural:"Internal calls"},[d.BreakStatement]:{singular:"Loop exit",plural:"Loop exists",shortSingular:"Exit",shortPlural:"Exits"},[d.ContinueStatement]:{singular:"Next iteration",plural:"Next iterations",shortSingular:"Next",shortPlural:"Nexts"},[d.ArgumentDeclaration]:{singular:"Input definition",plural:"Input definitions",shortSingular:"Input",shortPlural:"Inputs"},[d.InputMap]:{singular:"Input",plural:"Inputs",shortSingular:"Input",shortPlural:"Inputs"},[d.OutputMap]:{singular:"Output",plural:"Outputs",shortSingular:"Output",shortPlural:"Outputs"},[d.ValueDescriptor]:{singular:"Value descriptor",plural:"Value descriptors",shortSingular:"Value descriptor",shortPlural:"Value descriptors"},[d.DataType]:{singular:"Data type",plural:"Data types",shortSingular:"Data type",shortPlural:"Data types"},[d.LiteralValue]:{singular:"Literal value",plural:"Literal values",shortSingular:"Value",shortPlural:"Values"}};function AL(s){const u=Tw(s);if(!u){const r=Cm(s);if(r.includes(be.HTTP_ENDPOINT))return"HTTP endpoint";if(r.includes(be.PERSISTED_ENTITY))return"SQL database table";if(r.includes(be.CRON_JOB))return"Scheduled execution";if(r.includes(be.RELATIONAL_DATABASE))return"Relational database";if(r.includes(be.CONTAINER_COMPUTE_ENTITY))return"Container compute";if(r.includes(be.SHARED_DRIVE_ENTITY))return"Shared files drive";if(r.includes(be.COMPUTE_ENTITY))return"Compute";if(r.includes(be.AIRTABLE_AUTH_CONNECTION))return"Airtable account connection";if(r.includes(be.GOOGLE_AUTH_CONNECTION))return"Google account connection";if(r.includes(be.SLACK_AUTH_CONNECTION))return"Slack account connection";if(r.includes(be.ATLASSIAN_AUTH_CONNECTION))return"Atlassian account connection";if(r.includes(be.JIRA_AUTH_CONNECTION))return"Jira account connection";if(r.includes(be.MICROSOFT_AUTH_CONNECTION))return"Microsoft account connection";if(r.includes(be.OPENAI_AUTH_CONNECTION))return"OpenAI account connection";if(r.includes(be.EXTERNAL_INTEGRATION_CONNECTION))return"External account connection"}if(u){let r="Extension of "+ye(u,u.project)+" entity",a=el(r);const c=Cm(s);return c.includes(be.HTTP_ENDPOINT)?"HTTP endpoint"+(a?", "+a:""):c.includes(be.PERSISTED_ENTITY)?"SQL database table"+(a?", "+a:""):c.includes(be.CRON_JOB)?"Scheduled execution"+(a?", "+a:""):c.includes(be.RELATIONAL_DATABASE)?"Relational database"+(a?", "+a:""):c.includes(be.CONTAINER_COMPUTE_ENTITY)?"Container compute"+(a?", "+a:""):c.includes(be.SHARED_DRIVE_ENTITY)?"Shared files drive"+(a?", "+a:""):c.includes(be.COMPUTE_ENTITY)?"Compute"+(a?", "+a:""):c.includes(be.AIRTABLE_AUTH_CONNECTION)?"Airtable account connection"+(a?", "+a:""):c.includes(be.GOOGLE_AUTH_CONNECTION)?"Google account connection"+(a?", "+a:""):c.includes(be.SLACK_AUTH_CONNECTION)?"Slack account connection"+(a?", "+a:""):c.includes(be.ATLASSIAN_AUTH_CONNECTION)?"Atlassian account connection"+(a?", "+a:""):c.includes(be.JIRA_AUTH_CONNECTION)?"Jira account connection"+(a?", "+a:""):c.includes(be.MICROSOFT_AUTH_CONNECTION)?"Microsoft account connection"+(a?", "+a:""):c.includes(be.OPENAI_AUTH_CONNECTION)?"OpenAI account connection"+(a?", "+a:""):c.includes(be.EXTERNAL_INTEGRATION_CONNECTION)?"External account connection"+(a?", "+a:""):r}let i="";return s.abstract&&(i="Template "),s.static&&(i+=i?" single copy ":"Single copy "),i?i+"definition":"Definition"}function yke(s){return s.parent.type===d.DefinitionEntity||s.parent.type===d.InstalledProject?"Internal action of "+ye(s.parent,s.project):s.parent.type===d.Loop?"Action repeated on every iteration":"Internal action of entity"}function gL(s){return FB(s)?yke(s):"Custom trigger"}function tCi(s){var u;switch(s.type){case d.DefinitionEntity:return AL(s);case d.FunctionDeclaration:return gL(s)}return(u=Qs[s.type])==null?void 0:u.singular}function iCi(s){var u;switch(s.type){case d.DefinitionEntity:return AL(s);case d.FunctionDeclaration:return gL(s)}return(u=Qs[s.type])==null?void 0:u.singular}const IL=4e4,RL=280,rCi=300,DL=65,yy=32,dm=39,cE=26,hke=49,fE=44,nCi=35,bI=52,LD=10,Cs=LD*2,uc=38,AI=90,SI=270,mke=IL/2+120,Tke=IL/2+180;function wL(s){let i=yy+fE+uc+LD;const r=[...s.inputs];return r.length&&(i+=Cs,r.forEach(()=>{i+=cE})),{height:i,width:280}}function yE(s){var a,c;let i=yy+fE+uc+LD;const r=[...s.inputs];return r.length&&(i+=Cs,r.forEach(()=>{i+=cE})),s.andChildrenGroup&&(i+=Cs,s.andChildrenGroup.forEach(e=>{i+=yE(e).height})),s.orChildrenGroup&&(i+=Cs,s.orChildrenGroup.forEach(e=>{i+=yE(e).height})),(((a=s.declaration)==null?void 0:a.id)===j.condition["condition-group-and"].id||((c=s.declaration)==null?void 0:c.id)===j.condition["condition-group-or"].id)&&(i+=uc),{height:i,width:280}}function vke(s){var h,m;let i=DL;const r=[];if([d.DefinitionEntity].includes(s.type)){const v=[...s.suggestedProperties||[],...s.properties||[]];v.length&&(i+=Cs,v.forEach(b=>{i+=b.static?hke:dm}))}if([d.DefinitionEntity,d.InstalledProject,d.Loop].includes(s.type)){const v=[...(s==null?void 0:s.suggestedMethods)||[],...s.methods||[],...s.functions||[],...s.body?[s.body]:[]];v.length&&(i+=Cs,v.forEach(b=>{const A=wL(b);i+=A.height}))}ei.includes(s.type)?(r.push(...(s.inputs||[]).flatMap(v=>[v])||[]),i+=Cs,i+=fE,s.error&&(i+=bI)):[d.ReturnStatement,d.BreakStatement,d.ContinueStatement].includes(s.type)?(r.push(...s.outputs||[]),s.throws&&(i+=bI)):s.type===d.Condition&&(r.push(s.inputs[0]),s.inputs[1]&&r.push(s.inputs[1]),(((h=s.declaration)==null?void 0:h.id)===j.condition["condition-group-and"].id||((m=s.declaration)==null?void 0:m.id)===j.condition["condition-group-or"].id)&&(i+=uc),s.andChildrenGroup&&(i+=Cs,s.andChildrenGroup.forEach(v=>{i+=yE(v).height})),s.orChildrenGroup&&(i+=Cs,s.orChildrenGroup.forEach(v=>{i+=yE(v).height})));const a=r.length;a&&(i+=a*dm,i+=Cs);const c=[];if(s.type===d.FunctionDeclaration||s.type===d.GlobalEvent?c.push(...s.inputs||[]):ei.includes(s.type)&&c.push(...s.outputs||[]),mi.includes(s.type)){i+=Cs,i+=fE,s.usedInternalCalls.length&&s.usedInternalCalls.forEach(b=>{i+=bI+Cs,i+=b.inputs.length*cE,i+=b.outputs.length*cE});const v=s.getDataType(null);(!v||v.canModifyObjectStructure())&&(i+=uc)}s.type===d.Search&&(i+=uc);const e=c.length;return e&&(i+=e*dm,i+=Cs),[d.DefinitionEntity,d.FunctionDeclaration,d.ReturnStatement,d.BreakStatement,d.ContinueStatement].includes(s.type)&&(i+=uc),{height:i,width:280}}function Eke(s){let u=0;if(s.parent.type!==d.DefinitionEntity)return{offset:u};const i=s.parent,r=i.methods.findIndex(c=>c.id===s.id);return i.methods.slice(0,r).forEach(c=>{const e=wL(c);u+=e.height}),(i.properties.length||i.suggestedProperties.length)&&(u+=Cs,i.suggestedProperties.forEach(()=>{u+=dm}),i.properties.forEach(()=>{u+=dm})),{offset:u}}function Lb(s){return`${s.split("-").map((r,a)=>a===0?r.charAt(0).toUpperCase()+r.slice(1):r.toLowerCase()).join(" ")}.`}function aCi(s){switch(s.code){case ge.AbstractEntityWithNonAbstractMethods:return"This template entity has non-template actions";case ge.AbstractEntityWithNonAbstractProperties:return"This template entity has non-template properties";case ge.IncorrectEntityImplementation:return"This entity incorrectly implements a template entity";case ge.IncorrectMethodImplementation:return"This action incorrectly implements the template action it's based on";case ge.IncorrectPropertyImplementation:return"This property incorrectly implements the template property it's based on";case ge.AbstractMethodInNonAbstractEntity:return"This action is a template action in a non-template entity";case ge.AbstractPropertyInNonAbstractEntity:return"This property is a template property in a non-template entity";case Pe.MethodOverwritesOtherSiblingWithSameName:return"An action in this entity overwrites an action in the template entity with the same name";case Pe.PropertyOverwritesOtherSiblingWithSameName:return"A property in this entity overwrites a property in the template entity with the same name";case ge.MissingMethodImplementation:return"This entity is missing an action implementation from the template entity";case ge.MissingPropertyImplementation:return"This entity is missing a property implementation from the template entity";case Pe.NameNotUniqueInScope:return"Invalid name. There is another entity with the same name in the same scope";case ge.NoProperties:return"This entity has no properties, so it doesn't do anything";case ge.NonStaticPropertyInStaticEntity:return"This property is not static in a static entity";case ge.StaticEntityWithNonStaticProperties:return"This static entity has non-static properties";case ge.ReadingFromIncompatibleType:return"This entity reads data from a value of a different data type";case ge.WritingToIncompatibleType:return"This entity writes data to a value of a different data type";case ge.ScopeWithoutLogic:return"This action has no logic, so it doesn't do anything";case ge.NonStaticPropertyImplementsStatic:return"This property is static in a non-static entity";case ge.PropertyImplementsIncompatibleType:return"This property implements a property of a different data type";case ge.PropertyImplementsNonAbstact:return"This property implements a non-template property";case ge.StaticPropertyImplementsNonStatic:return"This static property implements a non-static property";case ge.VariableCallsOthersAndHasInternalCall:return"This variable calls other entities while being used to execute internal logic";case ge.VariableHasInputsAndInternalCall:return"This variable has inputs while being used to execute internal logic";case ge.VariableHasOutputsAndInternalCall:return"This variable has outputs while being used to execute internal logic";case ge.VariableIsCalledAndHasInternalCall:return"This variable is called while being used to execute internal logic";case Pe.InternalCallDeclarationIsInvalidType:return"This internal call is not an action";case Pe.InternalCallDeclarationNotFoundInParentDatatypeEntity:return"This internal call is not found in the parent entity";case Pe.InternalCallParentDeclarationEntityInvalidType:return"This internal call parent entity is not a data type";case Pe.InternalCallParentMissingDataType:return"This internal call parent entity has no data type";case Pe.UnreachableEntity:return"This entity is unreachable";case ge.DisconnectedCallableEntity:return"This entity is disconnected and won't be executed by anything after publishing";case ge.AbstractEntityImplements:return"This template entity implements a non-template entity";case ge.AbstractExtendingNonAbstractEntity:return"This template entity extends a non-template entity";case ge.InvalidPropertiesCombination:return"This entity has an invalid combination of properties";case ge.ExtendingNonInteractiveEntity:return"This entity extends a non-interactive entity";case ge.ExtendsIncompatibleEntities:return"This entity extends incompatible entities";case ge.ImplementingNonAbstractEntity:return"This entity implements a non-template entity";case ge.ImplementsIncompatibleEntities:return"This entity implements incompatible entities";case ge.LackingReturnStatementOnSomeBranches:return"This action is missing a termination on some branches";case ge.LastCalledEntityMustBeReturnEntity:return"The last called entity in this action must be a termination node";case ge.MissingRequiredValue:return"This action is missing a required value";case ge.NoPrimaryKeyProperty:return"This entity has no primary key property";case ge.NonAbstractExtendingAbstractEntity:return"This non-template entity extends a template entity";case ge.NonStaticExtendingStaticEntity:return"This non-static entity extends a static entity";case ge.NonStaticImplementingStaticEntity:return"This non-static entity implements a static entity";case ge.StaticExtendingNonStaticEntity:return"This static entity extends a non-static entity";case ge.StaticImplementingNonStaticEntity:return"This static entity implements a non-static entity";case ge.VariableReadsValueAndInternalCall:return"This variable reads a value while being used to execute internal logic";case ge.VariableWritesValuesAndInternalCall:return"This variable writes values while being used to execute internal logic";case Pe.InternalCallDeclarationNotInParentDatatypeEntity:return"This internal call declaration is not in the parent entity";case Pe.EmptyName:return"This entity has no name";case Pe.InvalidObjectStructure:return"This entity has an invalid structure";case Pe.LoopBodyFunctionOverwrite:return"This loop body action overwrites an action in the template entity with the same name";case Pe.MethodOverwritesBaseMethodWithSameImplementation:return"This action overwrites a base action with the same implementation";case Pe.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return"This action overwrites an action in an extended entity with the same implementation";case Pe.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return"This action overwrites an action in an implemented entity with the same implementation";case Pe.MissingCaller:return"This action is missing a caller";case Pe.NameAsResolvedCodeNameNotUniqueInScope:return"This entity has a name that is not unique in the scope of the code it is used in";case Pe.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return"This entity name can only contain letters, numbers, underscores and spaces";case Pe.NameMustStartWithLetterOrUnderscore:return"This entity name must start with a letter or an underscore";case Pe.NoOverlapWithImplementedSignature:return"This action does not overlap with the implemented action signature";case Pe.PropertyOverwritesBasePropertyWithSameImplementation:return"This property overwrites a base property with the same implementation";case Pe.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return"This property overwrites a property in an extended entity with the same implementation";case Pe.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return"This property overwrites a property in an implemented entity with the same implementation";case Pe.ReaderWriterIncompatibleDataType:return"This reader/writer has an incompatible data type with the value it is reading/writing";case lu.StatusCodeMustBeBetween100And599:return"HTTP status code must be between 100 and 599";case lu.StatusCodeMustBeNumber:return"HTTP status code must be a number, between 100 and 599";case tl.UUIDMustBeString:return`UUID must be a string, eg: "${hc()}"`;case tl.UUIDMustNotContainSpaces:return`UUID must not contain spaces, eg: "${hc()}"`;case tl.UUIDMustBeValidFormat:return`UUID must be in a valid format. Eg: "${hc()}"`;case Ra.MustBeUniqueAmongSameEntities:return"This value must be unique among the same kind";case Ra.StringValueMustNotHaveDashes:return"This value must not contain dashes";case Ra.StringValueMustNotHaveSpaces:return"This value must not contain spaces";case Ra.ValueMustBeString:return"This value must be a string";case zv.DayOfMonthAndWeekConflict:return"Cron expression cannot have both day of month and day of week";case zv.InvalidCharacters:return"Cron expression has invalid characters";case zv.MustHaveSixFields:return"Cron expression must have six fields";case ge.CalledBeforeDeclaration:return"Called before declaration";case ge.CalledInParallelBranchToDeclaration:return"Cannot call this action in a parallel branch";case ge.DefaultValueOverridesConstantProperty:return"Cannot override constant property";case ge.DefaultValueOverridesConstantVariable:return"Cannot override constant variable";case ge.EmptyGroupCondition:return"Cannot have an empty condition group";case ge.HigherScopeThanDeclaration:return"In higher scope than declaration";case ge.MissingEnumOptions:return"Missing enum options";case ge.ParentScopeRequiresReturnCurrentCatchesErrorWithNoCalls:return"Current node catches its errors with no further calls which terminates the branch, but the parent trigger requires a returned value";case ge.ValueReadingOverridesConstantProperty:return"Value reading overrides constant property";case ge.ValueReadingOverridesConstantVariable:return"Value reading overrides constant variable";case Pe.GlobalVariableDeclarationCannotBeCalled:return"Global variable declaration cannot be called";case Pe.GlobalVariableDeclarationCannotCallOnError:return"Global variable declaration cannot have error calls";case Pe.GlobalVariableDeclarationCannotCatchError:return"Global variable declaration cannot catch errors";case Pe.InternalCallDeclarationNotFound:return"Internal call declaration not found";case Pe.NameIsForbiddenKeyword:return"The name given is a forbidden keyword";default:return Lb(s.code)}}function sCi(s){switch(s.code){case ge.AbstractEntityWithNonAbstractMethods:return"Non-template actions";case ge.AbstractEntityWithNonAbstractProperties:return"Non-template properties";case ge.IncorrectEntityImplementation:return"Incorrect implementation";case ge.IncorrectMethodImplementation:return"Incorrect action implementation";case ge.IncorrectPropertyImplementation:return"Incorrect property implementation";case ge.AbstractMethodInNonAbstractEntity:return"Template action in non-template entity";case ge.AbstractPropertyInNonAbstractEntity:return"Template property in non-template entity";case Pe.MethodOverwritesOtherSiblingWithSameName:return"Action overwrite";case Pe.PropertyOverwritesOtherSiblingWithSameName:return"Property overwrite";case ge.MissingMethodImplementation:return"Missing action";case ge.MissingPropertyImplementation:return"Missing property";case Pe.NameNotUniqueInScope:return"Duplicate name";case ge.NoProperties:return"No properties";case ge.NonStaticPropertyInStaticEntity:return"Non-static property";case ge.StaticEntityWithNonStaticProperties:return"Non-static properties";case ge.ReadingFromIncompatibleType:return"Read from different type";case ge.WritingToIncompatibleType:return"Write to different type";case ge.ScopeWithoutLogic:return"No logic";case ge.NonStaticPropertyImplementsStatic:return"Invalid static property";case ge.PropertyImplementsIncompatibleType:return"Incompatible data type";case ge.PropertyImplementsNonAbstact:return"Non-template property";case ge.StaticPropertyImplementsNonStatic:return"Non-static property";case ge.VariableCallsOthersAndHasInternalCall:return"Bad internal call";case ge.VariableHasInputsAndInternalCall:return"Bad internal call";case ge.VariableHasOutputsAndInternalCall:return"Bad internal call";case ge.VariableIsCalledAndHasInternalCall:return"Bad internal call";case Pe.InternalCallDeclarationIsInvalidType:return"Declaration not an action";case Pe.InternalCallDeclarationNotFoundInParentDatatypeEntity:return"Declaration not found in parent";case Pe.InternalCallParentDeclarationEntityInvalidType:return"Invalid parent declaration type";case Pe.InternalCallParentMissingDataType:return"Parent has no data type";case Pe.InternalCallDeclarationNotInParentDatatypeEntity:return"Declaration not in parent";case Pe.UnreachableEntity:return"Unreachable entity";case ge.DisconnectedCallableEntity:return"Disconnected entity";case ge.AbstractEntityImplements:return"Abstract entity implements a non-template entity";case ge.AbstractExtendingNonAbstractEntity:return"Abstract entity extends a non-template entity";case ge.InvalidPropertiesCombination:return"Invalid properties combination";case ge.ExtendingNonInteractiveEntity:return"Extending non-interactive entity";case ge.ExtendsIncompatibleEntities:return"Extends incompatible entities";case ge.ImplementingNonAbstractEntity:return"Implementing non-template entity";case ge.ImplementsIncompatibleEntities:return"Implements incompatible entities";case ge.LackingReturnStatementOnSomeBranches:return"Missing termination on some branches";case ge.LastCalledEntityMustBeReturnEntity:return"Last called entity must be a termination node";case ge.MissingRequiredValue:return"Missing required value";case ge.NoPrimaryKeyProperty:return"No primary key property";case ge.NonAbstractExtendingAbstractEntity:return"Non-template entity extending a template entity";case ge.NonStaticExtendingStaticEntity:return"Non-static entity extending a static entity";case ge.NonStaticImplementingStaticEntity:return"Non-static entity implementing a static entity";case ge.StaticExtendingNonStaticEntity:return"Static entity extending a non-static entity";case ge.StaticImplementingNonStaticEntity:return"Static entity implementing a non-static entity";case ge.VariableReadsValueAndInternalCall:return"Variable reads value and has internal call";case ge.VariableWritesValuesAndInternalCall:return"Variable writes values and has internal call";case Pe.EmptyName:return"Empty name";case Pe.InvalidObjectStructure:return"Invalid object structure";case Pe.LoopBodyFunctionOverwrite:return"Loop body action overwrites action with same name";case Pe.MethodOverwritesBaseMethodWithSameImplementation:return"Action overwrites base action with same implementation";case Pe.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return"Action overwrites another with same implementation";case Pe.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return"Action overwrites another with same implementation";case Pe.MissingCaller:return"Missing caller";case Pe.NameAsResolvedCodeNameNotUniqueInScope:return"Name not unique in scope";case Pe.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return"Name can only contain letters, numbers, underscores and spaces";case Pe.NameMustStartWithLetterOrUnderscore:return"Name must start with letter or underscore";case Pe.NoOverlapWithImplementedSignature:return"No overlap with implemented signature";case Pe.PropertyOverwritesBasePropertyWithSameImplementation:return"Property overwrites base property with same implementation";case Pe.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return"Property overwrites another with same implementation";case Pe.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return"Property overwrites another with same implementation";case Pe.ReaderWriterIncompatibleDataType:return"Reader/writer incompatible data type";case lu.StatusCodeMustBeBetween100And599:return"HTTP status code must be between 100 and 599";case lu.StatusCodeMustBeNumber:return"HTTP status code must be a number";case tl.UUIDMustBeString:return"UUID must be a string";case tl.UUIDMustNotContainSpaces:return"UUID must not contain spaces";case tl.UUIDMustBeValidFormat:return"UUID must be in a valid format";case Ra.MustBeUniqueAmongSameEntities:return"This value must be unique among the same kind";case Ra.StringValueMustNotHaveDashes:return"This value must not contain dashes";case Ra.StringValueMustNotHaveSpaces:return"This value must not contain spaces";case ge.CalledBeforeDeclaration:return"Called before declaration";case ge.CalledInParallelBranchToDeclaration:return"Cannot call in a parallel branch";case ge.DefaultValueOverridesConstantProperty:return"Cannot override constant";case ge.DefaultValueOverridesConstantVariable:return"Cannot override constant";case ge.EmptyGroupCondition:return"Empty condition group";case ge.HigherScopeThanDeclaration:return"Higher scope than declaration";case ge.MissingEnumOptions:return"Missing enum options";case ge.ParentScopeRequiresReturnCurrentCatchesErrorWithNoCalls:return"Catches errors with no further calls, but the parent trigger requires a returned value";case ge.ValueReadingOverridesConstantProperty:return"Value reading overrides constant";case ge.ValueReadingOverridesConstantVariable:return"Value reading overrides constant";case Pe.GlobalVariableDeclarationCannotBeCalled:return"Global variable declaration cannot be called";case Pe.GlobalVariableDeclarationCannotCallOnError:return"Global variable declaration cannot have error calls";case Pe.GlobalVariableDeclarationCannotCatchError:return"Global variable declaration cannot catch errors";case Pe.InternalCallDeclarationNotFound:return"Internal call declaration not found";case Pe.NameIsForbiddenKeyword:return"Name is a forbidden keyword";default:return Lb(s.code)}}function lCi(s){switch(s.code){case ge.AbstractEntityWithNonAbstractMethods:return`${ye(s.entity,s.entity.project)} has non-template actions`;case ge.AbstractEntityWithNonAbstractProperties:return`${ye(s.entity,s.entity.project)} has non-template properties`;case ge.IncorrectEntityImplementation:return`${ye(s.entity,s.entity.project)} incorrectly implements template`;case ge.IncorrectMethodImplementation:return`${ye(s.entity,s.entity.project)} incorrectly implements the template`;case ge.IncorrectPropertyImplementation:return`${ye(s.entity,s.entity.project)} incorrectly implements the template`;case ge.AbstractMethodInNonAbstractEntity:return`${ye(s.entity,s.entity.project)} can't be a template`;case ge.AbstractPropertyInNonAbstractEntity:return`${ye(s.entity,s.entity.project)} can't be a template`;case Pe.MethodOverwritesOtherSiblingWithSameName:return`${ye(s.entity,s.entity.project)} overwrites action`;case Pe.PropertyOverwritesOtherSiblingWithSameName:return`${ye(s.entity,s.entity.project)} overwrites property`;case ge.MissingMethodImplementation:return`${ye(s.entity,s.entity.project)} is missing action`;case ge.MissingPropertyImplementation:return`${ye(s.entity,s.entity.project)} is missing property`;case Pe.NameNotUniqueInScope:return`${ye(s.entity,s.entity.project)} name is not unique`;case ge.NoProperties:return`${ye(s.entity,s.entity.project)} has no properties`;case ge.NonStaticPropertyInStaticEntity:return`${ye(s.entity,s.entity.project)} has non-static property`;case ge.StaticEntityWithNonStaticProperties:return`${ye(s.entity,s.entity.project)} has non-static properties`;case ge.ReadingFromIncompatibleType:return`${ye(s.entity,s.entity.project)} reads from different type`;case ge.WritingToIncompatibleType:return`${ye(s.entity,s.entity.project)} writes to different type`;case ge.ScopeWithoutLogic:return`${ye(s.entity,s.entity.project)} has no logic`;case ge.NonStaticPropertyImplementsStatic:return`${ye(s.entity,s.entity.project)} has invalid static property`;case ge.PropertyImplementsIncompatibleType:return`${ye(s.entity,s.entity.project)} has incompatible data type`;case ge.PropertyImplementsNonAbstact:return`${ye(s.entity,s.entity.project)} has non-template property`;case ge.StaticPropertyImplementsNonStatic:return`${ye(s.entity,s.entity.project)} has non-static property`;case ge.VariableCallsOthersAndHasInternalCall:return`${ye(s.entity,s.entity.project)} has bad internal call`;case ge.VariableHasInputsAndInternalCall:return`${ye(s.entity,s.entity.project)} has bad internal call`;case ge.VariableHasOutputsAndInternalCall:return`${ye(s.entity,s.entity.project)} has bad internal call`;case ge.VariableIsCalledAndHasInternalCall:return`${ye(s.entity,s.entity.project)} has bad internal call`;case Pe.InternalCallDeclarationIsInvalidType:return`${ye(s.entity,s.entity.project)} has declaration that is not an action`;case Pe.InternalCallDeclarationNotFoundInParentDatatypeEntity:return`${ye(s.entity,s.entity.project)} has declaration that is not found in parent`;case Pe.InternalCallParentDeclarationEntityInvalidType:return`${ye(s.entity,s.entity.project)} has invalid parent declaration type`;case Pe.InternalCallParentMissingDataType:return`${ye(s.entity,s.entity.project)}'s parent has no data type`;case Pe.InternalCallDeclarationNotInParentDatatypeEntity:return`${ye(s.entity,s.entity.project)} has declaration that is not in parent`;case Pe.UnreachableEntity:return`${ye(s.entity,s.entity.project)} is unreachable`;case ge.DisconnectedCallableEntity:return`${ye(s.entity,s.entity.project)} is not executed by any entity`;case ge.AbstractEntityImplements:return`${ye(s.entity,s.entity.project)} implements a non-template entity`;case ge.AbstractExtendingNonAbstractEntity:return`${ye(s.entity,s.entity.project)} extends a non-template entity`;case ge.InvalidPropertiesCombination:return`${ye(s.entity,s.entity.project)} has invalid properties combination`;case ge.ExtendingNonInteractiveEntity:return`${ye(s.entity,s.entity.project)} extends a non-interactive entity`;case ge.ExtendsIncompatibleEntities:return`${ye(s.entity,s.entity.project)} extends incompatible entities`;case ge.ImplementingNonAbstractEntity:return`${ye(s.entity,s.entity.project)} implements a non-template entity`;case ge.ImplementsIncompatibleEntities:return`${ye(s.entity,s.entity.project)} implements incompatible entities`;case ge.LackingReturnStatementOnSomeBranches:return`${ye(s.entity,s.entity.project)} is missing termination on some branches`;case ge.LastCalledEntityMustBeReturnEntity:return`${ye(s.entity,s.entity.project)}'s last called entity must be a termination node`;case ge.MissingRequiredValue:return`${ye(s.entity,s.entity.project)} is missing a required value`;case ge.NoPrimaryKeyProperty:return`${ye(s.entity,s.entity.project)} has no primary key property`;case ge.NonAbstractExtendingAbstractEntity:return`${ye(s.entity,s.entity.project)} extends a template entity`;case ge.NonStaticExtendingStaticEntity:return`${ye(s.entity,s.entity.project)} extends a static entity`;case ge.NonStaticImplementingStaticEntity:return`${ye(s.entity,s.entity.project)} implements a static entity`;case ge.StaticExtendingNonStaticEntity:return`${ye(s.entity,s.entity.project)} extends a non-static entity`;case ge.StaticImplementingNonStaticEntity:return`${ye(s.entity,s.entity.project)} implements a non-static entity`;case ge.VariableReadsValueAndInternalCall:return`${ye(s.entity,s.entity.project)} reads a value and has internal call`;case ge.VariableWritesValuesAndInternalCall:return`${ye(s.entity,s.entity.project)} writes values and has internal call`;case Pe.EmptyName:return`${Qs[s.entity.type]} has no name`;case Pe.InvalidObjectStructure:return`${ye(s.entity,s.entity.project)} has invalid structure`;case Pe.LoopBodyFunctionOverwrite:return`${ye(s.entity,s.entity.project)}'s loop body action overwrites an action`;case Pe.MethodOverwritesBaseMethodWithSameImplementation:return`${ye(s.entity,s.entity.project)} overwrites base action`;case Pe.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return`${ye(s.entity,s.entity.project)} overwrites another action with same implementation`;case Pe.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return`${ye(s.entity,s.entity.project)} overwrites another action with same implementation`;case Pe.MissingCaller:return`${ye(s.entity,s.entity.project)} is missing a caller`;case Pe.NameAsResolvedCodeNameNotUniqueInScope:return`${ye(s.entity,s.entity.project)} has a name not unique in the scope`;case Pe.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return`${ye(s.entity,s.entity.project)} name can only contain letters, numbers, underscores and spaces`;case Pe.NameMustStartWithLetterOrUnderscore:return`${ye(s.entity,s.entity.project)} name must start with letter or underscore`;case Pe.NoOverlapWithImplementedSignature:return`${ye(s.entity,s.entity.project)} has no overlap with implemented signature`;case Pe.PropertyOverwritesBasePropertyWithSameImplementation:return`${ye(s.entity,s.entity.project)} overwrites base property`;case Pe.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return`${ye(s.entity,s.entity.project)} overwrites another property with same implementation`;case Pe.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return`${ye(s.entity,s.entity.project)} overwrites another property with same implementation`;case Pe.ReaderWriterIncompatibleDataType:return`${ye(s.entity,s.entity.project)} has reader/writer with incompatible data type`;case lu.StatusCodeMustBeBetween100And599:return`${ye(s.entity,s.entity.project)} HTTP status code must be between 100 and 599`;case lu.StatusCodeMustBeNumber:return`${ye(s.entity,s.entity.project)} HTTP status code must be a number`;case tl.UUIDMustBeString:return`${ye(s.entity,s.entity.project)} UUID must be a string`;case tl.UUIDMustNotContainSpaces:return`${ye(s.entity,s.entity.project)} UUID must not contain spaces`;case tl.UUIDMustBeValidFormat:return`${ye(s.entity,s.entity.project)} UUID must be in a valid format`;case Ra.MustBeUniqueAmongSameEntities:return`${ye(s.entity,s.entity.project)} value must be unique among the same kind`;case Ra.StringValueMustNotHaveDashes:return`${ye(s.entity,s.entity.project)} value must not contain dashes`;case Ra.StringValueMustNotHaveSpaces:return`${ye(s.entity,s.entity.project)} value must not contain spaces`;default:return`${ye(s.entity,s.entity.project)} Error: ${Lb(s.code)}`}}function oCi(s){var u,i,r,a;switch(s.code){case ge.AbstractEntityWithNonAbstractMethods:return`${ye(s.entity,s.entity.project)} has non-template actions`;case ge.AbstractEntityWithNonAbstractProperties:return`${ye(s.entity,s.entity.project)} has non-template properties`;case ge.IncorrectEntityImplementation:return`${ye(s.entity,s.entity.project)} incorrectly implements the template entity`;case ge.IncorrectMethodImplementation:return`${ye(s.entity,s.entity.project)} incorrectly implements the template action it's based on`;case ge.IncorrectPropertyImplementation:return`${ye(s.entity,s.entity.project)} incorrectly implements the template property it's based on`;case ge.AbstractMethodInNonAbstractEntity:return`${ye(s.entity,s.entity.project)} is a template action in a non-template entity`;case ge.AbstractPropertyInNonAbstractEntity:return`${ye(s.entity,s.entity.project)} is a template property in a non-template entity`;case Pe.MethodOverwritesOtherSiblingWithSameName:return`${ye(s.entity,s.entity.project)} overwrites an action in the template entity`;case Pe.PropertyOverwritesOtherSiblingWithSameName:return`${ye(s.entity,s.entity.project)} overwrites a property in the template entity`;case ge.MissingMethodImplementation:return`${ye(s.entity,s.entity.project)} is missing an action implementation from the template entity`;case ge.MissingPropertyImplementation:return`${ye(s.entity,s.entity.project)} is missing a property implementation from the template entity`;case Pe.NameNotUniqueInScope:return`${ye(s.entity,s.entity.project)} has a duplicate name in the same scope`;case ge.NoProperties:return`${ye(s.entity,s.entity.project)} has no properties, so it doesn't do anything`;case ge.NonStaticPropertyInStaticEntity:return`${ye(s.entity,s.entity.project)} has a non-static property in a static entity`;case ge.StaticEntityWithNonStaticProperties:return`${ye(s.entity,s.entity.project)} has non-static properties in a static entity`;case ge.ReadingFromIncompatibleType:return`${ye(s.entity,s.entity.project)} reads data from a value of a different data type`;case ge.WritingToIncompatibleType:return`${ye(s.entity,s.entity.project)} writes data to a value of a different data type`;case ge.ScopeWithoutLogic:return`${ye(s.entity,s.entity.project)} has no logic`;case ge.NonStaticPropertyImplementsStatic:return`${ye(s.entity,s.entity.project)} has a static property in a non-static entity`;case ge.PropertyImplementsIncompatibleType:return`${ye(s.entity,s.entity.project)} implements a property of a different data type`;case ge.PropertyImplementsNonAbstact:return`${ye(s.entity,s.entity.project)} implements a non-template property`;case ge.StaticPropertyImplementsNonStatic:return`${ye(s.entity,s.entity.project)} has a static property in a non-static entity`;case ge.VariableCallsOthersAndHasInternalCall:return`${ye(s.entity,s.entity.project)} calls other entities while being used to execute internal logic`;case ge.VariableHasInputsAndInternalCall:return`${ye(s.entity,s.entity.project)} has inputs while being used to execute internal logic`;case ge.VariableHasOutputsAndInternalCall:return`${ye(s.entity,s.entity.project)} has outputs while being used to execute internal logic`;case ge.VariableIsCalledAndHasInternalCall:return`${ye(s.entity,s.entity.project)} is called while being used to execute internal logic`;case Pe.InternalCallDeclarationIsInvalidType:return`${ye(s.entity,s.entity.project)} has a declaration that is not an action`;case Pe.InternalCallDeclarationNotFoundInParentDatatypeEntity:return`${ye(s.entity,s.entity.project)} has a declaration that is not found in ${(u=s.entity.parent.getDataType(null))!=null&&u.entity?ye((i=s.entity.parent.getDataType(null))==null?void 0:i.entity,s.entity.project):"the variable's data-type entity"}`;case Pe.InternalCallParentDeclarationEntityInvalidType:return`${ye(s.entity,s.entity.project)} is part of a variable whos data-type entity can't have actions`;case Pe.InternalCallParentMissingDataType:return`${ye(s.entity,s.entity.project)} is part of a variable with no data-type entity`;case Pe.InternalCallDeclarationNotInParentDatatypeEntity:return`${ye(s.entity,s.entity.project)} has a declaration doesn't belong to ${(r=s.entity.parent.getDataType(null))!=null&&r.entity?ye((a=s.entity.parent.getDataType(null))==null?void 0:a.entity,s.entity.project):"the variable's data-type entity"}`;case Pe.UnreachableEntity:return`${ye(s.entity,s.entity.project)} is unreachable`;case ge.DisconnectedCallableEntity:return`${ye(s.entity,s.entity.project)} is disconnected and won't be executed by anything after publishing`;case ge.AbstractEntityImplements:return`${ye(s.entity,s.entity.project)} implements a non-template entity`;case ge.AbstractExtendingNonAbstractEntity:return`${ye(s.entity,s.entity.project)} extends a non-template entity`;case ge.InvalidPropertiesCombination:return`${ye(s.entity,s.entity.project)} has an invalid combination of properties`;case ge.ExtendingNonInteractiveEntity:return`${ye(s.entity,s.entity.project)} extends a non-interactive entity`;case ge.ExtendsIncompatibleEntities:return`${ye(s.entity,s.entity.project)} extends incompatible entities`;case ge.ImplementingNonAbstractEntity:return`${ye(s.entity,s.entity.project)} implements a non-template entity`;case ge.ImplementsIncompatibleEntities:return`${ye(s.entity,s.entity.project)} implements incompatible entities`;case ge.LackingReturnStatementOnSomeBranches:return`${ye(s.entity,s.entity.project)} has branches that don't terminate`;case ge.LastCalledEntityMustBeReturnEntity:return`${ye(s.entity,s.entity.project)} must end with a termination node`;case ge.MissingRequiredValue:return`${ye(s.entity,s.entity.project)} is missing a required value`;case ge.NoPrimaryKeyProperty:return`${ye(s.entity,s.entity.project)} has no primary key property`;case ge.NonAbstractExtendingAbstractEntity:return`${ye(s.entity,s.entity.project)} is a non-template entity extending a template entity`;case ge.NonStaticExtendingStaticEntity:return`${ye(s.entity,s.entity.project)} is a non-static entity extending a static entity`;case ge.NonStaticImplementingStaticEntity:return`${ye(s.entity,s.entity.project)} is a non-static entity implementing a static entity`;case ge.StaticExtendingNonStaticEntity:return`${ye(s.entity,s.entity.project)} is a static entity extending a non-static entity`;case ge.StaticImplementingNonStaticEntity:return`${ye(s.entity,s.entity.project)} is a static entity implementing a non-static entity`;case ge.VariableReadsValueAndInternalCall:return`${ye(s.entity,s.entity.project)} reads a value and has an internal call`;case ge.VariableWritesValuesAndInternalCall:return`${ye(s.entity,s.entity.project)} writes values and has an internal call`;case Pe.EmptyName:return`${Qs[s.entity.type]} has no name`;case Pe.InvalidObjectStructure:return`${ye(s.entity,s.entity.project)} has an invalid structure`;case Pe.LoopBodyFunctionOverwrite:return`${ye(s.entity,s.entity.project)}'s loop body action overwrites`;case Pe.MethodOverwritesBaseMethodWithSameImplementation:return`${ye(s.entity,s.entity.project)} overwrites a base action with same implementation`;case Pe.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return`${ye(s.entity,s.entity.project)} overwrites another action with same implementation`;case Pe.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return`${ye(s.entity,s.entity.project)} overwrites another action with same implementation`;case Pe.MissingCaller:return`${ye(s.entity,s.entity.project)} is missing a caller`;case Pe.NameAsResolvedCodeNameNotUniqueInScope:return`${ye(s.entity,s.entity.project)} has a name that is not unique in the scope`;case Pe.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return`${ye(s.entity,s.entity.project)} name can only contain letters, numbers, underscores and spaces`;case Pe.NameMustStartWithLetterOrUnderscore:return`${ye(s.entity,s.entity.project)} name must start with letter or underscore`;case Pe.NoOverlapWithImplementedSignature:return`${ye(s.entity,s.entity.project)} has no overlap with implemented signature`;case Pe.PropertyOverwritesBasePropertyWithSameImplementation:return`${ye(s.entity,s.entity.project)} overwrites a base property with same implementation`;case Pe.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return`${ye(s.entity,s.entity.project)} overwrites another property with same implementation`;case Pe.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return`${ye(s.entity,s.entity.project)} overwrites another property with same implementation`;case Pe.ReaderWriterIncompatibleDataType:return`${ye(s.entity,s.entity.project)} has a reader/writer with incompatible data type`;case lu.StatusCodeMustBeBetween100And599:return`${ye(s.entity,s.entity.project)} HTTP status code must be between 100 and 599`;case lu.StatusCodeMustBeNumber:return`${ye(s.entity,s.entity.project)} HTTP status code must be a number, between 100 and 599`;case tl.UUIDMustBeString:return`${ye(s.entity,s.entity.project)} UUID must be a string, eg: "${hc()}"`;case tl.UUIDMustNotContainSpaces:return`${ye(s.entity,s.entity.project)} UUID must not contain spaces, eg: "${hc()}"`;case tl.UUIDMustBeValidFormat:return`${ye(s.entity,s.entity.project)} UUID must be in a valid format. Eg: "${hc()}"`;case Ra.MustBeUniqueAmongSameEntities:return`${ye(s.entity,s.entity.project)} value must be unique among the same kind`;case Ra.StringValueMustNotHaveDashes:return`${ye(s.entity,s.entity.project)} value must not contain dashes`;case Ra.StringValueMustNotHaveSpaces:return`${ye(s.entity,s.entity.project)} value must not contain spaces`;case ge.CalledBeforeDeclaration:return"Called before declaration";case ge.CalledInParallelBranchToDeclaration:return`${ye(s.entity,s.entity.project)} cannot be called in a parallel branch`;case ge.DefaultValueOverridesConstantProperty:return`${ye(s.entity,s.entity.project)} default value overrides constant property`;case ge.DefaultValueOverridesConstantVariable:return`${ye(s.entity,s.entity.project)} default value overrides constant variable`;case ge.EmptyGroupCondition:return`${ye(s.entity,s.entity.project)} contains an empty group condition`;case ge.HigherScopeThanDeclaration:return`${ye(s.entity,s.entity.project)} is in a higher scope than its declaration`;case ge.MissingEnumOptions:return`${ye(s.entity,s.entity.project)} is missing enum options`;case ge.ParentScopeRequiresReturnCurrentCatchesErrorWithNoCalls:return`${ye(s.entity,s.entity.project)} catches its errors but its parent scope requires a returned value`;case ge.ValueReadingOverridesConstantProperty:return`${ye(s.entity,s.entity.project)} is reading a value, but it is a constant property`;case ge.ValueReadingOverridesConstantVariable:return`${ye(s.entity,s.entity.project)} is reading a value, but it is a constant variable`;case Pe.GlobalVariableDeclarationCannotBeCalled:return`${ye(s.entity,s.entity.project)} is global variable declaration and cannot be called`;case Pe.GlobalVariableDeclarationCannotCallOnError:return`${ye(s.entity,s.entity.project)} is global variable declaration and cannot call on error`;case Pe.GlobalVariableDeclarationCannotCatchError:return`${ye(s.entity,s.entity.project)} is global variable declaration and cannot catch errors`;case Pe.InternalCallDeclarationNotFound:return`${ye(s.entity,s.entity.project)}'s declaration isn't found`;case Pe.NameIsForbiddenKeyword:return`${ye(s.entity,s.entity.project)}'s name is a forbidden keyword`;default:return`${ye(s.entity,s.entity.project)} Error: ${Lb(s.code)}`}}function Bb(s){const u=(s||"").startsWith("error-caller-only--");switch(u?s.replace("error-caller-only--",""):s){case Ci.CallIsInHigherScope:return"In a higher scope";case Ci.CallIsInLowerScope:return"In a lower scope";case Ci.CallerIsInHigherScope:return"Caller is in a higher scope";case Ci.CallerIsInLowerScope:return"Caller is in a lower scope";case Ci.CannotBeCalledByChildren:return"Cannot be called by children";case Ci.CannotCallAncestor:return"Cannot call ancestor";case Ci.CannotConnectToItself:return"Cannot connect to itself";case Ci.CannotReadMoreThanOneValue:return"Cannot read more than one value";case Ci.CannotReadValueFromChildren:return"Cannot read value from entities executed after itself";case Ci.CannotWriteValueToAncestor:return"Cannot write value to ancestor";case RE.Suggestion:return"Suggestion";case Ci.ContinueOrBreakStatementCalledFromOutsideLoop:return"Cannot be called from outside loop";case Ci.DataTypesNotCompatible:return"Data types not compatible";case Ci.ElementInLoopBodyCallingOutsideLoop:return"Cannot call outside loop";case Ci.ErrorOututMapCannotBeConnectedToParentSuccessBranchCallees:return"Error cannot be connected to success branch";case Ci.ExecutionsAlreadyConnected:return"Executions already connected";case Ci.IsNotValueReadingEntity:return"Is not a value reading entity";case Ci.IsNotValueWritingEntity:return"Is not a value writing entity";case Ci.NotInScope:return"Not in a compatible scope";case Ci.OtherIncompatibleScopeReason:return"Incompatible scope";case Ci.SiblingInternalCallAlreadyUsedInParentVariable:return"Internal call already used in parent variable";case Ci.SuccessOutputMapCannotBeConnectedToParentErrorBranchCallees:return"Success cannot be connected to error branch";case Ci.ValuesAlreadyConnected:return"Values already connected";case Ci.CannotInteractWithInputInVariableWithInternalCalls:return"Cannot interact with input in variable with internal calls";case Ci.CannotInteractWithOutputInVariableWithInternalCalls:return"Cannot interact with output in variable with internal calls";case RE.CanvasGloballyDisabled:return"Canvas is globally disabled";case Ci.PropertyIsConstantItsValueCantBeReset:return"Property is constant, its value can't be reset";case Ci.CannotWriteValueOfGlobalVariableDeclaration:return"Cannot write value of global variable declaration";case Ci.CannotReSetValueOfConstantVariable:return"Cannot re-set value of constant variable";case Ci.CannotConnectToOwnNode:return"It is part of the same node";case Ci.CalledByErrorMustBePassThroughCallable:return"Called by error must be pass-through callable";case Ci.CannotChangeScopeBecauseItCallsOtherEntities:return"Cannot change scope because it calls other entities in its current scope";case Ci.CannotChangeScopeBecauseItIsAlreadyCalledByOtherEntitiesInDifferentScope:return"Cannot change scope because it is already called by other entities in different scope";case Ci.VariableDeclarationCannotBeMovedToLowerScopeBecauseInstancesUsage:return"Variable declaration cannot be moved to lower scope because its instances are used in the current or different incompatible lower scope";case Ci.CalledBySourceMustBeCallerEntity:return"Not a caller type";case Ci.CalledByErrorCannotBeConnectedToEntitiesCalledByOwnSuccessBranch:return"Already connected to the success branch from a common origin caller";case Ci.CalledBySuccessCannotBeConnectedToEntitiesCalledByOwnErrorBranch:return"Already connected to the error branch from a common origin caller";case Ci.RedundantCall:return"Redundant call. Already connected further down the execution path";case Ci.CannotBeCalledBeforeDeclaration:return"Cannot be called before declaration";case Ci.CannotBeCalledInParallelBranchToDeclaration:return"Cannot be called in parallel branch to declaration";case Ci.CannotBeHigherScopeThanDeclaration:return"Cannot be in a higher scope than declaration";case Ci.CannotCallGlobalVariableDeclaration:return"Cannot call global variable declaration";case Ci.EntityAlreadyCalledBySuccessCannotBeConnectedToUnrelatedErrorBranch:return u?"Cannot connect error: Already connected to a success branch from a common origin caller":"Already connected to a success branch from a common origin caller";case Ci.CannotInteractWithInputInGlobalVariableDeclaration:return"Cannot interact with input in global variable declaration";case Ci.IsNotCallableEntity:return"Is not a callable node type";case Ci.IsNotCallerEntity:return"Is not a caller node type";case Ci.IsNotPassThroughCallableEntity:return"Is not a pass-through callable node type that has an error branch";case Ci.NotAConnectableEntityType:return"Not a connectable node type";case Ci.WouldMakeAnEarlierNodeBeCalledBeforeItsDeclaration:return"Would make an earlier node be called before its declaration";default:return Vf(s||"")}}function dCi(s,u){const i=[...s,...u],r=Array.from(new Set(i));return{hasChanged:r.length!==s.length,reasons:r}}function uCi(s,u){const i=s.filter(a=>!u.includes(a));return{hasChanged:i.length!==s.length,reasons:i}}function pCi(s,u){return s.find(i=>i.entity.id===u)||null}function Xj(s){return s.filter((u,i)=>s.indexOf(u)===i)}class $n{constructor(u,i,r=null,a){D(this,"ids",[]);D(this,"entity");D(this,"entityCardHeight");D(this,"entityCardWidth");D(this,"index");D(this,"childEntities",[]);D(this,"children",[]);D(this,"parents",[]);D(this,"calculationEntryPoint");D(this,"_onlyEntities",null);D(this,"_changeSet",null);if(this.index=i,this.entity=u,this.calculationEntryPoint=r||this,this._changeSet=a||null,this===this.calculationEntryPoint&&!a)throw new Error("Change-set must be provided for the calculation entry point");this.calculateCardSize(),this.getSortedChildren()}static autoGenerateLayout(u,i,r){const a=mke-SI-RL,c=Tke-AI-DL;u.type===d.Project?(u.x=a,u.y=c):u.metaSync({x:u.x||a,y:u.y||c},i);const e=new $n(u,0,null,i);e.calculationEntryPoint=e,e._onlyEntities=r||[],e.ids=["0"];const f=[];e.next(m=>{f.push(...m)}),$n.recursivelyAssembleChildrenAreas(f),e.resolveChildrenOverlaps();const h=e.flattenChildEntities();return e._onlyEntities?h.filter(m=>{var v;return(v=e._onlyEntities)==null?void 0:v.includes(m)}):h}static recursivelyAssembleChildrenAreas(u){const i=[];u.forEach(r=>{r.next(a=>{i.push(...a)})}),i.length>0&&$n.recursivelyAssembleChildrenAreas(i)}get onlyEntities(){return this.calculationEntryPoint._onlyEntities||[]}get changeSet(){return this.calculationEntryPoint._changeSet}set changeSet(u){this.calculationEntryPoint._changeSet=u}findAreaInChildrenFromEntity(u){if(this.entity===u)return this;const i=this.children.find(a=>a.entity===u);return i||this.children.reduce((a,c)=>a||c.findAreaInChildrenFromEntity(u),null)}findAreaFromEntity(u){if(this.entity===u)return this;const i=this.calculationEntryPoint.children,r=i.find(c=>c.entity===u);return r||i.reduce((c,e)=>c||e.findAreaInChildrenFromEntity(u),null)}addParent(u){if(!this.parents.includes(u)){const i=$n.resolveIds(u,this.index);this.ids.push(...i),this.parents.push(u)}}static resolveIds(u,i){return u?u.ids.map(r=>`${r}-${i}`):[`${i}`]}getSortedChildren(){if(this.entity.collapsed){this.childEntities=[];return}const u=Qo(this.entity,!0);if(this.entity.type===d.Project){const i=[],r=[],a=[];u.forEach(e=>{if(d.DefinitionEntity===e.type){r.push(e);return}else if(Ti.includes(e.type)){a.push(e);return}i.push(e)});const c=i.sort((e,f)=>{const h=!!iR(e,f).length,m=Qo(e),v=Qo(f);return h?0:m.length&&!v.length?-1:!m.length&&v.length?1:0}).filter(e=>!Mf(e).length);this.childEntities=[...r,...a,...c]}else{const i=[],r=[],a=[],c=[],e=[];Ar.includes(this.entity.type)&&hw(this.entity).forEach(m=>{if(mi.includes(m.type)){a.push(m);return}const v=Mt(m);i.push(v)}),tn.includes(this.entity.type)&&r.push(...this.entity.detachedChildren);const f=u.filter(h=>{const m=i.includes(h);return m||a.includes(h)||r.includes(h)?!1:mi.includes(h.type)?(a.push(h),!1):gr.includes(h.type)&&!m?(c.push(h),!1):h.type===d.DefinitionEntity?(e.push(h),!1):!0});i.sort((h,m)=>Ho(h,m)?-1:0),c.sort((h,m)=>Ho(h,m)?-1:0),a.sort((h,m)=>AN(h,m)?1:AN(m,h)?-1:0),this.childEntities=[...e,...i,...c,...f,...a,...r]}}calculateCardSize(){const u=vke(this.entity);this.entityCardWidth=u.width,this.entityCardHeight=u.height}static getBoundriesOfTwoAreas(u,i){return{top:Math.min(u.top,i.top),left:Math.min(u.left,i.left),bottom:Math.max(u.bottom,i.bottom),right:Math.max(u.right,i.right)}}static getBoundriedOfCombinedAreas(u,i){const r=u.filter(c=>!i.includes(c));return r.reduce((c,e)=>i.includes(e)?c:$n.getBoundriesOfTwoAreas(c,e.fullBranchArea),r[0].fullBranchArea)}getFullAreaUntilAny(u){const i=this.ownEntityPlusBufferArea;return this.children.filter(e=>!u.includes(e)).map(e=>e.getFullAreaUntilAny(u)).reduce((e,f)=>$n.getBoundriesOfTwoAreas(e,f),i)}getFullAreaUntilAreaOrAnyChildren(u){const i=[u,...u.flattenChildren()],r=this.ownEntityPlusBufferArea;return this.children.filter(e=>i.includes(e)).map(e=>e.getFullAreaUntil(u)).reduce((e,f)=>$n.getBoundriesOfTwoAreas(e,f),r)}getFullAreaUntil(u){const i=this.ownEntityPlusBufferArea;return this.children.filter(c=>c!==u).map(c=>c.getFullAreaUntil(u)).reduce((c,e)=>$n.getBoundriesOfTwoAreas(c,e),i)}get fullBranchArea(){const u=this.ownEntityPlusBufferArea;return this.children.map(a=>a.fullBranchArea).reduce((a,c)=>$n.getBoundriesOfTwoAreas(a,c),u)}get ownEntityArea(){return{top:this.entity.y,left:this.entity.x,bottom:this.entity.y+this.entityCardHeight,right:this.entity.x+this.entityCardWidth}}get ownEntityPlusBufferArea(){const u=this.ownEntityArea;return{top:u.top,left:u.left,bottom:u.bottom+AI,right:u.right+SI}}static filterOutRepeatedAreas(u){return u.filter((i,r)=>u.indexOf(i)===r)}getEarliestId(u,i){const r=u.split("-"),a=i.split("-");return r.length<a.length?u:r.length>a.length?i:r.reduce((e,f,h)=>f<a[h]?u:i,u)}getEarliestLevel(){return this.ids.reduce((r,a)=>this.getEarliestId(r,a),this.ids[0]).split("-").length}countColumns(){let u=0;if(this!==this.calculationEntryPoint)u++;else return u;if(!this.parents.length)return u;const r=this.parents.reduce((a,c)=>c.getEarliestLevel()>a.getEarliestLevel()?c:a,this.parents[0]).countColumns();return u+=r,u}getLatestId(u,i){if(u===i)return u;const r=u.split("-"),a=i.split("-");return r.length<a.length?i:r.length>a.length?u:r.reduce((e,f,h)=>f>a[h]?u:i,u)}getLatestLevel(){return this.ids.length===1?this.ids[0].split("-").length:this.ids.reduce((r,a)=>this.getLatestId(r,a),this.ids[0]).split("-").length}smoothPosition(){const u=this.flattenSiblings();if(!u.length&&this.parents.length<=1&&this.children.length){const i=this.centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight();this.parents.forEach(r=>{r!==this.calculationEntryPoint&&r.shiftDownAlone(i)})}else if([...Ti].includes(this.entity.type)&&this.children.length)this.centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight();else if(!this.children.length&&this.parents.length>1){const i=u.filter(r=>!this.parents.includes(r));i.length?i.every(a=>{const c=this.countColumns(),e=a.countColumns();return c>e})&&this.centerHeaderVerticallyOverCombinedAllParentsHeaderHeight():i.length||this.centerHeaderVerticallyOverCombinedAllParentsHeaderHeight()}}shiftDownUntilAny(u,i){if(u.includes(this))return u;this.move(this.entity,{y:this.entity.y+i});let r=[...u,this];return this.children.forEach(a=>{if($n.getEarliestParentInChain(a)!==this)return;const e=pCi(r,a.entity.id);r=$n.filterOutRepeatedAreas([...r]),e||(r=r.filter(h=>h!==a));const f=a.shiftDownUntilAny(r,i);r.push(...f)}),r}shiftRightUntilAny(u,i){u.includes(this)||(this.move(this.entity,{x:this.entity.x+i}),this.children.forEach(r=>{const a=$n.filterOutRepeatedAreas([...this.flattenSiblings(),...u]);$n.getEarliestParentInChain(r)===this&&r.shiftRightUntilAny(a,i)}))}shiftRight(u){this.move(this.entity,{x:this.entity.x+u}),this.children.forEach(i=>{const a=i.flattenSiblings().filter(c=>c!==i);i.shiftRightUntilAny(a,u)})}shiftDownAlone(u){this.move(this.entity,{y:this.entity.y+u})}centerHeaderVerticallyOverCombinedAllParentsHeaderHeight(){const u=this.parents.reduce((a,c)=>{const e=c.ownEntityArea,f=e.top+yy,h={top:f,left:e.left,bottom:f,right:e.right};return $n.getBoundriesOfTwoAreas(a,h)},{top:1/0,left:1/0,bottom:-1/0,right:-1/0}),r=(u.bottom-u.top)/2-yy;this.shiftDownAlone(r)}centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight(){const u=this.children.reduce((a,c)=>{const e=c.ownEntityArea,f=e.top+yy,h={top:f,left:e.left,bottom:f,right:e.right};return $n.getBoundriesOfTwoAreas(a,h)},{top:1/0,left:1/0,bottom:-1/0,right:-1/0}),r=(u.bottom-u.top)/2-yy;return this.shiftDownAlone(r),r}resolveChildrenOverlaps(){const u=this.flattenChildren();let i=[];u.forEach(r=>{const a=r.adjustVerticallyToAvoidOverlaps();i.push(...a)}),u.forEach(r=>{r.smoothPosition()})}static getEarliestParentInChain(u){let i=u.parents[0];return u.parents.length&&(i=u.parents.sort((r,a)=>{if(!r.ids.length)return-1;if(!a.ids.length)return 1;const c=r.ids.sort((f,h)=>f.length<h.length?-1:0),e=a.ids.sort((f,h)=>f.length<h.length?-1:0);return c[0].length-e[0].length})[0]),i}flattenEarlierSiblings(u=new Set){return u.add(this.entity.id),this.parents.reduce((r,a)=>{if(u.has(a.entity.id))return r;u.add(a.entity.id);const e=a.children.slice(0,a.children.indexOf(this)).reduce((f,h)=>[...f,h,...h.flattenChildren(u)],[]);return[...r,...e]},[])}flattenSiblings(u=new Set){return u.add(this.entity.id),this.parents.reduce((r,a)=>{if(u.has(a.entity.id))return r;u.add(a.entity.id);const e=a.children.filter(f=>f!==this).reduce((f,h)=>[...f,h,...h.flattenChildren(u)],[]);return[...r,...e]},[])}flattenChildren(u=new Set){return this.children.reduce((i,r)=>u.has(r.entity.id)?i:(u.add(r.entity.id),[...i,r,...r.flattenChildren(u)]),[])}flattenParents(u=new Set){return this.parents.reduce((r,a)=>u.has(a.entity.id)?r:(u.add(a.entity.id),[...r,a,...a.flattenParents(u)]),[])}getAreaIfRendered(u){return this.calculationEntryPoint.flattenChildren().find(a=>a.entity.id===u.id)||null}getLowerSiblings(){const u=this.parents.reduce((i,r)=>{const a=r.children.indexOf(this),c=r.children.slice(a+1);return[...i,...c]},[]);return Xj(u)}getLowerAreas(){const u=this.getLowerSiblings(),i=this.parents.reduce((r,a)=>[...r,...a.getLowerAreas()],[]);return Xj([...u,...i])}adjustVerticallyToAvoidOverlaps(u=[]){const r=$n.getEarliestParentInChain(this).children[this.index-1];if(!r)return u;const a=this.flattenEarlierSiblings(),c=this.flattenParents(),e=[...a,...c,r],m=P(e.flatMap(w=>iR(this.entity,w.entity))).filter(w=>w.id!==this.entity.id).map(w=>this.findAreaFromEntity(w)).filter(w=>!!w),v=this.getFullAreaUntilAny(m),b=r.getFullAreaUntilAny(m),A=e.reduce((w,R)=>R===this||R.fullBranchArea.left!==v.left?w:Math.max(w,R.fullBranchArea.bottom),b.bottom);if(v.top<A){const w=A-v.top+AI;return this.shiftDownUntilAny(u,w)}return u}move(u,i){if(this.onlyEntities.includes(u)){if(!this.changeSet)throw new Error("Change set is not defined for this area, cannot move entity");u.metaSync(i,this.changeSet)}}addChild(u){const i=this.childEntities[u];let r=null;i.x&&i.y?r=this.getAreaIfRendered(i):!i.x&&!i.y&&this.move(i,{x:this.entity.x,y:this.entity.y}),r||(r=new $n(i,u,this.calculationEntryPoint));const a=this.ownEntityPlusBufferArea;this.children.includes(r)||(this.children.push(r),r.addParent(this));const c=r.fullBranchArea;if(c.left<a.right){const e=a.right-c.left;r.shiftRight(e)}return r}flattenChildEntities(u=new Set){return this.children.reduce((i,r)=>u.has(r.entity.id)?i:(u.add(r.entity.id),[...i,r.entity,...r.flattenChildEntities(u)]),[])}next(u){const i=[];this.childEntities.forEach((r,a)=>{const c=this.addChild(a);c&&i.push(c)}),u(i)}}async function cCi(s,u,i={}){var c;const r=X.YieldTracker.from(i),a=[];console.log("Generating layout for project...");for(const e of s.instancesList){if(s.diggestedBuiltInBaseEntitiesIds.has(e.id)||!Cy.includes(e.type)||((c=Mt(e))==null?void 0:c.id)!==e.id)continue;let f=ci(e,s);if(!f){console.log("No top scope owner for instance: ",e," in project: ",s);continue}if(!(Ti.includes(f.type)&&f.collapsed&&f.id!==e.id)){for(;f.parent&&f.parent!==s;)f=f.parent,Ti.includes(f.type)&&f.collapsed&&(f.id,e.id);e.x=0,e.y=0,u==null||u.add(e,z.Updated),a.push(e),await r.tick()}}$n.autoGenerateLayout(s,u,a)}async function fCi(s,u,i={}){const r=X.YieldTracker.from(i),a=[],c=[s,...Nt(s)].map(e=>Mt(e)).filter(Boolean);for(const e of c){if(s.project.diggestedBuiltInBaseEntitiesIds.has(e.id))continue;let f=ci(e,s.project);if(f&&!(Ti.includes(f.type)&&f.collapsed&&f.id!==e.id)){for(;f.parent&&f.parent!==s.project;)f=f.parent,Ti.includes(f.type)&&f.collapsed&&(f.id,e.id);e.x=0,e.y=0,u==null||u.add(e,z.Updated),a.push(e),await r.tick()}}$n.autoGenerateLayout(s.project,u,a)}async function yCi(s,u,i={}){const r=X.YieldTracker.from(i),a=[],c=new Set;yqe(u,{shallowMissingActivesError:!0,excludeAffected:!0}).forEach(m=>{var b;if((!m.x||!m.y)&&!c.has(m.id)&&!s.diggestedBuiltInBaseEntitiesIds.has(m.id)&&(a.push(m),c.add(m.id)),ed(m,s)){const A=Mt(m);A&&!c.has(A.id)&&!s.diggestedBuiltInBaseEntitiesIds.has(A.id)&&(a.push(A),c.add(A.id))}if(Ar.includes(m.type)){const A=m;[A,...Nt(A)].forEach(R=>{const O=Mt(R);O&&!c.has(O.id)&&!s.diggestedBuiltInBaseEntitiesIds.has(O.id)&&(a.push(O),c.add(O.id))})}m.type===d.DefinitionEntity&&m.methods.forEach(A=>{Nt(A).forEach(R=>{const O=Mt(R);O&&!c.has(O.id)&&!s.diggestedBuiltInBaseEntitiesIds.has(O.id)&&(a.push(O),c.add(O.id))})}),((b=m.parent)==null?void 0:b.type)===d.Project&&(a.push(m),c.add(m.id),Ar.includes(m.type)&&Nt(m).forEach(R=>{const O=Mt(R);O&&!c.has(O.id)&&!s.diggestedBuiltInBaseEntitiesIds.has(O.id)&&(a.push(O),c.add(O.id))}))});let f=[];for(const m of a)s.diggestedBuiltInBaseEntitiesIds.has(m.id)||(m.x=0,m.y=0,u==null||u.add(m,z.Updated),f.push(m),await r.tick());f=P(f),$n.autoGenerateLayout(s,u,f);const h=P([...f,...s.variableDeclarations,...s.variableInstances,...s.loops,...s.conditions,...s.operations,...s.searches]).filter(m=>m.x===0||m.y===0);$n.autoGenerateLayout(s,u,h)}var Uv=(s=>(s.Amazon="amazon",s.Google="google",s.Microsoft="microsoft",s))(Uv||{}),Jr=(s=>(s.RelationalDatabase="relational-database",s.CompiledLocalCodebase="compiled-local-codebase",s.CloudHostedCodebase="cloud-hosted-codebase",s.HttpApi="http-api",s.HttpEndpoint="http-endpoint",s.ServerlessFunction="serverless-function",s.CronJob="cron-job",s.AWSTenantAccount="aws-tenant-account",s.ContainerCompute="container-compute",s.SharedDrive="shared-drive",s))(Jr||{}),WP=(s=>(s.Post="post",s.Get="get",s.Acknowledgement="acknowledgment",s.Progress="progress",s.Error="error",s.Complete="complete",s))(WP||{}),py=(s=>(s.Queued="queued",s.Running="running",s.Success="success",s.Failed="failed",s.CleanedUp="cleaned-up",s.Skipped="skipped",s.AbortedByUser="aborted-by-user",s.UnrecoverableFailure="unrecoverable-failure",s.Reverted="reverted",s.UnpublishingStarted="unpublishing-started",s.Unpublished="unpublished",s))(py||{}),zP=(s=>(s.Queued="queued",s.Running="running",s.Success="success",s.Failed="failed",s.CleanedUp="cleaned-up",s.UnrecoverableFailure="unrecoverable-failure",s.Reverted="reverted",s.UnpublishingStarted="unpublishing-started",s.Unpublished="unpublished",s))(zP||{}),Ai=(s=>(s.ProjectNotFound="project-not-found",s.ProjectPublishRequestAcknowledged="project-publish-request-acknowledged",s.PublicationStepFailedReasonUnknown="publication-step-failed-reason-unknown",s.DeploymentCompleted="deployment-completed",s.DeploymentStarted="deployment-started",s.DeploymentFailed="deployment-failed",s.AllInfrastructureSuccessfullyProvisioned="all-infrastucture-successfully-provisioned",s.RequestPayloadValidationFailed="request-payload-validation-failed",s.ProjectStateValidationFailedMissingName="project-state-validation-failed-missing-name",s.ProjectStateValidationFailedMissingAnyFunctionality="project-state-validation-failed-missing-any-functionality",s.ProjectAlreadyBeingPublished="project-already-being-published",s.BillingSubscriptionUpdateFailed="billing-subscription-update-failed",s.RelationalDatabaseDeploymentStarted="relational-database-deployment-started",s.RelationalDatabaseDeploymentCompleted="relational-database-deployment-completed",s.RelationalDatabaseDeploymentFailed="relational-database-deployment-failed",s.CreatingNewRelationalDatabase="creating-new-relational-database",s.WaitingForPreviousRelationalDatabaseDeployment="waiting-for-previous-relationa-database-deployment",s.RelationalDatabaseAlreadyExists="relational-database-already-exists",s.RelationalDatabaseDeletionStarted="relational-database-deletion-started",s.RelationalDatabaseDeletionCompleted="relational-database-deletion-completed",s.RelationalDatabaseDeletionFailed="relational-database-deletion-failed",s.WaitingForPreviousRelationalDatabaseDeletion="waiting-for-previous-relationa-database-deletion",s.HttpApiDeploymentStarted="http-api-deployment-started",s.HttpApiDeploymentCompleted="http-api-deployment-completed",s.HttpApiDeploymentFailed="http-api-deployment-failed",s.CreatingNewHttpApi="creating-new-http-api",s.HttpApiAlreadyExists="http-api-already-exists",s.HttpApiDeletionStarted="http-api-deletion-started",s.HttpApiDeletionCompleted="http-api-deletion-completed",s.HttpApiDeletionFailed="http-api-deletion-failed",s.WaitingForPreviousHttpApiDeletion="waiting-for-previous-http-api-deletion",s.BusinessLogicCodebaseDeploymentStarted="business-logic-codebase-deployment-started",s.BusinessLogicCodebaseDeploymentCompleted="business-logic-codebase-deployment-completed",s.BusinessLogicCodebaseDeploymentFailed="business-logic-codebase-deployment-failed",s.BundlingCodebaseForDownload="bundling-codebase-for-download",s.UploadingCodebaseToCloudStorage="uploading-codebase-to-cloud-storage",s.UploadingCodebaseToCloudStorageCompleted="uploading-codebase-to-cloud-storage-completed",s.UploadingCodebaseToCloudStorageFailed="uploading-codebase-to-cloud-storage-failed",s.InfrastructureValuesCodebaseInterpolationStarted="infrastructure-values-codebase-interpolation-started",s.InfrastructureValuesCodebaseInterpolationCompleted="infrastructure-values-codebase-interpolation-completed",s.InfrastructureValuesCodebaseInterpolationFailed="infrastructure-values-codebase-interpolation-failed",s.CodeCompilationStarted="code-compilation-started",s.CodeCompilationCompleted="code-compilation-completed",s.CodeCompilationFailed="code-compilation-failed",s.BundleCodebaseStarted="bundle-codebase-started",s.BundleCodebaseCompleted="bundle-codebase-completed",s.BundleCodebaseFailed="bundle-codebase-failed",s.InstallingCodebaseDependenciesStarted="installing-codebase-dependencies-started",s.InstallingCodebaseDependenciesCompleted="installing-codebase-dependencies-completed",s.InstallingCodebaseDependenciesFailed="installing-codebase-dependencies-failed",s.MigrateRelationalDatabaseStarted="migrate-relational-database-started",s.MigrateRelationalDatabaseCompleted="migrate-relational-database-completed",s.MigrateRelationalDatabaseFailed="migrate-relational-database-failed",s.ExecutePublicationCompletedEventStarted="execute-publication-completed-event-started",s.ExecutePublicationCompletedEventCompleted="execute-publication-completed-event-completed",s.ExecutePublicationCompletedEventFailed="execute-publication-completed-event-failed",s.ExecutePublicationCompletedEventTimedOut="execute-publication-completed-event-timed-out",s.AWSTenantAccountProvisioningStarted="aws-tenant-account-provisioning-started",s.AWSTenantAccountProvisioningCompleted="aws-tenant-account-provisioning-completed",s.AWSTenantAccountProvisioningFailed="aws-tenant-account-provisioning-failed",s.ContainerComputeDeploymentStarted="container-compute-deployment-started",s.ContainerComputeDeploymentCompleted="container-compute-deployment-completed",s.ContainerComputeDeploymentFailed="container-compute-deployment-failed",s.ContainerComputeDeletionStarted="container-compute-deletion-started",s.ContainerComputeDeletionCompleted="container-compute-deletion-completed",s.ContainerComputeDeletionFailed="container-compute-deletion-failed",s.SharedDriveDeploymentStarted="shared-drive-deployment-started",s.SharedDriveDeploymentCompleted="shared-drive-deployment-completed",s.SharedDriveDeploymentFailed="shared-drive-deployment-failed",s.SharedDriveAlreadyExists="shared-drive-already-exists",s.SharedDriveDeletionStarted="shared-drive-deletion-started",s.SharedDriveDeletionCompleted="shared-drive-deletion-completed",s.SharedDriveDeletionFailed="shared-drive-deletion-failed",s))(Ai||{}),jo=(s=>(s.CodeCompilation="code-compilation",s.RelationalDatabaseDeployment="relational-database-deployment",s.RelationalDatabaseDeletion="relational-database-deletion",s.HttpApiDeployment="http-api-deployment",s.HttpApiDeletion="http-api-deletion",s.InfrastructureValuesCodebaseInterpolation="infrastructure-values-codebase-interpolation",s.BundleCodebase="bundle-codebase",s.MigrateRelationalDatabase="migrate-relational-database",s.BusinessLogicCodebaseDeployment="business-logic-codebase-deployment",s.ExecutePublicationCompletedEvent="execute-publication-completed-event",s.CodebaseCleanup="codebase-cleanup",s.AWSTenantAccountProvisioning="aws-tenant-account-provisioning",s.ContainerComputeDeployment="container-compute-deployment",s.ContainerComputeDeletion="container-compute-deletion",s.SharedDriveDeployment="shared-drive-deployment",s.SharedDriveDeletion="shared-drive-deletion",s))(jo||{});Jr.CloudHostedCodebase,Jr.HttpApi,Jr.RelationalDatabase,Jr.CloudHostedCodebase,Jr.CloudHostedCodebase,Jr.RelationalDatabase,Jr.CloudHostedCodebase,Jr.CloudHostedCodebase;function bke(s){return`project-${s}-http-api`}function BD(s){return`entity-${s}-database`}class Ake{constructor(u,i,r,a,c,e,f,h,m){D(this,"stepType");D(this,"id");D(this,"resourceType");D(this,"index");D(this,"dependency",[]);D(this,"lastEvent",null);D(this,"lastEventTimestamp",null);D(this,"status",py.Queued);D(this,"publicationRun");D(this,"resource");this.stepType=u,this.id=i,this.resourceType=r,this.status=a,this.dependency=c,this.index=e,this.lastEventTimestamp=f,this.publicationRun=h,this.resource=m}toJSON(){return{stepType:this.stepType,id:this.id,resourceType:this.resourceType,index:this.index,status:this.status,dependency:this.dependency,lastEvent:this.lastEvent,resource:{resourceId:this.resource.resourceId,resourceType:this.resource.resourceType,provider:this.resource.provider,details:this.resource.details,status:this.resource.status,name:this.resource.name}}}async update(u){var i,r;this.status=u.status,this.dependency=u.dependency,this.index=u.index,this.stepType=u.stepType,this.resourceType=u.resourceType,this.lastEvent=u.lastEvent,this.id=u.id,(r=this.resource)==null||r.setDetails((i=u.resource)==null?void 0:i.details)}}var gke=(s=>(s.Ready="ready",s.Provisioning="provisioning",s.Queued="queued",s.ProvisioningFailed="provisioning-failed",s.Deleting="deleting",s.DeletingFailed="deleting-failed",s.Deleted="deleted",s))(gke||{});class xf{constructor(u,i,r){D(this,"provisionedBy");D(this,"publicationRun");D(this,"resourceType");D(this,"provider");D(this,"resourceId");D(this,"details",null);D(this,"name",null);D(this,"status","queued");this.publicationRun=u,this.resourceType=i,this.provider=r}setDetails(u){this.details=u}setStatus(u){this.status=u}setProvisionedBy(u){this.provisionedBy=u}}class hCi extends xf{constructor(i,r,a){super(i,Jr.HttpEndpoint,a);D(this,"resourceType",Jr.HttpEndpoint);D(this,"owners",new Map);D(this,"details",null);D(this,"status","queued");r.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,r;return this.resourceId=BD((r=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:r.id),this.resourceId}}class mCi extends xf{constructor(i,r,a){super(i,Jr.ServerlessFunction,a);D(this,"resourceType",Jr.ServerlessFunction);D(this,"owners",new Map);D(this,"details",null);D(this,"status","queued");r.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,r;return this.resourceId=BD((r=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:r.id),this.resourceId}}class Ike extends xf{constructor(i,r,a){super(i,Jr.HttpApi,a);D(this,"resourceType",Jr.HttpApi);D(this,"owners",new Map);D(this,"details",null);D(this,"status","queued");r.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=bke(this.publicationRun.project.id),this.resourceId}}class Rke extends xf{constructor(i,r,a){super(i,Jr.RelationalDatabase,a);D(this,"resourceType",Jr.RelationalDatabase);D(this,"owners",new Map);D(this,"details",null);D(this,"status","queued");r.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,r;return this.resourceId=BD((r=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:r.id),this.resourceId}}class Dke extends xf{constructor(i,r){super(i,Jr.CloudHostedCodebase,r);D(this,"resourceType",Jr.CloudHostedCodebase);D(this,"details",null);D(this,"status","queued");this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=`cloud-hosted-codebase--${this.publicationRun.project.id}--${this.publicationRun.project.version}`,this.resourceId}}class wke extends xf{constructor(i,r){super(i,Jr.CompiledLocalCodebase,r);D(this,"resourceType",Jr.CompiledLocalCodebase);D(this,"details",null);D(this,"status","queued");this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=`compiled-codebase--${this.publicationRun.project.id}--${this.publicationRun.project.version}--${this.publicationRun.id}`,this.resourceId}}class TCi extends xf{constructor(i,r){super(i,Jr.AWSTenantAccount,r);D(this,"resourceType",Jr.AWSTenantAccount);D(this,"status","queued");this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=`aws-tenant-account--${this.publicationRun.project.id}`,this.resourceId}}class vCi{constructor(u,i){D(this,"id");D(this,"projectAutoIncrementPublicationCount");D(this,"projectPublishedSemanticVersion");D(this,"envIdentifier");D(this,"projectVersion");D(this,"projectBranchId");D(this,"projectId");D(this,"triggeredBy");D(this,"createdAt");D(this,"updatedAt");D(this,"status");D(this,"steps",[]);D(this,"editor");D(this,"explicitResources",new Map);D(this,"implicitGlobalResources",new Map);D(this,"finalGlobalEvent",null);D(this,"finalStatus",null);D(this,"contextType",le.PublicationRun);D(this,"extensionsRegistry");this.id=u.id,this.projectAutoIncrementPublicationCount=u.projectAutoIncrementPublicationCount,this.projectPublishedSemanticVersion=u.projectPublishedSemanticVersion,this.envIdentifier=u.envIdentifier,this.projectVersion=u.projectVersion,this.projectBranchId=u.projectBranchId,this.projectId=u.projectId,this.triggeredBy=u.triggeredBy,this.createdAt=u.createdAt,this.updatedAt=u.updatedAt,this.status=u.status,this.editor=i,this.initRegistry()}get off(){return this.extensionsRegistry.off}get on(){return this.extensionsRegistry.on}get emit(){return this.extensionsRegistry.emit}get emitAsync(){return this.extensionsRegistry.emitAsync}get emitAsyncAll(){return this.extensionsRegistry.emitAsyncAll}get emitAsyncAllSettled(){return this.extensionsRegistry.emitAsyncAllSettled}get emitAsyncSequentially(){return this.extensionsRegistry.emitAsyncSequentially}get emitAsyncSequentiallyAll(){return this.extensionsRegistry.emitAsyncSequentiallyAll}get emitAsyncSequentiallyAllSettled(){return this.extensionsRegistry.emitAsyncSequentiallyAllSettled}get project(){return this.editor.project}getInfraTypes(u){return this.steps.filter(i=>u.includes(i.resourceType))}getStepsTypes(u){return this.steps.filter(i=>u.includes(i.stepType))}toIds(u){return u.map(i=>i.id)}getResourceForEntity(u){const i=Array.from(this.explicitResources.values()).find(r=>r.owners.has(u.id));return i||null}async init(){await this.initResources()}async initResources(){this.implicitGlobalResources.set(Jr.CompiledLocalCodebase,new wke(this,Uv.Amazon)),this.implicitGlobalResources.set(Jr.CloudHostedCodebase,new Dke(this,Uv.Amazon));const u=this.project.entities.filter(r=>Vi(r,be.HTTP_ENDPOINT)),i=this.project.entities.filter(r=>Vi(r,be.RELATIONAL_DATABASE));if(i.length&&i.forEach(r=>{const a=new Rke(this,[r],Uv.Amazon);this.explicitResources.set(a.resourceId,a)}),u.length){const r=new Ike(this,u,Uv.Amazon);this.explicitResources.set(r.resourceId,r)}}setSteps(u,i){u.forEach(r=>{this.addStep(r,i)}),this.editor.events.emit(Ai.ProjectPublishRequestAcknowledged,{})}addStep(u,i){const r=u.dependency||[];if(r.length){const c=r.filter(e=>!this.steps.find(f=>f.id===e));if(c.length)throw new Error(`Missing dependencies: ${c.join(", ")}`)}if(!this.steps.find(c=>c.id===u.id)){const c=new Ake(u.stepType,u.id,u.resourceType,u.status,r,u.index,i,this,null);this.steps.push(c)}}onUpdate(u){var i;if(X.Logger.log("onUpdate",u),(i=u.payload)!=null&&i.stepType){const r=this.steps.find(a=>{var c;return a.id===((c=u.payload)==null?void 0:c.id)});r&&U(u.emittedAt).isAfter(U(r.lastEventTimestamp))&&r.update(u.payload)}this.editor.events.emit("publication-updated",{}),u.type===WP.Error?(this.finalStatus=zP.Failed,this.finalGlobalEvent=u.event,this.editor.events.emit("project-publication-error",u)):u.type===WP.Complete&&(this.finalStatus=zP.Success,this.finalGlobalEvent=u.event,this.editor.events.emit("project-publication-completed",u))}requestExtension(u){return this.extensionsRegistry.requestExtension(u)}async initRegistry(){return this.extensionsRegistry=new vL(this.editor.events),await this.extensionsRegistry.setup(),this.extensionsRegistry.onResolvePublicationRunContext(()=>this),await this.extensionsRegistry.contextAvailable(le.PublicationRun),this.extensionsRegistry}}function ECi(s){switch(s){case jo.CodeCompilation:return"Code generation";case jo.RelationalDatabaseDeployment:return"Database creation";case jo.HttpApiDeployment:return"HTTP gateway creation";case jo.InfrastructureValuesCodebaseInterpolation:return"Link code with resources";case jo.BundleCodebase:return"Bundle code";case jo.MigrateRelationalDatabase:return"Database structure migration";case jo.BusinessLogicCodebaseDeployment:return"Update servers with new code";case jo.CodebaseCleanup:return"Code cleanup";case jo.HttpApiDeletion:return"HTTP gateway deletion";case jo.RelationalDatabaseDeletion:return"Database deletion";default:return"Publication finished"}}function bCi(s){switch(s){case Ai.DeploymentCompleted:return"Successfully published";case Ai.DeploymentStarted:return"Publication started";case Ai.DeploymentFailed:return"Publication failed";case Ai.AllInfrastructureSuccessfullyProvisioned:return"All infrastructure successfully provisioned";case Ai.RequestPayloadValidationFailed:return"Request payload validation failed";case Ai.ProjectStateValidationFailedMissingName:return"Project state validation failed: missing name";case Ai.ProjectStateValidationFailedMissingAnyFunctionality:return"Project state validation failed: missing any functionality";case Ai.RelationalDatabaseDeploymentStarted:return"Database creation started";case Ai.RelationalDatabaseDeploymentCompleted:return"Database creation completed";case Ai.RelationalDatabaseDeploymentFailed:return"Database creation failed";case Ai.CreatingNewRelationalDatabase:return"Creating new database (up to 5 mins)";case Ai.WaitingForPreviousRelationalDatabaseDeployment:return"Waiting for previous database creation";case Ai.RelationalDatabaseAlreadyExists:return"Database already exists";case Ai.HttpApiDeploymentStarted:return"HTTP gateway creation started";case Ai.HttpApiDeploymentCompleted:return"HTTP gateway creation completed";case Ai.HttpApiDeploymentFailed:return"HTTP gateway creation failed";case Ai.CreatingNewHttpApi:return"Creating new HTTP gateway";case Ai.HttpApiAlreadyExists:return"HTTP gateway already exists";case Ai.BusinessLogicCodebaseDeploymentStarted:return"Update servers with new code started";case Ai.BusinessLogicCodebaseDeploymentCompleted:return"Update servers with new code completed";case Ai.BusinessLogicCodebaseDeploymentFailed:return"Update servers with new code failed";case Ai.BundlingCodebaseForDownload:return"Bundling code for download";case Ai.UploadingCodebaseToCloudStorage:return"Uploading code to cloud storage";case Ai.InfrastructureValuesCodebaseInterpolationStarted:return"Linking code with resources started";case Ai.InfrastructureValuesCodebaseInterpolationCompleted:return"Linking code with resources completed";case Ai.InfrastructureValuesCodebaseInterpolationFailed:return"Linking code with resources failed";case Ai.CodeCompilationStarted:return"Code generation started";case Ai.CodeCompilationCompleted:return"Code generation completed";case Ai.CodeCompilationFailed:return"Code generation failed";case Ai.BundleCodebaseStarted:return"Code bundling started";case Ai.BundleCodebaseCompleted:return"Code bundling completed";case Ai.BundleCodebaseFailed:return"Code bundling failed";case Ai.InstallingCodebaseDependenciesStarted:return"Installing code dependencies";case Ai.InstallingCodebaseDependenciesCompleted:return"Installing code dependencies completed";case Ai.InstallingCodebaseDependenciesFailed:return"Installing code dependencies failed";case Ai.MigrateRelationalDatabaseStarted:return"Database structure migration started";case Ai.MigrateRelationalDatabaseCompleted:return"Database structure migration completed";case Ai.MigrateRelationalDatabaseFailed:return"Database structure migration failed";case Ai.ProjectAlreadyBeingPublished:return"Project already being published. You need to wait for the previous publication to complete";case Ai.ProjectPublishRequestAcknowledged:return"Project publish request acknowledged";case Ai.UploadingCodebaseToCloudStorageCompleted:return"Uploading code to cloud storage completed";case Ai.UploadingCodebaseToCloudStorageFailed:return"Uploading code to cloud storage failed";case Ai.BillingSubscriptionUpdateFailed:return"Billing subscription update failed";case Ai.ProjectNotFound:return"Project not found";case Ai.HttpApiDeletionCompleted:return"HTTP gateway deletion completed";case Ai.HttpApiDeletionFailed:return"HTTP gateway deletion failed";case Ai.HttpApiDeletionStarted:return"HTTP gateway deletion started";case Ai.PublicationStepFailedReasonUnknown:return"Publication step failed: reason unknown";case Ai.WaitingForPreviousHttpApiDeletion:return"Waiting for previous HTTP gateway deletion";case Ai.RelationalDatabaseDeletionStarted:return"Database deletion started";case Ai.RelationalDatabaseDeletionCompleted:return"Database deletion completed";case Ai.RelationalDatabaseDeletionFailed:return"Database deletion failed";case Ai.WaitingForPreviousRelationalDatabaseDeletion:return"Waiting for previous database deletion"}return"Unknown event"}var Cke=(s=>(s.NO_LOGIC="NO_LOGIC",s.NO_NAME="NO_NAME",s.NO_CHANGES="NO_CHANGES",s.PROJECT_PUBLICATION_ALREADY_ONGOING="PROJECT_PUBLICATION_ALREADY_ONGOING",s))(Cke||{});function ACi(s){switch(s){case"NO_LOGIC":return"This project has no logic";case"NO_NAME":return"This project has no name";case"NO_CHANGES":return"This version has already been published";case"PROJECT_PUBLICATION_ALREADY_ONGOING":return"This project is already being published";default:return"Publishing is currently not available. Try again later"}}function gCi(s){switch(s){case Jr.RelationalDatabase:return"Relational database";case Jr.HttpEndpoint:case Jr.HttpApi:return"HTTP endpoints";case Jr.ServerlessFunction:case Jr.CloudHostedCodebase:return"Server code functions";default:return"Resources"}}function ICi(s){switch(s){case py.Running:return"In progress";case py.Failed:return"Failed";case py.Success:return"Succeeded";case py.Skipped:return"Skipped";case py.Queued:default:return"Queued"}}async function Oke(s,u={}){var h;const i=X.YieldTracker.from(u),r=ts(s),a=is(s),c=[...r,...a,...ta(s),...CL(s),...rs(s),...OL(s)],e=iA(s);c.push(...e);const f=vi(s.errors,c);await i.tick();for(const m of s.inputs)await m.validateAsync({tracker:i});for(const m of s.outputs)await m.validateAsync({tracker:i});for(const m of s.internalCalls)await m.validateAsync({tracker:i});return await((h=s.dataType)==null?void 0:h.validateAsync({tracker:i})),f}function _ke(s){var c;(c=s.dataType)==null||c.validate(),s.inputs.forEach(e=>e.validate()),s.outputs.forEach(e=>e.validate()),s.internalCalls.forEach(e=>e.validate());const u=ts(s),i=is(s),r=[...u,...i,...ta(s),...CL(s),...rs(s),...OL(s)],a=iA(s);return r.push(...a),vi(s.errors,r)}function CL(s,u){const r=[...s.project.getVariableDeclarations()].filter(a=>a.id!==s.id);return nA(s,[$r],r,u)}function OL(s){const u=[];if(s.parent!==s.project)return u;if(s.catchesError){const i=Kt({id:`${s.id}--${Pe.GlobalVariableDeclarationCannotCatchError}`,message:`${Qs[s.type].singular} "${ye(s,s.project)}" with id "${s.id}" cannot catch an error because it is globally declared. Global variable declarations must crash the project if an error occurs.`,severity:Ee.Error,code:Pe.GlobalVariableDeclarationCannotCatchError,entity:s});u.push(i.error)}if(s.errorCalls.length){const i=Kt({id:`${s.id}--${Pe.GlobalVariableDeclarationCannotCallOnError}`,message:`${Qs[s.type].singular} "${ye(s,s.project)}" with id "${s.id}" cannot call other entities from its error branch because it is globally declared. Global variable declarations must crash the project if an error occurs.`,severity:Ee.Error,code:Pe.GlobalVariableDeclarationCannotCallOnError,entity:s});u.push(i.error)}if(s.calledBy.length){const i=Kt({id:`${s.id}--${Pe.GlobalVariableDeclarationCannotBeCalled}`,message:`${Qs[s.type].singular} "${ye(s,s.project)}" with id "${s.id}" cannot be called because it is globally declared. Global variable declarations must be self initialized when the project is loaded, and not be called for initialization.`,severity:Ee.Error,code:Pe.GlobalVariableDeclarationCannotBeCalled,entity:s});u.push(i.error)}return[]}const RCi=Object.freeze(Object.defineProperty({__proto__:null,validate:_ke,validateAsync:Oke,validateGlobalVariableDeclaration:OL,validateVariableDeclarationName:CL},Symbol.toStringTag,{value:"Module"}));async function Pke(s,u={}){const i=X.YieldTracker.from(u),r=ts(s),a=is(s),c=[...r,...a,...ta(s),...rs(s),...Wd(s),...Vke(s)],e=iA(s);c.push(...e);const f=vi(s.errors,c);await i.tick();for(const h of s.inputs)await h.validateAsync({tracker:i});for(const h of s.outputs)await h.validateAsync({tracker:i});for(const h of s.internalCalls)await h.validateAsync({tracker:i});return f}function Nke(s){s.inputs.forEach(c=>c.validate()),s.outputs.forEach(c=>c.validate()),s.internalCalls.forEach(c=>c.validate());const u=ts(s),i=is(s),r=[...u,...i,...ta(s),...rs(s)],a=iA(s);return r.push(...a),vi(s.errors,r)}function Vke(s){const u=[],i=s.declaration.constant;if(i&&s.readsValue){const r=Kt({id:`${s.id}--${ge.ValueReadingOverridesConstantVariable}`,message:`The '${s.type}' entity "${ye(s,s.project)}" with id "${s.id}" is a constant variable whose value cannot be overriden, but reads a value.`,severity:Ee.Error,code:ge.ValueReadingOverridesConstantVariable,entity:s});u.push(r.error)}if(i&&s.defaultValue){const r=Kt({id:`${s.id}--${ge.DefaultValueOverridesConstantVariable}`,message:`The '${s.type}' entity "${ye(s,s.project)}" with id "${s.id}" is a constant variable whose value cannot be overridden, but has a 'defaultValue'.`,severity:Ee.Error,code:ge.DefaultValueOverridesConstantVariable,entity:s});u.push(r.error)}return u}function Wd(s){var h;const u=[],i=s.declaration;if((i==null?void 0:i.id)===((h=s.parent)==null?void 0:h.id)||!s.calledBy.length&&!s.successCalls.length&&!s.errorCalls.length&&s.usedInternalCalls.length)return u;const r=Nt(s),a=Nt(i);!!r.find(m=>m.id===i.id)&&u.push(Kt({id:`${s.id}--${ge.CalledBeforeDeclaration}`,code:ge.CalledBeforeDeclaration,severity:Ee.Error,message:`Entity of type "${s.type}" with id "${s.id}" is called before its 'variable-declaration' '${i.name}' with id "${i.id}".
72
+ `,"color: #3b82f6; font-weight: bold;");const a={...tc,...i};this.state="running";const c=this.project.activeExecution;this.project.activeExecution=this;try{const e=await this.executeBranch(this.entryPoint,a,r);return this.state="finished-success",e}finally{this.project.activeExecution=c}}getExecutionLevels(){const i=[];let r=this;for(;r;){const a=r.entryPoint,c=a?ye(a,this.project):"Unknown",e=a?a.type:"unknown";i.unshift(`${e} "${c}"`),r=r.parentExecution}return i.join(" -> ")}logBeforeExecution(i,r,a){var v,b;const c=this.getExecutionLevels(),e=ci(r,this.project),f=e?ye(e,this.project):"Project",h=e?e.type:"Project",m=ye(r,this.project);if(console.log(`%c[Execution: ${c}] %c[Scope: ${h} "${f}"]`,"color: #3b82f6; font-weight: bold;","color: #10b981; font-weight: bold;"),console.log(`%c${i} (${r.type}) -> [${m}]%c Inputs:`,"font-weight: bold; color: #224370ff;","color: #9ca3af;"),a.length?a.forEach(A=>{var R,O,$;const w=ye(A.valueOwner,this.project);console.log(` %c${(R=A.valueOwner)==null?void 0:R.type}%c (${(O=A.valueOwner)==null?void 0:O.id}) %c"${w}"%c:`,"color: #8b5cf6; font-weight: bold;","color: #9ca3af;","color: #10b981; font-weight: bold;","color: #667a9bff;",($=A.value)==null?void 0:$.value)}):console.log(" (none)"),r.type===d.VariableInstance||r.type===d.VariableDeclaration){const A=zr(r),w=Xu(A,this.valueResolutionContext);console.log(` %cExisting Value%c of [${ye(A,this.project)}]:`,"color: #ec4899; font-weight: bold;","color: #667a9bff;",(v=w==null?void 0:w.value)==null?void 0:v.value)}if(r.type===d.InternalCall){const A=r.parent;if(A){const w=Xu(A,this.valueResolutionContext);console.log(` %cParent Variable%c [${ye(A,this.project)}] Value:`,"color: #f59e0b; font-weight: bold;","color: #667a9bff;",(b=w==null?void 0:w.value)==null?void 0:b.value)}}}addEntity(i){var r;this.entities.includes(i)||(this.entities.push(i),(r=this.onAddEntityCallback)==null||r.call(this,i,{}))}async addEntityAsync(i,r={}){var a;this.entities.includes(i)||(this.entities.push(i),await((a=this.onAddEntityCallback)==null?void 0:a.call(this,i,r)))}addEntities(i){i.forEach(r=>this.addEntity(r))}async addEntitiesAsync(i,r={}){const a=X.YieldTracker.from(r),c=[];for(const e of i)c.push(this.addEntityAsync(e,r)),await a.tick();await Promise.all(c)}removeEntity(i){var r;if(i!==this.entryPoint){const a=this.entities.indexOf(i);a>-1&&(this.entities.splice(a,1),(r=this.onRemoveEntityCallback)==null||r.call(this,i,{}))}}hasEntity(i){var r;return this.entities.includes(i)?!0:i.parent&&((r=i.parent)==null?void 0:r.id)!==(i==null?void 0:i.id)?this.hasEntity(i.parent):!1}removeScheduled(i){const r=this.scheduled.indexOf(i);r>-1&&this.scheduled.splice(r,1)}hasScheduled(i){return!!this.scheduled.includes(i)}hasSkipped(i){return!!this.skipped.includes(i)}hasExecuted(i){return!!this.executed.includes(i)}hasEntityWithId(i){const r=this.project.get(i);return r?this.hasEntity(r):!1}onAddToSkippedList(i){this.onAddToSkippedListCallback=i}onAbortExecution(i){this.onAbortExecutionCallback=i}onAddEntity(i){this.onAddEntityCallback=i}onRemoveFromSkippedList(i){this.onRemoveFromSkippedListCallback=i}onRemoveEntity(i){this.onRemoveEntityCallback=i}addToExecutingList(i){this.executing.includes(i)||this.executing.push(i)}addToScheduledList(i){this.scheduled.includes(i)||this.scheduled.push(i)}removeFromScheduledList(i){const r=this.scheduled.indexOf(i);r>-1&&this.scheduled.splice(r,1)}removeFromExecutingList(i){var a;const r=this.executing.indexOf(i);r>-1&&(this.executing.splice(r,1),(a=this.onAbortExecutionCallback)==null||a.call(this,i,{}))}removeFromAlreadyExecutedList(i){const r=this.executed.indexOf(i);r>-1&&this.executed.splice(r,1)}removeFromSkippedList(i){var a;const r=this.skipped.indexOf(i);r>-1&&(this.skipped.splice(r,1),(a=this.onRemoveFromSkippedListCallback)==null||a.call(this,i,{}))}addToAlreadyExecutedList(i){this.executed.includes(i)||this.executed.push(i)}addToSkippedList(i){var r;this.skipped.includes(i)||(this.skipped.push(i),(r=this.onAddToSkippedListCallback)==null||r.call(this,i,{}))}getValueTypePreference(i){return this.parentContext.getValueTypePreference(i)||null}setValueTypePreference(i,r){this.parentContext.setValueTypePreference(i,r),this.emit(i,{})}}function eCi(s){var u,i;if(s.isList)return"list";if(((u=s.entity)==null?void 0:u.type)===d.DefinitionEntity)return"definition-entity";switch((i=s.entity)==null?void 0:i.name){case he.Number:return"number";case he.String:return"text";case he.Boolean:return"boolean";case he.UUID:return"uuid";case he.Date:return"date-time";default:return"definition-entity"}}const Qs={[d.PrimitiveEntity]:{singular:"Primitive",plural:"Primitives",shortSingular:"Primitive",shortPlural:"Primitives"},[d.DefinitionEntity]:{singular:"Definition",plural:"Definitions",shortSingular:"Definition",shortPlural:"Definitions"},[d.BuiltInBaseEntity]:{singular:"Base",plural:"Bases",shortSingular:"Base definition",shortPlural:"Base definitions"},[d.Property]:{singular:"Property",plural:"Properties",shortSingular:"Property",shortPlural:"Properties"},[d.FunctionDeclaration]:{singular:"Custom trigger",plural:"Custom triggers",shortSingular:"Trigger",shortPlural:"Triggers"},[d.FunctionCall]:{singular:"Execute trigger",plural:"Execute trigger",shortSingular:"Execute",shortPlural:"Execute"},[d.GlobalEvent]:{singular:"System trigger",plural:"System triggers",shortSingular:"Trigger",shortPlural:"Triggers"},[d.Project]:{singular:"Project",plural:"Projects",shortSingular:"Project",shortPlural:"Projects"},[d.VariableDeclaration]:{singular:"Variable",plural:"Variables",shortSingular:"Variable",shortPlural:"Variables"},[d.VariableInstance]:{singular:"Variable",plural:"Variables",shortSingular:"Variable",shortPlural:"Variables"},[d.Condition]:{singular:"Condition",plural:"Conditions",shortSingular:"Condition",shortPlural:"Conditions"},[d.Operation]:{singular:"Operation",plural:"Operations",shortSingular:"Operation",shortPlural:"Operations"},[d.ReturnStatement]:{singular:"Termination",plural:"Terminations",shortSingular:"Termination",shortPlural:"Terminations"},[d.InstalledProject]:{singular:"Installed project",plural:"Installed projects",shortSingular:"Project",shortPlural:"Projects"},[d.Search]:{singular:"Search",plural:"Searches",shortSingular:"Search",shortPlural:"Searches"},[d.Loop]:{singular:"Loop",plural:"Loops",shortSingular:"Loop",shortPlural:"Loops"},[d.ActionDescriptor]:{singular:"Action descriptor",plural:"Action descriptors",shortSingular:"Action descriptor",shortPlural:"Action descriptors"},[d.InternalCall]:{singular:"Internal call",plural:"Internal calls",shortSingular:"Internal call",shortPlural:"Internal calls"},[d.BreakStatement]:{singular:"Loop exit",plural:"Loop exists",shortSingular:"Exit",shortPlural:"Exits"},[d.ContinueStatement]:{singular:"Next iteration",plural:"Next iterations",shortSingular:"Next",shortPlural:"Nexts"},[d.ArgumentDeclaration]:{singular:"Input definition",plural:"Input definitions",shortSingular:"Input",shortPlural:"Inputs"},[d.InputMap]:{singular:"Input",plural:"Inputs",shortSingular:"Input",shortPlural:"Inputs"},[d.OutputMap]:{singular:"Output",plural:"Outputs",shortSingular:"Output",shortPlural:"Outputs"},[d.ValueDescriptor]:{singular:"Value descriptor",plural:"Value descriptors",shortSingular:"Value descriptor",shortPlural:"Value descriptors"},[d.DataType]:{singular:"Data type",plural:"Data types",shortSingular:"Data type",shortPlural:"Data types"},[d.LiteralValue]:{singular:"Literal value",plural:"Literal values",shortSingular:"Value",shortPlural:"Values"}};function AL(s){const u=Tw(s);if(!u){const r=Cm(s);if(r.includes(be.HTTP_ENDPOINT))return"HTTP endpoint";if(r.includes(be.PERSISTED_ENTITY))return"SQL database table";if(r.includes(be.CRON_JOB))return"Scheduled execution";if(r.includes(be.RELATIONAL_DATABASE))return"Relational database";if(r.includes(be.CONTAINER_COMPUTE_ENTITY))return"Container compute";if(r.includes(be.SHARED_DRIVE_ENTITY))return"Shared files drive";if(r.includes(be.COMPUTE_ENTITY))return"Compute";if(r.includes(be.AIRTABLE_AUTH_CONNECTION))return"Airtable account connection";if(r.includes(be.GOOGLE_AUTH_CONNECTION))return"Google account connection";if(r.includes(be.SLACK_AUTH_CONNECTION))return"Slack account connection";if(r.includes(be.ATLASSIAN_AUTH_CONNECTION))return"Atlassian account connection";if(r.includes(be.JIRA_AUTH_CONNECTION))return"Jira account connection";if(r.includes(be.MICROSOFT_AUTH_CONNECTION))return"Microsoft account connection";if(r.includes(be.OPENAI_AUTH_CONNECTION))return"OpenAI account connection";if(r.includes(be.EXTERNAL_INTEGRATION_CONNECTION))return"External account connection"}if(u){let r="Extension of "+ye(u,u.project)+" entity",a=el(r);const c=Cm(s);return c.includes(be.HTTP_ENDPOINT)?"HTTP endpoint"+(a?", "+a:""):c.includes(be.PERSISTED_ENTITY)?"SQL database table"+(a?", "+a:""):c.includes(be.CRON_JOB)?"Scheduled execution"+(a?", "+a:""):c.includes(be.RELATIONAL_DATABASE)?"Relational database"+(a?", "+a:""):c.includes(be.CONTAINER_COMPUTE_ENTITY)?"Container compute"+(a?", "+a:""):c.includes(be.SHARED_DRIVE_ENTITY)?"Shared files drive"+(a?", "+a:""):c.includes(be.COMPUTE_ENTITY)?"Compute"+(a?", "+a:""):c.includes(be.AIRTABLE_AUTH_CONNECTION)?"Airtable account connection"+(a?", "+a:""):c.includes(be.GOOGLE_AUTH_CONNECTION)?"Google account connection"+(a?", "+a:""):c.includes(be.SLACK_AUTH_CONNECTION)?"Slack account connection"+(a?", "+a:""):c.includes(be.ATLASSIAN_AUTH_CONNECTION)?"Atlassian account connection"+(a?", "+a:""):c.includes(be.JIRA_AUTH_CONNECTION)?"Jira account connection"+(a?", "+a:""):c.includes(be.MICROSOFT_AUTH_CONNECTION)?"Microsoft account connection"+(a?", "+a:""):c.includes(be.OPENAI_AUTH_CONNECTION)?"OpenAI account connection"+(a?", "+a:""):c.includes(be.EXTERNAL_INTEGRATION_CONNECTION)?"External account connection"+(a?", "+a:""):r}let i="";return s.abstract&&(i="Template "),s.static&&(i+=i?" single copy ":"Single copy "),i?i+"definition":"Definition"}function yke(s){return s.parent.type===d.DefinitionEntity||s.parent.type===d.InstalledProject?"Internal action of "+ye(s.parent,s.project):s.parent.type===d.Loop?"Action repeated on every iteration":"Internal action of entity"}function gL(s){return FB(s)?yke(s):"Custom trigger"}function tCi(s){var u;switch(s.type){case d.DefinitionEntity:return AL(s);case d.FunctionDeclaration:return gL(s)}return(u=Qs[s.type])==null?void 0:u.singular}function iCi(s){var u;switch(s.type){case d.DefinitionEntity:return AL(s);case d.FunctionDeclaration:return gL(s)}return(u=Qs[s.type])==null?void 0:u.singular}const IL=4e4,RL=280,rCi=300,DL=65,yy=32,dm=39,cE=26,hke=49,fE=44,nCi=35,bI=52,LD=10,Cs=LD*2,uc=38,AI=90,SI=270,mke=IL/2+120,Tke=IL/2+180;function wL(s){let i=yy+fE+uc+LD;const r=[...s.inputs];return r.length&&(i+=Cs,r.forEach(()=>{i+=cE})),{height:i,width:280}}function yE(s){var a,c;let i=yy+fE+uc+LD;const r=[...s.inputs];return r.length&&(i+=Cs,r.forEach(()=>{i+=cE})),s.andChildrenGroup&&(i+=Cs,s.andChildrenGroup.forEach(e=>{i+=yE(e).height})),s.orChildrenGroup&&(i+=Cs,s.orChildrenGroup.forEach(e=>{i+=yE(e).height})),(((a=s.declaration)==null?void 0:a.id)===j.condition["condition-group-and"].id||((c=s.declaration)==null?void 0:c.id)===j.condition["condition-group-or"].id)&&(i+=uc),{height:i,width:280}}function vke(s){var h,m;let i=DL;const r=[];if([d.DefinitionEntity].includes(s.type)){const v=[...s.suggestedProperties||[],...s.properties||[]];v.length&&(i+=Cs,v.forEach(b=>{i+=b.static?hke:dm}))}if([d.DefinitionEntity,d.InstalledProject,d.Loop].includes(s.type)){const v=[...(s==null?void 0:s.suggestedMethods)||[],...s.methods||[],...s.functions||[],...s.body?[s.body]:[]];v.length&&(i+=Cs,v.forEach(b=>{const A=wL(b);i+=A.height}))}ei.includes(s.type)?(r.push(...(s.inputs||[]).flatMap(v=>[v])||[]),i+=Cs,i+=fE,s.error&&(i+=bI)):[d.ReturnStatement,d.BreakStatement,d.ContinueStatement].includes(s.type)?(r.push(...s.outputs||[]),s.throws&&(i+=bI)):s.type===d.Condition&&(r.push(s.inputs[0]),s.inputs[1]&&r.push(s.inputs[1]),(((h=s.declaration)==null?void 0:h.id)===j.condition["condition-group-and"].id||((m=s.declaration)==null?void 0:m.id)===j.condition["condition-group-or"].id)&&(i+=uc),s.andChildrenGroup&&(i+=Cs,s.andChildrenGroup.forEach(v=>{i+=yE(v).height})),s.orChildrenGroup&&(i+=Cs,s.orChildrenGroup.forEach(v=>{i+=yE(v).height})));const a=r.length;a&&(i+=a*dm,i+=Cs);const c=[];if(s.type===d.FunctionDeclaration||s.type===d.GlobalEvent?c.push(...s.inputs||[]):ei.includes(s.type)&&c.push(...s.outputs||[]),mi.includes(s.type)){i+=Cs,i+=fE,s.usedInternalCalls.length&&s.usedInternalCalls.forEach(b=>{i+=bI+Cs,i+=b.inputs.length*cE,i+=b.outputs.length*cE});const v=s.getDataType(null);(!v||v.canModifyObjectStructure())&&(i+=uc)}s.type===d.Search&&(i+=uc);const e=c.length;return e&&(i+=e*dm,i+=Cs),[d.DefinitionEntity,d.FunctionDeclaration,d.ReturnStatement,d.BreakStatement,d.ContinueStatement].includes(s.type)&&(i+=uc),{height:i,width:280}}function Eke(s){let u=0;if(s.parent.type!==d.DefinitionEntity)return{offset:u};const i=s.parent,r=i.methods.findIndex(c=>c.id===s.id);return i.methods.slice(0,r).forEach(c=>{const e=wL(c);u+=e.height}),(i.properties.length||i.suggestedProperties.length)&&(u+=Cs,i.suggestedProperties.forEach(()=>{u+=dm}),i.properties.forEach(()=>{u+=dm})),{offset:u}}function Lb(s){return`${s.split("-").map((r,a)=>a===0?r.charAt(0).toUpperCase()+r.slice(1):r.toLowerCase()).join(" ")}.`}function aCi(s){switch(s.code){case ge.AbstractEntityWithNonAbstractMethods:return"This template entity has non-template actions";case ge.AbstractEntityWithNonAbstractProperties:return"This template entity has non-template properties";case ge.IncorrectEntityImplementation:return"This entity incorrectly implements a template entity";case ge.IncorrectMethodImplementation:return"This action incorrectly implements the template action it's based on";case ge.IncorrectPropertyImplementation:return"This property incorrectly implements the template property it's based on";case ge.AbstractMethodInNonAbstractEntity:return"This action is a template action in a non-template entity";case ge.AbstractPropertyInNonAbstractEntity:return"This property is a template property in a non-template entity";case Pe.MethodOverwritesOtherSiblingWithSameName:return"An action in this entity overwrites an action in the template entity with the same name";case Pe.PropertyOverwritesOtherSiblingWithSameName:return"A property in this entity overwrites a property in the template entity with the same name";case ge.MissingMethodImplementation:return"This entity is missing an action implementation from the template entity";case ge.MissingPropertyImplementation:return"This entity is missing a property implementation from the template entity";case Pe.NameNotUniqueInScope:return"Invalid name. There is another entity with the same name in the same scope";case ge.NoProperties:return"This entity has no properties, so it doesn't do anything";case ge.NonStaticPropertyInStaticEntity:return"This property is not static in a static entity";case ge.StaticEntityWithNonStaticProperties:return"This static entity has non-static properties";case ge.ReadingFromIncompatibleType:return"This entity reads data from a value of a different data type";case ge.WritingToIncompatibleType:return"This entity writes data to a value of a different data type";case ge.ScopeWithoutLogic:return"This action has no logic, so it doesn't do anything";case ge.NonStaticPropertyImplementsStatic:return"This property is static in a non-static entity";case ge.PropertyImplementsIncompatibleType:return"This property implements a property of a different data type";case ge.PropertyImplementsNonAbstact:return"This property implements a non-template property";case ge.StaticPropertyImplementsNonStatic:return"This static property implements a non-static property";case ge.VariableCallsOthersAndHasInternalCall:return"This variable calls other entities while being used to execute internal logic";case ge.VariableHasInputsAndInternalCall:return"This variable has inputs while being used to execute internal logic";case ge.VariableHasOutputsAndInternalCall:return"This variable has outputs while being used to execute internal logic";case ge.VariableIsCalledAndHasInternalCall:return"This variable is called while being used to execute internal logic";case Pe.InternalCallDeclarationIsInvalidType:return"This internal call is not an action";case Pe.InternalCallDeclarationNotFoundInParentDatatypeEntity:return"This internal call is not found in the parent entity";case Pe.InternalCallParentDeclarationEntityInvalidType:return"This internal call parent entity is not a data type";case Pe.InternalCallParentMissingDataType:return"This internal call parent entity has no data type";case Pe.UnreachableEntity:return"This entity is unreachable";case ge.DisconnectedCallableEntity:return"This entity is disconnected and won't be executed by anything after publishing";case ge.AbstractEntityImplements:return"This template entity implements a non-template entity";case ge.AbstractExtendingNonAbstractEntity:return"This template entity extends a non-template entity";case ge.InvalidPropertiesCombination:return"This entity has an invalid combination of properties";case ge.ExtendingNonInteractiveEntity:return"This entity extends a non-interactive entity";case ge.ExtendsIncompatibleEntities:return"This entity extends incompatible entities";case ge.ImplementingNonAbstractEntity:return"This entity implements a non-template entity";case ge.ImplementsIncompatibleEntities:return"This entity implements incompatible entities";case ge.LackingReturnStatementOnSomeBranches:return"This action is missing a termination on some branches";case ge.LastCalledEntityMustBeReturnEntity:return"The last called entity in this action must be a termination node";case ge.MissingRequiredValue:return"This action is missing a required value";case ge.NoPrimaryKeyProperty:return"This entity has no primary key property";case ge.NonAbstractExtendingAbstractEntity:return"This non-template entity extends a template entity";case ge.NonStaticExtendingStaticEntity:return"This non-static entity extends a static entity";case ge.NonStaticImplementingStaticEntity:return"This non-static entity implements a static entity";case ge.StaticExtendingNonStaticEntity:return"This static entity extends a non-static entity";case ge.StaticImplementingNonStaticEntity:return"This static entity implements a non-static entity";case ge.VariableReadsValueAndInternalCall:return"This variable reads a value while being used to execute internal logic";case ge.VariableWritesValuesAndInternalCall:return"This variable writes values while being used to execute internal logic";case Pe.InternalCallDeclarationNotInParentDatatypeEntity:return"This internal call declaration is not in the parent entity";case Pe.EmptyName:return"This entity has no name";case Pe.InvalidObjectStructure:return"This entity has an invalid structure";case Pe.LoopBodyFunctionOverwrite:return"This loop body action overwrites an action in the template entity with the same name";case Pe.MethodOverwritesBaseMethodWithSameImplementation:return"This action overwrites a base action with the same implementation";case Pe.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return"This action overwrites an action in an extended entity with the same implementation";case Pe.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return"This action overwrites an action in an implemented entity with the same implementation";case Pe.MissingCaller:return"This action is missing a caller";case Pe.NameAsResolvedCodeNameNotUniqueInScope:return"This entity has a name that is not unique in the scope of the code it is used in";case Pe.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return"This entity name can only contain letters, numbers, underscores and spaces";case Pe.NameMustStartWithLetterOrUnderscore:return"This entity name must start with a letter or an underscore";case Pe.NoOverlapWithImplementedSignature:return"This action does not overlap with the implemented action signature";case Pe.PropertyOverwritesBasePropertyWithSameImplementation:return"This property overwrites a base property with the same implementation";case Pe.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return"This property overwrites a property in an extended entity with the same implementation";case Pe.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return"This property overwrites a property in an implemented entity with the same implementation";case Pe.ReaderWriterIncompatibleDataType:return"This reader/writer has an incompatible data type with the value it is reading/writing";case lu.StatusCodeMustBeBetween100And599:return"HTTP status code must be between 100 and 599";case lu.StatusCodeMustBeNumber:return"HTTP status code must be a number, between 100 and 599";case tl.UUIDMustBeString:return`UUID must be a string, eg: "${hc()}"`;case tl.UUIDMustNotContainSpaces:return`UUID must not contain spaces, eg: "${hc()}"`;case tl.UUIDMustBeValidFormat:return`UUID must be in a valid format. Eg: "${hc()}"`;case Ra.MustBeUniqueAmongSameEntities:return"This value must be unique among the same kind";case Ra.StringValueMustNotHaveDashes:return"This value must not contain dashes";case Ra.StringValueMustNotHaveSpaces:return"This value must not contain spaces";case Ra.ValueMustBeString:return"This value must be a string";case zv.DayOfMonthAndWeekConflict:return"Cron expression cannot have both day of month and day of week";case zv.InvalidCharacters:return"Cron expression has invalid characters";case zv.MustHaveSixFields:return"Cron expression must have six fields";case ge.CalledBeforeDeclaration:return"Called before declaration";case ge.CalledInParallelBranchToDeclaration:return"Cannot call this action in a parallel branch";case ge.DefaultValueOverridesConstantProperty:return"Cannot override constant property";case ge.DefaultValueOverridesConstantVariable:return"Cannot override constant variable";case ge.EmptyGroupCondition:return"Cannot have an empty condition group";case ge.HigherScopeThanDeclaration:return"In higher scope than declaration";case ge.MissingEnumOptions:return"Missing enum options";case ge.ParentScopeRequiresReturnCurrentCatchesErrorWithNoCalls:return"Current node catches its errors with no further calls which terminates the branch, but the parent trigger requires a returned value";case ge.ValueReadingOverridesConstantProperty:return"Value reading overrides constant property";case ge.ValueReadingOverridesConstantVariable:return"Value reading overrides constant variable";case Pe.GlobalVariableDeclarationCannotBeCalled:return"Global variable declaration cannot be called";case Pe.GlobalVariableDeclarationCannotCallOnError:return"Global variable declaration cannot have error calls";case Pe.GlobalVariableDeclarationCannotCatchError:return"Global variable declaration cannot catch errors";case Pe.InternalCallDeclarationNotFound:return"Internal call declaration not found";case Pe.NameIsForbiddenKeyword:return"The name given is a forbidden keyword";default:return Lb(s.code)}}function sCi(s){switch(s.code){case ge.AbstractEntityWithNonAbstractMethods:return"Non-template actions";case ge.AbstractEntityWithNonAbstractProperties:return"Non-template properties";case ge.IncorrectEntityImplementation:return"Incorrect implementation";case ge.IncorrectMethodImplementation:return"Incorrect action implementation";case ge.IncorrectPropertyImplementation:return"Incorrect property implementation";case ge.AbstractMethodInNonAbstractEntity:return"Template action in non-template entity";case ge.AbstractPropertyInNonAbstractEntity:return"Template property in non-template entity";case Pe.MethodOverwritesOtherSiblingWithSameName:return"Action overwrite";case Pe.PropertyOverwritesOtherSiblingWithSameName:return"Property overwrite";case ge.MissingMethodImplementation:return"Missing action";case ge.MissingPropertyImplementation:return"Missing property";case Pe.NameNotUniqueInScope:return"Duplicate name";case ge.NoProperties:return"No properties";case ge.NonStaticPropertyInStaticEntity:return"Non-static property";case ge.StaticEntityWithNonStaticProperties:return"Non-static properties";case ge.ReadingFromIncompatibleType:return"Read from different type";case ge.WritingToIncompatibleType:return"Write to different type";case ge.ScopeWithoutLogic:return"No logic";case ge.NonStaticPropertyImplementsStatic:return"Invalid static property";case ge.PropertyImplementsIncompatibleType:return"Incompatible data type";case ge.PropertyImplementsNonAbstact:return"Non-template property";case ge.StaticPropertyImplementsNonStatic:return"Non-static property";case ge.VariableCallsOthersAndHasInternalCall:return"Bad internal call";case ge.VariableHasInputsAndInternalCall:return"Bad internal call";case ge.VariableHasOutputsAndInternalCall:return"Bad internal call";case ge.VariableIsCalledAndHasInternalCall:return"Bad internal call";case Pe.InternalCallDeclarationIsInvalidType:return"Declaration not an action";case Pe.InternalCallDeclarationNotFoundInParentDatatypeEntity:return"Declaration not found in parent";case Pe.InternalCallParentDeclarationEntityInvalidType:return"Invalid parent declaration type";case Pe.InternalCallParentMissingDataType:return"Parent has no data type";case Pe.InternalCallDeclarationNotInParentDatatypeEntity:return"Declaration not in parent";case Pe.UnreachableEntity:return"Unreachable entity";case ge.DisconnectedCallableEntity:return"Disconnected entity";case ge.AbstractEntityImplements:return"Abstract entity implements a non-template entity";case ge.AbstractExtendingNonAbstractEntity:return"Abstract entity extends a non-template entity";case ge.InvalidPropertiesCombination:return"Invalid properties combination";case ge.ExtendingNonInteractiveEntity:return"Extending non-interactive entity";case ge.ExtendsIncompatibleEntities:return"Extends incompatible entities";case ge.ImplementingNonAbstractEntity:return"Implementing non-template entity";case ge.ImplementsIncompatibleEntities:return"Implements incompatible entities";case ge.LackingReturnStatementOnSomeBranches:return"Missing termination on some branches";case ge.LastCalledEntityMustBeReturnEntity:return"Last called entity must be a termination node";case ge.MissingRequiredValue:return"Missing required value";case ge.NoPrimaryKeyProperty:return"No primary key property";case ge.NonAbstractExtendingAbstractEntity:return"Non-template entity extending a template entity";case ge.NonStaticExtendingStaticEntity:return"Non-static entity extending a static entity";case ge.NonStaticImplementingStaticEntity:return"Non-static entity implementing a static entity";case ge.StaticExtendingNonStaticEntity:return"Static entity extending a non-static entity";case ge.StaticImplementingNonStaticEntity:return"Static entity implementing a non-static entity";case ge.VariableReadsValueAndInternalCall:return"Variable reads value and has internal call";case ge.VariableWritesValuesAndInternalCall:return"Variable writes values and has internal call";case Pe.EmptyName:return"Empty name";case Pe.InvalidObjectStructure:return"Invalid object structure";case Pe.LoopBodyFunctionOverwrite:return"Loop body action overwrites action with same name";case Pe.MethodOverwritesBaseMethodWithSameImplementation:return"Action overwrites base action with same implementation";case Pe.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return"Action overwrites another with same implementation";case Pe.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return"Action overwrites another with same implementation";case Pe.MissingCaller:return"Missing caller";case Pe.NameAsResolvedCodeNameNotUniqueInScope:return"Name not unique in scope";case Pe.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return"Name can only contain letters, numbers, underscores and spaces";case Pe.NameMustStartWithLetterOrUnderscore:return"Name must start with letter or underscore";case Pe.NoOverlapWithImplementedSignature:return"No overlap with implemented signature";case Pe.PropertyOverwritesBasePropertyWithSameImplementation:return"Property overwrites base property with same implementation";case Pe.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return"Property overwrites another with same implementation";case Pe.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return"Property overwrites another with same implementation";case Pe.ReaderWriterIncompatibleDataType:return"Reader/writer incompatible data type";case lu.StatusCodeMustBeBetween100And599:return"HTTP status code must be between 100 and 599";case lu.StatusCodeMustBeNumber:return"HTTP status code must be a number";case tl.UUIDMustBeString:return"UUID must be a string";case tl.UUIDMustNotContainSpaces:return"UUID must not contain spaces";case tl.UUIDMustBeValidFormat:return"UUID must be in a valid format";case Ra.MustBeUniqueAmongSameEntities:return"This value must be unique among the same kind";case Ra.StringValueMustNotHaveDashes:return"This value must not contain dashes";case Ra.StringValueMustNotHaveSpaces:return"This value must not contain spaces";case ge.CalledBeforeDeclaration:return"Called before declaration";case ge.CalledInParallelBranchToDeclaration:return"Cannot call in a parallel branch";case ge.DefaultValueOverridesConstantProperty:return"Cannot override constant";case ge.DefaultValueOverridesConstantVariable:return"Cannot override constant";case ge.EmptyGroupCondition:return"Empty condition group";case ge.HigherScopeThanDeclaration:return"Higher scope than declaration";case ge.MissingEnumOptions:return"Missing enum options";case ge.ParentScopeRequiresReturnCurrentCatchesErrorWithNoCalls:return"Catches errors with no further calls, but the parent trigger requires a returned value";case ge.ValueReadingOverridesConstantProperty:return"Value reading overrides constant";case ge.ValueReadingOverridesConstantVariable:return"Value reading overrides constant";case Pe.GlobalVariableDeclarationCannotBeCalled:return"Global variable declaration cannot be called";case Pe.GlobalVariableDeclarationCannotCallOnError:return"Global variable declaration cannot have error calls";case Pe.GlobalVariableDeclarationCannotCatchError:return"Global variable declaration cannot catch errors";case Pe.InternalCallDeclarationNotFound:return"Internal call declaration not found";case Pe.NameIsForbiddenKeyword:return"Name is a forbidden keyword";default:return Lb(s.code)}}function lCi(s){switch(s.code){case ge.AbstractEntityWithNonAbstractMethods:return`${ye(s.entity,s.entity.project)} has non-template actions`;case ge.AbstractEntityWithNonAbstractProperties:return`${ye(s.entity,s.entity.project)} has non-template properties`;case ge.IncorrectEntityImplementation:return`${ye(s.entity,s.entity.project)} incorrectly implements template`;case ge.IncorrectMethodImplementation:return`${ye(s.entity,s.entity.project)} incorrectly implements the template`;case ge.IncorrectPropertyImplementation:return`${ye(s.entity,s.entity.project)} incorrectly implements the template`;case ge.AbstractMethodInNonAbstractEntity:return`${ye(s.entity,s.entity.project)} can't be a template`;case ge.AbstractPropertyInNonAbstractEntity:return`${ye(s.entity,s.entity.project)} can't be a template`;case Pe.MethodOverwritesOtherSiblingWithSameName:return`${ye(s.entity,s.entity.project)} overwrites action`;case Pe.PropertyOverwritesOtherSiblingWithSameName:return`${ye(s.entity,s.entity.project)} overwrites property`;case ge.MissingMethodImplementation:return`${ye(s.entity,s.entity.project)} is missing action`;case ge.MissingPropertyImplementation:return`${ye(s.entity,s.entity.project)} is missing property`;case Pe.NameNotUniqueInScope:return`${ye(s.entity,s.entity.project)} name is not unique`;case ge.NoProperties:return`${ye(s.entity,s.entity.project)} has no properties`;case ge.NonStaticPropertyInStaticEntity:return`${ye(s.entity,s.entity.project)} has non-static property`;case ge.StaticEntityWithNonStaticProperties:return`${ye(s.entity,s.entity.project)} has non-static properties`;case ge.ReadingFromIncompatibleType:return`${ye(s.entity,s.entity.project)} reads from different type`;case ge.WritingToIncompatibleType:return`${ye(s.entity,s.entity.project)} writes to different type`;case ge.ScopeWithoutLogic:return`${ye(s.entity,s.entity.project)} has no logic`;case ge.NonStaticPropertyImplementsStatic:return`${ye(s.entity,s.entity.project)} has invalid static property`;case ge.PropertyImplementsIncompatibleType:return`${ye(s.entity,s.entity.project)} has incompatible data type`;case ge.PropertyImplementsNonAbstact:return`${ye(s.entity,s.entity.project)} has non-template property`;case ge.StaticPropertyImplementsNonStatic:return`${ye(s.entity,s.entity.project)} has non-static property`;case ge.VariableCallsOthersAndHasInternalCall:return`${ye(s.entity,s.entity.project)} has bad internal call`;case ge.VariableHasInputsAndInternalCall:return`${ye(s.entity,s.entity.project)} has bad internal call`;case ge.VariableHasOutputsAndInternalCall:return`${ye(s.entity,s.entity.project)} has bad internal call`;case ge.VariableIsCalledAndHasInternalCall:return`${ye(s.entity,s.entity.project)} has bad internal call`;case Pe.InternalCallDeclarationIsInvalidType:return`${ye(s.entity,s.entity.project)} has declaration that is not an action`;case Pe.InternalCallDeclarationNotFoundInParentDatatypeEntity:return`${ye(s.entity,s.entity.project)} has declaration that is not found in parent`;case Pe.InternalCallParentDeclarationEntityInvalidType:return`${ye(s.entity,s.entity.project)} has invalid parent declaration type`;case Pe.InternalCallParentMissingDataType:return`${ye(s.entity,s.entity.project)}'s parent has no data type`;case Pe.InternalCallDeclarationNotInParentDatatypeEntity:return`${ye(s.entity,s.entity.project)} has declaration that is not in parent`;case Pe.UnreachableEntity:return`${ye(s.entity,s.entity.project)} is unreachable`;case ge.DisconnectedCallableEntity:return`${ye(s.entity,s.entity.project)} is not executed by any entity`;case ge.AbstractEntityImplements:return`${ye(s.entity,s.entity.project)} implements a non-template entity`;case ge.AbstractExtendingNonAbstractEntity:return`${ye(s.entity,s.entity.project)} extends a non-template entity`;case ge.InvalidPropertiesCombination:return`${ye(s.entity,s.entity.project)} has invalid properties combination`;case ge.ExtendingNonInteractiveEntity:return`${ye(s.entity,s.entity.project)} extends a non-interactive entity`;case ge.ExtendsIncompatibleEntities:return`${ye(s.entity,s.entity.project)} extends incompatible entities`;case ge.ImplementingNonAbstractEntity:return`${ye(s.entity,s.entity.project)} implements a non-template entity`;case ge.ImplementsIncompatibleEntities:return`${ye(s.entity,s.entity.project)} implements incompatible entities`;case ge.LackingReturnStatementOnSomeBranches:return`${ye(s.entity,s.entity.project)} is missing termination on some branches`;case ge.LastCalledEntityMustBeReturnEntity:return`${ye(s.entity,s.entity.project)}'s last called entity must be a termination node`;case ge.MissingRequiredValue:return`${ye(s.entity,s.entity.project)} is missing a required value`;case ge.NoPrimaryKeyProperty:return`${ye(s.entity,s.entity.project)} has no primary key property`;case ge.NonAbstractExtendingAbstractEntity:return`${ye(s.entity,s.entity.project)} extends a template entity`;case ge.NonStaticExtendingStaticEntity:return`${ye(s.entity,s.entity.project)} extends a static entity`;case ge.NonStaticImplementingStaticEntity:return`${ye(s.entity,s.entity.project)} implements a static entity`;case ge.StaticExtendingNonStaticEntity:return`${ye(s.entity,s.entity.project)} extends a non-static entity`;case ge.StaticImplementingNonStaticEntity:return`${ye(s.entity,s.entity.project)} implements a non-static entity`;case ge.VariableReadsValueAndInternalCall:return`${ye(s.entity,s.entity.project)} reads a value and has internal call`;case ge.VariableWritesValuesAndInternalCall:return`${ye(s.entity,s.entity.project)} writes values and has internal call`;case Pe.EmptyName:return`${Qs[s.entity.type]} has no name`;case Pe.InvalidObjectStructure:return`${ye(s.entity,s.entity.project)} has invalid structure`;case Pe.LoopBodyFunctionOverwrite:return`${ye(s.entity,s.entity.project)}'s loop body action overwrites an action`;case Pe.MethodOverwritesBaseMethodWithSameImplementation:return`${ye(s.entity,s.entity.project)} overwrites base action`;case Pe.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return`${ye(s.entity,s.entity.project)} overwrites another action with same implementation`;case Pe.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return`${ye(s.entity,s.entity.project)} overwrites another action with same implementation`;case Pe.MissingCaller:return`${ye(s.entity,s.entity.project)} is missing a caller`;case Pe.NameAsResolvedCodeNameNotUniqueInScope:return`${ye(s.entity,s.entity.project)} has a name not unique in the scope`;case Pe.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return`${ye(s.entity,s.entity.project)} name can only contain letters, numbers, underscores and spaces`;case Pe.NameMustStartWithLetterOrUnderscore:return`${ye(s.entity,s.entity.project)} name must start with letter or underscore`;case Pe.NoOverlapWithImplementedSignature:return`${ye(s.entity,s.entity.project)} has no overlap with implemented signature`;case Pe.PropertyOverwritesBasePropertyWithSameImplementation:return`${ye(s.entity,s.entity.project)} overwrites base property`;case Pe.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return`${ye(s.entity,s.entity.project)} overwrites another property with same implementation`;case Pe.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return`${ye(s.entity,s.entity.project)} overwrites another property with same implementation`;case Pe.ReaderWriterIncompatibleDataType:return`${ye(s.entity,s.entity.project)} has reader/writer with incompatible data type`;case lu.StatusCodeMustBeBetween100And599:return`${ye(s.entity,s.entity.project)} HTTP status code must be between 100 and 599`;case lu.StatusCodeMustBeNumber:return`${ye(s.entity,s.entity.project)} HTTP status code must be a number`;case tl.UUIDMustBeString:return`${ye(s.entity,s.entity.project)} UUID must be a string`;case tl.UUIDMustNotContainSpaces:return`${ye(s.entity,s.entity.project)} UUID must not contain spaces`;case tl.UUIDMustBeValidFormat:return`${ye(s.entity,s.entity.project)} UUID must be in a valid format`;case Ra.MustBeUniqueAmongSameEntities:return`${ye(s.entity,s.entity.project)} value must be unique among the same kind`;case Ra.StringValueMustNotHaveDashes:return`${ye(s.entity,s.entity.project)} value must not contain dashes`;case Ra.StringValueMustNotHaveSpaces:return`${ye(s.entity,s.entity.project)} value must not contain spaces`;default:return`${ye(s.entity,s.entity.project)} Error: ${Lb(s.code)}`}}function oCi(s){var u,i,r,a;switch(s.code){case ge.AbstractEntityWithNonAbstractMethods:return`${ye(s.entity,s.entity.project)} has non-template actions`;case ge.AbstractEntityWithNonAbstractProperties:return`${ye(s.entity,s.entity.project)} has non-template properties`;case ge.IncorrectEntityImplementation:return`${ye(s.entity,s.entity.project)} incorrectly implements the template entity`;case ge.IncorrectMethodImplementation:return`${ye(s.entity,s.entity.project)} incorrectly implements the template action it's based on`;case ge.IncorrectPropertyImplementation:return`${ye(s.entity,s.entity.project)} incorrectly implements the template property it's based on`;case ge.AbstractMethodInNonAbstractEntity:return`${ye(s.entity,s.entity.project)} is a template action in a non-template entity`;case ge.AbstractPropertyInNonAbstractEntity:return`${ye(s.entity,s.entity.project)} is a template property in a non-template entity`;case Pe.MethodOverwritesOtherSiblingWithSameName:return`${ye(s.entity,s.entity.project)} overwrites an action in the template entity`;case Pe.PropertyOverwritesOtherSiblingWithSameName:return`${ye(s.entity,s.entity.project)} overwrites a property in the template entity`;case ge.MissingMethodImplementation:return`${ye(s.entity,s.entity.project)} is missing an action implementation from the template entity`;case ge.MissingPropertyImplementation:return`${ye(s.entity,s.entity.project)} is missing a property implementation from the template entity`;case Pe.NameNotUniqueInScope:return`${ye(s.entity,s.entity.project)} has a duplicate name in the same scope`;case ge.NoProperties:return`${ye(s.entity,s.entity.project)} has no properties, so it doesn't do anything`;case ge.NonStaticPropertyInStaticEntity:return`${ye(s.entity,s.entity.project)} has a non-static property in a static entity`;case ge.StaticEntityWithNonStaticProperties:return`${ye(s.entity,s.entity.project)} has non-static properties in a static entity`;case ge.ReadingFromIncompatibleType:return`${ye(s.entity,s.entity.project)} reads data from a value of a different data type`;case ge.WritingToIncompatibleType:return`${ye(s.entity,s.entity.project)} writes data to a value of a different data type`;case ge.ScopeWithoutLogic:return`${ye(s.entity,s.entity.project)} has no logic`;case ge.NonStaticPropertyImplementsStatic:return`${ye(s.entity,s.entity.project)} has a static property in a non-static entity`;case ge.PropertyImplementsIncompatibleType:return`${ye(s.entity,s.entity.project)} implements a property of a different data type`;case ge.PropertyImplementsNonAbstact:return`${ye(s.entity,s.entity.project)} implements a non-template property`;case ge.StaticPropertyImplementsNonStatic:return`${ye(s.entity,s.entity.project)} has a static property in a non-static entity`;case ge.VariableCallsOthersAndHasInternalCall:return`${ye(s.entity,s.entity.project)} calls other entities while being used to execute internal logic`;case ge.VariableHasInputsAndInternalCall:return`${ye(s.entity,s.entity.project)} has inputs while being used to execute internal logic`;case ge.VariableHasOutputsAndInternalCall:return`${ye(s.entity,s.entity.project)} has outputs while being used to execute internal logic`;case ge.VariableIsCalledAndHasInternalCall:return`${ye(s.entity,s.entity.project)} is called while being used to execute internal logic`;case Pe.InternalCallDeclarationIsInvalidType:return`${ye(s.entity,s.entity.project)} has a declaration that is not an action`;case Pe.InternalCallDeclarationNotFoundInParentDatatypeEntity:return`${ye(s.entity,s.entity.project)} has a declaration that is not found in ${(u=s.entity.parent.getDataType(null))!=null&&u.entity?ye((i=s.entity.parent.getDataType(null))==null?void 0:i.entity,s.entity.project):"the variable's data-type entity"}`;case Pe.InternalCallParentDeclarationEntityInvalidType:return`${ye(s.entity,s.entity.project)} is part of a variable whos data-type entity can't have actions`;case Pe.InternalCallParentMissingDataType:return`${ye(s.entity,s.entity.project)} is part of a variable with no data-type entity`;case Pe.InternalCallDeclarationNotInParentDatatypeEntity:return`${ye(s.entity,s.entity.project)} has a declaration doesn't belong to ${(r=s.entity.parent.getDataType(null))!=null&&r.entity?ye((a=s.entity.parent.getDataType(null))==null?void 0:a.entity,s.entity.project):"the variable's data-type entity"}`;case Pe.UnreachableEntity:return`${ye(s.entity,s.entity.project)} is unreachable`;case ge.DisconnectedCallableEntity:return`${ye(s.entity,s.entity.project)} is disconnected and won't be executed by anything after publishing`;case ge.AbstractEntityImplements:return`${ye(s.entity,s.entity.project)} implements a non-template entity`;case ge.AbstractExtendingNonAbstractEntity:return`${ye(s.entity,s.entity.project)} extends a non-template entity`;case ge.InvalidPropertiesCombination:return`${ye(s.entity,s.entity.project)} has an invalid combination of properties`;case ge.ExtendingNonInteractiveEntity:return`${ye(s.entity,s.entity.project)} extends a non-interactive entity`;case ge.ExtendsIncompatibleEntities:return`${ye(s.entity,s.entity.project)} extends incompatible entities`;case ge.ImplementingNonAbstractEntity:return`${ye(s.entity,s.entity.project)} implements a non-template entity`;case ge.ImplementsIncompatibleEntities:return`${ye(s.entity,s.entity.project)} implements incompatible entities`;case ge.LackingReturnStatementOnSomeBranches:return`${ye(s.entity,s.entity.project)} has branches that don't terminate`;case ge.LastCalledEntityMustBeReturnEntity:return`${ye(s.entity,s.entity.project)} must end with a termination node`;case ge.MissingRequiredValue:return`${ye(s.entity,s.entity.project)} is missing a required value`;case ge.NoPrimaryKeyProperty:return`${ye(s.entity,s.entity.project)} has no primary key property`;case ge.NonAbstractExtendingAbstractEntity:return`${ye(s.entity,s.entity.project)} is a non-template entity extending a template entity`;case ge.NonStaticExtendingStaticEntity:return`${ye(s.entity,s.entity.project)} is a non-static entity extending a static entity`;case ge.NonStaticImplementingStaticEntity:return`${ye(s.entity,s.entity.project)} is a non-static entity implementing a static entity`;case ge.StaticExtendingNonStaticEntity:return`${ye(s.entity,s.entity.project)} is a static entity extending a non-static entity`;case ge.StaticImplementingNonStaticEntity:return`${ye(s.entity,s.entity.project)} is a static entity implementing a non-static entity`;case ge.VariableReadsValueAndInternalCall:return`${ye(s.entity,s.entity.project)} reads a value and has an internal call`;case ge.VariableWritesValuesAndInternalCall:return`${ye(s.entity,s.entity.project)} writes values and has an internal call`;case Pe.EmptyName:return`${Qs[s.entity.type]} has no name`;case Pe.InvalidObjectStructure:return`${ye(s.entity,s.entity.project)} has an invalid structure`;case Pe.LoopBodyFunctionOverwrite:return`${ye(s.entity,s.entity.project)}'s loop body action overwrites`;case Pe.MethodOverwritesBaseMethodWithSameImplementation:return`${ye(s.entity,s.entity.project)} overwrites a base action with same implementation`;case Pe.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return`${ye(s.entity,s.entity.project)} overwrites another action with same implementation`;case Pe.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return`${ye(s.entity,s.entity.project)} overwrites another action with same implementation`;case Pe.MissingCaller:return`${ye(s.entity,s.entity.project)} is missing a caller`;case Pe.NameAsResolvedCodeNameNotUniqueInScope:return`${ye(s.entity,s.entity.project)} has a name that is not unique in the scope`;case Pe.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return`${ye(s.entity,s.entity.project)} name can only contain letters, numbers, underscores and spaces`;case Pe.NameMustStartWithLetterOrUnderscore:return`${ye(s.entity,s.entity.project)} name must start with letter or underscore`;case Pe.NoOverlapWithImplementedSignature:return`${ye(s.entity,s.entity.project)} has no overlap with implemented signature`;case Pe.PropertyOverwritesBasePropertyWithSameImplementation:return`${ye(s.entity,s.entity.project)} overwrites a base property with same implementation`;case Pe.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return`${ye(s.entity,s.entity.project)} overwrites another property with same implementation`;case Pe.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return`${ye(s.entity,s.entity.project)} overwrites another property with same implementation`;case Pe.ReaderWriterIncompatibleDataType:return`${ye(s.entity,s.entity.project)} has a reader/writer with incompatible data type`;case lu.StatusCodeMustBeBetween100And599:return`${ye(s.entity,s.entity.project)} HTTP status code must be between 100 and 599`;case lu.StatusCodeMustBeNumber:return`${ye(s.entity,s.entity.project)} HTTP status code must be a number, between 100 and 599`;case tl.UUIDMustBeString:return`${ye(s.entity,s.entity.project)} UUID must be a string, eg: "${hc()}"`;case tl.UUIDMustNotContainSpaces:return`${ye(s.entity,s.entity.project)} UUID must not contain spaces, eg: "${hc()}"`;case tl.UUIDMustBeValidFormat:return`${ye(s.entity,s.entity.project)} UUID must be in a valid format. Eg: "${hc()}"`;case Ra.MustBeUniqueAmongSameEntities:return`${ye(s.entity,s.entity.project)} value must be unique among the same kind`;case Ra.StringValueMustNotHaveDashes:return`${ye(s.entity,s.entity.project)} value must not contain dashes`;case Ra.StringValueMustNotHaveSpaces:return`${ye(s.entity,s.entity.project)} value must not contain spaces`;case ge.CalledBeforeDeclaration:return"Called before declaration";case ge.CalledInParallelBranchToDeclaration:return`${ye(s.entity,s.entity.project)} cannot be called in a parallel branch`;case ge.DefaultValueOverridesConstantProperty:return`${ye(s.entity,s.entity.project)} default value overrides constant property`;case ge.DefaultValueOverridesConstantVariable:return`${ye(s.entity,s.entity.project)} default value overrides constant variable`;case ge.EmptyGroupCondition:return`${ye(s.entity,s.entity.project)} contains an empty group condition`;case ge.HigherScopeThanDeclaration:return`${ye(s.entity,s.entity.project)} is in a higher scope than its declaration`;case ge.MissingEnumOptions:return`${ye(s.entity,s.entity.project)} is missing enum options`;case ge.ParentScopeRequiresReturnCurrentCatchesErrorWithNoCalls:return`${ye(s.entity,s.entity.project)} catches its errors but its parent scope requires a returned value`;case ge.ValueReadingOverridesConstantProperty:return`${ye(s.entity,s.entity.project)} is reading a value, but it is a constant property`;case ge.ValueReadingOverridesConstantVariable:return`${ye(s.entity,s.entity.project)} is reading a value, but it is a constant variable`;case Pe.GlobalVariableDeclarationCannotBeCalled:return`${ye(s.entity,s.entity.project)} is global variable declaration and cannot be called`;case Pe.GlobalVariableDeclarationCannotCallOnError:return`${ye(s.entity,s.entity.project)} is global variable declaration and cannot call on error`;case Pe.GlobalVariableDeclarationCannotCatchError:return`${ye(s.entity,s.entity.project)} is global variable declaration and cannot catch errors`;case Pe.InternalCallDeclarationNotFound:return`${ye(s.entity,s.entity.project)}'s declaration isn't found`;case Pe.NameIsForbiddenKeyword:return`${ye(s.entity,s.entity.project)}'s name is a forbidden keyword`;default:return`${ye(s.entity,s.entity.project)} Error: ${Lb(s.code)}`}}function Bb(s){const u=(s||"").startsWith("error-caller-only--");switch(u?s.replace("error-caller-only--",""):s){case Ci.CallIsInHigherScope:return"In a higher scope";case Ci.CallIsInLowerScope:return"In a lower scope";case Ci.CallerIsInHigherScope:return"Caller is in a higher scope";case Ci.CallerIsInLowerScope:return"Caller is in a lower scope";case Ci.CannotBeCalledByChildren:return"Cannot be called by children";case Ci.CannotCallAncestor:return"Cannot call ancestor";case Ci.CannotConnectToItself:return"Cannot connect to itself";case Ci.CannotReadMoreThanOneValue:return"Cannot read more than one value";case Ci.CannotReadValueFromChildren:return"Cannot read value from entities executed after itself";case Ci.CannotWriteValueToAncestor:return"Cannot write value to ancestor";case RE.Suggestion:return"Suggestion";case Ci.ContinueOrBreakStatementCalledFromOutsideLoop:return"Cannot be called from outside loop";case Ci.DataTypesNotCompatible:return"Data types not compatible";case Ci.ElementInLoopBodyCallingOutsideLoop:return"Cannot call outside loop";case Ci.ErrorOututMapCannotBeConnectedToParentSuccessBranchCallees:return"Error cannot be connected to success branch";case Ci.ExecutionsAlreadyConnected:return"Executions already connected";case Ci.IsNotValueReadingEntity:return"Is not a value reading entity";case Ci.IsNotValueWritingEntity:return"Is not a value writing entity";case Ci.NotInScope:return"Not in a compatible scope";case Ci.OtherIncompatibleScopeReason:return"Incompatible scope";case Ci.SiblingInternalCallAlreadyUsedInParentVariable:return"Internal call already used in parent variable";case Ci.SuccessOutputMapCannotBeConnectedToParentErrorBranchCallees:return"Success cannot be connected to error branch";case Ci.ValuesAlreadyConnected:return"Values already connected";case Ci.CannotInteractWithInputInVariableWithInternalCalls:return"Cannot interact with input in variable with internal calls";case Ci.CannotInteractWithOutputInVariableWithInternalCalls:return"Cannot interact with output in variable with internal calls";case RE.CanvasGloballyDisabled:return"Canvas is globally disabled";case Ci.PropertyIsConstantItsValueCantBeReset:return"Property is constant, its value can't be reset";case Ci.CannotWriteValueOfGlobalVariableDeclaration:return"Cannot write value of global variable declaration";case Ci.CannotReSetValueOfConstantVariable:return"Cannot re-set value of constant variable";case Ci.CannotConnectToOwnNode:return"It is part of the same node";case Ci.CalledByErrorMustBePassThroughCallable:return"Called by error must be pass-through callable";case Ci.CannotChangeScopeBecauseItCallsOtherEntities:return"Cannot change scope because it calls other entities in its current scope";case Ci.CannotChangeScopeBecauseItIsAlreadyCalledByOtherEntitiesInDifferentScope:return"Cannot change scope because it is already called by other entities in different scope";case Ci.VariableDeclarationCannotBeMovedToLowerScopeBecauseInstancesUsage:return"Variable declaration cannot be moved to lower scope because its instances are used in the current or different incompatible lower scope";case Ci.CalledBySourceMustBeCallerEntity:return"Not a caller type";case Ci.CalledByErrorCannotBeConnectedToEntitiesCalledByOwnSuccessBranch:return"Already connected to the success branch from a common origin caller";case Ci.CalledBySuccessCannotBeConnectedToEntitiesCalledByOwnErrorBranch:return"Already connected to the error branch from a common origin caller";case Ci.RedundantCall:return"Redundant call. Already connected further down the execution path";case Ci.CannotBeCalledBeforeDeclaration:return"Cannot be called before declaration";case Ci.CannotBeCalledInParallelBranchToDeclaration:return"Cannot be called in parallel branch to declaration";case Ci.CannotBeHigherScopeThanDeclaration:return"Cannot be in a higher scope than declaration";case Ci.CannotCallGlobalVariableDeclaration:return"Cannot call global variable declaration";case Ci.EntityAlreadyCalledBySuccessCannotBeConnectedToUnrelatedErrorBranch:return u?"Cannot connect error: Already connected to a success branch from a common origin caller":"Already connected to a success branch from a common origin caller";case Ci.CannotInteractWithInputInGlobalVariableDeclaration:return"Cannot interact with input in global variable declaration";case Ci.IsNotCallableEntity:return"Is not a callable node type";case Ci.IsNotCallerEntity:return"Is not a caller node type";case Ci.IsNotPassThroughCallableEntity:return"Is not a pass-through callable node type that has an error branch";case Ci.NotAConnectableEntityType:return"Not a connectable node type";case Ci.WouldMakeAnEarlierNodeBeCalledBeforeItsDeclaration:return"Would make an earlier node be called before its declaration";default:return Vf(s||"")}}function dCi(s,u){const i=[...s,...u],r=Array.from(new Set(i));return{hasChanged:r.length!==s.length,reasons:r}}function uCi(s,u){const i=s.filter(a=>!u.includes(a));return{hasChanged:i.length!==s.length,reasons:i}}function pCi(s,u){return s.find(i=>i.entity.id===u)||null}function Xj(s){return s.filter((u,i)=>s.indexOf(u)===i)}class $n{constructor(u,i,r=null,a){D(this,"ids",[]);D(this,"entity");D(this,"entityCardHeight");D(this,"entityCardWidth");D(this,"index");D(this,"childEntities",[]);D(this,"children",[]);D(this,"parents",[]);D(this,"calculationEntryPoint");D(this,"_onlyEntities",null);D(this,"_changeSet",null);if(this.index=i,this.entity=u,this.calculationEntryPoint=r||this,this._changeSet=a||null,this===this.calculationEntryPoint&&!a)throw new Error("Change-set must be provided for the calculation entry point");this.calculateCardSize(),this.getSortedChildren()}static autoGenerateLayout(u,i,r){const a=mke-SI-RL,c=Tke-AI-DL;u.type===d.Project?(u.x=a,u.y=c):u.metaSync({x:u.x||a,y:u.y||c},i);const e=new $n(u,0,null,i);e.calculationEntryPoint=e,e._onlyEntities=r||[],e.ids=["0"];const f=[];e.next(m=>{f.push(...m)}),$n.recursivelyAssembleChildrenAreas(f),e.resolveChildrenOverlaps();const h=e.flattenChildEntities();return e._onlyEntities?h.filter(m=>{var v;return(v=e._onlyEntities)==null?void 0:v.includes(m)}):h}static recursivelyAssembleChildrenAreas(u){const i=[];u.forEach(r=>{r.next(a=>{i.push(...a)})}),i.length>0&&$n.recursivelyAssembleChildrenAreas(i)}get onlyEntities(){return this.calculationEntryPoint._onlyEntities||[]}get changeSet(){return this.calculationEntryPoint._changeSet}set changeSet(u){this.calculationEntryPoint._changeSet=u}findAreaInChildrenFromEntity(u){if(this.entity===u)return this;const i=this.children.find(a=>a.entity===u);return i||this.children.reduce((a,c)=>a||c.findAreaInChildrenFromEntity(u),null)}findAreaFromEntity(u){if(this.entity===u)return this;const i=this.calculationEntryPoint.children,r=i.find(c=>c.entity===u);return r||i.reduce((c,e)=>c||e.findAreaInChildrenFromEntity(u),null)}addParent(u){if(!this.parents.includes(u)){const i=$n.resolveIds(u,this.index);this.ids.push(...i),this.parents.push(u)}}static resolveIds(u,i){return u?u.ids.map(r=>`${r}-${i}`):[`${i}`]}getSortedChildren(){if(this.entity.collapsed){this.childEntities=[];return}const u=Qo(this.entity,!0);if(this.entity.type===d.Project){const i=[],r=[],a=[];u.forEach(e=>{if(d.DefinitionEntity===e.type){r.push(e);return}else if(Ti.includes(e.type)){a.push(e);return}i.push(e)});const c=i.sort((e,f)=>{const h=!!iR(e,f).length,m=Qo(e),v=Qo(f);return h?0:m.length&&!v.length?-1:!m.length&&v.length?1:0}).filter(e=>!Mf(e).length);this.childEntities=[...r,...a,...c]}else{const i=[],r=[],a=[],c=[],e=[];Ar.includes(this.entity.type)&&hw(this.entity).forEach(m=>{if(mi.includes(m.type)){a.push(m);return}const v=Mt(m);i.push(v)}),tn.includes(this.entity.type)&&r.push(...this.entity.detachedChildren);const f=u.filter(h=>{const m=i.includes(h);return m||a.includes(h)||r.includes(h)?!1:mi.includes(h.type)?(a.push(h),!1):gr.includes(h.type)&&!m?(c.push(h),!1):h.type===d.DefinitionEntity?(e.push(h),!1):!0});i.sort((h,m)=>Ho(h,m)?-1:0),c.sort((h,m)=>Ho(h,m)?-1:0),a.sort((h,m)=>AN(h,m)?1:AN(m,h)?-1:0),this.childEntities=[...e,...i,...c,...f,...a,...r]}}calculateCardSize(){const u=vke(this.entity);this.entityCardWidth=u.width,this.entityCardHeight=u.height}static getBoundriesOfTwoAreas(u,i){return{top:Math.min(u.top,i.top),left:Math.min(u.left,i.left),bottom:Math.max(u.bottom,i.bottom),right:Math.max(u.right,i.right)}}static getBoundriedOfCombinedAreas(u,i){const r=u.filter(c=>!i.includes(c));return r.reduce((c,e)=>i.includes(e)?c:$n.getBoundriesOfTwoAreas(c,e.fullBranchArea),r[0].fullBranchArea)}getFullAreaUntilAny(u){const i=this.ownEntityPlusBufferArea;return this.children.filter(e=>!u.includes(e)).map(e=>e.getFullAreaUntilAny(u)).reduce((e,f)=>$n.getBoundriesOfTwoAreas(e,f),i)}getFullAreaUntilAreaOrAnyChildren(u){const i=[u,...u.flattenChildren()],r=this.ownEntityPlusBufferArea;return this.children.filter(e=>i.includes(e)).map(e=>e.getFullAreaUntil(u)).reduce((e,f)=>$n.getBoundriesOfTwoAreas(e,f),r)}getFullAreaUntil(u){const i=this.ownEntityPlusBufferArea;return this.children.filter(c=>c!==u).map(c=>c.getFullAreaUntil(u)).reduce((c,e)=>$n.getBoundriesOfTwoAreas(c,e),i)}get fullBranchArea(){const u=this.ownEntityPlusBufferArea;return this.children.map(a=>a.fullBranchArea).reduce((a,c)=>$n.getBoundriesOfTwoAreas(a,c),u)}get ownEntityArea(){return{top:this.entity.y,left:this.entity.x,bottom:this.entity.y+this.entityCardHeight,right:this.entity.x+this.entityCardWidth}}get ownEntityPlusBufferArea(){const u=this.ownEntityArea;return{top:u.top,left:u.left,bottom:u.bottom+AI,right:u.right+SI}}static filterOutRepeatedAreas(u){return u.filter((i,r)=>u.indexOf(i)===r)}getEarliestId(u,i){const r=u.split("-"),a=i.split("-");return r.length<a.length?u:r.length>a.length?i:r.reduce((e,f,h)=>f<a[h]?u:i,u)}getEarliestLevel(){return this.ids.reduce((r,a)=>this.getEarliestId(r,a),this.ids[0]).split("-").length}countColumns(){let u=0;if(this!==this.calculationEntryPoint)u++;else return u;if(!this.parents.length)return u;const r=this.parents.reduce((a,c)=>c.getEarliestLevel()>a.getEarliestLevel()?c:a,this.parents[0]).countColumns();return u+=r,u}getLatestId(u,i){if(u===i)return u;const r=u.split("-"),a=i.split("-");return r.length<a.length?i:r.length>a.length?u:r.reduce((e,f,h)=>f>a[h]?u:i,u)}getLatestLevel(){return this.ids.length===1?this.ids[0].split("-").length:this.ids.reduce((r,a)=>this.getLatestId(r,a),this.ids[0]).split("-").length}smoothPosition(){const u=this.flattenSiblings();if(!u.length&&this.parents.length<=1&&this.children.length){const i=this.centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight();this.parents.forEach(r=>{r!==this.calculationEntryPoint&&r.shiftDownAlone(i)})}else if([...Ti].includes(this.entity.type)&&this.children.length)this.centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight();else if(!this.children.length&&this.parents.length>1){const i=u.filter(r=>!this.parents.includes(r));i.length?i.every(a=>{const c=this.countColumns(),e=a.countColumns();return c>e})&&this.centerHeaderVerticallyOverCombinedAllParentsHeaderHeight():i.length||this.centerHeaderVerticallyOverCombinedAllParentsHeaderHeight()}}shiftDownUntilAny(u,i){if(u.includes(this))return u;this.move(this.entity,{y:this.entity.y+i});let r=[...u,this];return this.children.forEach(a=>{if($n.getEarliestParentInChain(a)!==this)return;const e=pCi(r,a.entity.id);r=$n.filterOutRepeatedAreas([...r]),e||(r=r.filter(h=>h!==a));const f=a.shiftDownUntilAny(r,i);r.push(...f)}),r}shiftRightUntilAny(u,i){u.includes(this)||(this.move(this.entity,{x:this.entity.x+i}),this.children.forEach(r=>{const a=$n.filterOutRepeatedAreas([...this.flattenSiblings(),...u]);$n.getEarliestParentInChain(r)===this&&r.shiftRightUntilAny(a,i)}))}shiftRight(u){this.move(this.entity,{x:this.entity.x+u}),this.children.forEach(i=>{const a=i.flattenSiblings().filter(c=>c!==i);i.shiftRightUntilAny(a,u)})}shiftDownAlone(u){this.move(this.entity,{y:this.entity.y+u})}centerHeaderVerticallyOverCombinedAllParentsHeaderHeight(){const u=this.parents.reduce((a,c)=>{const e=c.ownEntityArea,f=e.top+yy,h={top:f,left:e.left,bottom:f,right:e.right};return $n.getBoundriesOfTwoAreas(a,h)},{top:1/0,left:1/0,bottom:-1/0,right:-1/0}),r=(u.bottom-u.top)/2-yy;this.shiftDownAlone(r)}centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight(){const u=this.children.reduce((a,c)=>{const e=c.ownEntityArea,f=e.top+yy,h={top:f,left:e.left,bottom:f,right:e.right};return $n.getBoundriesOfTwoAreas(a,h)},{top:1/0,left:1/0,bottom:-1/0,right:-1/0}),r=(u.bottom-u.top)/2-yy;return this.shiftDownAlone(r),r}resolveChildrenOverlaps(){const u=this.flattenChildren();let i=[];u.forEach(r=>{const a=r.adjustVerticallyToAvoidOverlaps();i.push(...a)}),u.forEach(r=>{r.smoothPosition()})}static getEarliestParentInChain(u){let i=u.parents[0];return u.parents.length&&(i=u.parents.sort((r,a)=>{if(!r.ids.length)return-1;if(!a.ids.length)return 1;const c=r.ids.sort((f,h)=>f.length<h.length?-1:0),e=a.ids.sort((f,h)=>f.length<h.length?-1:0);return c[0].length-e[0].length})[0]),i}flattenEarlierSiblings(u=new Set){return u.add(this.entity.id),this.parents.reduce((r,a)=>{if(u.has(a.entity.id))return r;u.add(a.entity.id);const e=a.children.slice(0,a.children.indexOf(this)).reduce((f,h)=>[...f,h,...h.flattenChildren(u)],[]);return[...r,...e]},[])}flattenSiblings(u=new Set){return u.add(this.entity.id),this.parents.reduce((r,a)=>{if(u.has(a.entity.id))return r;u.add(a.entity.id);const e=a.children.filter(f=>f!==this).reduce((f,h)=>[...f,h,...h.flattenChildren(u)],[]);return[...r,...e]},[])}flattenChildren(u=new Set){return this.children.reduce((i,r)=>u.has(r.entity.id)?i:(u.add(r.entity.id),[...i,r,...r.flattenChildren(u)]),[])}flattenParents(u=new Set){return this.parents.reduce((r,a)=>u.has(a.entity.id)?r:(u.add(a.entity.id),[...r,a,...a.flattenParents(u)]),[])}getAreaIfRendered(u){return this.calculationEntryPoint.flattenChildren().find(a=>a.entity.id===u.id)||null}getLowerSiblings(){const u=this.parents.reduce((i,r)=>{const a=r.children.indexOf(this),c=r.children.slice(a+1);return[...i,...c]},[]);return Xj(u)}getLowerAreas(){const u=this.getLowerSiblings(),i=this.parents.reduce((r,a)=>[...r,...a.getLowerAreas()],[]);return Xj([...u,...i])}adjustVerticallyToAvoidOverlaps(u=[]){const r=$n.getEarliestParentInChain(this).children[this.index-1];if(!r)return u;const a=this.flattenEarlierSiblings(),c=this.flattenParents(),e=[...a,...c,r],m=P(e.flatMap(w=>iR(this.entity,w.entity))).filter(w=>w.id!==this.entity.id).map(w=>this.findAreaFromEntity(w)).filter(w=>!!w),v=this.getFullAreaUntilAny(m),b=r.getFullAreaUntilAny(m),A=e.reduce((w,R)=>R===this||R.fullBranchArea.left!==v.left?w:Math.max(w,R.fullBranchArea.bottom),b.bottom);if(v.top<A){const w=A-v.top+AI;return this.shiftDownUntilAny(u,w)}return u}move(u,i){if(this.onlyEntities.includes(u)){if(!this.changeSet)throw new Error("Change set is not defined for this area, cannot move entity");u.metaSync(i,this.changeSet)}}addChild(u){const i=this.childEntities[u];let r=null;i.x&&i.y?r=this.getAreaIfRendered(i):!i.x&&!i.y&&this.move(i,{x:this.entity.x,y:this.entity.y}),r||(r=new $n(i,u,this.calculationEntryPoint));const a=this.ownEntityPlusBufferArea;this.children.includes(r)||(this.children.push(r),r.addParent(this));const c=r.fullBranchArea;if(c.left<a.right){const e=a.right-c.left;r.shiftRight(e)}return r}flattenChildEntities(u=new Set){return this.children.reduce((i,r)=>u.has(r.entity.id)?i:(u.add(r.entity.id),[...i,r.entity,...r.flattenChildEntities(u)]),[])}next(u){const i=[];this.childEntities.forEach((r,a)=>{const c=this.addChild(a);c&&i.push(c)}),u(i)}}async function cCi(s,u,i={}){var c;const r=X.YieldTracker.from(i),a=[];console.log("Generating layout for project...");for(const e of s.instancesList){if(s.diggestedBuiltInBaseEntitiesIds.has(e.id)||!Cy.includes(e.type)||((c=Mt(e))==null?void 0:c.id)!==e.id)continue;let f=ci(e,s);if(!f){console.log("No top scope owner for instance: ",e," in project: ",s);continue}if(!(Ti.includes(f.type)&&f.collapsed&&f.id!==e.id)){for(;f.parent&&f.parent!==s;)f=f.parent,Ti.includes(f.type)&&f.collapsed&&(f.id,e.id);e.x=0,e.y=0,u==null||u.add(e,z.Updated),a.push(e),await r.tick()}}$n.autoGenerateLayout(s,u,a)}async function fCi(s,u,i={}){const r=X.YieldTracker.from(i),a=[],c=[s,...Nt(s)].map(e=>Mt(e)).filter(Boolean);for(const e of c){if(s.project.diggestedBuiltInBaseEntitiesIds.has(e.id))continue;let f=ci(e,s.project);if(f&&!(Ti.includes(f.type)&&f.collapsed&&f.id!==e.id)){for(;f.parent&&f.parent!==s.project;)f=f.parent,Ti.includes(f.type)&&f.collapsed&&(f.id,e.id);e.x=0,e.y=0,u==null||u.add(e,z.Updated),a.push(e),await r.tick()}}$n.autoGenerateLayout(s.project,u,a)}async function yCi(s,u,i={}){const r=X.YieldTracker.from(i),a=[],c=new Set;yqe(u,{shallowMissingActivesError:!0,excludeAffected:!0}).forEach(m=>{var b;if((!m.x||!m.y)&&!c.has(m.id)&&!s.diggestedBuiltInBaseEntitiesIds.has(m.id)&&(a.push(m),c.add(m.id)),ed(m,s)){const A=Mt(m);A&&!c.has(A.id)&&!s.diggestedBuiltInBaseEntitiesIds.has(A.id)&&(a.push(A),c.add(A.id))}if(Ar.includes(m.type)){const A=m;[A,...Nt(A)].forEach(R=>{const O=Mt(R);O&&!c.has(O.id)&&!s.diggestedBuiltInBaseEntitiesIds.has(O.id)&&(a.push(O),c.add(O.id))})}m.type===d.DefinitionEntity&&m.methods.forEach(A=>{Nt(A).forEach(R=>{const O=Mt(R);O&&!c.has(O.id)&&!s.diggestedBuiltInBaseEntitiesIds.has(O.id)&&(a.push(O),c.add(O.id))})}),((b=m.parent)==null?void 0:b.type)===d.Project&&(a.push(m),c.add(m.id),Ar.includes(m.type)&&Nt(m).forEach(R=>{const O=Mt(R);O&&!c.has(O.id)&&!s.diggestedBuiltInBaseEntitiesIds.has(O.id)&&(a.push(O),c.add(O.id))}))});let f=[];for(const m of a)s.diggestedBuiltInBaseEntitiesIds.has(m.id)||(m.x=0,m.y=0,u==null||u.add(m,z.Updated),f.push(m),await r.tick());f=P(f),$n.autoGenerateLayout(s,u,f);const h=P([...f,...s.variableDeclarations,...s.variableInstances,...s.loops,...s.conditions,...s.operations,...s.searches]).filter(m=>m.x===0||m.y===0);$n.autoGenerateLayout(s,u,h)}var Uv=(s=>(s.Amazon="amazon",s.Google="google",s.Microsoft="microsoft",s))(Uv||{}),Jr=(s=>(s.RelationalDatabase="relational-database",s.CompiledLocalCodebase="compiled-local-codebase",s.CloudHostedCodebase="cloud-hosted-codebase",s.HttpApi="http-api",s.HttpEndpoint="http-endpoint",s.ServerlessFunction="serverless-function",s.CronJob="cron-job",s.AWSTenantAccount="aws-tenant-account",s.ContainerCompute="container-compute",s.SharedDrive="shared-drive",s))(Jr||{}),WP=(s=>(s.Post="post",s.Get="get",s.Acknowledgement="acknowledgment",s.Progress="progress",s.Error="error",s.Complete="complete",s))(WP||{}),py=(s=>(s.Queued="queued",s.Running="running",s.Success="success",s.Failed="failed",s.CleanupInProgress="cleanup-in-progress",s.CleanedUp="cleaned-up",s.Skipped="skipped",s.AbortedByUser="aborted-by-user",s.UnrecoverableFailure="unrecoverable-failure",s.Reverted="reverted",s.UnpublishingStarted="unpublishing-started",s.Unpublished="unpublished",s))(py||{}),zP=(s=>(s.Queued="queued",s.Running="running",s.Success="success",s.Failed="failed",s.CleanupInProgress="cleanup-in-progress",s.CleanedUp="cleaned-up",s.UnrecoverableFailure="unrecoverable-failure",s.Reverted="reverted",s.UnpublishingStarted="unpublishing-started",s.Unpublished="unpublished",s))(zP||{}),Ai=(s=>(s.ProjectNotFound="project-not-found",s.ProjectPublishRequestAcknowledged="project-publish-request-acknowledged",s.PublicationStepFailedReasonUnknown="publication-step-failed-reason-unknown",s.DeploymentCompleted="deployment-completed",s.DeploymentStarted="deployment-started",s.DeploymentFailed="deployment-failed",s.AllInfrastructureSuccessfullyProvisioned="all-infrastucture-successfully-provisioned",s.RequestPayloadValidationFailed="request-payload-validation-failed",s.ProjectStateValidationFailedMissingName="project-state-validation-failed-missing-name",s.ProjectStateValidationFailedMissingAnyFunctionality="project-state-validation-failed-missing-any-functionality",s.ProjectAlreadyBeingPublished="project-already-being-published",s.BillingSubscriptionUpdateFailed="billing-subscription-update-failed",s.RelationalDatabaseDeploymentStarted="relational-database-deployment-started",s.RelationalDatabaseDeploymentCompleted="relational-database-deployment-completed",s.RelationalDatabaseDeploymentFailed="relational-database-deployment-failed",s.CreatingNewRelationalDatabase="creating-new-relational-database",s.WaitingForPreviousRelationalDatabaseDeployment="waiting-for-previous-relationa-database-deployment",s.RelationalDatabaseAlreadyExists="relational-database-already-exists",s.RelationalDatabaseDeletionStarted="relational-database-deletion-started",s.RelationalDatabaseDeletionCompleted="relational-database-deletion-completed",s.RelationalDatabaseDeletionFailed="relational-database-deletion-failed",s.WaitingForPreviousRelationalDatabaseDeletion="waiting-for-previous-relationa-database-deletion",s.HttpApiDeploymentStarted="http-api-deployment-started",s.HttpApiDeploymentCompleted="http-api-deployment-completed",s.HttpApiDeploymentFailed="http-api-deployment-failed",s.CreatingNewHttpApi="creating-new-http-api",s.HttpApiAlreadyExists="http-api-already-exists",s.HttpApiDeletionStarted="http-api-deletion-started",s.HttpApiDeletionCompleted="http-api-deletion-completed",s.HttpApiDeletionFailed="http-api-deletion-failed",s.WaitingForPreviousHttpApiDeletion="waiting-for-previous-http-api-deletion",s.BusinessLogicCodebaseDeploymentStarted="business-logic-codebase-deployment-started",s.BusinessLogicCodebaseDeploymentCompleted="business-logic-codebase-deployment-completed",s.BusinessLogicCodebaseDeploymentFailed="business-logic-codebase-deployment-failed",s.BundlingCodebaseForDownload="bundling-codebase-for-download",s.UploadingCodebaseToCloudStorage="uploading-codebase-to-cloud-storage",s.UploadingCodebaseToCloudStorageCompleted="uploading-codebase-to-cloud-storage-completed",s.UploadingCodebaseToCloudStorageFailed="uploading-codebase-to-cloud-storage-failed",s.InfrastructureValuesCodebaseInterpolationStarted="infrastructure-values-codebase-interpolation-started",s.InfrastructureValuesCodebaseInterpolationCompleted="infrastructure-values-codebase-interpolation-completed",s.InfrastructureValuesCodebaseInterpolationFailed="infrastructure-values-codebase-interpolation-failed",s.CodeCompilationStarted="code-compilation-started",s.CodeCompilationCompleted="code-compilation-completed",s.CodeCompilationFailed="code-compilation-failed",s.BundleCodebaseStarted="bundle-codebase-started",s.BundleCodebaseCompleted="bundle-codebase-completed",s.BundleCodebaseFailed="bundle-codebase-failed",s.InstallingCodebaseDependenciesStarted="installing-codebase-dependencies-started",s.InstallingCodebaseDependenciesCompleted="installing-codebase-dependencies-completed",s.InstallingCodebaseDependenciesFailed="installing-codebase-dependencies-failed",s.MigrateRelationalDatabaseStarted="migrate-relational-database-started",s.MigrateRelationalDatabaseCompleted="migrate-relational-database-completed",s.MigrateRelationalDatabaseFailed="migrate-relational-database-failed",s.RevertRelationalDatabaseMigrationStarted="revert-relational-database-migration-started",s.RevertRelationalDatabaseMigrationCompleted="revert-relational-database-migration-completed",s.RevertRelationalDatabaseMigrationFailed="revert-relational-database-migration-failed",s.ExecutePublicationCompletedEventStarted="execute-publication-completed-event-started",s.ExecutePublicationCompletedEventCompleted="execute-publication-completed-event-completed",s.ExecutePublicationCompletedEventFailed="execute-publication-completed-event-failed",s.ExecutePublicationCompletedEventTimedOut="execute-publication-completed-event-timed-out",s.AWSTenantAccountProvisioningStarted="aws-tenant-account-provisioning-started",s.AWSTenantAccountProvisioningCompleted="aws-tenant-account-provisioning-completed",s.AWSTenantAccountProvisioningFailed="aws-tenant-account-provisioning-failed",s.ContainerComputeDeploymentStarted="container-compute-deployment-started",s.ContainerComputeDeploymentCompleted="container-compute-deployment-completed",s.ContainerComputeDeploymentFailed="container-compute-deployment-failed",s.ContainerComputeDeletionStarted="container-compute-deletion-started",s.ContainerComputeDeletionCompleted="container-compute-deletion-completed",s.ContainerComputeDeletionFailed="container-compute-deletion-failed",s.SharedDriveDeploymentStarted="shared-drive-deployment-started",s.SharedDriveDeploymentCompleted="shared-drive-deployment-completed",s.SharedDriveDeploymentFailed="shared-drive-deployment-failed",s.SharedDriveAlreadyExists="shared-drive-already-exists",s.SharedDriveDeletionStarted="shared-drive-deletion-started",s.SharedDriveDeletionCompleted="shared-drive-deletion-completed",s.SharedDriveDeletionFailed="shared-drive-deletion-failed",s))(Ai||{}),jo=(s=>(s.CodeCompilation="code-compilation",s.RelationalDatabaseDeployment="relational-database-deployment",s.RelationalDatabaseDeletion="relational-database-deletion",s.HttpApiDeployment="http-api-deployment",s.HttpApiDeletion="http-api-deletion",s.InfrastructureValuesCodebaseInterpolation="infrastructure-values-codebase-interpolation",s.BundleCodebase="bundle-codebase",s.MigrateRelationalDatabase="migrate-relational-database",s.RevertRelationalDatabaseMigration="revert-relational-database-migration",s.BusinessLogicCodebaseDeployment="business-logic-codebase-deployment",s.ExecutePublicationCompletedEvent="execute-publication-completed-event",s.CodebaseCleanup="codebase-cleanup",s.AWSTenantAccountProvisioning="aws-tenant-account-provisioning",s.ContainerComputeDeployment="container-compute-deployment",s.ContainerComputeDeletion="container-compute-deletion",s.SharedDriveDeployment="shared-drive-deployment",s.SharedDriveDeletion="shared-drive-deletion",s))(jo||{});Jr.CloudHostedCodebase,Jr.HttpApi,Jr.RelationalDatabase,Jr.CloudHostedCodebase,Jr.CloudHostedCodebase,Jr.RelationalDatabase,Jr.CloudHostedCodebase,Jr.CloudHostedCodebase;function bke(s){return`project-${s}-http-api`}function BD(s){return`entity-${s}-database`}class Ake{constructor(u,i,r,a,c,e,f,h,m,v=!1,b){D(this,"stepType");D(this,"id");D(this,"resourceType");D(this,"index");D(this,"dependency",[]);D(this,"lastEvent",null);D(this,"lastEventTimestamp",null);D(this,"status",py.Queued);D(this,"publicationRun");D(this,"resource");D(this,"cleanup",!1);D(this,"cleanupFor",null);D(this,"logs",[]);this.stepType=u,this.id=i,this.resourceType=r,this.status=a,this.dependency=c,this.index=e,this.lastEventTimestamp=f,this.publicationRun=h,this.resource=m,this.cleanup=v,this.cleanupFor=b||null}toJSON(){return{stepType:this.stepType,id:this.id,resourceType:this.resourceType,index:this.index,status:this.status,dependency:this.dependency,lastEvent:this.lastEvent,resource:{resourceId:this.resource.resourceId,resourceType:this.resource.resourceType,provider:this.resource.provider,details:this.resource.details,status:this.resource.status,name:this.resource.name},cleanup:this.cleanup,cleanupFor:this.cleanupFor,logs:this.logs}}async update(u){var i,r;this.status=u.status,this.dependency=u.dependency,this.index=u.index,this.stepType=u.stepType,this.resourceType=u.resourceType,this.lastEvent=u.lastEvent,this.id=u.id,(r=this.resource)==null||r.setDetails((i=u.resource)==null?void 0:i.details)}}var gke=(s=>(s.Ready="ready",s.Provisioning="provisioning",s.Queued="queued",s.ProvisioningFailed="provisioning-failed",s.Deleting="deleting",s.DeletingFailed="deleting-failed",s.Deleted="deleted",s))(gke||{});class xf{constructor(u,i,r){D(this,"provisionedBy");D(this,"publicationRun");D(this,"resourceType");D(this,"provider");D(this,"resourceId");D(this,"details",null);D(this,"name",null);D(this,"status","queued");this.publicationRun=u,this.resourceType=i,this.provider=r}setDetails(u){this.details=u}setStatus(u){this.status=u}setProvisionedBy(u){this.provisionedBy=u}}class hCi extends xf{constructor(i,r,a){super(i,Jr.HttpEndpoint,a);D(this,"resourceType",Jr.HttpEndpoint);D(this,"owners",new Map);D(this,"details",null);D(this,"status","queued");r.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,r;return this.resourceId=BD((r=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:r.id),this.resourceId}}class mCi extends xf{constructor(i,r,a){super(i,Jr.ServerlessFunction,a);D(this,"resourceType",Jr.ServerlessFunction);D(this,"owners",new Map);D(this,"details",null);D(this,"status","queued");r.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,r;return this.resourceId=BD((r=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:r.id),this.resourceId}}class Ike extends xf{constructor(i,r,a){super(i,Jr.HttpApi,a);D(this,"resourceType",Jr.HttpApi);D(this,"owners",new Map);D(this,"details",null);D(this,"status","queued");r.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=bke(this.publicationRun.project.id),this.resourceId}}class Rke extends xf{constructor(i,r,a){super(i,Jr.RelationalDatabase,a);D(this,"resourceType",Jr.RelationalDatabase);D(this,"owners",new Map);D(this,"details",null);D(this,"status","queued");r.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,r;return this.resourceId=BD((r=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:r.id),this.resourceId}}class Dke extends xf{constructor(i,r){super(i,Jr.CloudHostedCodebase,r);D(this,"resourceType",Jr.CloudHostedCodebase);D(this,"details",null);D(this,"status","queued");this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=`cloud-hosted-codebase--${this.publicationRun.project.id}--${this.publicationRun.project.version}`,this.resourceId}}class wke extends xf{constructor(i,r){super(i,Jr.CompiledLocalCodebase,r);D(this,"resourceType",Jr.CompiledLocalCodebase);D(this,"details",null);D(this,"status","queued");this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=`compiled-codebase--${this.publicationRun.project.id}--${this.publicationRun.project.version}--${this.publicationRun.id}`,this.resourceId}}class TCi extends xf{constructor(i,r){super(i,Jr.AWSTenantAccount,r);D(this,"resourceType",Jr.AWSTenantAccount);D(this,"status","queued");this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=`aws-tenant-account--${this.publicationRun.project.id}`,this.resourceId}}class vCi{constructor(u,i){D(this,"id");D(this,"projectAutoIncrementPublicationCount");D(this,"projectPublishedSemanticVersion");D(this,"envIdentifier");D(this,"projectVersion");D(this,"projectBranchId");D(this,"projectId");D(this,"triggeredBy");D(this,"createdAt");D(this,"updatedAt");D(this,"status");D(this,"steps",[]);D(this,"cleanupSteps",[]);D(this,"editor");D(this,"explicitResources",new Map);D(this,"implicitGlobalResources",new Map);D(this,"finalGlobalEvent",null);D(this,"finalStatus",null);D(this,"contextType",le.PublicationRun);D(this,"extensionsRegistry");this.id=u.id,this.projectAutoIncrementPublicationCount=u.projectAutoIncrementPublicationCount,this.projectPublishedSemanticVersion=u.projectPublishedSemanticVersion,this.envIdentifier=u.envIdentifier,this.projectVersion=u.projectVersion,this.projectBranchId=u.projectBranchId,this.projectId=u.projectId,this.triggeredBy=u.triggeredBy,this.createdAt=u.createdAt,this.updatedAt=u.updatedAt,this.status=u.status,this.editor=i,this.initRegistry()}get off(){return this.extensionsRegistry.off}get on(){return this.extensionsRegistry.on}get emit(){return this.extensionsRegistry.emit}get emitAsync(){return this.extensionsRegistry.emitAsync}get emitAsyncAll(){return this.extensionsRegistry.emitAsyncAll}get emitAsyncAllSettled(){return this.extensionsRegistry.emitAsyncAllSettled}get emitAsyncSequentially(){return this.extensionsRegistry.emitAsyncSequentially}get emitAsyncSequentiallyAll(){return this.extensionsRegistry.emitAsyncSequentiallyAll}get emitAsyncSequentiallyAllSettled(){return this.extensionsRegistry.emitAsyncSequentiallyAllSettled}get project(){return this.editor.project}getInfraTypes(u){return this.steps.filter(i=>u.includes(i.resourceType))}getStepsTypes(u){return this.steps.filter(i=>u.includes(i.stepType))}toIds(u){return u.map(i=>i.id)}getResourceForEntity(u){const i=Array.from(this.explicitResources.values()).find(r=>r.owners.has(u.id));return i||null}async init(){await this.initResources()}async initResources(){this.implicitGlobalResources.set(Jr.CompiledLocalCodebase,new wke(this,Uv.Amazon)),this.implicitGlobalResources.set(Jr.CloudHostedCodebase,new Dke(this,Uv.Amazon));const u=this.project.entities.filter(r=>Vi(r,be.HTTP_ENDPOINT)),i=this.project.entities.filter(r=>Vi(r,be.RELATIONAL_DATABASE));if(i.length&&i.forEach(r=>{const a=new Rke(this,[r],Uv.Amazon);this.explicitResources.set(a.resourceId,a)}),u.length){const r=new Ike(this,u,Uv.Amazon);this.explicitResources.set(r.resourceId,r)}}setSteps(u,i){u.forEach(r=>{this.addStep(r,i)}),this.editor.events.emit(Ai.ProjectPublishRequestAcknowledged,{})}addStep(u,i){const r=u.dependency||[];if(r.length){const c=r.filter(e=>!this.steps.find(f=>f.id===e));if(c.length)throw new Error(`Missing dependencies: ${c.join(", ")}`)}if(!this.steps.find(c=>c.id===u.id)){const c=new Ake(u.stepType,u.id,u.resourceType,u.status,r,u.index,i,this,null);this.steps.push(c)}}onUpdate(u){var i;if(X.Logger.log("onUpdate",u),(i=u.payload)!=null&&i.stepType){const r=this.steps.find(a=>{var c;return a.id===((c=u.payload)==null?void 0:c.id)});r&&U(u.emittedAt).isAfter(U(r.lastEventTimestamp))&&r.update(u.payload)}this.editor.events.emit("publication-updated",{}),u.type===WP.Error?(this.finalStatus=zP.Failed,this.finalGlobalEvent=u.event,this.editor.events.emit("project-publication-error",u)):u.type===WP.Complete&&(this.finalStatus=zP.Success,this.finalGlobalEvent=u.event,this.editor.events.emit("project-publication-completed",u))}requestExtension(u){return this.extensionsRegistry.requestExtension(u)}async initRegistry(){return this.extensionsRegistry=new vL(this.editor.events),await this.extensionsRegistry.setup(),this.extensionsRegistry.onResolvePublicationRunContext(()=>this),await this.extensionsRegistry.contextAvailable(le.PublicationRun),this.extensionsRegistry}}function ECi(s){switch(s){case jo.CodeCompilation:return"Code generation";case jo.RelationalDatabaseDeployment:return"Database creation";case jo.HttpApiDeployment:return"HTTP gateway creation";case jo.InfrastructureValuesCodebaseInterpolation:return"Link code with resources";case jo.BundleCodebase:return"Bundle code";case jo.MigrateRelationalDatabase:return"Database structure migration";case jo.BusinessLogicCodebaseDeployment:return"Update servers with new code";case jo.CodebaseCleanup:return"Code cleanup";case jo.HttpApiDeletion:return"HTTP gateway deletion";case jo.RelationalDatabaseDeletion:return"Database deletion";default:return"Publication finished"}}function bCi(s){switch(s){case Ai.DeploymentCompleted:return"Successfully published";case Ai.DeploymentStarted:return"Publication started";case Ai.DeploymentFailed:return"Publication failed";case Ai.AllInfrastructureSuccessfullyProvisioned:return"All infrastructure successfully provisioned";case Ai.RequestPayloadValidationFailed:return"Request payload validation failed";case Ai.ProjectStateValidationFailedMissingName:return"Project state validation failed: missing name";case Ai.ProjectStateValidationFailedMissingAnyFunctionality:return"Project state validation failed: missing any functionality";case Ai.RelationalDatabaseDeploymentStarted:return"Database creation started";case Ai.RelationalDatabaseDeploymentCompleted:return"Database creation completed";case Ai.RelationalDatabaseDeploymentFailed:return"Database creation failed";case Ai.CreatingNewRelationalDatabase:return"Creating new database (up to 5 mins)";case Ai.WaitingForPreviousRelationalDatabaseDeployment:return"Waiting for previous database creation";case Ai.RelationalDatabaseAlreadyExists:return"Database already exists";case Ai.HttpApiDeploymentStarted:return"HTTP gateway creation started";case Ai.HttpApiDeploymentCompleted:return"HTTP gateway creation completed";case Ai.HttpApiDeploymentFailed:return"HTTP gateway creation failed";case Ai.CreatingNewHttpApi:return"Creating new HTTP gateway";case Ai.HttpApiAlreadyExists:return"HTTP gateway already exists";case Ai.BusinessLogicCodebaseDeploymentStarted:return"Update servers with new code started";case Ai.BusinessLogicCodebaseDeploymentCompleted:return"Update servers with new code completed";case Ai.BusinessLogicCodebaseDeploymentFailed:return"Update servers with new code failed";case Ai.BundlingCodebaseForDownload:return"Bundling code for download";case Ai.UploadingCodebaseToCloudStorage:return"Uploading code to cloud storage";case Ai.InfrastructureValuesCodebaseInterpolationStarted:return"Linking code with resources started";case Ai.InfrastructureValuesCodebaseInterpolationCompleted:return"Linking code with resources completed";case Ai.InfrastructureValuesCodebaseInterpolationFailed:return"Linking code with resources failed";case Ai.CodeCompilationStarted:return"Code generation started";case Ai.CodeCompilationCompleted:return"Code generation completed";case Ai.CodeCompilationFailed:return"Code generation failed";case Ai.BundleCodebaseStarted:return"Code bundling started";case Ai.BundleCodebaseCompleted:return"Code bundling completed";case Ai.BundleCodebaseFailed:return"Code bundling failed";case Ai.InstallingCodebaseDependenciesStarted:return"Installing code dependencies";case Ai.InstallingCodebaseDependenciesCompleted:return"Installing code dependencies completed";case Ai.InstallingCodebaseDependenciesFailed:return"Installing code dependencies failed";case Ai.MigrateRelationalDatabaseStarted:return"Database structure migration started";case Ai.MigrateRelationalDatabaseCompleted:return"Database structure migration completed";case Ai.MigrateRelationalDatabaseFailed:return"Database structure migration failed";case Ai.ProjectAlreadyBeingPublished:return"Project already being published. You need to wait for the previous publication to complete";case Ai.ProjectPublishRequestAcknowledged:return"Project publish request acknowledged";case Ai.UploadingCodebaseToCloudStorageCompleted:return"Uploading code to cloud storage completed";case Ai.UploadingCodebaseToCloudStorageFailed:return"Uploading code to cloud storage failed";case Ai.BillingSubscriptionUpdateFailed:return"Billing subscription update failed";case Ai.ProjectNotFound:return"Project not found";case Ai.HttpApiDeletionCompleted:return"HTTP gateway deletion completed";case Ai.HttpApiDeletionFailed:return"HTTP gateway deletion failed";case Ai.HttpApiDeletionStarted:return"HTTP gateway deletion started";case Ai.PublicationStepFailedReasonUnknown:return"Publication step failed: reason unknown";case Ai.WaitingForPreviousHttpApiDeletion:return"Waiting for previous HTTP gateway deletion";case Ai.RelationalDatabaseDeletionStarted:return"Database deletion started";case Ai.RelationalDatabaseDeletionCompleted:return"Database deletion completed";case Ai.RelationalDatabaseDeletionFailed:return"Database deletion failed";case Ai.WaitingForPreviousRelationalDatabaseDeletion:return"Waiting for previous database deletion"}return"Unknown event"}var Cke=(s=>(s.NO_LOGIC="NO_LOGIC",s.NO_NAME="NO_NAME",s.NO_CHANGES="NO_CHANGES",s.PROJECT_PUBLICATION_ALREADY_ONGOING="PROJECT_PUBLICATION_ALREADY_ONGOING",s))(Cke||{});function ACi(s){switch(s){case"NO_LOGIC":return"This project has no logic";case"NO_NAME":return"This project has no name";case"NO_CHANGES":return"This version has already been published";case"PROJECT_PUBLICATION_ALREADY_ONGOING":return"This project is already being published";default:return"Publishing is currently not available. Try again later"}}function gCi(s){switch(s){case Jr.RelationalDatabase:return"Relational database";case Jr.HttpEndpoint:case Jr.HttpApi:return"HTTP endpoints";case Jr.ServerlessFunction:case Jr.CloudHostedCodebase:return"Server code functions";default:return"Resources"}}function ICi(s){switch(s){case py.Running:return"In progress";case py.Failed:return"Failed";case py.Success:return"Succeeded";case py.Skipped:return"Skipped";case py.Queued:default:return"Queued"}}async function Oke(s,u={}){var h;const i=X.YieldTracker.from(u),r=ts(s),a=is(s),c=[...r,...a,...ta(s),...CL(s),...rs(s),...OL(s)],e=iA(s);c.push(...e);const f=vi(s.errors,c);await i.tick();for(const m of s.inputs)await m.validateAsync({tracker:i});for(const m of s.outputs)await m.validateAsync({tracker:i});for(const m of s.internalCalls)await m.validateAsync({tracker:i});return await((h=s.dataType)==null?void 0:h.validateAsync({tracker:i})),f}function _ke(s){var c;(c=s.dataType)==null||c.validate(),s.inputs.forEach(e=>e.validate()),s.outputs.forEach(e=>e.validate()),s.internalCalls.forEach(e=>e.validate());const u=ts(s),i=is(s),r=[...u,...i,...ta(s),...CL(s),...rs(s),...OL(s)],a=iA(s);return r.push(...a),vi(s.errors,r)}function CL(s,u){const r=[...s.project.getVariableDeclarations()].filter(a=>a.id!==s.id);return nA(s,[$r],r,u)}function OL(s){const u=[];if(s.parent!==s.project)return u;if(s.catchesError){const i=Kt({id:`${s.id}--${Pe.GlobalVariableDeclarationCannotCatchError}`,message:`${Qs[s.type].singular} "${ye(s,s.project)}" with id "${s.id}" cannot catch an error because it is globally declared. Global variable declarations must crash the project if an error occurs.`,severity:Ee.Error,code:Pe.GlobalVariableDeclarationCannotCatchError,entity:s});u.push(i.error)}if(s.errorCalls.length){const i=Kt({id:`${s.id}--${Pe.GlobalVariableDeclarationCannotCallOnError}`,message:`${Qs[s.type].singular} "${ye(s,s.project)}" with id "${s.id}" cannot call other entities from its error branch because it is globally declared. Global variable declarations must crash the project if an error occurs.`,severity:Ee.Error,code:Pe.GlobalVariableDeclarationCannotCallOnError,entity:s});u.push(i.error)}if(s.calledBy.length){const i=Kt({id:`${s.id}--${Pe.GlobalVariableDeclarationCannotBeCalled}`,message:`${Qs[s.type].singular} "${ye(s,s.project)}" with id "${s.id}" cannot be called because it is globally declared. Global variable declarations must be self initialized when the project is loaded, and not be called for initialization.`,severity:Ee.Error,code:Pe.GlobalVariableDeclarationCannotBeCalled,entity:s});u.push(i.error)}return[]}const RCi=Object.freeze(Object.defineProperty({__proto__:null,validate:_ke,validateAsync:Oke,validateGlobalVariableDeclaration:OL,validateVariableDeclarationName:CL},Symbol.toStringTag,{value:"Module"}));async function Pke(s,u={}){const i=X.YieldTracker.from(u),r=ts(s),a=is(s),c=[...r,...a,...ta(s),...rs(s),...Wd(s),...Vke(s)],e=iA(s);c.push(...e);const f=vi(s.errors,c);await i.tick();for(const h of s.inputs)await h.validateAsync({tracker:i});for(const h of s.outputs)await h.validateAsync({tracker:i});for(const h of s.internalCalls)await h.validateAsync({tracker:i});return f}function Nke(s){s.inputs.forEach(c=>c.validate()),s.outputs.forEach(c=>c.validate()),s.internalCalls.forEach(c=>c.validate());const u=ts(s),i=is(s),r=[...u,...i,...ta(s),...rs(s)],a=iA(s);return r.push(...a),vi(s.errors,r)}function Vke(s){const u=[],i=s.declaration.constant;if(i&&s.readsValue){const r=Kt({id:`${s.id}--${ge.ValueReadingOverridesConstantVariable}`,message:`The '${s.type}' entity "${ye(s,s.project)}" with id "${s.id}" is a constant variable whose value cannot be overriden, but reads a value.`,severity:Ee.Error,code:ge.ValueReadingOverridesConstantVariable,entity:s});u.push(r.error)}if(i&&s.defaultValue){const r=Kt({id:`${s.id}--${ge.DefaultValueOverridesConstantVariable}`,message:`The '${s.type}' entity "${ye(s,s.project)}" with id "${s.id}" is a constant variable whose value cannot be overridden, but has a 'defaultValue'.`,severity:Ee.Error,code:ge.DefaultValueOverridesConstantVariable,entity:s});u.push(r.error)}return u}function Wd(s){var h;const u=[],i=s.declaration;if((i==null?void 0:i.id)===((h=s.parent)==null?void 0:h.id)||!s.calledBy.length&&!s.successCalls.length&&!s.errorCalls.length&&s.usedInternalCalls.length)return u;const r=Nt(s),a=Nt(i);!!r.find(m=>m.id===i.id)&&u.push(Kt({id:`${s.id}--${ge.CalledBeforeDeclaration}`,code:ge.CalledBeforeDeclaration,severity:Ee.Error,message:`Entity of type "${s.type}" with id "${s.id}" is called before its 'variable-declaration' '${i.name}' with id "${i.id}".
73
73
  The 'variable-declaration' must be called before any internal call that references it can be called.`,entity:s}).error);const e=ci(i,s.project),f=ci(s,s.project);if((e==null?void 0:e.type)!==d.Project&&e&&f){const m=!!a.find(v=>v.id===s.id);if((e==null?void 0:e.id)===(f==null?void 0:f.id))m||u.push(Kt({id:`${s.id}--${ge.CalledInParallelBranchToDeclaration}`,code:ge.CalledInParallelBranchToDeclaration,severity:Ee.Error,message:`Entity of type "${s.type}" with id "${s.id}" is called in a parallel branch to its 'variable-declaration' '${i.name}' with id "${i.id}".
74
74
  The 'variable-declaration' must be called in a different branch that executes before any internal call that references it can be called.`,entity:s}).error);else if(Os(f,e,s.project))u.push(Kt({id:`${s.id}--${ge.HigherScopeThanDeclaration}`,code:ge.HigherScopeThanDeclaration,severity:Ee.Error,message:`Entity of type "${s.type}" with id "${s.id}" is called in a higher scope than its 'variable-declaration' '${i.name}' with id "${i.id}".
75
75
  The 'variable-declaration' must be called in the same scope or in a higher scope than any internal call that references it.`,entity:s}).error);else if(Os(e,f,s.project)){let v=f;for(;v.id!==e.id&&v.id!==s.project.id;){const A=ci(v,s.project);if(A.id===e.id)break;v=A}const b=F0(v);if(b){const w=!!Nt(b).find(O=>O.id===i.id),R=!!a.find(O=>O.id===b.id);w?u.push(Kt({id:`${s.id}--${ge.CalledBeforeDeclaration}`,code:ge.CalledBeforeDeclaration,severity:Ee.Error,message:`Entity of type "${s.type}" with id "${s.id}" is called before its 'variable-declaration' '${i.name}' with id "${i.id}".
package/dist/index.d.ts CHANGED
@@ -24,6 +24,7 @@ import { IHttpEndpointInfrastructureResource } from '@elyx-code/definitions';
24
24
  import { IHTTPRouteDetails } from '@elyx-code/definitions';
25
25
  import { IInfrastructureResource } from '@elyx-code/definitions';
26
26
  import { ILiveMessageDTO } from '@elyx-code/definitions';
27
+ import { ILog } from '@elyx-code/definitions';
27
28
  import { InfrastructureResource as InfrastructureResource_2 } from '@elyx-code/definitions';
28
29
  import { InfrastructureResourceDetails } from '@elyx-code/definitions';
29
30
  import { InfrastructureResourceType } from '@elyx-code/definitions';
@@ -12479,6 +12480,7 @@ export declare enum BaseValueDescriptorIds {
12479
12480
  get updatedAt(): string;
12480
12481
  get status(): PublicationStatus;
12481
12482
  get steps(): IDeploymentStepDefinition<IInfrastructureResource>[];
12483
+ get cleanupSteps(): IDeploymentStepDefinition<IInfrastructureResource>[];
12482
12484
  get editor(): IEditor;
12483
12485
  get explicitResources(): Map<string, IRelationalDatabaseInfrastructureResource | IHttpApiInfrastructureResource | IServerlessFunctionInfrastructureResource | IHttpEndpointInfrastructureResource | IContainerComputeInfrastructureResource>;
12484
12486
  get implicitGlobalResources(): Map<InfrastructureResourceType.CompiledLocalCodebase | InfrastructureResourceType.CloudHostedCodebase | InfrastructureResourceType.AWSTenantAccount, ICloudHostedCodebaseInfrastructureResource | ICompiledLocalCodebaseInfrastructureResource | IAWSTenantAccountInfrastructureResource | null>;
@@ -20594,6 +20596,7 @@ export declare enum BaseValueDescriptorIds {
20594
20596
  implicitGlobalResources: Map<InfrastructureResourceType.CompiledLocalCodebase | InfrastructureResourceType.CloudHostedCodebase | InfrastructureResourceType.AWSTenantAccount, ICloudHostedCodebaseInfrastructureResource | ICompiledLocalCodebaseInfrastructureResource | IAWSTenantAccountInfrastructureResource | null>;
20595
20597
  finalGlobalEvent: ProjectPublicationEventName | null;
20596
20598
  finalStatus: PublicationStatus.Success | PublicationStatus.Failed | null;
20599
+ cleanupSteps: IDeploymentStepDefinition<IInfrastructureResource>[];
20597
20600
  }
20598
20601
 
20599
20602
  export declare interface IPublicationRunContext extends ExtensionContextBase<ExtensionContextType.PublicationRun>, Omit<IPublicationRun, 'events' | 'initRegistry' | 'extensionsRegistry' | 'contextType'> {
@@ -28298,6 +28301,7 @@ export declare enum BaseValueDescriptorIds {
28298
28301
  updatedAt: string;
28299
28302
  status: PublicationStatus;
28300
28303
  steps: PublicationStep[];
28304
+ cleanupSteps: PublicationStep[];
28301
28305
  editor: IEditor;
28302
28306
  explicitResources: Map<string, ExplicitInfrastructureResource>;
28303
28307
  implicitGlobalResources: Map<InfrastructureResourceType.CompiledLocalCodebase | InfrastructureResourceType.CloudHostedCodebase | InfrastructureResourceType.AWSTenantAccount, ImplicitGlobalInfrastructureResource | null>;
@@ -28340,7 +28344,10 @@ export declare enum BaseValueDescriptorIds {
28340
28344
  status: PublicationStepStatus;
28341
28345
  publicationRun: PublicationRun;
28342
28346
  resource: ExplicitInfrastructureResource | ImplicitGlobalInfrastructureResource;
28343
- constructor(stepType: PublishingSequenceStep, id: string, resourceType: InfrastructureResourceType, initialStatus: PublicationStepStatus, dependency: string[], index: number, lastEventTimestamp: string, publicationRun: PublicationRun, resource: ExplicitInfrastructureResource | ImplicitGlobalInfrastructureResource);
28347
+ cleanup: boolean;
28348
+ cleanupFor: string | null;
28349
+ logs: ILog[];
28350
+ constructor(stepType: PublishingSequenceStep, id: string, resourceType: InfrastructureResourceType, initialStatus: PublicationStepStatus, dependency: string[], index: number, lastEventTimestamp: string, publicationRun: PublicationRun, resource: ExplicitInfrastructureResource | ImplicitGlobalInfrastructureResource, cleanup?: boolean, cleanupFor?: string | null);
28344
28351
  toJSON(): IDeploymentStepDefinition;
28345
28352
  update(step: IDeploymentStepDefinition): Promise<void>;
28346
28353
  }
package/dist/index.js CHANGED
@@ -130865,6 +130865,9 @@ class JM extends tN {
130865
130865
  get steps() {
130866
130866
  return this._publicationRun.steps;
130867
130867
  }
130868
+ get cleanupSteps() {
130869
+ return this._publicationRun.cleanupSteps;
130870
+ }
130868
130871
  get editor() {
130869
130872
  return this._publicationRun.editor;
130870
130873
  }
@@ -136953,7 +136956,7 @@ async function zSi(s, u, i = {}) {
136953
136956
  ]).filter((m) => m.x === 0 || m.y === 0);
136954
136957
  Un.autoGenerateLayout(s, u, h);
136955
136958
  }
136956
- var cv = /* @__PURE__ */ ((s) => (s.Amazon = "amazon", s.Google = "google", s.Microsoft = "microsoft", s))(cv || {}), Jr = /* @__PURE__ */ ((s) => (s.RelationalDatabase = "relational-database", s.CompiledLocalCodebase = "compiled-local-codebase", s.CloudHostedCodebase = "cloud-hosted-codebase", s.HttpApi = "http-api", s.HttpEndpoint = "http-endpoint", s.ServerlessFunction = "serverless-function", s.CronJob = "cron-job", s.AWSTenantAccount = "aws-tenant-account", s.ContainerCompute = "container-compute", s.SharedDrive = "shared-drive", s))(Jr || {}), pO = /* @__PURE__ */ ((s) => (s.Post = "post", s.Get = "get", s.Acknowledgement = "acknowledgment", s.Progress = "progress", s.Error = "error", s.Complete = "complete", s))(pO || {}), xf = /* @__PURE__ */ ((s) => (s.Queued = "queued", s.Running = "running", s.Success = "success", s.Failed = "failed", s.CleanedUp = "cleaned-up", s.Skipped = "skipped", s.AbortedByUser = "aborted-by-user", s.UnrecoverableFailure = "unrecoverable-failure", s.Reverted = "reverted", s.UnpublishingStarted = "unpublishing-started", s.Unpublished = "unpublished", s))(xf || {}), cO = /* @__PURE__ */ ((s) => (s.Queued = "queued", s.Running = "running", s.Success = "success", s.Failed = "failed", s.CleanedUp = "cleaned-up", s.UnrecoverableFailure = "unrecoverable-failure", s.Reverted = "reverted", s.UnpublishingStarted = "unpublishing-started", s.Unpublished = "unpublished", s))(cO || {}), Ii = /* @__PURE__ */ ((s) => (s.ProjectNotFound = "project-not-found", s.ProjectPublishRequestAcknowledged = "project-publish-request-acknowledged", s.PublicationStepFailedReasonUnknown = "publication-step-failed-reason-unknown", s.DeploymentCompleted = "deployment-completed", s.DeploymentStarted = "deployment-started", s.DeploymentFailed = "deployment-failed", s.AllInfrastructureSuccessfullyProvisioned = "all-infrastucture-successfully-provisioned", s.RequestPayloadValidationFailed = "request-payload-validation-failed", s.ProjectStateValidationFailedMissingName = "project-state-validation-failed-missing-name", s.ProjectStateValidationFailedMissingAnyFunctionality = "project-state-validation-failed-missing-any-functionality", s.ProjectAlreadyBeingPublished = "project-already-being-published", s.BillingSubscriptionUpdateFailed = "billing-subscription-update-failed", s.RelationalDatabaseDeploymentStarted = "relational-database-deployment-started", s.RelationalDatabaseDeploymentCompleted = "relational-database-deployment-completed", s.RelationalDatabaseDeploymentFailed = "relational-database-deployment-failed", s.CreatingNewRelationalDatabase = "creating-new-relational-database", s.WaitingForPreviousRelationalDatabaseDeployment = "waiting-for-previous-relationa-database-deployment", s.RelationalDatabaseAlreadyExists = "relational-database-already-exists", s.RelationalDatabaseDeletionStarted = "relational-database-deletion-started", s.RelationalDatabaseDeletionCompleted = "relational-database-deletion-completed", s.RelationalDatabaseDeletionFailed = "relational-database-deletion-failed", s.WaitingForPreviousRelationalDatabaseDeletion = "waiting-for-previous-relationa-database-deletion", s.HttpApiDeploymentStarted = "http-api-deployment-started", s.HttpApiDeploymentCompleted = "http-api-deployment-completed", s.HttpApiDeploymentFailed = "http-api-deployment-failed", s.CreatingNewHttpApi = "creating-new-http-api", s.HttpApiAlreadyExists = "http-api-already-exists", s.HttpApiDeletionStarted = "http-api-deletion-started", s.HttpApiDeletionCompleted = "http-api-deletion-completed", s.HttpApiDeletionFailed = "http-api-deletion-failed", s.WaitingForPreviousHttpApiDeletion = "waiting-for-previous-http-api-deletion", s.BusinessLogicCodebaseDeploymentStarted = "business-logic-codebase-deployment-started", s.BusinessLogicCodebaseDeploymentCompleted = "business-logic-codebase-deployment-completed", s.BusinessLogicCodebaseDeploymentFailed = "business-logic-codebase-deployment-failed", s.BundlingCodebaseForDownload = "bundling-codebase-for-download", s.UploadingCodebaseToCloudStorage = "uploading-codebase-to-cloud-storage", s.UploadingCodebaseToCloudStorageCompleted = "uploading-codebase-to-cloud-storage-completed", s.UploadingCodebaseToCloudStorageFailed = "uploading-codebase-to-cloud-storage-failed", s.InfrastructureValuesCodebaseInterpolationStarted = "infrastructure-values-codebase-interpolation-started", s.InfrastructureValuesCodebaseInterpolationCompleted = "infrastructure-values-codebase-interpolation-completed", s.InfrastructureValuesCodebaseInterpolationFailed = "infrastructure-values-codebase-interpolation-failed", s.CodeCompilationStarted = "code-compilation-started", s.CodeCompilationCompleted = "code-compilation-completed", s.CodeCompilationFailed = "code-compilation-failed", s.BundleCodebaseStarted = "bundle-codebase-started", s.BundleCodebaseCompleted = "bundle-codebase-completed", s.BundleCodebaseFailed = "bundle-codebase-failed", s.InstallingCodebaseDependenciesStarted = "installing-codebase-dependencies-started", s.InstallingCodebaseDependenciesCompleted = "installing-codebase-dependencies-completed", s.InstallingCodebaseDependenciesFailed = "installing-codebase-dependencies-failed", s.MigrateRelationalDatabaseStarted = "migrate-relational-database-started", s.MigrateRelationalDatabaseCompleted = "migrate-relational-database-completed", s.MigrateRelationalDatabaseFailed = "migrate-relational-database-failed", s.ExecutePublicationCompletedEventStarted = "execute-publication-completed-event-started", s.ExecutePublicationCompletedEventCompleted = "execute-publication-completed-event-completed", s.ExecutePublicationCompletedEventFailed = "execute-publication-completed-event-failed", s.ExecutePublicationCompletedEventTimedOut = "execute-publication-completed-event-timed-out", s.AWSTenantAccountProvisioningStarted = "aws-tenant-account-provisioning-started", s.AWSTenantAccountProvisioningCompleted = "aws-tenant-account-provisioning-completed", s.AWSTenantAccountProvisioningFailed = "aws-tenant-account-provisioning-failed", s.ContainerComputeDeploymentStarted = "container-compute-deployment-started", s.ContainerComputeDeploymentCompleted = "container-compute-deployment-completed", s.ContainerComputeDeploymentFailed = "container-compute-deployment-failed", s.ContainerComputeDeletionStarted = "container-compute-deletion-started", s.ContainerComputeDeletionCompleted = "container-compute-deletion-completed", s.ContainerComputeDeletionFailed = "container-compute-deletion-failed", s.SharedDriveDeploymentStarted = "shared-drive-deployment-started", s.SharedDriveDeploymentCompleted = "shared-drive-deployment-completed", s.SharedDriveDeploymentFailed = "shared-drive-deployment-failed", s.SharedDriveAlreadyExists = "shared-drive-already-exists", s.SharedDriveDeletionStarted = "shared-drive-deletion-started", s.SharedDriveDeletionCompleted = "shared-drive-deletion-completed", s.SharedDriveDeletionFailed = "shared-drive-deletion-failed", s))(Ii || {}), Go = /* @__PURE__ */ ((s) => (s.CodeCompilation = "code-compilation", s.RelationalDatabaseDeployment = "relational-database-deployment", s.RelationalDatabaseDeletion = "relational-database-deletion", s.HttpApiDeployment = "http-api-deployment", s.HttpApiDeletion = "http-api-deletion", s.InfrastructureValuesCodebaseInterpolation = "infrastructure-values-codebase-interpolation", s.BundleCodebase = "bundle-codebase", s.MigrateRelationalDatabase = "migrate-relational-database", s.BusinessLogicCodebaseDeployment = "business-logic-codebase-deployment", s.ExecutePublicationCompletedEvent = "execute-publication-completed-event", s.CodebaseCleanup = "codebase-cleanup", s.AWSTenantAccountProvisioning = "aws-tenant-account-provisioning", s.ContainerComputeDeployment = "container-compute-deployment", s.ContainerComputeDeletion = "container-compute-deletion", s.SharedDriveDeployment = "shared-drive-deployment", s.SharedDriveDeletion = "shared-drive-deletion", s))(Go || {});
136959
+ var cv = /* @__PURE__ */ ((s) => (s.Amazon = "amazon", s.Google = "google", s.Microsoft = "microsoft", s))(cv || {}), Jr = /* @__PURE__ */ ((s) => (s.RelationalDatabase = "relational-database", s.CompiledLocalCodebase = "compiled-local-codebase", s.CloudHostedCodebase = "cloud-hosted-codebase", s.HttpApi = "http-api", s.HttpEndpoint = "http-endpoint", s.ServerlessFunction = "serverless-function", s.CronJob = "cron-job", s.AWSTenantAccount = "aws-tenant-account", s.ContainerCompute = "container-compute", s.SharedDrive = "shared-drive", s))(Jr || {}), pO = /* @__PURE__ */ ((s) => (s.Post = "post", s.Get = "get", s.Acknowledgement = "acknowledgment", s.Progress = "progress", s.Error = "error", s.Complete = "complete", s))(pO || {}), xf = /* @__PURE__ */ ((s) => (s.Queued = "queued", s.Running = "running", s.Success = "success", s.Failed = "failed", s.CleanupInProgress = "cleanup-in-progress", s.CleanedUp = "cleaned-up", s.Skipped = "skipped", s.AbortedByUser = "aborted-by-user", s.UnrecoverableFailure = "unrecoverable-failure", s.Reverted = "reverted", s.UnpublishingStarted = "unpublishing-started", s.Unpublished = "unpublished", s))(xf || {}), cO = /* @__PURE__ */ ((s) => (s.Queued = "queued", s.Running = "running", s.Success = "success", s.Failed = "failed", s.CleanupInProgress = "cleanup-in-progress", s.CleanedUp = "cleaned-up", s.UnrecoverableFailure = "unrecoverable-failure", s.Reverted = "reverted", s.UnpublishingStarted = "unpublishing-started", s.Unpublished = "unpublished", s))(cO || {}), Ii = /* @__PURE__ */ ((s) => (s.ProjectNotFound = "project-not-found", s.ProjectPublishRequestAcknowledged = "project-publish-request-acknowledged", s.PublicationStepFailedReasonUnknown = "publication-step-failed-reason-unknown", s.DeploymentCompleted = "deployment-completed", s.DeploymentStarted = "deployment-started", s.DeploymentFailed = "deployment-failed", s.AllInfrastructureSuccessfullyProvisioned = "all-infrastucture-successfully-provisioned", s.RequestPayloadValidationFailed = "request-payload-validation-failed", s.ProjectStateValidationFailedMissingName = "project-state-validation-failed-missing-name", s.ProjectStateValidationFailedMissingAnyFunctionality = "project-state-validation-failed-missing-any-functionality", s.ProjectAlreadyBeingPublished = "project-already-being-published", s.BillingSubscriptionUpdateFailed = "billing-subscription-update-failed", s.RelationalDatabaseDeploymentStarted = "relational-database-deployment-started", s.RelationalDatabaseDeploymentCompleted = "relational-database-deployment-completed", s.RelationalDatabaseDeploymentFailed = "relational-database-deployment-failed", s.CreatingNewRelationalDatabase = "creating-new-relational-database", s.WaitingForPreviousRelationalDatabaseDeployment = "waiting-for-previous-relationa-database-deployment", s.RelationalDatabaseAlreadyExists = "relational-database-already-exists", s.RelationalDatabaseDeletionStarted = "relational-database-deletion-started", s.RelationalDatabaseDeletionCompleted = "relational-database-deletion-completed", s.RelationalDatabaseDeletionFailed = "relational-database-deletion-failed", s.WaitingForPreviousRelationalDatabaseDeletion = "waiting-for-previous-relationa-database-deletion", s.HttpApiDeploymentStarted = "http-api-deployment-started", s.HttpApiDeploymentCompleted = "http-api-deployment-completed", s.HttpApiDeploymentFailed = "http-api-deployment-failed", s.CreatingNewHttpApi = "creating-new-http-api", s.HttpApiAlreadyExists = "http-api-already-exists", s.HttpApiDeletionStarted = "http-api-deletion-started", s.HttpApiDeletionCompleted = "http-api-deletion-completed", s.HttpApiDeletionFailed = "http-api-deletion-failed", s.WaitingForPreviousHttpApiDeletion = "waiting-for-previous-http-api-deletion", s.BusinessLogicCodebaseDeploymentStarted = "business-logic-codebase-deployment-started", s.BusinessLogicCodebaseDeploymentCompleted = "business-logic-codebase-deployment-completed", s.BusinessLogicCodebaseDeploymentFailed = "business-logic-codebase-deployment-failed", s.BundlingCodebaseForDownload = "bundling-codebase-for-download", s.UploadingCodebaseToCloudStorage = "uploading-codebase-to-cloud-storage", s.UploadingCodebaseToCloudStorageCompleted = "uploading-codebase-to-cloud-storage-completed", s.UploadingCodebaseToCloudStorageFailed = "uploading-codebase-to-cloud-storage-failed", s.InfrastructureValuesCodebaseInterpolationStarted = "infrastructure-values-codebase-interpolation-started", s.InfrastructureValuesCodebaseInterpolationCompleted = "infrastructure-values-codebase-interpolation-completed", s.InfrastructureValuesCodebaseInterpolationFailed = "infrastructure-values-codebase-interpolation-failed", s.CodeCompilationStarted = "code-compilation-started", s.CodeCompilationCompleted = "code-compilation-completed", s.CodeCompilationFailed = "code-compilation-failed", s.BundleCodebaseStarted = "bundle-codebase-started", s.BundleCodebaseCompleted = "bundle-codebase-completed", s.BundleCodebaseFailed = "bundle-codebase-failed", s.InstallingCodebaseDependenciesStarted = "installing-codebase-dependencies-started", s.InstallingCodebaseDependenciesCompleted = "installing-codebase-dependencies-completed", s.InstallingCodebaseDependenciesFailed = "installing-codebase-dependencies-failed", s.MigrateRelationalDatabaseStarted = "migrate-relational-database-started", s.MigrateRelationalDatabaseCompleted = "migrate-relational-database-completed", s.MigrateRelationalDatabaseFailed = "migrate-relational-database-failed", s.RevertRelationalDatabaseMigrationStarted = "revert-relational-database-migration-started", s.RevertRelationalDatabaseMigrationCompleted = "revert-relational-database-migration-completed", s.RevertRelationalDatabaseMigrationFailed = "revert-relational-database-migration-failed", s.ExecutePublicationCompletedEventStarted = "execute-publication-completed-event-started", s.ExecutePublicationCompletedEventCompleted = "execute-publication-completed-event-completed", s.ExecutePublicationCompletedEventFailed = "execute-publication-completed-event-failed", s.ExecutePublicationCompletedEventTimedOut = "execute-publication-completed-event-timed-out", s.AWSTenantAccountProvisioningStarted = "aws-tenant-account-provisioning-started", s.AWSTenantAccountProvisioningCompleted = "aws-tenant-account-provisioning-completed", s.AWSTenantAccountProvisioningFailed = "aws-tenant-account-provisioning-failed", s.ContainerComputeDeploymentStarted = "container-compute-deployment-started", s.ContainerComputeDeploymentCompleted = "container-compute-deployment-completed", s.ContainerComputeDeploymentFailed = "container-compute-deployment-failed", s.ContainerComputeDeletionStarted = "container-compute-deletion-started", s.ContainerComputeDeletionCompleted = "container-compute-deletion-completed", s.ContainerComputeDeletionFailed = "container-compute-deletion-failed", s.SharedDriveDeploymentStarted = "shared-drive-deployment-started", s.SharedDriveDeploymentCompleted = "shared-drive-deployment-completed", s.SharedDriveDeploymentFailed = "shared-drive-deployment-failed", s.SharedDriveAlreadyExists = "shared-drive-already-exists", s.SharedDriveDeletionStarted = "shared-drive-deletion-started", s.SharedDriveDeletionCompleted = "shared-drive-deletion-completed", s.SharedDriveDeletionFailed = "shared-drive-deletion-failed", s))(Ii || {}), Go = /* @__PURE__ */ ((s) => (s.CodeCompilation = "code-compilation", s.RelationalDatabaseDeployment = "relational-database-deployment", s.RelationalDatabaseDeletion = "relational-database-deletion", s.HttpApiDeployment = "http-api-deployment", s.HttpApiDeletion = "http-api-deletion", s.InfrastructureValuesCodebaseInterpolation = "infrastructure-values-codebase-interpolation", s.BundleCodebase = "bundle-codebase", s.MigrateRelationalDatabase = "migrate-relational-database", s.RevertRelationalDatabaseMigration = "revert-relational-database-migration", s.BusinessLogicCodebaseDeployment = "business-logic-codebase-deployment", s.ExecutePublicationCompletedEvent = "execute-publication-completed-event", s.CodebaseCleanup = "codebase-cleanup", s.AWSTenantAccountProvisioning = "aws-tenant-account-provisioning", s.ContainerComputeDeployment = "container-compute-deployment", s.ContainerComputeDeletion = "container-compute-deletion", s.SharedDriveDeployment = "shared-drive-deployment", s.SharedDriveDeletion = "shared-drive-deletion", s))(Go || {});
136957
136960
  Jr.CloudHostedCodebase, Jr.HttpApi, Jr.RelationalDatabase, Jr.CloudHostedCodebase, Jr.CloudHostedCodebase, Jr.RelationalDatabase, Jr.CloudHostedCodebase, Jr.CloudHostedCodebase;
136958
136961
  function VIi(s) {
136959
136962
  return `project-${s}-http-api`;
@@ -136962,9 +136965,7 @@ function mN(s) {
136962
136965
  return `entity-${s}-database`;
136963
136966
  }
136964
136967
  class NIi {
136965
- // | ExplicitInfrastructureResource
136966
- // | ImplicitGlobalInfrastructureResource;
136967
- constructor(u, i, r, a, c, e, f, h, m) {
136968
+ constructor(u, i, r, a, c, e, f, h, m, v = !1, E) {
136968
136969
  w(this, "stepType");
136969
136970
  w(this, "id");
136970
136971
  w(this, "resourceType");
@@ -136977,7 +136978,12 @@ class NIi {
136977
136978
  // Resolved infrastructure resource details
136978
136979
  // Only available after the step is run
136979
136980
  w(this, "resource");
136980
- this.stepType = u, this.id = i, this.resourceType = r, this.status = a, this.dependency = c, this.index = e, this.lastEventTimestamp = f, this.publicationRun = h, this.resource = m;
136981
+ // | ExplicitInfrastructureResource
136982
+ // | ImplicitGlobalInfrastructureResource;
136983
+ w(this, "cleanup", !1);
136984
+ w(this, "cleanupFor", null);
136985
+ w(this, "logs", []);
136986
+ this.stepType = u, this.id = i, this.resourceType = r, this.status = a, this.dependency = c, this.index = e, this.lastEventTimestamp = f, this.publicationRun = h, this.resource = m, this.cleanup = v, this.cleanupFor = E || null;
136981
136987
  }
136982
136988
  toJSON() {
136983
136989
  return {
@@ -136995,7 +137001,10 @@ class NIi {
136995
137001
  details: this.resource.details,
136996
137002
  status: this.resource.status,
136997
137003
  name: this.resource.name
136998
- }
137004
+ },
137005
+ cleanup: this.cleanup,
137006
+ cleanupFor: this.cleanupFor,
137007
+ logs: this.logs
136999
137008
  };
137000
137009
  }
137001
137010
  async update(u) {
@@ -137086,7 +137095,11 @@ class Ny {
137086
137095
  }
137087
137096
  class JSi extends Ny {
137088
137097
  constructor(i, r, a) {
137089
- super(i, Jr.HttpEndpoint, a);
137098
+ super(
137099
+ i,
137100
+ Jr.HttpEndpoint,
137101
+ a
137102
+ );
137090
137103
  w(this, "resourceType", Jr.HttpEndpoint);
137091
137104
  w(this, "owners", /* @__PURE__ */ new Map());
137092
137105
  // Only available after the step is run
@@ -137105,7 +137118,11 @@ class JSi extends Ny {
137105
137118
  }
137106
137119
  class YSi extends Ny {
137107
137120
  constructor(i, r, a) {
137108
- super(i, Jr.ServerlessFunction, a);
137121
+ super(
137122
+ i,
137123
+ Jr.ServerlessFunction,
137124
+ a
137125
+ );
137109
137126
  w(this, "resourceType", Jr.ServerlessFunction);
137110
137127
  w(this, "owners", /* @__PURE__ */ new Map());
137111
137128
  // Only available after the step is run
@@ -137142,7 +137159,11 @@ class xIi extends Ny {
137142
137159
  }
137143
137160
  class $Ii extends Ny {
137144
137161
  constructor(i, r, a) {
137145
- super(i, Jr.RelationalDatabase, a);
137162
+ super(
137163
+ i,
137164
+ Jr.RelationalDatabase,
137165
+ a
137166
+ );
137146
137167
  w(this, "resourceType", Jr.RelationalDatabase);
137147
137168
  w(this, "owners", /* @__PURE__ */ new Map());
137148
137169
  // Only available after the step is run
@@ -137161,7 +137182,11 @@ class $Ii extends Ny {
137161
137182
  }
137162
137183
  class LIi extends Ny {
137163
137184
  constructor(i, r) {
137164
- super(i, Jr.CloudHostedCodebase, r);
137185
+ super(
137186
+ i,
137187
+ Jr.CloudHostedCodebase,
137188
+ r
137189
+ );
137165
137190
  w(this, "resourceType", Jr.CloudHostedCodebase);
137166
137191
  // Only available after the step is run
137167
137192
  w(this, "details", null);
@@ -137174,7 +137199,11 @@ class LIi extends Ny {
137174
137199
  }
137175
137200
  class GIi extends Ny {
137176
137201
  constructor(i, r) {
137177
- super(i, Jr.CompiledLocalCodebase, r);
137202
+ super(
137203
+ i,
137204
+ Jr.CompiledLocalCodebase,
137205
+ r
137206
+ );
137178
137207
  w(this, "resourceType", Jr.CompiledLocalCodebase);
137179
137208
  // Only available after the step is run
137180
137209
  w(this, "details", null);
@@ -137214,6 +137243,7 @@ class XSi {
137214
137243
  w(this, "updatedAt");
137215
137244
  w(this, "status");
137216
137245
  w(this, "steps", []);
137246
+ w(this, "cleanupSteps", []);
137217
137247
  w(this, "editor");
137218
137248
  w(this, "explicitResources", /* @__PURE__ */ new Map());
137219
137249
  w(this, "implicitGlobalResources", /* @__PURE__ */ new Map());
@@ -137255,7 +137285,9 @@ class XSi {
137255
137285
  }
137256
137286
  getInfraTypes(u) {
137257
137287
  return this.steps.filter(
137258
- (i) => u.includes(i.resourceType)
137288
+ (i) => u.includes(
137289
+ i.resourceType
137290
+ )
137259
137291
  );
137260
137292
  }
137261
137293
  getStepsTypes(u) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elyx-code/project-logic-tree",
3
- "version": "0.0.7065",
3
+ "version": "0.0.7066",
4
4
  "author": "Sergio Herrero",
5
5
  "license": "UNLICENSED",
6
6
  "description": "An installable module which contains the type definitions and ephemeral state management for a projects' logic tree data structure",
@@ -38,7 +38,7 @@
38
38
  "log:project": "tsx --tsconfig tsconfig.scripts.json scripts/describe-project.ts"
39
39
  },
40
40
  "dependencies": {
41
- "@elyx-code/definitions": "^0.0.80003",
41
+ "@elyx-code/definitions": "^0.0.80006",
42
42
  "axios": "^1.9.0",
43
43
  "dayjs": "^1.11.13",
44
44
  "sql-parser-cst": "^0.33.1",