@elyx-code/project-logic-tree 0.0.7157 → 0.0.7158
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.js +53 -46
- package/package.json +1 -1
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 kpt extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleDriveUploadFile,version:"2.0.0",description:"Upload a file to Google Drive (media / import+copy) with auto content detection and simplified inputs.",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleDriveUploadFile);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m,T,g,E,I,A,D,V,N,x,G,K,q,H,W,ee,re,Y,Z,J,ne,z,ie,pe,me,ve,Ce,Oe;try{const Ve=((c=(s=n.find(Ji=>{var hi,mi;return((mi=(hi=Ji.valueOwner)==null?void 0:hi.declaration)==null?void 0:mi.id)===L.operation[le.GoogleDriveUploadFile].inputs.connection.id}))==null?void 0:s.value)==null?void 0:c.valueAsType)??((f=(e=n.find(Ji=>{var hi,mi;return((mi=(hi=Ji.valueOwner)==null?void 0:hi.declaration)==null?void 0:mi.id)===L.operation[le.GoogleDriveUploadFile].inputs.connection.id}))==null?void 0:e.value)==null?void 0:f.value);if(!(Ve instanceof Ga))return jp(i,"Invalid or missing connection entity");const Ie=((m=(y=n.find(Ji=>{var hi,mi;return((mi=(hi=Ji.valueOwner)==null?void 0:hi.declaration)==null?void 0:mi.id)===L.operation[le.GoogleDriveUploadFile].inputs.content.id}))==null?void 0:y.value)==null?void 0:m.valueAsType)??((g=(T=n.find(Ji=>{var hi,mi;return((mi=(hi=Ji.valueOwner)==null?void 0:hi.declaration)==null?void 0:mi.id)===L.operation[le.GoogleDriveUploadFile].inputs.content.id}))==null?void 0:T.value)==null?void 0:g.value),$e=(V=((I=(E=n.find(Ji=>{var hi,mi;return((mi=(hi=Ji.valueOwner)==null?void 0:hi.declaration)==null?void 0:mi.id)===L.operation[le.GoogleDriveUploadFile].inputs.name.id}))==null?void 0:E.value)==null?void 0:I.valueAsType)??((D=(A=n.find(Ji=>{var hi,mi;return((mi=(hi=Ji.valueOwner)==null?void 0:hi.declaration)==null?void 0:mi.id)===L.operation[le.GoogleDriveUploadFile].inputs.name.id}))==null?void 0:A.value)==null?void 0:D.value))==null?void 0:V.trim(),Ze=(((x=(N=n.find(Ji=>{var hi,mi;return((mi=(hi=Ji.valueOwner)==null?void 0:hi.declaration)==null?void 0:mi.id)===L.operation[le.GoogleDriveUploadFile].inputs.mimeType.id}))==null?void 0:N.value)==null?void 0:x.valueAsType)??((K=(G=n.find(Ji=>{var hi,mi;return((mi=(hi=Ji.valueOwner)==null?void 0:hi.declaration)==null?void 0:mi.id)===L.operation[le.GoogleDriveUploadFile].inputs.mimeType.id}))==null?void 0:G.value)==null?void 0:K.value))||"application/octet-stream",qe=(((H=(q=n.find(Ji=>{var hi,mi;return((mi=(hi=Ji.valueOwner)==null?void 0:hi.declaration)==null?void 0:mi.id)===L.operation[le.GoogleDriveUploadFile].inputs.folderId.id}))==null?void 0:q.value)==null?void 0:H.valueAsType)??((ee=(W=n.find(Ji=>{var hi,mi;return((mi=(hi=Ji.valueOwner)==null?void 0:hi.declaration)==null?void 0:mi.id)===L.operation[le.GoogleDriveUploadFile].inputs.folderId.id}))==null?void 0:W.value)==null?void 0:ee.value))||void 0,rt=(((Y=(re=n.find(Ji=>{var hi,mi;return((mi=(hi=Ji.valueOwner)==null?void 0:hi.declaration)==null?void 0:mi.id)===L.operation[le.GoogleDriveUploadFile].inputs.description.id}))==null?void 0:re.value)==null?void 0:Y.valueAsType)??((J=(Z=n.find(Ji=>{var hi,mi;return((mi=(hi=Ji.valueOwner)==null?void 0:hi.declaration)==null?void 0:mi.id)===L.operation[le.GoogleDriveUploadFile].inputs.description.id}))==null?void 0:Z.value)==null?void 0:J.value))||void 0,lt=(((z=(ne=n.find(Ji=>{var hi,mi;return((mi=(hi=Ji.valueOwner)==null?void 0:hi.declaration)==null?void 0:mi.id)===L.operation[le.GoogleDriveUploadFile].inputs.importMimeType.id}))==null?void 0:ne.value)==null?void 0:z.valueAsType)??((pe=(ie=n.find(Ji=>{var hi,mi;return((mi=(hi=Ji.valueOwner)==null?void 0:hi.declaration)==null?void 0:mi.id)===L.operation[le.GoogleDriveUploadFile].inputs.importMimeType.id}))==null?void 0:ie.value)==null?void 0:pe.value))||"text/plain";if(!$e)return jp(i,"Missing required input: name");const it=this.extensionsRegistry.requestContexts(this,[X.Editor])[0],Ye=Mi(Ve),vt={Authorization:`Bearer ${await it.getAccessToken()}`},_t=`${((me=it.env)==null?void 0:me.API_BASE_URL)+"/editor-runtime"}/v2/external-integrations/proxy/${it.projectId}/${qt["google-drive"]}/${Ye}`,bt=async(Ji,hi,{params:mi,body:Ds,contentType:ls,providerHeaders:Cr,responseType:br}={})=>{const oi=`${_t}/${yrn(hi)}`,ei={...vt};return ls&&(ei["Content-Type"]=ls),(Cr||br)&&(ei[frn]=JSON.stringify({...Cr?{headers:Cr}:{},...br?{responseType:br}:{}})),Ht.request({method:Ji,url:oi,params:mi,data:Ds,responseType:br||"json",headers:ei})},ht=typeof Ze=="string"&&Ze.startsWith("application/vnd.google-apps.");if(ht&&(Ie==null||Ie==="")){const Ji={name:$e,mimeType:Ze};qe&&(Ji.parents=[qe]),typeof rt=="string"&&(Ji.description=rt);const hi=await bt("POST","/drive/v3/files",{params:{supportsAllDrives:"true",fields:hE},body:JSON.stringify(Ji),contentType:"application/json"});return hi.status!==200&&hi.status!==201?jp(i,`Drive create failed (status=${hi.status})`):dN({file:hi.data})}if(ht&&Ie!=null){let Ji=await mrn(Ie);const mi=((br,oi)=>oi||(br==="application/vnd.google-apps.spreadsheet"?"text/csv":br==="application/vnd.google-apps.document"||br==="application/vnd.google-apps.presentation"?"text/html":"text/plain"))(Ze,lt),Ds=mi.startsWith("text/")&&!/charset=/i.test(mi)?`${mi}; charset=UTF-8`:mi;mi.startsWith("text/csv")&&(Ji=Trn(Ji));const ls=new TextEncoder().encode(Ji);if(ls.byteLength>n3)return jp(i,`Text body exceeds simple upload limit (${ls.byteLength} bytes).`);let Cr;try{const br=await bt("POST","/upload/drive/v3/files",{params:{uploadType:"media",supportsAllDrives:"true",fields:hE},body:ls,contentType:Ds});if(br.status!==200&&br.status!==201)return jp(i,`Drive media upload failed (status=${br.status})`);if(Cr=(ve=br.data)==null?void 0:ve.id,!Cr)return jp(i,"Drive media upload did not return an id");const oi={name:$e,mimeType:Ze};qe&&(oi.parents=[qe]),typeof rt=="string"&&(oi.description=rt);const ei=await bt("POST",`/drive/v3/files/${encodeURIComponent(Cr)}/copy`,{params:{supportsAllDrives:"true",fields:hE},body:JSON.stringify(oi),contentType:"application/json"});return ei.status!==200&&ei.status!==201?jp(i,`Drive copy-convert failed (status=${ei.status})`):dN({file:ei.data})}finally{if(Cr)try{await bt("DELETE",`/drive/v3/files/${encodeURIComponent(Cr)}`,{params:{supportsAllDrives:"true"}})}catch{}}}if(Ie==null)return jp(i,"Missing content for non-native upload");const{bytes:Zt,inferredMime:pt,isBinary:It}=await hrn(Ie),Nt=Zt.byteLength;if(Nt>n3)return jp(i,`File too large for simple upload (${Nt} bytes).`);const Dr=await bt("POST","/upload/drive/v3/files",{params:{uploadType:"media",supportsAllDrives:"true",fields:hE},body:Zt,contentType:Ze||pt||(It?"application/octet-stream":"text/plain; charset=UTF-8")});if(Dr.status!==200&&Dr.status!==201)return jp(i,`Drive media upload failed (status=${Dr.status})`);let ks=Dr.data;const Rs=(Ce=Dr.data)==null?void 0:Ce.id;return Rs&&(qe||$e||rt)&&(ks=await vrn(bt,Rs,$e,rt,qe)),dN({file:ks})}catch(Ve){const Ie=((Oe=Ve.response)==null?void 0:Oe.data)||Ve.message||Ve;return oe.Logger.error("[Google Drive] Upload document failed:",Ie),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:Ie,result:null}}}})}}function dN(r){return{value:U.Success,error:null,result:r}}function jp(r,u){return oe.Logger.log("[Google Drive] Upload error:",u),{value:r.catchesError||r.errorCalls.length?U.CaughtError:U.UnhandledError,error:u,result:null}}async function vrn(r,u,i,n,s){const c={};i&&(c.name=i),typeof n=="string"&&(c.description=n);const e={supportsAllDrives:"true",fields:hE},f={...e};s&&(f.addParents=s,f.removeParents="root");let y=await r("PATCH",`/drive/v3/files/${encodeURIComponent(u)}`,{params:f,body:JSON.stringify(c),contentType:"application/json"});if(y.status>=400&&s&&(y=await r("PATCH",`/drive/v3/files/${encodeURIComponent(u)}`,{params:{...e,addParents:s},body:JSON.stringify(c),contentType:"application/json"})),y.status!==200)throw new Error(`Drive metadata update failed (status=${y.status})`);return y.data}const grn="id,name,mimeType,webViewLink",brn="X-Elyx-Proxy-Config";function Ern(r){return r.startsWith("/")?r.slice(1):r}const uN=(r,u)=>(oe.Logger.log("[Google Drive Clone Document] error:",u),{value:r.catchesError||r.errorCalls.length?U.CaughtError:U.UnhandledError,error:u,result:null});class Upt extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleDriveCloneDocument,version:"1.0.0",description:"Google Drive clone document operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleDriveCloneDocument);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m,T,g,E,I,A,D,V,N,x,G;try{const K=L.operation[le.GoogleDriveCloneDocument],q=((c=(s=n.find(Oe=>{var Ve,Ie;return((Ie=(Ve=Oe.valueOwner)==null?void 0:Ve.declaration)==null?void 0:Ie.id)===K.inputs.connection.id}))==null?void 0:s.value)==null?void 0:c.valueAsType)??((f=(e=n.find(Oe=>{var Ve,Ie;return((Ie=(Ve=Oe.valueOwner)==null?void 0:Ve.declaration)==null?void 0:Ie.id)===K.inputs.connection.id}))==null?void 0:e.value)==null?void 0:f.value);if(!(q instanceof Ga))return uN(i,"Invalid or missing connection entity");const H=(m=(y=n.find(Oe=>{var Ve,Ie;return((Ie=(Ve=Oe.valueOwner)==null?void 0:Ve.declaration)==null?void 0:Ie.id)===K.inputs.documentId.id}))==null?void 0:y.value)==null?void 0:m.value;if(!H)return uN(i,"Missing required input: documentId");const W=(g=(T=n.find(Oe=>{var Ve,Ie;return((Ie=(Ve=Oe.valueOwner)==null?void 0:Ve.declaration)==null?void 0:Ie.id)===K.inputs.newName.id}))==null?void 0:T.value)==null?void 0:g.value,ee=(I=(E=n.find(Oe=>{var Ve,Ie;return((Ie=(Ve=Oe.valueOwner)==null?void 0:Ve.declaration)==null?void 0:Ie.id)===K.inputs.parentFolderIds.id}))==null?void 0:E.value)==null?void 0:I.value,re=(D=(A=n.find(Oe=>{var Ve,Ie;return((Ie=(Ve=Oe.valueOwner)==null?void 0:Ve.declaration)==null?void 0:Ie.id)===K.inputs.description.id}))==null?void 0:A.value)==null?void 0:D.value,Y=(N=(V=n.find(Oe=>{var Ve,Ie;return((Ie=(Ve=Oe.valueOwner)==null?void 0:Ve.declaration)==null?void 0:Ie.id)===K.inputs.starred.id}))==null?void 0:V.value)==null?void 0:N.value,Z=this.extensionsRegistry.requestContexts(this,[X.Editor])[0],J=Mi(q),z={Authorization:`Bearer ${await Z.getAccessToken()}`},ie=`${((x=Z.env)==null?void 0:x.API_BASE_URL)+"/editor-runtime"}/v2/external-integrations/proxy/${Z.projectId}/${qt["google-drive"]}/${J}`,pe=async(Oe,Ve,{params:Ie,body:$e,contentType:Ze,providerHeaders:qe,responseType:rt}={})=>{const lt=`${ie}/${Ern(Ve)}`,it={...z};return Ze&&(it["Content-Type"]=Ze),(qe||rt)&&(it[brn]=JSON.stringify({...qe?{headers:qe}:{},...rt?{responseType:rt}:{}})),Ht({method:Oe,url:lt,headers:it,params:Ie,data:$e,responseType:rt||"json"})},me={};W&&(me.name=W),ee&&ee.length>0&&(me.parents=ee),re&&(me.description=re),Y!==void 0&&(me.starred=Y);const Ce=(await pe("POST",`/v3/files/${H}/copy`,{params:{fields:grn,supportsAllDrives:!0},body:me,contentType:"application/json"})).data;return{value:U.Success,error:null,result:{id:Ce.id,name:Ce.name,mimeType:Ce.mimeType,webViewLink:Ce.webViewLink}}}catch(K){const q=((G=K.response)==null?void 0:G.data)||K.message||K;return uN(i,q)}}})}}const Arn="X-Elyx-Proxy-Config";function Irn(r){return r.startsWith("/")?r.slice(1):r}const pN=(r,u)=>(oe.Logger.log("[Google Drive Delete Document] error:",u),{value:r.catchesError||r.errorCalls.length?U.CaughtError:U.UnhandledError,error:u,result:null});class jpt extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleDriveDeleteDocument,version:"1.0.0",description:"Google Drive delete document operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleDriveDeleteDocument);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m,T,g,E,I;try{const A=L.operation[le.GoogleDriveDeleteDocument],D=((c=(s=n.find(ee=>{var re,Y;return((Y=(re=ee.valueOwner)==null?void 0:re.declaration)==null?void 0:Y.id)===A.inputs.connection.id}))==null?void 0:s.value)==null?void 0:c.valueAsType)??((f=(e=n.find(ee=>{var re,Y;return((Y=(re=ee.valueOwner)==null?void 0:re.declaration)==null?void 0:Y.id)===A.inputs.connection.id}))==null?void 0:e.value)==null?void 0:f.value);if(!(D instanceof Ga))return pN(i,"Invalid or missing connection entity");const V=(m=(y=n.find(ee=>{var re,Y;return((Y=(re=ee.valueOwner)==null?void 0:re.declaration)==null?void 0:Y.id)===A.inputs.documentId.id}))==null?void 0:y.value)==null?void 0:m.value;if(!V)return pN(i,"Missing required input: documentId");const N=(g=(T=n.find(ee=>{var re,Y;return((Y=(re=ee.valueOwner)==null?void 0:re.declaration)==null?void 0:Y.id)===A.inputs.permanent.id}))==null?void 0:T.value)==null?void 0:g.value,x=this.extensionsRegistry.requestContexts(this,[X.Editor])[0],G=Mi(D),q={Authorization:`Bearer ${await x.getAccessToken()}`},H=`${((E=x.env)==null?void 0:E.API_BASE_URL)+"/editor-runtime"}/v2/external-integrations/proxy/${x.projectId}/${qt["google-drive"]}/${G}`,W=async(ee,re,{params:Y,body:Z,contentType:J,providerHeaders:ne,responseType:z}={})=>{const ie=`${H}/${Irn(re)}`,pe={...q};return J&&(pe["Content-Type"]=J),(ne||z)&&(pe[Arn]=JSON.stringify({...ne?{headers:ne}:{},...z?{responseType:z}:{}})),Ht({method:ee,url:ie,headers:pe,params:Y,data:Z,responseType:z||"json"})};return N?await W("DELETE",`/v3/files/${V}`,{params:{supportsAllDrives:!0}}):await W("PATCH",`/v3/files/${V}`,{params:{supportsAllDrives:!0},body:{trashed:!0},contentType:"application/json"}),{value:U.Success,error:null,result:null}}catch(A){const D=((I=A.response)==null?void 0:I.data)||A.message||A;return pN(i,D)}}})}}class Kpt extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleGeminiGenerateContent,version:"1.0.0",description:"Send Gmail email operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleGeminiGenerateContent);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y;try{const m=n.find(x=>{var G,K;return((K=(G=x.valueOwner)==null?void 0:G.declaration)==null?void 0:K.id)===L.operation["external-integration--google-gemini--post--generate-content"].inputs.connection.id}),T=(s=m==null?void 0:m.value)==null?void 0:s.valueAsType;if(!T)return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No entity template provided",result:null};if(!(T instanceof Ga))return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"Invalid entity template value provided",result:null};const g=n.find(x=>{var G,K;return((K=(G=x.valueOwner)==null?void 0:G.declaration)==null?void 0:K.id)===L.operation["external-integration--google-gemini--post--generate-content"].inputs.prompt.id}),E=(c=g==null?void 0:g.value)==null?void 0:c.value;if(!E||typeof E!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"Invalid prompt value provided",result:null};const I=n.find(x=>{var G,K;return((K=(G=x.valueOwner)==null?void 0:G.declaration)==null?void 0:K.id)===L.operation["external-integration--google-gemini--post--generate-content"].inputs.model.id}),A=(e=I==null?void 0:I.value)==null?void 0:e.value;if(!A||typeof A!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"Invalid model value provided",result:null};const D=this.extensionsRegistry.requestContexts(this,[X.Editor])[0],V=Mi(T);console.log("Triggering Google Gemini generate content action with connectionId:",V);const N=await(await Ht.post(`${(f=D.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v1/external-integrations/trigger-action/${qt["google-gemini"]}/${V}/generate-content`,{payload:{prompt:E,model:A}},{headers:{"Content-Type":"application/json",Authorization:`Bearer ${await D.getAccessToken()}`}})).data;return oe.Logger.log("[Google Gemini] Generate content action response:",N),{value:U.Success,error:null,result:{content:N.content}}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return oe.Logger.error("[Google Gemini] Generate content failed:",T),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:T,result:null}}}})}}class qpt extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsCreateSpreadsheet,version:"1.0.0",description:"Create Spreadsheet Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsCreateSpreadsheet);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=He(i,i.project,"createSpreadsheet"),E="["+Fe(i,i.project,"Create spreadsheet")+": `"+T+"`] ",I=(Y,Z,J)=>{const ne=Fe(Y==null?void 0:Y.valueOwner,m==null?void 0:m.logic,Z),z=He(Y==null?void 0:Y.valueOwner,m==null?void 0:m.logic,J);return`"${ne}" (\`${z}\`)`},A=n.find(Y=>{var Z;return((Z=Y.valueOwner.declaration)==null?void 0:Z.id)===L.operation[le.GoogleSheetsCreateSpreadsheet].inputs.connection.id}),D=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!D||!D.id||!D.name||D.type!==a.DefinitionEntity)throw new Error(`${E}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const V=Mi(D);if(!V)throw new Error(`${E}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const N=n.find(Y=>{var Z;return((Z=Y.valueOwner.declaration)==null?void 0:Z.id)===L.operation[le.GoogleSheetsCreateSpreadsheet].inputs.title.id}),x=(c=N==null?void 0:N.value)==null?void 0:c.value;if(x&&typeof x!="string")throw new Error(`${E}The ${I(N,"Title","title")} input value is invalid. If present, it must be a non-empty string. E.g. "My Spreadsheet"`);const K={Authorization:`Bearer ${await m.getAccessToken()}`},q=`${(e=m.env)==null?void 0:e.API_BASE_URL}/editor-runtime/v1/external-integrations/generic-proxy/${m.projectId}/${qt["google-sheet"]}/${V}`,H=async Y=>Ht.post(q,Y,{headers:K}),W={};x&&(W.properties={title:x});const re=((f=(await H({method:"POST",endpoint:"/v4/spreadsheets",data:W})).data)==null?void 0:f.data)||{};return{value:U.Success,error:null,result:{spreadsheetId:re.spreadsheetId,spreadsheetUrl:re.spreadsheetUrl}}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return oe.Logger.log("[Google Sheets] error:",T),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:T,result:null}}}})}}function r$(r){let u="",i=r;for(;i>0;){const n=(i-1)%26;u=String.fromCharCode(65+n)+u,i=Math.floor((i-n)/26)}return u}function UO(r){if(!/^[A-Z]+$/.test(r))return NaN;let u=0;for(let i=0;i<r.length;i++)u=u*26+(r.charCodeAt(i)-64);return u}function qE(r,u){const i=(u==null?void 0:u.errorPrefix)||"";if(typeof r!="string")throw new Error(`${i}Input must be a string.`);let n,s=r;if(r.includes("!")){const I=r.split("!");let A=I.slice(0,-1).join("!");s=I[I.length-1],A.startsWith("'")&&A.endsWith("'")&&(A=A.slice(1,-1)),n=A}const c=/^(\$?[A-Z]+)?(\$?\d+)?(?::(\$?[A-Z]+)?(\$?\d+)?)?$/i,e=s.match(c);if(!e)throw new Error(`${i}Invalid A1 notation format: ${r}`);const[f,y,m,T,g]=e,E={sheet:n};return y&&(E.startColumn=y.toUpperCase()),m&&(E.startRow=m),T&&(E.endColumn=T.toUpperCase()),g&&(E.endRow=g),E}function AS(r,u){const i=u!=null&&u.errorPrefix?u.errorPrefix:"",n=T=>{if(typeof T=="string"){const g=T.replace("$","");return/^\d+$/.test(g)?parseInt(g,10):NaN}return T},s=T=>{if(typeof T=="string"){const g=T.replace("$","").toUpperCase();return/^\d+$/.test(g)?parseInt(g,10):UO(g)}return T},c=n(r.startRow),e=n(r.endRow),f=s(r.startColumn),y=s(r.endColumn),m=T=>typeof T=="string"&&T.includes("{{")&&T.includes("}}");if(r.startRow!==void 0&&r.startRow!==null&&r.startRow!==""&&isNaN(c)&&!m(r.startRow))throw new Error(`${i}Start Row is invalid.`);if(r.endRow!==void 0&&r.endRow!==null&&r.endRow!==""&&isNaN(e)&&!m(r.endRow))throw new Error(`${i}End Row is invalid.`);if(r.startColumn!==void 0&&r.startColumn!==null&&r.startColumn!==""&&isNaN(f)&&!m(r.startColumn))throw new Error(`${i}Start Column is invalid.`);if(r.endColumn!==void 0&&r.endColumn!==null&&r.endColumn!==""&&isNaN(y)&&!m(r.endColumn))throw new Error(`${i}End Column is invalid.`);if(c!=null&&!isNaN(c)&&c<1)throw new Error(`${i}Start Row must be greater than or equal to 1.`);if(e!=null&&!isNaN(e)&&e<1)throw new Error(`${i}End Row must be greater than or equal to 1.`);if(f!=null&&!isNaN(f)&&f<1)throw new Error(`${i}Start Column must be greater than or equal to 1.`);if(y!=null&&!isNaN(y)&&y<1)throw new Error(`${i}End Column must be greater than or equal to 1.`);if(c!=null&&!isNaN(c)&&e!==void 0&&e!==null&&!isNaN(e)&&c>e)throw new Error(`${i}Start Row must be less than or equal to End Row.`);if(f!=null&&!isNaN(f)&&y!==void 0&&y!==null&&!isNaN(y)&&f>y)throw new Error(`${i}Start Column must be less than or equal to End Column.`);if(typeof r.sheet=="number"&&r.sheet<0)throw new Error(`${i}Sheet ID must be greater than or equal to 0.`)}async function Md(r,u,i){if(!r)return;let n=r;if(typeof r=="string"){const e=r.trim();if(e.startsWith("{"))try{n=new Function("return "+e)()}catch{try{n=JSON.parse(e)}catch{}}else try{n=qE(e,{errorPrefix:"Internal"})}catch{}}if(n.sheet===void 0||n.sheet===null||n.sheet==="")return;const s=typeof n.sheet=="string",c=typeof n.sheet=="number";if(!(u==="Name"&&s)&&!(u==="Id"&&c))try{const e=await i();for(const f of e){const y=f.id,m=f.name;if(s&&m===n.sheet){n._resolvedSheetId=y,n._resolvedSheetName=m;return}if(c&&y===n.sheet){n._resolvedSheetId=y,n._resolvedSheetName=m;return}}}catch{}}function lg(r,u){if(!r)return"";if(typeof r=="string")return r;let i=r;if(typeof r=="string"&&r.trim().startsWith("{"))try{i=JSON.parse(r)}catch{}if(AS(i,u),i.namedRange&&i.namedRange.trim()!=="")return i.namedRange;const n=i._resolvedSheetName!==void 0?i._resolvedSheetName:typeof i.sheet=="string"?i.sheet:void 0,s=n?`'${n}'!`:"",c=E=>{if(typeof E=="number")return r$(E);if(typeof E=="string"){const I=E.replace("$","");if(/^\d+$/.test(I))return(E.startsWith("$")?"$":"")+r$(parseInt(I,10))}return E||""},e=c(i.startColumn),f=typeof i.startRow=="number"?i.startRow.toString():i.startRow||"",y=c(i.endColumn),m=typeof i.endRow=="number"?i.endRow.toString():i.endRow||"",T=`${e}${f}`,g=`${y}${m}`;return T&&g?`${s}${T}:${g}`:T?`${s}${T}`:s.replace(/!$/,"")}function Cp(r,u){if(!r)return{};let i=r;if(typeof r=="string"){const g=r.trim();if(g.startsWith("{"))try{i=new Function("return "+g)()}catch{try{i=JSON.parse(g)}catch{}}else try{i=qE(g,u)}catch{}}AS(i,u);const n={},s=i._resolvedSheetId!==void 0?i._resolvedSheetId:typeof i.sheet=="number"?i.sheet:void 0;s!=null&&(n.sheetId=s);const c=g=>{if(typeof g=="string"){const E=g.replace("$","");return/^\d+$/.test(E)?parseInt(E,10):NaN}return g},e=g=>{if(typeof g=="string"){const E=g.replace("$","").toUpperCase();return/^\d+$/.test(E)?parseInt(E,10):UO(E)}return g},f=c(i.startRow),y=c(i.endRow),m=e(i.startColumn),T=e(i.endColumn);return f!=null&&(n.startRowIndex=f-1),y!=null&&(n.endRowIndex=y),m!=null&&(n.startColumnIndex=m-1),T!=null&&(n.endColumnIndex=T),n}function gI(r,u){if(!r)return{};let i=r;if(typeof r=="string")if(r.trim().startsWith("{"))try{i=JSON.parse(r)}catch{i=qE(r,{errorPrefix:"Internal"})}else i=qE(r,{errorPrefix:"Internal"});AS(i,u);const n={},s=i._resolvedSheetId!==void 0?i._resolvedSheetId:typeof i.sheet=="number"?i.sheet:void 0;s!=null&&(n.sheetId=s);const c=g=>{if(typeof g=="string"){const E=g.replace("$","");return/^\d+$/.test(E)?parseInt(E,10):NaN}return g},e=g=>{if(typeof g=="string"){const E=g.replace("$","").toUpperCase();return/^\d+$/.test(E)?parseInt(E,10):UO(E)}return g},f=c(i.startRow),y=c(i.endRow),m=e(i.startColumn),T=e(i.endColumn);return f!=null?(n.dimension="ROWS",n.startIndex=f-1,y!=null?n.endIndex=y:n.endIndex=f):m!=null&&(n.dimension="COLUMNS",n.startIndex=m-1,T!=null?n.endIndex=T:n.endIndex=m),n}function Wn(r,u){const i=(u==null?void 0:u.errorPrefix)||"";if(typeof r!="string")throw new Error(`${i}Spreadsheet ID must be a string.`);const n=r.trim();if(n.length===0)throw new Error(`${i}Spreadsheet ID cannot be empty.`);if(n.includes("docs.google.com")||n.startsWith("http://")||n.startsWith("https://")||n.startsWith("www.google.com")){const c=n.match(/\/spreadsheets\/d\/e\/([a-zA-Z0-9-_]+)/);if(c&&c[1])return c[1];const e=n.match(/\/spreadsheets\/d\/([a-zA-Z0-9-_]+)/);if(e&&e[1])return e[1];throw new Error(`${i}Invalid Google Sheet URL format. Could not extract a valid Spreadsheet ID from the URL.`)}if(n.includes(" "))throw new Error(`${i}Spreadsheet ID cannot contain spaces.`);if(/[^a-zA-Z0-9-_]/.test(n))throw new Error(`${i}Spreadsheet ID contains invalid characters. Only alphanumeric characters, dashes, and underscores are allowed.`);return n}class Zpt extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsGetSpreadsheet,version:"1.0.0",description:"Get Spreadsheet Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsGetSpreadsheet);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=He(i,i.project,"getSpreadsheet"),I="["+Fe(i,i.project,"Get spreadsheet")+": `"+g+"`] ",A=(Z,J,ne)=>{const z=Fe(Z==null?void 0:Z.valueOwner,T==null?void 0:T.logic,J),ie=He(Z==null?void 0:Z.valueOwner,T==null?void 0:T.logic,ne);return`"${z}" (\`${ie}\`)`},D=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsGetSpreadsheet].inputs.connection.id}),V=(s=D==null?void 0:D.value)==null?void 0:s.valueAsType;if(!V||!V.id||!V.name||V.type!==a.DefinitionEntity)throw new Error(`${I}The ${A(D,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const N=Mi(V);if(!N)throw new Error(`${I}The ${A(D,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsGetSpreadsheet].inputs.spreadsheetId.id}),G=(c=x==null?void 0:x.value)==null?void 0:c.value,K=Wn(G,{errorPrefix:`${I}The ${A(x,"Spreadsheet ID","spreadsheetId")} input `}),H={Authorization:`Bearer ${await T.getAccessToken()}`},W=`${(e=T.env)==null?void 0:e.API_BASE_URL}/editor-runtime/v1/external-integrations/generic-proxy/${T.projectId}/${qt["google-sheet"]}/${N}`,Y=((f=(await(async Z=>Ht.post(W,Z,{headers:H}))({method:"GET",endpoint:`/v4/spreadsheets/${K}`})).data)==null?void 0:f.data)||{};return{value:U.Success,error:null,result:{title:(y=Y.properties)==null?void 0:y.title,spreadsheetUrl:Y.spreadsheetUrl}}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return oe.Logger.log("[Google Sheets] error:",g),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:g,result:null}}}})}}class Hpt extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsAddSheet,version:"1.0.0",description:"Add Sheet Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsAddSheet);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m,T,g,E,I;try{const A=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!A||!A.env)throw new Error("Editor context or environment missing");const D=He(i,i.project,"addSheet"),N="["+Fe(i,i.project,"Add sheet")+": `"+D+"`] ",x=(ve,Ce,Oe)=>{const Ve=Fe(ve==null?void 0:ve.valueOwner,A==null?void 0:A.logic,Ce),Ie=He(ve==null?void 0:ve.valueOwner,A==null?void 0:A.logic,Oe);return`"${Ve}" (\`${Ie}\`)`},G=n.find(ve=>{var Ce;return((Ce=ve.valueOwner.declaration)==null?void 0:Ce.id)===L.operation[le.GoogleSheetsAddSheet].inputs.connection.id}),K=(s=G==null?void 0:G.value)==null?void 0:s.valueAsType;if(!K||!K.id||!K.name||K.type!==a.DefinitionEntity)throw new Error(`${N}The ${x(G,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const q=Mi(K);if(!q)throw new Error(`${N}The ${x(G,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const H=n.find(ve=>{var Ce;return((Ce=ve.valueOwner.declaration)==null?void 0:Ce.id)===L.operation[le.GoogleSheetsAddSheet].inputs.spreadsheetId.id}),W=(c=H==null?void 0:H.value)==null?void 0:c.value,ee=Wn(W,{errorPrefix:`${N}The ${x(H,"Spreadsheet ID","spreadsheetId")} input `}),re=n.find(ve=>{var Ce;return((Ce=ve.valueOwner.declaration)==null?void 0:Ce.id)===L.operation[le.GoogleSheetsAddSheet].inputs.title.id}),Y=(e=re==null?void 0:re.value)==null?void 0:e.value;if(Y!=null&&typeof Y!="string")throw new Error(`${N}The ${x(re,"Title","title")} input value is invalid. If present, it must be a string. E.g. "New Sheet"`);const J={Authorization:`Bearer ${await A.getAccessToken()}`},ne=`${(f=A.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v1/external-integrations/generic-proxy/${A.projectId}/${qt["google-sheet"]}/${q}`,me=(E=(g=(T=(m=(((y=(await(async ve=>Ht.post(ne,ve,{headers:J}))({method:"POST",endpoint:`/v4/spreadsheets/${ee}:batchUpdate`,data:{requests:[{addSheet:{properties:{title:Y}}}]}})).data)==null?void 0:y.data)||{}).replies)==null?void 0:m[0])==null?void 0:T.addSheet)==null?void 0:g.properties)==null?void 0:E.sheetId;return{value:U.Success,error:null,result:{sheetId:me}}}catch(A){const D=((I=A.response)==null?void 0:I.data)||A.message||A;return oe.Logger.log("[Google Sheets] error:",D),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:D,result:null}}}})}}class Wpt extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsDeleteSheet,version:"1.0.0",description:"Delete Sheet Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsDeleteSheet);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=He(i,i.project,"deleteSheet"),E="["+Fe(i,i.project,"Delete sheet")+": `"+T+"`] ",I=(Y,Z,J)=>{const ne=Fe(Y==null?void 0:Y.valueOwner,m==null?void 0:m.logic,Z),z=He(Y==null?void 0:Y.valueOwner,m==null?void 0:m.logic,J);return`"${ne}" (\`${z}\`)`},A=n.find(Y=>{var Z;return((Z=Y.valueOwner.declaration)==null?void 0:Z.id)===L.operation[le.GoogleSheetsDeleteSheet].inputs.connection.id}),D=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!D||!D.id||!D.name||D.type!==a.DefinitionEntity)throw new Error(`${E}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const V=Mi(D);if(!V)throw new Error(`${E}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const N=n.find(Y=>{var Z;return((Z=Y.valueOwner.declaration)==null?void 0:Z.id)===L.operation[le.GoogleSheetsDeleteSheet].inputs.spreadsheetId.id}),x=(c=N==null?void 0:N.value)==null?void 0:c.value,G=Wn(x,{errorPrefix:`${E}The ${I(N,"Spreadsheet ID","spreadsheetId")} input `}),K=n.find(Y=>{var Z;return((Z=Y.valueOwner.declaration)==null?void 0:Z.id)===L.operation[le.GoogleSheetsDeleteSheet].inputs.sheetId.id}),q=(e=K==null?void 0:K.value)==null?void 0:e.value;if(q==null)throw new Error(`${E}The ${I(K,"Sheet ID","sheetId")} input is missing.`);if(typeof q!="number")throw new Error(`${E}The ${I(K,"Sheet ID","sheetId")} input value is invalid. It must be a number. E.g. 0`);const W={Authorization:`Bearer ${await m.getAccessToken()}`},ee=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v1/external-integrations/generic-proxy/${m.projectId}/${qt["google-sheet"]}/${V}`;return await(async Y=>Ht.post(ee,Y,{headers:W}))({method:"POST",endpoint:`/v4/spreadsheets/${G}:batchUpdate`,data:{requests:[{deleteSheet:{sheetId:q}}]}}),{value:U.Success,error:null,result:{success:!0}}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return oe.Logger.log("[Google Sheets] error:",T),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:T,result:null}}}})}}class zpt extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsAppendRows,version:"1.0.0",description:"Append Row(s) Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsAppendRows);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m,T,g;try{const E=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!E||!E.env)throw new Error("Editor context or environment missing");const I=He(i,i.project,"appendRows"),D="["+Fe(i,i.project,"Append rows")+": `"+I+"`] ",V=(ve,Ce,Oe)=>{const Ve=Fe(ve==null?void 0:ve.valueOwner,E==null?void 0:E.logic,Ce),Ie=He(ve==null?void 0:ve.valueOwner,E==null?void 0:E.logic,Oe);return`"${Ve}" (\`${Ie}\`)`},N=n.find(ve=>{var Ce;return((Ce=ve.valueOwner.declaration)==null?void 0:Ce.id)===L.operation[le.GoogleSheetsAppendRows].inputs.connection.id}),x=(s=N==null?void 0:N.value)==null?void 0:s.valueAsType;if(!x||!x.id||!x.name||x.type!==a.DefinitionEntity)throw new Error(`${D}The ${V(N,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const G=Mi(x);if(!G)throw new Error(`${D}The ${V(N,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const K=n.find(ve=>{var Ce;return((Ce=ve.valueOwner.declaration)==null?void 0:Ce.id)===L.operation[le.GoogleSheetsAppendRows].inputs.spreadsheetId.id}),q=(c=K==null?void 0:K.value)==null?void 0:c.value,H=Wn(q,{errorPrefix:`${D}The ${V(K,"Spreadsheet ID","spreadsheetId")} input `}),W=n.find(ve=>{var Ce;return((Ce=ve.valueOwner.declaration)==null?void 0:Ce.id)===L.operation[le.GoogleSheetsAppendRows].inputs.range.id}),ee=(e=W==null?void 0:W.value)==null?void 0:e.value;if(!ee||ee==="")throw new Error(`${D}The ${V(W,"Range","range")} input is missing.`);const re=n.find(ve=>{var Ce;return((Ce=ve.valueOwner.declaration)==null?void 0:Ce.id)===L.operation[le.GoogleSheetsAppendRows].inputs.values.id}),Y=(f=re==null?void 0:re.value)==null?void 0:f.value;if(Y==null)throw new Error(`${D}The ${V(re,"Values","values")} input is missing.`);const J={Authorization:`Bearer ${await E.getAccessToken()}`},ne=`${(y=E.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v1/external-integrations/generic-proxy/${E.projectId}/${qt["google-sheet"]}/${G}`,z=async ve=>Ht.post(ne,ve,{headers:J});let ie=Y;if(typeof Y=="string")try{ie=JSON.parse(Y)}catch{}await Md(ee,"Name",async()=>{var Ce;return(((Ce=(await z({method:"GET",endpoint:`/v4/spreadsheets/${H}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:Ce.sheets)||[]).map(Oe=>{var Ve,Ie;return{id:(Ve=Oe.properties)==null?void 0:Ve.sheetId,name:(Ie=Oe.properties)==null?void 0:Ie.title}})});const me=((m=(await z({method:"POST",endpoint:`/v4/spreadsheets/${H}/values/${lg(ee,{errorPrefix:`${D}The ${V(W,"Range","range")} input `})}:append`,params:{valueInputOption:"USER_ENTERED"},data:{values:Array.isArray(ie)?ie:[ie]}})).data)==null?void 0:m.data)||{};return{value:U.Success,error:null,result:{updatedRange:(T=me.updates)==null?void 0:T.updatedRange}}}catch(E){const I=((g=E.response)==null?void 0:g.data)||E.message||E;return oe.Logger.log("[Google Sheets] error:",I),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:I,result:null}}}})}}class Ypt extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsGetRangeValues,version:"1.0.0",description:"Get Range Values Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsGetRangeValues);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=He(i,i.project,"getRangeValues"),I="["+Fe(i,i.project,"Get range values")+": `"+g+"`] ",A=(ne,z,ie)=>{const pe=Fe(ne==null?void 0:ne.valueOwner,T==null?void 0:T.logic,z),me=He(ne==null?void 0:ne.valueOwner,T==null?void 0:T.logic,ie);return`"${pe}" (\`${me}\`)`},D=n.find(ne=>{var z;return((z=ne.valueOwner.declaration)==null?void 0:z.id)===L.operation[le.GoogleSheetsGetRangeValues].inputs.connection.id}),V=(s=D==null?void 0:D.value)==null?void 0:s.valueAsType;if(!V||!V.id||!V.name||V.type!==a.DefinitionEntity)throw new Error(`${I}The ${A(D,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const N=Mi(V);if(!N)throw new Error(`${I}The ${A(D,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(ne=>{var z;return((z=ne.valueOwner.declaration)==null?void 0:z.id)===L.operation[le.GoogleSheetsGetRangeValues].inputs.spreadsheetId.id}),G=(c=x==null?void 0:x.value)==null?void 0:c.value,K=Wn(G,{errorPrefix:`${I}The ${A(x,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(ne=>{var z;return((z=ne.valueOwner.declaration)==null?void 0:z.id)===L.operation[le.GoogleSheetsGetRangeValues].inputs.range.id}),H=(e=q==null?void 0:q.value)==null?void 0:e.value;if(!H||H==="")throw new Error(`${I}The ${A(q,"Range","range")} input is missing.`);const ee={Authorization:`Bearer ${await T.getAccessToken()}`},re=`${(f=T.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v1/external-integrations/generic-proxy/${T.projectId}/${qt["google-sheet"]}/${N}`,Y=async ne=>Ht.post(re,ne,{headers:ee});await Md(H,"Name",async()=>{var z;return(((z=(await Y({method:"GET",endpoint:`/v4/spreadsheets/${K}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:z.sheets)||[]).map(ie=>{var pe,me;return{id:(pe=ie.properties)==null?void 0:pe.sheetId,name:(me=ie.properties)==null?void 0:me.title}})});const J=((y=(await Y({method:"GET",endpoint:`/v4/spreadsheets/${K}/values/${lg(H,{errorPrefix:`${I}The ${A(q,"Range","range")} input `})}`})).data)==null?void 0:y.data)||{};return{value:U.Success,error:null,result:{values:J.values}}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return oe.Logger.log("[Google Sheets] error:",g),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:g,result:null}}}})}}class Jpt extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsUpdateRangeValues,version:"1.0.0",description:"Update Range Values Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsUpdateRangeValues);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m,T;try{const g=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!g||!g.env)throw new Error("Editor context or environment missing");const E=He(i,i.project,"updateRangeValues"),A="["+Fe(i,i.project,"Update range values")+": `"+E+"`] ",D=(me,ve,Ce)=>{const Oe=Fe(me==null?void 0:me.valueOwner,g==null?void 0:g.logic,ve),Ve=He(me==null?void 0:me.valueOwner,g==null?void 0:g.logic,Ce);return`"${Oe}" (\`${Ve}\`)`},V=n.find(me=>{var ve;return((ve=me.valueOwner.declaration)==null?void 0:ve.id)===L.operation[le.GoogleSheetsUpdateRangeValues].inputs.connection.id}),N=(s=V==null?void 0:V.value)==null?void 0:s.valueAsType;if(!N||!N.id||!N.name||N.type!==a.DefinitionEntity)throw new Error(`${A}The ${D(V,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=Mi(N);if(!x)throw new Error(`${A}The ${D(V,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const G=n.find(me=>{var ve;return((ve=me.valueOwner.declaration)==null?void 0:ve.id)===L.operation[le.GoogleSheetsUpdateRangeValues].inputs.spreadsheetId.id}),K=(c=G==null?void 0:G.value)==null?void 0:c.value,q=Wn(K,{errorPrefix:`${A}The ${D(G,"Spreadsheet ID","spreadsheetId")} input `}),H=n.find(me=>{var ve;return((ve=me.valueOwner.declaration)==null?void 0:ve.id)===L.operation[le.GoogleSheetsUpdateRangeValues].inputs.range.id}),W=(e=H==null?void 0:H.value)==null?void 0:e.value;if(!W||W==="")throw new Error(`${A}The ${D(H,"Range","range")} input is missing.`);const ee=n.find(me=>{var ve;return((ve=me.valueOwner.declaration)==null?void 0:ve.id)===L.operation[le.GoogleSheetsUpdateRangeValues].inputs.values.id}),re=(f=ee==null?void 0:ee.value)==null?void 0:f.value;if(re==null)throw new Error(`${A}The ${D(ee,"Values","values")} input is missing.`);const Z={Authorization:`Bearer ${await g.getAccessToken()}`},J=`${(y=g.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v1/external-integrations/generic-proxy/${g.projectId}/${qt["google-sheet"]}/${x}`,ne=async me=>Ht.post(J,me,{headers:Z});let z=re;if(typeof re=="string")try{z=JSON.parse(re)}catch{}await Md(W,"Name",async()=>{var ve;return(((ve=(await ne({method:"GET",endpoint:`/v4/spreadsheets/${q}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:ve.sheets)||[]).map(Ce=>{var Oe,Ve;return{id:(Oe=Ce.properties)==null?void 0:Oe.sheetId,name:(Ve=Ce.properties)==null?void 0:Ve.title}})});const pe=((m=(await ne({method:"PUT",endpoint:`/v4/spreadsheets/${q}/values/${lg(W,{errorPrefix:`${A}The ${D(H,"Range","range")} input `})}`,params:{valueInputOption:"USER_ENTERED"},data:{values:Array.isArray(z)?z:[z]}})).data)==null?void 0:m.data)||{};return{value:U.Success,error:null,result:{updatedRange:pe.updatedRange}}}catch(g){const E=((T=g.response)==null?void 0:T.data)||g.message||g;return oe.Logger.log("[Google Sheets] error:",E),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:E,result:null}}}})}}class Qpt extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsClearRange,version:"1.0.0",description:"Clear Range Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsClearRange);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=He(i,i.project,"clearRange"),I="["+Fe(i,i.project,"Clear range")+": `"+g+"`] ",A=(ne,z,ie)=>{const pe=Fe(ne==null?void 0:ne.valueOwner,T==null?void 0:T.logic,z),me=He(ne==null?void 0:ne.valueOwner,T==null?void 0:T.logic,ie);return`"${pe}" (\`${me}\`)`},D=n.find(ne=>{var z;return((z=ne.valueOwner.declaration)==null?void 0:z.id)===L.operation[le.GoogleSheetsClearRange].inputs.connection.id}),V=(s=D==null?void 0:D.value)==null?void 0:s.valueAsType;if(!V||!V.id||!V.name||V.type!==a.DefinitionEntity)throw new Error(`${I}The ${A(D,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const N=Mi(V);if(!N)throw new Error(`${I}The ${A(D,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(ne=>{var z;return((z=ne.valueOwner.declaration)==null?void 0:z.id)===L.operation[le.GoogleSheetsClearRange].inputs.spreadsheetId.id}),G=(c=x==null?void 0:x.value)==null?void 0:c.value,K=Wn(G,{errorPrefix:`${I}The ${A(x,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(ne=>{var z;return((z=ne.valueOwner.declaration)==null?void 0:z.id)===L.operation[le.GoogleSheetsClearRange].inputs.range.id}),H=(e=q==null?void 0:q.value)==null?void 0:e.value;if(!H||H==="")throw new Error(`${I}The ${A(q,"Range","range")} input is missing.`);const ee={Authorization:`Bearer ${await T.getAccessToken()}`},re=`${(f=T.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v1/external-integrations/generic-proxy/${T.projectId}/${qt["google-sheet"]}/${N}`,Y=async ne=>Ht.post(re,ne,{headers:ee});await Md(H,"Name",async()=>{var z;return(((z=(await Y({method:"GET",endpoint:`/v4/spreadsheets/${K}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:z.sheets)||[]).map(ie=>{var pe,me;return{id:(pe=ie.properties)==null?void 0:pe.sheetId,name:(me=ie.properties)==null?void 0:me.title}})});const J=((y=(await Y({method:"POST",endpoint:`/v4/spreadsheets/${K}/values/${lg(H,{errorPrefix:`${I}The ${A(q,"Range","range")} input `})}:clear`,data:{}})).data)==null?void 0:y.data)||{};return{value:U.Success,error:null,result:{clearedRange:J.clearedRange}}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return oe.Logger.log("[Google Sheets] error:",g),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:g,result:null}}}})}}class Xpt extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsBatchUpdateSpreadsheet,version:"1.0.0",description:"Batch Update Spreadsheet Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsBatchUpdateSpreadsheet);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=He(i,i.project,"batchUpdateSpreadsheet"),I="["+Fe(i,i.project,"Batch update spreadsheet")+": `"+g+"`] ",A=(z,ie,pe)=>{const me=Fe(z==null?void 0:z.valueOwner,T==null?void 0:T.logic,ie),ve=He(z==null?void 0:z.valueOwner,T==null?void 0:T.logic,pe);return`"${me}" (\`${ve}\`)`},D=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsBatchUpdateSpreadsheet].inputs.connection.id}),V=(s=D==null?void 0:D.value)==null?void 0:s.valueAsType;if(!V||!V.id||!V.name||V.type!==a.DefinitionEntity)throw new Error(`${I}The ${A(D,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const N=Mi(V);if(!N)throw new Error(`${I}The ${A(D,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsBatchUpdateSpreadsheet].inputs.spreadsheetId.id}),G=(c=x==null?void 0:x.value)==null?void 0:c.value,K=Wn(G,{errorPrefix:`${I}The ${A(x,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsBatchUpdateSpreadsheet].inputs.requests.id}),H=(e=q==null?void 0:q.value)==null?void 0:e.value;if(H==null||H==="")throw new Error(`${I}The ${A(q,"Requests","requests")} input is missing.`);let W=H;if(typeof H=="string")try{W=JSON.parse(H)}catch{}if(Array.isArray(W)||(W=[W]),W.length===0)throw new Error(`${I}The ${A(q,"Requests","requests")} input evaluated to an empty array. E.g. [{ addSheet: { properties: { title: "New Sheet" } } }]`);const re={Authorization:`Bearer ${await T.getAccessToken()}`},Y=`${(f=T.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v1/external-integrations/generic-proxy/${T.projectId}/${qt["google-sheet"]}/${N}`,J=await(async z=>Ht.post(Y,z,{headers:re}))({method:"POST",endpoint:`/v4/spreadsheets/${K}:batchUpdate`,data:{requests:W}}),ne=((y=J.data)==null?void 0:y.data)||J.data||{};return{value:U.Success,result:{replies:ne.replies||[]},error:null}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return oe.Logger.log("[Google Sheets] error:",g),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:g,result:null}}}})}}class ect extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsRenameSheet,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsRenameSheet);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=He(i,i.project,"renameSheet"),I="["+Fe(i,i.project,"Rename sheet")+": `"+g+"`] ",A=(ie,pe,me)=>{const ve=Fe(ie==null?void 0:ie.valueOwner,T==null?void 0:T.logic,pe),Ce=He(ie==null?void 0:ie.valueOwner,T==null?void 0:T.logic,me);return`"${ve}" (\`${Ce}\`)`},D=n.find(ie=>{var pe;return((pe=ie.valueOwner.declaration)==null?void 0:pe.id)===L.operation[le.GoogleSheetsRenameSheet].inputs.connection.id}),V=(s=D==null?void 0:D.value)==null?void 0:s.valueAsType;if(!V||!V.id||!V.name||V.type!==a.DefinitionEntity)throw new Error(`${I}The ${A(D,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const N=Mi(V);if(!N)throw new Error(`${I}The ${A(D,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(ie=>{var pe;return((pe=ie.valueOwner.declaration)==null?void 0:pe.id)===L.operation[le.GoogleSheetsRenameSheet].inputs.spreadsheetId.id}),G=(c=x==null?void 0:x.value)==null?void 0:c.value,K=Wn(G,{errorPrefix:`${I}The ${A(x,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(ie=>{var pe;return((pe=ie.valueOwner.declaration)==null?void 0:pe.id)===L.operation[le.GoogleSheetsRenameSheet].inputs.sheetId.id}),H=(e=q==null?void 0:q.value)==null?void 0:e.value;if(H==null)throw new Error(`${I}The ${A(q,"Sheet ID","sheetId")} input is missing.`);if(typeof H!="number")throw new Error(`${I}The ${A(q,"Sheet ID","sheetId")} input value is invalid. It must be a number. E.g. 0`);const W=n.find(ie=>{var pe;return((pe=ie.valueOwner.declaration)==null?void 0:pe.id)===L.operation[le.GoogleSheetsRenameSheet].inputs.title.id}),ee=(f=W==null?void 0:W.value)==null?void 0:f.value;if(ee!=null&&typeof ee!="string")throw new Error(`${I}The ${A(W,"Title","title")} input value is invalid, if present, it must be a string.`);const Y={Authorization:`Bearer ${await T.getAccessToken()}`},Z=`${(y=T.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v1/external-integrations/generic-proxy/${T.projectId}/${qt["google-sheet"]}/${N}`,J=async ie=>Ht.post(Z,ie,{headers:Y}),ne={sheetId:H},z=[];return ne.title=ee||"",z.push("title"),await J({method:"POST",endpoint:`/v4/spreadsheets/${K}:batchUpdate`,data:{requests:[{updateSheetProperties:{properties:ne,fields:z.join(",")}}]}}),{value:U.Success,result:{success:!0},error:null}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return oe.Logger.log("[Google Sheets] error:",g),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:g,result:null}}}})}}class tct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsCopySheet,version:"1.0.0",description:"Copy Sheet Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsCopySheet);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m,T;try{const g=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!g||!g.env)throw new Error("Editor context or environment missing");const E=He(i,i.project,"copySheet"),A="["+Fe(i,i.project,"Copy sheet")+": `"+E+"`] ",D=(pe,me,ve)=>{const Ce=Fe(pe==null?void 0:pe.valueOwner,g==null?void 0:g.logic,me),Oe=He(pe==null?void 0:pe.valueOwner,g==null?void 0:g.logic,ve);return`"${Ce}" (\`${Oe}\`)`},V=n.find(pe=>{var me;return((me=pe.valueOwner.declaration)==null?void 0:me.id)===L.operation[le.GoogleSheetsCopySheet].inputs.connection.id}),N=(s=V==null?void 0:V.value)==null?void 0:s.valueAsType;if(!N||!N.id||!N.name||N.type!==a.DefinitionEntity)throw new Error(`${A}The ${D(V,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=Mi(N);if(!x)throw new Error(`${A}The ${D(V,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const G=n.find(pe=>{var me;return((me=pe.valueOwner.declaration)==null?void 0:me.id)===L.operation[le.GoogleSheetsCopySheet].inputs.spreadsheetId.id}),K=(c=G==null?void 0:G.value)==null?void 0:c.value,q=Wn(K,{errorPrefix:`${A}The ${D(G,"Spreadsheet ID","spreadsheetId")} input `}),H=n.find(pe=>{var me;return((me=pe.valueOwner.declaration)==null?void 0:me.id)===L.operation[le.GoogleSheetsCopySheet].inputs.sheetId.id}),W=(e=H==null?void 0:H.value)==null?void 0:e.value;if(W==null)throw new Error(`${A}The ${D(H,"Sheet ID","sheetId")} input is missing.`);if(typeof W!="number")throw new Error(`${A}The ${D(H,"Sheet ID","sheetId")} input value is invalid. It must be a number. E.g. 0`);const ee=n.find(pe=>{var me;return((me=pe.valueOwner.declaration)==null?void 0:me.id)===L.operation[le.GoogleSheetsCopySheet].inputs.destinationSpreadsheetId.id}),re=(f=ee==null?void 0:ee.value)==null?void 0:f.value;if(!re||re==="")throw new Error(`${A}The ${D(ee,"Destination Spreadsheet ID","destinationSpreadsheetId")} input is missing.`);if(typeof re!="string")throw new Error(`${A}The ${D(ee,"Destination Spreadsheet ID","destinationSpreadsheetId")} input value is invalid. It must be a non-empty string. E.g. "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms"`);const Z={Authorization:`Bearer ${await g.getAccessToken()}`},J=`${(y=g.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v1/external-integrations/generic-proxy/${g.projectId}/${qt["google-sheet"]}/${x}`,z=await(async pe=>Ht.post(J,pe,{headers:Z}))({method:"POST",endpoint:`/v4/spreadsheets/${q}/sheets/${W}:copyTo`,data:{destinationSpreadsheetId:re}}),ie=((m=z.data)==null?void 0:m.data)||z.data||{};return{value:U.Success,result:{newSheetId:ie.sheetId},error:null}}catch(g){const E=((T=g.response)==null?void 0:T.data)||g.message||g;return oe.Logger.log("[Google Sheets] error:",E),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:E,result:null}}}})}}class ict extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsClearSheet,version:"1.0.0",description:"Clear Sheet Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsClearSheet);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=He(i,i.project,"clearSheet"),I="["+Fe(i,i.project,"Clear sheet")+": `"+g+"`] ",A=(ne,z,ie)=>{const pe=Fe(ne==null?void 0:ne.valueOwner,T==null?void 0:T.logic,z),me=He(ne==null?void 0:ne.valueOwner,T==null?void 0:T.logic,ie);return`"${pe}" (\`${me}\`)`},D=n.find(ne=>{var z;return((z=ne.valueOwner.declaration)==null?void 0:z.id)===L.operation[le.GoogleSheetsClearSheet].inputs.connection.id}),V=(s=D==null?void 0:D.value)==null?void 0:s.valueAsType;if(!V||!V.id||!V.name||V.type!==a.DefinitionEntity)throw new Error(`${I}The ${A(D,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const N=Mi(V);if(!N)throw new Error(`${I}The ${A(D,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(ne=>{var z;return((z=ne.valueOwner.declaration)==null?void 0:z.id)===L.operation[le.GoogleSheetsClearSheet].inputs.spreadsheetId.id}),G=(c=x==null?void 0:x.value)==null?void 0:c.value,K=Wn(G,{errorPrefix:`${I}The ${A(x,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(ne=>{var z;return((z=ne.valueOwner.declaration)==null?void 0:z.id)===L.operation[le.GoogleSheetsClearSheet].inputs.sheetName.id}),H=(e=q==null?void 0:q.value)==null?void 0:e.value;if(!H||H==="")throw new Error(`${I}The ${A(q,"Sheet Name","sheetName")} input is missing.`);if(typeof H!="string")throw new Error(`${I}The ${A(q,"Sheet Name","sheetName")} input value is invalid. It must be a non-empty string. E.g. "Sheet1"`);const ee={Authorization:`Bearer ${await T.getAccessToken()}`},re=`${(f=T.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v1/external-integrations/generic-proxy/${T.projectId}/${qt["google-sheet"]}/${N}`,Z=await(async ne=>Ht.post(re,ne,{headers:ee}))({method:"POST",endpoint:`/v4/spreadsheets/${K}/values/${H}:clear`,data:{}}),J=((y=Z.data)==null?void 0:y.data)||Z.data||{};return{value:U.Success,result:{clearedRange:J.clearedRange},error:null}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return oe.Logger.log("[Google Sheets] error:",g),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:g,result:null}}}})}}class nct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsBatchGetValues,version:"1.0.0",description:"Batch Get Values Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsBatchGetValues);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m,T,g,E,I,A;try{const D=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!D||!D.env)throw new Error("Editor context or environment missing");const V=He(i,i.project,"batchGetValues"),x="["+Fe(i,i.project,"Batch get values")+": `"+V+"`] ",G=($e,Ze,qe)=>{const rt=Fe($e==null?void 0:$e.valueOwner,D==null?void 0:D.logic,Ze),lt=He($e==null?void 0:$e.valueOwner,D==null?void 0:D.logic,qe);return`"${rt}" (\`${lt}\`)`},K=n.find($e=>{var Ze;return((Ze=$e.valueOwner.declaration)==null?void 0:Ze.id)===L.operation[le.GoogleSheetsBatchGetValues].inputs.connection.id}),q=(s=K==null?void 0:K.value)==null?void 0:s.valueAsType;if(!q||!q.id||!q.name||q.type!==a.DefinitionEntity)throw new Error(`${x}The ${G(K,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const H=Mi(q);if(!H)throw new Error(`${x}The ${G(K,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const W=n.find($e=>{var Ze;return((Ze=$e.valueOwner.declaration)==null?void 0:Ze.id)===L.operation[le.GoogleSheetsBatchGetValues].inputs.spreadsheetId.id}),ee=(c=W==null?void 0:W.value)==null?void 0:c.value,re=Wn(ee,{errorPrefix:`${x}The ${G(W,"Spreadsheet ID","spreadsheetId")} input `}),Y=n.find($e=>{var Ze;return((Ze=$e.valueOwner.declaration)==null?void 0:Ze.id)===L.operation[le.GoogleSheetsBatchGetValues].inputs.ranges.id}),Z=(e=Y==null?void 0:Y.value)==null?void 0:e.value;if(Z==null||Z==="")throw new Error(`${x}The ${G(Y,"Ranges","ranges")} input is missing.`);const ne={Authorization:`Bearer ${await D.getAccessToken()}`},z=`${(f=D.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v1/external-integrations/generic-proxy/${D.projectId}/${qt["google-sheet"]}/${H}`,ie=async $e=>Ht.post(z,$e,{headers:ne});let pe=Array.isArray(Z)?Z:[Z];if(pe.length===0)throw new Error(`${x}The ${G(Y,"Ranges","ranges")} input evaluated to an empty array. E.g. ["Sheet1!A1:B2"]`);let me=new Set;try{const $e=await ie({method:"GET",endpoint:`/v4/spreadsheets/${re}?fields=sheets.properties(sheetId,title)`}),Ze=((y=$e.data)==null?void 0:y.sheets)||((T=(m=$e.data)==null?void 0:m.data)==null?void 0:T.sheets)||[];me=new Set(Ze.map(qe=>{var rt;return(rt=qe.properties)==null?void 0:rt.title}).filter(Boolean))}catch{}const ve=$e=>{const Ze=$e.indexOf("!");if(Ze>-1){let qe=$e.substring(0,Ze).trim();return qe.startsWith("'")&&qe.endsWith("'")&&(qe=qe.slice(1,-1)),qe}return null},Ce=[],Oe=[];for(const $e of pe){const Ze=lg($e,{errorPrefix:`${x}The ${G(Y,"Ranges","ranges")} input `}),qe=ve(Ze);qe&&me.size>0&&!me.has(qe)?Oe.push({range:Ze,majorDimension:"ROWS",values:[]}):Ce.push({a1Range:Ze})}let Ve=[];if(Ce.length>0){const $e=await ie({method:"POST",endpoint:`/v4/spreadsheets/${re}/values:batchGetByDataFilter`,data:{dataFilters:Ce}});Ve=(((g=$e.data)==null?void 0:g.valueRanges)||((I=(E=$e.data)==null?void 0:E.data)==null?void 0:I.valueRanges)||[]).map(qe=>qe.valueRange||qe)}const Ie=[...Ve,...Oe];return{value:U.Success,result:{valueRanges:Ie},error:null}}catch(D){const V=((A=D.response)==null?void 0:A.data)||D.message||D;return oe.Logger.log("[Google Sheets] error:",V),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:V,result:null}}}})}}function a$(r){if(!r||typeof r!="object")return;const u={};return typeof r.red=="number"&&(u.red=r.red>1?r.red/255:r.red),typeof r.green=="number"&&(u.green=r.green>1?r.green/255:r.green),typeof r.blue=="number"&&(u.blue=r.blue>1?r.blue/255:r.blue),typeof r.alpha=="number"&&(u.alpha=r.alpha),Object.keys(u).length>0?u:void 0}class rct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsFormatCells,version:"1.0.0",description:"Format Cells Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsFormatCells);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=He(i,i.project,"formatCells"),E="["+Fe(i,i.project,"Format cells")+": `"+T+"`] ",I=(vt,_t,bt)=>{const ht=Fe(vt==null?void 0:vt.valueOwner,m==null?void 0:m.logic,_t),Zt=He(vt==null?void 0:vt.valueOwner,m==null?void 0:m.logic,bt);return`"${ht}" (\`${Zt}\`)`},A=n.find(vt=>{var _t;return((_t=vt.valueOwner.declaration)==null?void 0:_t.id)===L.operation[le.GoogleSheetsFormatCells].inputs.connection.id}),D=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!D||!D.id||!D.name||D.type!==a.DefinitionEntity)throw new Error(`${E}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const V=Mi(D);if(!V)throw new Error(`${E}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const N=n.find(vt=>{var _t;return((_t=vt.valueOwner.declaration)==null?void 0:_t.id)===L.operation[le.GoogleSheetsFormatCells].inputs.spreadsheetId.id}),x=(c=N==null?void 0:N.value)==null?void 0:c.value,G=Wn(x,{errorPrefix:`${E}The ${I(N,"Spreadsheet ID","spreadsheetId")} input `}),K=n.find(vt=>{var _t;return((_t=vt.valueOwner.declaration)==null?void 0:_t.id)===L.operation[le.GoogleSheetsFormatCells].inputs.range.id}),q=(e=K==null?void 0:K.value)==null?void 0:e.value;if(q==null)throw new Error(`${E}The ${I(K,"Range","range")} input is missing.`);const W={Authorization:`Bearer ${await m.getAccessToken()}`},ee=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v1/external-integrations/generic-proxy/${m.projectId}/${qt["google-sheet"]}/${V}`,re=async vt=>Ht.post(ee,vt,{headers:W});await Md(q,"Id",async()=>(await re({method:"GET",endpoint:`/v4/spreadsheets/${G}?fields=sheets.properties(sheetId,title)`})).data.sheets.map(_t=>({id:_t.properties.sheetId,name:_t.properties.title})));const Y=Cp(q,{errorPrefix:`${E}The ${I(K,"Range","range")} input `}),Z=L.operation[le.GoogleSheetsFormatCells].inputs,J=vt=>{var bt;const _t=n.find(ht=>{var Zt;return((Zt=ht.valueOwner.declaration)==null?void 0:Zt.id)===vt});return(bt=_t==null?void 0:_t.value)==null?void 0:bt.value},ne=J(Z.bold.id),z=J(Z.italic.id),ie=J(Z.underline.id),pe=J(Z.strikethrough.id),me=J(Z.fontSize.id),ve=J(Z.fontFamily.id),Ce=J(Z.textColor.id),Oe=J(Z.backgroundColor.id),Ve=J(Z.horizontalAlignment.id),Ie=J(Z.verticalAlignment.id),$e=J(Z.wrapStrategy.id),Ze={},qe=[],rt={},lt=[];typeof ne=="boolean"&&(rt.bold=ne,lt.push("bold")),typeof z=="boolean"&&(rt.italic=z,lt.push("italic")),typeof ie=="boolean"&&(rt.underline=ie,lt.push("underline")),typeof pe=="boolean"&&(rt.strikethrough=pe,lt.push("strikethrough")),typeof me=="number"&&!isNaN(me)&&(rt.fontSize=me,lt.push("fontSize")),typeof ve=="string"&&ve.trim()!==""&&(rt.fontFamily=ve.trim(),lt.push("fontFamily"));const it=a$(Ce);it&&(rt.foregroundColor=it,lt.push("foregroundColor")),lt.length>0&&(Ze.textFormat=rt,qe.push(`userEnteredFormat.textFormat(${lt.join(",")})`));const Ye=a$(Oe);if(Ye&&(Ze.backgroundColor=Ye,qe.push("userEnteredFormat.backgroundColor")),typeof Ve=="string"&&Ve!==""){const vt={Left:"LEFT",Center:"CENTER",Right:"RIGHT",Justify:"JUSTIFY"};Ze.horizontalAlignment=vt[Ve]||Ve.toUpperCase(),qe.push("userEnteredFormat.horizontalAlignment")}if(typeof Ie=="string"&&Ie!==""){const vt={Top:"TOP",Middle:"MIDDLE",Bottom:"BOTTOM"};Ze.verticalAlignment=vt[Ie]||Ie.toUpperCase(),qe.push("userEnteredFormat.verticalAlignment")}if(typeof $e=="string"&&$e!==""){const vt={"Overflow cell":"OVERFLOW_CELL","Wrap text":"WRAP","Clip text":"CLIP"};Ze.wrapStrategy=vt[$e]||$e.toUpperCase(),qe.push("userEnteredFormat.wrapStrategy")}if(qe.length===0)return{value:U.Success,result:{success:!0},error:null};const at={repeatCell:{range:Y,cell:{userEnteredFormat:Ze},fields:qe.join(",")}};return await re({method:"POST",endpoint:`/v4/spreadsheets/${G}:batchUpdate`,data:{requests:[at]}}),{value:U.Success,result:{success:!0},error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return oe.Logger.log("[Google Sheets] error:",T),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:T,result:null}}}})}}class act extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsSetNumberFormat,version:"1.0.0",description:"Set Number Format Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsSetNumberFormat);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=He(i,i.project,"setNumberFormat"),I="["+Fe(i,i.project,"Set number format")+": `"+g+"`] ",A=(ie,pe,me)=>{const ve=Fe(ie==null?void 0:ie.valueOwner,T==null?void 0:T.logic,pe),Ce=He(ie==null?void 0:ie.valueOwner,T==null?void 0:T.logic,me);return`"${ve}" (\`${Ce}\`)`},D=n.find(ie=>{var pe;return((pe=ie.valueOwner.declaration)==null?void 0:pe.id)===L.operation[le.GoogleSheetsSetNumberFormat].inputs.connection.id}),V=(s=D==null?void 0:D.value)==null?void 0:s.valueAsType;if(!V||!V.id||!V.name||V.type!==a.DefinitionEntity)throw new Error(`${I}The ${A(D,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const N=Mi(V);if(!N)throw new Error(`${I}The ${A(D,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(ie=>{var pe;return((pe=ie.valueOwner.declaration)==null?void 0:pe.id)===L.operation[le.GoogleSheetsSetNumberFormat].inputs.spreadsheetId.id}),G=(c=x==null?void 0:x.value)==null?void 0:c.value,K=Wn(G,{errorPrefix:`${I}The ${A(x,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(ie=>{var pe;return((pe=ie.valueOwner.declaration)==null?void 0:pe.id)===L.operation[le.GoogleSheetsSetNumberFormat].inputs.range.id}),H=(e=q==null?void 0:q.value)==null?void 0:e.value;if(H==null)throw new Error(`${I}The ${A(q,"Range","range")} input is missing.`);const ee={Authorization:`Bearer ${await T.getAccessToken()}`},re=`${(f=T.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v1/external-integrations/generic-proxy/${T.projectId}/${qt["google-sheet"]}/${N}`,Y=async ie=>Ht.post(re,ie,{headers:ee});await Md(H,"Id",async()=>(await Y({method:"GET",endpoint:`/v4/spreadsheets/${K}?fields=sheets.properties(sheetId,title)`})).data.sheets.map(pe=>({id:pe.properties.sheetId,name:pe.properties.title})));const Z=Cp(H,{errorPrefix:`${I}The ${A(q,"Range","range")} input `}),J=n.find(ie=>{var pe;return((pe=ie.valueOwner.declaration)==null?void 0:pe.id)===L.operation[le.GoogleSheetsSetNumberFormat].inputs.pattern.id}),ne=(y=J==null?void 0:J.value)==null?void 0:y.value;if(ne==null||ne==="")throw new Error(`${I}The ${A(J,"Pattern","pattern")} input is missing.`);if(typeof ne!="string")throw new Error(`${I}The ${A(J,"Pattern","pattern")} input value is invalid. It must be a string.`);const z={repeatCell:{range:Z,cell:{userEnteredFormat:{numberFormat:{type:"CUSTOM",pattern:ne}}},fields:"userEnteredFormat.numberFormat"}};return await Y({method:"POST",endpoint:`/v4/spreadsheets/${K}:batchUpdate`,data:{requests:[z]}}),{value:U.Success,result:{success:!0},error:null}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return oe.Logger.log("[Google Sheets] error:",g),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:g,result:null}}}})}}class sct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsMergeUnmergeCells,version:"1.0.0",description:"Merge or Unmerge Cells Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsMergeUnmergeCells);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m,T;try{const g=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!g||!g.env)throw new Error("Editor context or environment missing");const E=He(i,i.project,"mergeUnmergeCells"),A="["+Fe(i,i.project,"Merge/Unmerge cells")+": `"+E+"`] ",D=(ve,Ce,Oe)=>{const Ve=Fe(ve==null?void 0:ve.valueOwner,g==null?void 0:g.logic,Ce),Ie=He(ve==null?void 0:ve.valueOwner,g==null?void 0:g.logic,Oe);return`"${Ve}" (\`${Ie}\`)`},V=n.find(ve=>{var Ce;return((Ce=ve.valueOwner.declaration)==null?void 0:Ce.id)===L.operation[le.GoogleSheetsMergeUnmergeCells].inputs.connection.id}),N=(s=V==null?void 0:V.value)==null?void 0:s.valueAsType;if(!N||!N.id||!N.name||N.type!==a.DefinitionEntity)throw new Error(`${A}The ${D(V,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=Mi(N);if(!x)throw new Error(`${A}The ${D(V,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const G=n.find(ve=>{var Ce;return((Ce=ve.valueOwner.declaration)==null?void 0:Ce.id)===L.operation[le.GoogleSheetsMergeUnmergeCells].inputs.spreadsheetId.id}),K=(c=G==null?void 0:G.value)==null?void 0:c.value,q=Wn(K,{errorPrefix:`${A}The ${D(G,"Spreadsheet ID","spreadsheetId")} input `}),H=n.find(ve=>{var Ce;return((Ce=ve.valueOwner.declaration)==null?void 0:Ce.id)===L.operation[le.GoogleSheetsMergeUnmergeCells].inputs.range.id}),W=(e=H==null?void 0:H.value)==null?void 0:e.value;if(W==null)throw new Error(`${A}The ${D(H,"Range","range")} input is missing.`);const re={Authorization:`Bearer ${await g.getAccessToken()}`},Y=`${(f=g.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v1/external-integrations/generic-proxy/${g.projectId}/${qt["google-sheet"]}/${x}`,Z=async ve=>Ht.post(Y,ve,{headers:re});await Md(W,"Id",async()=>(await Z({method:"GET",endpoint:`/v4/spreadsheets/${q}?fields=sheets.properties(sheetId,title)`})).data.sheets.map(Ce=>({id:Ce.properties.sheetId,name:Ce.properties.title})));const J=Cp(W,{errorPrefix:`${A}The ${D(H,"Range","range")} input `}),ne=n.find(ve=>{var Ce;return((Ce=ve.valueOwner.declaration)==null?void 0:Ce.id)===L.operation[le.GoogleSheetsMergeUnmergeCells].inputs.merge.id}),z=!!((y=ne==null?void 0:ne.value)!=null&&y.value),ie=n.find(ve=>{var Ce;return((Ce=ve.valueOwner.declaration)==null?void 0:Ce.id)===L.operation[le.GoogleSheetsMergeUnmergeCells].inputs.mergeType.id}),pe=(m=ie==null?void 0:ie.value)==null?void 0:m.value;if(pe!=null&&typeof pe!="string")throw new Error(`${A}The ${D(ie,"Merge Type","mergeType")} input value is invalid, if present, it must be a string.`);const me=z?{mergeCells:{range:J,mergeType:pe||"MERGE_ALL"}}:{unmergeCells:{range:J}};return await Z({method:"POST",endpoint:`/v4/spreadsheets/${q}:batchUpdate`,data:{requests:[me]}}),{value:U.Success,result:{success:!0},error:null}}catch(g){const E=((T=g.response)==null?void 0:T.data)||g.message||g;return oe.Logger.log("[Google Sheets] error:",E),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:E,result:null}}}})}}class lct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsAutoResizeDimensions,version:"1.0.0",description:"Auto-Resize Dimensions Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsAutoResizeDimensions);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=He(i,i.project,"autoResizeDimensions"),E="["+Fe(i,i.project,"Auto-resize dimensions")+": `"+T+"`] ",I=(Z,J,ne)=>{const z=Fe(Z==null?void 0:Z.valueOwner,m==null?void 0:m.logic,J),ie=He(Z==null?void 0:Z.valueOwner,m==null?void 0:m.logic,ne);return`"${z}" (\`${ie}\`)`},A=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsAutoResizeDimensions].inputs.connection.id}),D=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!D||!D.id||!D.name||D.type!==a.DefinitionEntity)throw new Error(`${E}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const V=Mi(D);if(!V)throw new Error(`${E}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const N=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsAutoResizeDimensions].inputs.spreadsheetId.id}),x=(c=N==null?void 0:N.value)==null?void 0:c.value,G=Wn(x,{errorPrefix:`${E}The ${I(N,"Spreadsheet ID","spreadsheetId")} input `}),K=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsAutoResizeDimensions].inputs.range.id}),q=(e=K==null?void 0:K.value)==null?void 0:e.value;if(q==null)throw new Error(`${E}The ${I(K,"Range","range")} input is missing.`);const W={Authorization:`Bearer ${await m.getAccessToken()}`},ee=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v1/external-integrations/generic-proxy/${m.projectId}/${qt["google-sheet"]}/${V}`,re=async Z=>Ht.post(ee,Z,{headers:W});await Md(q,"Id",async()=>{var J;return(((J=(await re({method:"GET",endpoint:`/v4/spreadsheets/${G}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:J.sheets)||[]).map(ne=>{var z,ie;return{id:(z=ne.properties)==null?void 0:z.sheetId,name:(ie=ne.properties)==null?void 0:ie.title}})});const Y={autoResizeDimensions:{dimensions:gI(q,{errorPrefix:`${E}The ${I(K,"Range","range")} input `})}};return await re({method:"POST",endpoint:`/v4/spreadsheets/${G}:batchUpdate`,data:{requests:[Y]}}),{value:U.Success,result:{success:!0},error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return oe.Logger.log("[Google Sheets] error:",T),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:T,result:null}}}})}}class oct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsFindAndReplace,version:"1.0.0",description:"Find and Replace Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsFindAndReplace);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m,T,g,E,I,A,D,V;try{const N=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!N||!N.env)throw new Error("Editor context or environment missing");const x=He(i,i.project,"findAndReplace"),K="["+Fe(i,i.project,"Find and replace")+": `"+x+"`] ",q=(Ye,at,vt)=>{const _t=Fe(Ye==null?void 0:Ye.valueOwner,N==null?void 0:N.logic,at),bt=He(Ye==null?void 0:Ye.valueOwner,N==null?void 0:N.logic,vt);return`"${_t}" (\`${bt}\`)`},H=n.find(Ye=>{var at;return((at=Ye.valueOwner.declaration)==null?void 0:at.id)===L.operation[le.GoogleSheetsFindAndReplace].inputs.connection.id}),W=(s=H==null?void 0:H.value)==null?void 0:s.valueAsType;if(!W||!W.id||!W.name||W.type!==a.DefinitionEntity)throw new Error(`${K}The ${q(H,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const ee=Mi(W);if(!ee)throw new Error(`${K}The ${q(H,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const re=n.find(Ye=>{var at;return((at=Ye.valueOwner.declaration)==null?void 0:at.id)===L.operation[le.GoogleSheetsFindAndReplace].inputs.spreadsheetId.id}),Y=(c=re==null?void 0:re.value)==null?void 0:c.value,Z=Wn(Y,{errorPrefix:`${K}The ${q(re,"Spreadsheet ID","spreadsheetId")} input `}),J=n.find(Ye=>{var at;return((at=Ye.valueOwner.declaration)==null?void 0:at.id)===L.operation[le.GoogleSheetsFindAndReplace].inputs.range.id}),ne=(e=J==null?void 0:J.value)==null?void 0:e.value;if(ne==null)throw new Error(`${K}The ${q(J,"Range","range")} input is missing.`);const z=n.find(Ye=>{var at;return((at=Ye.valueOwner.declaration)==null?void 0:at.id)===L.operation[le.GoogleSheetsFindAndReplace].inputs.find.id}),ie=(f=z==null?void 0:z.value)==null?void 0:f.value;if(!ie||ie==="")throw new Error(`${K}The ${q(z,"Find","find")} input is missing.`);if(typeof ie!="string")throw new Error(`${K}The ${q(z,"Find","find")} input value is invalid. It must be a non-empty string.`);const pe=n.find(Ye=>{var at;return((at=Ye.valueOwner.declaration)==null?void 0:at.id)===L.operation[le.GoogleSheetsFindAndReplace].inputs.replace.id}),me=((y=pe==null?void 0:pe.value)==null?void 0:y.value)||"";if(typeof me!="string")throw new Error(`${K}The ${q(pe,"Replace","replace")} input value is invalid. It must be a string.`);const ve=n.find(Ye=>{var at;return((at=Ye.valueOwner.declaration)==null?void 0:at.id)===L.operation[le.GoogleSheetsFindAndReplace].inputs.matchCase.id}),Ce=!!((m=ve==null?void 0:ve.value)!=null&&m.value),Oe=n.find(Ye=>{var at;return((at=Ye.valueOwner.declaration)==null?void 0:at.id)===L.operation[le.GoogleSheetsFindAndReplace].inputs.matchEntireCell.id}),Ve=!!((T=Oe==null?void 0:Oe.value)!=null&&T.value),$e={Authorization:`Bearer ${await N.getAccessToken()}`},Ze=`${(g=N.env)==null?void 0:g.API_BASE_URL}/editor-runtime/v1/external-integrations/generic-proxy/${N.projectId}/${qt["google-sheet"]}/${ee}`,qe=async Ye=>Ht.post(Ze,Ye,{headers:$e}),rt={findReplace:{range:Cp(ne,{errorPrefix:`${K}The ${q(J,"Range","range")} input `}),find:ie,replacement:me,matchCase:Ce,matchEntireCell:Ve}},lt=await qe({method:"POST",endpoint:`/v4/spreadsheets/${Z}:batchUpdate`,data:{requests:[rt]}}),it=((E=lt.data)==null?void 0:E.data)||lt.data||{};return{value:U.Success,result:{occurrencesChanged:((D=(A=(I=it.replies)==null?void 0:I[0])==null?void 0:A.findReplace)==null?void 0:D.occurrencesChanged)||0},error:null}}catch(N){const x=((V=N.response)==null?void 0:V.data)||N.message||N;return oe.Logger.log("[Google Sheets] error:",x),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:x,result:null}}}})}}const s$={"List of items":"ONE_OF_LIST","List from cell range":"ONE_OF_RANGE","Number greater than":"NUMBER_GREATER","Number greater than or equal":"NUMBER_GREATER_THAN_EQ","Number less than":"NUMBER_LESS","Number less than or equal":"NUMBER_LESS_THAN_EQ","Number equal to":"NUMBER_EQ","Number not equal to":"NUMBER_NOT_EQ","Number between":"NUMBER_BETWEEN","Number not between":"NUMBER_NOT_BETWEEN","Text contains":"TEXT_CONTAINS","Text does not contain":"TEXT_NOT_CONTAINS","Text equals":"TEXT_EQ","Text is valid email":"TEXT_IS_EMAIL","Text is valid URL":"TEXT_IS_URL","Date is":"DATE_EQ","Date is before":"DATE_BEFORE","Date is after":"DATE_AFTER","Date is on or before":"DATE_ON_OR_BEFORE","Date is on or after":"DATE_ON_OR_AFTER","Date is between":"DATE_BETWEEN","Date is not between":"DATE_NOT_BETWEEN","Date is valid":"DATE_IS_VALID",Checkbox:"BOOLEAN","Custom formula":"CUSTOM_FORMULA"},_D={NUMBER_EQUAL:"NUMBER_EQ",NUMBER_NOT_EQUAL:"NUMBER_NOT_EQ",TEXT_DOES_NOT_CONTAIN:"TEXT_NOT_CONTAINS",TEXT_EQUAL:"TEXT_EQ",DATE_TIME_EQUAL:"DATE_EQ",DATE_EQUAL:"DATE_EQ"},Rrn=new Set([...Object.values(s$),...Object.keys(_D),...Object.values(_D)]);function dct(r){if(!r||typeof r!="string")return null;const u=r.trim();if(!u)return null;if(s$[u])return s$[u];const i=u.toUpperCase();return _D[i]?_D[i]:Rrn.has(i)?i:u}function Drn(r,u,i){if(r.length===0){i.push(new ft({id:`${u.id}--${ir.ConditionValuesInvalidFormula}`,message:'Custom formula condition requires a formula string starting with "=" (e.g., ["=SUM(A1:A10)>100"]).',severity:Ae.Error,code:ir.ConditionValuesInvalidFormula,entity:u}));return}r.length>1&&i.push(new ft({id:`${u.id}--${ir.ConditionValuesInvalidFormula}-count`,message:`Custom formula condition rule accepts only 1 formula string (e.g., ["=SUM(A1:A10)>100"]). You provided ${r.length} items.`,severity:Ae.Error,code:ir.ConditionValuesInvalidFormula,entity:u}));for(let n=0;n<r.length;n++){const s=String(r[n]).trim();s.startsWith("=")||i.push(new ft({id:`${u.id}--${ir.ConditionValuesInvalidFormula}-${n}`,message:`Custom formula "${s}" ${r.length>1?`(at index ${n}) `:""}is invalid. A custom formula must start with "=" (e.g., "=A1>100" or "=ISNUMBER(A1)").`,severity:Ae.Error,code:ir.ConditionValuesInvalidFormula,entity:u}))}}function Crn(r,u,i){if(r.length===0){i.push(new ft({id:`${u.id}--${ir.ConditionValuesSingleNumberRequired}`,message:'This numeric condition rule requires 1 numeric target value (e.g., ["100"]).',severity:Ae.Error,code:ir.ConditionValuesSingleNumberRequired,entity:u}));return}r.length>1&&i.push(new ft({id:`${u.id}--${ir.ConditionValuesSingleNumberRequired}-count`,message:`This numeric condition rule accepts only 1 numeric target value (e.g., ["100"]). You provided ${r.length} items.`,severity:Ae.Error,code:ir.ConditionValuesSingleNumberRequired,entity:u}));for(let n=0;n<r.length;n++){const s=String(r[n]).trim();(s===""||isNaN(Number(s)))&&i.push(new ft({id:`${u.id}--${ir.ConditionValuesSingleNumberRequired}-${n}`,message:`Condition value "${s}" ${r.length>1?`(at index ${n}) `:""}is invalid. It must be a valid number (e.g., "100").`,severity:Ae.Error,code:ir.ConditionValuesSingleNumberRequired,entity:u}))}}function wrn(r,u,i){r.length!==2&&i.push(new ft({id:`${u.id}--${ir.ConditionValuesTwoNumbersRequired}`,message:`A "between" condition rule requires exactly 2 boundary values (e.g., ["10", "50"] or ["2024-01-01", "2024-12-31"]). You provided ${r.length} items.`,severity:Ae.Error,code:ir.ConditionValuesTwoNumbersRequired,entity:u}))}function Orn(r,u,i){if(r.length===0){i.push(new ft({id:`${u.id}--${ir.ConditionValuesSingleRangeRequired}`,message:'The "List from cell range" rule requires a valid cell range in A1 notation (e.g., ["Sheet1!A1:A50"]).',severity:Ae.Error,code:ir.ConditionValuesSingleRangeRequired,entity:u}));return}r.length>1&&i.push(new ft({id:`${u.id}--${ir.ConditionValuesSingleRangeRequired}-count`,message:`The "List from cell range" rule accepts only 1 cell range in A1 notation (e.g., ["Sheet1!A1:A50"]). You provided ${r.length} items.`,severity:Ae.Error,code:ir.ConditionValuesSingleRangeRequired,entity:u}))}function Prn(r,u,i){r.length===0&&i.push(new ft({id:`${u.id}--${ir.ConditionValuesListEmpty}`,message:'The "List of items" rule requires at least one choice item (e.g., ["Pending", "Approved", "Rejected"]).',severity:Ae.Error,code:ir.ConditionValuesListEmpty,entity:u}))}function xrn(r,u,i){if(r.length===0){i.push(new ft({id:`${u.id}--${ir.ConditionValuesSingleTextRequired}`,message:'This text condition rule requires a non-empty text target value (e.g., ["important"]).',severity:Ae.Error,code:ir.ConditionValuesSingleTextRequired,entity:u}));return}r.length>1&&i.push(new ft({id:`${u.id}--${ir.ConditionValuesSingleTextRequired}-count`,message:`This text condition rule accepts only 1 text target value (e.g., ["important"]). You provided ${r.length} items.`,severity:Ae.Error,code:ir.ConditionValuesSingleTextRequired,entity:u}));for(let n=0;n<r.length;n++)String(r[n]).trim()===""&&i.push(new ft({id:`${u.id}--${ir.ConditionValuesSingleTextRequired}-${n}`,message:`Text target value ${r.length>1?`(at index ${n}) `:""}is empty. Expected a non-empty text string.`,severity:Ae.Error,code:ir.ConditionValuesSingleTextRequired,entity:u}))}function _rn(r,u,i){if(r.length===0){i.push(new ft({id:`${u.id}--${ir.ConditionValuesSingleTextRequired}`,message:'This date condition rule requires a target date or relative date string (e.g., ["2024-01-01"]).',severity:Ae.Error,code:ir.ConditionValuesSingleTextRequired,entity:u}));return}r.length>1&&i.push(new ft({id:`${u.id}--${ir.ConditionValuesSingleTextRequired}-count`,message:`This date condition rule accepts only 1 target date string (e.g., ["2024-01-01"]). You provided ${r.length} items.`,severity:Ae.Error,code:ir.ConditionValuesSingleTextRequired,entity:u}))}function Vrn(r,u,i){r.length>0&&i.push(new ft({id:`${u.id}--${ir.ConditionValuesNoValuesRequired}`,message:`This condition rule does not take any argument values (must be empty list []). You provided ${r.length} items.`,severity:Ae.Error,code:ir.ConditionValuesNoValuesRequired,entity:u}))}function Nrn(r,u,i,n){if(!u&&u!==0&&u!==!1)return;let s=[];if(typeof u=="string")try{const e=JSON.parse(u);s=Array.isArray(e)?e:[u]}catch{s=u.split(",").map(e=>e.trim()).filter(Boolean)}else Array.isArray(u)?s=u:s=[u];const c=dct(r);if(c)switch(c){case"CUSTOM_FORMULA":Drn(s,i,n);break;case"ONE_OF_LIST":Prn(s,i,n);break;case"ONE_OF_RANGE":Orn(s,i,n);break;case"NUMBER_GREATER":case"NUMBER_GREATER_THAN_EQ":case"NUMBER_LESS":case"NUMBER_LESS_THAN_EQ":case"NUMBER_EQUAL":case"NUMBER_NOT_EQUAL":Crn(s,i,n);break;case"NUMBER_BETWEEN":case"NUMBER_NOT_BETWEEN":case"DATE_BETWEEN":case"DATE_NOT_BETWEEN":wrn(s,i,n);break;case"TEXT_CONTAINS":case"TEXT_NOT_CONTAINS":case"TEXT_DOES_NOT_CONTAIN":case"TEXT_STARTS_WITH":case"TEXT_ENDS_WITH":case"TEXT_EQ":case"TEXT_EQUAL":xrn(s,i,n);break;case"DATE_EQ":case"DATE_TIME_EQUAL":case"DATE_BEFORE":case"DATE_AFTER":case"DATE_ON_OR_BEFORE":case"DATE_ON_OR_AFTER":_rn(s,i,n);break;case"TEXT_IS_EMAIL":case"TEXT_IS_URL":case"DATE_IS_VALID":case"BLANK":case"NOT_BLANK":case"BOOLEAN":Vrn(s,i,n);break}}function $rn(r){if(!r||typeof r!="string")return"A1";const u=r.split("!");return u[u.length-1].trim().split(":")[0].trim().replace(/\$/g,"")||"A1"}class uct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsAddDataValidation,version:"1.0.0",description:"Add Data Validation Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsAddDataValidation);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m,T;try{const g=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!g||!g.env)throw new Error("Editor context or environment missing");const E=He(i,i.project,"addDataValidation"),A="["+Fe(i,i.project,"Add data validation")+": `"+E+"`] ",D=(Ie,$e,Ze)=>{const qe=Fe(Ie==null?void 0:Ie.valueOwner,g==null?void 0:g.logic,$e),rt=He(Ie==null?void 0:Ie.valueOwner,g==null?void 0:g.logic,Ze);return`"${qe}" (\`${rt}\`)`},V=n.find(Ie=>{var $e;return(($e=Ie.valueOwner.declaration)==null?void 0:$e.id)===L.operation[le.GoogleSheetsAddDataValidation].inputs.connection.id}),N=(s=V==null?void 0:V.value)==null?void 0:s.valueAsType;if(!N||!N.id||!N.name||N.type!==a.DefinitionEntity)throw new Error(`${A}The ${D(V,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=Mi(N);if(!x)throw new Error(`${A}The ${D(V,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const G=n.find(Ie=>{var $e;return(($e=Ie.valueOwner.declaration)==null?void 0:$e.id)===L.operation[le.GoogleSheetsAddDataValidation].inputs.spreadsheetId.id}),K=(c=G==null?void 0:G.value)==null?void 0:c.value,q=Wn(K,{errorPrefix:`${A}The ${D(G,"Spreadsheet ID","spreadsheetId")} input `}),H=n.find(Ie=>{var $e;return(($e=Ie.valueOwner.declaration)==null?void 0:$e.id)===L.operation[le.GoogleSheetsAddDataValidation].inputs.range.id}),W=(e=H==null?void 0:H.value)==null?void 0:e.value;if(W==null)throw new Error(`${A}The ${D(H,"Range","range")} input is missing.`);const re={Authorization:`Bearer ${await g.getAccessToken()}`},Y=`${(f=g.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v1/external-integrations/generic-proxy/${g.projectId}/${qt["google-sheet"]}/${x}`,Z=async Ie=>Ht.post(Y,Ie,{headers:re});await Md(W,"Id",async()=>(await Z({method:"GET",endpoint:`/v4/spreadsheets/${q}?fields=sheets.properties(sheetId,title)`})).data.sheets.map($e=>({id:$e.properties.sheetId,name:$e.properties.title})));const J=Cp(W,{errorPrefix:`${A}The ${D(H,"Range","range")} input `}),ne=n.find(Ie=>{var $e;return(($e=Ie.valueOwner.declaration)==null?void 0:$e.id)===L.operation[le.GoogleSheetsAddDataValidation].inputs.conditionType.id}),z=(y=ne==null?void 0:ne.value)==null?void 0:y.value;if(!z||z==="")throw new Error(`${A}The ${D(ne,"Condition Type","conditionType")} input is missing.`);if(typeof z!="string")throw new Error(`${A}The ${D(ne,"Condition Type","conditionType")} input value is invalid. It must be a non-empty string.`);const ie=dct(z)||z,pe=n.find(Ie=>{var $e;return(($e=Ie.valueOwner.declaration)==null?void 0:$e.id)===L.operation[le.GoogleSheetsAddDataValidation].inputs.conditionValues.id}),me=(m=pe==null?void 0:pe.value)==null?void 0:m.value;let ve=me;if(typeof me=="string")try{ve=JSON.parse(me)}catch{ve=me.split(",").map($e=>$e.trim())}Array.isArray(ve)||(ve=ve?[ve]:[]);let Ce=ie,Oe=ve.map(Ie=>({userEnteredValue:String(Ie)}));if(ie==="TEXT_STARTS_WITH"||ie==="TEXT_ENDS_WITH"){const Ie=$rn(String(W)),$e=ve.length>0?String(ve[0]):"",Ze=$e.replace(/"/g,'""'),qe=ie==="TEXT_STARTS_WITH"?`=LEFT(${Ie}, ${$e.length})="${Ze}"`:`=RIGHT(${Ie}, ${$e.length})="${Ze}"`;Ce="CUSTOM_FORMULA",Oe=[{userEnteredValue:qe}]}const Ve={setDataValidation:{range:J,rule:{condition:{type:Ce,values:Oe},showCustomUi:!0}}};return await Z({method:"POST",endpoint:`/v4/spreadsheets/${q}:batchUpdate`,data:{requests:[Ve]}}),{value:U.Success,result:{success:!0},error:null}}catch(g){const E=((T=g.response)==null?void 0:T.data)||g.message||g;return oe.Logger.log("[Google Sheets] error:",E),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:E,result:null}}}})}}class pct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsSortRange,version:"1.0.0",description:"Sort Range Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsSortRange);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m,T;try{const g=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!g||!g.env)throw new Error("Editor context or environment missing");const E=He(i,i.project,"sortRange"),A="["+Fe(i,i.project,"Sort range")+": `"+E+"`] ",D=(Oe,Ve,Ie)=>{const $e=Fe(Oe==null?void 0:Oe.valueOwner,g==null?void 0:g.logic,Ve),Ze=He(Oe==null?void 0:Oe.valueOwner,g==null?void 0:g.logic,Ie);return`"${$e}" (\`${Ze}\`)`},V=n.find(Oe=>{var Ve;return((Ve=Oe.valueOwner.declaration)==null?void 0:Ve.id)===L.operation[le.GoogleSheetsSortRange].inputs.connection.id}),N=(s=V==null?void 0:V.value)==null?void 0:s.valueAsType;if(!N||!N.id||!N.name||N.type!==a.DefinitionEntity)throw new Error(`${A}The ${D(V,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=Mi(N);if(!x)throw new Error(`${A}The ${D(V,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const G=n.find(Oe=>{var Ve;return((Ve=Oe.valueOwner.declaration)==null?void 0:Ve.id)===L.operation[le.GoogleSheetsSortRange].inputs.spreadsheetId.id}),K=(c=G==null?void 0:G.value)==null?void 0:c.value,q=Wn(K,{errorPrefix:`${A}The ${D(G,"Spreadsheet ID","spreadsheetId")} input `}),H=n.find(Oe=>{var Ve;return((Ve=Oe.valueOwner.declaration)==null?void 0:Ve.id)===L.operation[le.GoogleSheetsSortRange].inputs.range.id}),W=(e=H==null?void 0:H.value)==null?void 0:e.value;if(W==null)throw new Error(`${A}The ${D(H,"Range","range")} input is missing.`);const re={Authorization:`Bearer ${await g.getAccessToken()}`},Y=`${(f=g.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v1/external-integrations/generic-proxy/${g.projectId}/${qt["google-sheet"]}/${x}`,Z=async Oe=>Ht.post(Y,Oe,{headers:re});await Md(W,"Id",async()=>(await Z({method:"GET",endpoint:`/v4/spreadsheets/${q}?fields=sheets.properties(sheetId,title)`})).data.sheets.map(Ve=>({id:Ve.properties.sheetId,name:Ve.properties.title})));const J=Cp(W,{errorPrefix:`${A}The ${D(H,"Range","range")} input `}),ne=n.find(Oe=>{var Ve;return((Ve=Oe.valueOwner.declaration)==null?void 0:Ve.id)===L.operation[le.GoogleSheetsSortRange].inputs.sortColumnIndex.id}),z=(y=ne==null?void 0:ne.value)==null?void 0:y.value;if(z==null)throw new Error(`${A}The ${D(ne,"Sort Column Index","sortColumnIndex")} input is missing.`);if(typeof z!="number")throw new Error(`${A}The ${D(ne,"Sort Column Index","sortColumnIndex")} input value is invalid. It must be a number.`);const ie=n.find(Oe=>{var Ve;return((Ve=Oe.valueOwner.declaration)==null?void 0:Ve.id)===L.operation[le.GoogleSheetsSortRange].inputs.sortOrder.id}),pe=(m=ie==null?void 0:ie.value)==null?void 0:m.value;if(pe==null||pe==="")throw new Error(`${A}The ${D(ie,"Sort Order","sortOrder")} input is missing.`);if(typeof pe!="string")throw new Error(`${A}The ${D(ie,"Sort Order","sortOrder")} input value is invalid. It must be a string.`);const ve={"Ascending (A-Z, 0-9)":"ASCENDING","Descending (Z-A, 9-0)":"DESCENDING",Ascending:"ASCENDING",Descending:"DESCENDING"}[pe]||pe.toUpperCase(),Ce={sortRange:{range:J,sortSpecs:[{dimensionIndex:z,sortOrder:ve}]}};return await Z({method:"POST",endpoint:`/v4/spreadsheets/${q}:batchUpdate`,data:{requests:[Ce]}}),{value:U.Success,result:{success:!0},error:null}}catch(g){const E=((T=g.response)==null?void 0:T.data)||g.message||g;return oe.Logger.log("[Google Sheets] error:",E),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:E,result:null}}}})}}class cct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsApplyClearFilter,version:"1.0.0",description:"Apply or Clear Filter Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsApplyClearFilter);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=He(i,i.project,"applyClearFilter"),I="["+Fe(i,i.project,"Apply or clear filter")+": `"+g+"`] ",A=(pe,me,ve)=>{const Ce=Fe(pe==null?void 0:pe.valueOwner,T==null?void 0:T.logic,me),Oe=He(pe==null?void 0:pe.valueOwner,T==null?void 0:T.logic,ve);return`"${Ce}" (\`${Oe}\`)`},D=n.find(pe=>{var me;return((me=pe.valueOwner.declaration)==null?void 0:me.id)===L.operation[le.GoogleSheetsApplyClearFilter].inputs.connection.id}),V=(s=D==null?void 0:D.value)==null?void 0:s.valueAsType;if(!V||!V.id||!V.name||V.type!==a.DefinitionEntity)throw new Error(`${I}The ${A(D,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const N=Mi(V);if(!N)throw new Error(`${I}The ${A(D,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(pe=>{var me;return((me=pe.valueOwner.declaration)==null?void 0:me.id)===L.operation[le.GoogleSheetsApplyClearFilter].inputs.spreadsheetId.id}),G=(c=x==null?void 0:x.value)==null?void 0:c.value,K=Wn(G,{errorPrefix:`${I}The ${A(x,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(pe=>{var me;return((me=pe.valueOwner.declaration)==null?void 0:me.id)===L.operation[le.GoogleSheetsApplyClearFilter].inputs.range.id}),H=(e=q==null?void 0:q.value)==null?void 0:e.value;if(H==null)throw new Error(`${I}The ${A(q,"Range","range")} input is missing.`);const ee={Authorization:`Bearer ${await T.getAccessToken()}`},re=`${(f=T.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v1/external-integrations/generic-proxy/${T.projectId}/${qt["google-sheet"]}/${N}`,Y=async pe=>Ht.post(re,pe,{headers:ee});await Md(H,"Id",async()=>(await Y({method:"GET",endpoint:`/v4/spreadsheets/${K}?fields=sheets.properties(sheetId,title)`})).data.sheets.map(me=>({id:me.properties.sheetId,name:me.properties.title})));const Z=Cp(H,{errorPrefix:`${I}The ${A(q,"Range","range")} input `}),J=n.find(pe=>{var me;return((me=pe.valueOwner.declaration)==null?void 0:me.id)===L.operation[le.GoogleSheetsApplyClearFilter].inputs.clearOnly.id}),ne=(y=J==null?void 0:J.value)==null?void 0:y.value;if(ne!=null&&typeof ne!="boolean")throw new Error(`${I}The ${A(J,"Clear Only","clearOnly")} input value is invalid. If present, it must be a boolean. E.g. true`);const z=Z.sheetId,ie=ne?{clearBasicFilter:{sheetId:z}}:{setBasicFilter:{filter:{range:Z}}};return await Y({method:"POST",endpoint:`/v4/spreadsheets/${K}:batchUpdate`,data:{requests:[ie]}}),{value:U.Success,result:{success:!0},error:null}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return oe.Logger.log("[Google Sheets] error:",g),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:g,result:null}}}})}}class fct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsUpdateSpreadsheetProperties,version:"1.0.0",description:"Update Spreadsheet Properties Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsUpdateSpreadsheetProperties);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m,T,g,E,I,A;try{const D=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!D||!D.env)throw new Error("Editor context or environment missing");const V=He(i,i.project,"updateSpreadsheetProperties"),x="["+Fe(i,i.project,"Update spreadsheet properties")+": `"+V+"`] ",G=(vt,_t,bt)=>{const ht=Fe(vt==null?void 0:vt.valueOwner,D==null?void 0:D.logic,_t),Zt=He(vt==null?void 0:vt.valueOwner,D==null?void 0:D.logic,bt);return`"${ht}" (\`${Zt}\`)`},K=n.find(vt=>{var _t;return((_t=vt.valueOwner.declaration)==null?void 0:_t.id)===L.operation[le.GoogleSheetsUpdateSpreadsheetProperties].inputs.connection.id}),q=(s=K==null?void 0:K.value)==null?void 0:s.valueAsType;if(!q||!q.id||!q.name||q.type!==a.DefinitionEntity)throw new Error(`${x}The ${G(K,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const H=Mi(q);if(!H)throw new Error(`${x}The ${G(K,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const W=n.find(vt=>{var _t;return((_t=vt.valueOwner.declaration)==null?void 0:_t.id)===L.operation[le.GoogleSheetsUpdateSpreadsheetProperties].inputs.spreadsheetId.id}),ee=(c=W==null?void 0:W.value)==null?void 0:c.value,re=Wn(ee,{errorPrefix:`${x}The ${G(W,"Spreadsheet ID","spreadsheetId")} input `}),Y=n.find(vt=>{var _t;return((_t=vt.valueOwner.declaration)==null?void 0:_t.id)===L.operation[le.GoogleSheetsUpdateSpreadsheetProperties].inputs.title.id}),Z=(e=Y==null?void 0:Y.value)==null?void 0:e.value;if(Z!=null&&typeof Z!="string")throw new Error(`${x}The ${G(Y,"Title","title")} input value is invalid. If present, it must be a string. E.g. "My Spreadsheet"`);const J=n.find(vt=>{var _t;return((_t=vt.valueOwner.declaration)==null?void 0:_t.id)===L.operation[le.GoogleSheetsUpdateSpreadsheetProperties].inputs.locale.id}),ne=(f=J==null?void 0:J.value)==null?void 0:f.value;if(ne!=null&&typeof ne!="string")throw new Error(`${x}The ${G(J,"Locale","locale")} input value is invalid. If present, it must be a string. E.g. "en_US"`);const z=n.find(vt=>{var _t;return((_t=vt.valueOwner.declaration)==null?void 0:_t.id)===L.operation[le.GoogleSheetsUpdateSpreadsheetProperties].inputs.timeZone.id}),ie=(y=z==null?void 0:z.value)==null?void 0:y.value;if(ie!=null&&typeof ie!="string")throw new Error(`${x}The ${G(z,"Time Zone","timeZone")} input value is invalid. If present, it must be a string. E.g. "America/New_York"`);const pe=n.find(vt=>{var _t;return((_t=vt.valueOwner.declaration)==null?void 0:_t.id)===L.operation[le.GoogleSheetsUpdateSpreadsheetProperties].inputs.autoRecalc.id}),me=(m=pe==null?void 0:pe.value)==null?void 0:m.value;if(me!=null&&typeof me!="string")throw new Error(`${x}The ${G(pe,"Auto Recalculation","autoRecalc")} input value is invalid. If present, it must be a string enum value. E.g. "ON_CHANGE"`);const ve=n.find(vt=>{var _t;return((_t=vt.valueOwner.declaration)==null?void 0:_t.id)===L.operation[le.GoogleSheetsUpdateSpreadsheetProperties].inputs.defaultFormat.id}),Ce=(T=ve==null?void 0:ve.value)==null?void 0:T.value;if(Ce!=null&&(typeof Ce!="object"||Array.isArray(Ce)))throw new Error(`${x}The ${G(ve,"Default Format","defaultFormat")} input value is invalid. If present, it must be an object representing the CellFormat.`);const Oe=n.find(vt=>{var _t;return((_t=vt.valueOwner.declaration)==null?void 0:_t.id)===L.operation[le.GoogleSheetsUpdateSpreadsheetProperties].inputs.iterativeCalculationSettings.id}),Ve=(g=Oe==null?void 0:Oe.value)==null?void 0:g.value;if(Ve!=null&&(typeof Ve!="object"||Array.isArray(Ve)))throw new Error(`${x}The ${G(Oe,"Iterative Calculation Settings","iterativeCalculationSettings")} input value is invalid. If present, it must be an object.`);const Ie=n.find(vt=>{var _t;return((_t=vt.valueOwner.declaration)==null?void 0:_t.id)===L.operation[le.GoogleSheetsUpdateSpreadsheetProperties].inputs.spreadsheetTheme.id}),$e=(E=Ie==null?void 0:Ie.value)==null?void 0:E.value;if($e!=null&&(typeof $e!="object"||Array.isArray($e)))throw new Error(`${x}The ${G(Ie,"Spreadsheet Theme","spreadsheetTheme")} input value is invalid. If present, it must be an object.`);const Ze={};if(Z!=null&&(Ze.title=Z),ne!=null&&(Ze.locale=ne),ie!=null&&(Ze.timeZone=ie),me!=null){const vt={"On change":"ON_CHANGE","Every minute":"MINUTE","Every hour":"HOUR"};Ze.autoRecalc=vt[me]||me.toUpperCase()}Ce!=null&&(Ze.defaultFormat=Ce),Ve!=null&&(Ze.iterativeCalculationSettings=Ve),$e!=null&&(Ze.spreadsheetTheme=$e);const qe=(vt,_t="")=>{let bt=[];for(const ht in vt){if(!Object.prototype.hasOwnProperty.call(vt,ht))continue;const Zt=vt[ht],pt=_t?`${_t}.${ht}`:ht;Zt!==null&&typeof Zt=="object"&&!Array.isArray(Zt)&&Object.keys(Zt).length>0?bt.push(...qe(Zt,pt)):bt.push(pt)}return bt},rt=qe(Ze);if(rt.length===0)throw new Error(`${x}At least one property must be provided to update.`);const it={Authorization:`Bearer ${await D.getAccessToken()}`},Ye=`${(I=D.env)==null?void 0:I.API_BASE_URL}/editor-runtime/v1/external-integrations/generic-proxy/${D.projectId}/${qt["google-sheet"]}/${H}`;return await(async vt=>Ht.post(Ye,vt,{headers:it}))({method:"POST",endpoint:`/v4/spreadsheets/${re}:batchUpdate`,data:{requests:[{updateSpreadsheetProperties:{properties:Ze,fields:rt.join(",")}}]}}),{value:U.Success,result:{success:!0},error:null}}catch(D){const V=((A=D.response)==null?void 0:A.data)||D.message||D;return oe.Logger.log("[Google Sheets] error:",V),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:V,result:null}}}})}}const Ib=(r,u)=>(oe.Logger.log("[Google Sheets Clone Sheet] error:",u),{value:r.catchesError||r.errorCalls.length?U.CaughtError:U.UnhandledError,error:u,result:null});class yct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsCloneSheet,version:"1.0.0",description:"Google Sheets clone sheet operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsCloneSheet);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m,T,g,E,I,A,D,V,N,x,G,K,q,H,W,ee;try{const re=L.operation[le.GoogleSheetsCloneSheet],Y=((c=(s=n.find(lt=>{var it,Ye;return((Ye=(it=lt.valueOwner)==null?void 0:it.declaration)==null?void 0:Ye.id)===re.inputs.connection.id}))==null?void 0:s.value)==null?void 0:c.valueAsType)??((f=(e=n.find(lt=>{var it,Ye;return((Ye=(it=lt.valueOwner)==null?void 0:it.declaration)==null?void 0:Ye.id)===re.inputs.connection.id}))==null?void 0:e.value)==null?void 0:f.value);if(!(Y instanceof Ga))return Ib(i,"Invalid or missing connection entity");const Z=(m=(y=n.find(lt=>{var it,Ye;return((Ye=(it=lt.valueOwner)==null?void 0:it.declaration)==null?void 0:Ye.id)===re.inputs.spreadsheetId.id}))==null?void 0:y.value)==null?void 0:m.value;if(!Z)return Ib(i,"Missing required input: spreadsheetId");const J=Wn(Z),ne=(g=(T=n.find(lt=>{var it,Ye;return((Ye=(it=lt.valueOwner)==null?void 0:it.declaration)==null?void 0:Ye.id)===re.inputs.sheet.id}))==null?void 0:T.value)==null?void 0:g.value;if(ne==null||ne==="")return Ib(i,"Missing required input: sheet");const z=(I=(E=n.find(lt=>{var it,Ye;return((Ye=(it=lt.valueOwner)==null?void 0:it.declaration)==null?void 0:Ye.id)===re.inputs.newSheetName.id}))==null?void 0:E.value)==null?void 0:I.value,ie=(D=(A=n.find(lt=>{var it,Ye;return((Ye=(it=lt.valueOwner)==null?void 0:it.declaration)==null?void 0:Ye.id)===re.inputs.insertIndex.id}))==null?void 0:A.value)==null?void 0:D.value,pe=this.extensionsRegistry.requestContexts(this,[X.Editor])[0],me=Mi(Y),Ce={Authorization:`Bearer ${await pe.getAccessToken()}`},Oe=`${(V=pe.env)==null?void 0:V.API_BASE_URL}/editor-runtime/v1/external-integrations/generic-proxy/${pe.projectId}/${qt["google-sheet"]}/${me}`,Ve=async lt=>Ht.post(Oe,lt,{headers:Ce});let Ie;if(!isNaN(Number(ne)))Ie=Number(ne);else{const lt=await Ve({method:"GET",endpoint:`/v4/spreadsheets/${J}`}),Ye=(((x=(N=lt.data)==null?void 0:N.data)==null?void 0:x.sheets)||((G=lt.data)==null?void 0:G.sheets)||[]).find(at=>{var vt;return((vt=at.properties)==null?void 0:vt.title)===String(ne)});if(!Ye)return Ib(i,`Could not find sheet with name "${ne}"`);Ie=Ye.properties.sheetId}const $e={sourceSheetId:Ie};z&&($e.newSheetName=z),typeof ie=="number"&&($e.insertSheetIndex=ie);const Ze=await Ve({method:"POST",endpoint:`/v4/spreadsheets/${J}:batchUpdate`,data:{requests:[{duplicateSheet:$e}]}}),rt=((W=(H=(q=(((K=Ze.data)==null?void 0:K.data)||Ze.data||{}).replies)==null?void 0:q[0])==null?void 0:H.duplicateSheet)==null?void 0:W.properties)||{};return{value:U.Success,error:null,result:{newSheetId:rt.sheetId,newSheetName:rt.title}}}catch(re){const Y=((ee=re.response)==null?void 0:ee.data)||re.message||re;return Ib(i,Y)}}})}}class hct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsDeleteChart,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsDeleteChart);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=He(i,i.project,"deleteChart"),E="["+Fe(i,i.project,"Delete Chart")+": `"+T+"`] ",I=(Z,J,ne)=>{const z=Fe(Z==null?void 0:Z.valueOwner,m==null?void 0:m.logic,J),ie=He(Z==null?void 0:Z.valueOwner,m==null?void 0:m.logic,ne);return`"${z}" (\`${ie}\`)`},A=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsDeleteChart].inputs.connection.id}),D=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!D||!D.id||!D.name||D.type!==a.DefinitionEntity)throw new Error(`${E}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const V=Mi(D);if(!V)throw new Error(`${E}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const N=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsDeleteChart].inputs.spreadsheetId.id}),x=(c=N==null?void 0:N.value)==null?void 0:c.value,G=Wn(x,{errorPrefix:`${E}The ${I(N,"Spreadsheet ID","spreadsheetId")} input `}),K=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsDeleteChart].inputs.chartId.id}),q=(e=K==null?void 0:K.value)==null?void 0:e.value;if(q==null)throw new Error(`${E}The ${I(K,"chartId","chartId")} input is missing.`);const W={Authorization:`Bearer ${await m.getAccessToken()}`},ee=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v1/external-integrations/generic-proxy/${m.projectId}/${qt["google-sheet"]}/${V}`,re=async Z=>Ht.post(ee,Z,{headers:W});let Y={};return Y.deleteChart={chartId:typeof q=="string"&&q.trim().startsWith("{")?JSON.parse(q):q},await re({method:"POST",endpoint:`/v4/spreadsheets/${G}:batchUpdate`,data:{requests:[Y]}}),{value:U.Success,result:{success:!0},error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return oe.Logger.log("[Google Sheets] error:",T),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:T,result:null}}}})}}class mct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsDeletePivotTable,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsDeletePivotTable);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=He(i,i.project,"deletePivotTable"),E="["+Fe(i,i.project,"Delete Pivot Table")+": `"+T+"`] ",I=(Z,J,ne)=>{const z=Fe(Z==null?void 0:Z.valueOwner,m==null?void 0:m.logic,J),ie=He(Z==null?void 0:Z.valueOwner,m==null?void 0:m.logic,ne);return`"${z}" (\`${ie}\`)`},A=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsDeletePivotTable].inputs.connection.id}),D=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!D||!D.id||!D.name||D.type!==a.DefinitionEntity)throw new Error(`${E}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const V=Mi(D);if(!V)throw new Error(`${E}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const N=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsDeletePivotTable].inputs.spreadsheetId.id}),x=(c=N==null?void 0:N.value)==null?void 0:c.value,G=Wn(x,{errorPrefix:`${E}The ${I(N,"Spreadsheet ID","spreadsheetId")} input `}),K=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsDeletePivotTable].inputs.destination.id}),q=(e=K==null?void 0:K.value)==null?void 0:e.value;if(q==null)throw new Error(`${E}The ${I(K,"destination","destination")} input is missing.`);const W={Authorization:`Bearer ${await m.getAccessToken()}`},ee=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v1/external-integrations/generic-proxy/${m.projectId}/${qt["google-sheet"]}/${V}`,re=async Z=>Ht.post(ee,Z,{headers:W});let Y={updateCells:{start:typeof q=="string"&&q.trim().startsWith("{")?JSON.parse(q):q,rows:[{values:[{pivotTable:null}]}],fields:"pivotTable"}};return await re({method:"POST",endpoint:`/v4/spreadsheets/${G}:batchUpdate`,data:{requests:[Y]}}),{value:U.Success,result:{success:!0},error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return oe.Logger.log("[Google Sheets] error:",T),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:T,result:null}}}})}}class Tct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsDeleteDimension,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsDeleteDimension);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=He(i,i.project,"deleteDimension"),E="["+Fe(i,i.project,"Delete Dimension")+": `"+T+"`] ",I=(Z,J,ne)=>{const z=Fe(Z==null?void 0:Z.valueOwner,m==null?void 0:m.logic,J),ie=He(Z==null?void 0:Z.valueOwner,m==null?void 0:m.logic,ne);return`"${z}" (\`${ie}\`)`},A=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsDeleteDimension].inputs.connection.id}),D=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!D||!D.id||!D.name||D.type!==a.DefinitionEntity)throw new Error(`${E}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const V=Mi(D);if(!V)throw new Error(`${E}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const N=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsDeleteDimension].inputs.spreadsheetId.id}),x=(c=N==null?void 0:N.value)==null?void 0:c.value,G=Wn(x,{errorPrefix:`${E}The ${I(N,"Spreadsheet ID","spreadsheetId")} input `}),K=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsDeleteDimension].inputs.range.id}),q=(e=K==null?void 0:K.value)==null?void 0:e.value;if(q==null)throw new Error(`${E}The ${I(K,"range","range")} input is missing.`);const W={Authorization:`Bearer ${await m.getAccessToken()}`},ee=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v1/external-integrations/generic-proxy/${m.projectId}/${qt["google-sheet"]}/${V}`,re=async Z=>Ht.post(ee,Z,{headers:W});let Y={};return Y.deleteDimension={range:gI(q,{errorPrefix:`${E}The ${I(K,"Range","range")} input `})},await re({method:"POST",endpoint:`/v4/spreadsheets/${G}:batchUpdate`,data:{requests:[Y]}}),{value:U.Success,result:{success:!0},error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return oe.Logger.log("[Google Sheets] error:",T),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:T,result:null}}}})}}class vct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsDeleteProtectedRange,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsDeleteProtectedRange);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=He(i,i.project,"deleteProtectedRange"),E="["+Fe(i,i.project,"Delete Protected Range")+": `"+T+"`] ",I=(Z,J,ne)=>{const z=Fe(Z==null?void 0:Z.valueOwner,m==null?void 0:m.logic,J),ie=He(Z==null?void 0:Z.valueOwner,m==null?void 0:m.logic,ne);return`"${z}" (\`${ie}\`)`},A=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsDeleteProtectedRange].inputs.connection.id}),D=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!D||!D.id||!D.name||D.type!==a.DefinitionEntity)throw new Error(`${E}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const V=Mi(D);if(!V)throw new Error(`${E}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const N=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsDeleteProtectedRange].inputs.spreadsheetId.id}),x=(c=N==null?void 0:N.value)==null?void 0:c.value,G=Wn(x,{errorPrefix:`${E}The ${I(N,"Spreadsheet ID","spreadsheetId")} input `}),K=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsDeleteProtectedRange].inputs.protectedRangeId.id}),q=(e=K==null?void 0:K.value)==null?void 0:e.value;if(q==null)throw new Error(`${E}The ${I(K,"protectedRangeId","protectedRangeId")} input is missing.`);const W={Authorization:`Bearer ${await m.getAccessToken()}`},ee=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v1/external-integrations/generic-proxy/${m.projectId}/${qt["google-sheet"]}/${V}`,re=async Z=>Ht.post(ee,Z,{headers:W});let Y={};return Y.deleteProtectedRange={protectedRangeId:typeof q=="string"&&q.trim().startsWith("{")?JSON.parse(q):q},await re({method:"POST",endpoint:`/v4/spreadsheets/${G}:batchUpdate`,data:{requests:[Y]}}),{value:U.Success,result:{success:!0},error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return oe.Logger.log("[Google Sheets] error:",T),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:T,result:null}}}})}}class gct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsAddBanding,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsAddBanding);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=He(i,i.project,"addBanding"),E="["+Fe(i,i.project,"Add Banding")+": `"+T+"`] ",I=(Z,J,ne)=>{const z=Fe(Z==null?void 0:Z.valueOwner,m==null?void 0:m.logic,J),ie=He(Z==null?void 0:Z.valueOwner,m==null?void 0:m.logic,ne);return`"${z}" (\`${ie}\`)`},A=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsAddBanding].inputs.connection.id}),D=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!D||!D.id||!D.name||D.type!==a.DefinitionEntity)throw new Error(`${E}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const V=Mi(D);if(!V)throw new Error(`${E}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const N=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsAddBanding].inputs.spreadsheetId.id}),x=(c=N==null?void 0:N.value)==null?void 0:c.value,G=Wn(x,{errorPrefix:`${E}The ${I(N,"Spreadsheet ID","spreadsheetId")} input `}),K=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsAddBanding].inputs.bandedRange.id}),q=(e=K==null?void 0:K.value)==null?void 0:e.value;if(q==null)throw new Error(`${E}The ${I(K,"bandedRange","bandedRange")} input is missing.`);const W={Authorization:`Bearer ${await m.getAccessToken()}`},ee=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v1/external-integrations/generic-proxy/${m.projectId}/${qt["google-sheet"]}/${V}`,re=async Z=>Ht.post(ee,Z,{headers:W});let Y={};return Y.addBanding={bandedRange:Cp(q,{errorPrefix:`${E}The ${I(K,"bandedRange","bandedRange")} input `})},await re({method:"POST",endpoint:`/v4/spreadsheets/${G}:batchUpdate`,data:{requests:[Y]}}),{value:U.Success,result:{success:!0},error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return oe.Logger.log("[Google Sheets] error:",T),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:T,result:null}}}})}}class bct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsAddChart,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsAddChart);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=He(i,i.project,"addChart"),E="["+Fe(i,i.project,"Add Chart")+": `"+T+"`] ",I=(Z,J,ne)=>{const z=Fe(Z==null?void 0:Z.valueOwner,m==null?void 0:m.logic,J),ie=He(Z==null?void 0:Z.valueOwner,m==null?void 0:m.logic,ne);return`"${z}" (\`${ie}\`)`},A=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsAddChart].inputs.connection.id}),D=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!D||!D.id||!D.name||D.type!==a.DefinitionEntity)throw new Error(`${E}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const V=Mi(D);if(!V)throw new Error(`${E}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const N=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsAddChart].inputs.spreadsheetId.id}),x=(c=N==null?void 0:N.value)==null?void 0:c.value,G=Wn(x,{errorPrefix:`${E}The ${I(N,"Spreadsheet ID","spreadsheetId")} input `}),K=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsAddChart].inputs.chart.id}),q=(e=K==null?void 0:K.value)==null?void 0:e.value;if(q==null)throw new Error(`${E}The ${I(K,"chart","chart")} input is missing.`);const W={Authorization:`Bearer ${await m.getAccessToken()}`},ee=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v1/external-integrations/generic-proxy/${m.projectId}/${qt["google-sheet"]}/${V}`,re=async Z=>Ht.post(ee,Z,{headers:W});let Y={};return Y.addChart={chart:typeof q=="string"&&q.trim().startsWith("{")?JSON.parse(q):q},await re({method:"POST",endpoint:`/v4/spreadsheets/${G}:batchUpdate`,data:{requests:[Y]}}),{value:U.Success,result:{success:!0},error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return oe.Logger.log("[Google Sheets] error:",T),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:T,result:null}}}})}}class Ect extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsAddConditionalFormatRule,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsAddConditionalFormatRule);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=He(i,i.project,"addConditionalFormatRule"),E="["+Fe(i,i.project,"Add Conditional Format Rule")+": `"+T+"`] ",I=(Z,J,ne)=>{const z=Fe(Z==null?void 0:Z.valueOwner,m==null?void 0:m.logic,J),ie=He(Z==null?void 0:Z.valueOwner,m==null?void 0:m.logic,ne);return`"${z}" (\`${ie}\`)`},A=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsAddConditionalFormatRule].inputs.connection.id}),D=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!D||!D.id||!D.name||D.type!==a.DefinitionEntity)throw new Error(`${E}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const V=Mi(D);if(!V)throw new Error(`${E}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const N=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsAddConditionalFormatRule].inputs.spreadsheetId.id}),x=(c=N==null?void 0:N.value)==null?void 0:c.value,G=Wn(x,{errorPrefix:`${E}The ${I(N,"Spreadsheet ID","spreadsheetId")} input `}),K=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsAddConditionalFormatRule].inputs.rule.id}),q=(e=K==null?void 0:K.value)==null?void 0:e.value;if(q==null)throw new Error(`${E}The ${I(K,"rule","rule")} input is missing.`);const W={Authorization:`Bearer ${await m.getAccessToken()}`},ee=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v1/external-integrations/generic-proxy/${m.projectId}/${qt["google-sheet"]}/${V}`,re=async Z=>Ht.post(ee,Z,{headers:W});let Y={};return Y.addConditionalFormatRule={rule:typeof q=="string"&&q.trim().startsWith("{")?JSON.parse(q):q},await re({method:"POST",endpoint:`/v4/spreadsheets/${G}:batchUpdate`,data:{requests:[Y]}}),{value:U.Success,result:{success:!0},error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return oe.Logger.log("[Google Sheets] error:",T),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:T,result:null}}}})}}class Act extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsAddProtectedRange,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsAddProtectedRange);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=He(i,i.project,"addProtectedRange"),E="["+Fe(i,i.project,"Add Protected Range")+": `"+T+"`] ",I=(Z,J,ne)=>{const z=Fe(Z==null?void 0:Z.valueOwner,m==null?void 0:m.logic,J),ie=He(Z==null?void 0:Z.valueOwner,m==null?void 0:m.logic,ne);return`"${z}" (\`${ie}\`)`},A=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsAddProtectedRange].inputs.connection.id}),D=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!D||!D.id||!D.name||D.type!==a.DefinitionEntity)throw new Error(`${E}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const V=Mi(D);if(!V)throw new Error(`${E}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const N=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsAddProtectedRange].inputs.spreadsheetId.id}),x=(c=N==null?void 0:N.value)==null?void 0:c.value,G=Wn(x,{errorPrefix:`${E}The ${I(N,"Spreadsheet ID","spreadsheetId")} input `}),K=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsAddProtectedRange].inputs.protectedRange.id}),q=(e=K==null?void 0:K.value)==null?void 0:e.value;if(q==null)throw new Error(`${E}The ${I(K,"protectedRange","protectedRange")} input is missing.`);const W={Authorization:`Bearer ${await m.getAccessToken()}`},ee=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v1/external-integrations/generic-proxy/${m.projectId}/${qt["google-sheet"]}/${V}`,re=async Z=>Ht.post(ee,Z,{headers:W});let Y={};return Y.addProtectedRange={protectedRange:typeof q=="string"&&q.trim().startsWith("{")?JSON.parse(q):q},await re({method:"POST",endpoint:`/v4/spreadsheets/${G}:batchUpdate`,data:{requests:[Y]}}),{value:U.Success,result:{success:!0},error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return oe.Logger.log("[Google Sheets] error:",T),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:T,result:null}}}})}}class Ict extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsUpdateChartSpec,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsUpdateChartSpec);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=He(i,i.project,"updateChartSpec"),I="["+Fe(i,i.project,"Update Chart Spec")+": `"+g+"`] ",A=(z,ie,pe)=>{const me=Fe(z==null?void 0:z.valueOwner,T==null?void 0:T.logic,ie),ve=He(z==null?void 0:z.valueOwner,T==null?void 0:T.logic,pe);return`"${me}" (\`${ve}\`)`},D=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsUpdateChartSpec].inputs.connection.id}),V=(s=D==null?void 0:D.value)==null?void 0:s.valueAsType;if(!V||!V.id||!V.name||V.type!==a.DefinitionEntity)throw new Error(`${I}The ${A(D,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const N=Mi(V);if(!N)throw new Error(`${I}The ${A(D,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsUpdateChartSpec].inputs.spreadsheetId.id}),G=(c=x==null?void 0:x.value)==null?void 0:c.value,K=Wn(G,{errorPrefix:`${I}The ${A(x,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsUpdateChartSpec].inputs.chartId.id}),H=(e=q==null?void 0:q.value)==null?void 0:e.value;if(H==null)throw new Error(`${I}The ${A(q,"chartId","chartId")} input is missing.`);const W=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsUpdateChartSpec].inputs.chart.id}),ee=(f=W==null?void 0:W.value)==null?void 0:f.value;if(ee==null)throw new Error(`${I}The ${A(W,"chart","chart")} input is missing.`);const Y={Authorization:`Bearer ${await T.getAccessToken()}`},Z=`${(y=T.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v1/external-integrations/generic-proxy/${T.projectId}/${qt["google-sheet"]}/${N}`,J=async z=>Ht.post(Z,z,{headers:Y});let ne={};return ne.updateChartSpec={chartId:typeof H=="string"&&H.trim().startsWith("{")?JSON.parse(H):H,chart:typeof ee=="string"&&ee.trim().startsWith("{")?JSON.parse(ee):ee},await J({method:"POST",endpoint:`/v4/spreadsheets/${K}:batchUpdate`,data:{requests:[ne]}}),{value:U.Success,result:{success:!0},error:null}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return oe.Logger.log("[Google Sheets] error:",g),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:g,result:null}}}})}}class Rct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsCreatePivotTable,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsCreatePivotTable);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=He(i,i.project,"createPivotTable"),I="["+Fe(i,i.project,"Create Pivot Table")+": `"+g+"`] ",A=(z,ie,pe)=>{const me=Fe(z==null?void 0:z.valueOwner,T==null?void 0:T.logic,ie),ve=He(z==null?void 0:z.valueOwner,T==null?void 0:T.logic,pe);return`"${me}" (\`${ve}\`)`},D=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsCreatePivotTable].inputs.connection.id}),V=(s=D==null?void 0:D.value)==null?void 0:s.valueAsType;if(!V||!V.id||!V.name||V.type!==a.DefinitionEntity)throw new Error(`${I}The ${A(D,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const N=Mi(V);if(!N)throw new Error(`${I}The ${A(D,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsCreatePivotTable].inputs.spreadsheetId.id}),G=(c=x==null?void 0:x.value)==null?void 0:c.value,K=Wn(G,{errorPrefix:`${I}The ${A(x,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsCreatePivotTable].inputs.destination.id}),H=(e=q==null?void 0:q.value)==null?void 0:e.value;if(H==null)throw new Error(`${I}The ${A(q,"destination","destination")} input is missing.`);const W=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsCreatePivotTable].inputs.pivotTable.id}),ee=(f=W==null?void 0:W.value)==null?void 0:f.value;if(ee==null)throw new Error(`${I}The ${A(W,"pivotTable","pivotTable")} input is missing.`);const Y={Authorization:`Bearer ${await T.getAccessToken()}`},Z=`${(y=T.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v1/external-integrations/generic-proxy/${T.projectId}/${qt["google-sheet"]}/${N}`,J=async z=>Ht.post(Z,z,{headers:Y});let ne={updateCells:{start:typeof H=="string"&&H.trim().startsWith("{")?JSON.parse(H):H,rows:[{values:[{pivotTable:typeof ee=="string"&&ee.trim().startsWith("{")?JSON.parse(ee):ee}]}],fields:"pivotTable"}};return await J({method:"POST",endpoint:`/v4/spreadsheets/${K}:batchUpdate`,data:{requests:[ne]}}),{value:U.Success,result:{success:!0},error:null}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return oe.Logger.log("[Google Sheets] error:",g),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:g,result:null}}}})}}class Dct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsInsertDimension,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsInsertDimension);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=He(i,i.project,"insertDimension"),I="["+Fe(i,i.project,"Insert Dimension")+": `"+g+"`] ",A=(z,ie,pe)=>{const me=Fe(z==null?void 0:z.valueOwner,T==null?void 0:T.logic,ie),ve=He(z==null?void 0:z.valueOwner,T==null?void 0:T.logic,pe);return`"${me}" (\`${ve}\`)`},D=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsInsertDimension].inputs.connection.id}),V=(s=D==null?void 0:D.value)==null?void 0:s.valueAsType;if(!V||!V.id||!V.name||V.type!==a.DefinitionEntity)throw new Error(`${I}The ${A(D,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const N=Mi(V);if(!N)throw new Error(`${I}The ${A(D,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsInsertDimension].inputs.spreadsheetId.id}),G=(c=x==null?void 0:x.value)==null?void 0:c.value,K=Wn(G,{errorPrefix:`${I}The ${A(x,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsInsertDimension].inputs.range.id}),H=(e=q==null?void 0:q.value)==null?void 0:e.value;if(H==null)throw new Error(`${I}The ${A(q,"range","range")} input is missing.`);const W=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsInsertDimension].inputs.inheritFromBefore.id}),ee=(f=W==null?void 0:W.value)==null?void 0:f.value;if(ee==null)throw new Error(`${I}The ${A(W,"inheritFromBefore","inheritFromBefore")} input is missing.`);const Y={Authorization:`Bearer ${await T.getAccessToken()}`},Z=`${(y=T.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v1/external-integrations/generic-proxy/${T.projectId}/${qt["google-sheet"]}/${N}`,J=async z=>Ht.post(Z,z,{headers:Y});let ne={};return ne.insertDimension={range:gI(H,{errorPrefix:`${I}The ${A(q,"Range","range")} input `}),inheritFromBefore:typeof ee=="string"&&ee.trim().startsWith("{")?JSON.parse(ee):ee},await J({method:"POST",endpoint:`/v4/spreadsheets/${K}:batchUpdate`,data:{requests:[ne]}}),{value:U.Success,result:{success:!0},error:null}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return oe.Logger.log("[Google Sheets] error:",g),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:g,result:null}}}})}}class Cct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsMoveDimension,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsMoveDimension);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=He(i,i.project,"moveDimension"),I="["+Fe(i,i.project,"Move Dimension")+": `"+g+"`] ",A=(z,ie,pe)=>{const me=Fe(z==null?void 0:z.valueOwner,T==null?void 0:T.logic,ie),ve=He(z==null?void 0:z.valueOwner,T==null?void 0:T.logic,pe);return`"${me}" (\`${ve}\`)`},D=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsMoveDimension].inputs.connection.id}),V=(s=D==null?void 0:D.value)==null?void 0:s.valueAsType;if(!V||!V.id||!V.name||V.type!==a.DefinitionEntity)throw new Error(`${I}The ${A(D,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const N=Mi(V);if(!N)throw new Error(`${I}The ${A(D,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsMoveDimension].inputs.spreadsheetId.id}),G=(c=x==null?void 0:x.value)==null?void 0:c.value,K=Wn(G,{errorPrefix:`${I}The ${A(x,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsMoveDimension].inputs.source.id}),H=(e=q==null?void 0:q.value)==null?void 0:e.value;if(H==null)throw new Error(`${I}The ${A(q,"source","source")} input is missing.`);const W=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsMoveDimension].inputs.destinationIndex.id}),ee=(f=W==null?void 0:W.value)==null?void 0:f.value;if(ee==null)throw new Error(`${I}The ${A(W,"destinationIndex","destinationIndex")} input is missing.`);const Y={Authorization:`Bearer ${await T.getAccessToken()}`},Z=`${(y=T.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v1/external-integrations/generic-proxy/${T.projectId}/${qt["google-sheet"]}/${N}`,J=async z=>Ht.post(Z,z,{headers:Y});let ne={};return ne.moveDimension={source:typeof H=="string"&&H.trim().startsWith("{")?JSON.parse(H):H,destinationIndex:typeof ee=="string"&&ee.trim().startsWith("{")?JSON.parse(ee):ee},await J({method:"POST",endpoint:`/v4/spreadsheets/${K}:batchUpdate`,data:{requests:[ne]}}),{value:U.Success,result:{success:!0},error:null}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return oe.Logger.log("[Google Sheets] error:",g),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:g,result:null}}}})}}class wct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsUpdateConditionalFormatRule,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsUpdateConditionalFormatRule);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=He(i,i.project,"updateConditionalFormatRule"),I="["+Fe(i,i.project,"Update Conditional Format Rule")+": `"+g+"`] ",A=(z,ie,pe)=>{const me=Fe(z==null?void 0:z.valueOwner,T==null?void 0:T.logic,ie),ve=He(z==null?void 0:z.valueOwner,T==null?void 0:T.logic,pe);return`"${me}" (\`${ve}\`)`},D=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsUpdateConditionalFormatRule].inputs.connection.id}),V=(s=D==null?void 0:D.value)==null?void 0:s.valueAsType;if(!V||!V.id||!V.name||V.type!==a.DefinitionEntity)throw new Error(`${I}The ${A(D,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const N=Mi(V);if(!N)throw new Error(`${I}The ${A(D,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsUpdateConditionalFormatRule].inputs.spreadsheetId.id}),G=(c=x==null?void 0:x.value)==null?void 0:c.value,K=Wn(G,{errorPrefix:`${I}The ${A(x,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsUpdateConditionalFormatRule].inputs.index.id}),H=(e=q==null?void 0:q.value)==null?void 0:e.value;if(H==null)throw new Error(`${I}The ${A(q,"index","index")} input is missing.`);const W=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsUpdateConditionalFormatRule].inputs.rule.id}),ee=(f=W==null?void 0:W.value)==null?void 0:f.value;if(ee==null)throw new Error(`${I}The ${A(W,"rule","rule")} input is missing.`);const Y={Authorization:`Bearer ${await T.getAccessToken()}`},Z=`${(y=T.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v1/external-integrations/generic-proxy/${T.projectId}/${qt["google-sheet"]}/${N}`,J=async z=>Ht.post(Z,z,{headers:Y});let ne={};return ne.updateConditionalFormatRule={index:typeof H=="string"&&H.trim().startsWith("{")?JSON.parse(H):H,rule:typeof ee=="string"&&ee.trim().startsWith("{")?JSON.parse(ee):ee},await J({method:"POST",endpoint:`/v4/spreadsheets/${K}:batchUpdate`,data:{requests:[ne]}}),{value:U.Success,result:{success:!0},error:null}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return oe.Logger.log("[Google Sheets] error:",g),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:g,result:null}}}})}}class Oct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsUpdateProtectedRange,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsUpdateProtectedRange);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=He(i,i.project,"updateProtectedRange"),I="["+Fe(i,i.project,"Update Protected Range")+": `"+g+"`] ",A=(z,ie,pe)=>{const me=Fe(z==null?void 0:z.valueOwner,T==null?void 0:T.logic,ie),ve=He(z==null?void 0:z.valueOwner,T==null?void 0:T.logic,pe);return`"${me}" (\`${ve}\`)`},D=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsUpdateProtectedRange].inputs.connection.id}),V=(s=D==null?void 0:D.value)==null?void 0:s.valueAsType;if(!V||!V.id||!V.name||V.type!==a.DefinitionEntity)throw new Error(`${I}The ${A(D,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const N=Mi(V);if(!N)throw new Error(`${I}The ${A(D,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsUpdateProtectedRange].inputs.spreadsheetId.id}),G=(c=x==null?void 0:x.value)==null?void 0:c.value,K=Wn(G,{errorPrefix:`${I}The ${A(x,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsUpdateProtectedRange].inputs.protectedRangeId.id}),H=(e=q==null?void 0:q.value)==null?void 0:e.value;if(H==null)throw new Error(`${I}The ${A(q,"protectedRangeId","protectedRangeId")} input is missing.`);const W=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsUpdateProtectedRange].inputs.protectedRange.id}),ee=(f=W==null?void 0:W.value)==null?void 0:f.value;if(ee==null)throw new Error(`${I}The ${A(W,"protectedRange","protectedRange")} input is missing.`);const Y={Authorization:`Bearer ${await T.getAccessToken()}`},Z=`${(y=T.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v1/external-integrations/generic-proxy/${T.projectId}/${qt["google-sheet"]}/${N}`,J=async z=>Ht.post(Z,z,{headers:Y});let ne={};return ne.updateProtectedRange={protectedRangeId:typeof H=="string"&&H.trim().startsWith("{")?JSON.parse(H):H,protectedRange:typeof ee=="string"&&ee.trim().startsWith("{")?JSON.parse(ee):ee},await J({method:"POST",endpoint:`/v4/spreadsheets/${K}:batchUpdate`,data:{requests:[ne]}}),{value:U.Success,result:{success:!0},error:null}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return oe.Logger.log("[Google Sheets] error:",g),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:g,result:null}}}})}}class Pct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsAddNamedRange,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsAddNamedRange);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=He(i,i.project,"addNamedRange"),I="["+Fe(i,i.project,"Add Named Range")+": `"+g+"`] ",A=(z,ie,pe)=>{const me=Fe(z==null?void 0:z.valueOwner,T==null?void 0:T.logic,ie),ve=He(z==null?void 0:z.valueOwner,T==null?void 0:T.logic,pe);return`"${me}" (\`${ve}\`)`},D=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsAddNamedRange].inputs.connection.id}),V=(s=D==null?void 0:D.value)==null?void 0:s.valueAsType;if(!V||!V.id||!V.name||V.type!==a.DefinitionEntity)throw new Error(`${I}The ${A(D,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const N=Mi(V);if(!N)throw new Error(`${I}The ${A(D,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsAddNamedRange].inputs.spreadsheetId.id}),G=(c=x==null?void 0:x.value)==null?void 0:c.value,K=Wn(G,{errorPrefix:`${I}The ${A(x,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsAddNamedRange].inputs.name.id}),H=(e=q==null?void 0:q.value)==null?void 0:e.value;if(H==null)throw new Error(`${I}The ${A(q,"name","name")} input is missing.`);const W=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsAddNamedRange].inputs.range.id}),ee=(f=W==null?void 0:W.value)==null?void 0:f.value;if(ee==null)throw new Error(`${I}The ${A(W,"range","range")} input is missing.`);const Y={Authorization:`Bearer ${await T.getAccessToken()}`},Z=`${(y=T.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v1/external-integrations/generic-proxy/${T.projectId}/${qt["google-sheet"]}/${N}`,J=async z=>Ht.post(Z,z,{headers:Y});let ne={};return ne.addNamedRange={name:typeof H=="string"&&H.trim().startsWith("{")?JSON.parse(H):H,range:Cp(ee,{errorPrefix:`${I}The ${A(W,"Range","range")} input `})},await J({method:"POST",endpoint:`/v4/spreadsheets/${K}:batchUpdate`,data:{requests:[ne]}}),{value:U.Success,result:{success:!0},error:null}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return oe.Logger.log("[Google Sheets] error:",g),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:g,result:null}}}})}}class xct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsSetCellNote,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsSetCellNote);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=He(i,i.project,"setCellNote"),I="["+Fe(i,i.project,"Set Cell Note")+": `"+g+"`] ",A=(z,ie,pe)=>{const me=Fe(z==null?void 0:z.valueOwner,T==null?void 0:T.logic,ie),ve=He(z==null?void 0:z.valueOwner,T==null?void 0:T.logic,pe);return`"${me}" (\`${ve}\`)`},D=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsSetCellNote].inputs.connection.id}),V=(s=D==null?void 0:D.value)==null?void 0:s.valueAsType;if(!V||!V.id||!V.name||V.type!==a.DefinitionEntity)throw new Error(`${I}The ${A(D,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const N=Mi(V);if(!N)throw new Error(`${I}The ${A(D,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsSetCellNote].inputs.spreadsheetId.id}),G=(c=x==null?void 0:x.value)==null?void 0:c.value,K=Wn(G,{errorPrefix:`${I}The ${A(x,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsSetCellNote].inputs.range.id}),H=(e=q==null?void 0:q.value)==null?void 0:e.value;if(H==null)throw new Error(`${I}The ${A(q,"range","range")} input is missing.`);const W=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsSetCellNote].inputs.note.id}),ee=(f=W==null?void 0:W.value)==null?void 0:f.value;if(ee==null)throw new Error(`${I}The ${A(W,"note","note")} input is missing.`);const Y={Authorization:`Bearer ${await T.getAccessToken()}`},Z=`${(y=T.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v1/external-integrations/generic-proxy/${T.projectId}/${qt["google-sheet"]}/${N}`,J=async z=>Ht.post(Z,z,{headers:Y});let ne={repeatCell:{range:Cp(H,{errorPrefix:`${I}The ${A(q,"Range","range")} input `}),cell:{note:typeof ee=="string"&&ee.trim().startsWith("{")?JSON.parse(ee):ee},fields:"note"}};return await J({method:"POST",endpoint:`/v4/spreadsheets/${K}:batchUpdate`,data:{requests:[ne]}}),{value:U.Success,result:{success:!0},error:null}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return oe.Logger.log("[Google Sheets] error:",g),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:g,result:null}}}})}}class _ct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsDeleteConditionalFormatRule,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsDeleteConditionalFormatRule);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=He(i,i.project,"deleteConditionalFormatRule"),I="["+Fe(i,i.project,"Delete Conditional Format Rule")+": `"+g+"`] ",A=(z,ie,pe)=>{const me=Fe(z==null?void 0:z.valueOwner,T==null?void 0:T.logic,ie),ve=He(z==null?void 0:z.valueOwner,T==null?void 0:T.logic,pe);return`"${me}" (\`${ve}\`)`},D=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsDeleteConditionalFormatRule].inputs.connection.id}),V=(s=D==null?void 0:D.value)==null?void 0:s.valueAsType;if(!V||!V.id||!V.name||V.type!==a.DefinitionEntity)throw new Error(`${I}The ${A(D,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const N=Mi(V);if(!N)throw new Error(`${I}The ${A(D,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsDeleteConditionalFormatRule].inputs.spreadsheetId.id}),G=(c=x==null?void 0:x.value)==null?void 0:c.value,K=Wn(G,{errorPrefix:`${I}The ${A(x,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsDeleteConditionalFormatRule].inputs.sheetId.id}),H=(e=q==null?void 0:q.value)==null?void 0:e.value;if(H==null)throw new Error(`${I}The ${A(q,"sheetId","sheetId")} input is missing.`);const W=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsDeleteConditionalFormatRule].inputs.index.id}),ee=(f=W==null?void 0:W.value)==null?void 0:f.value;if(ee==null)throw new Error(`${I}The ${A(W,"index","index")} input is missing.`);const Y={Authorization:`Bearer ${await T.getAccessToken()}`},Z=`${(y=T.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v1/external-integrations/generic-proxy/${T.projectId}/${qt["google-sheet"]}/${N}`,J=async z=>Ht.post(Z,z,{headers:Y});let ne={};return ne.deleteConditionalFormatRule={sheetId:typeof H=="string"&&H.trim().startsWith("{")?JSON.parse(H):H,index:typeof ee=="string"&&ee.trim().startsWith("{")?JSON.parse(ee):ee},await J({method:"POST",endpoint:`/v4/spreadsheets/${K}:batchUpdate`,data:{requests:[ne]}}),{value:U.Success,result:{success:!0},error:null}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return oe.Logger.log("[Google Sheets] error:",g),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:g,result:null}}}})}}class Vct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsResizeDimension,version:"1.0.0",description:"Resize Dimension Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsResizeDimension);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=He(i,i.project,"resizeDimension"),I="["+Fe(i,i.project,"Resize dimension")+": `"+g+"`] ",A=(ie,pe,me)=>{const ve=Fe(ie==null?void 0:ie.valueOwner,T==null?void 0:T.logic,pe),Ce=He(ie==null?void 0:ie.valueOwner,T==null?void 0:T.logic,me);return`"${ve}" (\`${Ce}\`)`},D=n.find(ie=>{var pe;return((pe=ie.valueOwner.declaration)==null?void 0:pe.id)===L.operation[le.GoogleSheetsResizeDimension].inputs.connection.id}),V=(s=D==null?void 0:D.value)==null?void 0:s.valueAsType;if(!V||!V.id||!V.name||V.type!==a.DefinitionEntity)throw new Error(`${I}The ${A(D,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const N=Mi(V);if(!N)throw new Error(`${I}The ${A(D,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(ie=>{var pe;return((pe=ie.valueOwner.declaration)==null?void 0:pe.id)===L.operation[le.GoogleSheetsResizeDimension].inputs.spreadsheetId.id}),G=(c=x==null?void 0:x.value)==null?void 0:c.value,K=Wn(G,{errorPrefix:`${I}The ${A(x,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(ie=>{var pe;return((pe=ie.valueOwner.declaration)==null?void 0:pe.id)===L.operation[le.GoogleSheetsResizeDimension].inputs.range.id}),H=(e=q==null?void 0:q.value)==null?void 0:e.value;if(H==null)throw new Error(`${I}The ${A(q,"Range","range")} input is missing.`);const W=n.find(ie=>{var pe;return((pe=ie.valueOwner.declaration)==null?void 0:pe.id)===L.operation[le.GoogleSheetsResizeDimension].inputs.pixelSize.id}),ee=(f=W==null?void 0:W.value)==null?void 0:f.value;if(ee==null||typeof ee!="number"||isNaN(ee)||ee<0)throw new Error(`${I}The ${A(W,"Pixel size","pixelSize")} input is missing or invalid. Expected a non-negative number in pixels.`);const Y={Authorization:`Bearer ${await T.getAccessToken()}`},Z=`${(y=T.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v1/external-integrations/generic-proxy/${T.projectId}/${qt["google-sheet"]}/${N}`,J=async ie=>Ht.post(Z,ie,{headers:Y});await Md(H,"Id",async()=>{var pe;return(((pe=(await J({method:"GET",endpoint:`/v4/spreadsheets/${K}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:pe.sheets)||[]).map(me=>{var ve,Ce;return{id:(ve=me.properties)==null?void 0:ve.sheetId,name:(Ce=me.properties)==null?void 0:Ce.title}})});const z={updateDimensionProperties:{range:gI(H,{errorPrefix:`${I}The ${A(q,"Range","range")} input `}),properties:{pixelSize:ee},fields:"pixelSize"}};return await J({method:"POST",endpoint:`/v4/spreadsheets/${K}:batchUpdate`,data:{requests:[z]}}),{value:U.Success,result:{success:!0},error:null}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return oe.Logger.log("[Google Sheets] error:",g),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:g,result:null}}}})}}class Nct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:Me.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_UPLOAD_FILE,version:"1.0.0",description:"Cloud File System: Upload File",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Logic]});C(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic);if(!n)return;const s=n.get(je.UploadFile);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{var s,c,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=He(i,i.project,"uploadFile"),E="["+Fe(i,i.project,"Upload file")+": `"+T+"`] ",I=n.find(ne=>{var z,ie;return((ie=(z=ne.valueOwner)==null?void 0:z.declaration)==null?void 0:ie.id)===L.operation[je.UploadFile].inputs.bucket.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==a.DefinitionEntity)throw new Error(`${E}Invalid input "${Fe(I==null?void 0:I.valueOwner,m==null?void 0:m.logic,"Storage")}" (\`${He(I==null?void 0:I.valueOwner,m==null?void 0:m.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const D=Bs(A==null?void 0:A.id,((c=m.branchHead)==null?void 0:c.identifier)||"main");if(!((m==null?void 0:m.liveResources)||[]).find(ne=>ne.resourceId===D))throw new Error(`${E}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const N=n.find(ne=>{var z,ie;return((ie=(z=ne.valueOwner)==null?void 0:z.declaration)==null?void 0:ie.id)===L.operation[je.UploadFile].inputs.key.id}),x=(e=N==null?void 0:N.value)==null?void 0:e.value;if(!x||x==="")throw new Error(`${E}The "${Fe(N==null?void 0:N.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${He(N==null?void 0:N.valueOwner,m==null?void 0:m.logic,"key")}\`) input is missing.`);if(typeof x!="string")throw new Error(`${E}The "${Fe(N==null?void 0:N.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${He(N==null?void 0:N.valueOwner,m==null?void 0:m.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const G=n.find(ne=>{var z,ie;return((ie=(z=ne.valueOwner)==null?void 0:z.declaration)==null?void 0:ie.id)===L.operation[je.UploadFile].inputs.file.id}),K=(f=G==null?void 0:G.value)==null?void 0:f.value;if(!K)throw new Error(`${E}The "${Fe(G==null?void 0:G.valueOwner,m==null?void 0:m.logic,"File")}" (\`${He(G==null?void 0:G.valueOwner,m==null?void 0:m.logic,"file")}\`) input is missing'`);if(typeof K!="object"||!K.uri||typeof K.uri!="string")throw new Error(`${E}The "${Fe(G==null?void 0:G.valueOwner,m==null?void 0:m.logic,"File")}" (\`${He(G==null?void 0:G.valueOwner,m==null?void 0:m.logic,"file")}\`) input is invalid, should be an object with a text 'uri' property.`);const q=K.uri,H=K.mimeType||"application/octet-stream",W=x,re=(y=(await Ht.post(`${m.env.API_BASE_URL}/cloud-files-service/v1/files?bucket=${D}&key=${encodeURIComponent(W)}&contentType=${encodeURIComponent(H)}`,{},{headers:{Authorization:`Bearer ${await m.getAccessToken()}`}})).data)==null?void 0:y.uploadUrl;if(!re)throw new Error(`${E}Failed to retrieve pre-signed upload URL.`);let Y;try{Y=await ES(q,()=>m.getAccessToken())}catch(ne){throw new Error(`${E}Failed to fetch file content from '${q}': ${(ne==null?void 0:ne.message)||ne}`)}await Ht.put(re,Y,{headers:{"Content-Type":H}});const J={uri:`${m.env.API_BASE_URL}/cloud-files-service/v1/files/download?bucket=${D}&key=${encodeURIComponent(W)}`,name:W.split("/").pop()||W,mimeType:H,size:Y.length};return{value:U.Success,error:null,result:J}}catch(m){return{value:U.UnhandledError,error:m,result:null}}}})}}class $ct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:Me.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_GET_FILE,version:"1.0.0",description:"Cloud File System: Get File",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Logic]});C(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic);if(!n)return;const s=n.get(je.GetFile);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{var s,c,e;try{const f=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!f||!f.env)throw new Error("Editor context or environment missing");const y=He(i,i.project,"getFile"),T="["+Fe(i,i.project,"Get file")+": `"+y+"`] ",g=n.find(G=>{var K,q;return((q=(K=G.valueOwner)==null?void 0:K.declaration)==null?void 0:q.id)===L.operation[je.GetFile].inputs.bucket.id}),E=(s=g==null?void 0:g.value)==null?void 0:s.valueAsType;if(!E||!E.id||!E.name||E.type!==a.DefinitionEntity)throw new Error(`${T}Invalid input "${Fe(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"Storage")}" (\`${He(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const I=Bs(E==null?void 0:E.id,((c=f.branchHead)==null?void 0:c.identifier)||"main");if(!((f==null?void 0:f.liveResources)||[]).find(G=>G.resourceId===I))throw new Error(`${T}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const D=n.find(G=>{var K,q;return((q=(K=G.valueOwner)==null?void 0:K.declaration)==null?void 0:q.id)===L.operation[je.GetFile].inputs.key.id}),V=(e=D==null?void 0:D.value)==null?void 0:e.value;if(!V||V==="")throw new Error(`${T}The "${Fe(D==null?void 0:D.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${He(D==null?void 0:D.valueOwner,f==null?void 0:f.logic,"key")}\`) input is missing.`);if(typeof V!="string")throw new Error(`${T}The "${Fe(D==null?void 0:D.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${He(D==null?void 0:D.valueOwner,f==null?void 0:f.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const x=(await Ht.get(`${f.env.API_BASE_URL}/cloud-files-service/v1/files/metadata?bucket=${I}&key=${encodeURIComponent(V)}`,{headers:{Authorization:`Bearer ${await f.getAccessToken()}`}})).data;return{value:U.Success,error:null,result:{uri:x.uri,name:x.name,key:x.key,size:x.size,mimeType:x.mimeType,access:x.access,lastModified:x.lastModified}}}catch(f){return{value:U.UnhandledError,error:f,result:null}}}})}}class Lct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:Me.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_LIST_FILES,version:"1.0.0",description:"Cloud File System: List Files",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Logic]});C(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic);if(!n)return;const s=n.get(je.ListFiles);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{var s,c,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=He(i,i.project,"listFiles"),E="["+Fe(i,i.project,"List files")+": `"+T+"`] ",I=n.find(pe=>{var me,ve;return((ve=(me=pe.valueOwner)==null?void 0:me.declaration)==null?void 0:ve.id)===L.operation[je.ListFiles].inputs.bucket.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==a.DefinitionEntity)throw new Error(`${E}Invalid input "${Fe(I==null?void 0:I.valueOwner,m==null?void 0:m.logic,"Storage")}" (\`${He(I==null?void 0:I.valueOwner,m==null?void 0:m.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const D=Bs(A==null?void 0:A.id,((c=m.branchHead)==null?void 0:c.identifier)||"main");if(!((m==null?void 0:m.liveResources)||[]).find(pe=>pe.resourceId===D))throw new Error(`${E}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const N=n.find(pe=>{var me,ve;return((ve=(me=pe.valueOwner)==null?void 0:me.declaration)==null?void 0:ve.id)===L.operation[je.ListFiles].inputs.path.id}),x=(e=N==null?void 0:N.value)==null?void 0:e.value;if(x!==void 0&&typeof x!="string")throw new Error(`${E}The "${Fe(N==null?void 0:N.valueOwner,m==null?void 0:m.logic,"Path")}" (\`${He(N==null?void 0:N.valueOwner,m==null?void 0:m.logic,"path")}\`) input value is invalid, if present, it must be a string.`);const G=n.find(pe=>{var me,ve;return((ve=(me=pe.valueOwner)==null?void 0:me.declaration)==null?void 0:ve.id)===L.operation[je.ListFiles].inputs.maxKeys.id}),K=(f=G==null?void 0:G.value)==null?void 0:f.value;if(K!==void 0&&(typeof K!="number"||K<=0))throw new Error(`${E}The "${Fe(G==null?void 0:G.valueOwner,m==null?void 0:m.logic,"Max results")}" (\`${He(G==null?void 0:G.valueOwner,m==null?void 0:m.logic,"maxKeys")}\`) input value is invalid, if present, it must be a number greater than 0.`);const q=n.find(pe=>{var me,ve;return((ve=(me=pe.valueOwner)==null?void 0:me.declaration)==null?void 0:ve.id)===L.operation[je.ListFiles].inputs.startAfter.id}),H=(y=q==null?void 0:q.value)==null?void 0:y.value;if(H!==void 0&&(typeof H!="string"||H===""))throw new Error(`${E}The "${Fe(q==null?void 0:q.valueOwner,m==null?void 0:m.logic,"Start after")}" (\`${He(q==null?void 0:q.valueOwner,m==null?void 0:m.logic,"startAfter")}\`) input value is invalid, if present, it must be a non-empty string.`);let W=`${m.env.API_BASE_URL}/cloud-files-service/v1/files?bucket=${D}`;x&&(W+=`&path=${encodeURIComponent(x)}`),K&&(W+=`&maxKeys=${K}`),H&&(W+=`&startAfter=${encodeURIComponent(H)}`);const ee=await Ht.get(W,{headers:{Authorization:`Bearer ${await m.getAccessToken()}`}}),re=pe=>{var Oe;if(!pe)return"application/octet-stream";const me=pe.split(".");if(me.length<=1)return"application/octet-stream";const ve=(Oe=me.pop())==null?void 0:Oe.toLowerCase();return ve&&{png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",svg:"image/svg+xml",pdf:"application/pdf",txt:"text/plain",html:"text/html",css:"text/css",js:"application/javascript",json:"application/json",csv:"text/csv",xml:"application/xml",zip:"application/zip",mp3:"audio/mpeg",mp4:"video/mp4",mov:"video/quicktime",wav:"audio/wav"}[ve]||"application/octet-stream"},Z=(ee.data.items||ee.data.files||[]).map(pe=>({uri:pe.uri||pe.url||`${m.env.API_BASE_URL}/cloud-files-service/v1/files/download?bucket=${D}&key=${encodeURIComponent(pe.key)}`,name:pe.name,key:pe.key,mimeType:pe.mimeType||re(pe.key),size:pe.size||0,lastModified:pe.lastModified,access:pe.access})),J=ee.data.total!==void 0?ee.data.total:Z.length,ne=ee.data.size!==void 0?ee.data.size:Z.reduce((pe,me)=>pe+(me.size||0),0),z=ee.data.nextStartAfter!==void 0?ee.data.nextStartAfter:null,ie=ee.data.hasMore!==void 0?ee.data.hasMore:!1;return{value:U.Success,error:null,result:{items:Z,total:J,size:ne,nextStartAfter:z,hasMore:ie}}}catch(m){return{value:U.UnhandledError,error:m,result:null}}}})}}class Gct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:Me.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_DELETE_FILES,version:"1.0.0",description:"Cloud File System: Delete Files",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Logic]});C(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic);if(!n)return;const s=n.get(je.DeleteFiles);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{var s,c,e;try{const f=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!f||!f.env)throw new Error("Editor context or environment missing");const y=He(i,i.project,"deleteFiles"),T="["+Fe(i,i.project,"Delete files")+": `"+y+"`] ",g=n.find(K=>{var q,H;return((H=(q=K.valueOwner)==null?void 0:q.declaration)==null?void 0:H.id)===L.operation[je.DeleteFiles].inputs.bucket.id}),E=(s=g==null?void 0:g.value)==null?void 0:s.valueAsType;if(!E||!E.id||!E.name||E.type!==a.DefinitionEntity)throw new Error(`${T}Invalid input "${Fe(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"Storage")}" (\`${He(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const I=Bs(E==null?void 0:E.id,((c=f.branchHead)==null?void 0:c.identifier)||"main");if(!((f==null?void 0:f.liveResources)||[]).find(K=>K.resourceId===I))throw new Error(`${T}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const D=n.find(K=>{var q,H;return((H=(q=K.valueOwner)==null?void 0:q.declaration)==null?void 0:H.id)===L.operation[je.DeleteFiles].inputs.keys.id}),V=(e=D==null?void 0:D.value)==null?void 0:e.value,N=Array.isArray(V)?V:typeof V=="string"&&V!==""?[V]:[];if(!N||N.length===0)throw new Error(`${T}The "${Fe(D==null?void 0:D.valueOwner,f==null?void 0:f.logic,"Keys")}" (\`${He(D==null?void 0:D.valueOwner,f==null?void 0:f.logic,"keys")}\`) input is missing.`);if(!Array.isArray(N)||N.some(K=>typeof K!="string"||K===""))throw new Error(`${T}The "${Fe(D==null?void 0:D.valueOwner,f==null?void 0:f.logic,"Keys")}" (\`${He(D==null?void 0:D.valueOwner,f==null?void 0:f.logic,"keys")}\`) input value is invalid, if present, it must be a list of non-empty strings.`);const G=(await Ht.delete(`${f.env.API_BASE_URL}/cloud-files-service/v1/files`,{headers:{Authorization:`Bearer ${await f.getAccessToken()}`},data:{bucket:I,keys:N}})).data;return{value:U.Success,error:null,result:null}}catch(f){return{value:U.UnhandledError,error:f,result:null}}}})}}class Bct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:Me.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_COPY_FILE,version:"1.0.0",description:"Cloud File System: Copy File",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Logic]});C(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic);if(!n)return;const s=n.get(je.CopyFile);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{var s,c,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=He(i,i.project,"copyFile"),I="["+Fe(i,i.project,"Copy file")+": `"+g+"`] ",A=n.find(ne=>{var z,ie;return((ie=(z=ne.valueOwner)==null?void 0:z.declaration)==null?void 0:ie.id)===L.operation[je.CopyFile].inputs.bucket.id}),D=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!D||!D.id||!D.name||D.type!==a.DefinitionEntity)throw new Error(`${I}Invalid input "${Fe(A==null?void 0:A.valueOwner,T==null?void 0:T.logic,"Storage")}" (\`${He(A==null?void 0:A.valueOwner,T==null?void 0:T.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const V=Bs(D==null?void 0:D.id,((c=T.branchHead)==null?void 0:c.identifier)||"main");if(!((T==null?void 0:T.liveResources)||[]).find(ne=>ne.resourceId===V))throw new Error(`${I}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const x=n.find(ne=>{var z,ie;return((ie=(z=ne.valueOwner)==null?void 0:z.declaration)==null?void 0:ie.id)===L.operation[je.CopyFile].inputs.sourceKey.id}),G=(e=x==null?void 0:x.value)==null?void 0:e.value;if(!G||G==="")throw new Error(`${I}The "${Fe(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"Source key")}" (\`${He(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"sourceKey")}\`) input is missing.`);if(typeof G!="string")throw new Error(`${I}The "${Fe(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"Source key")}" (\`${He(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"sourceKey")}\`) input value is invalid, if present, it must be a non-empty string.`);const K=n.find(ne=>{var z,ie;return((ie=(z=ne.valueOwner)==null?void 0:z.declaration)==null?void 0:ie.id)===L.operation[je.CopyFile].inputs.destinationKey.id}),q=(f=K==null?void 0:K.value)==null?void 0:f.value;if(!q||q==="")throw new Error(`${I}The "${Fe(K==null?void 0:K.valueOwner,T==null?void 0:T.logic,"Destination key")}" (\`${He(K==null?void 0:K.valueOwner,T==null?void 0:T.logic,"destinationKey")}\`) input is missing.`);if(typeof q!="string")throw new Error(`${I}The "${Fe(K==null?void 0:K.valueOwner,T==null?void 0:T.logic,"Destination key")}" (\`${He(K==null?void 0:K.valueOwner,T==null?void 0:T.logic,"destinationKey")}\`) input value is invalid, if present, it must be a non-empty string.`);const H=n.find(ne=>{var z,ie;return((ie=(z=ne.valueOwner)==null?void 0:z.declaration)==null?void 0:ie.id)===L.operation[je.CopyFile].inputs.destinationBucket.id}),W=(y=H==null?void 0:H.value)==null?void 0:y.valueAsType;if(W&&(!W.id||!W.name||W.type!==a.DefinitionEntity))throw new Error(`${I}Invalid input "${Fe(H==null?void 0:H.valueOwner,T==null?void 0:T.logic,"Destination Storage")}" (\`${He(H==null?void 0:H.valueOwner,T==null?void 0:T.logic,"destinationBucket")}\`), expected a valid "Cloud file system" node.`);const ee=W!=null&&W.id?Bs(W.id,((m=T.branchHead)==null?void 0:m.identifier)||"main"):V;if(!((T==null?void 0:T.liveResources)||[]).find(ne=>ne.resourceId===ee))throw new Error(`${I}The destination "Cloud file system" is not live. Publish the project first, then try again to run the operation node.`);const Y={headers:{Authorization:`Bearer ${await T.getAccessToken()}`}},J=(await Ht.post(`${T.env.API_BASE_URL}/cloud-files-service/v1/files/copy`,{bucket:V,destinationBucket:ee,sourceKey:G,destinationKey:q},Y)).data;return{value:U.Success,error:null,result:null}}catch(T){return{value:U.UnhandledError,error:T,result:null}}}})}}class Mct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:Me.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_MOVE_FILE,version:"1.0.0",description:"Cloud File System: Move File",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Logic]});C(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic);if(!n)return;const s=n.get(je.MoveFile);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{var s,c,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=He(i,i.project,"moveFile"),I="["+Fe(i,i.project,"Move file")+": `"+g+"`] ",A=n.find(ne=>{var z,ie;return((ie=(z=ne.valueOwner)==null?void 0:z.declaration)==null?void 0:ie.id)===L.operation[je.MoveFile].inputs.bucket.id}),D=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!D||!D.id||!D.name||D.type!==a.DefinitionEntity)throw new Error(`${I}Invalid input "${Fe(A==null?void 0:A.valueOwner,T==null?void 0:T.logic,"Storage")}" (\`${He(A==null?void 0:A.valueOwner,T==null?void 0:T.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const V=Bs(D==null?void 0:D.id,((c=T.branchHead)==null?void 0:c.identifier)||"main");if(!((T==null?void 0:T.liveResources)||[]).find(ne=>ne.resourceId===V))throw new Error(`${I}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const x=n.find(ne=>{var z,ie;return((ie=(z=ne.valueOwner)==null?void 0:z.declaration)==null?void 0:ie.id)===L.operation[je.MoveFile].inputs.sourceKey.id}),G=(e=x==null?void 0:x.value)==null?void 0:e.value;if(!G||G==="")throw new Error(`${I}The "${Fe(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"Source key")}" (\`${He(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"sourceKey")}\`) input is missing.`);if(typeof G!="string")throw new Error(`${I}The "${Fe(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"Source key")}" (\`${He(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"sourceKey")}\`) input value is invalid, if present, it must be a non-empty string.`);const K=n.find(ne=>{var z,ie;return((ie=(z=ne.valueOwner)==null?void 0:z.declaration)==null?void 0:ie.id)===L.operation[je.MoveFile].inputs.destinationKey.id}),q=(f=K==null?void 0:K.value)==null?void 0:f.value;if(!q||q==="")throw new Error(`${I}The "${Fe(K==null?void 0:K.valueOwner,T==null?void 0:T.logic,"Destination key")}" (\`${He(K==null?void 0:K.valueOwner,T==null?void 0:T.logic,"destinationKey")}\`) input is missing.`);if(typeof q!="string")throw new Error(`${I}The "${Fe(K==null?void 0:K.valueOwner,T==null?void 0:T.logic,"Destination key")}" (\`${He(K==null?void 0:K.valueOwner,T==null?void 0:T.logic,"destinationKey")}\`) input value is invalid, if present, it must be a non-empty string.`);const H=n.find(ne=>{var z,ie;return((ie=(z=ne.valueOwner)==null?void 0:z.declaration)==null?void 0:ie.id)===L.operation[je.MoveFile].inputs.destinationBucket.id}),W=(y=H==null?void 0:H.value)==null?void 0:y.valueAsType;if(W&&(!W.id||!W.name||W.type!==a.DefinitionEntity))throw new Error(`${I}Invalid input "${Fe(H==null?void 0:H.valueOwner,T==null?void 0:T.logic,"Destination storage")}" (\`${He(H==null?void 0:H.valueOwner,T==null?void 0:T.logic,"destinationBucket")}\`), expected a valid "Cloud file system" node.`);const ee=W!=null&&W.id?Bs(W.id,((m=T.branchHead)==null?void 0:m.identifier)||"main"):V;if(!((T==null?void 0:T.liveResources)||[]).find(ne=>ne.resourceId===ee))throw new Error(`${I}The destination "Cloud file system" is not live. Publish the project first, then try again to run the operation node.`);const Y={headers:{Authorization:`Bearer ${await T.getAccessToken()}`}},J=(await Ht.post(`${T.env.API_BASE_URL}/cloud-files-service/v1/files/move`,{bucket:V,destinationBucket:ee,sourceKey:G,destinationKey:q},Y)).data;return{value:U.Success,error:null,result:null}}catch(T){return{value:U.UnhandledError,error:T,result:null}}}})}}class Sct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:Me.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_RENAME_FILE,version:"1.0.0",description:"Cloud File System: Rename File",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Logic]});C(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic);if(!n)return;const s=n.get(je.RenameFile);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{var s,c,e,f;try{const y=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!y||!y.env)throw new Error("Editor context or environment missing");const m=He(i,i.project,"renameFile"),g="["+Fe(i,i.project,"Rename file")+": `"+m+"`] ",E=n.find(re=>{var Y,Z;return((Z=(Y=re.valueOwner)==null?void 0:Y.declaration)==null?void 0:Z.id)===L.operation[je.RenameFile].inputs.bucket.id}),I=(s=E==null?void 0:E.value)==null?void 0:s.valueAsType;if(!I||!I.id||!I.name||I.type!==a.DefinitionEntity)throw new Error(`${g}Invalid input "${Fe(E==null?void 0:E.valueOwner,y==null?void 0:y.logic,"Storage")}" (\`${He(E==null?void 0:E.valueOwner,y==null?void 0:y.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const A=Bs(I==null?void 0:I.id,((c=y.branchHead)==null?void 0:c.identifier)||"main");if(!((y==null?void 0:y.liveResources)||[]).find(re=>re.resourceId===A))throw new Error(`${g}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const V=n.find(re=>{var Y,Z;return((Z=(Y=re.valueOwner)==null?void 0:Y.declaration)==null?void 0:Z.id)===L.operation[je.RenameFile].inputs.key.id}),N=(e=V==null?void 0:V.value)==null?void 0:e.value;if(!N||N==="")throw new Error(`${g}The "${Fe(V==null?void 0:V.valueOwner,y==null?void 0:y.logic,"Key")}" (\`${He(V==null?void 0:V.valueOwner,y==null?void 0:y.logic,"key")}\`) input is missing.`);if(typeof N!="string")throw new Error(`${g}The "${Fe(V==null?void 0:V.valueOwner,y==null?void 0:y.logic,"Key")}" (\`${He(V==null?void 0:V.valueOwner,y==null?void 0:y.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const x=n.find(re=>{var Y,Z;return((Z=(Y=re.valueOwner)==null?void 0:Y.declaration)==null?void 0:Z.id)===L.operation[je.RenameFile].inputs.newName.id}),G=(f=x==null?void 0:x.value)==null?void 0:f.value;if(!G||G==="")throw new Error(`${g}The "${Fe(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"New name")}" (\`${He(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"newName")}\`) input is missing.`);if(typeof G!="string")throw new Error(`${g}The "${Fe(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"New name")}" (\`${He(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"newName")}\`) input value is invalid, if present, it must be a non-empty string.`);const K=N.lastIndexOf("/"),H=`${K!==-1?N.substring(0,K+1):""}${G}`,W={headers:{Authorization:`Bearer ${await y.getAccessToken()}`}},ee=await Ht.post(`${y.env.API_BASE_URL}/cloud-files-service/v1/files/rename`,{bucket:A,key:N,newName:G},W);return{value:U.Success,error:null,result:ee.data||{key:N,newName:G,destinationKey:H}}}catch(y){return{value:U.UnhandledError,error:y,result:null}}}})}}class Fct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:Me.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_GET_FILE_METADATA,version:"1.0.0",description:"Cloud File System: Get File Metadata",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Logic]});C(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic);if(!n)return;const s=n.get(je.GetFileMetadata);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{var s,c,e;try{const f=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!f||!f.env)throw new Error("Editor context or environment missing");const y=He(i,i.project,"getFileMetadata"),T="["+Fe(i,i.project,"Get file metadata")+": `"+y+"`] ",g=n.find(x=>{var G,K;return((K=(G=x.valueOwner)==null?void 0:G.declaration)==null?void 0:K.id)===L.operation[je.GetFileMetadata].inputs.bucket.id}),E=(s=g==null?void 0:g.value)==null?void 0:s.valueAsType;if(!E||!E.id||!E.name||E.type!==a.DefinitionEntity)throw new Error(`${T}Invalid input "${Fe(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"Storage")}" (\`${He(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const I=Bs(E==null?void 0:E.id,((c=f.branchHead)==null?void 0:c.identifier)||"main");if(!((f==null?void 0:f.liveResources)||[]).find(x=>x.resourceId===I))throw new Error(`${T}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const D=n.find(x=>{var G,K;return((K=(G=x.valueOwner)==null?void 0:G.declaration)==null?void 0:K.id)===L.operation[je.GetFileMetadata].inputs.key.id}),V=(e=D==null?void 0:D.value)==null?void 0:e.value;if(!V||V==="")throw new Error(`${T}The "${Fe(D==null?void 0:D.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${He(D==null?void 0:D.valueOwner,f==null?void 0:f.logic,"key")}\`) input is missing.`);if(typeof V!="string")throw new Error(`${T}The "${Fe(D==null?void 0:D.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${He(D==null?void 0:D.valueOwner,f==null?void 0:f.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const N=await Ht.get(`${f.env.API_BASE_URL}/cloud-files-service/v1/files/metadata?bucket=${I}&key=${encodeURIComponent(V)}`,{headers:{Authorization:`Bearer ${await f.getAccessToken()}`}});return{value:U.Success,error:null,result:N.data}}catch(f){return{value:U.UnhandledError,error:f,result:null}}}})}}class kct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:Me.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_CHECK_FILE_EXISTS,version:"1.0.0",description:"Cloud File System: Check File Exists",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Logic]});C(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic);if(!n)return;const s=n.get(je.CheckFileExists);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{var s,c,e;try{const f=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!f||!f.env)throw new Error("Editor context or environment missing");const y=He(i,i.project,"checkFileExists"),T="["+Fe(i,i.project,"Check File Exists")+": `"+y+"`] ",g=n.find(x=>{var G,K;return((K=(G=x.valueOwner)==null?void 0:G.declaration)==null?void 0:K.id)===L.operation[je.CheckFileExists].inputs.bucket.id}),E=(s=g==null?void 0:g.value)==null?void 0:s.valueAsType;if(!E||!E.id||!E.name||E.type!==a.DefinitionEntity)throw new Error(`${T}Invalid input "${Fe(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"Storage")}" (\`${He(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const I=Bs(E==null?void 0:E.id,((c=f.branchHead)==null?void 0:c.identifier)||"main");if(!((f==null?void 0:f.liveResources)||[]).find(x=>x.resourceId===I))throw new Error(`${T}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const D=n.find(x=>{var G,K;return((K=(G=x.valueOwner)==null?void 0:G.declaration)==null?void 0:K.id)===L.operation[je.CheckFileExists].inputs.key.id}),V=(e=D==null?void 0:D.value)==null?void 0:e.value;if(!V||V==="")throw new Error(`${T}The "${Fe(D==null?void 0:D.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${He(D==null?void 0:D.valueOwner,f==null?void 0:f.logic,"key")}\`) input is missing.`);if(typeof V!="string")throw new Error(`${T}The "${Fe(D==null?void 0:D.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${He(D==null?void 0:D.valueOwner,f==null?void 0:f.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const N=await Ht.get(`${f.env.API_BASE_URL}/cloud-files-service/v1/files/exists?bucket=${I}&key=${encodeURIComponent(V)}`,{headers:{Authorization:`Bearer ${await f.getAccessToken()}`}});return{value:U.Success,error:null,result:N.data.exists}}catch(f){return{value:U.UnhandledError,error:f,result:!1}}}})}}class Uct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:Me.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_GET_PRESIGNED_URL,version:"1.0.0",description:"Cloud File System: Get Pre-signed URL",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Logic]});C(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic);if(!n)return;const s=n.get(je.GetPresignedUrl);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{var s,c,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=He(i,i.project,"getPresignedUrl"),E="["+Fe(i,i.project,"Get pre-signed URL")+": `"+T+"`] ",I=n.find(Z=>{var J,ne;return((ne=(J=Z.valueOwner)==null?void 0:J.declaration)==null?void 0:ne.id)===L.operation[je.GetPresignedUrl].inputs.bucket.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==a.DefinitionEntity)throw new Error(`${E}Invalid input "${Fe(I==null?void 0:I.valueOwner,m==null?void 0:m.logic,"Storage")}" (\`${He(I==null?void 0:I.valueOwner,m==null?void 0:m.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const D=Bs(A==null?void 0:A.id,((c=m.branchHead)==null?void 0:c.identifier)||"main");if(!((m==null?void 0:m.liveResources)||[]).find(Z=>Z.resourceId===D))throw new Error(`${E}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const N=n.find(Z=>{var J,ne;return((ne=(J=Z.valueOwner)==null?void 0:J.declaration)==null?void 0:ne.id)===L.operation[je.GetPresignedUrl].inputs.key.id}),x=(e=N==null?void 0:N.value)==null?void 0:e.value;if(!x||x==="")throw new Error(`${E}The "${Fe(N==null?void 0:N.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${He(N==null?void 0:N.valueOwner,m==null?void 0:m.logic,"key")}\`) input is missing.`);if(typeof x!="string")throw new Error(`${E}The "${Fe(N==null?void 0:N.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${He(N==null?void 0:N.valueOwner,m==null?void 0:m.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const G=n.find(Z=>{var J,ne;return((ne=(J=Z.valueOwner)==null?void 0:J.declaration)==null?void 0:ne.id)===L.operation[je.GetPresignedUrl].inputs.action.id}),K=(f=G==null?void 0:G.value)==null?void 0:f.value,q=(K||"read").toLowerCase(),H=["read","write","delete","metadata","upload","putobject","head","headobject","getobject","get"];if(!K||K==="")throw new Error(`${E}The "${Fe(G==null?void 0:G.valueOwner,m==null?void 0:m.logic,"Action")}" (\`${He(G==null?void 0:G.valueOwner,m==null?void 0:m.logic,"action")}\`) input is missing.`);if(!H.includes(q))throw new Error(`${E}Invalid "${Fe(G==null?void 0:G.valueOwner,m==null?void 0:m.logic,"Action")}" (\`${He(G==null?void 0:G.valueOwner,m==null?void 0:m.logic,"action")}\`) input value, must be one of "read", "write", "delete" or "metadata".`);const W=n.find(Z=>{var J,ne;return((ne=(J=Z.valueOwner)==null?void 0:J.declaration)==null?void 0:ne.id)===L.operation[je.GetPresignedUrl].inputs.expiresInSeconds.id}),ee=(y=W==null?void 0:W.value)==null?void 0:y.value,re=ee!=null?Number(ee):3600;if(isNaN(re)||re<=0)throw new Error(`${E}Invalid "${Fe(W==null?void 0:W.valueOwner,m==null?void 0:m.logic,"Expires in seconds")}" (\`${He(W==null?void 0:W.valueOwner,m==null?void 0:m.logic,"expiresInSeconds")}\`) input value, expected a positive number.`);const Y=await Ht.get(`${m.env.API_BASE_URL}/cloud-files-service/v1/files/presigned-url?bucket=${D}&key=${encodeURIComponent(x)}&action=${q}&expiresInSeconds=${re}`,{headers:{Authorization:`Bearer ${await m.getAccessToken()}`}});return{value:U.Success,error:null,result:Y.data}}catch(m){return{value:U.UnhandledError,error:m,result:null}}}})}}class jct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:Me.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_SET_FILE_ACCESS,version:"1.0.0",description:"Cloud File System: Set File Access",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Logic]});C(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic);if(!n)return;const s=n.get(je.SetFileAccess);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{var s,c,e,f;try{const y=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!y||!y.env)throw new Error("Editor context or environment missing");const m=He(i,i.project,"setFileAccess"),g="["+Fe(i,i.project,"Set file access")+": `"+m+"`] ",E=n.find(K=>{var q,H;return((H=(q=K.valueOwner)==null?void 0:q.declaration)==null?void 0:H.id)===L.operation[je.SetFileAccess].inputs.bucket.id}),I=(s=E==null?void 0:E.value)==null?void 0:s.valueAsType;if(!I||!I.id||!I.name||I.type!==a.DefinitionEntity)throw new Error(`${g}Invalid input "${Fe(E==null?void 0:E.valueOwner,y==null?void 0:y.logic,"Storage")}" (\`${He(E==null?void 0:E.valueOwner,y==null?void 0:y.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const A=Bs(I==null?void 0:I.id,((c=y.branchHead)==null?void 0:c.identifier)||"main");if(!((y==null?void 0:y.liveResources)||[]).find(K=>K.resourceId===A))throw new Error(`${g}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const V=n.find(K=>{var q,H;return((H=(q=K.valueOwner)==null?void 0:q.declaration)==null?void 0:H.id)===L.operation[je.SetFileAccess].inputs.key.id}),N=(e=V==null?void 0:V.value)==null?void 0:e.value;if(!N||N==="")throw new Error(`${g}The "${Fe(V==null?void 0:V.valueOwner,y==null?void 0:y.logic,"Key")}" (\`${He(V==null?void 0:V.valueOwner,y==null?void 0:y.logic,"key")}\`) input is missing.`);if(typeof N!="string")throw new Error(`${g}The "${Fe(V==null?void 0:V.valueOwner,y==null?void 0:y.logic,"Key")}" (\`${He(V==null?void 0:V.valueOwner,y==null?void 0:y.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const x=n.find(K=>{var q,H;return((H=(q=K.valueOwner)==null?void 0:q.declaration)==null?void 0:H.id)===L.operation[je.SetFileAccess].inputs.access.id}),G=((f=x==null?void 0:x.value)==null?void 0:f.value)??"private";if(!G||G==="")throw new Error(`${g}The "${Fe(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"Access")}" (\`${He(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"access")}\`) input is missing.`);if(typeof G!="string"||!["public","private"].includes(G))throw new Error(`${g}The "${Fe(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"Access")}" (\`${He(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"access")}\`) input value is invalid, if present, it must be exactly the "public" or "private" text values.`);return await Ht.post(`${y.env.API_BASE_URL}/cloud-files-service/v1/files/access`,{bucket:A,key:N,access:G},{headers:{Authorization:`Bearer ${await y.getAccessToken()}`}}),{value:U.Success,error:null,result:null}}catch(y){return{value:U.UnhandledError,error:y,result:null}}}})}}class Kct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:Me.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_CREATE_FOLDER,version:"1.0.0",description:"Cloud File System: Create Folder",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Logic]});C(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic);if(!n)return;const s=n.get(je.CreateFolder);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{var s,c,e;try{const f=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!f||!f.env)throw new Error("Editor context or environment missing");const y=He(i,i.project,"createFolder"),T="["+Fe(i,i.project,"Create folder")+": `"+y+"`] ",g=n.find(G=>{var K,q;return((q=(K=G.valueOwner)==null?void 0:K.declaration)==null?void 0:q.id)===L.operation[je.CreateFolder].inputs.bucket.id}),E=(s=g==null?void 0:g.value)==null?void 0:s.valueAsType;if(!E||!E.id||!E.name||E.type!==a.DefinitionEntity)throw new Error(`${T}Invalid input "${Fe(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"Storage")}" (\`${He(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const I=Bs(E==null?void 0:E.id,((c=f.branchHead)==null?void 0:c.identifier)||"main");if(!((f==null?void 0:f.liveResources)||[]).find(G=>G.resourceId===I))throw new Error(`${T}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const D=n.find(G=>{var K,q;return((q=(K=G.valueOwner)==null?void 0:K.declaration)==null?void 0:q.id)===L.operation[je.CreateFolder].inputs.folderPath.id}),V=(e=D==null?void 0:D.value)==null?void 0:e.value;if(!V||V==="")throw new Error(`${T}The "${Fe(D==null?void 0:D.valueOwner,f==null?void 0:f.logic,"Folder path")}" (\`${He(D==null?void 0:D.valueOwner,f==null?void 0:f.logic,"folderPath")}\`) input is missing.`);if(typeof V!="string")throw new Error(`${T}The "${Fe(D==null?void 0:D.valueOwner,f==null?void 0:f.logic,"Folder path")}" (\`${He(D==null?void 0:D.valueOwner,f==null?void 0:f.logic,"folderPath")}\`) input value is invalid, if present, it must be a non-empty string.`);const x=(await Ht.post(`${f.env.API_BASE_URL}/cloud-files-service/v1/files/folders`,{bucket:I,folderPath:V},{headers:{Authorization:`Bearer ${await f.getAccessToken()}`}})).data;return{value:U.Success,error:null,result:null}}catch(f){return{value:U.UnhandledError,error:f,result:null}}}})}}class qct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:Me.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_DELETE_FOLDERS,version:"1.0.0",description:"Cloud File System: Delete Folders",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Logic]});C(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic);if(!n)return;const s=n.get(je.DeleteFolders);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{var s,c,e;try{const f=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!f||!f.env)throw new Error("Editor context or environment missing");const y=He(i,i.project,"deleteFolders"),T="["+Fe(i,i.project,"Delete folders")+": `"+y+"`] ",g=n.find(K=>{var q,H;return((H=(q=K.valueOwner)==null?void 0:q.declaration)==null?void 0:H.id)===L.operation[je.DeleteFolders].inputs.bucket.id}),E=(s=g==null?void 0:g.value)==null?void 0:s.valueAsType;if(!E||!E.id||!E.name||E.type!==a.DefinitionEntity)throw new Error(`${T}Invalid input "${Fe(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"Storage")}" (\`${He(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const I=Bs(E==null?void 0:E.id,((c=f.branchHead)==null?void 0:c.identifier)||"main");if(!((f==null?void 0:f.liveResources)||[]).find(K=>K.resourceId===I))throw new Error(`${T}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const D=n.find(K=>{var q,H;return((H=(q=K.valueOwner)==null?void 0:q.declaration)==null?void 0:H.id)===L.operation[je.DeleteFolders].inputs.folderPaths.id}),V=(e=D==null?void 0:D.value)==null?void 0:e.value,N=Array.isArray(V)?V:typeof V=="string"&&V!==""?[V]:[];if(!N||N.length===0)throw new Error(`${T}The "${Fe(D==null?void 0:D.valueOwner,f==null?void 0:f.logic,"Folder paths")}" (\`${He(D==null?void 0:D.valueOwner,f==null?void 0:f.logic,"folderPaths")}\`) input is missing.`);if(!Array.isArray(N)||N.some(K=>typeof K!="string"||K===""))throw new Error(`${T}The "${Fe(D==null?void 0:D.valueOwner,f==null?void 0:f.logic,"Folder paths")}" (\`${He(D==null?void 0:D.valueOwner,f==null?void 0:f.logic,"folderPaths")}\`) input value is invalid, if present, it must be a list of non-empty strings.`);const G=(await Ht.delete(`${f.env.API_BASE_URL}/cloud-files-service/v1/files/folders`,{headers:{Authorization:`Bearer ${await f.getAccessToken()}`},data:{bucket:I,folderPaths:N}})).data;return{value:U.Success,error:null,result:null}}catch(f){return{value:U.UnhandledError,error:f,result:null}}}})}}class Zct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:Me.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_CREATE_MULTIPART_UPLOAD,version:"1.0.0",description:"Cloud File System: Create Multipart Upload",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Logic]});C(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic);if(!n)return;const s=n.get(je.CreateMultipartUpload);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{var s,c,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=He(i,i.project,"createMultipartUpload"),E="["+Fe(i,i.project,"Create multipart upload")+": `"+T+"`] ",I=n.find(q=>{var H,W;return((W=(H=q.valueOwner)==null?void 0:H.declaration)==null?void 0:W.id)===L.operation[je.CreateMultipartUpload].inputs.bucket.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==a.DefinitionEntity)throw new Error(`${E}Invalid input "${Fe(I==null?void 0:I.valueOwner,m==null?void 0:m.logic,"Storage")}" (\`${He(I==null?void 0:I.valueOwner,m==null?void 0:m.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const D=Bs(A==null?void 0:A.id,((c=m.branchHead)==null?void 0:c.identifier)||"main"),V=n.find(q=>{var H,W;return((W=(H=q.valueOwner)==null?void 0:H.declaration)==null?void 0:W.id)===L.operation[je.CreateMultipartUpload].inputs.key.id}),N=(e=V==null?void 0:V.value)==null?void 0:e.value;if(!N||N==="")throw new Error(`${E}The "${Fe(V==null?void 0:V.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${He(V==null?void 0:V.valueOwner,m==null?void 0:m.logic,"key")}\`) input is missing.`);if(typeof N!="string")throw new Error(`${E}The "${Fe(V==null?void 0:V.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${He(V==null?void 0:V.valueOwner,m==null?void 0:m.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const x=n.find(q=>{var H,W;return((W=(H=q.valueOwner)==null?void 0:H.declaration)==null?void 0:W.id)===L.operation[je.CreateMultipartUpload].inputs.contentType.id}),G=((f=x==null?void 0:x.value)==null?void 0:f.value)||"application/octet-stream";if(!G||G==="")throw new Error(`${E}The "${Fe(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"Content Type")}" (\`${He(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"contentType")}\`) input is missing.`);if(typeof G!="string")throw new Error(`${E}The "${Fe(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"Content Type")}" (\`${He(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"contentType")}\`) input value is invalid, if present, it must be a non-empty string.`);const K=await Ht.post(`${m.env.API_BASE_URL}/cloud-files-service/v1/files/multipart?bucket=${D}&key=${encodeURIComponent(N)}&contentType=${encodeURIComponent(G)}`,{},{headers:{Authorization:`Bearer ${await m.getAccessToken()}`}});return{value:U.Success,error:null,result:{uploadId:typeof K.data=="object"&&((y=K.data)!=null&&y.uploadId)?K.data.uploadId:K.data}}}catch(m){return{value:U.UnhandledError,error:m,result:null}}}})}}class Hct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:Me.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_GET_UPLOAD_PART_PRESIGNED_URL,version:"1.0.0",description:"Cloud File System: Get Upload Part Pre-signed URL",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Logic]});C(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic);if(!n)return;const s=n.get(je.GetUploadPartPresignedUrl);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{var s,c,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=He(i,i.project,"getUploadPartPresignedUrl"),E="["+Fe(i,i.project,"Get upload part pre-signed URL")+": `"+T+"`] ",I=n.find(W=>{var ee,re;return((re=(ee=W.valueOwner)==null?void 0:ee.declaration)==null?void 0:re.id)===L.operation[je.GetUploadPartPresignedUrl].inputs.bucket.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==a.DefinitionEntity)throw new Error(`${E}${E}Invalid input "${Fe(I==null?void 0:I.valueOwner,m==null?void 0:m.logic,"Storage")}" (\`${He(I==null?void 0:I.valueOwner,m==null?void 0:m.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const D=Bs(A==null?void 0:A.id,((c=m.branchHead)==null?void 0:c.identifier)||"main"),V=n.find(W=>{var ee,re;return((re=(ee=W.valueOwner)==null?void 0:ee.declaration)==null?void 0:re.id)===L.operation[je.GetUploadPartPresignedUrl].inputs.key.id}),N=(e=V==null?void 0:V.value)==null?void 0:e.value;if(!N||N==="")throw new Error(`${E}The "${Fe(V==null?void 0:V.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${He(V==null?void 0:V.valueOwner,m==null?void 0:m.logic,"key")}\`) input is missing.`);if(typeof N!="string")throw new Error(`${E}The "${Fe(V==null?void 0:V.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${He(V==null?void 0:V.valueOwner,m==null?void 0:m.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const x=n.find(W=>{var ee,re;return((re=(ee=W.valueOwner)==null?void 0:ee.declaration)==null?void 0:re.id)===L.operation[je.GetUploadPartPresignedUrl].inputs.uploadId.id}),G=(f=x==null?void 0:x.value)==null?void 0:f.value;if(!G||G==="")throw new Error(`${E}The "${Fe(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"Upload ID")}" (\`${He(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"uploadId")}\`) input is missing.`);if(typeof G!="string")throw new Error(`${E}The "${Fe(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"Upload ID")}" (\`${He(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"uploadId")}\`) input value is invalid, if present, it must be a non-empty string.`);const K=n.find(W=>{var ee,re;return((re=(ee=W.valueOwner)==null?void 0:ee.declaration)==null?void 0:re.id)===L.operation[je.GetUploadPartPresignedUrl].inputs.partNumber.id}),q=Number((y=K==null?void 0:K.value)==null?void 0:y.value);if(isNaN(q)||q<=0)throw new Error(`${E}The "${Fe(K==null?void 0:K.valueOwner,m==null?void 0:m.logic,"Part number")}" (\`${He(K==null?void 0:K.valueOwner,m==null?void 0:m.logic,"partNumber")}\`) input is missing or invalid.`);const H=await Ht.get(`${m.env.API_BASE_URL}/cloud-files-service/v1/files/multipart/${G}?bucket=${D}&key=${encodeURIComponent(N)}&partNumber=${q}`,{headers:{Authorization:`Bearer ${await m.getAccessToken()}`}});return{value:U.Success,error:null,result:H.data}}catch(m){return{value:U.UnhandledError,error:m,result:null}}}})}}class Wct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:Me.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_COMPLETE_MULTIPART_UPLOAD,version:"1.0.0",description:"Cloud File System: Complete Multipart Upload",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Logic]});C(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic);if(!n)return;const s=n.get(je.CompleteMultipartUpload);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{var s,c,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=He(i,i.project,"completeMultipartUpload"),E="["+Fe(i,i.project,"Complete multipart upload")+": `"+T+"`] ",I=n.find(ee=>{var re,Y;return((Y=(re=ee.valueOwner)==null?void 0:re.declaration)==null?void 0:Y.id)===L.operation[je.CompleteMultipartUpload].inputs.bucket.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==a.DefinitionEntity)throw new Error(`${E}Invalid input "${Fe(I==null?void 0:I.valueOwner,m==null?void 0:m.logic,"Storage")}" (\`${He(I==null?void 0:I.valueOwner,m==null?void 0:m.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const D=Bs(A==null?void 0:A.id,((c=m.branchHead)==null?void 0:c.identifier)||"main"),V=n.find(ee=>{var re,Y;return((Y=(re=ee.valueOwner)==null?void 0:re.declaration)==null?void 0:Y.id)===L.operation[je.CompleteMultipartUpload].inputs.key.id}),N=(e=V==null?void 0:V.value)==null?void 0:e.value;if(!N||N==="")throw new Error(`${E}The "${Fe(V==null?void 0:V.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${He(V==null?void 0:V.valueOwner,m==null?void 0:m.logic,"key")}\`) input is missing.`);if(typeof N!="string")throw new Error(`${E}The "${Fe(V==null?void 0:V.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${He(V==null?void 0:V.valueOwner,m==null?void 0:m.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const x=n.find(ee=>{var re,Y;return((Y=(re=ee.valueOwner)==null?void 0:re.declaration)==null?void 0:Y.id)===L.operation[je.CompleteMultipartUpload].inputs.uploadId.id}),G=(f=x==null?void 0:x.value)==null?void 0:f.value;if(!G||G==="")throw new Error(`${E}The "${Fe(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"Upload ID")}" (\`${He(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"uploadId")}\`) input is missing.`);if(typeof G!="string")throw new Error(`${E}The "${Fe(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"Upload ID")}" (\`${He(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"uploadId")}\`) input value is invalid, if present, it must be a non-empty string.`);const K=n.find(ee=>{var re,Y;return((Y=(re=ee.valueOwner)==null?void 0:re.declaration)==null?void 0:Y.id)===L.operation[je.CompleteMultipartUpload].inputs.parts.id}),q=(y=K==null?void 0:K.value)==null?void 0:y.value;if(!Array.isArray(q)||q.length===0)throw new Error(`${E}The "${Fe(K==null?void 0:K.valueOwner,m==null?void 0:m.logic,"Parts")}" (\`${He(K==null?void 0:K.valueOwner,m==null?void 0:m.logic,"parts")}\`) input is missing or empty.`);if(q.some(ee=>{let re=!1,Y=!1;return(ee.partNumber&&Number(ee.partNumber)>0||ee.PartNumber&&Number(ee.PartNumber)>0)&&(re=!0),(ee.etag&&typeof ee.etag=="string"||ee.ETag&&typeof ee.ETag=="string")&&(Y=!0),!re||!Y}))throw new Error(`${E}The "${Fe(K==null?void 0:K.valueOwner,m==null?void 0:m.logic,"Parts")}" (\`${He(K==null?void 0:K.valueOwner,m==null?void 0:m.logic,"parts")}\`) input value is invalid, if present, it must be an array of objects with "partNumber" and "etag" properties.`);const W=(await Ht.post(`${m.env.API_BASE_URL}/cloud-files-service/v1/files/multipart/${G}/complete?bucket=${D}&key=${encodeURIComponent(N)}`,{parts:q},{headers:{Authorization:`Bearer ${await m.getAccessToken()}`}})).data||{};return{value:U.Success,error:null,result:{location:W.location||W.Location||N,key:W.key||W.Key||N,etag:W.etag||W.ETag||null}}}catch(m){return{value:U.UnhandledError,error:m,result:null}}}})}}class zct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:Me.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_ABORT_MULTIPART_UPLOAD,version:"1.0.0",description:"Cloud File System: Abort Multipart Upload",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Logic]});C(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic);if(!n)return;const s=n.get(je.AbortMultipartUpload);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{var s,c,e,f;try{const y=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!y||!y.env)throw new Error("Editor context or environment missing");const m=He(i,i.project,"abortMultipartUpload"),g="["+Fe(i,i.project,"Abort multipart upload")+": `"+m+"`] ",E=n.find(q=>{var H,W;return((W=(H=q.valueOwner)==null?void 0:H.declaration)==null?void 0:W.id)===L.operation[je.AbortMultipartUpload].inputs.bucket.id}),I=(s=E==null?void 0:E.value)==null?void 0:s.valueAsType;if(!I||!I.id||!I.name||I.type!==a.DefinitionEntity)throw new Error(`${g}Invalid input "${Fe(E==null?void 0:E.valueOwner,y==null?void 0:y.logic,"Storage")}" (\`${He(E==null?void 0:E.valueOwner,y==null?void 0:y.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const A=Bs(I==null?void 0:I.id,((c=y.branchHead)==null?void 0:c.identifier)||"main"),D=n.find(q=>{var H,W;return((W=(H=q.valueOwner)==null?void 0:H.declaration)==null?void 0:W.id)===L.operation[je.AbortMultipartUpload].inputs.key.id}),V=(e=D==null?void 0:D.value)==null?void 0:e.value;if(!V||V==="")throw new Error(`${g}The "${Fe(D==null?void 0:D.valueOwner,y==null?void 0:y.logic,"Key")}" (\`${He(D==null?void 0:D.valueOwner,y==null?void 0:y.logic,"key")}\`) input is missing.`);if(typeof V!="string")throw new Error(`${g}The "${Fe(D==null?void 0:D.valueOwner,y==null?void 0:y.logic,"Key")}" (\`${He(D==null?void 0:D.valueOwner,y==null?void 0:y.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const N=n.find(q=>{var H,W;return((W=(H=q.valueOwner)==null?void 0:H.declaration)==null?void 0:W.id)===L.operation[je.AbortMultipartUpload].inputs.uploadId.id}),x=(f=N==null?void 0:N.value)==null?void 0:f.value;if(!x||x==="")throw new Error(`${g}The "${Fe(N==null?void 0:N.valueOwner,y==null?void 0:y.logic,"Upload ID")}" (\`${He(N==null?void 0:N.valueOwner,y==null?void 0:y.logic,"uploadId")}\`) input is missing.`);if(typeof x!="string")throw new Error(`${g}The "${Fe(N==null?void 0:N.valueOwner,y==null?void 0:y.logic,"Upload ID")}" (\`${He(N==null?void 0:N.valueOwner,y==null?void 0:y.logic,"uploadId")}\`) input value is invalid, if present, it must be a non-empty string.`);const K=(await Ht.delete(`${y.env.API_BASE_URL}/cloud-files-service/v1/files/multipart/${x}?bucket=${A}&key=${encodeURIComponent(V)}`,{headers:{Authorization:`Bearer ${await y.getAccessToken()}`}})).data;return{value:U.Success,error:null,result:null}}catch(y){return{value:U.UnhandledError,error:y,result:null}}}})}}class Lrn extends _e{constructor(){super(...arguments);C(this,"manifest",{id:Me.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_UPLOAD_FILE_PART,version:"1.0.0",description:"Cloud File System: Upload File Part",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Logic]});C(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic);if(!n)return;const s=n.get(je.UploadFilePart);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{var s,c,e,f,y,m,T,g,E;try{const I=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!I||!I.env)throw new Error("Editor context or environment missing");const A=He(i,i.project,"uploadFilePart"),V="["+Fe(i,i.project,"Upload file part")+": `"+A+"`] ",N=n.find(ve=>{var Ce,Oe;return((Oe=(Ce=ve.valueOwner)==null?void 0:Ce.declaration)==null?void 0:Oe.id)===L.operation[je.UploadFilePart].inputs.bucket.id}),x=(s=N==null?void 0:N.value)==null?void 0:s.valueAsType;if(!x||!x.id||!x.name||x.type!==a.DefinitionEntity)throw new Error(`${V}Invalid input "${Fe(N==null?void 0:N.valueOwner,I==null?void 0:I.logic,"Storage")}" (\`${He(N==null?void 0:N.valueOwner,I==null?void 0:I.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const G=Bs(x==null?void 0:x.id,((c=I.branchHead)==null?void 0:c.identifier)||"main");if(!((I==null?void 0:I.liveResources)||[]).find(ve=>ve.resourceId===G))throw new Error(`${V}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const q=n.find(ve=>{var Ce,Oe;return((Oe=(Ce=ve.valueOwner)==null?void 0:Ce.declaration)==null?void 0:Oe.id)===L.operation[je.UploadFilePart].inputs.key.id}),H=(e=q==null?void 0:q.value)==null?void 0:e.value;if(!H||H==="")throw new Error(`${V}The "${Fe(q==null?void 0:q.valueOwner,I==null?void 0:I.logic,"Key")}" (\`${He(q==null?void 0:q.valueOwner,I==null?void 0:I.logic,"key")}\`) input is missing.`);if(typeof H!="string")throw new Error(`${V}The "${Fe(q==null?void 0:q.valueOwner,I==null?void 0:I.logic,"Key")}" (\`${He(q==null?void 0:q.valueOwner,I==null?void 0:I.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const W=n.find(ve=>{var Ce,Oe;return((Oe=(Ce=ve.valueOwner)==null?void 0:Ce.declaration)==null?void 0:Oe.id)===L.operation[je.UploadFilePart].inputs.uploadId.id}),ee=(f=W==null?void 0:W.value)==null?void 0:f.value;if(!ee||ee==="")throw new Error(`${V}The "${Fe(W==null?void 0:W.valueOwner,I==null?void 0:I.logic,"Upload ID")}" (\`${He(W==null?void 0:W.valueOwner,I==null?void 0:I.logic,"uploadId")}\`) input is missing.`);if(typeof ee!="string")throw new Error(`${V}The "${Fe(W==null?void 0:W.valueOwner,I==null?void 0:I.logic,"Upload ID")}" (\`${He(W==null?void 0:W.valueOwner,I==null?void 0:I.logic,"uploadId")}\`) input value is invalid, if present, it must be a non-empty string.`);const re=n.find(ve=>{var Ce,Oe;return((Oe=(Ce=ve.valueOwner)==null?void 0:Ce.declaration)==null?void 0:Oe.id)===L.operation[je.UploadFilePart].inputs.partNumber.id}),Y=Number((y=re==null?void 0:re.value)==null?void 0:y.value);if(((m=re==null?void 0:re.value)==null?void 0:m.value)===void 0||((T=re==null?void 0:re.value)==null?void 0:T.value)===null||isNaN(Y)||Y<=0)throw new Error(`${V}The "${Fe(re==null?void 0:re.valueOwner,I==null?void 0:I.logic,"Part number")}" (\`${He(re==null?void 0:re.valueOwner,I==null?void 0:I.logic,"partNumber")}\`) input is missing or invalid.`);const Z=n.find(ve=>{var Ce,Oe;return((Oe=(Ce=ve.valueOwner)==null?void 0:Ce.declaration)==null?void 0:Oe.id)===L.operation[je.UploadFilePart].inputs.bytes.id}),J=(g=Z==null?void 0:Z.value)==null?void 0:g.value;if(J==null)throw new Error(`${V}The "${Fe(Z==null?void 0:Z.valueOwner,I==null?void 0:I.logic,"Bytes")}" (\`${He(Z==null?void 0:Z.valueOwner,I==null?void 0:I.logic,"bytes")}\`) input is missing.`);const z=(E=(await Ht.get(`${I.env.API_BASE_URL}/cloud-files-service/v1/files/multipart/${ee}?bucket=${G}&key=${encodeURIComponent(H)}&partNumber=${Y}`,{headers:{Authorization:`Bearer ${await I.getAccessToken()}`}})).data)==null?void 0:E.uploadUrl;if(!z)throw new Error(`${V}Failed to obtain presigned upload URL for part ${Y}.`);const ie=await Ht.put(z,J,{headers:{"Content-Type":"application/octet-stream"}}),pe=ie.headers.etag||ie.headers.ETag||"",me=typeof pe=="string"?pe.replace(/"/g,""):"";return{value:U.Success,error:null,result:{partNumber:Y,etag:me}}}catch(I){return{value:U.UnhandledError,error:I,result:null}}}})}}class l$ extends VO{constructor(u,i,n=i.projectId){super(u,X.Editor),this._editor=i,this.id=n}get ready(){return this._editor.ready}get env(){return this._editor.env}get hasLoadedLogic(){return this._editor.hasLoadedLogic}get destroyed(){return this._editor.destroyed}get logicLoadingPromise(){return this._editor.logicLoadingPromise}get logic(){return this._editor.logic}get lastPublishedProjectState(){return this._editor.lastPublishedProjectState}get branchHead(){return this._editor.branchHead}get branchHeadPromise(){return this._editor.branchHeadPromise}get projectId(){return this._editor.projectId}get sessionId(){return this._editor.sessionId}get userAuthorId(){return this._editor.userAuthorId}get peerConnections(){return this._editor.peerConnections}get test(){return this._editor.test}get localTestValues(){return this._editor.localTestValues}get resolvedValues(){return this._editor.resolvedValues}get persistedExecutionResults(){return this._editor.persistedExecutionResults}get publication(){return this._editor.publication}get livePublishedVersions(){return this._editor.livePublishedVersions}get publications(){return this._editor.publications}get liveResources(){return this._editor.liveResources}get execution(){return this._editor.execution}get project(){return this._editor.logic}get lastExecutionResults(){return this._editor.lastExecutionResults}get undoableStackValueIndex(){return this._editor.undoableStackValueIndex}set undoableStackValueIndex(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,n){return this._editor.resolveInitialChildrenPositions(u,i,n)}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,n){return this._editor.moveBranchHeadToVersion(u,i,n)}loadInitialBranchHead(){return this._editor.loadInitialBranchHead()}}function Grn(r,u){return u instanceof l$?u:new l$(r,u)}class o$ extends VO{constructor(u,i){super(u,X.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 Brn(r,u){return u instanceof o$?u:new o$(r,u)}function Mrn(r){r.register(new Ert(r)),r.register(new brt(r)),r.register(new mrt(r)),r.register(new vrt(r)),r.register(new grt(r)),r.register(new Trt(r)),r.register(new tdt(r)),r.register(new idt(r)),r.register(new ndt(r)),r.register(new adt(r)),r.register(new rdt(r)),r.register(new sdt(r)),r.register(new Zut(r)),r.register(new Hut(r)),r.register(new Wut(r)),r.register(new zut(r)),r.register(new Yut(r)),r.register(new Jut(r)),r.register(new Qut(r)),r.register(new Xut(r)),r.register(new ept(r)),r.register(new tpt(r)),r.register(new eot(r)),r.register(new tot(r)),r.register(new iot(r)),r.register(new not(r)),r.register(new rot(r)),r.register(new aot(r)),r.register(new sot(r)),r.register(new lot(r)),r.register(new oot(r)),r.register(new dot(r)),r.register(new uot(r)),r.register(new pot(r)),r.register(new cot(r)),r.register(new fot(r)),r.register(new yot(r)),r.register(new hot(r)),r.register(new mot(r)),r.register(new Tot(r)),r.register(new vot(r)),r.register(new Eot(r)),r.register(new Aot(r)),r.register(new Iot(r)),r.register(new blt(r)),r.register(new Elt(r)),r.register(new Alt(r)),r.register(new Ilt(r)),r.register(new Rlt(r)),r.register(new Dlt(r)),r.register(new Clt(r)),r.register(new wlt(r)),r.register(new Olt(r)),r.register(new xlt(r)),r.register(new _lt(r)),r.register(new Vlt(r)),r.register(new Nlt(r)),r.register(new $lt(r)),r.register(new Sst(r)),r.register(new uut(r)),r.register(new out(r)),r.register(new dut(r)),r.register(new Mat(r)),r.register(new Sat(r)),r.register(new Fat(r)),r.register(new kat(r)),r.register(new Uat(r)),r.register(new jat(r)),r.register(new Kat(r)),r.register(new qat(r)),r.register(new Zat(r)),r.register(new ast(r)),r.register(new Gst(r)),r.register(new Bst(r)),r.register(new Mst(r)),r.register(new Hat(r)),r.register(new Wat(r)),r.register(new zat(r)),r.register(new Yat(r)),r.register(new Jat(r)),r.register(new Qat(r)),r.register(new Xat(r)),r.register(new est(r)),r.register(new tst(r)),r.register(new ist(r)),r.register(new nst(r)),r.register(new rst(r)),r.register(new sst(r)),r.register(new lst(r)),r.register(new ost(r)),r.register(new dst(r)),r.register(new ust(r)),r.register(new pst(r)),r.register(new cst(r)),r.register(new fst(r)),r.register(new yst(r)),r.register(new hst(r)),r.register(new mst(r)),r.register(new Tst(r)),r.register(new Cst(r)),r.register(new wst(r)),r.register(new Ost(r)),r.register(new vst(r)),r.register(new gst(r)),r.register(new bst(r)),r.register(new Est(r)),r.register(new Ast(r)),r.register(new Ist(r)),r.register(new Rst(r)),r.register(new Dst(r)),r.register(new yut(r)),r.register(new hut(r)),r.register(new mut(r)),r.register(new Tut(r)),r.register(new put(r)),r.register(new cut(r)),r.register(new fut(r)),r.register(new vut(r)),r.register(new but(r)),r.register(new Aut(r)),r.register(new gut(r)),r.register(new Eut(r)),r.register(new Iut(r)),r.register(new Cut(r)),r.register(new Rut(r)),r.register(new Dut(r)),r.register(new Llt(r)),r.register(new Slt(r)),r.register(new Flt(r)),r.register(new jlt(r)),r.register(new Klt(r)),r.register(new qlt(r)),r.register(new Zlt(r)),r.register(new Hlt(r)),r.register(new Wlt(r)),r.register(new zlt(r)),r.register(new Ylt(r)),r.register(new klt(r)),r.register(new Ult(r)),r.register(new Nct(r)),r.register(new $ct(r)),r.register(new Lct(r)),r.register(new Gct(r)),r.register(new Bct(r)),r.register(new Mct(r)),r.register(new Sct(r)),r.register(new Fct(r)),r.register(new kct(r)),r.register(new Uct(r)),r.register(new jct(r)),r.register(new Kct(r)),r.register(new qct(r)),r.register(new Zct(r)),r.register(new Hct(r)),r.register(new Wct(r)),r.register(new zct(r)),r.register(new Blt(r)),r.register(new Mlt(r)),r.register(new Glt(r)),r.register(new Plt(r)),r.register(new Qlt(r)),r.register(new Xlt(r)),r.register(new Jlt(r)),r.register(new odt(r)),r.register(new Vdt(r)),r.register(new _dt(r)),r.register(new Ndt(r)),r.register(new $dt(r)),r.register(new pdt(r)),r.register(new cdt(r)),r.register(new vdt(r)),r.register(new mdt(r)),r.register(new Pdt(r)),r.register(new Idt(r)),r.register(new Ddt(r)),r.register(new wdt(r)),r.register(new Cdt(r)),r.register(new Tdt(r)),r.register(new bdt(r)),r.register(new Edt(r)),r.register(new gdt(r)),r.register(new ldt(r)),r.register(new fdt(r)),r.register(new Rdt(r)),r.register(new Bdt(r)),r.register(new QN(r)),r.register(new udt(r)),r.register(new ydt(r)),r.register(new ddt(r)),r.register(new Odt(r)),r.register(new hdt(r)),r.register(new Adt(r)),r.register(new xdt(r)),r.register(new Gdt(r)),r.register(new Ldt(r)),r.register(new Mdt(r)),r.register(new QN(r)),r.register(new Fdt(r)),r.register(new Sdt(r)),r.register(new kdt(r)),r.register(new Mot(r)),r.register(new Sot(r)),r.register(new Fot(r)),r.register(new Dot(r)),r.register(new bot(r)),r.register(new Pot(r)),r.register(new Not(r)),r.register(new got(r)),r.register(new $ot(r)),r.register(new Bot(r)),r.register(new _ot(r)),r.register(new xot(r)),r.register(new wD(r)),r.register(new kot(r)),r.register(new Uot(r)),r.register(new Vot(r)),r.register(new Got(r)),r.register(new Lot(r)),r.register(new Oot(r)),r.register(new wot(r)),r.register(new Cot(r)),r.register(new Rot(r)),r.register(new qot(r)),r.register(new Kot(r)),r.register(new Zot(r)),r.register(new jot(r)),r.register(new Vst(r)),r.register(new Pst(r)),r.register(new _st(r)),r.register(new Nst(r)),r.register(new $st(r)),r.register(new xst(r)),r.register(new Lst(r)),r.register(new rpt(r)),r.register(new upt(r)),r.register(new cpt(r)),r.register(new ypt(r)),r.register(new hpt(r)),r.register(new mpt(r)),r.register(new Tpt(r)),r.register(new dpt(r)),r.register(new ppt(r)),r.register(new fpt(r)),r.register(new opt(r)),r.register(new lpt(r)),r.register(new spt(r)),r.register(new apt(r)),r.register(new ipt(r)),r.register(new npt(r)),r.register(new Apt(r)),r.register(new Ipt(r)),r.register(new bpt(r)),r.register(new Ept(r)),r.register(new qut(r)),r.register(new vpt(r)),r.register(new gpt(r)),r.register(new Dpt(r)),r.register(new Rpt(r)),r.register(new Cpt(r)),r.register(new wpt(r)),r.register(new Opt(r)),r.register(new Art(r)),r.register(new Irt(r)),r.register(new DD(r)),r.register(new CD(r)),r.register(new Npt(r)),r.register(new $pt(r)),r.register(new Bpt(r)),r.register(new Kpt(r)),r.register(new Spt(r)),r.register(new Lpt(r)),r.register(new Gpt(r)),r.register(new Fpt(r)),r.register(new Mpt(r)),r.register(new kpt(r)),r.register(new Upt(r)),r.register(new jpt(r)),r.register(new qpt(r)),r.register(new Zpt(r)),r.register(new Hpt(r)),r.register(new Wpt(r)),r.register(new zpt(r)),r.register(new Ypt(r)),r.register(new Jpt(r)),r.register(new Qpt(r)),r.register(new Xpt(r)),r.register(new ect(r)),r.register(new fct(r)),r.register(new tct(r)),r.register(new ict(r)),r.register(new nct(r)),r.register(new rct(r)),r.register(new act(r)),r.register(new sct(r)),r.register(new lct(r)),r.register(new oct(r)),r.register(new uct(r)),r.register(new pct(r)),r.register(new cct(r)),r.register(new yct(r)),r.register(new Vct(r)),r.register(new mct(r)),r.register(new Dct(r)),r.register(new Ect(r)),r.register(new Act(r)),r.register(new bct(r)),r.register(new Oct(r)),r.register(new hct(r)),r.register(new Tct(r)),r.register(new Pct(r)),r.register(new wct(r)),r.register(new _ct(r)),r.register(new gct(r)),r.register(new vct(r)),r.register(new Ict(r)),r.register(new xct(r)),r.register(new Cct(r)),r.register(new Rct(r)),r.register(new Ppt(r)),r.register(new xpt(r))}class IS{constructor(u=new oe.Events("extensions-registry-fallback-events")){C(this,"extensionsRegistry",new Map);C(this,"initialized",new Set);C(this,"initializedContexts",new Set);C(this,"onResolveEditorContextCallback",()=>null);C(this,"onResolveProjectLogicContextCallback",()=>null);C(this,"onResolveEditorGUIContextCallback",()=>null);C(this,"onResolveGUIContextCallback",()=>null);C(this,"onResolveCompileContextCallback",()=>null);C(this,"onResolvePublicationRunContextCallback",()=>null);this.events=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||Pe.Normal)-(i.manifest.initPriority||Pe.Normal))}async setup(){Mrn(this),oe.Logger.log("Initializing extensions without context..."),this.initForReady()}requestContext(u){switch(u){case X.Editor:return this.onResolveEditorContextCallback();case X.Logic:return this.onResolveProjectLogicContextCallback();case X.EditorGUI:return this.onResolveEditorGUIContextCallback();case X.Compile:return this.onResolveCompileContextCallback();case X.PublicationRun:return this.onResolvePublicationRunContextCallback();case X.GUI:return this.onResolveGUIContextCallback();case X.EditorGUI:return this.onResolveEditorGUIContextCallback();default:throw new Error(`Unknown context type: ${u}`)}}requestContexts(u,i=[]){const n=[];i.length===0&&(i=u.manifest.contexts);for(const s of i){const c=this.requestContext(s);c&&n.push(c)}return n}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 n of this.extensionInOrder)if(n.module.init&&!this.initialized.has(n.manifest.id)){const s=n.manifest.contexts.map(c=>this.requestContext(c)).filter(c=>c!==null);s.length&&(await((i=(u=n.module).init)==null?void 0:i.call(u,s)),this.initialized.add(n.manifest.id))}else!n.module.init&&!this.initialized.has(n.manifest.id)&&this.initialized.add(n.manifest.id)}async initForReady(){oe.Logger.log("Initializing extensions for ready contexts...");for(const u of this.extensionInOrder)if(u.module.init&&!this.initialized.has(u.manifest.id)){oe.Logger.debug("Initializing "+u.manifest.id+" extension...");const i=this.requestContexts(u);u.manifest.contexts.every(s=>!!i.find(c=>c.contextType===s))?(await u.module.init(i),this.initialized.add(u.manifest.id)):oe.Logger.warn(`Skipping initialization of ${u.manifest.id} extension, not all contexts are ready.`,`Required contexts: ${u.manifest.contexts.join(", ")}`,`Available contexts: ${i.map(s=>s.contextType).join(", ")}`)}else!u.module.init&&!this.initialized.has(u.manifest.id)?(oe.Logger.log("Set "+u.manifest.id+" extension as initialized by default..."),this.initialized.add(u.manifest.id)):oe.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)){oe.Logger.warn(`Context ${u} is already initialized. Skipping re-initialization.`);return}switch(this.initializedContexts.add(u),u){case X.Editor:{if(!this.onResolveEditorContextCallback)throw new Error("No editor context resolver callback set. Call onResolveEditorContext first.");break}case X.Logic:{if(!this.onResolveProjectLogicContextCallback)throw new Error("No project logic context resolver callback set. Call onResolveProjectLogicContext first.");break}}oe.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 W1=null;const RS={requestExtension:r=>(W1||(W1=new IS,W1.setup()),W1.requestExtension(r))};function iy(r){return!(r instanceof Error)&&typeof r=="object"&&r!==null?r:r instanceof Error?{name:r.name,message:r.message,stack:r.stack,...r}:r}function r3(r){var u,i,n;if(r&&typeof r=="object"&&"value"in r){const s=r;return{single:((u=s.value)==null?void 0:u.valueAsTypeSingle)??((i=s.value)==null?void 0:i.value),list:((n=s.value)==null?void 0:n.valueAsTypeList)??null}}return{single:r,list:Array.isArray(r)?r:null}}const ny={onBeforeEntityExecution:async()=>{},onEntityExecuted:async()=>{}};class d$ extends Error{constructor(){super("Execution was stopped"),this.name="ExecutionStoppedError"}}var DS=(r=>(r.FinishedSuccess="finished-success",r.FinishedError="finished-error",r.Running="running",r.Paused="paused",r.Stopped="stopped",r.NotStarted="not-started",r))(DS||{});const Yct={...RS,getValueTypePreference:()=>null,setValueTypePreference:()=>{}};class ET extends oe.Events{constructor(i,n,s,c=null,e=Yct){super();C(this,"project");C(this,"entryPoint");C(this,"state","not-started");C(this,"events",new oe.Events("fe-exec-inst-events"));C(this,"entities",[]);C(this,"parentExecution",null);C(this,"executing",[]);C(this,"executed",[]);C(this,"skipped",[]);C(this,"scheduled",[]);C(this,"localTestValues");C(this,"resolvedValues");C(this,"persistedExecutionResults");C(this,"lastExecutionResults");C(this,"onAddToSkippedListCallback",null);C(this,"onRemoveFromSkippedListCallback",null);C(this,"onAddEntityCallback",null);C(this,"onRemoveEntityCallback",null);C(this,"onAbortExecutionCallback",null);this.parentContext=e,this.entities=n,this.entryPoint=s,this.project=i,this.parentExecution=c,this.localTestValues=new fE(M.UUID.uuid(),this.project),this.resolvedValues=new fE(M.UUID.uuid(),this.project),this.persistedExecutionResults=new fE(M.UUID.uuid(),this.project),this.lastExecutionResults=new fE(M.UUID.uuid(),this.project)}get valueResolutionContext(){return{execution:this,project:this.project,localTestValues:this.localTestValues,resolvedValues:this.resolvedValues,persistedExecutionResults:this.persistedExecutionResults,lastExecutionResults:this.lastExecutionResults,getValueTypePreference:this.parentContext.getValueTypePreference,setValueTypePreference:this.parentContext.setValueTypePreference}}get rootExecution(){let 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 d$;for(;this.isPaused();){if(this.isStopped())throw new d$;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),er.includes(i.type)&&Ut(i).forEach(n=>this.skip(n))))}async schedule(i,n,s){if(this.hasExecuted(i))return null;if(xi.includes(i.type))return this.executeBranch(i,s,n);if(tr.includes(i.type)){if(i.calledBy.every(e=>this.hasExecuted(e)||!this.hasEntity(e)))return this.executeBranch(i,s,n);this.scheduled.includes(i)||this.scheduled.push(i)}return null}mergeExernalValuesWithInternalInputs(i,n){const s=[];return wi.includes(n.type)?s.push(...n.inputs.filter(e=>O0(e))):[...fi,...xi].includes(n.type)?s.push(...n.inputs):ci.includes(n.type)&&s.push(...n.outputs.filter(e=>O0(e))),s.map(e=>{var y;let f=i.find(m=>m.valueOwner.id===e.id);if(f)return f;if(!f&&xi.includes(n.type)&&(f=i.find(m=>{var T;return((T=m.valueOwner.declaration)==null?void 0:T.id)===e.id})),f){const m=(y=f.value)==null?void 0:y.clone(null);return m==null||m.setStandaloneParent(e,null),{...f,valueOwner:e,value:m||null,inheritanceLink:{sources:[f],target:e}}}return Za.includes(e.type)?Jd(e,this.valueResolutionContext):qu(e,this.valueResolutionContext)}).reduce((e,f)=>{const y=Qp(f==null?void 0:f.valueOwner,this.project),m=f?[f]:[];return y.forEach(T=>{var I,A,D;if(T.id===(f==null?void 0:f.valueOwner.id))return;const g=rn(T.getDataType(null),T,this.project);g==null||g.metaSync({value:(I=f==null?void 0:f.value)==null?void 0:I.value},null),g==null||g.setValueAsTypeList(((A=f==null?void 0:f.value)==null?void 0:A.valueAsTypeList)||null),g==null||g.setValueAsTypeSingle(((D=f==null?void 0:f.value)==null?void 0:D.valueAsTypeSingle)||null);const E={...f,valueOwner:T,value:g};m.push(E)}),[...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,n,s,c={}){var f,y;this.logBeforeExecution("executeInternalCall",i,n);const e={...ny,...c};try{let m={value:U.Success,error:null,result:null};if(n.sort((D,V)=>D.valueOwner.index-V.valueOwner.index),Object.values(xa).includes(i.declaration.id)){const D=this.parentContext.requestExtension(_i+i.declaration.id).module.main;D?m=await D(i,n,this):oe.Logger.warn(`No implementation found for built-in function: ${i.declaration.id}`)}else{const D=await this.executeDetachedFullFunctionDeclarationLogic(i.declaration,n,s,e);m={value:D.value,error:D.error,result:D.result}}let T=null;if(m.error&&i.error){oe.Logger.warn("Raw error executing entity: ",m.error);const{single:D,list:V}=r3(m.error),N=iy(D),x=(f=i.error)==null?void 0:f.getDataType(null),G=rn(x||null,i.error,s);if(x!=null&&x.asType)V!==null?G==null||G.setValueAsTypeList(V):G==null||G.setValueAsTypeSingle(D);else{const K=pa(N)?JSON.stringify(N,null,2):N;G==null||G.metaSync({value:K},null)}T={valueOwner:i.error,type:We.ExecutionResult,inheritanceLink:null,value:G}}const g=i==null?void 0:i.getDataType(null),E=rn(g,i,s),{single:I,list:A}=r3(m.result);return g!=null&&g.asType?A!==null?E==null||E.setValueAsTypeList(A):E==null||E.setValueAsTypeSingle(I):E==null||E.metaSync({value:I},null),{value:m.value,entity:i,error:T,result:{value:E||null,valueOwner:i,type:We.ExecutionResult,inheritanceLink:null}}}catch(m){if(m&&(m.name==="ExecutionStoppedError"||m.message==="Execution was stopped"))throw m;oe.Logger.warn("Internal call execution error: ",m);let T=null;if(i.error){const g=iy(m),E=(y=i.error)==null?void 0:y.getDataType(null),I=rn(E,i.error,s);if(E!=null&&E.asType)I==null||I.setValueAsTypeSingle(m);else{const A=pa(g)?JSON.stringify(g,null,2):g;I==null||I.metaSync({value:A},null)}T={valueOwner:i.error,type:We.ExecutionResult,inheritanceLink:null,value:I}}return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,entity:i,error:T,result:null}}}static async executeOperation(i,n,s,c){var e,f;c?c.logBeforeExecution("executeOperation",i,n):console.log(`executeOperation (${i.type}) -> [${Ee(i,s)}] Inputs:${n.length?`
|
|
61
|
+
`),u}class kpt extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleDriveUploadFile,version:"2.0.0",description:"Upload a file to Google Drive (media / import+copy) with auto content detection and simplified inputs.",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleDriveUploadFile);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m,T,g,E,I,A,D,V,N,x,G,K,q,H,W,ee,re,Y,Z,J,ne,z,ie,pe,me,ve,Ce,Oe;try{const Ve=((c=(s=n.find(Ji=>{var hi,mi;return((mi=(hi=Ji.valueOwner)==null?void 0:hi.declaration)==null?void 0:mi.id)===L.operation[le.GoogleDriveUploadFile].inputs.connection.id}))==null?void 0:s.value)==null?void 0:c.valueAsType)??((f=(e=n.find(Ji=>{var hi,mi;return((mi=(hi=Ji.valueOwner)==null?void 0:hi.declaration)==null?void 0:mi.id)===L.operation[le.GoogleDriveUploadFile].inputs.connection.id}))==null?void 0:e.value)==null?void 0:f.value);if(!(Ve instanceof Ga))return jp(i,"Invalid or missing connection entity");const Ie=((m=(y=n.find(Ji=>{var hi,mi;return((mi=(hi=Ji.valueOwner)==null?void 0:hi.declaration)==null?void 0:mi.id)===L.operation[le.GoogleDriveUploadFile].inputs.content.id}))==null?void 0:y.value)==null?void 0:m.valueAsType)??((g=(T=n.find(Ji=>{var hi,mi;return((mi=(hi=Ji.valueOwner)==null?void 0:hi.declaration)==null?void 0:mi.id)===L.operation[le.GoogleDriveUploadFile].inputs.content.id}))==null?void 0:T.value)==null?void 0:g.value),$e=(V=((I=(E=n.find(Ji=>{var hi,mi;return((mi=(hi=Ji.valueOwner)==null?void 0:hi.declaration)==null?void 0:mi.id)===L.operation[le.GoogleDriveUploadFile].inputs.name.id}))==null?void 0:E.value)==null?void 0:I.valueAsType)??((D=(A=n.find(Ji=>{var hi,mi;return((mi=(hi=Ji.valueOwner)==null?void 0:hi.declaration)==null?void 0:mi.id)===L.operation[le.GoogleDriveUploadFile].inputs.name.id}))==null?void 0:A.value)==null?void 0:D.value))==null?void 0:V.trim(),Ze=(((x=(N=n.find(Ji=>{var hi,mi;return((mi=(hi=Ji.valueOwner)==null?void 0:hi.declaration)==null?void 0:mi.id)===L.operation[le.GoogleDriveUploadFile].inputs.mimeType.id}))==null?void 0:N.value)==null?void 0:x.valueAsType)??((K=(G=n.find(Ji=>{var hi,mi;return((mi=(hi=Ji.valueOwner)==null?void 0:hi.declaration)==null?void 0:mi.id)===L.operation[le.GoogleDriveUploadFile].inputs.mimeType.id}))==null?void 0:G.value)==null?void 0:K.value))||"application/octet-stream",qe=(((H=(q=n.find(Ji=>{var hi,mi;return((mi=(hi=Ji.valueOwner)==null?void 0:hi.declaration)==null?void 0:mi.id)===L.operation[le.GoogleDriveUploadFile].inputs.folderId.id}))==null?void 0:q.value)==null?void 0:H.valueAsType)??((ee=(W=n.find(Ji=>{var hi,mi;return((mi=(hi=Ji.valueOwner)==null?void 0:hi.declaration)==null?void 0:mi.id)===L.operation[le.GoogleDriveUploadFile].inputs.folderId.id}))==null?void 0:W.value)==null?void 0:ee.value))||void 0,rt=(((Y=(re=n.find(Ji=>{var hi,mi;return((mi=(hi=Ji.valueOwner)==null?void 0:hi.declaration)==null?void 0:mi.id)===L.operation[le.GoogleDriveUploadFile].inputs.description.id}))==null?void 0:re.value)==null?void 0:Y.valueAsType)??((J=(Z=n.find(Ji=>{var hi,mi;return((mi=(hi=Ji.valueOwner)==null?void 0:hi.declaration)==null?void 0:mi.id)===L.operation[le.GoogleDriveUploadFile].inputs.description.id}))==null?void 0:Z.value)==null?void 0:J.value))||void 0,lt=(((z=(ne=n.find(Ji=>{var hi,mi;return((mi=(hi=Ji.valueOwner)==null?void 0:hi.declaration)==null?void 0:mi.id)===L.operation[le.GoogleDriveUploadFile].inputs.importMimeType.id}))==null?void 0:ne.value)==null?void 0:z.valueAsType)??((pe=(ie=n.find(Ji=>{var hi,mi;return((mi=(hi=Ji.valueOwner)==null?void 0:hi.declaration)==null?void 0:mi.id)===L.operation[le.GoogleDriveUploadFile].inputs.importMimeType.id}))==null?void 0:ie.value)==null?void 0:pe.value))||"text/plain";if(!$e)return jp(i,"Missing required input: name");const it=this.extensionsRegistry.requestContexts(this,[X.Editor])[0],Ye=Mi(Ve),vt={Authorization:`Bearer ${await it.getAccessToken()}`},_t=`${((me=it.env)==null?void 0:me.API_BASE_URL)+"/editor-runtime"}/v2/external-integrations/proxy/${it.projectId}/${qt["google-drive"]}/${Ye}`,bt=async(Ji,hi,{params:mi,body:Ds,contentType:ls,providerHeaders:Cr,responseType:br}={})=>{const oi=`${_t}/${yrn(hi)}`,ei={...vt};return ls&&(ei["Content-Type"]=ls),(Cr||br)&&(ei[frn]=JSON.stringify({...Cr?{headers:Cr}:{},...br?{responseType:br}:{}})),Ht.request({method:Ji,url:oi,params:mi,data:Ds,responseType:br||"json",headers:ei})},ht=typeof Ze=="string"&&Ze.startsWith("application/vnd.google-apps.");if(ht&&(Ie==null||Ie==="")){const Ji={name:$e,mimeType:Ze};qe&&(Ji.parents=[qe]),typeof rt=="string"&&(Ji.description=rt);const hi=await bt("POST","/drive/v3/files",{params:{supportsAllDrives:"true",fields:hE},body:JSON.stringify(Ji),contentType:"application/json"});return hi.status!==200&&hi.status!==201?jp(i,`Drive create failed (status=${hi.status})`):dN({file:hi.data})}if(ht&&Ie!=null){let Ji=await mrn(Ie);const mi=((br,oi)=>oi||(br==="application/vnd.google-apps.spreadsheet"?"text/csv":br==="application/vnd.google-apps.document"||br==="application/vnd.google-apps.presentation"?"text/html":"text/plain"))(Ze,lt),Ds=mi.startsWith("text/")&&!/charset=/i.test(mi)?`${mi}; charset=UTF-8`:mi;mi.startsWith("text/csv")&&(Ji=Trn(Ji));const ls=new TextEncoder().encode(Ji);if(ls.byteLength>n3)return jp(i,`Text body exceeds simple upload limit (${ls.byteLength} bytes).`);let Cr;try{const br=await bt("POST","/upload/drive/v3/files",{params:{uploadType:"media",supportsAllDrives:"true",fields:hE},body:ls,contentType:Ds});if(br.status!==200&&br.status!==201)return jp(i,`Drive media upload failed (status=${br.status})`);if(Cr=(ve=br.data)==null?void 0:ve.id,!Cr)return jp(i,"Drive media upload did not return an id");const oi={name:$e,mimeType:Ze};qe&&(oi.parents=[qe]),typeof rt=="string"&&(oi.description=rt);const ei=await bt("POST",`/drive/v3/files/${encodeURIComponent(Cr)}/copy`,{params:{supportsAllDrives:"true",fields:hE},body:JSON.stringify(oi),contentType:"application/json"});return ei.status!==200&&ei.status!==201?jp(i,`Drive copy-convert failed (status=${ei.status})`):dN({file:ei.data})}finally{if(Cr)try{await bt("DELETE",`/drive/v3/files/${encodeURIComponent(Cr)}`,{params:{supportsAllDrives:"true"}})}catch{}}}if(Ie==null)return jp(i,"Missing content for non-native upload");const{bytes:Zt,inferredMime:pt,isBinary:It}=await hrn(Ie),Nt=Zt.byteLength;if(Nt>n3)return jp(i,`File too large for simple upload (${Nt} bytes).`);const Dr=await bt("POST","/upload/drive/v3/files",{params:{uploadType:"media",supportsAllDrives:"true",fields:hE},body:Zt,contentType:Ze||pt||(It?"application/octet-stream":"text/plain; charset=UTF-8")});if(Dr.status!==200&&Dr.status!==201)return jp(i,`Drive media upload failed (status=${Dr.status})`);let ks=Dr.data;const Rs=(Ce=Dr.data)==null?void 0:Ce.id;return Rs&&(qe||$e||rt)&&(ks=await vrn(bt,Rs,$e,rt,qe)),dN({file:ks})}catch(Ve){const Ie=((Oe=Ve.response)==null?void 0:Oe.data)||Ve.message||Ve;return oe.Logger.error("[Google Drive] Upload document failed:",Ie),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:Ie,result:null}}}})}}function dN(r){return{value:U.Success,error:null,result:r}}function jp(r,u){return oe.Logger.log("[Google Drive] Upload error:",u),{value:r.catchesError||r.errorCalls.length?U.CaughtError:U.UnhandledError,error:u,result:null}}async function vrn(r,u,i,n,s){const c={};i&&(c.name=i),typeof n=="string"&&(c.description=n);const e={supportsAllDrives:"true",fields:hE},f={...e};s&&(f.addParents=s,f.removeParents="root");let y=await r("PATCH",`/drive/v3/files/${encodeURIComponent(u)}`,{params:f,body:JSON.stringify(c),contentType:"application/json"});if(y.status>=400&&s&&(y=await r("PATCH",`/drive/v3/files/${encodeURIComponent(u)}`,{params:{...e,addParents:s},body:JSON.stringify(c),contentType:"application/json"})),y.status!==200)throw new Error(`Drive metadata update failed (status=${y.status})`);return y.data}const grn="id,name,mimeType,webViewLink",brn="X-Elyx-Proxy-Config";function Ern(r){return r.startsWith("/")?r.slice(1):r}const uN=(r,u)=>(oe.Logger.log("[Google Drive Clone Document] error:",u),{value:r.catchesError||r.errorCalls.length?U.CaughtError:U.UnhandledError,error:u,result:null});class Upt extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleDriveCloneDocument,version:"1.0.0",description:"Google Drive clone document operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleDriveCloneDocument);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m,T,g,E,I,A,D,V,N,x,G;try{const K=L.operation[le.GoogleDriveCloneDocument],q=((c=(s=n.find(Oe=>{var Ve,Ie;return((Ie=(Ve=Oe.valueOwner)==null?void 0:Ve.declaration)==null?void 0:Ie.id)===K.inputs.connection.id}))==null?void 0:s.value)==null?void 0:c.valueAsType)??((f=(e=n.find(Oe=>{var Ve,Ie;return((Ie=(Ve=Oe.valueOwner)==null?void 0:Ve.declaration)==null?void 0:Ie.id)===K.inputs.connection.id}))==null?void 0:e.value)==null?void 0:f.value);if(!(q instanceof Ga))return uN(i,"Invalid or missing connection entity");const H=(m=(y=n.find(Oe=>{var Ve,Ie;return((Ie=(Ve=Oe.valueOwner)==null?void 0:Ve.declaration)==null?void 0:Ie.id)===K.inputs.documentId.id}))==null?void 0:y.value)==null?void 0:m.value;if(!H)return uN(i,"Missing required input: documentId");const W=(g=(T=n.find(Oe=>{var Ve,Ie;return((Ie=(Ve=Oe.valueOwner)==null?void 0:Ve.declaration)==null?void 0:Ie.id)===K.inputs.newName.id}))==null?void 0:T.value)==null?void 0:g.value,ee=(I=(E=n.find(Oe=>{var Ve,Ie;return((Ie=(Ve=Oe.valueOwner)==null?void 0:Ve.declaration)==null?void 0:Ie.id)===K.inputs.parentFolderIds.id}))==null?void 0:E.value)==null?void 0:I.value,re=(D=(A=n.find(Oe=>{var Ve,Ie;return((Ie=(Ve=Oe.valueOwner)==null?void 0:Ve.declaration)==null?void 0:Ie.id)===K.inputs.description.id}))==null?void 0:A.value)==null?void 0:D.value,Y=(N=(V=n.find(Oe=>{var Ve,Ie;return((Ie=(Ve=Oe.valueOwner)==null?void 0:Ve.declaration)==null?void 0:Ie.id)===K.inputs.starred.id}))==null?void 0:V.value)==null?void 0:N.value,Z=this.extensionsRegistry.requestContexts(this,[X.Editor])[0],J=Mi(q),z={Authorization:`Bearer ${await Z.getAccessToken()}`},ie=`${((x=Z.env)==null?void 0:x.API_BASE_URL)+"/editor-runtime"}/v2/external-integrations/proxy/${Z.projectId}/${qt["google-drive"]}/${J}`,pe=async(Oe,Ve,{params:Ie,body:$e,contentType:Ze,providerHeaders:qe,responseType:rt}={})=>{const lt=`${ie}/${Ern(Ve)}`,it={...z};return Ze&&(it["Content-Type"]=Ze),(qe||rt)&&(it[brn]=JSON.stringify({...qe?{headers:qe}:{},...rt?{responseType:rt}:{}})),Ht({method:Oe,url:lt,headers:it,params:Ie,data:$e,responseType:rt||"json"})},me={};W&&(me.name=W),ee&&ee.length>0&&(me.parents=ee),re&&(me.description=re),Y!==void 0&&(me.starred=Y);const Ce=(await pe("POST",`/v3/files/${H}/copy`,{params:{fields:grn,supportsAllDrives:!0},body:me,contentType:"application/json"})).data;return{value:U.Success,error:null,result:{id:Ce.id,name:Ce.name,mimeType:Ce.mimeType,webViewLink:Ce.webViewLink}}}catch(K){const q=((G=K.response)==null?void 0:G.data)||K.message||K;return uN(i,q)}}})}}const Arn="X-Elyx-Proxy-Config";function Irn(r){return r.startsWith("/")?r.slice(1):r}const pN=(r,u)=>(oe.Logger.log("[Google Drive Delete Document] error:",u),{value:r.catchesError||r.errorCalls.length?U.CaughtError:U.UnhandledError,error:u,result:null});class jpt extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleDriveDeleteDocument,version:"1.0.0",description:"Google Drive delete document operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleDriveDeleteDocument);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m,T,g,E,I;try{const A=L.operation[le.GoogleDriveDeleteDocument],D=((c=(s=n.find(ee=>{var re,Y;return((Y=(re=ee.valueOwner)==null?void 0:re.declaration)==null?void 0:Y.id)===A.inputs.connection.id}))==null?void 0:s.value)==null?void 0:c.valueAsType)??((f=(e=n.find(ee=>{var re,Y;return((Y=(re=ee.valueOwner)==null?void 0:re.declaration)==null?void 0:Y.id)===A.inputs.connection.id}))==null?void 0:e.value)==null?void 0:f.value);if(!(D instanceof Ga))return pN(i,"Invalid or missing connection entity");const V=(m=(y=n.find(ee=>{var re,Y;return((Y=(re=ee.valueOwner)==null?void 0:re.declaration)==null?void 0:Y.id)===A.inputs.documentId.id}))==null?void 0:y.value)==null?void 0:m.value;if(!V)return pN(i,"Missing required input: documentId");const N=(g=(T=n.find(ee=>{var re,Y;return((Y=(re=ee.valueOwner)==null?void 0:re.declaration)==null?void 0:Y.id)===A.inputs.permanent.id}))==null?void 0:T.value)==null?void 0:g.value,x=this.extensionsRegistry.requestContexts(this,[X.Editor])[0],G=Mi(D),q={Authorization:`Bearer ${await x.getAccessToken()}`},H=`${((E=x.env)==null?void 0:E.API_BASE_URL)+"/editor-runtime"}/v2/external-integrations/proxy/${x.projectId}/${qt["google-drive"]}/${G}`,W=async(ee,re,{params:Y,body:Z,contentType:J,providerHeaders:ne,responseType:z}={})=>{const ie=`${H}/${Irn(re)}`,pe={...q};return J&&(pe["Content-Type"]=J),(ne||z)&&(pe[Arn]=JSON.stringify({...ne?{headers:ne}:{},...z?{responseType:z}:{}})),Ht({method:ee,url:ie,headers:pe,params:Y,data:Z,responseType:z||"json"})};return N?await W("DELETE",`/v3/files/${V}`,{params:{supportsAllDrives:!0}}):await W("PATCH",`/v3/files/${V}`,{params:{supportsAllDrives:!0},body:{trashed:!0},contentType:"application/json"}),{value:U.Success,error:null,result:null}}catch(A){const D=((I=A.response)==null?void 0:I.data)||A.message||A;return pN(i,D)}}})}}class Kpt extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleGeminiGenerateContent,version:"1.0.0",description:"Send Gmail email operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleGeminiGenerateContent);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y;try{const m=n.find(x=>{var G,K;return((K=(G=x.valueOwner)==null?void 0:G.declaration)==null?void 0:K.id)===L.operation["external-integration--google-gemini--post--generate-content"].inputs.connection.id}),T=(s=m==null?void 0:m.value)==null?void 0:s.valueAsType;if(!T)return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No entity template provided",result:null};if(!(T instanceof Ga))return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"Invalid entity template value provided",result:null};const g=n.find(x=>{var G,K;return((K=(G=x.valueOwner)==null?void 0:G.declaration)==null?void 0:K.id)===L.operation["external-integration--google-gemini--post--generate-content"].inputs.prompt.id}),E=(c=g==null?void 0:g.value)==null?void 0:c.value;if(!E||typeof E!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"Invalid prompt value provided",result:null};const I=n.find(x=>{var G,K;return((K=(G=x.valueOwner)==null?void 0:G.declaration)==null?void 0:K.id)===L.operation["external-integration--google-gemini--post--generate-content"].inputs.model.id}),A=(e=I==null?void 0:I.value)==null?void 0:e.value;if(!A||typeof A!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"Invalid model value provided",result:null};const D=this.extensionsRegistry.requestContexts(this,[X.Editor])[0],V=Mi(T);console.log("Triggering Google Gemini generate content action with connectionId:",V);const N=await(await Ht.post(`${(f=D.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v1/external-integrations/trigger-action/${qt["google-gemini"]}/${V}/generate-content`,{payload:{prompt:E,model:A}},{headers:{"Content-Type":"application/json",Authorization:`Bearer ${await D.getAccessToken()}`}})).data;return oe.Logger.log("[Google Gemini] Generate content action response:",N),{value:U.Success,error:null,result:{content:N.content}}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return oe.Logger.error("[Google Gemini] Generate content failed:",T),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:T,result:null}}}})}}class qpt extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsCreateSpreadsheet,version:"1.0.0",description:"Create Spreadsheet Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsCreateSpreadsheet);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=He(i,i.project,"createSpreadsheet"),E="["+Fe(i,i.project,"Create spreadsheet")+": `"+T+"`] ",I=(Y,Z,J)=>{const ne=Fe(Y==null?void 0:Y.valueOwner,m==null?void 0:m.logic,Z),z=He(Y==null?void 0:Y.valueOwner,m==null?void 0:m.logic,J);return`"${ne}" (\`${z}\`)`},A=n.find(Y=>{var Z;return((Z=Y.valueOwner.declaration)==null?void 0:Z.id)===L.operation[le.GoogleSheetsCreateSpreadsheet].inputs.connection.id}),D=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!D||!D.id||!D.name||D.type!==a.DefinitionEntity)throw new Error(`${E}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const V=Mi(D);if(!V)throw new Error(`${E}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const N=n.find(Y=>{var Z;return((Z=Y.valueOwner.declaration)==null?void 0:Z.id)===L.operation[le.GoogleSheetsCreateSpreadsheet].inputs.title.id}),x=(c=N==null?void 0:N.value)==null?void 0:c.value;if(x&&typeof x!="string")throw new Error(`${E}The ${I(N,"Title","title")} input value is invalid. If present, it must be a non-empty string. E.g. "My Spreadsheet"`);const K={Authorization:`Bearer ${await m.getAccessToken()}`},q=`${(e=m.env)==null?void 0:e.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${qt["google-sheet"]}/${V}`,H=async Y=>Ht.post(q,Y,{headers:K}),W={};x&&(W.properties={title:x});const re=((f=(await H({method:"POST",endpoint:"/v4/spreadsheets",data:W})).data)==null?void 0:f.data)||{};return{value:U.Success,error:null,result:{spreadsheetId:re.spreadsheetId,spreadsheetUrl:re.spreadsheetUrl}}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return oe.Logger.log("[Google Sheets] error:",T),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:T,result:null}}}})}}function r$(r){let u="",i=r;for(;i>0;){const n=(i-1)%26;u=String.fromCharCode(65+n)+u,i=Math.floor((i-n)/26)}return u}function UO(r){if(!/^[A-Z]+$/.test(r))return NaN;let u=0;for(let i=0;i<r.length;i++)u=u*26+(r.charCodeAt(i)-64);return u}function qE(r,u){const i=(u==null?void 0:u.errorPrefix)||"";if(typeof r!="string")throw new Error(`${i}Input must be a string.`);let n,s=r;if(r.includes("!")){const I=r.split("!");let A=I.slice(0,-1).join("!");s=I[I.length-1],A.startsWith("'")&&A.endsWith("'")&&(A=A.slice(1,-1)),n=A}const c=/^(\$?[A-Z]+)?(\$?\d+)?(?::(\$?[A-Z]+)?(\$?\d+)?)?$/i,e=s.match(c);if(!e)throw new Error(`${i}Invalid A1 notation format: ${r}`);const[f,y,m,T,g]=e,E={sheet:n};return y&&(E.startColumn=y.toUpperCase()),m&&(E.startRow=m),T&&(E.endColumn=T.toUpperCase()),g&&(E.endRow=g),E}function AS(r,u){const i=u!=null&&u.errorPrefix?u.errorPrefix:"",n=T=>{if(typeof T=="string"){const g=T.replace("$","");return/^\d+$/.test(g)?parseInt(g,10):NaN}return T},s=T=>{if(typeof T=="string"){const g=T.replace("$","").toUpperCase();return/^\d+$/.test(g)?parseInt(g,10):UO(g)}return T},c=n(r.startRow),e=n(r.endRow),f=s(r.startColumn),y=s(r.endColumn),m=T=>typeof T=="string"&&T.includes("{{")&&T.includes("}}");if(r.startRow!==void 0&&r.startRow!==null&&r.startRow!==""&&isNaN(c)&&!m(r.startRow))throw new Error(`${i}Start Row is invalid.`);if(r.endRow!==void 0&&r.endRow!==null&&r.endRow!==""&&isNaN(e)&&!m(r.endRow))throw new Error(`${i}End Row is invalid.`);if(r.startColumn!==void 0&&r.startColumn!==null&&r.startColumn!==""&&isNaN(f)&&!m(r.startColumn))throw new Error(`${i}Start Column is invalid.`);if(r.endColumn!==void 0&&r.endColumn!==null&&r.endColumn!==""&&isNaN(y)&&!m(r.endColumn))throw new Error(`${i}End Column is invalid.`);if(c!=null&&!isNaN(c)&&c<1)throw new Error(`${i}Start Row must be greater than or equal to 1.`);if(e!=null&&!isNaN(e)&&e<1)throw new Error(`${i}End Row must be greater than or equal to 1.`);if(f!=null&&!isNaN(f)&&f<1)throw new Error(`${i}Start Column must be greater than or equal to 1.`);if(y!=null&&!isNaN(y)&&y<1)throw new Error(`${i}End Column must be greater than or equal to 1.`);if(c!=null&&!isNaN(c)&&e!==void 0&&e!==null&&!isNaN(e)&&c>e)throw new Error(`${i}Start Row must be less than or equal to End Row.`);if(f!=null&&!isNaN(f)&&y!==void 0&&y!==null&&!isNaN(y)&&f>y)throw new Error(`${i}Start Column must be less than or equal to End Column.`);if(typeof r.sheet=="number"&&r.sheet<0)throw new Error(`${i}Sheet ID must be greater than or equal to 0.`)}async function Md(r,u,i){if(!r)return;let n=r;if(typeof r=="string"){const e=r.trim();if(e.startsWith("{"))try{n=new Function("return "+e)()}catch{try{n=JSON.parse(e)}catch{}}else try{n=qE(e,{errorPrefix:"Internal"})}catch{}}if(n.sheet===void 0||n.sheet===null||n.sheet==="")return;const s=typeof n.sheet=="string",c=typeof n.sheet=="number";if(!(u==="Name"&&s)&&!(u==="Id"&&c))try{const e=await i();for(const f of e){const y=f.id,m=f.name;if(s&&m===n.sheet){n._resolvedSheetId=y,n._resolvedSheetName=m;return}if(c&&y===n.sheet){n._resolvedSheetId=y,n._resolvedSheetName=m;return}}}catch{}}function lg(r,u){if(!r)return"";if(typeof r=="string")return r;let i=r;if(typeof r=="string"&&r.trim().startsWith("{"))try{i=JSON.parse(r)}catch{}if(AS(i,u),i.namedRange&&i.namedRange.trim()!=="")return i.namedRange;const n=i._resolvedSheetName!==void 0?i._resolvedSheetName:typeof i.sheet=="string"?i.sheet:void 0,s=n?`'${n}'!`:"",c=E=>{if(typeof E=="number")return r$(E);if(typeof E=="string"){const I=E.replace("$","");if(/^\d+$/.test(I))return(E.startsWith("$")?"$":"")+r$(parseInt(I,10))}return E||""},e=c(i.startColumn),f=typeof i.startRow=="number"?i.startRow.toString():i.startRow||"",y=c(i.endColumn),m=typeof i.endRow=="number"?i.endRow.toString():i.endRow||"",T=`${e}${f}`,g=`${y}${m}`;return T&&g?`${s}${T}:${g}`:T?`${s}${T}`:s.replace(/!$/,"")}function Cp(r,u){if(!r)return{};let i=r;if(typeof r=="string"){const g=r.trim();if(g.startsWith("{"))try{i=new Function("return "+g)()}catch{try{i=JSON.parse(g)}catch{}}else try{i=qE(g,u)}catch{}}AS(i,u);const n={},s=i._resolvedSheetId!==void 0?i._resolvedSheetId:typeof i.sheet=="number"?i.sheet:void 0;s!=null&&(n.sheetId=s);const c=g=>{if(typeof g=="string"){const E=g.replace("$","");return/^\d+$/.test(E)?parseInt(E,10):NaN}return g},e=g=>{if(typeof g=="string"){const E=g.replace("$","").toUpperCase();return/^\d+$/.test(E)?parseInt(E,10):UO(E)}return g},f=c(i.startRow),y=c(i.endRow),m=e(i.startColumn),T=e(i.endColumn);return f!=null&&(n.startRowIndex=f-1),y!=null&&(n.endRowIndex=y),m!=null&&(n.startColumnIndex=m-1),T!=null&&(n.endColumnIndex=T),n}function gI(r,u){if(!r)return{};let i=r;if(typeof r=="string")if(r.trim().startsWith("{"))try{i=JSON.parse(r)}catch{i=qE(r,{errorPrefix:"Internal"})}else i=qE(r,{errorPrefix:"Internal"});AS(i,u);const n={},s=i._resolvedSheetId!==void 0?i._resolvedSheetId:typeof i.sheet=="number"?i.sheet:void 0;s!=null&&(n.sheetId=s);const c=g=>{if(typeof g=="string"){const E=g.replace("$","");return/^\d+$/.test(E)?parseInt(E,10):NaN}return g},e=g=>{if(typeof g=="string"){const E=g.replace("$","").toUpperCase();return/^\d+$/.test(E)?parseInt(E,10):UO(E)}return g},f=c(i.startRow),y=c(i.endRow),m=e(i.startColumn),T=e(i.endColumn);return f!=null?(n.dimension="ROWS",n.startIndex=f-1,y!=null?n.endIndex=y:n.endIndex=f):m!=null&&(n.dimension="COLUMNS",n.startIndex=m-1,T!=null?n.endIndex=T:n.endIndex=m),n}function Wn(r,u){const i=(u==null?void 0:u.errorPrefix)||"";if(typeof r!="string")throw new Error(`${i}Spreadsheet ID must be a string.`);const n=r.trim();if(n.length===0)throw new Error(`${i}Spreadsheet ID cannot be empty.`);if(n.includes("docs.google.com")||n.startsWith("http://")||n.startsWith("https://")||n.startsWith("www.google.com")){const c=n.match(/\/spreadsheets\/d\/e\/([a-zA-Z0-9-_]+)/);if(c&&c[1])return c[1];const e=n.match(/\/spreadsheets\/d\/([a-zA-Z0-9-_]+)/);if(e&&e[1])return e[1];throw new Error(`${i}Invalid Google Sheet URL format. Could not extract a valid Spreadsheet ID from the URL.`)}if(n.includes(" "))throw new Error(`${i}Spreadsheet ID cannot contain spaces.`);if(/[^a-zA-Z0-9-_]/.test(n))throw new Error(`${i}Spreadsheet ID contains invalid characters. Only alphanumeric characters, dashes, and underscores are allowed.`);return n}class Zpt extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsGetSpreadsheet,version:"1.0.0",description:"Get Spreadsheet Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsGetSpreadsheet);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=He(i,i.project,"getSpreadsheet"),I="["+Fe(i,i.project,"Get spreadsheet")+": `"+g+"`] ",A=(Z,J,ne)=>{const z=Fe(Z==null?void 0:Z.valueOwner,T==null?void 0:T.logic,J),ie=He(Z==null?void 0:Z.valueOwner,T==null?void 0:T.logic,ne);return`"${z}" (\`${ie}\`)`},D=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsGetSpreadsheet].inputs.connection.id}),V=(s=D==null?void 0:D.value)==null?void 0:s.valueAsType;if(!V||!V.id||!V.name||V.type!==a.DefinitionEntity)throw new Error(`${I}The ${A(D,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const N=Mi(V);if(!N)throw new Error(`${I}The ${A(D,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsGetSpreadsheet].inputs.spreadsheetId.id}),G=(c=x==null?void 0:x.value)==null?void 0:c.value,K=Wn(G,{errorPrefix:`${I}The ${A(x,"Spreadsheet ID","spreadsheetId")} input `}),H={Authorization:`Bearer ${await T.getAccessToken()}`},W=`${(e=T.env)==null?void 0:e.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${T.projectId}/${qt["google-sheet"]}/${N}`,Y=((f=(await(async Z=>Ht.post(W,Z,{headers:H}))({method:"GET",endpoint:`/v4/spreadsheets/${K}`})).data)==null?void 0:f.data)||{};return{value:U.Success,error:null,result:{title:(y=Y.properties)==null?void 0:y.title,spreadsheetUrl:Y.spreadsheetUrl}}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return oe.Logger.log("[Google Sheets] error:",g),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:g,result:null}}}})}}class Hpt extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsAddSheet,version:"1.0.0",description:"Add Sheet Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsAddSheet);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m,T,g,E,I;try{const A=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!A||!A.env)throw new Error("Editor context or environment missing");const D=He(i,i.project,"addSheet"),N="["+Fe(i,i.project,"Add sheet")+": `"+D+"`] ",x=(ve,Ce,Oe)=>{const Ve=Fe(ve==null?void 0:ve.valueOwner,A==null?void 0:A.logic,Ce),Ie=He(ve==null?void 0:ve.valueOwner,A==null?void 0:A.logic,Oe);return`"${Ve}" (\`${Ie}\`)`},G=n.find(ve=>{var Ce;return((Ce=ve.valueOwner.declaration)==null?void 0:Ce.id)===L.operation[le.GoogleSheetsAddSheet].inputs.connection.id}),K=(s=G==null?void 0:G.value)==null?void 0:s.valueAsType;if(!K||!K.id||!K.name||K.type!==a.DefinitionEntity)throw new Error(`${N}The ${x(G,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const q=Mi(K);if(!q)throw new Error(`${N}The ${x(G,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const H=n.find(ve=>{var Ce;return((Ce=ve.valueOwner.declaration)==null?void 0:Ce.id)===L.operation[le.GoogleSheetsAddSheet].inputs.spreadsheetId.id}),W=(c=H==null?void 0:H.value)==null?void 0:c.value,ee=Wn(W,{errorPrefix:`${N}The ${x(H,"Spreadsheet ID","spreadsheetId")} input `}),re=n.find(ve=>{var Ce;return((Ce=ve.valueOwner.declaration)==null?void 0:Ce.id)===L.operation[le.GoogleSheetsAddSheet].inputs.title.id}),Y=(e=re==null?void 0:re.value)==null?void 0:e.value;if(Y!=null&&typeof Y!="string")throw new Error(`${N}The ${x(re,"Title","title")} input value is invalid. If present, it must be a string. E.g. "New Sheet"`);const J={Authorization:`Bearer ${await A.getAccessToken()}`},ne=`${(f=A.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${A.projectId}/${qt["google-sheet"]}/${q}`,me=(E=(g=(T=(m=(((y=(await(async ve=>Ht.post(ne,ve,{headers:J}))({method:"POST",endpoint:`/v4/spreadsheets/${ee}:batchUpdate`,data:{requests:[{addSheet:{properties:{title:Y}}}]}})).data)==null?void 0:y.data)||{}).replies)==null?void 0:m[0])==null?void 0:T.addSheet)==null?void 0:g.properties)==null?void 0:E.sheetId;return{value:U.Success,error:null,result:{sheetId:me}}}catch(A){const D=((I=A.response)==null?void 0:I.data)||A.message||A;return oe.Logger.log("[Google Sheets] error:",D),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:D,result:null}}}})}}class Wpt extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsDeleteSheet,version:"1.0.0",description:"Delete Sheet Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsDeleteSheet);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=He(i,i.project,"deleteSheet"),E="["+Fe(i,i.project,"Delete sheet")+": `"+T+"`] ",I=(Y,Z,J)=>{const ne=Fe(Y==null?void 0:Y.valueOwner,m==null?void 0:m.logic,Z),z=He(Y==null?void 0:Y.valueOwner,m==null?void 0:m.logic,J);return`"${ne}" (\`${z}\`)`},A=n.find(Y=>{var Z;return((Z=Y.valueOwner.declaration)==null?void 0:Z.id)===L.operation[le.GoogleSheetsDeleteSheet].inputs.connection.id}),D=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!D||!D.id||!D.name||D.type!==a.DefinitionEntity)throw new Error(`${E}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const V=Mi(D);if(!V)throw new Error(`${E}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const N=n.find(Y=>{var Z;return((Z=Y.valueOwner.declaration)==null?void 0:Z.id)===L.operation[le.GoogleSheetsDeleteSheet].inputs.spreadsheetId.id}),x=(c=N==null?void 0:N.value)==null?void 0:c.value,G=Wn(x,{errorPrefix:`${E}The ${I(N,"Spreadsheet ID","spreadsheetId")} input `}),K=n.find(Y=>{var Z;return((Z=Y.valueOwner.declaration)==null?void 0:Z.id)===L.operation[le.GoogleSheetsDeleteSheet].inputs.sheetId.id}),q=(e=K==null?void 0:K.value)==null?void 0:e.value;if(q==null)throw new Error(`${E}The ${I(K,"Sheet ID","sheetId")} input is missing.`);if(typeof q!="number")throw new Error(`${E}The ${I(K,"Sheet ID","sheetId")} input value is invalid. It must be a number. E.g. 0`);const W={Authorization:`Bearer ${await m.getAccessToken()}`},ee=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${qt["google-sheet"]}/${V}`;return await(async Y=>Ht.post(ee,Y,{headers:W}))({method:"POST",endpoint:`/v4/spreadsheets/${G}:batchUpdate`,data:{requests:[{deleteSheet:{sheetId:q}}]}}),{value:U.Success,error:null,result:{success:!0}}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return oe.Logger.log("[Google Sheets] error:",T),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:T,result:null}}}})}}class zpt extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsAppendRows,version:"1.0.0",description:"Append Row(s) Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsAppendRows);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m,T,g;try{const E=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!E||!E.env)throw new Error("Editor context or environment missing");const I=He(i,i.project,"appendRows"),D="["+Fe(i,i.project,"Append rows")+": `"+I+"`] ",V=(ve,Ce,Oe)=>{const Ve=Fe(ve==null?void 0:ve.valueOwner,E==null?void 0:E.logic,Ce),Ie=He(ve==null?void 0:ve.valueOwner,E==null?void 0:E.logic,Oe);return`"${Ve}" (\`${Ie}\`)`},N=n.find(ve=>{var Ce;return((Ce=ve.valueOwner.declaration)==null?void 0:Ce.id)===L.operation[le.GoogleSheetsAppendRows].inputs.connection.id}),x=(s=N==null?void 0:N.value)==null?void 0:s.valueAsType;if(!x||!x.id||!x.name||x.type!==a.DefinitionEntity)throw new Error(`${D}The ${V(N,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const G=Mi(x);if(!G)throw new Error(`${D}The ${V(N,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const K=n.find(ve=>{var Ce;return((Ce=ve.valueOwner.declaration)==null?void 0:Ce.id)===L.operation[le.GoogleSheetsAppendRows].inputs.spreadsheetId.id}),q=(c=K==null?void 0:K.value)==null?void 0:c.value,H=Wn(q,{errorPrefix:`${D}The ${V(K,"Spreadsheet ID","spreadsheetId")} input `}),W=n.find(ve=>{var Ce;return((Ce=ve.valueOwner.declaration)==null?void 0:Ce.id)===L.operation[le.GoogleSheetsAppendRows].inputs.range.id}),ee=(e=W==null?void 0:W.value)==null?void 0:e.value;if(!ee||ee==="")throw new Error(`${D}The ${V(W,"Range","range")} input is missing.`);const re=n.find(ve=>{var Ce;return((Ce=ve.valueOwner.declaration)==null?void 0:Ce.id)===L.operation[le.GoogleSheetsAppendRows].inputs.values.id}),Y=(f=re==null?void 0:re.value)==null?void 0:f.value;if(Y==null)throw new Error(`${D}The ${V(re,"Values","values")} input is missing.`);const J={Authorization:`Bearer ${await E.getAccessToken()}`},ne=`${(y=E.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${E.projectId}/${qt["google-sheet"]}/${G}`,z=async ve=>Ht.post(ne,ve,{headers:J});let ie=Y;if(typeof Y=="string")try{ie=JSON.parse(Y)}catch{}await Md(ee,"Name",async()=>{var Ce;return(((Ce=(await z({method:"GET",endpoint:`/v4/spreadsheets/${H}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:Ce.sheets)||[]).map(Oe=>{var Ve,Ie;return{id:(Ve=Oe.properties)==null?void 0:Ve.sheetId,name:(Ie=Oe.properties)==null?void 0:Ie.title}})});const me=((m=(await z({method:"POST",endpoint:`/v4/spreadsheets/${H}/values/${lg(ee,{errorPrefix:`${D}The ${V(W,"Range","range")} input `})}:append`,params:{valueInputOption:"USER_ENTERED"},data:{values:Array.isArray(ie)?ie:[ie]}})).data)==null?void 0:m.data)||{};return{value:U.Success,error:null,result:{updatedRange:(T=me.updates)==null?void 0:T.updatedRange}}}catch(E){const I=((g=E.response)==null?void 0:g.data)||E.message||E;return oe.Logger.log("[Google Sheets] error:",I),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:I,result:null}}}})}}class Ypt extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsGetRangeValues,version:"1.0.0",description:"Get Range Values Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsGetRangeValues);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=He(i,i.project,"getRangeValues"),I="["+Fe(i,i.project,"Get range values")+": `"+g+"`] ",A=(ne,z,ie)=>{const pe=Fe(ne==null?void 0:ne.valueOwner,T==null?void 0:T.logic,z),me=He(ne==null?void 0:ne.valueOwner,T==null?void 0:T.logic,ie);return`"${pe}" (\`${me}\`)`},D=n.find(ne=>{var z;return((z=ne.valueOwner.declaration)==null?void 0:z.id)===L.operation[le.GoogleSheetsGetRangeValues].inputs.connection.id}),V=(s=D==null?void 0:D.value)==null?void 0:s.valueAsType;if(!V||!V.id||!V.name||V.type!==a.DefinitionEntity)throw new Error(`${I}The ${A(D,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const N=Mi(V);if(!N)throw new Error(`${I}The ${A(D,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(ne=>{var z;return((z=ne.valueOwner.declaration)==null?void 0:z.id)===L.operation[le.GoogleSheetsGetRangeValues].inputs.spreadsheetId.id}),G=(c=x==null?void 0:x.value)==null?void 0:c.value,K=Wn(G,{errorPrefix:`${I}The ${A(x,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(ne=>{var z;return((z=ne.valueOwner.declaration)==null?void 0:z.id)===L.operation[le.GoogleSheetsGetRangeValues].inputs.range.id}),H=(e=q==null?void 0:q.value)==null?void 0:e.value;if(!H||H==="")throw new Error(`${I}The ${A(q,"Range","range")} input is missing.`);const ee={Authorization:`Bearer ${await T.getAccessToken()}`},re=`${(f=T.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${T.projectId}/${qt["google-sheet"]}/${N}`,Y=async ne=>Ht.post(re,ne,{headers:ee});await Md(H,"Name",async()=>{var z;return(((z=(await Y({method:"GET",endpoint:`/v4/spreadsheets/${K}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:z.sheets)||[]).map(ie=>{var pe,me;return{id:(pe=ie.properties)==null?void 0:pe.sheetId,name:(me=ie.properties)==null?void 0:me.title}})});const J=((y=(await Y({method:"GET",endpoint:`/v4/spreadsheets/${K}/values/${lg(H,{errorPrefix:`${I}The ${A(q,"Range","range")} input `})}`})).data)==null?void 0:y.data)||{};return{value:U.Success,error:null,result:{values:J.values}}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return oe.Logger.log("[Google Sheets] error:",g),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:g,result:null}}}})}}class Jpt extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsUpdateRangeValues,version:"1.0.0",description:"Update Range Values Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsUpdateRangeValues);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m,T;try{const g=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!g||!g.env)throw new Error("Editor context or environment missing");const E=He(i,i.project,"updateRangeValues"),A="["+Fe(i,i.project,"Update range values")+": `"+E+"`] ",D=(me,ve,Ce)=>{const Oe=Fe(me==null?void 0:me.valueOwner,g==null?void 0:g.logic,ve),Ve=He(me==null?void 0:me.valueOwner,g==null?void 0:g.logic,Ce);return`"${Oe}" (\`${Ve}\`)`},V=n.find(me=>{var ve;return((ve=me.valueOwner.declaration)==null?void 0:ve.id)===L.operation[le.GoogleSheetsUpdateRangeValues].inputs.connection.id}),N=(s=V==null?void 0:V.value)==null?void 0:s.valueAsType;if(!N||!N.id||!N.name||N.type!==a.DefinitionEntity)throw new Error(`${A}The ${D(V,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=Mi(N);if(!x)throw new Error(`${A}The ${D(V,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const G=n.find(me=>{var ve;return((ve=me.valueOwner.declaration)==null?void 0:ve.id)===L.operation[le.GoogleSheetsUpdateRangeValues].inputs.spreadsheetId.id}),K=(c=G==null?void 0:G.value)==null?void 0:c.value,q=Wn(K,{errorPrefix:`${A}The ${D(G,"Spreadsheet ID","spreadsheetId")} input `}),H=n.find(me=>{var ve;return((ve=me.valueOwner.declaration)==null?void 0:ve.id)===L.operation[le.GoogleSheetsUpdateRangeValues].inputs.range.id}),W=(e=H==null?void 0:H.value)==null?void 0:e.value;if(!W||W==="")throw new Error(`${A}The ${D(H,"Range","range")} input is missing.`);const ee=n.find(me=>{var ve;return((ve=me.valueOwner.declaration)==null?void 0:ve.id)===L.operation[le.GoogleSheetsUpdateRangeValues].inputs.values.id}),re=(f=ee==null?void 0:ee.value)==null?void 0:f.value;if(re==null)throw new Error(`${A}The ${D(ee,"Values","values")} input is missing.`);const Z={Authorization:`Bearer ${await g.getAccessToken()}`},J=`${(y=g.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${g.projectId}/${qt["google-sheet"]}/${x}`,ne=async me=>Ht.post(J,me,{headers:Z});let z=re;if(typeof re=="string")try{z=JSON.parse(re)}catch{}await Md(W,"Name",async()=>{var ve;return(((ve=(await ne({method:"GET",endpoint:`/v4/spreadsheets/${q}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:ve.sheets)||[]).map(Ce=>{var Oe,Ve;return{id:(Oe=Ce.properties)==null?void 0:Oe.sheetId,name:(Ve=Ce.properties)==null?void 0:Ve.title}})});const pe=((m=(await ne({method:"PUT",endpoint:`/v4/spreadsheets/${q}/values/${lg(W,{errorPrefix:`${A}The ${D(H,"Range","range")} input `})}`,params:{valueInputOption:"USER_ENTERED"},data:{values:Array.isArray(z)?z:[z]}})).data)==null?void 0:m.data)||{};return{value:U.Success,error:null,result:{updatedRange:pe.updatedRange}}}catch(g){const E=((T=g.response)==null?void 0:T.data)||g.message||g;return oe.Logger.log("[Google Sheets] error:",E),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:E,result:null}}}})}}class Qpt extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsClearRange,version:"1.0.0",description:"Clear Range Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsClearRange);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=He(i,i.project,"clearRange"),I="["+Fe(i,i.project,"Clear range")+": `"+g+"`] ",A=(ne,z,ie)=>{const pe=Fe(ne==null?void 0:ne.valueOwner,T==null?void 0:T.logic,z),me=He(ne==null?void 0:ne.valueOwner,T==null?void 0:T.logic,ie);return`"${pe}" (\`${me}\`)`},D=n.find(ne=>{var z;return((z=ne.valueOwner.declaration)==null?void 0:z.id)===L.operation[le.GoogleSheetsClearRange].inputs.connection.id}),V=(s=D==null?void 0:D.value)==null?void 0:s.valueAsType;if(!V||!V.id||!V.name||V.type!==a.DefinitionEntity)throw new Error(`${I}The ${A(D,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const N=Mi(V);if(!N)throw new Error(`${I}The ${A(D,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(ne=>{var z;return((z=ne.valueOwner.declaration)==null?void 0:z.id)===L.operation[le.GoogleSheetsClearRange].inputs.spreadsheetId.id}),G=(c=x==null?void 0:x.value)==null?void 0:c.value,K=Wn(G,{errorPrefix:`${I}The ${A(x,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(ne=>{var z;return((z=ne.valueOwner.declaration)==null?void 0:z.id)===L.operation[le.GoogleSheetsClearRange].inputs.range.id}),H=(e=q==null?void 0:q.value)==null?void 0:e.value;if(!H||H==="")throw new Error(`${I}The ${A(q,"Range","range")} input is missing.`);const ee={Authorization:`Bearer ${await T.getAccessToken()}`},re=`${(f=T.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${T.projectId}/${qt["google-sheet"]}/${N}`,Y=async ne=>Ht.post(re,ne,{headers:ee});await Md(H,"Name",async()=>{var z;return(((z=(await Y({method:"GET",endpoint:`/v4/spreadsheets/${K}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:z.sheets)||[]).map(ie=>{var pe,me;return{id:(pe=ie.properties)==null?void 0:pe.sheetId,name:(me=ie.properties)==null?void 0:me.title}})});const J=((y=(await Y({method:"POST",endpoint:`/v4/spreadsheets/${K}/values/${lg(H,{errorPrefix:`${I}The ${A(q,"Range","range")} input `})}:clear`,data:{}})).data)==null?void 0:y.data)||{};return{value:U.Success,error:null,result:{clearedRange:J.clearedRange}}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return oe.Logger.log("[Google Sheets] error:",g),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:g,result:null}}}})}}class Xpt extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsBatchUpdateSpreadsheet,version:"1.0.0",description:"Batch Update Spreadsheet Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsBatchUpdateSpreadsheet);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=He(i,i.project,"batchUpdateSpreadsheet"),I="["+Fe(i,i.project,"Batch update spreadsheet")+": `"+g+"`] ",A=(z,ie,pe)=>{const me=Fe(z==null?void 0:z.valueOwner,T==null?void 0:T.logic,ie),ve=He(z==null?void 0:z.valueOwner,T==null?void 0:T.logic,pe);return`"${me}" (\`${ve}\`)`},D=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsBatchUpdateSpreadsheet].inputs.connection.id}),V=(s=D==null?void 0:D.value)==null?void 0:s.valueAsType;if(!V||!V.id||!V.name||V.type!==a.DefinitionEntity)throw new Error(`${I}The ${A(D,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const N=Mi(V);if(!N)throw new Error(`${I}The ${A(D,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsBatchUpdateSpreadsheet].inputs.spreadsheetId.id}),G=(c=x==null?void 0:x.value)==null?void 0:c.value,K=Wn(G,{errorPrefix:`${I}The ${A(x,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsBatchUpdateSpreadsheet].inputs.requests.id}),H=(e=q==null?void 0:q.value)==null?void 0:e.value;if(H==null||H==="")throw new Error(`${I}The ${A(q,"Requests","requests")} input is missing.`);let W=H;if(typeof H=="string")try{W=JSON.parse(H)}catch{}if(Array.isArray(W)||(W=[W]),W.length===0)throw new Error(`${I}The ${A(q,"Requests","requests")} input evaluated to an empty array. E.g. [{ addSheet: { properties: { title: "New Sheet" } } }]`);const re={Authorization:`Bearer ${await T.getAccessToken()}`},Y=`${(f=T.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${T.projectId}/${qt["google-sheet"]}/${N}`,J=await(async z=>Ht.post(Y,z,{headers:re}))({method:"POST",endpoint:`/v4/spreadsheets/${K}:batchUpdate`,data:{requests:W}}),ne=((y=J.data)==null?void 0:y.data)||J.data||{};return{value:U.Success,result:{replies:ne.replies||[]},error:null}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return oe.Logger.log("[Google Sheets] error:",g),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:g,result:null}}}})}}class ect extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsRenameSheet,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsRenameSheet);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=He(i,i.project,"renameSheet"),I="["+Fe(i,i.project,"Rename sheet")+": `"+g+"`] ",A=(ie,pe,me)=>{const ve=Fe(ie==null?void 0:ie.valueOwner,T==null?void 0:T.logic,pe),Ce=He(ie==null?void 0:ie.valueOwner,T==null?void 0:T.logic,me);return`"${ve}" (\`${Ce}\`)`},D=n.find(ie=>{var pe;return((pe=ie.valueOwner.declaration)==null?void 0:pe.id)===L.operation[le.GoogleSheetsRenameSheet].inputs.connection.id}),V=(s=D==null?void 0:D.value)==null?void 0:s.valueAsType;if(!V||!V.id||!V.name||V.type!==a.DefinitionEntity)throw new Error(`${I}The ${A(D,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const N=Mi(V);if(!N)throw new Error(`${I}The ${A(D,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(ie=>{var pe;return((pe=ie.valueOwner.declaration)==null?void 0:pe.id)===L.operation[le.GoogleSheetsRenameSheet].inputs.spreadsheetId.id}),G=(c=x==null?void 0:x.value)==null?void 0:c.value,K=Wn(G,{errorPrefix:`${I}The ${A(x,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(ie=>{var pe;return((pe=ie.valueOwner.declaration)==null?void 0:pe.id)===L.operation[le.GoogleSheetsRenameSheet].inputs.sheetId.id}),H=(e=q==null?void 0:q.value)==null?void 0:e.value;if(H==null)throw new Error(`${I}The ${A(q,"Sheet ID","sheetId")} input is missing.`);if(typeof H!="number")throw new Error(`${I}The ${A(q,"Sheet ID","sheetId")} input value is invalid. It must be a number. E.g. 0`);const W=n.find(ie=>{var pe;return((pe=ie.valueOwner.declaration)==null?void 0:pe.id)===L.operation[le.GoogleSheetsRenameSheet].inputs.title.id}),ee=(f=W==null?void 0:W.value)==null?void 0:f.value;if(ee!=null&&typeof ee!="string")throw new Error(`${I}The ${A(W,"Title","title")} input value is invalid, if present, it must be a string.`);const Y={Authorization:`Bearer ${await T.getAccessToken()}`},Z=`${(y=T.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${T.projectId}/${qt["google-sheet"]}/${N}`,J=async ie=>Ht.post(Z,ie,{headers:Y}),ne={sheetId:H},z=[];return ne.title=ee||"",z.push("title"),await J({method:"POST",endpoint:`/v4/spreadsheets/${K}:batchUpdate`,data:{requests:[{updateSheetProperties:{properties:ne,fields:z.join(",")}}]}}),{value:U.Success,result:{success:!0},error:null}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return oe.Logger.log("[Google Sheets] error:",g),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:g,result:null}}}})}}class tct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsCopySheet,version:"1.0.0",description:"Copy Sheet Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsCopySheet);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m,T;try{const g=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!g||!g.env)throw new Error("Editor context or environment missing");const E=He(i,i.project,"copySheet"),A="["+Fe(i,i.project,"Copy sheet")+": `"+E+"`] ",D=(pe,me,ve)=>{const Ce=Fe(pe==null?void 0:pe.valueOwner,g==null?void 0:g.logic,me),Oe=He(pe==null?void 0:pe.valueOwner,g==null?void 0:g.logic,ve);return`"${Ce}" (\`${Oe}\`)`},V=n.find(pe=>{var me;return((me=pe.valueOwner.declaration)==null?void 0:me.id)===L.operation[le.GoogleSheetsCopySheet].inputs.connection.id}),N=(s=V==null?void 0:V.value)==null?void 0:s.valueAsType;if(!N||!N.id||!N.name||N.type!==a.DefinitionEntity)throw new Error(`${A}The ${D(V,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=Mi(N);if(!x)throw new Error(`${A}The ${D(V,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const G=n.find(pe=>{var me;return((me=pe.valueOwner.declaration)==null?void 0:me.id)===L.operation[le.GoogleSheetsCopySheet].inputs.spreadsheetId.id}),K=(c=G==null?void 0:G.value)==null?void 0:c.value,q=Wn(K,{errorPrefix:`${A}The ${D(G,"Spreadsheet ID","spreadsheetId")} input `}),H=n.find(pe=>{var me;return((me=pe.valueOwner.declaration)==null?void 0:me.id)===L.operation[le.GoogleSheetsCopySheet].inputs.sheetId.id}),W=(e=H==null?void 0:H.value)==null?void 0:e.value;if(W==null)throw new Error(`${A}The ${D(H,"Sheet ID","sheetId")} input is missing.`);if(typeof W!="number")throw new Error(`${A}The ${D(H,"Sheet ID","sheetId")} input value is invalid. It must be a number. E.g. 0`);const ee=n.find(pe=>{var me;return((me=pe.valueOwner.declaration)==null?void 0:me.id)===L.operation[le.GoogleSheetsCopySheet].inputs.destinationSpreadsheetId.id}),re=(f=ee==null?void 0:ee.value)==null?void 0:f.value;if(!re||re==="")throw new Error(`${A}The ${D(ee,"Destination Spreadsheet ID","destinationSpreadsheetId")} input is missing.`);if(typeof re!="string")throw new Error(`${A}The ${D(ee,"Destination Spreadsheet ID","destinationSpreadsheetId")} input value is invalid. It must be a non-empty string. E.g. "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms"`);const Z={Authorization:`Bearer ${await g.getAccessToken()}`},J=`${(y=g.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${g.projectId}/${qt["google-sheet"]}/${x}`,z=await(async pe=>Ht.post(J,pe,{headers:Z}))({method:"POST",endpoint:`/v4/spreadsheets/${q}/sheets/${W}:copyTo`,data:{destinationSpreadsheetId:re}}),ie=((m=z.data)==null?void 0:m.data)||z.data||{};return{value:U.Success,result:{newSheetId:ie.sheetId},error:null}}catch(g){const E=((T=g.response)==null?void 0:T.data)||g.message||g;return oe.Logger.log("[Google Sheets] error:",E),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:E,result:null}}}})}}class ict extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsClearSheet,version:"1.0.0",description:"Clear Sheet Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsClearSheet);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=He(i,i.project,"clearSheet"),I="["+Fe(i,i.project,"Clear sheet")+": `"+g+"`] ",A=(ne,z,ie)=>{const pe=Fe(ne==null?void 0:ne.valueOwner,T==null?void 0:T.logic,z),me=He(ne==null?void 0:ne.valueOwner,T==null?void 0:T.logic,ie);return`"${pe}" (\`${me}\`)`},D=n.find(ne=>{var z;return((z=ne.valueOwner.declaration)==null?void 0:z.id)===L.operation[le.GoogleSheetsClearSheet].inputs.connection.id}),V=(s=D==null?void 0:D.value)==null?void 0:s.valueAsType;if(!V||!V.id||!V.name||V.type!==a.DefinitionEntity)throw new Error(`${I}The ${A(D,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const N=Mi(V);if(!N)throw new Error(`${I}The ${A(D,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(ne=>{var z;return((z=ne.valueOwner.declaration)==null?void 0:z.id)===L.operation[le.GoogleSheetsClearSheet].inputs.spreadsheetId.id}),G=(c=x==null?void 0:x.value)==null?void 0:c.value,K=Wn(G,{errorPrefix:`${I}The ${A(x,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(ne=>{var z;return((z=ne.valueOwner.declaration)==null?void 0:z.id)===L.operation[le.GoogleSheetsClearSheet].inputs.sheetName.id}),H=(e=q==null?void 0:q.value)==null?void 0:e.value;if(!H||H==="")throw new Error(`${I}The ${A(q,"Sheet Name","sheetName")} input is missing.`);if(typeof H!="string")throw new Error(`${I}The ${A(q,"Sheet Name","sheetName")} input value is invalid. It must be a non-empty string. E.g. "Sheet1"`);const ee={Authorization:`Bearer ${await T.getAccessToken()}`},re=`${(f=T.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${T.projectId}/${qt["google-sheet"]}/${N}`,Z=await(async ne=>Ht.post(re,ne,{headers:ee}))({method:"POST",endpoint:`/v4/spreadsheets/${K}/values/${H}:clear`,data:{}}),J=((y=Z.data)==null?void 0:y.data)||Z.data||{};return{value:U.Success,result:{clearedRange:J.clearedRange},error:null}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return oe.Logger.log("[Google Sheets] error:",g),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:g,result:null}}}})}}class nct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsBatchGetValues,version:"1.0.0",description:"Batch Get Values Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsBatchGetValues);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m,T,g,E,I,A;try{const D=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!D||!D.env)throw new Error("Editor context or environment missing");const V=He(i,i.project,"batchGetValues"),x="["+Fe(i,i.project,"Batch get values")+": `"+V+"`] ",G=($e,Ze,qe)=>{const rt=Fe($e==null?void 0:$e.valueOwner,D==null?void 0:D.logic,Ze),lt=He($e==null?void 0:$e.valueOwner,D==null?void 0:D.logic,qe);return`"${rt}" (\`${lt}\`)`},K=n.find($e=>{var Ze;return((Ze=$e.valueOwner.declaration)==null?void 0:Ze.id)===L.operation[le.GoogleSheetsBatchGetValues].inputs.connection.id}),q=(s=K==null?void 0:K.value)==null?void 0:s.valueAsType;if(!q||!q.id||!q.name||q.type!==a.DefinitionEntity)throw new Error(`${x}The ${G(K,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const H=Mi(q);if(!H)throw new Error(`${x}The ${G(K,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const W=n.find($e=>{var Ze;return((Ze=$e.valueOwner.declaration)==null?void 0:Ze.id)===L.operation[le.GoogleSheetsBatchGetValues].inputs.spreadsheetId.id}),ee=(c=W==null?void 0:W.value)==null?void 0:c.value,re=Wn(ee,{errorPrefix:`${x}The ${G(W,"Spreadsheet ID","spreadsheetId")} input `}),Y=n.find($e=>{var Ze;return((Ze=$e.valueOwner.declaration)==null?void 0:Ze.id)===L.operation[le.GoogleSheetsBatchGetValues].inputs.ranges.id}),Z=(e=Y==null?void 0:Y.value)==null?void 0:e.value;if(Z==null||Z==="")throw new Error(`${x}The ${G(Y,"Ranges","ranges")} input is missing.`);const ne={Authorization:`Bearer ${await D.getAccessToken()}`},z=`${(f=D.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${D.projectId}/${qt["google-sheet"]}/${H}`,ie=async $e=>Ht.post(z,$e,{headers:ne});let pe=Array.isArray(Z)?Z:[Z];if(pe.length===0)throw new Error(`${x}The ${G(Y,"Ranges","ranges")} input evaluated to an empty array. E.g. ["Sheet1!A1:B2"]`);let me=new Set;try{const $e=await ie({method:"GET",endpoint:`/v4/spreadsheets/${re}?fields=sheets.properties(sheetId,title)`}),Ze=((y=$e.data)==null?void 0:y.sheets)||((T=(m=$e.data)==null?void 0:m.data)==null?void 0:T.sheets)||[];me=new Set(Ze.map(qe=>{var rt;return(rt=qe.properties)==null?void 0:rt.title}).filter(Boolean))}catch{}const ve=$e=>{const Ze=$e.indexOf("!");if(Ze>-1){let qe=$e.substring(0,Ze).trim();return qe.startsWith("'")&&qe.endsWith("'")&&(qe=qe.slice(1,-1)),qe}return null},Ce=[],Oe=[];for(const $e of pe){const Ze=lg($e,{errorPrefix:`${x}The ${G(Y,"Ranges","ranges")} input `}),qe=ve(Ze);qe&&me.size>0&&!me.has(qe)?Oe.push({range:Ze,majorDimension:"ROWS",values:[]}):Ce.push({a1Range:Ze})}let Ve=[];if(Ce.length>0){const $e=await ie({method:"POST",endpoint:`/v4/spreadsheets/${re}/values:batchGetByDataFilter`,data:{dataFilters:Ce}});Ve=(((g=$e.data)==null?void 0:g.valueRanges)||((I=(E=$e.data)==null?void 0:E.data)==null?void 0:I.valueRanges)||[]).map(qe=>qe.valueRange||qe)}const Ie=[...Ve,...Oe];return{value:U.Success,result:{valueRanges:Ie},error:null}}catch(D){const V=((A=D.response)==null?void 0:A.data)||D.message||D;return oe.Logger.log("[Google Sheets] error:",V),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:V,result:null}}}})}}function a$(r){if(!r||typeof r!="object")return;const u={};return typeof r.red=="number"&&(u.red=r.red>1?r.red/255:r.red),typeof r.green=="number"&&(u.green=r.green>1?r.green/255:r.green),typeof r.blue=="number"&&(u.blue=r.blue>1?r.blue/255:r.blue),typeof r.alpha=="number"&&(u.alpha=r.alpha),Object.keys(u).length>0?u:void 0}class rct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsFormatCells,version:"1.0.0",description:"Format Cells Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsFormatCells);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=He(i,i.project,"formatCells"),E="["+Fe(i,i.project,"Format cells")+": `"+T+"`] ",I=(vt,_t,bt)=>{const ht=Fe(vt==null?void 0:vt.valueOwner,m==null?void 0:m.logic,_t),Zt=He(vt==null?void 0:vt.valueOwner,m==null?void 0:m.logic,bt);return`"${ht}" (\`${Zt}\`)`},A=n.find(vt=>{var _t;return((_t=vt.valueOwner.declaration)==null?void 0:_t.id)===L.operation[le.GoogleSheetsFormatCells].inputs.connection.id}),D=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!D||!D.id||!D.name||D.type!==a.DefinitionEntity)throw new Error(`${E}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const V=Mi(D);if(!V)throw new Error(`${E}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const N=n.find(vt=>{var _t;return((_t=vt.valueOwner.declaration)==null?void 0:_t.id)===L.operation[le.GoogleSheetsFormatCells].inputs.spreadsheetId.id}),x=(c=N==null?void 0:N.value)==null?void 0:c.value,G=Wn(x,{errorPrefix:`${E}The ${I(N,"Spreadsheet ID","spreadsheetId")} input `}),K=n.find(vt=>{var _t;return((_t=vt.valueOwner.declaration)==null?void 0:_t.id)===L.operation[le.GoogleSheetsFormatCells].inputs.range.id}),q=(e=K==null?void 0:K.value)==null?void 0:e.value;if(q==null)throw new Error(`${E}The ${I(K,"Range","range")} input is missing.`);const W={Authorization:`Bearer ${await m.getAccessToken()}`},ee=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${qt["google-sheet"]}/${V}`,re=async vt=>Ht.post(ee,vt,{headers:W});await Md(q,"Id",async()=>(await re({method:"GET",endpoint:`/v4/spreadsheets/${G}?fields=sheets.properties(sheetId,title)`})).data.sheets.map(_t=>({id:_t.properties.sheetId,name:_t.properties.title})));const Y=Cp(q,{errorPrefix:`${E}The ${I(K,"Range","range")} input `}),Z=L.operation[le.GoogleSheetsFormatCells].inputs,J=vt=>{var bt;const _t=n.find(ht=>{var Zt;return((Zt=ht.valueOwner.declaration)==null?void 0:Zt.id)===vt});return(bt=_t==null?void 0:_t.value)==null?void 0:bt.value},ne=J(Z.bold.id),z=J(Z.italic.id),ie=J(Z.underline.id),pe=J(Z.strikethrough.id),me=J(Z.fontSize.id),ve=J(Z.fontFamily.id),Ce=J(Z.textColor.id),Oe=J(Z.backgroundColor.id),Ve=J(Z.horizontalAlignment.id),Ie=J(Z.verticalAlignment.id),$e=J(Z.wrapStrategy.id),Ze={},qe=[],rt={},lt=[];typeof ne=="boolean"&&(rt.bold=ne,lt.push("bold")),typeof z=="boolean"&&(rt.italic=z,lt.push("italic")),typeof ie=="boolean"&&(rt.underline=ie,lt.push("underline")),typeof pe=="boolean"&&(rt.strikethrough=pe,lt.push("strikethrough")),typeof me=="number"&&!isNaN(me)&&(rt.fontSize=me,lt.push("fontSize")),typeof ve=="string"&&ve.trim()!==""&&(rt.fontFamily=ve.trim(),lt.push("fontFamily"));const it=a$(Ce);it&&(rt.foregroundColor=it,lt.push("foregroundColor")),lt.length>0&&(Ze.textFormat=rt,qe.push(`userEnteredFormat.textFormat(${lt.join(",")})`));const Ye=a$(Oe);if(Ye&&(Ze.backgroundColor=Ye,qe.push("userEnteredFormat.backgroundColor")),typeof Ve=="string"&&Ve!==""){const vt={Left:"LEFT",Center:"CENTER",Right:"RIGHT",Justify:"JUSTIFY"};Ze.horizontalAlignment=vt[Ve]||Ve.toUpperCase(),qe.push("userEnteredFormat.horizontalAlignment")}if(typeof Ie=="string"&&Ie!==""){const vt={Top:"TOP",Middle:"MIDDLE",Bottom:"BOTTOM"};Ze.verticalAlignment=vt[Ie]||Ie.toUpperCase(),qe.push("userEnteredFormat.verticalAlignment")}if(typeof $e=="string"&&$e!==""){const vt={"Overflow cell":"OVERFLOW_CELL","Wrap text":"WRAP","Clip text":"CLIP"};Ze.wrapStrategy=vt[$e]||$e.toUpperCase(),qe.push("userEnteredFormat.wrapStrategy")}if(qe.length===0)return{value:U.Success,result:{success:!0},error:null};const at={repeatCell:{range:Y,cell:{userEnteredFormat:Ze},fields:qe.join(",")}};return await re({method:"POST",endpoint:`/v4/spreadsheets/${G}:batchUpdate`,data:{requests:[at]}}),{value:U.Success,result:{success:!0},error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return oe.Logger.log("[Google Sheets] error:",T),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:T,result:null}}}})}}class act extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsSetNumberFormat,version:"1.0.0",description:"Set Number Format Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsSetNumberFormat);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=He(i,i.project,"setNumberFormat"),I="["+Fe(i,i.project,"Set number format")+": `"+g+"`] ",A=(ie,pe,me)=>{const ve=Fe(ie==null?void 0:ie.valueOwner,T==null?void 0:T.logic,pe),Ce=He(ie==null?void 0:ie.valueOwner,T==null?void 0:T.logic,me);return`"${ve}" (\`${Ce}\`)`},D=n.find(ie=>{var pe;return((pe=ie.valueOwner.declaration)==null?void 0:pe.id)===L.operation[le.GoogleSheetsSetNumberFormat].inputs.connection.id}),V=(s=D==null?void 0:D.value)==null?void 0:s.valueAsType;if(!V||!V.id||!V.name||V.type!==a.DefinitionEntity)throw new Error(`${I}The ${A(D,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const N=Mi(V);if(!N)throw new Error(`${I}The ${A(D,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(ie=>{var pe;return((pe=ie.valueOwner.declaration)==null?void 0:pe.id)===L.operation[le.GoogleSheetsSetNumberFormat].inputs.spreadsheetId.id}),G=(c=x==null?void 0:x.value)==null?void 0:c.value,K=Wn(G,{errorPrefix:`${I}The ${A(x,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(ie=>{var pe;return((pe=ie.valueOwner.declaration)==null?void 0:pe.id)===L.operation[le.GoogleSheetsSetNumberFormat].inputs.range.id}),H=(e=q==null?void 0:q.value)==null?void 0:e.value;if(H==null)throw new Error(`${I}The ${A(q,"Range","range")} input is missing.`);const ee={Authorization:`Bearer ${await T.getAccessToken()}`},re=`${(f=T.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${T.projectId}/${qt["google-sheet"]}/${N}`,Y=async ie=>Ht.post(re,ie,{headers:ee});await Md(H,"Id",async()=>(await Y({method:"GET",endpoint:`/v4/spreadsheets/${K}?fields=sheets.properties(sheetId,title)`})).data.sheets.map(pe=>({id:pe.properties.sheetId,name:pe.properties.title})));const Z=Cp(H,{errorPrefix:`${I}The ${A(q,"Range","range")} input `}),J=n.find(ie=>{var pe;return((pe=ie.valueOwner.declaration)==null?void 0:pe.id)===L.operation[le.GoogleSheetsSetNumberFormat].inputs.pattern.id}),ne=(y=J==null?void 0:J.value)==null?void 0:y.value;if(ne==null||ne==="")throw new Error(`${I}The ${A(J,"Pattern","pattern")} input is missing.`);if(typeof ne!="string")throw new Error(`${I}The ${A(J,"Pattern","pattern")} input value is invalid. It must be a string.`);const z={repeatCell:{range:Z,cell:{userEnteredFormat:{numberFormat:{type:"CUSTOM",pattern:ne}}},fields:"userEnteredFormat.numberFormat"}};return await Y({method:"POST",endpoint:`/v4/spreadsheets/${K}:batchUpdate`,data:{requests:[z]}}),{value:U.Success,result:{success:!0},error:null}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return oe.Logger.log("[Google Sheets] error:",g),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:g,result:null}}}})}}class sct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsMergeUnmergeCells,version:"1.0.0",description:"Merge or Unmerge Cells Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsMergeUnmergeCells);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m,T;try{const g=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!g||!g.env)throw new Error("Editor context or environment missing");const E=He(i,i.project,"mergeUnmergeCells"),A="["+Fe(i,i.project,"Merge/Unmerge cells")+": `"+E+"`] ",D=(ve,Ce,Oe)=>{const Ve=Fe(ve==null?void 0:ve.valueOwner,g==null?void 0:g.logic,Ce),Ie=He(ve==null?void 0:ve.valueOwner,g==null?void 0:g.logic,Oe);return`"${Ve}" (\`${Ie}\`)`},V=n.find(ve=>{var Ce;return((Ce=ve.valueOwner.declaration)==null?void 0:Ce.id)===L.operation[le.GoogleSheetsMergeUnmergeCells].inputs.connection.id}),N=(s=V==null?void 0:V.value)==null?void 0:s.valueAsType;if(!N||!N.id||!N.name||N.type!==a.DefinitionEntity)throw new Error(`${A}The ${D(V,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=Mi(N);if(!x)throw new Error(`${A}The ${D(V,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const G=n.find(ve=>{var Ce;return((Ce=ve.valueOwner.declaration)==null?void 0:Ce.id)===L.operation[le.GoogleSheetsMergeUnmergeCells].inputs.spreadsheetId.id}),K=(c=G==null?void 0:G.value)==null?void 0:c.value,q=Wn(K,{errorPrefix:`${A}The ${D(G,"Spreadsheet ID","spreadsheetId")} input `}),H=n.find(ve=>{var Ce;return((Ce=ve.valueOwner.declaration)==null?void 0:Ce.id)===L.operation[le.GoogleSheetsMergeUnmergeCells].inputs.range.id}),W=(e=H==null?void 0:H.value)==null?void 0:e.value;if(W==null)throw new Error(`${A}The ${D(H,"Range","range")} input is missing.`);const re={Authorization:`Bearer ${await g.getAccessToken()}`},Y=`${(f=g.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${g.projectId}/${qt["google-sheet"]}/${x}`,Z=async ve=>Ht.post(Y,ve,{headers:re});await Md(W,"Id",async()=>(await Z({method:"GET",endpoint:`/v4/spreadsheets/${q}?fields=sheets.properties(sheetId,title)`})).data.sheets.map(Ce=>({id:Ce.properties.sheetId,name:Ce.properties.title})));const J=Cp(W,{errorPrefix:`${A}The ${D(H,"Range","range")} input `}),ne=n.find(ve=>{var Ce;return((Ce=ve.valueOwner.declaration)==null?void 0:Ce.id)===L.operation[le.GoogleSheetsMergeUnmergeCells].inputs.merge.id}),z=!!((y=ne==null?void 0:ne.value)!=null&&y.value),ie=n.find(ve=>{var Ce;return((Ce=ve.valueOwner.declaration)==null?void 0:Ce.id)===L.operation[le.GoogleSheetsMergeUnmergeCells].inputs.mergeType.id}),pe=(m=ie==null?void 0:ie.value)==null?void 0:m.value;if(pe!=null&&typeof pe!="string")throw new Error(`${A}The ${D(ie,"Merge Type","mergeType")} input value is invalid, if present, it must be a string.`);const me=z?{mergeCells:{range:J,mergeType:pe||"MERGE_ALL"}}:{unmergeCells:{range:J}};return await Z({method:"POST",endpoint:`/v4/spreadsheets/${q}:batchUpdate`,data:{requests:[me]}}),{value:U.Success,result:{success:!0},error:null}}catch(g){const E=((T=g.response)==null?void 0:T.data)||g.message||g;return oe.Logger.log("[Google Sheets] error:",E),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:E,result:null}}}})}}class lct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsAutoResizeDimensions,version:"1.0.0",description:"Auto-Resize Dimensions Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsAutoResizeDimensions);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=He(i,i.project,"autoResizeDimensions"),E="["+Fe(i,i.project,"Auto-resize dimensions")+": `"+T+"`] ",I=(Z,J,ne)=>{const z=Fe(Z==null?void 0:Z.valueOwner,m==null?void 0:m.logic,J),ie=He(Z==null?void 0:Z.valueOwner,m==null?void 0:m.logic,ne);return`"${z}" (\`${ie}\`)`},A=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsAutoResizeDimensions].inputs.connection.id}),D=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!D||!D.id||!D.name||D.type!==a.DefinitionEntity)throw new Error(`${E}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const V=Mi(D);if(!V)throw new Error(`${E}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const N=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsAutoResizeDimensions].inputs.spreadsheetId.id}),x=(c=N==null?void 0:N.value)==null?void 0:c.value,G=Wn(x,{errorPrefix:`${E}The ${I(N,"Spreadsheet ID","spreadsheetId")} input `}),K=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsAutoResizeDimensions].inputs.range.id}),q=(e=K==null?void 0:K.value)==null?void 0:e.value;if(q==null)throw new Error(`${E}The ${I(K,"Range","range")} input is missing.`);const W={Authorization:`Bearer ${await m.getAccessToken()}`},ee=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${qt["google-sheet"]}/${V}`,re=async Z=>Ht.post(ee,Z,{headers:W});await Md(q,"Id",async()=>{var J;return(((J=(await re({method:"GET",endpoint:`/v4/spreadsheets/${G}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:J.sheets)||[]).map(ne=>{var z,ie;return{id:(z=ne.properties)==null?void 0:z.sheetId,name:(ie=ne.properties)==null?void 0:ie.title}})});const Y={autoResizeDimensions:{dimensions:gI(q,{errorPrefix:`${E}The ${I(K,"Range","range")} input `})}};return await re({method:"POST",endpoint:`/v4/spreadsheets/${G}:batchUpdate`,data:{requests:[Y]}}),{value:U.Success,result:{success:!0},error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return oe.Logger.log("[Google Sheets] error:",T),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:T,result:null}}}})}}class oct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsFindAndReplace,version:"1.0.0",description:"Find and Replace Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsFindAndReplace);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m,T,g,E,I,A,D,V;try{const N=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!N||!N.env)throw new Error("Editor context or environment missing");const x=He(i,i.project,"findAndReplace"),K="["+Fe(i,i.project,"Find and replace")+": `"+x+"`] ",q=(Ye,at,vt)=>{const _t=Fe(Ye==null?void 0:Ye.valueOwner,N==null?void 0:N.logic,at),bt=He(Ye==null?void 0:Ye.valueOwner,N==null?void 0:N.logic,vt);return`"${_t}" (\`${bt}\`)`},H=n.find(Ye=>{var at;return((at=Ye.valueOwner.declaration)==null?void 0:at.id)===L.operation[le.GoogleSheetsFindAndReplace].inputs.connection.id}),W=(s=H==null?void 0:H.value)==null?void 0:s.valueAsType;if(!W||!W.id||!W.name||W.type!==a.DefinitionEntity)throw new Error(`${K}The ${q(H,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const ee=Mi(W);if(!ee)throw new Error(`${K}The ${q(H,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const re=n.find(Ye=>{var at;return((at=Ye.valueOwner.declaration)==null?void 0:at.id)===L.operation[le.GoogleSheetsFindAndReplace].inputs.spreadsheetId.id}),Y=(c=re==null?void 0:re.value)==null?void 0:c.value,Z=Wn(Y,{errorPrefix:`${K}The ${q(re,"Spreadsheet ID","spreadsheetId")} input `}),J=n.find(Ye=>{var at;return((at=Ye.valueOwner.declaration)==null?void 0:at.id)===L.operation[le.GoogleSheetsFindAndReplace].inputs.range.id}),ne=(e=J==null?void 0:J.value)==null?void 0:e.value;if(ne==null)throw new Error(`${K}The ${q(J,"Range","range")} input is missing.`);const z=n.find(Ye=>{var at;return((at=Ye.valueOwner.declaration)==null?void 0:at.id)===L.operation[le.GoogleSheetsFindAndReplace].inputs.find.id}),ie=(f=z==null?void 0:z.value)==null?void 0:f.value;if(!ie||ie==="")throw new Error(`${K}The ${q(z,"Find","find")} input is missing.`);if(typeof ie!="string")throw new Error(`${K}The ${q(z,"Find","find")} input value is invalid. It must be a non-empty string.`);const pe=n.find(Ye=>{var at;return((at=Ye.valueOwner.declaration)==null?void 0:at.id)===L.operation[le.GoogleSheetsFindAndReplace].inputs.replace.id}),me=((y=pe==null?void 0:pe.value)==null?void 0:y.value)||"";if(typeof me!="string")throw new Error(`${K}The ${q(pe,"Replace","replace")} input value is invalid. It must be a string.`);const ve=n.find(Ye=>{var at;return((at=Ye.valueOwner.declaration)==null?void 0:at.id)===L.operation[le.GoogleSheetsFindAndReplace].inputs.matchCase.id}),Ce=!!((m=ve==null?void 0:ve.value)!=null&&m.value),Oe=n.find(Ye=>{var at;return((at=Ye.valueOwner.declaration)==null?void 0:at.id)===L.operation[le.GoogleSheetsFindAndReplace].inputs.matchEntireCell.id}),Ve=!!((T=Oe==null?void 0:Oe.value)!=null&&T.value),$e={Authorization:`Bearer ${await N.getAccessToken()}`},Ze=`${(g=N.env)==null?void 0:g.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${N.projectId}/${qt["google-sheet"]}/${ee}`,qe=async Ye=>Ht.post(Ze,Ye,{headers:$e}),rt={findReplace:{range:Cp(ne,{errorPrefix:`${K}The ${q(J,"Range","range")} input `}),find:ie,replacement:me,matchCase:Ce,matchEntireCell:Ve}},lt=await qe({method:"POST",endpoint:`/v4/spreadsheets/${Z}:batchUpdate`,data:{requests:[rt]}}),it=((E=lt.data)==null?void 0:E.data)||lt.data||{};return{value:U.Success,result:{occurrencesChanged:((D=(A=(I=it.replies)==null?void 0:I[0])==null?void 0:A.findReplace)==null?void 0:D.occurrencesChanged)||0},error:null}}catch(N){const x=((V=N.response)==null?void 0:V.data)||N.message||N;return oe.Logger.log("[Google Sheets] error:",x),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:x,result:null}}}})}}const s$={"List of items":"ONE_OF_LIST","List from cell range":"ONE_OF_RANGE","Number greater than":"NUMBER_GREATER","Number greater than or equal":"NUMBER_GREATER_THAN_EQ","Number less than":"NUMBER_LESS","Number less than or equal":"NUMBER_LESS_THAN_EQ","Number equal to":"NUMBER_EQ","Number not equal to":"NUMBER_NOT_EQ","Number between":"NUMBER_BETWEEN","Number not between":"NUMBER_NOT_BETWEEN","Text contains":"TEXT_CONTAINS","Text does not contain":"TEXT_NOT_CONTAINS","Text equals":"TEXT_EQ","Text is valid email":"TEXT_IS_EMAIL","Text is valid URL":"TEXT_IS_URL","Date is":"DATE_EQ","Date is before":"DATE_BEFORE","Date is after":"DATE_AFTER","Date is on or before":"DATE_ON_OR_BEFORE","Date is on or after":"DATE_ON_OR_AFTER","Date is between":"DATE_BETWEEN","Date is not between":"DATE_NOT_BETWEEN","Date is valid":"DATE_IS_VALID",Checkbox:"BOOLEAN","Custom formula":"CUSTOM_FORMULA"},_D={NUMBER_EQUAL:"NUMBER_EQ",NUMBER_NOT_EQUAL:"NUMBER_NOT_EQ",TEXT_DOES_NOT_CONTAIN:"TEXT_NOT_CONTAINS",TEXT_EQUAL:"TEXT_EQ",DATE_TIME_EQUAL:"DATE_EQ",DATE_EQUAL:"DATE_EQ"},Rrn=new Set([...Object.values(s$),...Object.keys(_D),...Object.values(_D)]);function dct(r){if(!r||typeof r!="string")return null;const u=r.trim();if(!u)return null;if(s$[u])return s$[u];const i=u.toUpperCase();return _D[i]?_D[i]:Rrn.has(i)?i:u}function Drn(r,u,i){if(r.length===0){i.push(new ft({id:`${u.id}--${ir.ConditionValuesInvalidFormula}`,message:'Custom formula condition requires a formula string starting with "=" (e.g., ["=SUM(A1:A10)>100"]).',severity:Ae.Error,code:ir.ConditionValuesInvalidFormula,entity:u}));return}r.length>1&&i.push(new ft({id:`${u.id}--${ir.ConditionValuesInvalidFormula}-count`,message:`Custom formula condition rule accepts only 1 formula string (e.g., ["=SUM(A1:A10)>100"]). You provided ${r.length} items.`,severity:Ae.Error,code:ir.ConditionValuesInvalidFormula,entity:u}));for(let n=0;n<r.length;n++){const s=String(r[n]).trim();s.startsWith("=")||i.push(new ft({id:`${u.id}--${ir.ConditionValuesInvalidFormula}-${n}`,message:`Custom formula "${s}" ${r.length>1?`(at index ${n}) `:""}is invalid. A custom formula must start with "=" (e.g., "=A1>100" or "=ISNUMBER(A1)").`,severity:Ae.Error,code:ir.ConditionValuesInvalidFormula,entity:u}))}}function Crn(r,u,i){if(r.length===0){i.push(new ft({id:`${u.id}--${ir.ConditionValuesSingleNumberRequired}`,message:'This numeric condition rule requires 1 numeric target value (e.g., ["100"]).',severity:Ae.Error,code:ir.ConditionValuesSingleNumberRequired,entity:u}));return}r.length>1&&i.push(new ft({id:`${u.id}--${ir.ConditionValuesSingleNumberRequired}-count`,message:`This numeric condition rule accepts only 1 numeric target value (e.g., ["100"]). You provided ${r.length} items.`,severity:Ae.Error,code:ir.ConditionValuesSingleNumberRequired,entity:u}));for(let n=0;n<r.length;n++){const s=String(r[n]).trim();(s===""||isNaN(Number(s)))&&i.push(new ft({id:`${u.id}--${ir.ConditionValuesSingleNumberRequired}-${n}`,message:`Condition value "${s}" ${r.length>1?`(at index ${n}) `:""}is invalid. It must be a valid number (e.g., "100").`,severity:Ae.Error,code:ir.ConditionValuesSingleNumberRequired,entity:u}))}}function wrn(r,u,i){r.length!==2&&i.push(new ft({id:`${u.id}--${ir.ConditionValuesTwoNumbersRequired}`,message:`A "between" condition rule requires exactly 2 boundary values (e.g., ["10", "50"] or ["2024-01-01", "2024-12-31"]). You provided ${r.length} items.`,severity:Ae.Error,code:ir.ConditionValuesTwoNumbersRequired,entity:u}))}function Orn(r,u,i){if(r.length===0){i.push(new ft({id:`${u.id}--${ir.ConditionValuesSingleRangeRequired}`,message:'The "List from cell range" rule requires a valid cell range in A1 notation (e.g., ["Sheet1!A1:A50"]).',severity:Ae.Error,code:ir.ConditionValuesSingleRangeRequired,entity:u}));return}r.length>1&&i.push(new ft({id:`${u.id}--${ir.ConditionValuesSingleRangeRequired}-count`,message:`The "List from cell range" rule accepts only 1 cell range in A1 notation (e.g., ["Sheet1!A1:A50"]). You provided ${r.length} items.`,severity:Ae.Error,code:ir.ConditionValuesSingleRangeRequired,entity:u}))}function Prn(r,u,i){r.length===0&&i.push(new ft({id:`${u.id}--${ir.ConditionValuesListEmpty}`,message:'The "List of items" rule requires at least one choice item (e.g., ["Pending", "Approved", "Rejected"]).',severity:Ae.Error,code:ir.ConditionValuesListEmpty,entity:u}))}function xrn(r,u,i){if(r.length===0){i.push(new ft({id:`${u.id}--${ir.ConditionValuesSingleTextRequired}`,message:'This text condition rule requires a non-empty text target value (e.g., ["important"]).',severity:Ae.Error,code:ir.ConditionValuesSingleTextRequired,entity:u}));return}r.length>1&&i.push(new ft({id:`${u.id}--${ir.ConditionValuesSingleTextRequired}-count`,message:`This text condition rule accepts only 1 text target value (e.g., ["important"]). You provided ${r.length} items.`,severity:Ae.Error,code:ir.ConditionValuesSingleTextRequired,entity:u}));for(let n=0;n<r.length;n++)String(r[n]).trim()===""&&i.push(new ft({id:`${u.id}--${ir.ConditionValuesSingleTextRequired}-${n}`,message:`Text target value ${r.length>1?`(at index ${n}) `:""}is empty. Expected a non-empty text string.`,severity:Ae.Error,code:ir.ConditionValuesSingleTextRequired,entity:u}))}function _rn(r,u,i){if(r.length===0){i.push(new ft({id:`${u.id}--${ir.ConditionValuesSingleTextRequired}`,message:'This date condition rule requires a target date or relative date string (e.g., ["2024-01-01"]).',severity:Ae.Error,code:ir.ConditionValuesSingleTextRequired,entity:u}));return}r.length>1&&i.push(new ft({id:`${u.id}--${ir.ConditionValuesSingleTextRequired}-count`,message:`This date condition rule accepts only 1 target date string (e.g., ["2024-01-01"]). You provided ${r.length} items.`,severity:Ae.Error,code:ir.ConditionValuesSingleTextRequired,entity:u}))}function Vrn(r,u,i){r.length>0&&i.push(new ft({id:`${u.id}--${ir.ConditionValuesNoValuesRequired}`,message:`This condition rule does not take any argument values (must be empty list []). You provided ${r.length} items.`,severity:Ae.Error,code:ir.ConditionValuesNoValuesRequired,entity:u}))}function Nrn(r,u,i,n){if(!u&&u!==0&&u!==!1)return;let s=[];if(typeof u=="string")try{const e=JSON.parse(u);s=Array.isArray(e)?e:[u]}catch{s=u.split(",").map(e=>e.trim()).filter(Boolean)}else Array.isArray(u)?s=u:s=[u];const c=dct(r);if(c)switch(c){case"CUSTOM_FORMULA":Drn(s,i,n);break;case"ONE_OF_LIST":Prn(s,i,n);break;case"ONE_OF_RANGE":Orn(s,i,n);break;case"NUMBER_GREATER":case"NUMBER_GREATER_THAN_EQ":case"NUMBER_LESS":case"NUMBER_LESS_THAN_EQ":case"NUMBER_EQUAL":case"NUMBER_NOT_EQUAL":Crn(s,i,n);break;case"NUMBER_BETWEEN":case"NUMBER_NOT_BETWEEN":case"DATE_BETWEEN":case"DATE_NOT_BETWEEN":wrn(s,i,n);break;case"TEXT_CONTAINS":case"TEXT_NOT_CONTAINS":case"TEXT_DOES_NOT_CONTAIN":case"TEXT_STARTS_WITH":case"TEXT_ENDS_WITH":case"TEXT_EQ":case"TEXT_EQUAL":xrn(s,i,n);break;case"DATE_EQ":case"DATE_TIME_EQUAL":case"DATE_BEFORE":case"DATE_AFTER":case"DATE_ON_OR_BEFORE":case"DATE_ON_OR_AFTER":_rn(s,i,n);break;case"TEXT_IS_EMAIL":case"TEXT_IS_URL":case"DATE_IS_VALID":case"BLANK":case"NOT_BLANK":case"BOOLEAN":Vrn(s,i,n);break}}function $rn(r){if(!r||typeof r!="string")return"A1";const u=r.split("!");return u[u.length-1].trim().split(":")[0].trim().replace(/\$/g,"")||"A1"}class uct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsAddDataValidation,version:"1.0.0",description:"Add Data Validation Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsAddDataValidation);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m,T;try{const g=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!g||!g.env)throw new Error("Editor context or environment missing");const E=He(i,i.project,"addDataValidation"),A="["+Fe(i,i.project,"Add data validation")+": `"+E+"`] ",D=(Ie,$e,Ze)=>{const qe=Fe(Ie==null?void 0:Ie.valueOwner,g==null?void 0:g.logic,$e),rt=He(Ie==null?void 0:Ie.valueOwner,g==null?void 0:g.logic,Ze);return`"${qe}" (\`${rt}\`)`},V=n.find(Ie=>{var $e;return(($e=Ie.valueOwner.declaration)==null?void 0:$e.id)===L.operation[le.GoogleSheetsAddDataValidation].inputs.connection.id}),N=(s=V==null?void 0:V.value)==null?void 0:s.valueAsType;if(!N||!N.id||!N.name||N.type!==a.DefinitionEntity)throw new Error(`${A}The ${D(V,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=Mi(N);if(!x)throw new Error(`${A}The ${D(V,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const G=n.find(Ie=>{var $e;return(($e=Ie.valueOwner.declaration)==null?void 0:$e.id)===L.operation[le.GoogleSheetsAddDataValidation].inputs.spreadsheetId.id}),K=(c=G==null?void 0:G.value)==null?void 0:c.value,q=Wn(K,{errorPrefix:`${A}The ${D(G,"Spreadsheet ID","spreadsheetId")} input `}),H=n.find(Ie=>{var $e;return(($e=Ie.valueOwner.declaration)==null?void 0:$e.id)===L.operation[le.GoogleSheetsAddDataValidation].inputs.range.id}),W=(e=H==null?void 0:H.value)==null?void 0:e.value;if(W==null)throw new Error(`${A}The ${D(H,"Range","range")} input is missing.`);const re={Authorization:`Bearer ${await g.getAccessToken()}`},Y=`${(f=g.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${g.projectId}/${qt["google-sheet"]}/${x}`,Z=async Ie=>Ht.post(Y,Ie,{headers:re});await Md(W,"Id",async()=>(await Z({method:"GET",endpoint:`/v4/spreadsheets/${q}?fields=sheets.properties(sheetId,title)`})).data.sheets.map($e=>({id:$e.properties.sheetId,name:$e.properties.title})));const J=Cp(W,{errorPrefix:`${A}The ${D(H,"Range","range")} input `}),ne=n.find(Ie=>{var $e;return(($e=Ie.valueOwner.declaration)==null?void 0:$e.id)===L.operation[le.GoogleSheetsAddDataValidation].inputs.conditionType.id}),z=(y=ne==null?void 0:ne.value)==null?void 0:y.value;if(!z||z==="")throw new Error(`${A}The ${D(ne,"Condition Type","conditionType")} input is missing.`);if(typeof z!="string")throw new Error(`${A}The ${D(ne,"Condition Type","conditionType")} input value is invalid. It must be a non-empty string.`);const ie=dct(z)||z,pe=n.find(Ie=>{var $e;return(($e=Ie.valueOwner.declaration)==null?void 0:$e.id)===L.operation[le.GoogleSheetsAddDataValidation].inputs.conditionValues.id}),me=(m=pe==null?void 0:pe.value)==null?void 0:m.value;let ve=me;if(typeof me=="string")try{ve=JSON.parse(me)}catch{ve=me.split(",").map($e=>$e.trim())}Array.isArray(ve)||(ve=ve?[ve]:[]);let Ce=ie,Oe=ve.map(Ie=>({userEnteredValue:String(Ie)}));if(ie==="TEXT_STARTS_WITH"||ie==="TEXT_ENDS_WITH"){const Ie=$rn(String(W)),$e=ve.length>0?String(ve[0]):"",Ze=$e.replace(/"/g,'""'),qe=ie==="TEXT_STARTS_WITH"?`=LEFT(${Ie}, ${$e.length})="${Ze}"`:`=RIGHT(${Ie}, ${$e.length})="${Ze}"`;Ce="CUSTOM_FORMULA",Oe=[{userEnteredValue:qe}]}const Ve={setDataValidation:{range:J,rule:{condition:{type:Ce,values:Oe},showCustomUi:!0}}};return await Z({method:"POST",endpoint:`/v4/spreadsheets/${q}:batchUpdate`,data:{requests:[Ve]}}),{value:U.Success,result:{success:!0},error:null}}catch(g){const E=((T=g.response)==null?void 0:T.data)||g.message||g;return oe.Logger.log("[Google Sheets] error:",E),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:E,result:null}}}})}}class pct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsSortRange,version:"1.0.0",description:"Sort Range Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsSortRange);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m,T;try{const g=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!g||!g.env)throw new Error("Editor context or environment missing");const E=He(i,i.project,"sortRange"),A="["+Fe(i,i.project,"Sort range")+": `"+E+"`] ",D=(Oe,Ve,Ie)=>{const $e=Fe(Oe==null?void 0:Oe.valueOwner,g==null?void 0:g.logic,Ve),Ze=He(Oe==null?void 0:Oe.valueOwner,g==null?void 0:g.logic,Ie);return`"${$e}" (\`${Ze}\`)`},V=n.find(Oe=>{var Ve;return((Ve=Oe.valueOwner.declaration)==null?void 0:Ve.id)===L.operation[le.GoogleSheetsSortRange].inputs.connection.id}),N=(s=V==null?void 0:V.value)==null?void 0:s.valueAsType;if(!N||!N.id||!N.name||N.type!==a.DefinitionEntity)throw new Error(`${A}The ${D(V,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=Mi(N);if(!x)throw new Error(`${A}The ${D(V,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const G=n.find(Oe=>{var Ve;return((Ve=Oe.valueOwner.declaration)==null?void 0:Ve.id)===L.operation[le.GoogleSheetsSortRange].inputs.spreadsheetId.id}),K=(c=G==null?void 0:G.value)==null?void 0:c.value,q=Wn(K,{errorPrefix:`${A}The ${D(G,"Spreadsheet ID","spreadsheetId")} input `}),H=n.find(Oe=>{var Ve;return((Ve=Oe.valueOwner.declaration)==null?void 0:Ve.id)===L.operation[le.GoogleSheetsSortRange].inputs.range.id}),W=(e=H==null?void 0:H.value)==null?void 0:e.value;if(W==null)throw new Error(`${A}The ${D(H,"Range","range")} input is missing.`);const re={Authorization:`Bearer ${await g.getAccessToken()}`},Y=`${(f=g.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${g.projectId}/${qt["google-sheet"]}/${x}`,Z=async Oe=>Ht.post(Y,Oe,{headers:re});await Md(W,"Id",async()=>(await Z({method:"GET",endpoint:`/v4/spreadsheets/${q}?fields=sheets.properties(sheetId,title)`})).data.sheets.map(Ve=>({id:Ve.properties.sheetId,name:Ve.properties.title})));const J=Cp(W,{errorPrefix:`${A}The ${D(H,"Range","range")} input `}),ne=n.find(Oe=>{var Ve;return((Ve=Oe.valueOwner.declaration)==null?void 0:Ve.id)===L.operation[le.GoogleSheetsSortRange].inputs.sortColumnIndex.id}),z=(y=ne==null?void 0:ne.value)==null?void 0:y.value;if(z==null)throw new Error(`${A}The ${D(ne,"Sort Column Index","sortColumnIndex")} input is missing.`);if(typeof z!="number")throw new Error(`${A}The ${D(ne,"Sort Column Index","sortColumnIndex")} input value is invalid. It must be a number.`);const ie=n.find(Oe=>{var Ve;return((Ve=Oe.valueOwner.declaration)==null?void 0:Ve.id)===L.operation[le.GoogleSheetsSortRange].inputs.sortOrder.id}),pe=(m=ie==null?void 0:ie.value)==null?void 0:m.value;if(pe==null||pe==="")throw new Error(`${A}The ${D(ie,"Sort Order","sortOrder")} input is missing.`);if(typeof pe!="string")throw new Error(`${A}The ${D(ie,"Sort Order","sortOrder")} input value is invalid. It must be a string.`);const ve={"Ascending (A-Z, 0-9)":"ASCENDING","Descending (Z-A, 9-0)":"DESCENDING",Ascending:"ASCENDING",Descending:"DESCENDING"}[pe]||pe.toUpperCase(),Ce={sortRange:{range:J,sortSpecs:[{dimensionIndex:z,sortOrder:ve}]}};return await Z({method:"POST",endpoint:`/v4/spreadsheets/${q}:batchUpdate`,data:{requests:[Ce]}}),{value:U.Success,result:{success:!0},error:null}}catch(g){const E=((T=g.response)==null?void 0:T.data)||g.message||g;return oe.Logger.log("[Google Sheets] error:",E),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:E,result:null}}}})}}class cct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsApplyClearFilter,version:"1.0.0",description:"Apply or Clear Filter Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsApplyClearFilter);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=He(i,i.project,"applyClearFilter"),I="["+Fe(i,i.project,"Apply or clear filter")+": `"+g+"`] ",A=(pe,me,ve)=>{const Ce=Fe(pe==null?void 0:pe.valueOwner,T==null?void 0:T.logic,me),Oe=He(pe==null?void 0:pe.valueOwner,T==null?void 0:T.logic,ve);return`"${Ce}" (\`${Oe}\`)`},D=n.find(pe=>{var me;return((me=pe.valueOwner.declaration)==null?void 0:me.id)===L.operation[le.GoogleSheetsApplyClearFilter].inputs.connection.id}),V=(s=D==null?void 0:D.value)==null?void 0:s.valueAsType;if(!V||!V.id||!V.name||V.type!==a.DefinitionEntity)throw new Error(`${I}The ${A(D,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const N=Mi(V);if(!N)throw new Error(`${I}The ${A(D,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(pe=>{var me;return((me=pe.valueOwner.declaration)==null?void 0:me.id)===L.operation[le.GoogleSheetsApplyClearFilter].inputs.spreadsheetId.id}),G=(c=x==null?void 0:x.value)==null?void 0:c.value,K=Wn(G,{errorPrefix:`${I}The ${A(x,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(pe=>{var me;return((me=pe.valueOwner.declaration)==null?void 0:me.id)===L.operation[le.GoogleSheetsApplyClearFilter].inputs.range.id}),H=(e=q==null?void 0:q.value)==null?void 0:e.value;if(H==null)throw new Error(`${I}The ${A(q,"Range","range")} input is missing.`);const ee={Authorization:`Bearer ${await T.getAccessToken()}`},re=`${(f=T.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${T.projectId}/${qt["google-sheet"]}/${N}`,Y=async pe=>Ht.post(re,pe,{headers:ee});await Md(H,"Id",async()=>(await Y({method:"GET",endpoint:`/v4/spreadsheets/${K}?fields=sheets.properties(sheetId,title)`})).data.sheets.map(me=>({id:me.properties.sheetId,name:me.properties.title})));const Z=Cp(H,{errorPrefix:`${I}The ${A(q,"Range","range")} input `}),J=n.find(pe=>{var me;return((me=pe.valueOwner.declaration)==null?void 0:me.id)===L.operation[le.GoogleSheetsApplyClearFilter].inputs.clearOnly.id}),ne=(y=J==null?void 0:J.value)==null?void 0:y.value;if(ne!=null&&typeof ne!="boolean")throw new Error(`${I}The ${A(J,"Clear Only","clearOnly")} input value is invalid. If present, it must be a boolean. E.g. true`);const z=Z.sheetId,ie=ne?{clearBasicFilter:{sheetId:z}}:{setBasicFilter:{filter:{range:Z}}};return await Y({method:"POST",endpoint:`/v4/spreadsheets/${K}:batchUpdate`,data:{requests:[ie]}}),{value:U.Success,result:{success:!0},error:null}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return oe.Logger.log("[Google Sheets] error:",g),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:g,result:null}}}})}}class fct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsUpdateSpreadsheetProperties,version:"1.0.0",description:"Update Spreadsheet Properties Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsUpdateSpreadsheetProperties);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m,T,g,E,I,A;try{const D=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!D||!D.env)throw new Error("Editor context or environment missing");const V=He(i,i.project,"updateSpreadsheetProperties"),x="["+Fe(i,i.project,"Update spreadsheet properties")+": `"+V+"`] ",G=(vt,_t,bt)=>{const ht=Fe(vt==null?void 0:vt.valueOwner,D==null?void 0:D.logic,_t),Zt=He(vt==null?void 0:vt.valueOwner,D==null?void 0:D.logic,bt);return`"${ht}" (\`${Zt}\`)`},K=n.find(vt=>{var _t;return((_t=vt.valueOwner.declaration)==null?void 0:_t.id)===L.operation[le.GoogleSheetsUpdateSpreadsheetProperties].inputs.connection.id}),q=(s=K==null?void 0:K.value)==null?void 0:s.valueAsType;if(!q||!q.id||!q.name||q.type!==a.DefinitionEntity)throw new Error(`${x}The ${G(K,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const H=Mi(q);if(!H)throw new Error(`${x}The ${G(K,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const W=n.find(vt=>{var _t;return((_t=vt.valueOwner.declaration)==null?void 0:_t.id)===L.operation[le.GoogleSheetsUpdateSpreadsheetProperties].inputs.spreadsheetId.id}),ee=(c=W==null?void 0:W.value)==null?void 0:c.value,re=Wn(ee,{errorPrefix:`${x}The ${G(W,"Spreadsheet ID","spreadsheetId")} input `}),Y=n.find(vt=>{var _t;return((_t=vt.valueOwner.declaration)==null?void 0:_t.id)===L.operation[le.GoogleSheetsUpdateSpreadsheetProperties].inputs.title.id}),Z=(e=Y==null?void 0:Y.value)==null?void 0:e.value;if(Z!=null&&typeof Z!="string")throw new Error(`${x}The ${G(Y,"Title","title")} input value is invalid. If present, it must be a string. E.g. "My Spreadsheet"`);const J=n.find(vt=>{var _t;return((_t=vt.valueOwner.declaration)==null?void 0:_t.id)===L.operation[le.GoogleSheetsUpdateSpreadsheetProperties].inputs.locale.id}),ne=(f=J==null?void 0:J.value)==null?void 0:f.value;if(ne!=null&&typeof ne!="string")throw new Error(`${x}The ${G(J,"Locale","locale")} input value is invalid. If present, it must be a string. E.g. "en_US"`);const z=n.find(vt=>{var _t;return((_t=vt.valueOwner.declaration)==null?void 0:_t.id)===L.operation[le.GoogleSheetsUpdateSpreadsheetProperties].inputs.timeZone.id}),ie=(y=z==null?void 0:z.value)==null?void 0:y.value;if(ie!=null&&typeof ie!="string")throw new Error(`${x}The ${G(z,"Time Zone","timeZone")} input value is invalid. If present, it must be a string. E.g. "America/New_York"`);const pe=n.find(vt=>{var _t;return((_t=vt.valueOwner.declaration)==null?void 0:_t.id)===L.operation[le.GoogleSheetsUpdateSpreadsheetProperties].inputs.autoRecalc.id}),me=(m=pe==null?void 0:pe.value)==null?void 0:m.value;if(me!=null&&typeof me!="string")throw new Error(`${x}The ${G(pe,"Auto Recalculation","autoRecalc")} input value is invalid. If present, it must be a string enum value. E.g. "ON_CHANGE"`);const ve=n.find(vt=>{var _t;return((_t=vt.valueOwner.declaration)==null?void 0:_t.id)===L.operation[le.GoogleSheetsUpdateSpreadsheetProperties].inputs.defaultFormat.id}),Ce=(T=ve==null?void 0:ve.value)==null?void 0:T.value;if(Ce!=null&&(typeof Ce!="object"||Array.isArray(Ce)))throw new Error(`${x}The ${G(ve,"Default Format","defaultFormat")} input value is invalid. If present, it must be an object representing the CellFormat.`);const Oe=n.find(vt=>{var _t;return((_t=vt.valueOwner.declaration)==null?void 0:_t.id)===L.operation[le.GoogleSheetsUpdateSpreadsheetProperties].inputs.iterativeCalculationSettings.id}),Ve=(g=Oe==null?void 0:Oe.value)==null?void 0:g.value;if(Ve!=null&&(typeof Ve!="object"||Array.isArray(Ve)))throw new Error(`${x}The ${G(Oe,"Iterative Calculation Settings","iterativeCalculationSettings")} input value is invalid. If present, it must be an object.`);const Ie=n.find(vt=>{var _t;return((_t=vt.valueOwner.declaration)==null?void 0:_t.id)===L.operation[le.GoogleSheetsUpdateSpreadsheetProperties].inputs.spreadsheetTheme.id}),$e=(E=Ie==null?void 0:Ie.value)==null?void 0:E.value;if($e!=null&&(typeof $e!="object"||Array.isArray($e)))throw new Error(`${x}The ${G(Ie,"Spreadsheet Theme","spreadsheetTheme")} input value is invalid. If present, it must be an object.`);const Ze={};if(Z!=null&&(Ze.title=Z),ne!=null&&(Ze.locale=ne),ie!=null&&(Ze.timeZone=ie),me!=null){const vt={"On change":"ON_CHANGE","Every minute":"MINUTE","Every hour":"HOUR"};Ze.autoRecalc=vt[me]||me.toUpperCase()}Ce!=null&&(Ze.defaultFormat=Ce),Ve!=null&&(Ze.iterativeCalculationSettings=Ve),$e!=null&&(Ze.spreadsheetTheme=$e);const qe=(vt,_t="")=>{let bt=[];for(const ht in vt){if(!Object.prototype.hasOwnProperty.call(vt,ht))continue;const Zt=vt[ht],pt=_t?`${_t}.${ht}`:ht;Zt!==null&&typeof Zt=="object"&&!Array.isArray(Zt)&&Object.keys(Zt).length>0?bt.push(...qe(Zt,pt)):bt.push(pt)}return bt},rt=qe(Ze);if(rt.length===0)throw new Error(`${x}At least one property must be provided to update.`);const it={Authorization:`Bearer ${await D.getAccessToken()}`},Ye=`${(I=D.env)==null?void 0:I.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${D.projectId}/${qt["google-sheet"]}/${H}`;return await(async vt=>Ht.post(Ye,vt,{headers:it}))({method:"POST",endpoint:`/v4/spreadsheets/${re}:batchUpdate`,data:{requests:[{updateSpreadsheetProperties:{properties:Ze,fields:rt.join(",")}}]}}),{value:U.Success,result:{success:!0},error:null}}catch(D){const V=((A=D.response)==null?void 0:A.data)||D.message||D;return oe.Logger.log("[Google Sheets] error:",V),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:V,result:null}}}})}}const Ib=(r,u)=>(oe.Logger.log("[Google Sheets Clone Sheet] error:",u),{value:r.catchesError||r.errorCalls.length?U.CaughtError:U.UnhandledError,error:u,result:null});class yct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsCloneSheet,version:"1.0.0",description:"Google Sheets clone sheet operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsCloneSheet);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m,T,g,E,I,A,D,V,N,x,G,K,q,H,W,ee;try{const re=L.operation[le.GoogleSheetsCloneSheet],Y=((c=(s=n.find(lt=>{var it,Ye;return((Ye=(it=lt.valueOwner)==null?void 0:it.declaration)==null?void 0:Ye.id)===re.inputs.connection.id}))==null?void 0:s.value)==null?void 0:c.valueAsType)??((f=(e=n.find(lt=>{var it,Ye;return((Ye=(it=lt.valueOwner)==null?void 0:it.declaration)==null?void 0:Ye.id)===re.inputs.connection.id}))==null?void 0:e.value)==null?void 0:f.value);if(!(Y instanceof Ga))return Ib(i,"Invalid or missing connection entity");const Z=(m=(y=n.find(lt=>{var it,Ye;return((Ye=(it=lt.valueOwner)==null?void 0:it.declaration)==null?void 0:Ye.id)===re.inputs.spreadsheetId.id}))==null?void 0:y.value)==null?void 0:m.value;if(!Z)return Ib(i,"Missing required input: spreadsheetId");const J=Wn(Z),ne=(g=(T=n.find(lt=>{var it,Ye;return((Ye=(it=lt.valueOwner)==null?void 0:it.declaration)==null?void 0:Ye.id)===re.inputs.sheet.id}))==null?void 0:T.value)==null?void 0:g.value;if(ne==null||ne==="")return Ib(i,"Missing required input: sheet");const z=(I=(E=n.find(lt=>{var it,Ye;return((Ye=(it=lt.valueOwner)==null?void 0:it.declaration)==null?void 0:Ye.id)===re.inputs.newSheetName.id}))==null?void 0:E.value)==null?void 0:I.value,ie=(D=(A=n.find(lt=>{var it,Ye;return((Ye=(it=lt.valueOwner)==null?void 0:it.declaration)==null?void 0:Ye.id)===re.inputs.insertIndex.id}))==null?void 0:A.value)==null?void 0:D.value,pe=this.extensionsRegistry.requestContexts(this,[X.Editor])[0],me=Mi(Y),Ce={Authorization:`Bearer ${await pe.getAccessToken()}`},Oe=`${(V=pe.env)==null?void 0:V.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${pe.projectId}/${qt["google-sheet"]}/${me}`,Ve=async lt=>Ht.post(Oe,lt,{headers:Ce});let Ie;if(!isNaN(Number(ne)))Ie=Number(ne);else{const lt=await Ve({method:"GET",endpoint:`/v4/spreadsheets/${J}`}),Ye=(((x=(N=lt.data)==null?void 0:N.data)==null?void 0:x.sheets)||((G=lt.data)==null?void 0:G.sheets)||[]).find(at=>{var vt;return((vt=at.properties)==null?void 0:vt.title)===String(ne)});if(!Ye)return Ib(i,`Could not find sheet with name "${ne}"`);Ie=Ye.properties.sheetId}const $e={sourceSheetId:Ie};z&&($e.newSheetName=z),typeof ie=="number"&&($e.insertSheetIndex=ie);const Ze=await Ve({method:"POST",endpoint:`/v4/spreadsheets/${J}:batchUpdate`,data:{requests:[{duplicateSheet:$e}]}}),rt=((W=(H=(q=(((K=Ze.data)==null?void 0:K.data)||Ze.data||{}).replies)==null?void 0:q[0])==null?void 0:H.duplicateSheet)==null?void 0:W.properties)||{};return{value:U.Success,error:null,result:{newSheetId:rt.sheetId,newSheetName:rt.title}}}catch(re){const Y=((ee=re.response)==null?void 0:ee.data)||re.message||re;return Ib(i,Y)}}})}}class hct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsDeleteChart,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsDeleteChart);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=He(i,i.project,"deleteChart"),E="["+Fe(i,i.project,"Delete Chart")+": `"+T+"`] ",I=(Z,J,ne)=>{const z=Fe(Z==null?void 0:Z.valueOwner,m==null?void 0:m.logic,J),ie=He(Z==null?void 0:Z.valueOwner,m==null?void 0:m.logic,ne);return`"${z}" (\`${ie}\`)`},A=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsDeleteChart].inputs.connection.id}),D=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!D||!D.id||!D.name||D.type!==a.DefinitionEntity)throw new Error(`${E}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const V=Mi(D);if(!V)throw new Error(`${E}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const N=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsDeleteChart].inputs.spreadsheetId.id}),x=(c=N==null?void 0:N.value)==null?void 0:c.value,G=Wn(x,{errorPrefix:`${E}The ${I(N,"Spreadsheet ID","spreadsheetId")} input `}),K=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsDeleteChart].inputs.chartId.id}),q=(e=K==null?void 0:K.value)==null?void 0:e.value;if(q==null)throw new Error(`${E}The ${I(K,"chartId","chartId")} input is missing.`);const W={Authorization:`Bearer ${await m.getAccessToken()}`},ee=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${qt["google-sheet"]}/${V}`,re=async Z=>Ht.post(ee,Z,{headers:W});let Y={};return Y.deleteChart={chartId:typeof q=="string"&&q.trim().startsWith("{")?JSON.parse(q):q},await re({method:"POST",endpoint:`/v4/spreadsheets/${G}:batchUpdate`,data:{requests:[Y]}}),{value:U.Success,result:{success:!0},error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return oe.Logger.log("[Google Sheets] error:",T),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:T,result:null}}}})}}class mct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsDeletePivotTable,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsDeletePivotTable);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=He(i,i.project,"deletePivotTable"),E="["+Fe(i,i.project,"Delete Pivot Table")+": `"+T+"`] ",I=(Z,J,ne)=>{const z=Fe(Z==null?void 0:Z.valueOwner,m==null?void 0:m.logic,J),ie=He(Z==null?void 0:Z.valueOwner,m==null?void 0:m.logic,ne);return`"${z}" (\`${ie}\`)`},A=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsDeletePivotTable].inputs.connection.id}),D=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!D||!D.id||!D.name||D.type!==a.DefinitionEntity)throw new Error(`${E}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const V=Mi(D);if(!V)throw new Error(`${E}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const N=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsDeletePivotTable].inputs.spreadsheetId.id}),x=(c=N==null?void 0:N.value)==null?void 0:c.value,G=Wn(x,{errorPrefix:`${E}The ${I(N,"Spreadsheet ID","spreadsheetId")} input `}),K=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsDeletePivotTable].inputs.destination.id}),q=(e=K==null?void 0:K.value)==null?void 0:e.value;if(q==null)throw new Error(`${E}The ${I(K,"destination","destination")} input is missing.`);const W={Authorization:`Bearer ${await m.getAccessToken()}`},ee=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${qt["google-sheet"]}/${V}`,re=async Z=>Ht.post(ee,Z,{headers:W});let Y={updateCells:{start:typeof q=="string"&&q.trim().startsWith("{")?JSON.parse(q):q,rows:[{values:[{pivotTable:null}]}],fields:"pivotTable"}};return await re({method:"POST",endpoint:`/v4/spreadsheets/${G}:batchUpdate`,data:{requests:[Y]}}),{value:U.Success,result:{success:!0},error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return oe.Logger.log("[Google Sheets] error:",T),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:T,result:null}}}})}}class Tct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsDeleteDimension,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsDeleteDimension);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=He(i,i.project,"deleteDimension"),E="["+Fe(i,i.project,"Delete Dimension")+": `"+T+"`] ",I=(Z,J,ne)=>{const z=Fe(Z==null?void 0:Z.valueOwner,m==null?void 0:m.logic,J),ie=He(Z==null?void 0:Z.valueOwner,m==null?void 0:m.logic,ne);return`"${z}" (\`${ie}\`)`},A=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsDeleteDimension].inputs.connection.id}),D=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!D||!D.id||!D.name||D.type!==a.DefinitionEntity)throw new Error(`${E}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const V=Mi(D);if(!V)throw new Error(`${E}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const N=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsDeleteDimension].inputs.spreadsheetId.id}),x=(c=N==null?void 0:N.value)==null?void 0:c.value,G=Wn(x,{errorPrefix:`${E}The ${I(N,"Spreadsheet ID","spreadsheetId")} input `}),K=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsDeleteDimension].inputs.range.id}),q=(e=K==null?void 0:K.value)==null?void 0:e.value;if(q==null)throw new Error(`${E}The ${I(K,"range","range")} input is missing.`);const W={Authorization:`Bearer ${await m.getAccessToken()}`},ee=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${qt["google-sheet"]}/${V}`,re=async Z=>Ht.post(ee,Z,{headers:W});let Y={};return Y.deleteDimension={range:gI(q,{errorPrefix:`${E}The ${I(K,"Range","range")} input `})},await re({method:"POST",endpoint:`/v4/spreadsheets/${G}:batchUpdate`,data:{requests:[Y]}}),{value:U.Success,result:{success:!0},error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return oe.Logger.log("[Google Sheets] error:",T),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:T,result:null}}}})}}class vct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsDeleteProtectedRange,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsDeleteProtectedRange);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=He(i,i.project,"deleteProtectedRange"),E="["+Fe(i,i.project,"Delete Protected Range")+": `"+T+"`] ",I=(Z,J,ne)=>{const z=Fe(Z==null?void 0:Z.valueOwner,m==null?void 0:m.logic,J),ie=He(Z==null?void 0:Z.valueOwner,m==null?void 0:m.logic,ne);return`"${z}" (\`${ie}\`)`},A=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsDeleteProtectedRange].inputs.connection.id}),D=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!D||!D.id||!D.name||D.type!==a.DefinitionEntity)throw new Error(`${E}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const V=Mi(D);if(!V)throw new Error(`${E}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const N=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsDeleteProtectedRange].inputs.spreadsheetId.id}),x=(c=N==null?void 0:N.value)==null?void 0:c.value,G=Wn(x,{errorPrefix:`${E}The ${I(N,"Spreadsheet ID","spreadsheetId")} input `}),K=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsDeleteProtectedRange].inputs.protectedRangeId.id}),q=(e=K==null?void 0:K.value)==null?void 0:e.value;if(q==null)throw new Error(`${E}The ${I(K,"protectedRangeId","protectedRangeId")} input is missing.`);const W={Authorization:`Bearer ${await m.getAccessToken()}`},ee=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${qt["google-sheet"]}/${V}`,re=async Z=>Ht.post(ee,Z,{headers:W});let Y={};return Y.deleteProtectedRange={protectedRangeId:typeof q=="string"&&q.trim().startsWith("{")?JSON.parse(q):q},await re({method:"POST",endpoint:`/v4/spreadsheets/${G}:batchUpdate`,data:{requests:[Y]}}),{value:U.Success,result:{success:!0},error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return oe.Logger.log("[Google Sheets] error:",T),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:T,result:null}}}})}}class gct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsAddBanding,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsAddBanding);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=He(i,i.project,"addBanding"),E="["+Fe(i,i.project,"Add Banding")+": `"+T+"`] ",I=(Z,J,ne)=>{const z=Fe(Z==null?void 0:Z.valueOwner,m==null?void 0:m.logic,J),ie=He(Z==null?void 0:Z.valueOwner,m==null?void 0:m.logic,ne);return`"${z}" (\`${ie}\`)`},A=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsAddBanding].inputs.connection.id}),D=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!D||!D.id||!D.name||D.type!==a.DefinitionEntity)throw new Error(`${E}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const V=Mi(D);if(!V)throw new Error(`${E}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const N=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsAddBanding].inputs.spreadsheetId.id}),x=(c=N==null?void 0:N.value)==null?void 0:c.value,G=Wn(x,{errorPrefix:`${E}The ${I(N,"Spreadsheet ID","spreadsheetId")} input `}),K=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsAddBanding].inputs.bandedRange.id}),q=(e=K==null?void 0:K.value)==null?void 0:e.value;if(q==null)throw new Error(`${E}The ${I(K,"bandedRange","bandedRange")} input is missing.`);const W={Authorization:`Bearer ${await m.getAccessToken()}`},ee=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${qt["google-sheet"]}/${V}`,re=async Z=>Ht.post(ee,Z,{headers:W});let Y={};return Y.addBanding={bandedRange:Cp(q,{errorPrefix:`${E}The ${I(K,"bandedRange","bandedRange")} input `})},await re({method:"POST",endpoint:`/v4/spreadsheets/${G}:batchUpdate`,data:{requests:[Y]}}),{value:U.Success,result:{success:!0},error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return oe.Logger.log("[Google Sheets] error:",T),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:T,result:null}}}})}}class bct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsAddChart,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsAddChart);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=He(i,i.project,"addChart"),E="["+Fe(i,i.project,"Add Chart")+": `"+T+"`] ",I=(Z,J,ne)=>{const z=Fe(Z==null?void 0:Z.valueOwner,m==null?void 0:m.logic,J),ie=He(Z==null?void 0:Z.valueOwner,m==null?void 0:m.logic,ne);return`"${z}" (\`${ie}\`)`},A=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsAddChart].inputs.connection.id}),D=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!D||!D.id||!D.name||D.type!==a.DefinitionEntity)throw new Error(`${E}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const V=Mi(D);if(!V)throw new Error(`${E}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const N=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsAddChart].inputs.spreadsheetId.id}),x=(c=N==null?void 0:N.value)==null?void 0:c.value,G=Wn(x,{errorPrefix:`${E}The ${I(N,"Spreadsheet ID","spreadsheetId")} input `}),K=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsAddChart].inputs.chart.id}),q=(e=K==null?void 0:K.value)==null?void 0:e.value;if(q==null)throw new Error(`${E}The ${I(K,"chart","chart")} input is missing.`);const W={Authorization:`Bearer ${await m.getAccessToken()}`},ee=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${qt["google-sheet"]}/${V}`,re=async Z=>Ht.post(ee,Z,{headers:W});let Y={};return Y.addChart={chart:typeof q=="string"&&q.trim().startsWith("{")?JSON.parse(q):q},await re({method:"POST",endpoint:`/v4/spreadsheets/${G}:batchUpdate`,data:{requests:[Y]}}),{value:U.Success,result:{success:!0},error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return oe.Logger.log("[Google Sheets] error:",T),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:T,result:null}}}})}}class Ect extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsAddConditionalFormatRule,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsAddConditionalFormatRule);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=He(i,i.project,"addConditionalFormatRule"),E="["+Fe(i,i.project,"Add Conditional Format Rule")+": `"+T+"`] ",I=(Z,J,ne)=>{const z=Fe(Z==null?void 0:Z.valueOwner,m==null?void 0:m.logic,J),ie=He(Z==null?void 0:Z.valueOwner,m==null?void 0:m.logic,ne);return`"${z}" (\`${ie}\`)`},A=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsAddConditionalFormatRule].inputs.connection.id}),D=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!D||!D.id||!D.name||D.type!==a.DefinitionEntity)throw new Error(`${E}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const V=Mi(D);if(!V)throw new Error(`${E}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const N=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsAddConditionalFormatRule].inputs.spreadsheetId.id}),x=(c=N==null?void 0:N.value)==null?void 0:c.value,G=Wn(x,{errorPrefix:`${E}The ${I(N,"Spreadsheet ID","spreadsheetId")} input `}),K=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsAddConditionalFormatRule].inputs.rule.id}),q=(e=K==null?void 0:K.value)==null?void 0:e.value;if(q==null)throw new Error(`${E}The ${I(K,"rule","rule")} input is missing.`);const W={Authorization:`Bearer ${await m.getAccessToken()}`},ee=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${qt["google-sheet"]}/${V}`,re=async Z=>Ht.post(ee,Z,{headers:W});let Y={};return Y.addConditionalFormatRule={rule:typeof q=="string"&&q.trim().startsWith("{")?JSON.parse(q):q},await re({method:"POST",endpoint:`/v4/spreadsheets/${G}:batchUpdate`,data:{requests:[Y]}}),{value:U.Success,result:{success:!0},error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return oe.Logger.log("[Google Sheets] error:",T),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:T,result:null}}}})}}class Act extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsAddProtectedRange,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsAddProtectedRange);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=He(i,i.project,"addProtectedRange"),E="["+Fe(i,i.project,"Add Protected Range")+": `"+T+"`] ",I=(Z,J,ne)=>{const z=Fe(Z==null?void 0:Z.valueOwner,m==null?void 0:m.logic,J),ie=He(Z==null?void 0:Z.valueOwner,m==null?void 0:m.logic,ne);return`"${z}" (\`${ie}\`)`},A=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsAddProtectedRange].inputs.connection.id}),D=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!D||!D.id||!D.name||D.type!==a.DefinitionEntity)throw new Error(`${E}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const V=Mi(D);if(!V)throw new Error(`${E}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const N=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsAddProtectedRange].inputs.spreadsheetId.id}),x=(c=N==null?void 0:N.value)==null?void 0:c.value,G=Wn(x,{errorPrefix:`${E}The ${I(N,"Spreadsheet ID","spreadsheetId")} input `}),K=n.find(Z=>{var J;return((J=Z.valueOwner.declaration)==null?void 0:J.id)===L.operation[le.GoogleSheetsAddProtectedRange].inputs.protectedRange.id}),q=(e=K==null?void 0:K.value)==null?void 0:e.value;if(q==null)throw new Error(`${E}The ${I(K,"protectedRange","protectedRange")} input is missing.`);const W={Authorization:`Bearer ${await m.getAccessToken()}`},ee=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${qt["google-sheet"]}/${V}`,re=async Z=>Ht.post(ee,Z,{headers:W});let Y={};return Y.addProtectedRange={protectedRange:typeof q=="string"&&q.trim().startsWith("{")?JSON.parse(q):q},await re({method:"POST",endpoint:`/v4/spreadsheets/${G}:batchUpdate`,data:{requests:[Y]}}),{value:U.Success,result:{success:!0},error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return oe.Logger.log("[Google Sheets] error:",T),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:T,result:null}}}})}}class Ict extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsUpdateChartSpec,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsUpdateChartSpec);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=He(i,i.project,"updateChartSpec"),I="["+Fe(i,i.project,"Update Chart Spec")+": `"+g+"`] ",A=(z,ie,pe)=>{const me=Fe(z==null?void 0:z.valueOwner,T==null?void 0:T.logic,ie),ve=He(z==null?void 0:z.valueOwner,T==null?void 0:T.logic,pe);return`"${me}" (\`${ve}\`)`},D=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsUpdateChartSpec].inputs.connection.id}),V=(s=D==null?void 0:D.value)==null?void 0:s.valueAsType;if(!V||!V.id||!V.name||V.type!==a.DefinitionEntity)throw new Error(`${I}The ${A(D,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const N=Mi(V);if(!N)throw new Error(`${I}The ${A(D,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsUpdateChartSpec].inputs.spreadsheetId.id}),G=(c=x==null?void 0:x.value)==null?void 0:c.value,K=Wn(G,{errorPrefix:`${I}The ${A(x,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsUpdateChartSpec].inputs.chartId.id}),H=(e=q==null?void 0:q.value)==null?void 0:e.value;if(H==null)throw new Error(`${I}The ${A(q,"chartId","chartId")} input is missing.`);const W=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsUpdateChartSpec].inputs.chart.id}),ee=(f=W==null?void 0:W.value)==null?void 0:f.value;if(ee==null)throw new Error(`${I}The ${A(W,"chart","chart")} input is missing.`);const Y={Authorization:`Bearer ${await T.getAccessToken()}`},Z=`${(y=T.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${T.projectId}/${qt["google-sheet"]}/${N}`,J=async z=>Ht.post(Z,z,{headers:Y});let ne={};return ne.updateChartSpec={chartId:typeof H=="string"&&H.trim().startsWith("{")?JSON.parse(H):H,chart:typeof ee=="string"&&ee.trim().startsWith("{")?JSON.parse(ee):ee},await J({method:"POST",endpoint:`/v4/spreadsheets/${K}:batchUpdate`,data:{requests:[ne]}}),{value:U.Success,result:{success:!0},error:null}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return oe.Logger.log("[Google Sheets] error:",g),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:g,result:null}}}})}}class Rct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsCreatePivotTable,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsCreatePivotTable);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=He(i,i.project,"createPivotTable"),I="["+Fe(i,i.project,"Create Pivot Table")+": `"+g+"`] ",A=(z,ie,pe)=>{const me=Fe(z==null?void 0:z.valueOwner,T==null?void 0:T.logic,ie),ve=He(z==null?void 0:z.valueOwner,T==null?void 0:T.logic,pe);return`"${me}" (\`${ve}\`)`},D=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsCreatePivotTable].inputs.connection.id}),V=(s=D==null?void 0:D.value)==null?void 0:s.valueAsType;if(!V||!V.id||!V.name||V.type!==a.DefinitionEntity)throw new Error(`${I}The ${A(D,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const N=Mi(V);if(!N)throw new Error(`${I}The ${A(D,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsCreatePivotTable].inputs.spreadsheetId.id}),G=(c=x==null?void 0:x.value)==null?void 0:c.value,K=Wn(G,{errorPrefix:`${I}The ${A(x,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsCreatePivotTable].inputs.destination.id}),H=(e=q==null?void 0:q.value)==null?void 0:e.value;if(H==null)throw new Error(`${I}The ${A(q,"destination","destination")} input is missing.`);const W=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsCreatePivotTable].inputs.pivotTable.id}),ee=(f=W==null?void 0:W.value)==null?void 0:f.value;if(ee==null)throw new Error(`${I}The ${A(W,"pivotTable","pivotTable")} input is missing.`);const Y={Authorization:`Bearer ${await T.getAccessToken()}`},Z=`${(y=T.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${T.projectId}/${qt["google-sheet"]}/${N}`,J=async z=>Ht.post(Z,z,{headers:Y});let ne={updateCells:{start:typeof H=="string"&&H.trim().startsWith("{")?JSON.parse(H):H,rows:[{values:[{pivotTable:typeof ee=="string"&&ee.trim().startsWith("{")?JSON.parse(ee):ee}]}],fields:"pivotTable"}};return await J({method:"POST",endpoint:`/v4/spreadsheets/${K}:batchUpdate`,data:{requests:[ne]}}),{value:U.Success,result:{success:!0},error:null}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return oe.Logger.log("[Google Sheets] error:",g),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:g,result:null}}}})}}class Dct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsInsertDimension,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsInsertDimension);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=He(i,i.project,"insertDimension"),I="["+Fe(i,i.project,"Insert Dimension")+": `"+g+"`] ",A=(z,ie,pe)=>{const me=Fe(z==null?void 0:z.valueOwner,T==null?void 0:T.logic,ie),ve=He(z==null?void 0:z.valueOwner,T==null?void 0:T.logic,pe);return`"${me}" (\`${ve}\`)`},D=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsInsertDimension].inputs.connection.id}),V=(s=D==null?void 0:D.value)==null?void 0:s.valueAsType;if(!V||!V.id||!V.name||V.type!==a.DefinitionEntity)throw new Error(`${I}The ${A(D,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const N=Mi(V);if(!N)throw new Error(`${I}The ${A(D,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsInsertDimension].inputs.spreadsheetId.id}),G=(c=x==null?void 0:x.value)==null?void 0:c.value,K=Wn(G,{errorPrefix:`${I}The ${A(x,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsInsertDimension].inputs.range.id}),H=(e=q==null?void 0:q.value)==null?void 0:e.value;if(H==null)throw new Error(`${I}The ${A(q,"range","range")} input is missing.`);const W=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsInsertDimension].inputs.inheritFromBefore.id}),ee=(f=W==null?void 0:W.value)==null?void 0:f.value;if(ee==null)throw new Error(`${I}The ${A(W,"inheritFromBefore","inheritFromBefore")} input is missing.`);const Y={Authorization:`Bearer ${await T.getAccessToken()}`},Z=`${(y=T.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${T.projectId}/${qt["google-sheet"]}/${N}`,J=async z=>Ht.post(Z,z,{headers:Y});let ne={};return ne.insertDimension={range:gI(H,{errorPrefix:`${I}The ${A(q,"Range","range")} input `}),inheritFromBefore:typeof ee=="string"&&ee.trim().startsWith("{")?JSON.parse(ee):ee},await J({method:"POST",endpoint:`/v4/spreadsheets/${K}:batchUpdate`,data:{requests:[ne]}}),{value:U.Success,result:{success:!0},error:null}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return oe.Logger.log("[Google Sheets] error:",g),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:g,result:null}}}})}}class Cct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsMoveDimension,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsMoveDimension);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=He(i,i.project,"moveDimension"),I="["+Fe(i,i.project,"Move Dimension")+": `"+g+"`] ",A=(z,ie,pe)=>{const me=Fe(z==null?void 0:z.valueOwner,T==null?void 0:T.logic,ie),ve=He(z==null?void 0:z.valueOwner,T==null?void 0:T.logic,pe);return`"${me}" (\`${ve}\`)`},D=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsMoveDimension].inputs.connection.id}),V=(s=D==null?void 0:D.value)==null?void 0:s.valueAsType;if(!V||!V.id||!V.name||V.type!==a.DefinitionEntity)throw new Error(`${I}The ${A(D,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const N=Mi(V);if(!N)throw new Error(`${I}The ${A(D,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsMoveDimension].inputs.spreadsheetId.id}),G=(c=x==null?void 0:x.value)==null?void 0:c.value,K=Wn(G,{errorPrefix:`${I}The ${A(x,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsMoveDimension].inputs.source.id}),H=(e=q==null?void 0:q.value)==null?void 0:e.value;if(H==null)throw new Error(`${I}The ${A(q,"source","source")} input is missing.`);const W=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsMoveDimension].inputs.destinationIndex.id}),ee=(f=W==null?void 0:W.value)==null?void 0:f.value;if(ee==null)throw new Error(`${I}The ${A(W,"destinationIndex","destinationIndex")} input is missing.`);const Y={Authorization:`Bearer ${await T.getAccessToken()}`},Z=`${(y=T.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${T.projectId}/${qt["google-sheet"]}/${N}`,J=async z=>Ht.post(Z,z,{headers:Y});let ne={};return ne.moveDimension={source:typeof H=="string"&&H.trim().startsWith("{")?JSON.parse(H):H,destinationIndex:typeof ee=="string"&&ee.trim().startsWith("{")?JSON.parse(ee):ee},await J({method:"POST",endpoint:`/v4/spreadsheets/${K}:batchUpdate`,data:{requests:[ne]}}),{value:U.Success,result:{success:!0},error:null}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return oe.Logger.log("[Google Sheets] error:",g),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:g,result:null}}}})}}class wct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsUpdateConditionalFormatRule,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsUpdateConditionalFormatRule);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=He(i,i.project,"updateConditionalFormatRule"),I="["+Fe(i,i.project,"Update Conditional Format Rule")+": `"+g+"`] ",A=(z,ie,pe)=>{const me=Fe(z==null?void 0:z.valueOwner,T==null?void 0:T.logic,ie),ve=He(z==null?void 0:z.valueOwner,T==null?void 0:T.logic,pe);return`"${me}" (\`${ve}\`)`},D=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsUpdateConditionalFormatRule].inputs.connection.id}),V=(s=D==null?void 0:D.value)==null?void 0:s.valueAsType;if(!V||!V.id||!V.name||V.type!==a.DefinitionEntity)throw new Error(`${I}The ${A(D,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const N=Mi(V);if(!N)throw new Error(`${I}The ${A(D,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsUpdateConditionalFormatRule].inputs.spreadsheetId.id}),G=(c=x==null?void 0:x.value)==null?void 0:c.value,K=Wn(G,{errorPrefix:`${I}The ${A(x,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsUpdateConditionalFormatRule].inputs.index.id}),H=(e=q==null?void 0:q.value)==null?void 0:e.value;if(H==null)throw new Error(`${I}The ${A(q,"index","index")} input is missing.`);const W=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsUpdateConditionalFormatRule].inputs.rule.id}),ee=(f=W==null?void 0:W.value)==null?void 0:f.value;if(ee==null)throw new Error(`${I}The ${A(W,"rule","rule")} input is missing.`);const Y={Authorization:`Bearer ${await T.getAccessToken()}`},Z=`${(y=T.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${T.projectId}/${qt["google-sheet"]}/${N}`,J=async z=>Ht.post(Z,z,{headers:Y});let ne={};return ne.updateConditionalFormatRule={index:typeof H=="string"&&H.trim().startsWith("{")?JSON.parse(H):H,rule:typeof ee=="string"&&ee.trim().startsWith("{")?JSON.parse(ee):ee},await J({method:"POST",endpoint:`/v4/spreadsheets/${K}:batchUpdate`,data:{requests:[ne]}}),{value:U.Success,result:{success:!0},error:null}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return oe.Logger.log("[Google Sheets] error:",g),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:g,result:null}}}})}}class Oct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsUpdateProtectedRange,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsUpdateProtectedRange);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=He(i,i.project,"updateProtectedRange"),I="["+Fe(i,i.project,"Update Protected Range")+": `"+g+"`] ",A=(z,ie,pe)=>{const me=Fe(z==null?void 0:z.valueOwner,T==null?void 0:T.logic,ie),ve=He(z==null?void 0:z.valueOwner,T==null?void 0:T.logic,pe);return`"${me}" (\`${ve}\`)`},D=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsUpdateProtectedRange].inputs.connection.id}),V=(s=D==null?void 0:D.value)==null?void 0:s.valueAsType;if(!V||!V.id||!V.name||V.type!==a.DefinitionEntity)throw new Error(`${I}The ${A(D,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const N=Mi(V);if(!N)throw new Error(`${I}The ${A(D,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsUpdateProtectedRange].inputs.spreadsheetId.id}),G=(c=x==null?void 0:x.value)==null?void 0:c.value,K=Wn(G,{errorPrefix:`${I}The ${A(x,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsUpdateProtectedRange].inputs.protectedRangeId.id}),H=(e=q==null?void 0:q.value)==null?void 0:e.value;if(H==null)throw new Error(`${I}The ${A(q,"protectedRangeId","protectedRangeId")} input is missing.`);const W=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsUpdateProtectedRange].inputs.protectedRange.id}),ee=(f=W==null?void 0:W.value)==null?void 0:f.value;if(ee==null)throw new Error(`${I}The ${A(W,"protectedRange","protectedRange")} input is missing.`);const Y={Authorization:`Bearer ${await T.getAccessToken()}`},Z=`${(y=T.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${T.projectId}/${qt["google-sheet"]}/${N}`,J=async z=>Ht.post(Z,z,{headers:Y});let ne={};return ne.updateProtectedRange={protectedRangeId:typeof H=="string"&&H.trim().startsWith("{")?JSON.parse(H):H,protectedRange:typeof ee=="string"&&ee.trim().startsWith("{")?JSON.parse(ee):ee},await J({method:"POST",endpoint:`/v4/spreadsheets/${K}:batchUpdate`,data:{requests:[ne]}}),{value:U.Success,result:{success:!0},error:null}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return oe.Logger.log("[Google Sheets] error:",g),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:g,result:null}}}})}}class Pct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsAddNamedRange,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsAddNamedRange);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=He(i,i.project,"addNamedRange"),I="["+Fe(i,i.project,"Add Named Range")+": `"+g+"`] ",A=(z,ie,pe)=>{const me=Fe(z==null?void 0:z.valueOwner,T==null?void 0:T.logic,ie),ve=He(z==null?void 0:z.valueOwner,T==null?void 0:T.logic,pe);return`"${me}" (\`${ve}\`)`},D=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsAddNamedRange].inputs.connection.id}),V=(s=D==null?void 0:D.value)==null?void 0:s.valueAsType;if(!V||!V.id||!V.name||V.type!==a.DefinitionEntity)throw new Error(`${I}The ${A(D,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const N=Mi(V);if(!N)throw new Error(`${I}The ${A(D,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsAddNamedRange].inputs.spreadsheetId.id}),G=(c=x==null?void 0:x.value)==null?void 0:c.value,K=Wn(G,{errorPrefix:`${I}The ${A(x,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsAddNamedRange].inputs.name.id}),H=(e=q==null?void 0:q.value)==null?void 0:e.value;if(H==null)throw new Error(`${I}The ${A(q,"name","name")} input is missing.`);const W=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsAddNamedRange].inputs.range.id}),ee=(f=W==null?void 0:W.value)==null?void 0:f.value;if(ee==null)throw new Error(`${I}The ${A(W,"range","range")} input is missing.`);const Y={Authorization:`Bearer ${await T.getAccessToken()}`},Z=`${(y=T.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${T.projectId}/${qt["google-sheet"]}/${N}`,J=async z=>Ht.post(Z,z,{headers:Y});let ne={};return ne.addNamedRange={name:typeof H=="string"&&H.trim().startsWith("{")?JSON.parse(H):H,range:Cp(ee,{errorPrefix:`${I}The ${A(W,"Range","range")} input `})},await J({method:"POST",endpoint:`/v4/spreadsheets/${K}:batchUpdate`,data:{requests:[ne]}}),{value:U.Success,result:{success:!0},error:null}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return oe.Logger.log("[Google Sheets] error:",g),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:g,result:null}}}})}}class xct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsSetCellNote,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsSetCellNote);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=He(i,i.project,"setCellNote"),I="["+Fe(i,i.project,"Set Cell Note")+": `"+g+"`] ",A=(z,ie,pe)=>{const me=Fe(z==null?void 0:z.valueOwner,T==null?void 0:T.logic,ie),ve=He(z==null?void 0:z.valueOwner,T==null?void 0:T.logic,pe);return`"${me}" (\`${ve}\`)`},D=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsSetCellNote].inputs.connection.id}),V=(s=D==null?void 0:D.value)==null?void 0:s.valueAsType;if(!V||!V.id||!V.name||V.type!==a.DefinitionEntity)throw new Error(`${I}The ${A(D,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const N=Mi(V);if(!N)throw new Error(`${I}The ${A(D,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsSetCellNote].inputs.spreadsheetId.id}),G=(c=x==null?void 0:x.value)==null?void 0:c.value,K=Wn(G,{errorPrefix:`${I}The ${A(x,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsSetCellNote].inputs.range.id}),H=(e=q==null?void 0:q.value)==null?void 0:e.value;if(H==null)throw new Error(`${I}The ${A(q,"range","range")} input is missing.`);const W=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsSetCellNote].inputs.note.id}),ee=(f=W==null?void 0:W.value)==null?void 0:f.value;if(ee==null)throw new Error(`${I}The ${A(W,"note","note")} input is missing.`);const Y={Authorization:`Bearer ${await T.getAccessToken()}`},Z=`${(y=T.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${T.projectId}/${qt["google-sheet"]}/${N}`,J=async z=>Ht.post(Z,z,{headers:Y});let ne={repeatCell:{range:Cp(H,{errorPrefix:`${I}The ${A(q,"Range","range")} input `}),cell:{note:typeof ee=="string"&&ee.trim().startsWith("{")?JSON.parse(ee):ee},fields:"note"}};return await J({method:"POST",endpoint:`/v4/spreadsheets/${K}:batchUpdate`,data:{requests:[ne]}}),{value:U.Success,result:{success:!0},error:null}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return oe.Logger.log("[Google Sheets] error:",g),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:g,result:null}}}})}}class _ct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsDeleteConditionalFormatRule,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsDeleteConditionalFormatRule);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=He(i,i.project,"deleteConditionalFormatRule"),I="["+Fe(i,i.project,"Delete Conditional Format Rule")+": `"+g+"`] ",A=(z,ie,pe)=>{const me=Fe(z==null?void 0:z.valueOwner,T==null?void 0:T.logic,ie),ve=He(z==null?void 0:z.valueOwner,T==null?void 0:T.logic,pe);return`"${me}" (\`${ve}\`)`},D=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsDeleteConditionalFormatRule].inputs.connection.id}),V=(s=D==null?void 0:D.value)==null?void 0:s.valueAsType;if(!V||!V.id||!V.name||V.type!==a.DefinitionEntity)throw new Error(`${I}The ${A(D,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const N=Mi(V);if(!N)throw new Error(`${I}The ${A(D,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsDeleteConditionalFormatRule].inputs.spreadsheetId.id}),G=(c=x==null?void 0:x.value)==null?void 0:c.value,K=Wn(G,{errorPrefix:`${I}The ${A(x,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsDeleteConditionalFormatRule].inputs.sheetId.id}),H=(e=q==null?void 0:q.value)==null?void 0:e.value;if(H==null)throw new Error(`${I}The ${A(q,"sheetId","sheetId")} input is missing.`);const W=n.find(z=>{var ie;return((ie=z.valueOwner.declaration)==null?void 0:ie.id)===L.operation[le.GoogleSheetsDeleteConditionalFormatRule].inputs.index.id}),ee=(f=W==null?void 0:W.value)==null?void 0:f.value;if(ee==null)throw new Error(`${I}The ${A(W,"index","index")} input is missing.`);const Y={Authorization:`Bearer ${await T.getAccessToken()}`},Z=`${(y=T.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${T.projectId}/${qt["google-sheet"]}/${N}`,J=async z=>Ht.post(Z,z,{headers:Y});let ne={};return ne.deleteConditionalFormatRule={sheetId:typeof H=="string"&&H.trim().startsWith("{")?JSON.parse(H):H,index:typeof ee=="string"&&ee.trim().startsWith("{")?JSON.parse(ee):ee},await J({method:"POST",endpoint:`/v4/spreadsheets/${K}:batchUpdate`,data:{requests:[ne]}}),{value:U.Success,result:{success:!0},error:null}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return oe.Logger.log("[Google Sheets] error:",g),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:g,result:null}}}})}}class Vct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:_i+le.GoogleSheetsResizeDimension,version:"1.0.0",description:"Resize Dimension Google Sheets operation implementation module",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(le.GoogleSheetsResizeDimension);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{var s,c,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=He(i,i.project,"resizeDimension"),I="["+Fe(i,i.project,"Resize dimension")+": `"+g+"`] ",A=(ie,pe,me)=>{const ve=Fe(ie==null?void 0:ie.valueOwner,T==null?void 0:T.logic,pe),Ce=He(ie==null?void 0:ie.valueOwner,T==null?void 0:T.logic,me);return`"${ve}" (\`${Ce}\`)`},D=n.find(ie=>{var pe;return((pe=ie.valueOwner.declaration)==null?void 0:pe.id)===L.operation[le.GoogleSheetsResizeDimension].inputs.connection.id}),V=(s=D==null?void 0:D.value)==null?void 0:s.valueAsType;if(!V||!V.id||!V.name||V.type!==a.DefinitionEntity)throw new Error(`${I}The ${A(D,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const N=Mi(V);if(!N)throw new Error(`${I}The ${A(D,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(ie=>{var pe;return((pe=ie.valueOwner.declaration)==null?void 0:pe.id)===L.operation[le.GoogleSheetsResizeDimension].inputs.spreadsheetId.id}),G=(c=x==null?void 0:x.value)==null?void 0:c.value,K=Wn(G,{errorPrefix:`${I}The ${A(x,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(ie=>{var pe;return((pe=ie.valueOwner.declaration)==null?void 0:pe.id)===L.operation[le.GoogleSheetsResizeDimension].inputs.range.id}),H=(e=q==null?void 0:q.value)==null?void 0:e.value;if(H==null)throw new Error(`${I}The ${A(q,"Range","range")} input is missing.`);const W=n.find(ie=>{var pe;return((pe=ie.valueOwner.declaration)==null?void 0:pe.id)===L.operation[le.GoogleSheetsResizeDimension].inputs.pixelSize.id}),ee=(f=W==null?void 0:W.value)==null?void 0:f.value;if(ee==null||typeof ee!="number"||isNaN(ee)||ee<0)throw new Error(`${I}The ${A(W,"Pixel size","pixelSize")} input is missing or invalid. Expected a non-negative number in pixels.`);const Y={Authorization:`Bearer ${await T.getAccessToken()}`},Z=`${(y=T.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${T.projectId}/${qt["google-sheet"]}/${N}`,J=async ie=>Ht.post(Z,ie,{headers:Y});await Md(H,"Id",async()=>{var pe;return(((pe=(await J({method:"GET",endpoint:`/v4/spreadsheets/${K}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:pe.sheets)||[]).map(me=>{var ve,Ce;return{id:(ve=me.properties)==null?void 0:ve.sheetId,name:(Ce=me.properties)==null?void 0:Ce.title}})});const z={updateDimensionProperties:{range:gI(H,{errorPrefix:`${I}The ${A(q,"Range","range")} input `}),properties:{pixelSize:ee},fields:"pixelSize"}};return await J({method:"POST",endpoint:`/v4/spreadsheets/${K}:batchUpdate`,data:{requests:[z]}}),{value:U.Success,result:{success:!0},error:null}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return oe.Logger.log("[Google Sheets] error:",g),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:g,result:null}}}})}}class Nct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:Me.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_UPLOAD_FILE,version:"1.0.0",description:"Cloud File System: Upload File",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Logic]});C(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic);if(!n)return;const s=n.get(je.UploadFile);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{var s,c,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=He(i,i.project,"uploadFile"),E="["+Fe(i,i.project,"Upload file")+": `"+T+"`] ",I=n.find(ne=>{var z,ie;return((ie=(z=ne.valueOwner)==null?void 0:z.declaration)==null?void 0:ie.id)===L.operation[je.UploadFile].inputs.bucket.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==a.DefinitionEntity)throw new Error(`${E}Invalid input "${Fe(I==null?void 0:I.valueOwner,m==null?void 0:m.logic,"Storage")}" (\`${He(I==null?void 0:I.valueOwner,m==null?void 0:m.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const D=Bs(A==null?void 0:A.id,((c=m.branchHead)==null?void 0:c.identifier)||"main");if(!((m==null?void 0:m.liveResources)||[]).find(ne=>ne.resourceId===D))throw new Error(`${E}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const N=n.find(ne=>{var z,ie;return((ie=(z=ne.valueOwner)==null?void 0:z.declaration)==null?void 0:ie.id)===L.operation[je.UploadFile].inputs.key.id}),x=(e=N==null?void 0:N.value)==null?void 0:e.value;if(!x||x==="")throw new Error(`${E}The "${Fe(N==null?void 0:N.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${He(N==null?void 0:N.valueOwner,m==null?void 0:m.logic,"key")}\`) input is missing.`);if(typeof x!="string")throw new Error(`${E}The "${Fe(N==null?void 0:N.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${He(N==null?void 0:N.valueOwner,m==null?void 0:m.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const G=n.find(ne=>{var z,ie;return((ie=(z=ne.valueOwner)==null?void 0:z.declaration)==null?void 0:ie.id)===L.operation[je.UploadFile].inputs.file.id}),K=(f=G==null?void 0:G.value)==null?void 0:f.value;if(!K)throw new Error(`${E}The "${Fe(G==null?void 0:G.valueOwner,m==null?void 0:m.logic,"File")}" (\`${He(G==null?void 0:G.valueOwner,m==null?void 0:m.logic,"file")}\`) input is missing'`);if(typeof K!="object"||!K.uri||typeof K.uri!="string")throw new Error(`${E}The "${Fe(G==null?void 0:G.valueOwner,m==null?void 0:m.logic,"File")}" (\`${He(G==null?void 0:G.valueOwner,m==null?void 0:m.logic,"file")}\`) input is invalid, should be an object with a text 'uri' property.`);const q=K.uri,H=K.mimeType||"application/octet-stream",W=x,re=(y=(await Ht.post(`${m.env.API_BASE_URL}/cloud-files-service/v1/files?bucket=${D}&key=${encodeURIComponent(W)}&contentType=${encodeURIComponent(H)}`,{},{headers:{Authorization:`Bearer ${await m.getAccessToken()}`}})).data)==null?void 0:y.uploadUrl;if(!re)throw new Error(`${E}Failed to retrieve pre-signed upload URL.`);let Y;try{Y=await ES(q,()=>m.getAccessToken())}catch(ne){throw new Error(`${E}Failed to fetch file content from '${q}': ${(ne==null?void 0:ne.message)||ne}`)}await Ht.put(re,Y,{headers:{"Content-Type":H}});const J={uri:`${m.env.API_BASE_URL}/cloud-files-service/v1/files/download?bucket=${D}&key=${encodeURIComponent(W)}`,name:W.split("/").pop()||W,mimeType:H,size:Y.length};return{value:U.Success,error:null,result:J}}catch(m){return{value:U.UnhandledError,error:m,result:null}}}})}}class $ct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:Me.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_GET_FILE,version:"1.0.0",description:"Cloud File System: Get File",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Logic]});C(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic);if(!n)return;const s=n.get(je.GetFile);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{var s,c,e;try{const f=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!f||!f.env)throw new Error("Editor context or environment missing");const y=He(i,i.project,"getFile"),T="["+Fe(i,i.project,"Get file")+": `"+y+"`] ",g=n.find(G=>{var K,q;return((q=(K=G.valueOwner)==null?void 0:K.declaration)==null?void 0:q.id)===L.operation[je.GetFile].inputs.bucket.id}),E=(s=g==null?void 0:g.value)==null?void 0:s.valueAsType;if(!E||!E.id||!E.name||E.type!==a.DefinitionEntity)throw new Error(`${T}Invalid input "${Fe(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"Storage")}" (\`${He(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const I=Bs(E==null?void 0:E.id,((c=f.branchHead)==null?void 0:c.identifier)||"main");if(!((f==null?void 0:f.liveResources)||[]).find(G=>G.resourceId===I))throw new Error(`${T}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const D=n.find(G=>{var K,q;return((q=(K=G.valueOwner)==null?void 0:K.declaration)==null?void 0:q.id)===L.operation[je.GetFile].inputs.key.id}),V=(e=D==null?void 0:D.value)==null?void 0:e.value;if(!V||V==="")throw new Error(`${T}The "${Fe(D==null?void 0:D.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${He(D==null?void 0:D.valueOwner,f==null?void 0:f.logic,"key")}\`) input is missing.`);if(typeof V!="string")throw new Error(`${T}The "${Fe(D==null?void 0:D.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${He(D==null?void 0:D.valueOwner,f==null?void 0:f.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const x=(await Ht.get(`${f.env.API_BASE_URL}/cloud-files-service/v1/files/metadata?bucket=${I}&key=${encodeURIComponent(V)}`,{headers:{Authorization:`Bearer ${await f.getAccessToken()}`}})).data;return{value:U.Success,error:null,result:{uri:x.uri,name:x.name,key:x.key,size:x.size,mimeType:x.mimeType,access:x.access,lastModified:x.lastModified}}}catch(f){return{value:U.UnhandledError,error:f,result:null}}}})}}class Lct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:Me.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_LIST_FILES,version:"1.0.0",description:"Cloud File System: List Files",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Logic]});C(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic);if(!n)return;const s=n.get(je.ListFiles);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{var s,c,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=He(i,i.project,"listFiles"),E="["+Fe(i,i.project,"List files")+": `"+T+"`] ",I=n.find(pe=>{var me,ve;return((ve=(me=pe.valueOwner)==null?void 0:me.declaration)==null?void 0:ve.id)===L.operation[je.ListFiles].inputs.bucket.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==a.DefinitionEntity)throw new Error(`${E}Invalid input "${Fe(I==null?void 0:I.valueOwner,m==null?void 0:m.logic,"Storage")}" (\`${He(I==null?void 0:I.valueOwner,m==null?void 0:m.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const D=Bs(A==null?void 0:A.id,((c=m.branchHead)==null?void 0:c.identifier)||"main");if(!((m==null?void 0:m.liveResources)||[]).find(pe=>pe.resourceId===D))throw new Error(`${E}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const N=n.find(pe=>{var me,ve;return((ve=(me=pe.valueOwner)==null?void 0:me.declaration)==null?void 0:ve.id)===L.operation[je.ListFiles].inputs.path.id}),x=(e=N==null?void 0:N.value)==null?void 0:e.value;if(x!==void 0&&typeof x!="string")throw new Error(`${E}The "${Fe(N==null?void 0:N.valueOwner,m==null?void 0:m.logic,"Path")}" (\`${He(N==null?void 0:N.valueOwner,m==null?void 0:m.logic,"path")}\`) input value is invalid, if present, it must be a string.`);const G=n.find(pe=>{var me,ve;return((ve=(me=pe.valueOwner)==null?void 0:me.declaration)==null?void 0:ve.id)===L.operation[je.ListFiles].inputs.maxKeys.id}),K=(f=G==null?void 0:G.value)==null?void 0:f.value;if(K!==void 0&&(typeof K!="number"||K<=0))throw new Error(`${E}The "${Fe(G==null?void 0:G.valueOwner,m==null?void 0:m.logic,"Max results")}" (\`${He(G==null?void 0:G.valueOwner,m==null?void 0:m.logic,"maxKeys")}\`) input value is invalid, if present, it must be a number greater than 0.`);const q=n.find(pe=>{var me,ve;return((ve=(me=pe.valueOwner)==null?void 0:me.declaration)==null?void 0:ve.id)===L.operation[je.ListFiles].inputs.startAfter.id}),H=(y=q==null?void 0:q.value)==null?void 0:y.value;if(H!==void 0&&(typeof H!="string"||H===""))throw new Error(`${E}The "${Fe(q==null?void 0:q.valueOwner,m==null?void 0:m.logic,"Start after")}" (\`${He(q==null?void 0:q.valueOwner,m==null?void 0:m.logic,"startAfter")}\`) input value is invalid, if present, it must be a non-empty string.`);let W=`${m.env.API_BASE_URL}/cloud-files-service/v1/files?bucket=${D}`;x&&(W+=`&path=${encodeURIComponent(x)}`),K&&(W+=`&maxKeys=${K}`),H&&(W+=`&startAfter=${encodeURIComponent(H)}`);const ee=await Ht.get(W,{headers:{Authorization:`Bearer ${await m.getAccessToken()}`}}),re=pe=>{var Oe;if(!pe)return"application/octet-stream";const me=pe.split(".");if(me.length<=1)return"application/octet-stream";const ve=(Oe=me.pop())==null?void 0:Oe.toLowerCase();return ve&&{png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",svg:"image/svg+xml",pdf:"application/pdf",txt:"text/plain",html:"text/html",css:"text/css",js:"application/javascript",json:"application/json",csv:"text/csv",xml:"application/xml",zip:"application/zip",mp3:"audio/mpeg",mp4:"video/mp4",mov:"video/quicktime",wav:"audio/wav"}[ve]||"application/octet-stream"},Z=(ee.data.items||ee.data.files||[]).map(pe=>({uri:pe.uri||pe.url||`${m.env.API_BASE_URL}/cloud-files-service/v1/files/download?bucket=${D}&key=${encodeURIComponent(pe.key)}`,name:pe.name,key:pe.key,mimeType:pe.mimeType||re(pe.key),size:pe.size||0,lastModified:pe.lastModified,access:pe.access})),J=ee.data.total!==void 0?ee.data.total:Z.length,ne=ee.data.size!==void 0?ee.data.size:Z.reduce((pe,me)=>pe+(me.size||0),0),z=ee.data.nextStartAfter!==void 0?ee.data.nextStartAfter:null,ie=ee.data.hasMore!==void 0?ee.data.hasMore:!1;return{value:U.Success,error:null,result:{items:Z,total:J,size:ne,nextStartAfter:z,hasMore:ie}}}catch(m){return{value:U.UnhandledError,error:m,result:null}}}})}}class Gct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:Me.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_DELETE_FILES,version:"1.0.0",description:"Cloud File System: Delete Files",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Logic]});C(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic);if(!n)return;const s=n.get(je.DeleteFiles);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{var s,c,e;try{const f=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!f||!f.env)throw new Error("Editor context or environment missing");const y=He(i,i.project,"deleteFiles"),T="["+Fe(i,i.project,"Delete files")+": `"+y+"`] ",g=n.find(K=>{var q,H;return((H=(q=K.valueOwner)==null?void 0:q.declaration)==null?void 0:H.id)===L.operation[je.DeleteFiles].inputs.bucket.id}),E=(s=g==null?void 0:g.value)==null?void 0:s.valueAsType;if(!E||!E.id||!E.name||E.type!==a.DefinitionEntity)throw new Error(`${T}Invalid input "${Fe(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"Storage")}" (\`${He(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const I=Bs(E==null?void 0:E.id,((c=f.branchHead)==null?void 0:c.identifier)||"main");if(!((f==null?void 0:f.liveResources)||[]).find(K=>K.resourceId===I))throw new Error(`${T}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const D=n.find(K=>{var q,H;return((H=(q=K.valueOwner)==null?void 0:q.declaration)==null?void 0:H.id)===L.operation[je.DeleteFiles].inputs.keys.id}),V=(e=D==null?void 0:D.value)==null?void 0:e.value,N=Array.isArray(V)?V:typeof V=="string"&&V!==""?[V]:[];if(!N||N.length===0)throw new Error(`${T}The "${Fe(D==null?void 0:D.valueOwner,f==null?void 0:f.logic,"Keys")}" (\`${He(D==null?void 0:D.valueOwner,f==null?void 0:f.logic,"keys")}\`) input is missing.`);if(!Array.isArray(N)||N.some(K=>typeof K!="string"||K===""))throw new Error(`${T}The "${Fe(D==null?void 0:D.valueOwner,f==null?void 0:f.logic,"Keys")}" (\`${He(D==null?void 0:D.valueOwner,f==null?void 0:f.logic,"keys")}\`) input value is invalid, if present, it must be a list of non-empty strings.`);const G=(await Ht.delete(`${f.env.API_BASE_URL}/cloud-files-service/v1/files`,{headers:{Authorization:`Bearer ${await f.getAccessToken()}`},data:{bucket:I,keys:N}})).data;return{value:U.Success,error:null,result:null}}catch(f){return{value:U.UnhandledError,error:f,result:null}}}})}}class Bct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:Me.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_COPY_FILE,version:"1.0.0",description:"Cloud File System: Copy File",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Logic]});C(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic);if(!n)return;const s=n.get(je.CopyFile);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{var s,c,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=He(i,i.project,"copyFile"),I="["+Fe(i,i.project,"Copy file")+": `"+g+"`] ",A=n.find(ne=>{var z,ie;return((ie=(z=ne.valueOwner)==null?void 0:z.declaration)==null?void 0:ie.id)===L.operation[je.CopyFile].inputs.bucket.id}),D=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!D||!D.id||!D.name||D.type!==a.DefinitionEntity)throw new Error(`${I}Invalid input "${Fe(A==null?void 0:A.valueOwner,T==null?void 0:T.logic,"Storage")}" (\`${He(A==null?void 0:A.valueOwner,T==null?void 0:T.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const V=Bs(D==null?void 0:D.id,((c=T.branchHead)==null?void 0:c.identifier)||"main");if(!((T==null?void 0:T.liveResources)||[]).find(ne=>ne.resourceId===V))throw new Error(`${I}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const x=n.find(ne=>{var z,ie;return((ie=(z=ne.valueOwner)==null?void 0:z.declaration)==null?void 0:ie.id)===L.operation[je.CopyFile].inputs.sourceKey.id}),G=(e=x==null?void 0:x.value)==null?void 0:e.value;if(!G||G==="")throw new Error(`${I}The "${Fe(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"Source key")}" (\`${He(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"sourceKey")}\`) input is missing.`);if(typeof G!="string")throw new Error(`${I}The "${Fe(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"Source key")}" (\`${He(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"sourceKey")}\`) input value is invalid, if present, it must be a non-empty string.`);const K=n.find(ne=>{var z,ie;return((ie=(z=ne.valueOwner)==null?void 0:z.declaration)==null?void 0:ie.id)===L.operation[je.CopyFile].inputs.destinationKey.id}),q=(f=K==null?void 0:K.value)==null?void 0:f.value;if(!q||q==="")throw new Error(`${I}The "${Fe(K==null?void 0:K.valueOwner,T==null?void 0:T.logic,"Destination key")}" (\`${He(K==null?void 0:K.valueOwner,T==null?void 0:T.logic,"destinationKey")}\`) input is missing.`);if(typeof q!="string")throw new Error(`${I}The "${Fe(K==null?void 0:K.valueOwner,T==null?void 0:T.logic,"Destination key")}" (\`${He(K==null?void 0:K.valueOwner,T==null?void 0:T.logic,"destinationKey")}\`) input value is invalid, if present, it must be a non-empty string.`);const H=n.find(ne=>{var z,ie;return((ie=(z=ne.valueOwner)==null?void 0:z.declaration)==null?void 0:ie.id)===L.operation[je.CopyFile].inputs.destinationBucket.id}),W=(y=H==null?void 0:H.value)==null?void 0:y.valueAsType;if(W&&(!W.id||!W.name||W.type!==a.DefinitionEntity))throw new Error(`${I}Invalid input "${Fe(H==null?void 0:H.valueOwner,T==null?void 0:T.logic,"Destination Storage")}" (\`${He(H==null?void 0:H.valueOwner,T==null?void 0:T.logic,"destinationBucket")}\`), expected a valid "Cloud file system" node.`);const ee=W!=null&&W.id?Bs(W.id,((m=T.branchHead)==null?void 0:m.identifier)||"main"):V;if(!((T==null?void 0:T.liveResources)||[]).find(ne=>ne.resourceId===ee))throw new Error(`${I}The destination "Cloud file system" is not live. Publish the project first, then try again to run the operation node.`);const Y={headers:{Authorization:`Bearer ${await T.getAccessToken()}`}},J=(await Ht.post(`${T.env.API_BASE_URL}/cloud-files-service/v1/files/copy`,{bucket:V,destinationBucket:ee,sourceKey:G,destinationKey:q},Y)).data;return{value:U.Success,error:null,result:null}}catch(T){return{value:U.UnhandledError,error:T,result:null}}}})}}class Mct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:Me.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_MOVE_FILE,version:"1.0.0",description:"Cloud File System: Move File",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Logic]});C(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic);if(!n)return;const s=n.get(je.MoveFile);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{var s,c,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=He(i,i.project,"moveFile"),I="["+Fe(i,i.project,"Move file")+": `"+g+"`] ",A=n.find(ne=>{var z,ie;return((ie=(z=ne.valueOwner)==null?void 0:z.declaration)==null?void 0:ie.id)===L.operation[je.MoveFile].inputs.bucket.id}),D=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!D||!D.id||!D.name||D.type!==a.DefinitionEntity)throw new Error(`${I}Invalid input "${Fe(A==null?void 0:A.valueOwner,T==null?void 0:T.logic,"Storage")}" (\`${He(A==null?void 0:A.valueOwner,T==null?void 0:T.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const V=Bs(D==null?void 0:D.id,((c=T.branchHead)==null?void 0:c.identifier)||"main");if(!((T==null?void 0:T.liveResources)||[]).find(ne=>ne.resourceId===V))throw new Error(`${I}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const x=n.find(ne=>{var z,ie;return((ie=(z=ne.valueOwner)==null?void 0:z.declaration)==null?void 0:ie.id)===L.operation[je.MoveFile].inputs.sourceKey.id}),G=(e=x==null?void 0:x.value)==null?void 0:e.value;if(!G||G==="")throw new Error(`${I}The "${Fe(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"Source key")}" (\`${He(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"sourceKey")}\`) input is missing.`);if(typeof G!="string")throw new Error(`${I}The "${Fe(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"Source key")}" (\`${He(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"sourceKey")}\`) input value is invalid, if present, it must be a non-empty string.`);const K=n.find(ne=>{var z,ie;return((ie=(z=ne.valueOwner)==null?void 0:z.declaration)==null?void 0:ie.id)===L.operation[je.MoveFile].inputs.destinationKey.id}),q=(f=K==null?void 0:K.value)==null?void 0:f.value;if(!q||q==="")throw new Error(`${I}The "${Fe(K==null?void 0:K.valueOwner,T==null?void 0:T.logic,"Destination key")}" (\`${He(K==null?void 0:K.valueOwner,T==null?void 0:T.logic,"destinationKey")}\`) input is missing.`);if(typeof q!="string")throw new Error(`${I}The "${Fe(K==null?void 0:K.valueOwner,T==null?void 0:T.logic,"Destination key")}" (\`${He(K==null?void 0:K.valueOwner,T==null?void 0:T.logic,"destinationKey")}\`) input value is invalid, if present, it must be a non-empty string.`);const H=n.find(ne=>{var z,ie;return((ie=(z=ne.valueOwner)==null?void 0:z.declaration)==null?void 0:ie.id)===L.operation[je.MoveFile].inputs.destinationBucket.id}),W=(y=H==null?void 0:H.value)==null?void 0:y.valueAsType;if(W&&(!W.id||!W.name||W.type!==a.DefinitionEntity))throw new Error(`${I}Invalid input "${Fe(H==null?void 0:H.valueOwner,T==null?void 0:T.logic,"Destination storage")}" (\`${He(H==null?void 0:H.valueOwner,T==null?void 0:T.logic,"destinationBucket")}\`), expected a valid "Cloud file system" node.`);const ee=W!=null&&W.id?Bs(W.id,((m=T.branchHead)==null?void 0:m.identifier)||"main"):V;if(!((T==null?void 0:T.liveResources)||[]).find(ne=>ne.resourceId===ee))throw new Error(`${I}The destination "Cloud file system" is not live. Publish the project first, then try again to run the operation node.`);const Y={headers:{Authorization:`Bearer ${await T.getAccessToken()}`}},J=(await Ht.post(`${T.env.API_BASE_URL}/cloud-files-service/v1/files/move`,{bucket:V,destinationBucket:ee,sourceKey:G,destinationKey:q},Y)).data;return{value:U.Success,error:null,result:null}}catch(T){return{value:U.UnhandledError,error:T,result:null}}}})}}class Sct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:Me.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_RENAME_FILE,version:"1.0.0",description:"Cloud File System: Rename File",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Logic]});C(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic);if(!n)return;const s=n.get(je.RenameFile);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{var s,c,e,f;try{const y=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!y||!y.env)throw new Error("Editor context or environment missing");const m=He(i,i.project,"renameFile"),g="["+Fe(i,i.project,"Rename file")+": `"+m+"`] ",E=n.find(re=>{var Y,Z;return((Z=(Y=re.valueOwner)==null?void 0:Y.declaration)==null?void 0:Z.id)===L.operation[je.RenameFile].inputs.bucket.id}),I=(s=E==null?void 0:E.value)==null?void 0:s.valueAsType;if(!I||!I.id||!I.name||I.type!==a.DefinitionEntity)throw new Error(`${g}Invalid input "${Fe(E==null?void 0:E.valueOwner,y==null?void 0:y.logic,"Storage")}" (\`${He(E==null?void 0:E.valueOwner,y==null?void 0:y.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const A=Bs(I==null?void 0:I.id,((c=y.branchHead)==null?void 0:c.identifier)||"main");if(!((y==null?void 0:y.liveResources)||[]).find(re=>re.resourceId===A))throw new Error(`${g}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const V=n.find(re=>{var Y,Z;return((Z=(Y=re.valueOwner)==null?void 0:Y.declaration)==null?void 0:Z.id)===L.operation[je.RenameFile].inputs.key.id}),N=(e=V==null?void 0:V.value)==null?void 0:e.value;if(!N||N==="")throw new Error(`${g}The "${Fe(V==null?void 0:V.valueOwner,y==null?void 0:y.logic,"Key")}" (\`${He(V==null?void 0:V.valueOwner,y==null?void 0:y.logic,"key")}\`) input is missing.`);if(typeof N!="string")throw new Error(`${g}The "${Fe(V==null?void 0:V.valueOwner,y==null?void 0:y.logic,"Key")}" (\`${He(V==null?void 0:V.valueOwner,y==null?void 0:y.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const x=n.find(re=>{var Y,Z;return((Z=(Y=re.valueOwner)==null?void 0:Y.declaration)==null?void 0:Z.id)===L.operation[je.RenameFile].inputs.newName.id}),G=(f=x==null?void 0:x.value)==null?void 0:f.value;if(!G||G==="")throw new Error(`${g}The "${Fe(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"New name")}" (\`${He(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"newName")}\`) input is missing.`);if(typeof G!="string")throw new Error(`${g}The "${Fe(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"New name")}" (\`${He(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"newName")}\`) input value is invalid, if present, it must be a non-empty string.`);const K=N.lastIndexOf("/"),H=`${K!==-1?N.substring(0,K+1):""}${G}`,W={headers:{Authorization:`Bearer ${await y.getAccessToken()}`}},ee=await Ht.post(`${y.env.API_BASE_URL}/cloud-files-service/v1/files/rename`,{bucket:A,key:N,newName:G},W);return{value:U.Success,error:null,result:ee.data||{key:N,newName:G,destinationKey:H}}}catch(y){return{value:U.UnhandledError,error:y,result:null}}}})}}class Fct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:Me.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_GET_FILE_METADATA,version:"1.0.0",description:"Cloud File System: Get File Metadata",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Logic]});C(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic);if(!n)return;const s=n.get(je.GetFileMetadata);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{var s,c,e;try{const f=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!f||!f.env)throw new Error("Editor context or environment missing");const y=He(i,i.project,"getFileMetadata"),T="["+Fe(i,i.project,"Get file metadata")+": `"+y+"`] ",g=n.find(x=>{var G,K;return((K=(G=x.valueOwner)==null?void 0:G.declaration)==null?void 0:K.id)===L.operation[je.GetFileMetadata].inputs.bucket.id}),E=(s=g==null?void 0:g.value)==null?void 0:s.valueAsType;if(!E||!E.id||!E.name||E.type!==a.DefinitionEntity)throw new Error(`${T}Invalid input "${Fe(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"Storage")}" (\`${He(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const I=Bs(E==null?void 0:E.id,((c=f.branchHead)==null?void 0:c.identifier)||"main");if(!((f==null?void 0:f.liveResources)||[]).find(x=>x.resourceId===I))throw new Error(`${T}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const D=n.find(x=>{var G,K;return((K=(G=x.valueOwner)==null?void 0:G.declaration)==null?void 0:K.id)===L.operation[je.GetFileMetadata].inputs.key.id}),V=(e=D==null?void 0:D.value)==null?void 0:e.value;if(!V||V==="")throw new Error(`${T}The "${Fe(D==null?void 0:D.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${He(D==null?void 0:D.valueOwner,f==null?void 0:f.logic,"key")}\`) input is missing.`);if(typeof V!="string")throw new Error(`${T}The "${Fe(D==null?void 0:D.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${He(D==null?void 0:D.valueOwner,f==null?void 0:f.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const N=await Ht.get(`${f.env.API_BASE_URL}/cloud-files-service/v1/files/metadata?bucket=${I}&key=${encodeURIComponent(V)}`,{headers:{Authorization:`Bearer ${await f.getAccessToken()}`}});return{value:U.Success,error:null,result:N.data}}catch(f){return{value:U.UnhandledError,error:f,result:null}}}})}}class kct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:Me.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_CHECK_FILE_EXISTS,version:"1.0.0",description:"Cloud File System: Check File Exists",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Logic]});C(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic);if(!n)return;const s=n.get(je.CheckFileExists);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{var s,c,e;try{const f=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!f||!f.env)throw new Error("Editor context or environment missing");const y=He(i,i.project,"checkFileExists"),T="["+Fe(i,i.project,"Check File Exists")+": `"+y+"`] ",g=n.find(x=>{var G,K;return((K=(G=x.valueOwner)==null?void 0:G.declaration)==null?void 0:K.id)===L.operation[je.CheckFileExists].inputs.bucket.id}),E=(s=g==null?void 0:g.value)==null?void 0:s.valueAsType;if(!E||!E.id||!E.name||E.type!==a.DefinitionEntity)throw new Error(`${T}Invalid input "${Fe(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"Storage")}" (\`${He(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const I=Bs(E==null?void 0:E.id,((c=f.branchHead)==null?void 0:c.identifier)||"main");if(!((f==null?void 0:f.liveResources)||[]).find(x=>x.resourceId===I))throw new Error(`${T}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const D=n.find(x=>{var G,K;return((K=(G=x.valueOwner)==null?void 0:G.declaration)==null?void 0:K.id)===L.operation[je.CheckFileExists].inputs.key.id}),V=(e=D==null?void 0:D.value)==null?void 0:e.value;if(!V||V==="")throw new Error(`${T}The "${Fe(D==null?void 0:D.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${He(D==null?void 0:D.valueOwner,f==null?void 0:f.logic,"key")}\`) input is missing.`);if(typeof V!="string")throw new Error(`${T}The "${Fe(D==null?void 0:D.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${He(D==null?void 0:D.valueOwner,f==null?void 0:f.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const N=await Ht.get(`${f.env.API_BASE_URL}/cloud-files-service/v1/files/exists?bucket=${I}&key=${encodeURIComponent(V)}`,{headers:{Authorization:`Bearer ${await f.getAccessToken()}`}});return{value:U.Success,error:null,result:N.data.exists}}catch(f){return{value:U.UnhandledError,error:f,result:!1}}}})}}class Uct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:Me.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_GET_PRESIGNED_URL,version:"1.0.0",description:"Cloud File System: Get Pre-signed URL",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Logic]});C(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic);if(!n)return;const s=n.get(je.GetPresignedUrl);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{var s,c,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=He(i,i.project,"getPresignedUrl"),E="["+Fe(i,i.project,"Get pre-signed URL")+": `"+T+"`] ",I=n.find(Z=>{var J,ne;return((ne=(J=Z.valueOwner)==null?void 0:J.declaration)==null?void 0:ne.id)===L.operation[je.GetPresignedUrl].inputs.bucket.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==a.DefinitionEntity)throw new Error(`${E}Invalid input "${Fe(I==null?void 0:I.valueOwner,m==null?void 0:m.logic,"Storage")}" (\`${He(I==null?void 0:I.valueOwner,m==null?void 0:m.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const D=Bs(A==null?void 0:A.id,((c=m.branchHead)==null?void 0:c.identifier)||"main");if(!((m==null?void 0:m.liveResources)||[]).find(Z=>Z.resourceId===D))throw new Error(`${E}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const N=n.find(Z=>{var J,ne;return((ne=(J=Z.valueOwner)==null?void 0:J.declaration)==null?void 0:ne.id)===L.operation[je.GetPresignedUrl].inputs.key.id}),x=(e=N==null?void 0:N.value)==null?void 0:e.value;if(!x||x==="")throw new Error(`${E}The "${Fe(N==null?void 0:N.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${He(N==null?void 0:N.valueOwner,m==null?void 0:m.logic,"key")}\`) input is missing.`);if(typeof x!="string")throw new Error(`${E}The "${Fe(N==null?void 0:N.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${He(N==null?void 0:N.valueOwner,m==null?void 0:m.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const G=n.find(Z=>{var J,ne;return((ne=(J=Z.valueOwner)==null?void 0:J.declaration)==null?void 0:ne.id)===L.operation[je.GetPresignedUrl].inputs.action.id}),K=(f=G==null?void 0:G.value)==null?void 0:f.value,q=(K||"read").toLowerCase(),H=["read","write","delete","metadata","upload","putobject","head","headobject","getobject","get"];if(!K||K==="")throw new Error(`${E}The "${Fe(G==null?void 0:G.valueOwner,m==null?void 0:m.logic,"Action")}" (\`${He(G==null?void 0:G.valueOwner,m==null?void 0:m.logic,"action")}\`) input is missing.`);if(!H.includes(q))throw new Error(`${E}Invalid "${Fe(G==null?void 0:G.valueOwner,m==null?void 0:m.logic,"Action")}" (\`${He(G==null?void 0:G.valueOwner,m==null?void 0:m.logic,"action")}\`) input value, must be one of "read", "write", "delete" or "metadata".`);const W=n.find(Z=>{var J,ne;return((ne=(J=Z.valueOwner)==null?void 0:J.declaration)==null?void 0:ne.id)===L.operation[je.GetPresignedUrl].inputs.expiresInSeconds.id}),ee=(y=W==null?void 0:W.value)==null?void 0:y.value,re=ee!=null?Number(ee):3600;if(isNaN(re)||re<=0)throw new Error(`${E}Invalid "${Fe(W==null?void 0:W.valueOwner,m==null?void 0:m.logic,"Expires in seconds")}" (\`${He(W==null?void 0:W.valueOwner,m==null?void 0:m.logic,"expiresInSeconds")}\`) input value, expected a positive number.`);const Y=await Ht.get(`${m.env.API_BASE_URL}/cloud-files-service/v1/files/presigned-url?bucket=${D}&key=${encodeURIComponent(x)}&action=${q}&expiresInSeconds=${re}`,{headers:{Authorization:`Bearer ${await m.getAccessToken()}`}});return{value:U.Success,error:null,result:Y.data}}catch(m){return{value:U.UnhandledError,error:m,result:null}}}})}}class jct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:Me.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_SET_FILE_ACCESS,version:"1.0.0",description:"Cloud File System: Set File Access",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Logic]});C(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic);if(!n)return;const s=n.get(je.SetFileAccess);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{var s,c,e,f;try{const y=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!y||!y.env)throw new Error("Editor context or environment missing");const m=He(i,i.project,"setFileAccess"),g="["+Fe(i,i.project,"Set file access")+": `"+m+"`] ",E=n.find(K=>{var q,H;return((H=(q=K.valueOwner)==null?void 0:q.declaration)==null?void 0:H.id)===L.operation[je.SetFileAccess].inputs.bucket.id}),I=(s=E==null?void 0:E.value)==null?void 0:s.valueAsType;if(!I||!I.id||!I.name||I.type!==a.DefinitionEntity)throw new Error(`${g}Invalid input "${Fe(E==null?void 0:E.valueOwner,y==null?void 0:y.logic,"Storage")}" (\`${He(E==null?void 0:E.valueOwner,y==null?void 0:y.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const A=Bs(I==null?void 0:I.id,((c=y.branchHead)==null?void 0:c.identifier)||"main");if(!((y==null?void 0:y.liveResources)||[]).find(K=>K.resourceId===A))throw new Error(`${g}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const V=n.find(K=>{var q,H;return((H=(q=K.valueOwner)==null?void 0:q.declaration)==null?void 0:H.id)===L.operation[je.SetFileAccess].inputs.key.id}),N=(e=V==null?void 0:V.value)==null?void 0:e.value;if(!N||N==="")throw new Error(`${g}The "${Fe(V==null?void 0:V.valueOwner,y==null?void 0:y.logic,"Key")}" (\`${He(V==null?void 0:V.valueOwner,y==null?void 0:y.logic,"key")}\`) input is missing.`);if(typeof N!="string")throw new Error(`${g}The "${Fe(V==null?void 0:V.valueOwner,y==null?void 0:y.logic,"Key")}" (\`${He(V==null?void 0:V.valueOwner,y==null?void 0:y.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const x=n.find(K=>{var q,H;return((H=(q=K.valueOwner)==null?void 0:q.declaration)==null?void 0:H.id)===L.operation[je.SetFileAccess].inputs.access.id}),G=((f=x==null?void 0:x.value)==null?void 0:f.value)??"private";if(!G||G==="")throw new Error(`${g}The "${Fe(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"Access")}" (\`${He(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"access")}\`) input is missing.`);if(typeof G!="string"||!["public","private"].includes(G))throw new Error(`${g}The "${Fe(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"Access")}" (\`${He(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"access")}\`) input value is invalid, if present, it must be exactly the "public" or "private" text values.`);return await Ht.post(`${y.env.API_BASE_URL}/cloud-files-service/v1/files/access`,{bucket:A,key:N,access:G},{headers:{Authorization:`Bearer ${await y.getAccessToken()}`}}),{value:U.Success,error:null,result:null}}catch(y){return{value:U.UnhandledError,error:y,result:null}}}})}}class Kct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:Me.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_CREATE_FOLDER,version:"1.0.0",description:"Cloud File System: Create Folder",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Logic]});C(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic);if(!n)return;const s=n.get(je.CreateFolder);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{var s,c,e;try{const f=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!f||!f.env)throw new Error("Editor context or environment missing");const y=He(i,i.project,"createFolder"),T="["+Fe(i,i.project,"Create folder")+": `"+y+"`] ",g=n.find(G=>{var K,q;return((q=(K=G.valueOwner)==null?void 0:K.declaration)==null?void 0:q.id)===L.operation[je.CreateFolder].inputs.bucket.id}),E=(s=g==null?void 0:g.value)==null?void 0:s.valueAsType;if(!E||!E.id||!E.name||E.type!==a.DefinitionEntity)throw new Error(`${T}Invalid input "${Fe(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"Storage")}" (\`${He(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const I=Bs(E==null?void 0:E.id,((c=f.branchHead)==null?void 0:c.identifier)||"main");if(!((f==null?void 0:f.liveResources)||[]).find(G=>G.resourceId===I))throw new Error(`${T}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const D=n.find(G=>{var K,q;return((q=(K=G.valueOwner)==null?void 0:K.declaration)==null?void 0:q.id)===L.operation[je.CreateFolder].inputs.folderPath.id}),V=(e=D==null?void 0:D.value)==null?void 0:e.value;if(!V||V==="")throw new Error(`${T}The "${Fe(D==null?void 0:D.valueOwner,f==null?void 0:f.logic,"Folder path")}" (\`${He(D==null?void 0:D.valueOwner,f==null?void 0:f.logic,"folderPath")}\`) input is missing.`);if(typeof V!="string")throw new Error(`${T}The "${Fe(D==null?void 0:D.valueOwner,f==null?void 0:f.logic,"Folder path")}" (\`${He(D==null?void 0:D.valueOwner,f==null?void 0:f.logic,"folderPath")}\`) input value is invalid, if present, it must be a non-empty string.`);const x=(await Ht.post(`${f.env.API_BASE_URL}/cloud-files-service/v1/files/folders`,{bucket:I,folderPath:V},{headers:{Authorization:`Bearer ${await f.getAccessToken()}`}})).data;return{value:U.Success,error:null,result:null}}catch(f){return{value:U.UnhandledError,error:f,result:null}}}})}}class qct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:Me.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_DELETE_FOLDERS,version:"1.0.0",description:"Cloud File System: Delete Folders",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Logic]});C(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic);if(!n)return;const s=n.get(je.DeleteFolders);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{var s,c,e;try{const f=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!f||!f.env)throw new Error("Editor context or environment missing");const y=He(i,i.project,"deleteFolders"),T="["+Fe(i,i.project,"Delete folders")+": `"+y+"`] ",g=n.find(K=>{var q,H;return((H=(q=K.valueOwner)==null?void 0:q.declaration)==null?void 0:H.id)===L.operation[je.DeleteFolders].inputs.bucket.id}),E=(s=g==null?void 0:g.value)==null?void 0:s.valueAsType;if(!E||!E.id||!E.name||E.type!==a.DefinitionEntity)throw new Error(`${T}Invalid input "${Fe(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"Storage")}" (\`${He(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const I=Bs(E==null?void 0:E.id,((c=f.branchHead)==null?void 0:c.identifier)||"main");if(!((f==null?void 0:f.liveResources)||[]).find(K=>K.resourceId===I))throw new Error(`${T}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const D=n.find(K=>{var q,H;return((H=(q=K.valueOwner)==null?void 0:q.declaration)==null?void 0:H.id)===L.operation[je.DeleteFolders].inputs.folderPaths.id}),V=(e=D==null?void 0:D.value)==null?void 0:e.value,N=Array.isArray(V)?V:typeof V=="string"&&V!==""?[V]:[];if(!N||N.length===0)throw new Error(`${T}The "${Fe(D==null?void 0:D.valueOwner,f==null?void 0:f.logic,"Folder paths")}" (\`${He(D==null?void 0:D.valueOwner,f==null?void 0:f.logic,"folderPaths")}\`) input is missing.`);if(!Array.isArray(N)||N.some(K=>typeof K!="string"||K===""))throw new Error(`${T}The "${Fe(D==null?void 0:D.valueOwner,f==null?void 0:f.logic,"Folder paths")}" (\`${He(D==null?void 0:D.valueOwner,f==null?void 0:f.logic,"folderPaths")}\`) input value is invalid, if present, it must be a list of non-empty strings.`);const G=(await Ht.delete(`${f.env.API_BASE_URL}/cloud-files-service/v1/files/folders`,{headers:{Authorization:`Bearer ${await f.getAccessToken()}`},data:{bucket:I,folderPaths:N}})).data;return{value:U.Success,error:null,result:null}}catch(f){return{value:U.UnhandledError,error:f,result:null}}}})}}class Zct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:Me.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_CREATE_MULTIPART_UPLOAD,version:"1.0.0",description:"Cloud File System: Create Multipart Upload",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Logic]});C(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic);if(!n)return;const s=n.get(je.CreateMultipartUpload);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{var s,c,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=He(i,i.project,"createMultipartUpload"),E="["+Fe(i,i.project,"Create multipart upload")+": `"+T+"`] ",I=n.find(q=>{var H,W;return((W=(H=q.valueOwner)==null?void 0:H.declaration)==null?void 0:W.id)===L.operation[je.CreateMultipartUpload].inputs.bucket.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==a.DefinitionEntity)throw new Error(`${E}Invalid input "${Fe(I==null?void 0:I.valueOwner,m==null?void 0:m.logic,"Storage")}" (\`${He(I==null?void 0:I.valueOwner,m==null?void 0:m.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const D=Bs(A==null?void 0:A.id,((c=m.branchHead)==null?void 0:c.identifier)||"main"),V=n.find(q=>{var H,W;return((W=(H=q.valueOwner)==null?void 0:H.declaration)==null?void 0:W.id)===L.operation[je.CreateMultipartUpload].inputs.key.id}),N=(e=V==null?void 0:V.value)==null?void 0:e.value;if(!N||N==="")throw new Error(`${E}The "${Fe(V==null?void 0:V.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${He(V==null?void 0:V.valueOwner,m==null?void 0:m.logic,"key")}\`) input is missing.`);if(typeof N!="string")throw new Error(`${E}The "${Fe(V==null?void 0:V.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${He(V==null?void 0:V.valueOwner,m==null?void 0:m.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const x=n.find(q=>{var H,W;return((W=(H=q.valueOwner)==null?void 0:H.declaration)==null?void 0:W.id)===L.operation[je.CreateMultipartUpload].inputs.contentType.id}),G=((f=x==null?void 0:x.value)==null?void 0:f.value)||"application/octet-stream";if(!G||G==="")throw new Error(`${E}The "${Fe(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"Content Type")}" (\`${He(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"contentType")}\`) input is missing.`);if(typeof G!="string")throw new Error(`${E}The "${Fe(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"Content Type")}" (\`${He(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"contentType")}\`) input value is invalid, if present, it must be a non-empty string.`);const K=await Ht.post(`${m.env.API_BASE_URL}/cloud-files-service/v1/files/multipart?bucket=${D}&key=${encodeURIComponent(N)}&contentType=${encodeURIComponent(G)}`,{},{headers:{Authorization:`Bearer ${await m.getAccessToken()}`}});return{value:U.Success,error:null,result:{uploadId:typeof K.data=="object"&&((y=K.data)!=null&&y.uploadId)?K.data.uploadId:K.data}}}catch(m){return{value:U.UnhandledError,error:m,result:null}}}})}}class Hct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:Me.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_GET_UPLOAD_PART_PRESIGNED_URL,version:"1.0.0",description:"Cloud File System: Get Upload Part Pre-signed URL",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Logic]});C(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic);if(!n)return;const s=n.get(je.GetUploadPartPresignedUrl);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{var s,c,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=He(i,i.project,"getUploadPartPresignedUrl"),E="["+Fe(i,i.project,"Get upload part pre-signed URL")+": `"+T+"`] ",I=n.find(W=>{var ee,re;return((re=(ee=W.valueOwner)==null?void 0:ee.declaration)==null?void 0:re.id)===L.operation[je.GetUploadPartPresignedUrl].inputs.bucket.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==a.DefinitionEntity)throw new Error(`${E}${E}Invalid input "${Fe(I==null?void 0:I.valueOwner,m==null?void 0:m.logic,"Storage")}" (\`${He(I==null?void 0:I.valueOwner,m==null?void 0:m.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const D=Bs(A==null?void 0:A.id,((c=m.branchHead)==null?void 0:c.identifier)||"main"),V=n.find(W=>{var ee,re;return((re=(ee=W.valueOwner)==null?void 0:ee.declaration)==null?void 0:re.id)===L.operation[je.GetUploadPartPresignedUrl].inputs.key.id}),N=(e=V==null?void 0:V.value)==null?void 0:e.value;if(!N||N==="")throw new Error(`${E}The "${Fe(V==null?void 0:V.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${He(V==null?void 0:V.valueOwner,m==null?void 0:m.logic,"key")}\`) input is missing.`);if(typeof N!="string")throw new Error(`${E}The "${Fe(V==null?void 0:V.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${He(V==null?void 0:V.valueOwner,m==null?void 0:m.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const x=n.find(W=>{var ee,re;return((re=(ee=W.valueOwner)==null?void 0:ee.declaration)==null?void 0:re.id)===L.operation[je.GetUploadPartPresignedUrl].inputs.uploadId.id}),G=(f=x==null?void 0:x.value)==null?void 0:f.value;if(!G||G==="")throw new Error(`${E}The "${Fe(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"Upload ID")}" (\`${He(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"uploadId")}\`) input is missing.`);if(typeof G!="string")throw new Error(`${E}The "${Fe(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"Upload ID")}" (\`${He(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"uploadId")}\`) input value is invalid, if present, it must be a non-empty string.`);const K=n.find(W=>{var ee,re;return((re=(ee=W.valueOwner)==null?void 0:ee.declaration)==null?void 0:re.id)===L.operation[je.GetUploadPartPresignedUrl].inputs.partNumber.id}),q=Number((y=K==null?void 0:K.value)==null?void 0:y.value);if(isNaN(q)||q<=0)throw new Error(`${E}The "${Fe(K==null?void 0:K.valueOwner,m==null?void 0:m.logic,"Part number")}" (\`${He(K==null?void 0:K.valueOwner,m==null?void 0:m.logic,"partNumber")}\`) input is missing or invalid.`);const H=await Ht.get(`${m.env.API_BASE_URL}/cloud-files-service/v1/files/multipart/${G}?bucket=${D}&key=${encodeURIComponent(N)}&partNumber=${q}`,{headers:{Authorization:`Bearer ${await m.getAccessToken()}`}});return{value:U.Success,error:null,result:H.data}}catch(m){return{value:U.UnhandledError,error:m,result:null}}}})}}class Wct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:Me.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_COMPLETE_MULTIPART_UPLOAD,version:"1.0.0",description:"Cloud File System: Complete Multipart Upload",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Logic]});C(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic);if(!n)return;const s=n.get(je.CompleteMultipartUpload);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{var s,c,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=He(i,i.project,"completeMultipartUpload"),E="["+Fe(i,i.project,"Complete multipart upload")+": `"+T+"`] ",I=n.find(ee=>{var re,Y;return((Y=(re=ee.valueOwner)==null?void 0:re.declaration)==null?void 0:Y.id)===L.operation[je.CompleteMultipartUpload].inputs.bucket.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==a.DefinitionEntity)throw new Error(`${E}Invalid input "${Fe(I==null?void 0:I.valueOwner,m==null?void 0:m.logic,"Storage")}" (\`${He(I==null?void 0:I.valueOwner,m==null?void 0:m.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const D=Bs(A==null?void 0:A.id,((c=m.branchHead)==null?void 0:c.identifier)||"main"),V=n.find(ee=>{var re,Y;return((Y=(re=ee.valueOwner)==null?void 0:re.declaration)==null?void 0:Y.id)===L.operation[je.CompleteMultipartUpload].inputs.key.id}),N=(e=V==null?void 0:V.value)==null?void 0:e.value;if(!N||N==="")throw new Error(`${E}The "${Fe(V==null?void 0:V.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${He(V==null?void 0:V.valueOwner,m==null?void 0:m.logic,"key")}\`) input is missing.`);if(typeof N!="string")throw new Error(`${E}The "${Fe(V==null?void 0:V.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${He(V==null?void 0:V.valueOwner,m==null?void 0:m.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const x=n.find(ee=>{var re,Y;return((Y=(re=ee.valueOwner)==null?void 0:re.declaration)==null?void 0:Y.id)===L.operation[je.CompleteMultipartUpload].inputs.uploadId.id}),G=(f=x==null?void 0:x.value)==null?void 0:f.value;if(!G||G==="")throw new Error(`${E}The "${Fe(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"Upload ID")}" (\`${He(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"uploadId")}\`) input is missing.`);if(typeof G!="string")throw new Error(`${E}The "${Fe(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"Upload ID")}" (\`${He(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"uploadId")}\`) input value is invalid, if present, it must be a non-empty string.`);const K=n.find(ee=>{var re,Y;return((Y=(re=ee.valueOwner)==null?void 0:re.declaration)==null?void 0:Y.id)===L.operation[je.CompleteMultipartUpload].inputs.parts.id}),q=(y=K==null?void 0:K.value)==null?void 0:y.value;if(!Array.isArray(q)||q.length===0)throw new Error(`${E}The "${Fe(K==null?void 0:K.valueOwner,m==null?void 0:m.logic,"Parts")}" (\`${He(K==null?void 0:K.valueOwner,m==null?void 0:m.logic,"parts")}\`) input is missing or empty.`);if(q.some(ee=>{let re=!1,Y=!1;return(ee.partNumber&&Number(ee.partNumber)>0||ee.PartNumber&&Number(ee.PartNumber)>0)&&(re=!0),(ee.etag&&typeof ee.etag=="string"||ee.ETag&&typeof ee.ETag=="string")&&(Y=!0),!re||!Y}))throw new Error(`${E}The "${Fe(K==null?void 0:K.valueOwner,m==null?void 0:m.logic,"Parts")}" (\`${He(K==null?void 0:K.valueOwner,m==null?void 0:m.logic,"parts")}\`) input value is invalid, if present, it must be an array of objects with "partNumber" and "etag" properties.`);const W=(await Ht.post(`${m.env.API_BASE_URL}/cloud-files-service/v1/files/multipart/${G}/complete?bucket=${D}&key=${encodeURIComponent(N)}`,{parts:q},{headers:{Authorization:`Bearer ${await m.getAccessToken()}`}})).data||{};return{value:U.Success,error:null,result:{location:W.location||W.Location||N,key:W.key||W.Key||N,etag:W.etag||W.ETag||null}}}catch(m){return{value:U.UnhandledError,error:m,result:null}}}})}}class zct extends _e{constructor(){super(...arguments);C(this,"manifest",{id:Me.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_ABORT_MULTIPART_UPLOAD,version:"1.0.0",description:"Cloud File System: Abort Multipart Upload",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Logic]});C(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic);if(!n)return;const s=n.get(je.AbortMultipartUpload);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{var s,c,e,f;try{const y=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!y||!y.env)throw new Error("Editor context or environment missing");const m=He(i,i.project,"abortMultipartUpload"),g="["+Fe(i,i.project,"Abort multipart upload")+": `"+m+"`] ",E=n.find(q=>{var H,W;return((W=(H=q.valueOwner)==null?void 0:H.declaration)==null?void 0:W.id)===L.operation[je.AbortMultipartUpload].inputs.bucket.id}),I=(s=E==null?void 0:E.value)==null?void 0:s.valueAsType;if(!I||!I.id||!I.name||I.type!==a.DefinitionEntity)throw new Error(`${g}Invalid input "${Fe(E==null?void 0:E.valueOwner,y==null?void 0:y.logic,"Storage")}" (\`${He(E==null?void 0:E.valueOwner,y==null?void 0:y.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const A=Bs(I==null?void 0:I.id,((c=y.branchHead)==null?void 0:c.identifier)||"main"),D=n.find(q=>{var H,W;return((W=(H=q.valueOwner)==null?void 0:H.declaration)==null?void 0:W.id)===L.operation[je.AbortMultipartUpload].inputs.key.id}),V=(e=D==null?void 0:D.value)==null?void 0:e.value;if(!V||V==="")throw new Error(`${g}The "${Fe(D==null?void 0:D.valueOwner,y==null?void 0:y.logic,"Key")}" (\`${He(D==null?void 0:D.valueOwner,y==null?void 0:y.logic,"key")}\`) input is missing.`);if(typeof V!="string")throw new Error(`${g}The "${Fe(D==null?void 0:D.valueOwner,y==null?void 0:y.logic,"Key")}" (\`${He(D==null?void 0:D.valueOwner,y==null?void 0:y.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const N=n.find(q=>{var H,W;return((W=(H=q.valueOwner)==null?void 0:H.declaration)==null?void 0:W.id)===L.operation[je.AbortMultipartUpload].inputs.uploadId.id}),x=(f=N==null?void 0:N.value)==null?void 0:f.value;if(!x||x==="")throw new Error(`${g}The "${Fe(N==null?void 0:N.valueOwner,y==null?void 0:y.logic,"Upload ID")}" (\`${He(N==null?void 0:N.valueOwner,y==null?void 0:y.logic,"uploadId")}\`) input is missing.`);if(typeof x!="string")throw new Error(`${g}The "${Fe(N==null?void 0:N.valueOwner,y==null?void 0:y.logic,"Upload ID")}" (\`${He(N==null?void 0:N.valueOwner,y==null?void 0:y.logic,"uploadId")}\`) input value is invalid, if present, it must be a non-empty string.`);const K=(await Ht.delete(`${y.env.API_BASE_URL}/cloud-files-service/v1/files/multipart/${x}?bucket=${A}&key=${encodeURIComponent(V)}`,{headers:{Authorization:`Bearer ${await y.getAccessToken()}`}})).data;return{value:U.Success,error:null,result:null}}catch(y){return{value:U.UnhandledError,error:y,result:null}}}})}}class Lrn extends _e{constructor(){super(...arguments);C(this,"manifest",{id:Me.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_UPLOAD_FILE_PART,version:"1.0.0",description:"Cloud File System: Upload File Part",initPriority:Pe.High,permissions:[xe.All],contexts:[X.Logic]});C(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic);if(!n)return;const s=n.get(je.UploadFilePart);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{var s,c,e,f,y,m,T,g,E;try{const I=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!I||!I.env)throw new Error("Editor context or environment missing");const A=He(i,i.project,"uploadFilePart"),V="["+Fe(i,i.project,"Upload file part")+": `"+A+"`] ",N=n.find(ve=>{var Ce,Oe;return((Oe=(Ce=ve.valueOwner)==null?void 0:Ce.declaration)==null?void 0:Oe.id)===L.operation[je.UploadFilePart].inputs.bucket.id}),x=(s=N==null?void 0:N.value)==null?void 0:s.valueAsType;if(!x||!x.id||!x.name||x.type!==a.DefinitionEntity)throw new Error(`${V}Invalid input "${Fe(N==null?void 0:N.valueOwner,I==null?void 0:I.logic,"Storage")}" (\`${He(N==null?void 0:N.valueOwner,I==null?void 0:I.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const G=Bs(x==null?void 0:x.id,((c=I.branchHead)==null?void 0:c.identifier)||"main");if(!((I==null?void 0:I.liveResources)||[]).find(ve=>ve.resourceId===G))throw new Error(`${V}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const q=n.find(ve=>{var Ce,Oe;return((Oe=(Ce=ve.valueOwner)==null?void 0:Ce.declaration)==null?void 0:Oe.id)===L.operation[je.UploadFilePart].inputs.key.id}),H=(e=q==null?void 0:q.value)==null?void 0:e.value;if(!H||H==="")throw new Error(`${V}The "${Fe(q==null?void 0:q.valueOwner,I==null?void 0:I.logic,"Key")}" (\`${He(q==null?void 0:q.valueOwner,I==null?void 0:I.logic,"key")}\`) input is missing.`);if(typeof H!="string")throw new Error(`${V}The "${Fe(q==null?void 0:q.valueOwner,I==null?void 0:I.logic,"Key")}" (\`${He(q==null?void 0:q.valueOwner,I==null?void 0:I.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const W=n.find(ve=>{var Ce,Oe;return((Oe=(Ce=ve.valueOwner)==null?void 0:Ce.declaration)==null?void 0:Oe.id)===L.operation[je.UploadFilePart].inputs.uploadId.id}),ee=(f=W==null?void 0:W.value)==null?void 0:f.value;if(!ee||ee==="")throw new Error(`${V}The "${Fe(W==null?void 0:W.valueOwner,I==null?void 0:I.logic,"Upload ID")}" (\`${He(W==null?void 0:W.valueOwner,I==null?void 0:I.logic,"uploadId")}\`) input is missing.`);if(typeof ee!="string")throw new Error(`${V}The "${Fe(W==null?void 0:W.valueOwner,I==null?void 0:I.logic,"Upload ID")}" (\`${He(W==null?void 0:W.valueOwner,I==null?void 0:I.logic,"uploadId")}\`) input value is invalid, if present, it must be a non-empty string.`);const re=n.find(ve=>{var Ce,Oe;return((Oe=(Ce=ve.valueOwner)==null?void 0:Ce.declaration)==null?void 0:Oe.id)===L.operation[je.UploadFilePart].inputs.partNumber.id}),Y=Number((y=re==null?void 0:re.value)==null?void 0:y.value);if(((m=re==null?void 0:re.value)==null?void 0:m.value)===void 0||((T=re==null?void 0:re.value)==null?void 0:T.value)===null||isNaN(Y)||Y<=0)throw new Error(`${V}The "${Fe(re==null?void 0:re.valueOwner,I==null?void 0:I.logic,"Part number")}" (\`${He(re==null?void 0:re.valueOwner,I==null?void 0:I.logic,"partNumber")}\`) input is missing or invalid.`);const Z=n.find(ve=>{var Ce,Oe;return((Oe=(Ce=ve.valueOwner)==null?void 0:Ce.declaration)==null?void 0:Oe.id)===L.operation[je.UploadFilePart].inputs.bytes.id}),J=(g=Z==null?void 0:Z.value)==null?void 0:g.value;if(J==null)throw new Error(`${V}The "${Fe(Z==null?void 0:Z.valueOwner,I==null?void 0:I.logic,"Bytes")}" (\`${He(Z==null?void 0:Z.valueOwner,I==null?void 0:I.logic,"bytes")}\`) input is missing.`);const z=(E=(await Ht.get(`${I.env.API_BASE_URL}/cloud-files-service/v1/files/multipart/${ee}?bucket=${G}&key=${encodeURIComponent(H)}&partNumber=${Y}`,{headers:{Authorization:`Bearer ${await I.getAccessToken()}`}})).data)==null?void 0:E.uploadUrl;if(!z)throw new Error(`${V}Failed to obtain presigned upload URL for part ${Y}.`);const ie=await Ht.put(z,J,{headers:{"Content-Type":"application/octet-stream"}}),pe=ie.headers.etag||ie.headers.ETag||"",me=typeof pe=="string"?pe.replace(/"/g,""):"";return{value:U.Success,error:null,result:{partNumber:Y,etag:me}}}catch(I){return{value:U.UnhandledError,error:I,result:null}}}})}}class l$ extends VO{constructor(u,i,n=i.projectId){super(u,X.Editor),this._editor=i,this.id=n}get ready(){return this._editor.ready}get env(){return this._editor.env}get hasLoadedLogic(){return this._editor.hasLoadedLogic}get destroyed(){return this._editor.destroyed}get logicLoadingPromise(){return this._editor.logicLoadingPromise}get logic(){return this._editor.logic}get lastPublishedProjectState(){return this._editor.lastPublishedProjectState}get branchHead(){return this._editor.branchHead}get branchHeadPromise(){return this._editor.branchHeadPromise}get projectId(){return this._editor.projectId}get sessionId(){return this._editor.sessionId}get userAuthorId(){return this._editor.userAuthorId}get peerConnections(){return this._editor.peerConnections}get test(){return this._editor.test}get localTestValues(){return this._editor.localTestValues}get resolvedValues(){return this._editor.resolvedValues}get persistedExecutionResults(){return this._editor.persistedExecutionResults}get publication(){return this._editor.publication}get livePublishedVersions(){return this._editor.livePublishedVersions}get publications(){return this._editor.publications}get liveResources(){return this._editor.liveResources}get execution(){return this._editor.execution}get project(){return this._editor.logic}get lastExecutionResults(){return this._editor.lastExecutionResults}get undoableStackValueIndex(){return this._editor.undoableStackValueIndex}set undoableStackValueIndex(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,n){return this._editor.resolveInitialChildrenPositions(u,i,n)}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,n){return this._editor.moveBranchHeadToVersion(u,i,n)}loadInitialBranchHead(){return this._editor.loadInitialBranchHead()}}function Grn(r,u){return u instanceof l$?u:new l$(r,u)}class o$ extends VO{constructor(u,i){super(u,X.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 Brn(r,u){return u instanceof o$?u:new o$(r,u)}function Mrn(r){r.register(new Ert(r)),r.register(new brt(r)),r.register(new mrt(r)),r.register(new vrt(r)),r.register(new grt(r)),r.register(new Trt(r)),r.register(new tdt(r)),r.register(new idt(r)),r.register(new ndt(r)),r.register(new adt(r)),r.register(new rdt(r)),r.register(new sdt(r)),r.register(new Zut(r)),r.register(new Hut(r)),r.register(new Wut(r)),r.register(new zut(r)),r.register(new Yut(r)),r.register(new Jut(r)),r.register(new Qut(r)),r.register(new Xut(r)),r.register(new ept(r)),r.register(new tpt(r)),r.register(new eot(r)),r.register(new tot(r)),r.register(new iot(r)),r.register(new not(r)),r.register(new rot(r)),r.register(new aot(r)),r.register(new sot(r)),r.register(new lot(r)),r.register(new oot(r)),r.register(new dot(r)),r.register(new uot(r)),r.register(new pot(r)),r.register(new cot(r)),r.register(new fot(r)),r.register(new yot(r)),r.register(new hot(r)),r.register(new mot(r)),r.register(new Tot(r)),r.register(new vot(r)),r.register(new Eot(r)),r.register(new Aot(r)),r.register(new Iot(r)),r.register(new blt(r)),r.register(new Elt(r)),r.register(new Alt(r)),r.register(new Ilt(r)),r.register(new Rlt(r)),r.register(new Dlt(r)),r.register(new Clt(r)),r.register(new wlt(r)),r.register(new Olt(r)),r.register(new xlt(r)),r.register(new _lt(r)),r.register(new Vlt(r)),r.register(new Nlt(r)),r.register(new $lt(r)),r.register(new Sst(r)),r.register(new uut(r)),r.register(new out(r)),r.register(new dut(r)),r.register(new Mat(r)),r.register(new Sat(r)),r.register(new Fat(r)),r.register(new kat(r)),r.register(new Uat(r)),r.register(new jat(r)),r.register(new Kat(r)),r.register(new qat(r)),r.register(new Zat(r)),r.register(new ast(r)),r.register(new Gst(r)),r.register(new Bst(r)),r.register(new Mst(r)),r.register(new Hat(r)),r.register(new Wat(r)),r.register(new zat(r)),r.register(new Yat(r)),r.register(new Jat(r)),r.register(new Qat(r)),r.register(new Xat(r)),r.register(new est(r)),r.register(new tst(r)),r.register(new ist(r)),r.register(new nst(r)),r.register(new rst(r)),r.register(new sst(r)),r.register(new lst(r)),r.register(new ost(r)),r.register(new dst(r)),r.register(new ust(r)),r.register(new pst(r)),r.register(new cst(r)),r.register(new fst(r)),r.register(new yst(r)),r.register(new hst(r)),r.register(new mst(r)),r.register(new Tst(r)),r.register(new Cst(r)),r.register(new wst(r)),r.register(new Ost(r)),r.register(new vst(r)),r.register(new gst(r)),r.register(new bst(r)),r.register(new Est(r)),r.register(new Ast(r)),r.register(new Ist(r)),r.register(new Rst(r)),r.register(new Dst(r)),r.register(new yut(r)),r.register(new hut(r)),r.register(new mut(r)),r.register(new Tut(r)),r.register(new put(r)),r.register(new cut(r)),r.register(new fut(r)),r.register(new vut(r)),r.register(new but(r)),r.register(new Aut(r)),r.register(new gut(r)),r.register(new Eut(r)),r.register(new Iut(r)),r.register(new Cut(r)),r.register(new Rut(r)),r.register(new Dut(r)),r.register(new Llt(r)),r.register(new Slt(r)),r.register(new Flt(r)),r.register(new jlt(r)),r.register(new Klt(r)),r.register(new qlt(r)),r.register(new Zlt(r)),r.register(new Hlt(r)),r.register(new Wlt(r)),r.register(new zlt(r)),r.register(new Ylt(r)),r.register(new klt(r)),r.register(new Ult(r)),r.register(new Nct(r)),r.register(new $ct(r)),r.register(new Lct(r)),r.register(new Gct(r)),r.register(new Bct(r)),r.register(new Mct(r)),r.register(new Sct(r)),r.register(new Fct(r)),r.register(new kct(r)),r.register(new Uct(r)),r.register(new jct(r)),r.register(new Kct(r)),r.register(new qct(r)),r.register(new Zct(r)),r.register(new Hct(r)),r.register(new Wct(r)),r.register(new zct(r)),r.register(new Blt(r)),r.register(new Mlt(r)),r.register(new Glt(r)),r.register(new Plt(r)),r.register(new Qlt(r)),r.register(new Xlt(r)),r.register(new Jlt(r)),r.register(new odt(r)),r.register(new Vdt(r)),r.register(new _dt(r)),r.register(new Ndt(r)),r.register(new $dt(r)),r.register(new pdt(r)),r.register(new cdt(r)),r.register(new vdt(r)),r.register(new mdt(r)),r.register(new Pdt(r)),r.register(new Idt(r)),r.register(new Ddt(r)),r.register(new wdt(r)),r.register(new Cdt(r)),r.register(new Tdt(r)),r.register(new bdt(r)),r.register(new Edt(r)),r.register(new gdt(r)),r.register(new ldt(r)),r.register(new fdt(r)),r.register(new Rdt(r)),r.register(new Bdt(r)),r.register(new QN(r)),r.register(new udt(r)),r.register(new ydt(r)),r.register(new ddt(r)),r.register(new Odt(r)),r.register(new hdt(r)),r.register(new Adt(r)),r.register(new xdt(r)),r.register(new Gdt(r)),r.register(new Ldt(r)),r.register(new Mdt(r)),r.register(new QN(r)),r.register(new Fdt(r)),r.register(new Sdt(r)),r.register(new kdt(r)),r.register(new Mot(r)),r.register(new Sot(r)),r.register(new Fot(r)),r.register(new Dot(r)),r.register(new bot(r)),r.register(new Pot(r)),r.register(new Not(r)),r.register(new got(r)),r.register(new $ot(r)),r.register(new Bot(r)),r.register(new _ot(r)),r.register(new xot(r)),r.register(new wD(r)),r.register(new kot(r)),r.register(new Uot(r)),r.register(new Vot(r)),r.register(new Got(r)),r.register(new Lot(r)),r.register(new Oot(r)),r.register(new wot(r)),r.register(new Cot(r)),r.register(new Rot(r)),r.register(new qot(r)),r.register(new Kot(r)),r.register(new Zot(r)),r.register(new jot(r)),r.register(new Vst(r)),r.register(new Pst(r)),r.register(new _st(r)),r.register(new Nst(r)),r.register(new $st(r)),r.register(new xst(r)),r.register(new Lst(r)),r.register(new rpt(r)),r.register(new upt(r)),r.register(new cpt(r)),r.register(new ypt(r)),r.register(new hpt(r)),r.register(new mpt(r)),r.register(new Tpt(r)),r.register(new dpt(r)),r.register(new ppt(r)),r.register(new fpt(r)),r.register(new opt(r)),r.register(new lpt(r)),r.register(new spt(r)),r.register(new apt(r)),r.register(new ipt(r)),r.register(new npt(r)),r.register(new Apt(r)),r.register(new Ipt(r)),r.register(new bpt(r)),r.register(new Ept(r)),r.register(new qut(r)),r.register(new vpt(r)),r.register(new gpt(r)),r.register(new Dpt(r)),r.register(new Rpt(r)),r.register(new Cpt(r)),r.register(new wpt(r)),r.register(new Opt(r)),r.register(new Art(r)),r.register(new Irt(r)),r.register(new DD(r)),r.register(new CD(r)),r.register(new Npt(r)),r.register(new $pt(r)),r.register(new Bpt(r)),r.register(new Kpt(r)),r.register(new Spt(r)),r.register(new Lpt(r)),r.register(new Gpt(r)),r.register(new Fpt(r)),r.register(new Mpt(r)),r.register(new kpt(r)),r.register(new Upt(r)),r.register(new jpt(r)),r.register(new qpt(r)),r.register(new Zpt(r)),r.register(new Hpt(r)),r.register(new Wpt(r)),r.register(new zpt(r)),r.register(new Ypt(r)),r.register(new Jpt(r)),r.register(new Qpt(r)),r.register(new Xpt(r)),r.register(new ect(r)),r.register(new fct(r)),r.register(new tct(r)),r.register(new ict(r)),r.register(new nct(r)),r.register(new rct(r)),r.register(new act(r)),r.register(new sct(r)),r.register(new lct(r)),r.register(new oct(r)),r.register(new uct(r)),r.register(new pct(r)),r.register(new cct(r)),r.register(new yct(r)),r.register(new Vct(r)),r.register(new mct(r)),r.register(new Dct(r)),r.register(new Ect(r)),r.register(new Act(r)),r.register(new bct(r)),r.register(new Oct(r)),r.register(new hct(r)),r.register(new Tct(r)),r.register(new Pct(r)),r.register(new wct(r)),r.register(new _ct(r)),r.register(new gct(r)),r.register(new vct(r)),r.register(new Ict(r)),r.register(new xct(r)),r.register(new Cct(r)),r.register(new Rct(r)),r.register(new Ppt(r)),r.register(new xpt(r))}class IS{constructor(u=new oe.Events("extensions-registry-fallback-events")){C(this,"extensionsRegistry",new Map);C(this,"initialized",new Set);C(this,"initializedContexts",new Set);C(this,"onResolveEditorContextCallback",()=>null);C(this,"onResolveProjectLogicContextCallback",()=>null);C(this,"onResolveEditorGUIContextCallback",()=>null);C(this,"onResolveGUIContextCallback",()=>null);C(this,"onResolveCompileContextCallback",()=>null);C(this,"onResolvePublicationRunContextCallback",()=>null);this.events=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||Pe.Normal)-(i.manifest.initPriority||Pe.Normal))}async setup(){Mrn(this),oe.Logger.log("Initializing extensions without context..."),this.initForReady()}requestContext(u){switch(u){case X.Editor:return this.onResolveEditorContextCallback();case X.Logic:return this.onResolveProjectLogicContextCallback();case X.EditorGUI:return this.onResolveEditorGUIContextCallback();case X.Compile:return this.onResolveCompileContextCallback();case X.PublicationRun:return this.onResolvePublicationRunContextCallback();case X.GUI:return this.onResolveGUIContextCallback();case X.EditorGUI:return this.onResolveEditorGUIContextCallback();default:throw new Error(`Unknown context type: ${u}`)}}requestContexts(u,i=[]){const n=[];i.length===0&&(i=u.manifest.contexts);for(const s of i){const c=this.requestContext(s);c&&n.push(c)}return n}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 n of this.extensionInOrder)if(n.module.init&&!this.initialized.has(n.manifest.id)){const s=n.manifest.contexts.map(c=>this.requestContext(c)).filter(c=>c!==null);s.length&&(await((i=(u=n.module).init)==null?void 0:i.call(u,s)),this.initialized.add(n.manifest.id))}else!n.module.init&&!this.initialized.has(n.manifest.id)&&this.initialized.add(n.manifest.id)}async initForReady(){oe.Logger.log("Initializing extensions for ready contexts...");for(const u of this.extensionInOrder)if(u.module.init&&!this.initialized.has(u.manifest.id)){oe.Logger.debug("Initializing "+u.manifest.id+" extension...");const i=this.requestContexts(u);u.manifest.contexts.every(s=>!!i.find(c=>c.contextType===s))?(await u.module.init(i),this.initialized.add(u.manifest.id)):oe.Logger.warn(`Skipping initialization of ${u.manifest.id} extension, not all contexts are ready.`,`Required contexts: ${u.manifest.contexts.join(", ")}`,`Available contexts: ${i.map(s=>s.contextType).join(", ")}`)}else!u.module.init&&!this.initialized.has(u.manifest.id)?(oe.Logger.log("Set "+u.manifest.id+" extension as initialized by default..."),this.initialized.add(u.manifest.id)):oe.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)){oe.Logger.warn(`Context ${u} is already initialized. Skipping re-initialization.`);return}switch(this.initializedContexts.add(u),u){case X.Editor:{if(!this.onResolveEditorContextCallback)throw new Error("No editor context resolver callback set. Call onResolveEditorContext first.");break}case X.Logic:{if(!this.onResolveProjectLogicContextCallback)throw new Error("No project logic context resolver callback set. Call onResolveProjectLogicContext first.");break}}oe.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 W1=null;const RS={requestExtension:r=>(W1||(W1=new IS,W1.setup()),W1.requestExtension(r))};function iy(r){return!(r instanceof Error)&&typeof r=="object"&&r!==null?r:r instanceof Error?{name:r.name,message:r.message,stack:r.stack,...r}:r}function r3(r){var u,i,n;if(r&&typeof r=="object"&&"value"in r){const s=r;return{single:((u=s.value)==null?void 0:u.valueAsTypeSingle)??((i=s.value)==null?void 0:i.value),list:((n=s.value)==null?void 0:n.valueAsTypeList)??null}}return{single:r,list:Array.isArray(r)?r:null}}const ny={onBeforeEntityExecution:async()=>{},onEntityExecuted:async()=>{}};class d$ extends Error{constructor(){super("Execution was stopped"),this.name="ExecutionStoppedError"}}var DS=(r=>(r.FinishedSuccess="finished-success",r.FinishedError="finished-error",r.Running="running",r.Paused="paused",r.Stopped="stopped",r.NotStarted="not-started",r))(DS||{});const Yct={...RS,getValueTypePreference:()=>null,setValueTypePreference:()=>{}};class ET extends oe.Events{constructor(i,n,s,c=null,e=Yct){super();C(this,"project");C(this,"entryPoint");C(this,"state","not-started");C(this,"events",new oe.Events("fe-exec-inst-events"));C(this,"entities",[]);C(this,"parentExecution",null);C(this,"executing",[]);C(this,"executed",[]);C(this,"skipped",[]);C(this,"scheduled",[]);C(this,"localTestValues");C(this,"resolvedValues");C(this,"persistedExecutionResults");C(this,"lastExecutionResults");C(this,"onAddToSkippedListCallback",null);C(this,"onRemoveFromSkippedListCallback",null);C(this,"onAddEntityCallback",null);C(this,"onRemoveEntityCallback",null);C(this,"onAbortExecutionCallback",null);this.parentContext=e,this.entities=n,this.entryPoint=s,this.project=i,this.parentExecution=c,this.localTestValues=new fE(M.UUID.uuid(),this.project),this.resolvedValues=new fE(M.UUID.uuid(),this.project),this.persistedExecutionResults=new fE(M.UUID.uuid(),this.project),this.lastExecutionResults=new fE(M.UUID.uuid(),this.project)}get valueResolutionContext(){return{execution:this,project:this.project,localTestValues:this.localTestValues,resolvedValues:this.resolvedValues,persistedExecutionResults:this.persistedExecutionResults,lastExecutionResults:this.lastExecutionResults,getValueTypePreference:this.parentContext.getValueTypePreference,setValueTypePreference:this.parentContext.setValueTypePreference}}get rootExecution(){let 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 d$;for(;this.isPaused();){if(this.isStopped())throw new d$;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),er.includes(i.type)&&Ut(i).forEach(n=>this.skip(n))))}async schedule(i,n,s){if(this.hasExecuted(i))return null;if(xi.includes(i.type))return this.executeBranch(i,s,n);if(tr.includes(i.type)){if(i.calledBy.every(e=>this.hasExecuted(e)||!this.hasEntity(e)))return this.executeBranch(i,s,n);this.scheduled.includes(i)||this.scheduled.push(i)}return null}mergeExernalValuesWithInternalInputs(i,n){const s=[];return wi.includes(n.type)?s.push(...n.inputs.filter(e=>O0(e))):[...fi,...xi].includes(n.type)?s.push(...n.inputs):ci.includes(n.type)&&s.push(...n.outputs.filter(e=>O0(e))),s.map(e=>{var y;let f=i.find(m=>m.valueOwner.id===e.id);if(f)return f;if(!f&&xi.includes(n.type)&&(f=i.find(m=>{var T;return((T=m.valueOwner.declaration)==null?void 0:T.id)===e.id})),f){const m=(y=f.value)==null?void 0:y.clone(null);return m==null||m.setStandaloneParent(e,null),{...f,valueOwner:e,value:m||null,inheritanceLink:{sources:[f],target:e}}}return Za.includes(e.type)?Jd(e,this.valueResolutionContext):qu(e,this.valueResolutionContext)}).reduce((e,f)=>{const y=Qp(f==null?void 0:f.valueOwner,this.project),m=f?[f]:[];return y.forEach(T=>{var I,A,D;if(T.id===(f==null?void 0:f.valueOwner.id))return;const g=rn(T.getDataType(null),T,this.project);g==null||g.metaSync({value:(I=f==null?void 0:f.value)==null?void 0:I.value},null),g==null||g.setValueAsTypeList(((A=f==null?void 0:f.value)==null?void 0:A.valueAsTypeList)||null),g==null||g.setValueAsTypeSingle(((D=f==null?void 0:f.value)==null?void 0:D.valueAsTypeSingle)||null);const E={...f,valueOwner:T,value:g};m.push(E)}),[...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,n,s,c={}){var f,y;this.logBeforeExecution("executeInternalCall",i,n);const e={...ny,...c};try{let m={value:U.Success,error:null,result:null};if(n.sort((D,V)=>D.valueOwner.index-V.valueOwner.index),Object.values(xa).includes(i.declaration.id)){const D=this.parentContext.requestExtension(_i+i.declaration.id).module.main;D?m=await D(i,n,this):oe.Logger.warn(`No implementation found for built-in function: ${i.declaration.id}`)}else{const D=await this.executeDetachedFullFunctionDeclarationLogic(i.declaration,n,s,e);m={value:D.value,error:D.error,result:D.result}}let T=null;if(m.error&&i.error){oe.Logger.warn("Raw error executing entity: ",m.error);const{single:D,list:V}=r3(m.error),N=iy(D),x=(f=i.error)==null?void 0:f.getDataType(null),G=rn(x||null,i.error,s);if(x!=null&&x.asType)V!==null?G==null||G.setValueAsTypeList(V):G==null||G.setValueAsTypeSingle(D);else{const K=pa(N)?JSON.stringify(N,null,2):N;G==null||G.metaSync({value:K},null)}T={valueOwner:i.error,type:We.ExecutionResult,inheritanceLink:null,value:G}}const g=i==null?void 0:i.getDataType(null),E=rn(g,i,s),{single:I,list:A}=r3(m.result);return g!=null&&g.asType?A!==null?E==null||E.setValueAsTypeList(A):E==null||E.setValueAsTypeSingle(I):E==null||E.metaSync({value:I},null),{value:m.value,entity:i,error:T,result:{value:E||null,valueOwner:i,type:We.ExecutionResult,inheritanceLink:null}}}catch(m){if(m&&(m.name==="ExecutionStoppedError"||m.message==="Execution was stopped"))throw m;oe.Logger.warn("Internal call execution error: ",m);let T=null;if(i.error){const g=iy(m),E=(y=i.error)==null?void 0:y.getDataType(null),I=rn(E,i.error,s);if(E!=null&&E.asType)I==null||I.setValueAsTypeSingle(m);else{const A=pa(g)?JSON.stringify(g,null,2):g;I==null||I.metaSync({value:A},null)}T={valueOwner:i.error,type:We.ExecutionResult,inheritanceLink:null,value:I}}return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,entity:i,error:T,result:null}}}static async executeOperation(i,n,s,c){var e,f;c?c.logBeforeExecution("executeOperation",i,n):console.log(`executeOperation (${i.type}) -> [${Ee(i,s)}] Inputs:${n.length?`
|
|
62
62
|
`:""}${n.map(y=>{var m,T,g;return`${(m=y.valueOwner)==null?void 0:m.type} (${(T=y.valueOwner)==null?void 0:T.id}) "${Ee(y.valueOwner,s)}": ${JSON.stringify((g=y.value)==null?void 0:g.value,null,2)}`}).join(`
|
|
63
63
|
`)}
|
|
64
64
|
`);try{let y={value:U.Success,error:null,result:null};n.sort((E,I)=>E.valueOwner.index-I.valueOwner.index),i.declaration.implementation&&(y=await i.declaration.implementation(i,n.sort((E,I)=>E.valueOwner.index-I.valueOwner.index)));let m=null;if(y.error&&i.error){const E=iy(y.error),I=((e=i.error)==null?void 0:e.getDataType(null))||null,A=rn(I,i.error,s);if(I!=null&&I.asType)A==null||A.setValueAsTypeSingle(y.error);else{const D=pa(E)?JSON.stringify(E,null,2):E;A==null||A.metaSync({value:D},null)}m={valueOwner:i.error,type:We.ExecutionResult,inheritanceLink:null,value:A}}const T=i==null?void 0:i.getDataType(null),g=rn(T,i,s);return T!=null&&T.asType?g==null||g.setValueAsTypeSingle(y.result):g==null||g.metaSync({value:y.result},null),{value:y.value,entity:i,error:m,result:{value:g||null,valueOwner:i,type:We.ExecutionResult,inheritanceLink:null}}}catch(y){if(y&&(y.name==="ExecutionStoppedError"||y.message==="Execution was stopped"))throw y;console.warn("Operation execution error: ",y);let m=null;if(i.error){const T=iy(y),g=(f=i.error)==null?void 0:f.getDataType(null),E=rn(g,i.error,s);if(g!=null&&g.asType)E==null||E.setValueAsTypeSingle(y);else{const I=pa(T)?JSON.stringify(T,null,2):T;E==null||E.metaSync({value:I},null)}m={valueOwner:i.error,type:We.ExecutionResult,inheritanceLink:null,value:E}}return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,entity:i,error:m,result:null}}}async executeSearch(i,n,s){var c;this.logBeforeExecution("executeSearch",i,n);try{let e={value:U.Success,error:null,result:null};const f=await(await this.parentContext.requestExtension(Me.SEARCH_NODE_IMPLEMENTATION)).module.main(i,n),y=i==null?void 0:i.getDataType(null),m=rn(y,i,s);return m==null||m.metaSync({value:f},null),f.error?{value:U.UnhandledError,entity:i,error:{valueOwner:i,type:We.ExecutionResult,inheritanceLink:null,value:m},result:null}:{value:e.value,entity:i,error:null,result:{value:m,valueOwner:i,type:We.ExecutionResult,inheritanceLink:null}}}catch(e){if(e&&(e.name==="ExecutionStoppedError"||e.message==="Execution was stopped"))throw e;if(oe.Logger.warn(`Search node execution error: ${e}`),!i.error)return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,entity:i,error:null,result:null};const f=iy(e),y=(c=i.error)==null?void 0:c.getDataType(null),m=rn(y,i.error,s),T=pa(f)?JSON.stringify(f,null,2):f;return m==null||m.metaSync({value:T},null),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,entity:i,error:{valueOwner:i.error,type:We.ExecutionResult,inheritanceLink:null,value:m},result:null}}}async executeLoop(i,n,s,c={}){var f,y,m,T,g,E,I,A,D,V,N,x,G,K,q,H,W;this.logBeforeExecution("executeLoop",i,n);const e={...ny,...c};try{let ee={value:U.Success,error:null,result:null};const re=n.map(pe=>{var me,ve;return((me=pe==null?void 0:pe.value)==null?void 0:me.valueAsType)||((ve=pe==null?void 0:pe.value)==null?void 0:ve.value)});let Y={};const Z=i.body.inputs.find(pe=>pe!==i.currentIterationNumberArgumentDeclaration&&pe!==i.currentValueArgumentDeclaration);if(Z){const pe=Z,me=rn(pe.getDataType(null),pe,s);me==null||me.metaSync({value:((f=pe.defaultValue)==null?void 0:f.value)||null},null),Y[pe.id]={value:me||null,valueOwner:pe,type:We.ExecutionResult,inheritanceLink:null}}let J={value:U.Success,entity:i.body,error:null,result:null};switch(i.declaration.id){case L.loop["counted-loop"].id:{const pe=re[0];let me=1;for(;me<=pe&&me<=1e3;){await this.checkStateAndPause();const ve=i.body.inputs.map(Ce=>{if(Ce===i.currentIterationNumberArgumentDeclaration){const Oe=i.currentIterationNumberArgumentDeclaration.getDataType(null),Ve=Wc(Oe),Ie=this.lastExecutionResults.readValue(Ce.id);if(Ie){Ie.metaSync({value:me},null);const rt=_r(Ie,Ce);this.lastExecutionResults.writeValue(Ce,rt);const lt={value:rt,valueOwner:i.currentIterationNumberArgumentDeclaration,type:We.ExecutionResult,inheritanceLink:null};return Y[Ce.id]=lt,lt}const $e={id:M.UUID.uuid(),deletable:!0,editable:!0,type:a.LiteralValue,autogeneration:null,version:M.UUID.uuid(),createdAt:new Date().toISOString(),author:M.sessionAuthor,deleted:!1,previousVersion:null,value:me,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:Ve,standaloneParent:Ce.toReference()},Ze=wr($e,s);this.lastExecutionResults.writeValue(Ce,Ze);const qe={value:Ze,valueOwner:i.currentIterationNumberArgumentDeclaration,type:We.ExecutionResult,inheritanceLink:null};return Y[Ce.id]=qe,qe}else return Y[Ce.id]}).filter(Ce=>!!Ce);if(J=await this.executeFullFunctionDeclarationLogic(i.body,ve,e),J!=null&&J.result&&J.value!==U.Return){const Ce=i.body.inputs.find(Oe=>Oe!==i.currentIterationNumberArgumentDeclaration&&Oe!==i.currentValueArgumentDeclaration);if(Ce){let Oe=(y=J.result.value)==null?void 0:y.value;Oe===void 0&&(Oe=null),(m=Y[Ce.id].value)==null||m.metaSync({value:Oe},null);const Ve=_r(Y[Ce.id].value,Ce);this.lastExecutionResults.writeValue(Ce,Ve)}}if([U.CaughtError,U.UnhandledError,U.Break,U.Return].includes(J.value))break;me++}break}case L.loop["manual-flow-loop"].id:{let pe=1;for(;pe<=50;){await this.checkStateAndPause();const me=i.body.inputs.map(ve=>{if(ve===i.currentIterationNumberArgumentDeclaration){const Ce=this.lastExecutionResults.readValue(ve.id);if(Ce){Ce.metaSync({value:pe},null);const $e=_r(Ce,ve);this.lastExecutionResults.writeValue(ve,$e);const Ze={value:$e,valueOwner:ve,type:We.ExecutionResult,inheritanceLink:null};return Y[ve.id]=Ze,Ze}const Oe=i.currentIterationNumberArgumentDeclaration.getDataType(null),Ve=rn(Oe,ve,s);return Ve==null||Ve.metaSync({value:pe},null),this.lastExecutionResults.writeValue(ve,Ve),{value:Ve,valueOwner:ve,type:We.ExecutionResult,inheritanceLink:null}}else return Y[ve.id]}).filter(ve=>!!ve);if(J=await this.executeFullFunctionDeclarationLogic(i.body,me,e),J!=null&&J.result&&J.value!==U.Return){const ve=i.body.inputs.find(Ce=>Ce!==i.currentIterationNumberArgumentDeclaration&&Ce!==i.currentValueArgumentDeclaration);if(ve){let Ce=(T=J.result.value)==null?void 0:T.value;Ce===void 0&&(Ce=null),(g=Y[ve.id].value)==null||g.metaSync({value:Ce},null);const Oe=_r(Y[ve.id].value,ve);this.lastExecutionResults.writeValue(ve,Oe)}}if([U.CaughtError,U.UnhandledError,U.Break,U.Return].includes(J.value))break;pe++}break}case L.loop["list-loop"].id:{const pe=re[0];let me=1;const ve=pe;for(let Ce=0;Ce<ve.length;Ce++){await this.checkStateAndPause();const Oe=ve[Ce],Ve=i.body.inputs.map(Ie=>{if(Ie===i.currentIterationNumberArgumentDeclaration){const $e=this.lastExecutionResults.readValue(Ie.id);if($e){$e.metaSync({value:me},null);const lt=_r($e,Ie);return this.lastExecutionResults.writeValue(Ie,lt),{value:lt,valueOwner:Ie,type:We.ExecutionResult,inheritanceLink:null}}const Ze=i.currentIterationNumberArgumentDeclaration.getDataType(null),qe=rn(Ze,Ie,s);return qe==null||qe.metaSync({value:me},null),this.lastExecutionResults.writeValue(Ie,qe),{value:qe,valueOwner:i.currentIterationNumberArgumentDeclaration,type:We.ExecutionResult,inheritanceLink:null}}else if(Ie===i.currentValueArgumentDeclaration){const $e=i.currentValueArgumentDeclaration.getDataType(null),Ze=Wc($e),qe=this.lastExecutionResults.readValue(Ie.id);if(qe){qe.metaSync({value:Oe},null);const Ye=_r(qe,Ie);return this.lastExecutionResults.writeValue(Ie,Ye),{value:Ye,valueOwner:Ie,type:We.ExecutionResult,inheritanceLink:null}}const rt={id:M.UUID.uuid(),deletable:!0,editable:!0,type:a.LiteralValue,autogeneration:null,version:M.UUID.uuid(),createdAt:new Date().toISOString(),author:M.sessionAuthor,deleted:!1,previousVersion:null,value:Oe,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:Ze,standaloneParent:Ie.toReference()},lt=wr(rt,s);return this.lastExecutionResults.writeValue(Ie,lt),{value:lt,valueOwner:i.currentValueArgumentDeclaration,type:We.ExecutionResult,inheritanceLink:null}}else return Y[Ie.id]}).filter(Ie=>!!Ie);if(J=await this.executeFullFunctionDeclarationLogic(i.body,Ve,e),J!=null&&J.result&&J.value!==U.Return){const Ie=i.body.inputs.find($e=>$e!==i.currentIterationNumberArgumentDeclaration&&$e!==i.currentValueArgumentDeclaration);if(Ie){let $e=(E=J.result.value)==null?void 0:E.value;$e===void 0&&($e=null),(I=Y[Ie.id].value)==null||I.metaSync({value:$e},null);const Ze=_r(Y[Ie.id].value,Ie);this.lastExecutionResults.writeValue(Ie,Ze)}}if([U.CaughtError,U.UnhandledError,U.Break,U.Return].includes(J.value))break;me++}break}case L.loop["object-keys-loop"].id:{const pe=re[0];let me=1;const ve=pe?Object.keys(pe):[];for(let Ce=0;Ce<ve.length;Ce++){await this.checkStateAndPause();const Oe=ve[Ce],Ve=i.body.inputs.map(Ie=>{if(Ie===i.currentIterationNumberArgumentDeclaration){const $e=this.lastExecutionResults.readValue(Ie.id);if($e){$e.metaSync({value:me},null);const lt=_r($e,Ie);return this.lastExecutionResults.writeValue(Ie,lt),{value:lt,valueOwner:Ie,type:We.ExecutionResult,inheritanceLink:null}}const Ze=i.currentIterationNumberArgumentDeclaration.getDataType(null),qe=rn(Ze,Ie,s);return qe==null||qe.metaSync({value:me},null),this.lastExecutionResults.writeValue(Ie,qe),{value:qe,valueOwner:i.currentIterationNumberArgumentDeclaration,type:We.ExecutionResult,inheritanceLink:null}}else if(Ie===i.currentValueArgumentDeclaration){const $e=i.currentValueArgumentDeclaration.getDataType(null),Ze=Wc($e),qe=this.lastExecutionResults.readValue(Ie.id);if(qe){qe.metaSync({value:Oe},null);const Ye=_r(qe,Ie);return this.lastExecutionResults.writeValue(Ie,Ye),{value:qe,valueOwner:Ie,type:We.ExecutionResult,inheritanceLink:null}}const rt={id:M.UUID.uuid(),deletable:!0,editable:!0,type:a.LiteralValue,autogeneration:null,version:M.UUID.uuid(),createdAt:new Date().toISOString(),author:M.sessionAuthor,deleted:!1,previousVersion:null,value:Oe,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:Ze,standaloneParent:Ie.toReference()},lt=wr(rt,s);return this.lastExecutionResults.writeValue(Ie,lt),{value:lt,valueOwner:i.currentValueArgumentDeclaration,type:We.ExecutionResult,inheritanceLink:null}}else return Y[Ie.id]}).filter(Ie=>!!Ie);if(J=await this.executeFullFunctionDeclarationLogic(i.body,Ve,e),J!=null&&J.result&&J.value!==U.Return){const Ie=i.body.inputs.find($e=>$e!==i.currentIterationNumberArgumentDeclaration&&$e!==i.currentValueArgumentDeclaration);if(Ie){let $e=(A=J.result.value)==null?void 0:A.value;$e===void 0&&($e=null),(D=Y[Ie.id].value)==null||D.metaSync({value:$e},null);const Ze=_r(Y[Ie.id].value,Ie);this.lastExecutionResults.writeValue(Ie,Ze)}}if([U.CaughtError,U.UnhandledError,U.Break,U.Return].includes(J.value))break;me++}break}case L.loop["object-values-loop"].id:{const pe=re[0];let me=1;const ve=pe?Object.values(pe):[];for(let Ce=0;Ce<ve.length;Ce++){await this.checkStateAndPause();const Oe=ve[Ce],Ve=i.body.inputs.map(Ie=>{if(Ie===i.currentIterationNumberArgumentDeclaration){const $e=this.lastExecutionResults.readValue(Ie.id);if($e){$e.metaSync({value:me},null);const lt=_r($e,Ie);return this.lastExecutionResults.writeValue(Ie,lt),{value:lt,valueOwner:Ie,type:We.ExecutionResult,inheritanceLink:null}}const Ze=i.currentIterationNumberArgumentDeclaration.getDataType(null),qe=rn(Ze,Ie,s);return qe==null||qe.metaSync({value:me},null),this.lastExecutionResults.writeValue(Ie,qe),{value:qe,valueOwner:i.currentIterationNumberArgumentDeclaration,type:We.ExecutionResult,inheritanceLink:null}}else if(Ie===i.currentValueArgumentDeclaration){const $e=i.currentValueArgumentDeclaration.getDataType(null),Ze=Wc($e),qe=this.lastExecutionResults.readValue(Ie.id);if(qe){qe.metaSync({value:Oe},null);const Ye=_r(qe,Ie);return this.lastExecutionResults.writeValue(Ie,Ye),{value:qe,valueOwner:Ie,type:We.ExecutionResult,inheritanceLink:null}}const rt={id:M.UUID.uuid(),deletable:!0,editable:!0,type:a.LiteralValue,autogeneration:null,version:M.UUID.uuid(),createdAt:new Date().toISOString(),author:M.sessionAuthor,deleted:!1,previousVersion:null,value:Oe,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:Ze,standaloneParent:Ie.toReference()},lt=wr(rt,s);return this.lastExecutionResults.writeValue(Ie,lt),{value:lt,valueOwner:i.currentValueArgumentDeclaration,type:We.ExecutionResult,inheritanceLink:null}}else return Y[Ie.id]}).filter(Ie=>!!Ie);if(J=await this.executeFullFunctionDeclarationLogic(i.body,Ve,e),J!=null&&J.result&&J.value!==U.Return){const Ie=i.body.inputs.find($e=>$e!==i.currentIterationNumberArgumentDeclaration&&$e!==i.currentValueArgumentDeclaration);if(Ie){let $e=(V=J.result.value)==null?void 0:V.value;$e===void 0&&($e=null),(N=Y[Ie.id].value)==null||N.metaSync({value:$e},null);const Ze=_r(Y[Ie.id].value,Ie);this.lastExecutionResults.writeValue(Ie,Ze)}}if([U.CaughtError,U.UnhandledError,U.Break,U.Return].includes(J.value))break;me++}break}case L.loop["string-loop"].id:{const pe=re[0];let me=1;const ve=pe.split("");for(let Ce=0;Ce<ve.length;Ce++){await this.checkStateAndPause();const Oe=ve[Ce],Ve=i.body.inputs.map(Ie=>{if(Ie===i.currentIterationNumberArgumentDeclaration){const $e=this.lastExecutionResults.readValue(Ie.id);if($e){$e.metaSync({value:me},null);const lt=_r($e,Ie);return this.lastExecutionResults.writeValue(Ie,lt),{value:lt,valueOwner:Ie,type:We.ExecutionResult,inheritanceLink:null}}const Ze=i.currentIterationNumberArgumentDeclaration.getDataType(null),qe=rn(Ze,Ie,s);return qe==null||qe.metaSync({value:me},null),this.lastExecutionResults.writeValue(Ie,qe),{value:qe,valueOwner:i.currentIterationNumberArgumentDeclaration,type:We.ExecutionResult,inheritanceLink:null}}else if(Ie===i.currentValueArgumentDeclaration){const $e=i.currentValueArgumentDeclaration.getDataType(null),Ze=Wc($e),qe=this.lastExecutionResults.readValue(Ie.id);if(qe){qe.metaSync({value:Oe},null);const Ye=_r(qe,Ie);return this.lastExecutionResults.writeValue(Ie,Ye),{value:Ye,valueOwner:Ie,type:We.ExecutionResult,inheritanceLink:null}}const rt={id:M.UUID.uuid(),deletable:!0,editable:!0,type:a.LiteralValue,autogeneration:null,version:M.UUID.uuid(),createdAt:new Date().toISOString(),author:M.sessionAuthor,deleted:!1,previousVersion:null,value:Oe,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:Ze,standaloneParent:Ie.toReference()},lt=wr(rt,s);return this.lastExecutionResults.writeValue(Ie,lt),{value:lt,valueOwner:i.currentValueArgumentDeclaration,type:We.ExecutionResult,inheritanceLink:null}}else return Y[Ie.id]}).filter(Ie=>!!Ie);if(J=await this.executeFullFunctionDeclarationLogic(i.body,Ve,e),(J.results||[]).forEach(Ie=>{var lt,it,Ye;if(Ie.valueOwner.type!==a.InputMap||ci.includes(Ie.valueOwner.parent.type))return;const $e=i.body.inputs.find(at=>Ee(at,s)===Ee(Ie.valueOwner,s)),qe=[...(lt=Y[$e.id].value)==null?void 0:lt.value,((it=Ie.value)==null?void 0:it.value)||null];(Ye=Y[$e.id].value)==null||Ye.metaSync({value:qe},null);const rt=_r(Y[$e.id].value,$e);this.lastExecutionResults.writeValue($e,rt)}),[U.CaughtError,U.UnhandledError,U.Break,U.Return].includes(J.value))break;me++}break}}let ne=U.Success;if(J.value===U.UnhandledError?i.catchesError||i.errorCalls.length?ne=U.CaughtError:ne=U.UnhandledError:[U.CaughtError,U.Return].includes(J.value)&&(ne=J.value),ee={value:ne,error:((G=(x=J.error)==null?void 0:x.value)==null?void 0:G.value)||null,result:((q=(K=J==null?void 0:J.result)==null?void 0:K.value)==null?void 0:q.value)||null},ee.value===U.UnhandledError||ee.value===U.CaughtError){let pe=null;if(i.error){const me=iy(ee.error),ve=(H=i.error)==null?void 0:H.getDataType(null),Ce=rn(ve||null,i.error,s);if(ve!=null&&ve.asType)Ce==null||Ce.setValueAsTypeSingle(ee.error);else{const Oe=pa(me)?JSON.stringify(me,null,2):me;Ce==null||Ce.metaSync({value:Oe},null)}pe={valueOwner:i.error,type:We.ExecutionResult,inheritanceLink:null,value:Ce}}return{value:ee.value,entity:i,error:pe,result:null}}const z=i==null?void 0:i.getDataType(null),ie=rn(z,i,s);return z!=null&&z.asType?ie==null||ie.setValueAsTypeSingle(ee.result):ie==null||ie.metaSync({value:ee.result},null),{value:ee.value,entity:i,error:null,result:{value:ie||null,valueOwner:i,type:We.ExecutionResult,inheritanceLink:null}}}catch(ee){if(ee&&(ee.name==="ExecutionStoppedError"||ee.message==="Execution was stopped"))throw ee;if(oe.Logger.warn("Error executing loop: ",ee),i.error){const re=iy(ee),Y=(W=i.error)==null?void 0:W.getDataType(null),Z=rn(Y,i.error,s);if(Y!=null&&Y.asType)Z==null||Z.setValueAsTypeSingle(ee);else{const J=pa(re)?JSON.stringify(re,null,2):re;Z==null||Z.metaSync({value:J},null)}return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,entity:i,error:{valueOwner:i.error,type:We.ExecutionResult,inheritanceLink:null,value:Z},result:null}}else return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,entity:i,error:null,result:null}}}async executeFunctionCall(i,n,s,c={}){var f,y,m,T,g,E,I,A,D,V,N,x,G,K,q,H,W,ee,re,Y,Z,J,ne,z,ie,pe;const e={...ny,...c};try{this.logBeforeExecution("executeFunctionCall",i,n);const me=await this.executeDetachedFullFunctionDeclarationLogic(i.declaration,n,s,e);let ve=null;if(me.error&&i.error){oe.Logger.warn("Raw error executing entity: ",me.error);const Ie=(f=i.error)==null?void 0:f.getDataType(null),$e=rn(Ie||null,i.error,s);Ie!=null&&Ie.asType?(m=(y=me.error)==null?void 0:y.value)!=null&&m.valueAsTypeSingle?$e==null||$e.setValueAsTypeSingle((g=(T=me.error)==null?void 0:T.value)==null?void 0:g.valueAsTypeSingle):(I=(E=me.error)==null?void 0:E.value)!=null&&I.valueAsTypeList&&Array.isArray((D=(A=me.error)==null?void 0:A.value)==null?void 0:D.valueAsTypeList)&&($e==null||$e.setValueAsTypeList((N=(V=me.error)==null?void 0:V.value)==null?void 0:N.valueAsTypeList)):$e==null||$e.metaSync({value:(G=(x=me.error)==null?void 0:x.value)==null?void 0:G.value},null),ve={valueOwner:i.error,type:We.ExecutionResult,inheritanceLink:null,value:$e}}let Ce=U.Success;me.value===U.UnhandledError&&(i.catchesError||i.errorCalls.length?Ce=U.CaughtError:Ce=U.UnhandledError);const Oe=i==null?void 0:i.getDataType(null),Ve=rn(Oe,i,s);return Oe!=null&&Oe.asType?(q=(K=me.result)==null?void 0:K.value)!=null&&q.valueAsTypeSingle?Ve==null||Ve.setValueAsTypeSingle((W=(H=me.result)==null?void 0:H.value)==null?void 0:W.valueAsTypeSingle):(re=(ee=me.result)==null?void 0:ee.value)!=null&&re.valueAsTypeList&&Array.isArray((Z=(Y=me.result)==null?void 0:Y.value)==null?void 0:Z.valueAsTypeList)&&(Ve==null||Ve.setValueAsTypeList((ne=(J=me.result)==null?void 0:J.value)==null?void 0:ne.valueAsTypeList)):Ve==null||Ve.metaSync({value:((ie=(z=me.result)==null?void 0:z.value)==null?void 0:ie.value)||null},null),{value:Ce,entity:i,error:ve,result:{value:Ve||null,valueOwner:i,type:We.ExecutionResult,inheritanceLink:null}}}catch(me){if(me&&(me.name==="ExecutionStoppedError"||me.message==="Execution was stopped"))throw me;if(!i.error)return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,entity:i,error:null,result:null};const ve=iy(me),Ce=(pe=i.error)==null?void 0:pe.getDataType(null),Oe=rn(Ce,i.error,s);if(Ce!=null&&Ce.asType)Oe==null||Oe.setValueAsTypeSingle(me);else{const Ve=pa(ve)?JSON.stringify(ve,null,2):ve;Oe==null||Oe.metaSync({value:Ve},null)}return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,entity:i,error:{valueOwner:i.error,type:We.ExecutionResult,inheritanceLink:null,value:Oe},result:null}}}async executeCondition(i,n){var c,e,f,y;this.logBeforeExecution("executeCondition",i,n);let s=!1;switch(i.declaration.id){case vs.BooleanIsTrue:{const m=(e=(c=n[0])==null?void 0:c.value)==null?void 0:e.value;if(typeof m!="boolean")throw new TypeError("BooleanIsTrue expects a boolean input.");s=m===!0;break}case vs.BooleanIsFalse:{const m=(y=(f=n[0])==null?void 0:f.value)==null?void 0:y.value;if(typeof m!="boolean")throw new TypeError("BooleanIsFalse expects a boolean input.");s=m===!1;break}case Aa.And:{s=(await Promise.all(i.andChildrenGroup.map(async T=>{const g=this.mergeExernalValuesWithInternalInputs(n,T);return(await this.executeCondition(T,g)).value===U.Success}))).every(T=>T);break}case Aa.Or:{s=(await Promise.all(i.orChildrenGroup.map(async T=>{const g=this.mergeExernalValuesWithInternalInputs(n,T);return(await this.executeCondition(T,g)).value===U.Success}))).some(T=>T);break}default:throw new Error(`Condition declaration ${i.declaration.name} does not have an implementation.`)}return{value:s?U.Success:U.ConditionNotMet,entity:i,error:null,result:null}}async executeDetachedFullFunctionDeclarationLogic(i,n,s,c={}){this.logBeforeExecution("executeDetachedFullFunctionDeclarationLogic",i,n);const e={...ny,...c,onBeforeEntityExecution:(m,T,g)=>{var E;return((E=c==null?void 0:c.onBeforeEntityExecution)==null?void 0:E.call(c,m,T,{...g,detached:!0}))||Promise.resolve()},onEntityExecuted:(m,T,g)=>{var E;return((E=c==null?void 0:c.onEntityExecuted)==null?void 0:E.call(c,m,T,{...g,detached:!0}))||Promise.resolve()}},f=new ET(s,[i,...WD(i)],i,this,this.parentContext);return f.inheritValuesFromContext(this),await f.execute(e,n)}async executeFullFunctionDeclarationLogic(i,n,s={}){this.logBeforeExecution("executeFullFunctionDeclarationLogic",i,n);const c={...ny,...s},e=WD(i),f=[];e.forEach(T=>{if(T.type===a.VariableDeclaration||T.type===a.VariableInstance){const g=T;g.internalCalls&&f.push(...g.internalCalls)}}),e.push(...f),console.log(`[executeFullFunctionDeclarationLogic] Reseting children for: ${Ee(i,this.project)}
|