@elyx-code/project-logic-tree 0.0.7226 → 0.0.7227
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- 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
|
`)),!p.includes(" ")&&/\\t/.test(p)&&(p=p.replace(/\\t/g," ")),p=p.replace(/\r\n/g,`
|
|
59
59
|
`).replace(/\r/g,`
|
|
60
60
|
`),p=p.replace(/\n/g,`\r
|
|
61
|
-
`),p}class FAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleDriveUploadFile,version:"2.0.0",description:"Upload a file to Google Drive (media / import+copy) with auto content detection and simplified inputs.",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleDriveUploadFile);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A,x,P,O,$,U,Z,j,H,Y,ie,W,z,J,ee;try{const Q=this.extensionsRegistry.requestContexts(this,[te.Editor])[0],re=Be(t,t.project,"uploadFile"),le="["+Ve(t,t.project,"Upload Google Drive File")+": `"+re+"`] ",oe=G.operation[X.GoogleDriveUploadFile],ce=n.find(kt=>{var Ct,Oi;return((Oi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:Oi.id)===oe.inputs.connection.id}),be=((s=ce==null?void 0:ce.value)==null?void 0:s.valueAsType)??((u=ce==null?void 0:ce.value)==null?void 0:u.value);if(!be||!be.id||!be.name||be.type!==r.DefinitionEntity)throw new Error(`${le}Invalid input "${Ve(ce==null?void 0:ce.valueOwner,Q==null?void 0:Q.logic,"Connection")}" (\`${Be(ce==null?void 0:ce.valueOwner,Q==null?void 0:Q.logic,"connection")}\`), expected a valid connection node.`);const Ce=n.find(kt=>{var Ct,Oi;return((Oi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:Oi.id)===oe.inputs.content.id}),Ee=((e=Ce==null?void 0:Ce.value)==null?void 0:e.valueAsType)??((f=Ce==null?void 0:Ce.value)==null?void 0:f.value),xe=n.find(kt=>{var Ct,Oi;return((Oi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:Oi.id)===oe.inputs.name.id}),Le=(m=(y=xe==null?void 0:xe.value)==null?void 0:y.value)==null?void 0:m.trim();if(!Le||Le==="")throw new Error(`${le}The "${Ve(xe==null?void 0:xe.valueOwner,Q==null?void 0:Q.logic,"File Name")}" (\`${Be(xe==null?void 0:xe.valueOwner,Q==null?void 0:Q.logic,"name")}\`) input is missing.`);const Fe=(((g=(T=n.find(kt=>{var Ct,Oi;return((Oi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:Oi.id)===G.operation[X.GoogleDriveUploadFile].inputs.mimeType.id}))==null?void 0:T.value)==null?void 0:g.valueAsType)??((R=(b=n.find(kt=>{var Ct,Oi;return((Oi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:Oi.id)===G.operation[X.GoogleDriveUploadFile].inputs.mimeType.id}))==null?void 0:b.value)==null?void 0:R.value))||"application/octet-stream",tt=(((A=(I=n.find(kt=>{var Ct,Oi;return((Oi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:Oi.id)===G.operation[X.GoogleDriveUploadFile].inputs.folderId.id}))==null?void 0:I.value)==null?void 0:A.valueAsType)??((P=(x=n.find(kt=>{var Ct,Oi;return((Oi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:Oi.id)===G.operation[X.GoogleDriveUploadFile].inputs.folderId.id}))==null?void 0:x.value)==null?void 0:P.value))||void 0,We=((($=(O=n.find(kt=>{var Ct,Oi;return((Oi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:Oi.id)===G.operation[X.GoogleDriveUploadFile].inputs.description.id}))==null?void 0:O.value)==null?void 0:$.valueAsType)??((Z=(U=n.find(kt=>{var Ct,Oi;return((Oi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:Oi.id)===G.operation[X.GoogleDriveUploadFile].inputs.description.id}))==null?void 0:U.value)==null?void 0:Z.value))||void 0,et=(((H=(j=n.find(kt=>{var Ct,Oi;return((Oi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:Oi.id)===G.operation[X.GoogleDriveUploadFile].inputs.importMimeType.id}))==null?void 0:j.value)==null?void 0:H.valueAsType)??((ie=(Y=n.find(kt=>{var Ct,Oi;return((Oi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:Oi.id)===G.operation[X.GoogleDriveUploadFile].inputs.importMimeType.id}))==null?void 0:Y.value)==null?void 0:ie.value))||"text/plain";if(!Le)return ay(t,"Missing required input: name");const qe=ui(be),st={Authorization:`Bearer ${await Q.getAccessToken()}`},ft=`${((W=Q.env)==null?void 0:W.API_BASE_URL)+"/editor-runtime"}/v2/external-integrations/proxy/${Q.projectId}/${Zt["google-drive"]}/${qe}`,Et=async(kt,Ct,{params:Oi,body:wn,contentType:Yr,providerHeaders:Jr,responseType:hi}={})=>{const $t=`${ft}/${eRn(Ct)}`,Nt={...st};return Yr&&(Nt["Content-Type"]=Yr),(Jr||hi)&&(Nt[XIn]=JSON.stringify({...Jr?{headers:Jr}:{},...hi?{responseType:hi}:{}})),Ht.request({method:kt,url:$t,params:Oi,data:wn,responseType:hi||"json",headers:Nt})},pt=typeof Fe=="string"&&Fe.startsWith("application/vnd.google-apps.");if(pt&&(Ee==null||Ee==="")){const kt={name:Le,mimeType:Fe};tt&&(kt.parents=[tt]),typeof We=="string"&&(kt.description=We);const Ct=await Et("POST","/drive/v3/files",{params:{supportsAllDrives:"true",fields:$R},body:JSON.stringify(kt),contentType:"application/json"});return Ct.status!==200&&Ct.status!==201?ay(t,`Drive create failed (status=${Ct.status})`):JG({file:Ct.data})}if(pt&&Ee!=null){let kt=await iRn(Ee);const Oi=((hi,$t)=>$t||(hi==="application/vnd.google-apps.spreadsheet"?"text/csv":hi==="application/vnd.google-apps.document"||hi==="application/vnd.google-apps.presentation"?"text/html":"text/plain"))(Fe,et),wn=Oi.startsWith("text/")&&!/charset=/i.test(Oi)?`${Oi}; charset=UTF-8`:Oi;Oi.startsWith("text/csv")&&(kt=nRn(kt));const Yr=new TextEncoder().encode(kt);if(Yr.byteLength>I5)return ay(t,`Text body exceeds simple upload limit (${Yr.byteLength} bytes).`);let Jr;try{const hi=await Et("POST","/upload/drive/v3/files",{params:{uploadType:"media",supportsAllDrives:"true",fields:$R},body:Yr,contentType:wn});if(hi.status!==200&&hi.status!==201)return ay(t,`Drive media upload failed (status=${hi.status})`);if(Jr=(z=hi.data)==null?void 0:z.id,!Jr)return ay(t,"Drive media upload did not return an id");const $t={name:Le,mimeType:Fe};tt&&($t.parents=[tt]),typeof We=="string"&&($t.description=We);const Nt=await Et("POST",`/drive/v3/files/${encodeURIComponent(Jr)}/copy`,{params:{supportsAllDrives:"true",fields:$R},body:JSON.stringify($t),contentType:"application/json"});return Nt.status!==200&&Nt.status!==201?ay(t,`Drive copy-convert failed (status=${Nt.status})`):JG({file:Nt.data})}finally{if(Jr)try{await Et("DELETE",`/drive/v3/files/${encodeURIComponent(Jr)}`,{params:{supportsAllDrives:"true"}})}catch{}}}if(Ee==null)return ay(t,"Missing content for non-native upload");const{bytes:Me,inferredMime:Je,isBinary:ke}=await tRn(Ee),lt=Me.byteLength;if(lt>I5)return ay(t,`File too large for simple upload (${lt} bytes).`);const Gt=await Et("POST","/upload/drive/v3/files",{params:{uploadType:"media",supportsAllDrives:"true",fields:$R},body:Me,contentType:Fe||Je||(ke?"application/octet-stream":"text/plain; charset=UTF-8")});if(Gt.status!==200&&Gt.status!==201)return ay(t,`Drive media upload failed (status=${Gt.status})`);let si=Gt.data;const pi=(J=Gt.data)==null?void 0:J.id;return pi&&(tt||Le||We)&&(si=await rRn(Et,pi,Le,We,tt)),JG({file:si})}catch(Q){const re=((ee=Q.response)==null?void 0:ee.data)||Q.message||Q;return pe.Logger.error("[Google Drive] Upload document failed:",re),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:re,result:null}}}})}}function JG(a){return{value:K.Success,error:null,result:a}}function ay(a,p){return pe.Logger.log("[Google Drive] Upload error:",p),{value:a.catchesError||a.errorCalls.length?K.CaughtError:K.UnhandledError,error:p,result:null}}async function rRn(a,p,t,n,s){const u={};t&&(u.name=t),typeof n=="string"&&(u.description=n);const e={supportsAllDrives:"true",fields:$R},f={...e};s&&(f.addParents=s,f.removeParents="root");let y=await a("PATCH",`/drive/v3/files/${encodeURIComponent(p)}`,{params:f,body:JSON.stringify(u),contentType:"application/json"});if(y.status>=400&&s&&(y=await a("PATCH",`/drive/v3/files/${encodeURIComponent(p)}`,{params:{...e,addParents:s},body:JSON.stringify(u),contentType:"application/json"})),y.status!==200)throw new Error(`Drive metadata update failed (status=${y.status})`);return y.data}const aRn="id,name,mimeType,webViewLink",sRn="X-Elyx-Proxy-Config";function lRn(a){return a.startsWith("/")?a.slice(1):a}const oRn=(a,p)=>(pe.Logger.log("[Google Drive Clone Document] error:",p),{value:a.catchesError||a.errorCalls.length?K.CaughtError:K.UnhandledError,error:p,result:null});class kAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleDriveCloneDocument,version:"1.0.0",description:"Google Drive clone document operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleDriveCloneDocument);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A,x;try{const P=this.extensionsRegistry.requestContexts(this,[te.Editor])[0],O=G.operation[X.GoogleDriveCloneDocument],$=Be(t,t.project,"cloneDocument"),Z="["+Ve(t,t.project,"Clone document")+": `"+$+"`] ",j=n.find(Ee=>{var xe,Le;return((Le=(xe=Ee.valueOwner)==null?void 0:xe.declaration)==null?void 0:Le.id)===O.inputs.connection.id}),H=((s=j==null?void 0:j.value)==null?void 0:s.valueAsType)??((u=j==null?void 0:j.value)==null?void 0:u.value);if(!H||!H.id||!H.name||H.type!==r.DefinitionEntity)throw new Error(`${Z}Invalid input "${Ve(j==null?void 0:j.valueOwner,P==null?void 0:P.logic,"Connection")}" (\`${Be(j==null?void 0:j.valueOwner,P==null?void 0:P.logic,"connection")}\`), expected a valid connection node.`);const Y=ui(H);if(!Y)throw new Error(`${Z}The "${Ve(j==null?void 0:j.valueOwner,P==null?void 0:P.logic,"Connection")}" (\`${Be(j==null?void 0:j.valueOwner,P==null?void 0:P.logic,"connection")}\`) input is invalid, missing underlying Connection ID value.`);const ie=n.find(Ee=>{var xe,Le;return((Le=(xe=Ee.valueOwner)==null?void 0:xe.declaration)==null?void 0:Le.id)===O.inputs.documentId.id}),W=(e=ie==null?void 0:ie.value)==null?void 0:e.value;if(!W||W==="")throw new Error(`${Z}The "${Ve(ie==null?void 0:ie.valueOwner,P==null?void 0:P.logic,"Document ID")}" (\`${Be(ie==null?void 0:ie.valueOwner,P==null?void 0:P.logic,"documentId")}\`) input is missing.`);if(typeof W!="string")throw new Error(`${Z}The "${Ve(ie==null?void 0:ie.valueOwner,P==null?void 0:P.logic,"Document ID")}" (\`${Be(ie==null?void 0:ie.valueOwner,P==null?void 0:P.logic,"documentId")}\`) input value is invalid, if present, it must be a non-empty string.`);const z=(y=(f=n.find(Ee=>{var xe,Le;return((Le=(xe=Ee.valueOwner)==null?void 0:xe.declaration)==null?void 0:Le.id)===O.inputs.newName.id}))==null?void 0:f.value)==null?void 0:y.value,J=(T=(m=n.find(Ee=>{var xe,Le;return((Le=(xe=Ee.valueOwner)==null?void 0:xe.declaration)==null?void 0:Le.id)===O.inputs.parentFolderIds.id}))==null?void 0:m.value)==null?void 0:T.value,ee=(b=(g=n.find(Ee=>{var xe,Le;return((Le=(xe=Ee.valueOwner)==null?void 0:xe.declaration)==null?void 0:Le.id)===O.inputs.description.id}))==null?void 0:g.value)==null?void 0:b.value,Q=(I=(R=n.find(Ee=>{var xe,Le;return((Le=(xe=Ee.valueOwner)==null?void 0:xe.declaration)==null?void 0:Le.id)===O.inputs.starred.id}))==null?void 0:R.value)==null?void 0:I.value;ui(H);const ae={Authorization:`Bearer ${await P.getAccessToken()}`},le=`${((A=P.env)==null?void 0:A.API_BASE_URL)+"/editor-runtime"}/v2/external-integrations/proxy/${P.projectId}/${Zt["google-drive"]}/${Y}`,oe=async(Ee,xe,{params:Le,body:Fe,contentType:tt,providerHeaders:We,responseType:et}={})=>{const qe=`${le}/${lRn(xe)}`,ot={...ae};return tt&&(ot["Content-Type"]=tt),(We||et)&&(ot[sRn]=JSON.stringify({...We?{headers:We}:{},...et?{responseType:et}:{}})),Ht({method:Ee,url:qe,headers:ot,params:Le,data:Fe,responseType:et||"json"})},ce={};z&&(ce.name=z),J&&J.length>0&&(ce.parents=J),ee&&(ce.description=ee),Q!==void 0&&(ce.starred=Q);const Ce=(await oe("POST",`/drive/v3/files/${W}/copy`,{params:{fields:aRn,supportsAllDrives:!0},body:ce,contentType:"application/json"})).data;return{value:K.Success,error:null,result:{id:Ce.id,name:Ce.name,mimeType:Ce.mimeType,webViewLink:Ce.webViewLink}}}catch(P){const O=((x=P.response)==null?void 0:x.data)||P.message||P;return oRn(t,O)}}})}}const dRn="X-Elyx-Proxy-Config";function pRn(a){return a.startsWith("/")?a.slice(1):a}const uRn=(a,p)=>(pe.Logger.log("[Google Drive Delete Document] error:",p),{value:a.catchesError||a.errorCalls.length?K.CaughtError:K.UnhandledError,error:p,result:null});class UAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleDriveDeleteDocument,version:"1.0.0",description:"Google Drive delete document operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleDriveDeleteDocument);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T;try{const g=this.extensionsRegistry.requestContexts(this,[te.Editor])[0],b=G.operation[X.GoogleDriveDeleteDocument],R=Be(t,t.project,"deleteDocument"),A="["+Ve(t,t.project,"Delete document")+": `"+R+"`] ",x=n.find(W=>{var z,J;return((J=(z=W.valueOwner)==null?void 0:z.declaration)==null?void 0:J.id)===b.inputs.connection.id}),P=((s=x==null?void 0:x.value)==null?void 0:s.valueAsType)??((u=x==null?void 0:x.value)==null?void 0:u.value);if(!P||!P.id||!P.name||P.type!==r.DefinitionEntity)throw new Error(`${A}Invalid input "${Ve(x==null?void 0:x.valueOwner,g==null?void 0:g.logic,"Connection")}" (\`${Be(x==null?void 0:x.valueOwner,g==null?void 0:g.logic,"connection")}\`), expected a valid connection node.`);const O=ui(P);if(!O)throw new Error(`${A}The "${Ve(x==null?void 0:x.valueOwner,g==null?void 0:g.logic,"Connection")}" (\`${Be(x==null?void 0:x.valueOwner,g==null?void 0:g.logic,"connection")}\`) input is invalid, missing underlying Connection ID value.`);const $=n.find(W=>{var z,J;return((J=(z=W.valueOwner)==null?void 0:z.declaration)==null?void 0:J.id)===b.inputs.documentId.id}),U=(e=$==null?void 0:$.value)==null?void 0:e.value;if(!U||U==="")throw new Error(`${A}The "${Ve($==null?void 0:$.valueOwner,g==null?void 0:g.logic,"Document ID")}" (\`${Be($==null?void 0:$.valueOwner,g==null?void 0:g.logic,"documentId")}\`) input is missing.`);if(typeof U!="string")throw new Error(`${A}The "${Ve($==null?void 0:$.valueOwner,g==null?void 0:g.logic,"Document ID")}" (\`${Be($==null?void 0:$.valueOwner,g==null?void 0:g.logic,"documentId")}\`) input value is invalid, if present, it must be a non-empty string.`);const Z=(y=(f=n.find(W=>{var z,J;return((J=(z=W.valueOwner)==null?void 0:z.declaration)==null?void 0:J.id)===b.inputs.permanent.id}))==null?void 0:f.value)==null?void 0:y.value;ui(P);const H={Authorization:`Bearer ${await g.getAccessToken()}`},Y=`${((m=g.env)==null?void 0:m.API_BASE_URL)+"/editor-runtime"}/v2/external-integrations/proxy/${g.projectId}/${Zt["google-drive"]}/${O}`,ie=async(W,z,{params:J,body:ee,contentType:Q,providerHeaders:re,responseType:ae}={})=>{const le=`${Y}/${pRn(z)}`,oe={...H};return Q&&(oe["Content-Type"]=Q),(re||ae)&&(oe[dRn]=JSON.stringify({...re?{headers:re}:{},...ae?{responseType:ae}:{}})),Ht({method:W,url:le,headers:oe,params:J,data:ee,responseType:ae||"json"})};return Z?await ie("DELETE",`/drive/v3/files/${U}`,{params:{supportsAllDrives:!0}}):await ie("PATCH",`/drive/v3/files/${U}`,{params:{supportsAllDrives:!0},body:{trashed:!0},contentType:"application/json"}),{value:K.Success,error:null,result:null}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return uRn(t,b)}}})}}const cRn="X-Elyx-Proxy-Config";function fRn(a){return a.startsWith("/")?a.slice(1):a}const yRn=(a,p)=>(pe.Logger.log("[Google Drive Create Permission] error:",p),{value:a.catchesError||a.errorCalls.length?K.CaughtError:K.UnhandledError,error:p,result:null});class KAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleDriveCreatePermission,version:"1.0.0",description:"Google Drive create permission operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleDriveCreatePermission);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A,x,P,O,$,U,Z;try{const j=this.extensionsRegistry.requestContexts(this,[te.Editor])[0],H=G.operation[X.GoogleDriveCreatePermission],Y=Be(t,t.project,"createPermission"),W="["+Ve(t,t.project,"Create permission")+": `"+Y+"`] ",z=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===H.inputs.connection.id}),J=((s=z==null?void 0:z.value)==null?void 0:s.valueAsType)??((u=z==null?void 0:z.value)==null?void 0:u.value);if(!J||!J.id||!J.name||J.type!==r.DefinitionEntity)throw new Error(`${W}Invalid input "${Ve(z==null?void 0:z.valueOwner,j==null?void 0:j.logic,"Connection")}" (\`${Be(z==null?void 0:z.valueOwner,j==null?void 0:j.logic,"connection")}\`), expected a valid connection node.`);const ee=ui(J);if(!ee)throw new Error(`${W}The "${Ve(z==null?void 0:z.valueOwner,j==null?void 0:j.logic,"Connection")}" (\`${Be(z==null?void 0:z.valueOwner,j==null?void 0:j.logic,"connection")}\`) input is invalid, missing underlying Connection ID value.`);const Q=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===H.inputs.fileId.id}),re=(e=Q==null?void 0:Q.value)==null?void 0:e.value;if(!re||re==="")throw new Error(`${W}The "${Ve(Q==null?void 0:Q.valueOwner,j==null?void 0:j.logic,"File ID")}" (\`${Be(Q==null?void 0:Q.valueOwner,j==null?void 0:j.logic,"fileId")}\`) input is missing.`);if(typeof re!="string")throw new Error(`${W}The "${Ve(Q==null?void 0:Q.valueOwner,j==null?void 0:j.logic,"File ID")}" (\`${Be(Q==null?void 0:Q.valueOwner,j==null?void 0:j.logic,"fileId")}\`) input value is invalid, if present, it must be a non-empty string.`);const ae=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===H.inputs.role.id}),le=(f=ae==null?void 0:ae.value)==null?void 0:f.value;if(!le||le==="")throw new Error(`${W}The "${Ve(ae==null?void 0:ae.valueOwner,j==null?void 0:j.logic,"Role")}" (\`${Be(ae==null?void 0:ae.valueOwner,j==null?void 0:j.logic,"role")}\`) input is missing.`);if(typeof le!="string")throw new Error(`${W}The "${Ve(ae==null?void 0:ae.valueOwner,j==null?void 0:j.logic,"Role")}" (\`${Be(ae==null?void 0:ae.valueOwner,j==null?void 0:j.logic,"role")}\`) input value is invalid, if present, it must be a non-empty string.`);const oe=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===H.inputs.type.id}),ce=(y=oe==null?void 0:oe.value)==null?void 0:y.value;if(!ce||ce==="")throw new Error(`${W}The "${Ve(oe==null?void 0:oe.valueOwner,j==null?void 0:j.logic,"Type")}" (\`${Be(oe==null?void 0:oe.valueOwner,j==null?void 0:j.logic,"type")}\`) input is missing.`);if(typeof ce!="string")throw new Error(`${W}The "${Ve(oe==null?void 0:oe.valueOwner,j==null?void 0:j.logic,"Type")}" (\`${Be(oe==null?void 0:oe.valueOwner,j==null?void 0:j.logic,"type")}\`) input value is invalid, if present, it must be a non-empty string.`);const be=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===H.inputs.emailAddress.id}),Ce=(m=be==null?void 0:be.value)==null?void 0:m.value,Ee=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===H.inputs.domain.id}),xe=(T=Ee==null?void 0:Ee.value)==null?void 0:T.value;if((ce==="user"||ce==="group")&&(!Ce||Ce.trim()===""))throw new Error(`${W}The "${Ve(be==null?void 0:be.valueOwner,j==null?void 0:j.logic,"Email address")}" (\`${Be(be==null?void 0:be.valueOwner,j==null?void 0:j.logic,"emailAddress")}\`) input is required when type is "${ce}".`);if(ce==="domain"&&(!xe||xe.trim()===""))throw new Error(`${W}The "${Ve(Ee==null?void 0:Ee.valueOwner,j==null?void 0:j.logic,"Domain")}" (\`${Be(Ee==null?void 0:Ee.valueOwner,j==null?void 0:j.logic,"domain")}\`) input is required when type is "domain".`);const Le=(b=(g=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===H.inputs.sendNotificationEmail.id}))==null?void 0:g.value)==null?void 0:b.value,Fe=(I=(R=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===H.inputs.emailMessage.id}))==null?void 0:R.value)==null?void 0:I.value,tt=(x=(A=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===H.inputs.allowFileDiscovery.id}))==null?void 0:A.value)==null?void 0:x.value,We=(O=(P=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===H.inputs.transferOwnership.id}))==null?void 0:P.value)==null?void 0:O.value;ui(J);const qe={Authorization:`Bearer ${await j.getAccessToken()}`},ot=`${(($=j.env)==null?void 0:$.API_BASE_URL)+"/editor-runtime"}/v2/external-integrations/proxy/${j.projectId}/${Zt["google-drive"]}/${ee}`,st=async(Je,ke,{params:lt,body:Pt,contentType:Gt,providerHeaders:si,responseType:pi}={})=>{const kt=`${ot}/${fRn(ke)}`,Ct={...qe};return Gt&&(Ct["Content-Type"]=Gt),(si||pi)&&(Ct[cRn]=JSON.stringify({...si?{headers:si}:{},...pi?{responseType:pi}:{}})),Ht({method:Je,url:kt,headers:Ct,params:lt,data:Pt,responseType:pi||"json"})},ft={supportsAllDrives:!0,fields:"id,type,role,emailAddress,domain,displayName"};Le!==void 0&&(ft.sendNotificationEmail=Le),Fe&&(ft.emailMessage=Fe),We!==void 0&&(ft.transferOwnership=We);const Et={role:le,type:ce};Ce&&(Et.emailAddress=Ce),xe&&(Et.domain=xe),tt!==void 0&&(Et.allowFileDiscovery=tt);const pt=await st("POST",`/drive/v3/files/${re}/permissions`,{params:ft,body:Et,contentType:"application/json"}),Me=((U=pt.data)==null?void 0:U.data)??pt.data;return{value:K.Success,error:null,result:{id:(Me==null?void 0:Me.id)??"",type:(Me==null?void 0:Me.type)??ce,role:(Me==null?void 0:Me.role)??le,emailAddress:(Me==null?void 0:Me.emailAddress)??Ce??"",domain:(Me==null?void 0:Me.domain)??xe??"",displayName:(Me==null?void 0:Me.displayName)??""}}}catch(j){const H=((Z=j.response)==null?void 0:Z.data)||j.message||j;return yRn(t,typeof H=="object"?JSON.stringify(H):String(H))}}})}}const hRn="X-Elyx-Proxy-Config";function mRn(a){return a.startsWith("/")?a.slice(1):a}const TRn=(a,p)=>(pe.Logger.log("[Google Drive Delete Permission] error:",p),{value:a.catchesError||a.errorCalls.length?K.CaughtError:K.UnhandledError,error:p,result:null});class jAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleDriveDeletePermission,version:"1.0.0",description:"Google Drive delete permission operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleDriveDeletePermission);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[te.Editor])[0],g=G.operation[X.GoogleDriveDeletePermission],b=Be(t,t.project,"deletePermission"),I="["+Ve(t,t.project,"Delete permission")+": `"+b+"`] ",A=n.find(W=>{var z,J;return((J=(z=W.valueOwner)==null?void 0:z.declaration)==null?void 0:J.id)===g.inputs.connection.id}),x=((s=A==null?void 0:A.value)==null?void 0:s.valueAsType)??((u=A==null?void 0:A.value)==null?void 0:u.value);if(!x||!x.id||!x.name||x.type!==r.DefinitionEntity)throw new Error(`${I}Invalid input "${Ve(A==null?void 0:A.valueOwner,T==null?void 0:T.logic,"Connection")}" (\`${Be(A==null?void 0:A.valueOwner,T==null?void 0:T.logic,"connection")}\`), expected a valid connection node.`);const P=ui(x);if(!P)throw new Error(`${I}The "${Ve(A==null?void 0:A.valueOwner,T==null?void 0:T.logic,"Connection")}" (\`${Be(A==null?void 0:A.valueOwner,T==null?void 0:T.logic,"connection")}\`) input is invalid, missing underlying Connection ID value.`);const O=n.find(W=>{var z,J;return((J=(z=W.valueOwner)==null?void 0:z.declaration)==null?void 0:J.id)===g.inputs.fileId.id}),$=(e=O==null?void 0:O.value)==null?void 0:e.value;if(!$||$==="")throw new Error(`${I}The "${Ve(O==null?void 0:O.valueOwner,T==null?void 0:T.logic,"File ID")}" (\`${Be(O==null?void 0:O.valueOwner,T==null?void 0:T.logic,"fileId")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${I}The "${Ve(O==null?void 0:O.valueOwner,T==null?void 0:T.logic,"File ID")}" (\`${Be(O==null?void 0:O.valueOwner,T==null?void 0:T.logic,"fileId")}\`) input value is invalid, if present, it must be a non-empty string.`);const U=n.find(W=>{var z,J;return((J=(z=W.valueOwner)==null?void 0:z.declaration)==null?void 0:J.id)===g.inputs.permissionId.id}),Z=(f=U==null?void 0:U.value)==null?void 0:f.value;if(!Z||Z==="")throw new Error(`${I}The "${Ve(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"Permission ID")}" (\`${Be(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"permissionId")}\`) input is missing.`);if(typeof Z!="string")throw new Error(`${I}The "${Ve(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"Permission ID")}" (\`${Be(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"permissionId")}\`) input value is invalid, if present, it must be a non-empty string.`);ui(x);const H={Authorization:`Bearer ${await T.getAccessToken()}`},Y=`${((y=T.env)==null?void 0:y.API_BASE_URL)+"/editor-runtime"}/v2/external-integrations/proxy/${T.projectId}/${Zt["google-drive"]}/${P}`;return await(async(W,z,{params:J,body:ee,contentType:Q,providerHeaders:re,responseType:ae}={})=>{const le=`${Y}/${mRn(z)}`,oe={...H};return Q&&(oe["Content-Type"]=Q),(re||ae)&&(oe[hRn]=JSON.stringify({...re?{headers:re}:{},...ae?{responseType:ae}:{}})),Ht({method:W,url:le,headers:oe,params:J,data:ee,responseType:ae||"json"})})("DELETE",`/drive/v3/files/${$}/permissions/${Z}`,{params:{supportsAllDrives:!0}}),{value:K.Success,error:null,result:void 0}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return TRn(t,typeof g=="object"?JSON.stringify(g):String(g))}}})}}const vRn="X-Elyx-Proxy-Config";function gRn(a){return a.startsWith("/")?a.slice(1):a}const bRn=(a,p)=>(pe.Logger.log("[Google Drive List Permissions] error:",p),{value:a.catchesError||a.errorCalls.length?K.CaughtError:K.UnhandledError,error:p,result:null});class qAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleDriveListPermissions,version:"1.0.0",description:"Google Drive list permissions operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleDriveListPermissions);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R;try{const I=this.extensionsRegistry.requestContexts(this,[te.Editor])[0],A=G.operation[X.GoogleDriveListPermissions],x=Be(t,t.project,"listPermissions"),O="["+Ve(t,t.project,"List permissions")+": `"+x+"`] ",$=n.find(ce=>{var be,Ce;return((Ce=(be=ce.valueOwner)==null?void 0:be.declaration)==null?void 0:Ce.id)===A.inputs.connection.id}),U=((s=$==null?void 0:$.value)==null?void 0:s.valueAsType)??((u=$==null?void 0:$.value)==null?void 0:u.value);if(!U||!U.id||!U.name||U.type!==r.DefinitionEntity)throw new Error(`${O}Invalid input "${Ve($==null?void 0:$.valueOwner,I==null?void 0:I.logic,"Connection")}" (\`${Be($==null?void 0:$.valueOwner,I==null?void 0:I.logic,"connection")}\`), expected a valid connection node.`);const Z=ui(U);if(!Z)throw new Error(`${O}The "${Ve($==null?void 0:$.valueOwner,I==null?void 0:I.logic,"Connection")}" (\`${Be($==null?void 0:$.valueOwner,I==null?void 0:I.logic,"connection")}\`) input is invalid, missing underlying Connection ID value.`);const j=n.find(ce=>{var be,Ce;return((Ce=(be=ce.valueOwner)==null?void 0:be.declaration)==null?void 0:Ce.id)===A.inputs.fileId.id}),H=(e=j==null?void 0:j.value)==null?void 0:e.value;if(!H||H==="")throw new Error(`${O}The "${Ve(j==null?void 0:j.valueOwner,I==null?void 0:I.logic,"File ID")}" (\`${Be(j==null?void 0:j.valueOwner,I==null?void 0:I.logic,"fileId")}\`) input is missing.`);if(typeof H!="string")throw new Error(`${O}The "${Ve(j==null?void 0:j.valueOwner,I==null?void 0:I.logic,"File ID")}" (\`${Be(j==null?void 0:j.valueOwner,I==null?void 0:I.logic,"fileId")}\`) input value is invalid, if present, it must be a non-empty string.`);const Y=(y=(f=n.find(ce=>{var be,Ce;return((Ce=(be=ce.valueOwner)==null?void 0:be.declaration)==null?void 0:Ce.id)===A.inputs.pageSize.id}))==null?void 0:f.value)==null?void 0:y.value,ie=(T=(m=n.find(ce=>{var be,Ce;return((Ce=(be=ce.valueOwner)==null?void 0:be.declaration)==null?void 0:Ce.id)===A.inputs.pageToken.id}))==null?void 0:m.value)==null?void 0:T.value;ui(U);const z={Authorization:`Bearer ${await I.getAccessToken()}`},J=`${((g=I.env)==null?void 0:g.API_BASE_URL)+"/editor-runtime"}/v2/external-integrations/proxy/${I.projectId}/${Zt["google-drive"]}/${Z}`,ee=async(ce,be,{params:Ce,body:Ee,contentType:xe,providerHeaders:Le,responseType:Fe}={})=>{const tt=`${J}/${gRn(be)}`,We={...z};return xe&&(We["Content-Type"]=xe),(Le||Fe)&&(We[vRn]=JSON.stringify({...Le?{headers:Le}:{},...Fe?{responseType:Fe}:{}})),Ht({method:ce,url:tt,headers:We,params:Ce,data:Ee,responseType:Fe||"json"})},Q={supportsAllDrives:!0,fields:"nextPageToken,permissions(id,type,role,emailAddress,domain,displayName)"};Y!=null&&(Q.pageSize=Y),ie&&(Q.pageToken=ie);const re=await ee("GET",`/drive/v3/files/${H}/permissions`,{params:Q}),ae=((b=re.data)==null?void 0:b.data)??re.data,oe=(Array.isArray(ae==null?void 0:ae.permissions)?ae.permissions:[]).map(ce=>({id:(ce==null?void 0:ce.id)??"",type:(ce==null?void 0:ce.type)??"",role:(ce==null?void 0:ce.role)??"",emailAddress:(ce==null?void 0:ce.emailAddress)??"",domain:(ce==null?void 0:ce.domain)??"",displayName:(ce==null?void 0:ce.displayName)??""}));return{value:K.Success,error:null,result:{permissions:oe,nextPageToken:(ae==null?void 0:ae.nextPageToken)??""}}}catch(I){const A=((R=I.response)==null?void 0:R.data)||I.message||I;return bRn(t,typeof A=="object"?JSON.stringify(A):String(A))}}})}}const ERn="X-Elyx-Proxy-Config";function IRn(a){return a.startsWith("/")?a.slice(1):a}const RRn=(a,p)=>(pe.Logger.log("[Google Drive Update Permission] error:",p),{value:a.catchesError||a.errorCalls.length?K.CaughtError:K.UnhandledError,error:p,result:null});class ZAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleDriveUpdatePermission,version:"1.0.0",description:"Google Drive update permission operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleDriveUpdatePermission);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R;try{const I=this.extensionsRegistry.requestContexts(this,[te.Editor])[0],A=G.operation[X.GoogleDriveUpdatePermission],x=Be(t,t.project,"updatePermission"),O="["+Ve(t,t.project,"Update permission")+": `"+x+"`] ",$=n.find(be=>{var Ce,Ee;return((Ee=(Ce=be.valueOwner)==null?void 0:Ce.declaration)==null?void 0:Ee.id)===A.inputs.connection.id}),U=((s=$==null?void 0:$.value)==null?void 0:s.valueAsType)??((u=$==null?void 0:$.value)==null?void 0:u.value);if(!U||!U.id||!U.name||U.type!==r.DefinitionEntity)throw new Error(`${O}Invalid input "${Ve($==null?void 0:$.valueOwner,I==null?void 0:I.logic,"Connection")}" (\`${Be($==null?void 0:$.valueOwner,I==null?void 0:I.logic,"connection")}\`), expected a valid connection node.`);const Z=ui(U);if(!Z)throw new Error(`${O}The "${Ve($==null?void 0:$.valueOwner,I==null?void 0:I.logic,"Connection")}" (\`${Be($==null?void 0:$.valueOwner,I==null?void 0:I.logic,"connection")}\`) input is invalid, missing underlying Connection ID value.`);const j=n.find(be=>{var Ce,Ee;return((Ee=(Ce=be.valueOwner)==null?void 0:Ce.declaration)==null?void 0:Ee.id)===A.inputs.fileId.id}),H=(e=j==null?void 0:j.value)==null?void 0:e.value;if(!H||H==="")throw new Error(`${O}The "${Ve(j==null?void 0:j.valueOwner,I==null?void 0:I.logic,"File ID")}" (\`${Be(j==null?void 0:j.valueOwner,I==null?void 0:I.logic,"fileId")}\`) input is missing.`);if(typeof H!="string")throw new Error(`${O}The "${Ve(j==null?void 0:j.valueOwner,I==null?void 0:I.logic,"File ID")}" (\`${Be(j==null?void 0:j.valueOwner,I==null?void 0:I.logic,"fileId")}\`) input value is invalid, if present, it must be a non-empty string.`);const Y=n.find(be=>{var Ce,Ee;return((Ee=(Ce=be.valueOwner)==null?void 0:Ce.declaration)==null?void 0:Ee.id)===A.inputs.permissionId.id}),ie=(f=Y==null?void 0:Y.value)==null?void 0:f.value;if(!ie||ie==="")throw new Error(`${O}The "${Ve(Y==null?void 0:Y.valueOwner,I==null?void 0:I.logic,"Permission ID")}" (\`${Be(Y==null?void 0:Y.valueOwner,I==null?void 0:I.logic,"permissionId")}\`) input is missing.`);if(typeof ie!="string")throw new Error(`${O}The "${Ve(Y==null?void 0:Y.valueOwner,I==null?void 0:I.logic,"Permission ID")}" (\`${Be(Y==null?void 0:Y.valueOwner,I==null?void 0:I.logic,"permissionId")}\`) input value is invalid, if present, it must be a non-empty string.`);const W=n.find(be=>{var Ce,Ee;return((Ee=(Ce=be.valueOwner)==null?void 0:Ce.declaration)==null?void 0:Ee.id)===A.inputs.role.id}),z=(y=W==null?void 0:W.value)==null?void 0:y.value;if(!z||z==="")throw new Error(`${O}The "${Ve(W==null?void 0:W.valueOwner,I==null?void 0:I.logic,"Role")}" (\`${Be(W==null?void 0:W.valueOwner,I==null?void 0:I.logic,"role")}\`) input is missing.`);if(typeof z!="string")throw new Error(`${O}The "${Ve(W==null?void 0:W.valueOwner,I==null?void 0:I.logic,"Role")}" (\`${Be(W==null?void 0:W.valueOwner,I==null?void 0:I.logic,"role")}\`) input value is invalid, if present, it must be a non-empty string.`);const J=(T=(m=n.find(be=>{var Ce,Ee;return((Ee=(Ce=be.valueOwner)==null?void 0:Ce.declaration)==null?void 0:Ee.id)===A.inputs.transferOwnership.id}))==null?void 0:m.value)==null?void 0:T.value;ui(U);const Q={Authorization:`Bearer ${await I.getAccessToken()}`},re=`${((g=I.env)==null?void 0:g.API_BASE_URL)+"/editor-runtime"}/v2/external-integrations/proxy/${I.projectId}/${Zt["google-drive"]}/${Z}`,ae=async(be,Ce,{params:Ee,body:xe,contentType:Le,providerHeaders:Fe,responseType:tt}={})=>{const We=`${re}/${IRn(Ce)}`,et={...Q};return Le&&(et["Content-Type"]=Le),(Fe||tt)&&(et[ERn]=JSON.stringify({...Fe?{headers:Fe}:{},...tt?{responseType:tt}:{}})),Ht({method:be,url:We,headers:et,params:Ee,data:xe,responseType:tt||"json"})},le={supportsAllDrives:!0,fields:"id,type,role,emailAddress,domain,displayName"};J!=null&&(le.transferOwnership=J);const oe=await ae("PATCH",`/drive/v3/files/${H}/permissions/${ie}`,{params:le,body:{role:z},contentType:"application/json"}),ce=((b=oe.data)==null?void 0:b.data)??oe.data;return{value:K.Success,error:null,result:{id:(ce==null?void 0:ce.id)??ie,type:(ce==null?void 0:ce.type)??"",role:(ce==null?void 0:ce.role)??z,emailAddress:(ce==null?void 0:ce.emailAddress)??"",domain:(ce==null?void 0:ce.domain)??"",displayName:(ce==null?void 0:ce.displayName)??""}}}catch(I){const A=((R=I.response)==null?void 0:R.data)||I.message||I;return RRn(t,typeof A=="object"?JSON.stringify(A):String(A))}}})}}class HAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleGeminiGenerateContent,version:"1.0.0",description:"Send Gmail email operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleGeminiGenerateContent);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[te.Editor])[0],g=Be(t,t.project,"generateContent"),R="["+Ve(t,t.project,"Generate content")+": `"+g+"`] ",I=G.operation[X.GoogleGeminiGenerateContent],A=n.find(H=>{var Y,ie;return((ie=(Y=H.valueOwner)==null?void 0:Y.declaration)==null?void 0:ie.id)===I.inputs.connection.id}),x=((s=A==null?void 0:A.value)==null?void 0:s.valueAsType)??((u=A==null?void 0:A.value)==null?void 0:u.value);if(!x||!x.id||!x.name||x.type!==r.DefinitionEntity)throw new Error(`${R}Invalid input "${Ve(A==null?void 0:A.valueOwner,T==null?void 0:T.logic,"Connection")}" (\`${Be(A==null?void 0:A.valueOwner,T==null?void 0:T.logic,"connection")}\`), expected a valid connection node.`);const P=ui(x);if(!P)throw new Error(`${R}The "${Ve(A==null?void 0:A.valueOwner,T==null?void 0:T.logic,"Connection")}" (\`${Be(A==null?void 0:A.valueOwner,T==null?void 0:T.logic,"connection")}\`) input is invalid, missing underlying Connection ID value.`);const O=n.find(H=>{var Y,ie;return((ie=(Y=H.valueOwner)==null?void 0:Y.declaration)==null?void 0:ie.id)===I.inputs.prompt.id}),$=(e=O==null?void 0:O.value)==null?void 0:e.value;if($==null||$==="")throw new Error(`${R}The "${Ve(O==null?void 0:O.valueOwner,T==null?void 0:T.logic,"Prompt")}" (\`${Be(O==null?void 0:O.valueOwner,T==null?void 0:T.logic,"prompt")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${R}The "${Ve(O==null?void 0:O.valueOwner,T==null?void 0:T.logic,"Prompt")}" (\`${Be(O==null?void 0:O.valueOwner,T==null?void 0:T.logic,"prompt")}\`) input value is invalid, if present, it must be a non-empty string.`);const U=n.find(H=>{var Y,ie;return((ie=(Y=H.valueOwner)==null?void 0:Y.declaration)==null?void 0:ie.id)===I.inputs.model.id}),Z=(f=U==null?void 0:U.value)==null?void 0:f.value;if(Z==null||Z==="")throw new Error(`${R}The "${Ve(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"Model")}" (\`${Be(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"model")}\`) input is missing.`);if(typeof Z!="string")throw new Error(`${R}The "${Ve(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"Model")}" (\`${Be(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"model")}\`) input value is invalid, if present, it must be a non-empty string.`);ui(x),console.log("Triggering Google Gemini generate content action with connectionId:",P);const j=await(await Ht.post(`${(y=T.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v1/external-integrations/trigger-action/${Zt["google-gemini"]}/${P}/generate-content`,{payload:{prompt:$,model:Z}},{headers:{"Content-Type":"application/json",Authorization:`Bearer ${await T.getAccessToken()}`}})).data;return pe.Logger.log("[Google Gemini] Generate content action response:",j),{value:K.Success,error:null,result:{content:j.content}}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return pe.Logger.error("[Google Gemini] Generate content failed:",g),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:g,result:null}}}})}}class WAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsCreateSpreadsheet,version:"1.0.0",description:"Create Spreadsheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsCreateSpreadsheet);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f;try{const y=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!y||!y.env)throw new Error("Editor context or environment missing");const m=Be(t,t.project,"createSpreadsheet"),g="["+Ve(t,t.project,"Create spreadsheet")+": `"+m+"`] ",b=(ie,W,z)=>{const J=Ve(ie==null?void 0:ie.valueOwner,y==null?void 0:y.logic,W),ee=Be(ie==null?void 0:ie.valueOwner,y==null?void 0:y.logic,z);return`"${J}" (\`${ee}\`)`},R=n.find(ie=>{var W;return((W=ie.valueOwner.declaration)==null?void 0:W.id)===G.operation[X.GoogleSheetsCreateSpreadsheet].inputs.connection.id}),I=(s=R==null?void 0:R.value)==null?void 0:s.valueAsType;if(!I||!I.id||!I.name||I.type!==r.DefinitionEntity)throw new Error(`${g}The ${b(R,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const A=ui(I);if(!A)throw new Error(`${g}The ${b(R,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(ie=>{var W;return((W=ie.valueOwner.declaration)==null?void 0:W.id)===G.operation[X.GoogleSheetsCreateSpreadsheet].inputs.title.id}),P=(u=x==null?void 0:x.value)==null?void 0:u.value;if(P&&typeof P!="string")throw new Error(`${g}The ${b(x,"Title","title")} input value is invalid. If present, it must be a non-empty string. E.g. "My Spreadsheet"`);const $={Authorization:`Bearer ${await y.getAccessToken()}`},U=`${(e=y.env)==null?void 0:e.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${y.projectId}/${Zt["google-sheet"]}/${A}`,Z=async ie=>Ht.post(U,ie,{headers:$}),j={};P&&(j.properties={title:P});const Y=(await Z({method:"POST",endpoint:"/v4/spreadsheets",data:j})).data||{};return{value:K.Success,error:null,result:{spreadsheetId:Y.spreadsheetId,spreadsheetUrl:Y.spreadsheetUrl}}}catch(y){const m=((f=y.response)==null?void 0:f.data)||y.message||y;return pe.Logger.log("[Google Sheets] error:",m),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:m,result:null}}}})}}function QL(a){let p="",t=a;for(;t>0;){const n=(t-1)%26;p=String.fromCharCode(65+n)+p,t=Math.floor((t-n)/26)}return p}function DV(a){if(!/^[A-Z]{1,3}$/.test(a))return NaN;let p=0;for(let t=0;t<a.length;t++)p=p*26+(a.charCodeAt(t)-64);return p}function yA(a,p){const t=(p==null?void 0:p.errorPrefix)||"";if(typeof a!="string")throw new Error(`${t}Input must be a string.`);let n,s=a;if(a.includes("!")){const R=a.split("!");let I=R.slice(0,-1).join("!");s=R[R.length-1],I.startsWith("'")&&I.endsWith("'")&&(I=I.slice(1,-1)),n=I}const u=/^(\$?[A-Z]{1,3})?(\$?\d+)?(?::(\$?[A-Z]{1,3})?(\$?\d+)?)?$/i,e=s.match(u);if(!e)throw new Error(`${t}Invalid A1 notation format: ${a}`);const[f,y,m,T,g]=e,b={sheet:n};return y&&(b.startColumn=y.toUpperCase()),m&&(b.startRow=m),T&&(b.endColumn=T.toUpperCase()),g&&(b.endRow=g),b}function k4(a,p){const t=p!=null&&p.errorPrefix?p.errorPrefix:"",n=T=>{if(typeof T=="string"){const g=T.replace("$","");return/^\d+$/.test(g)?parseInt(g,10):NaN}return T},s=T=>{if(typeof T=="string"){const g=T.replace("$","").toUpperCase();return/^\d+$/.test(g)?parseInt(g,10):DV(g)}return T},u=n(a.startRow),e=n(a.endRow),f=s(a.startColumn),y=s(a.endColumn),m=T=>typeof T=="string"&&T.includes("{{")&&T.includes("}}");if(a.startRow!==void 0&&a.startRow!==null&&a.startRow!==""&&isNaN(u)&&!m(a.startRow))throw new Error(`${t}Start Row is invalid.`);if(a.endRow!==void 0&&a.endRow!==null&&a.endRow!==""&&isNaN(e)&&!m(a.endRow))throw new Error(`${t}End Row is invalid.`);if(a.startColumn!==void 0&&a.startColumn!==null&&a.startColumn!==""&&isNaN(f)&&!m(a.startColumn))throw new Error(`${t}Start Column is invalid.`);if(a.endColumn!==void 0&&a.endColumn!==null&&a.endColumn!==""&&isNaN(y)&&!m(a.endColumn))throw new Error(`${t}End Column is invalid.`);if(u!=null&&!isNaN(u)&&u<1)throw new Error(`${t}Start Row must be greater than or equal to 1.`);if(e!=null&&!isNaN(e)&&e<1)throw new Error(`${t}End Row must be greater than or equal to 1.`);if(f!=null&&!isNaN(f)&&f<1)throw new Error(`${t}Start Column must be greater than or equal to 1.`);if(y!=null&&!isNaN(y)&&y<1)throw new Error(`${t}End Column must be greater than or equal to 1.`);if(u!=null&&!isNaN(u)&&e!==void 0&&e!==null&&!isNaN(e)&&u>e)throw new Error(`${t}Start Row must be less than or equal to End Row.`);if(f!=null&&!isNaN(f)&&y!==void 0&&y!==null&&!isNaN(y)&&f>y)throw new Error(`${t}Start Column must be less than or equal to End Column.`);if(typeof a.sheet=="number"&&a.sheet<0)throw new Error(`${t}Sheet ID must be greater than or equal to 0.`)}async function Ha(a,p,t){if(!a)return a;let n=a;if(typeof a=="string"){const f=a.trim();if(f.startsWith("{"))try{n=new Function("return "+f)()}catch{try{n=JSON.parse(f)}catch{}}else try{n=yA(f,{errorPrefix:"Internal"})}catch{}}else if(typeof a=="object"&&a!==null)try{n=JSON.parse(JSON.stringify(a))}catch{n={...a}}if(n.sheet===void 0||n.sheet===null||n.sheet==="")return n;const s=typeof n.sheet=="string",u=typeof n.sheet=="number";if(p==="Name"&&s)return n;if(p==="Id"&&u)return n._resolvedSheetId=n.sheet,n;const e=n.sheet;try{const f=await t();for(const y of f){const m=y.id,T=y.name,g=String(T).trim().toLowerCase()===String(e).trim().toLowerCase(),b=String(m)===String(e);if(g||b)return n._resolvedSheetId=m,n._resolvedSheetName=T,n}}catch{}return n}function lv(a,p){if(!a)return"";if(typeof a=="string")return a;let t=a;if(typeof a=="string"&&a.trim().startsWith("{"))try{t=JSON.parse(a)}catch{}if(k4(t,p),t.namedRange&&t.namedRange.trim()!=="")return t.namedRange;const n=t._resolvedSheetName!==void 0?t._resolvedSheetName:typeof t.sheet=="string"?t.sheet:void 0,s=n?`'${n}'!`:"",u=R=>{if(typeof R=="number")return QL(R);if(typeof R=="string"){const I=R.replace("$","");if(/^\d+$/.test(I))return(R.startsWith("$")?"$":"")+QL(parseInt(I,10))}return R||""},e=u(t.startColumn),f=typeof t.startRow=="number"?t.startRow.toString():t.startRow||"",y=u(t.endColumn),m=typeof t.endRow=="number"?t.endRow.toString():t.endRow||"",T=`${e}${f}`,g=`${y}${m}`;if(T&&g)return`${s}${T}:${g}`;if(T)return`${s}${T}`;const b=s.replace(/!$/,"");return b||"A1"}function ps(a,p){if(!a)return{};let t=a;if(typeof a=="string"){const g=a.trim();if(g.startsWith("{"))try{t=new Function("return "+g)()}catch{try{t=JSON.parse(g)}catch{}}else try{t=yA(g,p)}catch{}}k4(t,p);const n={},s=t._resolvedSheetId!==void 0?t._resolvedSheetId:typeof t.sheet=="number"?t.sheet:/^\d+$/.test(String(t.sheet||""))?Number(t.sheet):void 0;s!=null&&!isNaN(s)&&(n.sheetId=s);const u=g=>{if(g==null)return null;if(typeof g=="string"){const b=g.trim().replace("$","");return b===""?null:/^\d+$/.test(b)?parseInt(b,10):NaN}return typeof g=="number"?g:null},e=g=>{if(g==null)return null;if(typeof g=="string"){const b=g.trim().replace("$","").toUpperCase();return b===""?null:/^\d+$/.test(b)?parseInt(b,10):DV(b)}return typeof g=="number"?g:null},f=u(t.startRow),y=u(t.endRow),m=e(t.startColumn),T=e(t.endColumn);return f!=null&&(n.startRowIndex=f-1),y!=null&&(n.endRowIndex=y),m!=null&&(n.startColumnIndex=m-1),T!=null&&(n.endColumnIndex=T),n}function XL(a,p){if(!a)return{};let t=a;if(typeof a=="string")if(a.trim().startsWith("{"))try{t=JSON.parse(a)}catch{t=yA(a,{errorPrefix:"Internal"})}else t=yA(a,{errorPrefix:"Internal"});k4(t,p);const n={},s=t._resolvedSheetId!==void 0?t._resolvedSheetId:typeof t.sheet=="number"?t.sheet:void 0;s!=null&&(n.sheetId=s);const u=g=>{if(g==null)return null;if(typeof g=="string"){const b=g.trim().replace("$","");return b===""?null:/^\d+$/.test(b)?parseInt(b,10):NaN}return typeof g=="number"?g:null},e=g=>{if(g==null)return null;if(typeof g=="string"){const b=g.trim().replace("$","").toUpperCase();return b===""?null:/^\d+$/.test(b)?parseInt(b,10):DV(b)}return typeof g=="number"?g:null},f=u(t.startRow),y=u(t.endRow),m=e(t.startColumn),T=e(t.endColumn);return f!=null&&(!isNaN(f)||y===null&&m===null&&T===null)?(n.dimension="ROWS",n.startIndex=isNaN(f)?NaN:f-1,y!=null?n.endIndex=y:n.endIndex=isNaN(f)?NaN:f):m!=null?(n.dimension="COLUMNS",n.startIndex=isNaN(m)?NaN:m-1,T!=null?n.endIndex=T:n.endIndex=isNaN(m)?NaN:m):f!=null&&(n.dimension="ROWS",n.startIndex=isNaN(f)?NaN:f-1,y!=null?n.endIndex=y:n.endIndex=isNaN(f)?NaN:f),n}function ln(a,p){const t=(p==null?void 0:p.errorPrefix)||"";if(typeof a!="string")throw new Error(`${t}Spreadsheet ID must be a string.`);const n=a.trim();if(n.length===0)throw new Error(`${t}Spreadsheet ID cannot be empty.`);if(n.includes("docs.google.com")||n.startsWith("http://")||n.startsWith("https://")||n.startsWith("www.google.com")){const u=n.match(/\/spreadsheets\/d\/e\/([a-zA-Z0-9-_]+)/);if(u&&u[1])return u[1];const e=n.match(/\/spreadsheets\/d\/([a-zA-Z0-9-_]+)/);if(e&&e[1])return e[1];throw new Error(`${t}Invalid Google Sheet URL format. Could not extract a valid Spreadsheet ID from the URL.`)}if(n.includes(" "))throw new Error(`${t}Spreadsheet ID cannot contain spaces.`);if(/[^a-zA-Z0-9-_]/.test(n))throw new Error(`${t}Spreadsheet ID contains invalid characters. Only alphanumeric characters, dashes, and underscores are allowed.`);return n}function zAt(a){if(!a)return"A1";const p=lv(a);if(!p)return"A1";const t=p.split("!");return t[t.length-1].trim().split(":")[0].trim().replace(/\$/g,"")||"A1"}function U4(a,p,t){if(!p){const f=XL(a,t);return f?[f]:[]}const n=ps(a,t),s=n.sheetId,u=f=>{const y={dimension:f};return s!=null&&(y.sheetId=s),f==="COLUMNS"?(n.startColumnIndex!==void 0&&n.startColumnIndex!==null&&(y.startIndex=n.startColumnIndex),n.endColumnIndex!==void 0&&n.endColumnIndex!==null&&(y.endIndex=n.endColumnIndex)):(n.startRowIndex!==void 0&&n.startRowIndex!==null&&(y.startIndex=n.startRowIndex),n.endRowIndex!==void 0&&n.endRowIndex!==null&&(y.endIndex=n.endRowIndex)),y},e=String(p).trim().toUpperCase();return e==="COLUMNS"?[u("COLUMNS")]:e==="ROWS"?[u("ROWS")]:e==="BOTH"?[u("COLUMNS"),u("ROWS")]:[XL(a,t)]}class YAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsGetSpreadsheet,version:"1.0.0",description:"Get Spreadsheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsGetSpreadsheet);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g;try{const b=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!b||!b.env)throw new Error("Editor context or environment missing");const R=Be(t,t.project,"getSpreadsheet"),A="["+Ve(t,t.project,"Get spreadsheet")+": `"+R+"`] ",x=(Q,re,ae)=>{const le=Ve(Q==null?void 0:Q.valueOwner,b==null?void 0:b.logic,re),oe=Be(Q==null?void 0:Q.valueOwner,b==null?void 0:b.logic,ae);return`"${le}" (\`${oe}\`)`},P=n.find(Q=>{var re;return((re=Q.valueOwner.declaration)==null?void 0:re.id)===G.operation[X.GoogleSheetsGetSpreadsheet].inputs.connection.id}),O=(s=P==null?void 0:P.value)==null?void 0:s.valueAsType;if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${A}The ${x(P,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const $=ui(O);if(!$)throw new Error(`${A}The ${x(P,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const U=n.find(Q=>{var re;return((re=Q.valueOwner.declaration)==null?void 0:re.id)===G.operation[X.GoogleSheetsGetSpreadsheet].inputs.spreadsheetId.id}),Z=(u=U==null?void 0:U.value)==null?void 0:u.value,j=ln(Z,{errorPrefix:`${A}The ${x(U,"Spreadsheet ID","spreadsheetId")} input `}),Y={Authorization:`Bearer ${await b.getAccessToken()}`},ie=`${(e=b.env)==null?void 0:e.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${b.projectId}/${Zt["google-sheet"]}/${$}`,J=(await(async Q=>Ht.post(ie,Q,{headers:Y}))({method:"GET",endpoint:`/v4/spreadsheets/${j}`})).data||{},ee=(J.sheets||[]).map(Q=>{var re,ae,le,oe,ce,be,Ce,Ee,xe,Le,Fe,tt,We;return{sheetId:(re=Q.properties)==null?void 0:re.sheetId,title:(ae=Q.properties)==null?void 0:ae.title,index:(le=Q.properties)==null?void 0:le.index,sheetType:(oe=Q.properties)==null?void 0:oe.sheetType,rowCount:(be=(ce=Q.properties)==null?void 0:ce.gridProperties)==null?void 0:be.rowCount,columnCount:(Ee=(Ce=Q.properties)==null?void 0:Ce.gridProperties)==null?void 0:Ee.columnCount,frozenRowCount:(Le=(xe=Q.properties)==null?void 0:xe.gridProperties)==null?void 0:Le.frozenRowCount,frozenColumnCount:(tt=(Fe=Q.properties)==null?void 0:Fe.gridProperties)==null?void 0:tt.frozenColumnCount,hidden:((We=Q.properties)==null?void 0:We.hidden)??!1}});return{value:K.Success,error:null,result:{spreadsheetId:J.spreadsheetId,title:(f=J.properties)==null?void 0:f.title,spreadsheetUrl:J.spreadsheetUrl,locale:(y=J.properties)==null?void 0:y.locale,timeZone:(m=J.properties)==null?void 0:m.timeZone,autoRecalc:(T=J.properties)==null?void 0:T.autoRecalc,sheets:ee}}}catch(b){const R=((g=b.response)==null?void 0:g.data)||b.message||b;return pe.Logger.log("[Google Sheets] error:",R),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:R,result:null}}}})}}class JAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsAddSheet,version:"1.0.0",description:"Add Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsAddSheet);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g;try{const b=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!b||!b.env)throw new Error("Editor context or environment missing");const R=Be(t,t.project,"addSheet"),A="["+Ve(t,t.project,"Add sheet")+": `"+R+"`] ",x=(oe,ce,be)=>{const Ce=Ve(oe==null?void 0:oe.valueOwner,b==null?void 0:b.logic,ce),Ee=Be(oe==null?void 0:oe.valueOwner,b==null?void 0:b.logic,be);return`"${Ce}" (\`${Ee}\`)`},P=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[X.GoogleSheetsAddSheet].inputs.connection.id}),O=(s=P==null?void 0:P.value)==null?void 0:s.valueAsType;if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${A}The ${x(P,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const $=ui(O);if(!$)throw new Error(`${A}The ${x(P,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const U=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[X.GoogleSheetsAddSheet].inputs.spreadsheetId.id}),Z=(u=U==null?void 0:U.value)==null?void 0:u.value,j=ln(Z,{errorPrefix:`${A}The ${x(U,"Spreadsheet ID","spreadsheetId")} input `}),H=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[X.GoogleSheetsAddSheet].inputs.title.id}),Y=(e=H==null?void 0:H.value)==null?void 0:e.value;if(Y!=null&&typeof Y!="string")throw new Error(`${A}The ${x(H,"Title","title")} input value is invalid. If present, it must be a string. E.g. "New Sheet"`);const W={Authorization:`Bearer ${await b.getAccessToken()}`},z=`${(f=b.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${b.projectId}/${Zt["google-sheet"]}/${$}`,re=((T=(m=(y=((await(async oe=>Ht.post(z,oe,{headers:W}))({method:"POST",endpoint:`/v4/spreadsheets/${j}:batchUpdate`,data:{requests:[{addSheet:{properties:{title:Y}}}]}})).data||{}).replies)==null?void 0:y[0])==null?void 0:m.addSheet)==null?void 0:T.properties)||{},ae=re.gridProperties||{},le={sheetId:re.sheetId,title:re.title,index:re.index,sheetType:re.sheetType,rowCount:ae.rowCount,columnCount:ae.columnCount,frozenRowCount:ae.frozenRowCount,frozenColumnCount:ae.frozenColumnCount,hideGridlines:ae.hideGridlines??!1,rowGroupControlAfter:ae.rowGroupControlAfter??!1,columnGroupControlAfter:ae.columnGroupControlAfter??!1,hidden:re.hidden??!1,rightToLeft:re.rightToLeft??!1,tabColor:re.tabColor?{red:re.tabColor.red??0,green:re.tabColor.green??0,blue:re.tabColor.blue??0,alpha:re.tabColor.alpha??1}:null,basicFilter:null,protectedRanges:[],bandedRanges:[],charts:[],conditionalFormatRules:[],mergedCells:[]};return{value:K.Success,error:null,result:le}}catch(b){const R=((g=b.response)==null?void 0:g.data)||b.message||b;return pe.Logger.log("[Google Sheets] error:",R),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:R,result:null}}}})}}class QAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsDeleteSheet,version:"1.0.0",description:"Delete Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsDeleteSheet);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T;try{const g=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!g||!g.env)throw new Error("Editor context or environment missing");const b=Be(t,t.project,"deleteSheet"),I="["+Ve(t,t.project,"Delete sheet")+": `"+b+"`] ",A=(ee,Q,re)=>{const ae=Ve(ee==null?void 0:ee.valueOwner,g==null?void 0:g.logic,Q),le=Be(ee==null?void 0:ee.valueOwner,g==null?void 0:g.logic,re);return`"${ae}" (\`${le}\`)`},x=n.find(ee=>{var Q;return((Q=ee.valueOwner.declaration)==null?void 0:Q.id)===G.operation[X.GoogleSheetsDeleteSheet].inputs.connection.id}),P=(s=x==null?void 0:x.value)==null?void 0:s.valueAsType;if(!P||!P.id||!P.name||P.type!==r.DefinitionEntity)throw new Error(`${I}The ${A(x,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(P);if(!O)throw new Error(`${I}The ${A(x,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const $=n.find(ee=>{var Q;return((Q=ee.valueOwner.declaration)==null?void 0:Q.id)===G.operation[X.GoogleSheetsDeleteSheet].inputs.spreadsheetId.id}),U=(u=$==null?void 0:$.value)==null?void 0:u.value,Z=ln(U,{errorPrefix:`${I}The ${A($,"Spreadsheet ID","spreadsheetId")} input `}),j=n.find(ee=>{var Q;return((Q=ee.valueOwner.declaration)==null?void 0:Q.id)===G.operation[X.GoogleSheetsDeleteSheet].inputs.sheetId.id}),H=(e=j==null?void 0:j.value)==null?void 0:e.value;if(H==null||H==="")throw new Error(`${I}The ${A(j,"Sheet (ID or name)","sheetId")} input is missing.`);const ie={Authorization:`Bearer ${await g.getAccessToken()}`},W=`${(f=g.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${g.projectId}/${Zt["google-sheet"]}/${O}`,z=async ee=>Ht.post(W,ee,{headers:ie});let J;if(typeof H=="number")J=H;else if(typeof H=="string"){const ee=H.trim(),Q=await z({method:"GET",endpoint:`/v4/spreadsheets/${Z}?fields=sheets.properties(sheetId,title)`}).catch(()=>null),ae=(((y=Q==null?void 0:Q.data)==null?void 0:y.sheets)||[]).find(le=>{var oe,ce;return((oe=le.properties)==null?void 0:oe.title)===ee||String((ce=le.properties)==null?void 0:ce.sheetId)===ee});if(ae&&((m=ae.properties)==null?void 0:m.sheetId)!==void 0)J=ae.properties.sheetId;else if(/^\d+$/.test(ee))J=parseInt(ee,10);else throw new Error(`${I}Sheet "${H}" was not found in the spreadsheet.`)}else throw new Error(`${I}The ${A(j,"Sheet (ID or name)","sheetId")} input value is invalid. It must be a number or string.`);return await z({method:"POST",endpoint:`/v4/spreadsheets/${Z}:batchUpdate`,data:{requests:[{deleteSheet:{sheetId:J}}]}}),{value:K.Success,error:null,result:null}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return pe.Logger.log("[Google Sheets] error:",b),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:b,result:null}}}})}}class XAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsAppendRows,version:"1.0.0",description:"Append Row(s) Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsAppendRows);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T;try{const g=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!g||!g.env)throw new Error("Editor context or environment missing");const b=Be(t,t.project,"appendRows"),I="["+Ve(t,t.project,"Append rows")+": `"+b+"`] ",A=(oe,ce,be)=>{const Ce=Ve(oe==null?void 0:oe.valueOwner,g==null?void 0:g.logic,ce),Ee=Be(oe==null?void 0:oe.valueOwner,g==null?void 0:g.logic,be);return`"${Ce}" (\`${Ee}\`)`},x=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[X.GoogleSheetsAppendRows].inputs.connection.id}),P=(s=x==null?void 0:x.value)==null?void 0:s.valueAsType;if(!P||!P.id||!P.name||P.type!==r.DefinitionEntity)throw new Error(`${I}The ${A(x,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(P);if(!O)throw new Error(`${I}The ${A(x,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const $=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[X.GoogleSheetsAppendRows].inputs.spreadsheetId.id}),U=(u=$==null?void 0:$.value)==null?void 0:u.value,Z=ln(U,{errorPrefix:`${I}The ${A($,"Spreadsheet ID","spreadsheetId")} input `}),j=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[X.GoogleSheetsAppendRows].inputs.range.id}),H=(e=j==null?void 0:j.value)==null?void 0:e.value;if(!H||H==="")throw new Error(`${I}The ${A(j,"Range","range")} input is missing.`);const Y=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[X.GoogleSheetsAppendRows].inputs.values.id}),ie=(f=Y==null?void 0:Y.value)==null?void 0:f.value;if(ie==null)throw new Error(`${I}The ${A(Y,"Values","values")} input is missing.`);const 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}/${Zt["google-sheet"]}/${O}`,ee=async oe=>Ht.post(J,oe,{headers:z});let Q=ie;if(typeof ie=="string")try{Q=JSON.parse(ie)}catch{}const re=await Ha(H,"Name",async()=>{var ce;return(((ce=(await ee({method:"GET",endpoint:`/v4/spreadsheets/${Z}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:ce.sheets)||[]).map(be=>{var Ce,Ee;return{id:(Ce=be.properties)==null?void 0:Ce.sheetId,name:(Ee=be.properties)==null?void 0:Ee.title}})}),le=(await ee({method:"POST",endpoint:`/v4/spreadsheets/${Z}/values/${lv(re,{errorPrefix:`${I}The ${A(j,"Range","range")} input `})}:append`,params:{valueInputOption:"USER_ENTERED"},data:{values:Array.isArray(Q)?Q:[Q]}})).data||{};return{value:K.Success,error:null,result:{updatedRange:(m=le.updates)==null?void 0:m.updatedRange}}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return pe.Logger.log("[Google Sheets] error:",b),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:b,result:null}}}})}}class e1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsGetRangeValues,version:"1.0.0",description:"Get Range Values Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsGetRangeValues);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"getRangeValues"),b="["+Ve(t,t.project,"Get range values")+": `"+T+"`] ",R=(Q,re,ae)=>{const le=Ve(Q==null?void 0:Q.valueOwner,m==null?void 0:m.logic,re),oe=Be(Q==null?void 0:Q.valueOwner,m==null?void 0:m.logic,ae);return`"${le}" (\`${oe}\`)`},I=n.find(Q=>{var re;return((re=Q.valueOwner.declaration)==null?void 0:re.id)===G.operation[X.GoogleSheetsGetRangeValues].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=ui(A);if(!x)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(Q=>{var re;return((re=Q.valueOwner.declaration)==null?void 0:re.id)===G.operation[X.GoogleSheetsGetRangeValues].inputs.spreadsheetId.id}),O=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(O,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(Q=>{var re;return((re=Q.valueOwner.declaration)==null?void 0:re.id)===G.operation[X.GoogleSheetsGetRangeValues].inputs.range.id}),Z=(e=U==null?void 0:U.value)==null?void 0:e.value;if(!Z||Z==="")throw new Error(`${b}The ${R(U,"Range","range")} input is missing.`);const H={Authorization:`Bearer ${await m.getAccessToken()}`},Y=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${x}`,ie=async Q=>Ht.post(Y,Q,{headers:H}),W=await Ha(Z,"Name",async()=>{var re;return(((re=(await ie({method:"GET",endpoint:`/v4/spreadsheets/${$}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:re.sheets)||[]).map(ae=>{var le,oe;return{id:(le=ae.properties)==null?void 0:le.sheetId,name:(oe=ae.properties)==null?void 0:oe.title}})}),z=lv(W,{errorPrefix:`${b}The ${R(U,"Range","range")} input `}),ee=(await ie({method:"GET",endpoint:`/v4/spreadsheets/${$}/values/${encodeURIComponent(z)}`})).data||{};return{value:K.Success,error:null,result:{values:ee.values}}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class t1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsUpdateRangeValues,version:"1.0.0",description:"Update Range Values Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsUpdateRangeValues);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=Be(t,t.project,"updateRangeValues"),R="["+Ve(t,t.project,"Update range values")+": `"+g+"`] ",I=(le,oe,ce)=>{const be=Ve(le==null?void 0:le.valueOwner,T==null?void 0:T.logic,oe),Ce=Be(le==null?void 0:le.valueOwner,T==null?void 0:T.logic,ce);return`"${be}" (\`${Ce}\`)`},A=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[X.GoogleSheetsUpdateRangeValues].inputs.connection.id}),x=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!x||!x.id||!x.name||x.type!==r.DefinitionEntity)throw new Error(`${R}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const P=ui(x);if(!P)throw new Error(`${R}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const O=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[X.GoogleSheetsUpdateRangeValues].inputs.spreadsheetId.id}),$=(u=O==null?void 0:O.value)==null?void 0:u.value,U=ln($,{errorPrefix:`${R}The ${I(O,"Spreadsheet ID","spreadsheetId")} input `}),Z=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[X.GoogleSheetsUpdateRangeValues].inputs.range.id}),j=(e=Z==null?void 0:Z.value)==null?void 0:e.value;if(!j||j==="")throw new Error(`${R}The ${I(Z,"Range","range")} input is missing.`);const H=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[X.GoogleSheetsUpdateRangeValues].inputs.values.id}),Y=(f=H==null?void 0:H.value)==null?void 0:f.value;if(Y==null)throw new Error(`${R}The ${I(H,"Values","values")} input is missing.`);const W={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}/${Zt["google-sheet"]}/${P}`,J=async le=>Ht.post(z,le,{headers:W});let ee=Y;if(typeof Y=="string")try{ee=JSON.parse(Y)}catch{}const Q=await Ha(j,"Name",async()=>{var oe;return(((oe=(await J({method:"GET",endpoint:`/v4/spreadsheets/${U}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:oe.sheets)||[]).map(ce=>{var be,Ce;return{id:(be=ce.properties)==null?void 0:be.sheetId,name:(Ce=ce.properties)==null?void 0:Ce.title}})}),ae=(await J({method:"PUT",endpoint:`/v4/spreadsheets/${U}/values/${lv(Q,{errorPrefix:`${R}The ${I(Z,"Range","range")} input `})}`,params:{valueInputOption:"USER_ENTERED"},data:{values:Array.isArray(ee)?ee:[ee]}})).data||{};return{value:K.Success,error:null,result:{updatedRange:ae.updatedRange}}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return pe.Logger.log("[Google Sheets] error:",g),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:g,result:null}}}})}}class i1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsClearRange,version:"1.0.0",description:"Clear Range Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsClearRange);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"clearRange"),b="["+Ve(t,t.project,"Clear range")+": `"+T+"`] ",R=(ee,Q,re)=>{const ae=Ve(ee==null?void 0:ee.valueOwner,m==null?void 0:m.logic,Q),le=Be(ee==null?void 0:ee.valueOwner,m==null?void 0:m.logic,re);return`"${ae}" (\`${le}\`)`},I=n.find(ee=>{var Q;return((Q=ee.valueOwner.declaration)==null?void 0:Q.id)===G.operation[X.GoogleSheetsClearRange].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=ui(A);if(!x)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(ee=>{var Q;return((Q=ee.valueOwner.declaration)==null?void 0:Q.id)===G.operation[X.GoogleSheetsClearRange].inputs.spreadsheetId.id}),O=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(O,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(ee=>{var Q;return((Q=ee.valueOwner.declaration)==null?void 0:Q.id)===G.operation[X.GoogleSheetsClearRange].inputs.range.id}),Z=(e=U==null?void 0:U.value)==null?void 0:e.value;if(!Z||Z==="")throw new Error(`${b}The ${R(U,"Range","range")} input is missing.`);const H={Authorization:`Bearer ${await m.getAccessToken()}`},Y=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${x}`,ie=async ee=>Ht.post(Y,ee,{headers:H}),W=await Ha(Z,"Name",async()=>{var Q;return(((Q=(await ie({method:"GET",endpoint:`/v4/spreadsheets/${$}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:Q.sheets)||[]).map(re=>{var ae,le;return{id:(ae=re.properties)==null?void 0:ae.sheetId,name:(le=re.properties)==null?void 0:le.title}})}),J=(await ie({method:"POST",endpoint:`/v4/spreadsheets/${$}/values/${lv(W,{errorPrefix:`${b}The ${R(U,"Range","range")} input `})}:clear`,data:{}})).data||{};return{value:K.Success,error:null,result:{clearedRange:J.clearedRange}}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class n1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsBatchUpdateSpreadsheet,version:"1.0.0",description:"Batch Update Spreadsheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsBatchUpdateSpreadsheet);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"batchUpdateSpreadsheet"),b="["+Ve(t,t.project,"Batch update spreadsheet")+": `"+T+"`] ",R=(ee,Q,re)=>{const ae=Ve(ee==null?void 0:ee.valueOwner,m==null?void 0:m.logic,Q),le=Be(ee==null?void 0:ee.valueOwner,m==null?void 0:m.logic,re);return`"${ae}" (\`${le}\`)`},I=n.find(ee=>{var Q;return((Q=ee.valueOwner.declaration)==null?void 0:Q.id)===G.operation[X.GoogleSheetsBatchUpdateSpreadsheet].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=ui(A);if(!x)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(ee=>{var Q;return((Q=ee.valueOwner.declaration)==null?void 0:Q.id)===G.operation[X.GoogleSheetsBatchUpdateSpreadsheet].inputs.spreadsheetId.id}),O=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(O,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(ee=>{var Q;return((Q=ee.valueOwner.declaration)==null?void 0:Q.id)===G.operation[X.GoogleSheetsBatchUpdateSpreadsheet].inputs.requests.id}),Z=(e=U==null?void 0:U.value)==null?void 0:e.value;if(Z==null||Z==="")throw new Error(`${b}The ${R(U,"Requests","requests")} input is missing.`);let j=Z;if(typeof Z=="string")try{j=JSON.parse(Z)}catch{}if(Array.isArray(j)||(j=[j]),j.length===0)throw new Error(`${b}The ${R(U,"Requests","requests")} input evaluated to an empty array. E.g. [{ addSheet: { properties: { title: "New Sheet" } } }]`);const Y={Authorization:`Bearer ${await m.getAccessToken()}`},ie=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${x}`,J=(await(async ee=>Ht.post(ie,ee,{headers:Y}))({method:"POST",endpoint:`/v4/spreadsheets/${$}:batchUpdate`,data:{requests:j}})).data||{};return{value:K.Success,result:{replies:J.replies||[]},error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class r1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsRenameSheet,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsRenameSheet);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g;try{const b=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!b||!b.env)throw new Error("Editor context or environment missing");const R=Be(t,t.project,"renameSheet"),A="["+Ve(t,t.project,"Rename sheet")+": `"+R+"`] ",x=(oe,ce,be)=>{const Ce=Ve(oe==null?void 0:oe.valueOwner,b==null?void 0:b.logic,ce),Ee=Be(oe==null?void 0:oe.valueOwner,b==null?void 0:b.logic,be);return`"${Ce}" (\`${Ee}\`)`},P=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[X.GoogleSheetsRenameSheet].inputs.connection.id}),O=(s=P==null?void 0:P.value)==null?void 0:s.valueAsType;if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${A}The ${x(P,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const $=ui(O);if(!$)throw new Error(`${A}The ${x(P,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const U=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[X.GoogleSheetsRenameSheet].inputs.spreadsheetId.id}),Z=(u=U==null?void 0:U.value)==null?void 0:u.value,j=ln(Z,{errorPrefix:`${A}The ${x(U,"Spreadsheet ID","spreadsheetId")} input `}),H=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[X.GoogleSheetsRenameSheet].inputs.sheetId.id}),Y=(e=H==null?void 0:H.value)==null?void 0:e.value;if(Y==null||Y==="")throw new Error(`${A}The ${x(H,"Sheet (ID or name)","sheetId")} input is missing.`);const ie=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[X.GoogleSheetsRenameSheet].inputs.title.id}),W=(f=ie==null?void 0:ie.value)==null?void 0:f.value;if(W!=null&&typeof W!="string")throw new Error(`${A}The ${x(ie,"Title","title")} input value is invalid, if present, it must be a string.`);const J={Authorization:`Bearer ${await b.getAccessToken()}`},ee=`${(y=b.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${b.projectId}/${Zt["google-sheet"]}/${$}`,Q=async oe=>Ht.post(ee,oe,{headers:J});let re;if(typeof Y=="number")re=Y;else if(typeof Y=="string"){const oe=Y.trim(),ce=await Q({method:"GET",endpoint:`/v4/spreadsheets/${j}?fields=sheets.properties(sheetId,title)`}).catch(()=>null),Ce=(((m=ce==null?void 0:ce.data)==null?void 0:m.sheets)||[]).find(Ee=>{var xe,Le;return((xe=Ee.properties)==null?void 0:xe.title)===oe||String((Le=Ee.properties)==null?void 0:Le.sheetId)===oe});if(Ce&&((T=Ce.properties)==null?void 0:T.sheetId)!==void 0)re=Ce.properties.sheetId;else if(/^\d+$/.test(oe))re=parseInt(oe,10);else throw new Error(`${A}Sheet "${Y}" was not found in the spreadsheet.`)}else throw new Error(`${A}The ${x(H,"Sheet (ID or name)","sheetId")} input value is invalid. It must be a number or string.`);const ae={sheetId:re},le=[];return ae.title=W||"",le.push("title"),await Q({method:"POST",endpoint:`/v4/spreadsheets/${j}:batchUpdate`,data:{requests:[{updateSheetProperties:{properties:ae,fields:le.join(",")}}]}}),{value:K.Success,result:null,error:null}}catch(b){const R=((g=b.response)==null?void 0:g.data)||b.message||b;return pe.Logger.log("[Google Sheets] error:",R),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:R,result:null}}}})}}class a1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsCopySheet,version:"1.0.0",description:"Copy Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsCopySheet);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b;try{const R=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!R||!R.env)throw new Error("Editor context or environment missing");const I=Be(t,t.project,"copySheet"),x="["+Ve(t,t.project,"Copy sheet")+": `"+I+"`] ",P=(xe,Le,Fe)=>{const tt=Ve(xe==null?void 0:xe.valueOwner,R==null?void 0:R.logic,Le),We=Be(xe==null?void 0:xe.valueOwner,R==null?void 0:R.logic,Fe);return`"${tt}" (\`${We}\`)`},O=n.find(xe=>{var Le;return((Le=xe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[X.GoogleSheetsCopySheet].inputs.connection.id}),$=(s=O==null?void 0:O.value)==null?void 0:s.valueAsType;if(!$||!$.id||!$.name||$.type!==r.DefinitionEntity)throw new Error(`${x}The ${P(O,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const U=ui($);if(!U)throw new Error(`${x}The ${P(O,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const Z=n.find(xe=>{var Le;return((Le=xe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[X.GoogleSheetsCopySheet].inputs.spreadsheetId.id}),j=(u=Z==null?void 0:Z.value)==null?void 0:u.value,H=ln(j,{errorPrefix:`${x}The ${P(Z,"Spreadsheet ID","spreadsheetId")} input `}),Y=n.find(xe=>{var Le;return((Le=xe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[X.GoogleSheetsCopySheet].inputs.sheetId.id}),ie=(e=Y==null?void 0:Y.value)==null?void 0:e.value;if(ie==null||ie==="")throw new Error(`${x}The ${P(Y,"Sheet (ID or name)","sheetId")} input is missing.`);const W=n.find(xe=>{var Le;return((Le=xe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[X.GoogleSheetsCopySheet].inputs.destinationSpreadsheetId.id}),z=(f=W==null?void 0:W.value)==null?void 0:f.value;let J=H;if(z!=null&&String(z).trim()!==""){if(typeof z!="string")throw new Error(`${x}The ${P(W,"Destination Spreadsheet ID","destinationSpreadsheetId")} input value is invalid, if present, it must be a string.`);J=ln(z,{errorPrefix:`${x}The ${P(W,"Destination Spreadsheet ID","destinationSpreadsheetId")} input `})}const ee=n.find(xe=>{var Le;return((Le=xe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[X.GoogleSheetsCopySheet].inputs.newSheetName.id}),Q=(y=ee==null?void 0:ee.value)==null?void 0:y.value;if(Q!=null&&typeof Q!="string")throw new Error(`${x}The ${P(ee,"New Sheet Name","newSheetName")} input value is invalid, if present, it must be a string.`);const ae={Authorization:`Bearer ${await R.getAccessToken()}`},le=`${(m=R.env)==null?void 0:m.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${R.projectId}/${Zt["google-sheet"]}/${U}`,oe=async xe=>Ht.post(le,xe,{headers:ae});let ce;if(typeof ie=="number")ce=ie;else if(typeof ie=="string"){const xe=ie.trim(),Le=await oe({method:"GET",endpoint:`/v4/spreadsheets/${H}?fields=sheets.properties(sheetId,title)`}).catch(()=>null),tt=(((T=Le==null?void 0:Le.data)==null?void 0:T.sheets)||[]).find(We=>{var et,qe;return((et=We.properties)==null?void 0:et.title)===xe||String((qe=We.properties)==null?void 0:qe.sheetId)===xe});if(tt&&((g=tt.properties)==null?void 0:g.sheetId)!==void 0)ce=tt.properties.sheetId;else if(/^\d+$/.test(xe))ce=parseInt(xe,10);else throw new Error(`${x}Sheet "${ie}" was not found in the source spreadsheet.`)}else throw new Error(`${x}The ${P(Y,"Sheet (ID or name)","sheetId")} input value is invalid. It must be a number or string.`);const Ee=((await oe({method:"POST",endpoint:`/v4/spreadsheets/${H}/sheets/${ce}:copyTo`,data:{destinationSpreadsheetId:J}})).data||{}).sheetId;return Q&&typeof Q=="string"&&Q.trim()!==""&&await oe({method:"POST",endpoint:`/v4/spreadsheets/${J}:batchUpdate`,data:{requests:[{updateSheetProperties:{properties:{sheetId:Ee,title:Q.trim()},fields:"title"}}]}}),{value:K.Success,result:{newSheetId:Ee},error:null}}catch(R){const I=((b=R.response)==null?void 0:b.data)||R.message||R;return pe.Logger.log("[Google Sheets] error:",I),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:I,result:null}}}})}}class s1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsClearSheet,version:"1.0.0",description:"Clear Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsClearSheet);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b;try{const R=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!R||!R.env)throw new Error("Editor context or environment missing");const I=Be(t,t.project,"clearSheet"),x="["+Ve(t,t.project,"Clear sheet")+": `"+I+"`] ",P=(le,oe,ce)=>{const be=Ve(le==null?void 0:le.valueOwner,R==null?void 0:R.logic,oe),Ce=Be(le==null?void 0:le.valueOwner,R==null?void 0:R.logic,ce);return`"${be}" (\`${Ce}\`)`},O=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[X.GoogleSheetsClearSheet].inputs.connection.id}),$=(s=O==null?void 0:O.value)==null?void 0:s.valueAsType;if(!$||!$.id||!$.name||$.type!==r.DefinitionEntity)throw new Error(`${x}The ${P(O,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const U=ui($);if(!U)throw new Error(`${x}The ${P(O,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const Z=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[X.GoogleSheetsClearSheet].inputs.spreadsheetId.id}),j=(u=Z==null?void 0:Z.value)==null?void 0:u.value,H=ln(j,{errorPrefix:`${x}The ${P(Z,"Spreadsheet ID","spreadsheetId")} input `}),Y=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[X.GoogleSheetsClearSheet].inputs.sheetName.id}),ie=(e=Y==null?void 0:Y.value)==null?void 0:e.value;if(ie==null||ie==="")throw new Error(`${x}The ${P(Y,"Sheet (ID or name)","sheetName")} input is missing.`);const z={Authorization:`Bearer ${await R.getAccessToken()}`},J=`${(f=R.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${R.projectId}/${Zt["google-sheet"]}/${U}`,ee=async le=>Ht.post(J,le,{headers:z});let Q;if(typeof ie=="string"){const le=ie.trim();if(/^\d+$/.test(le)){const oe=await ee({method:"GET",endpoint:`/v4/spreadsheets/${H}?fields=sheets.properties(sheetId,title)`}).catch(()=>null),be=(((y=oe==null?void 0:oe.data)==null?void 0:y.sheets)||[]).find(Ce=>{var Ee,xe;return String((Ee=Ce.properties)==null?void 0:Ee.sheetId)===le||((xe=Ce.properties)==null?void 0:xe.title)===le});Q=((m=be==null?void 0:be.properties)==null?void 0:m.title)||le}else Q=le}else if(typeof ie=="number"){const ce=(((T=(await ee({method:"GET",endpoint:`/v4/spreadsheets/${H}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:T.sheets)||[]).find(be=>{var Ce;return Number((Ce=be.properties)==null?void 0:Ce.sheetId)===ie});if(!ce||!((g=ce.properties)!=null&&g.title))throw new Error(`${x}Sheet with ID ${ie} was not found in the spreadsheet.`);Q=ce.properties.title}else throw new Error(`${x}The ${P(Y,"Sheet (ID or name)","sheetName")} input value is invalid. It must be a number or string.`);const ae=(await ee({method:"POST",endpoint:`/v4/spreadsheets/${H}/values/${encodeURIComponent(Q)}:clear`,data:{}})).data||{};return{value:K.Success,result:{clearedRange:ae.clearedRange},error:null}}catch(R){const I=((b=R.response)==null?void 0:b.data)||R.message||R;return pe.Logger.log("[Google Sheets] error:",I),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:I,result:null}}}})}}class l1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsBatchGetValues,version:"1.0.0",description:"Batch Get Values Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsBatchGetValues);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T;try{const g=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!g||!g.env)throw new Error("Editor context or environment missing");const b=Be(t,t.project,"batchGetValues"),I="["+Ve(t,t.project,"Batch get values")+": `"+b+"`] ",A=(ce,be,Ce)=>{const Ee=Ve(ce==null?void 0:ce.valueOwner,g==null?void 0:g.logic,be),xe=Be(ce==null?void 0:ce.valueOwner,g==null?void 0:g.logic,Ce);return`"${Ee}" (\`${xe}\`)`},x=n.find(ce=>{var be;return((be=ce.valueOwner.declaration)==null?void 0:be.id)===G.operation[X.GoogleSheetsBatchGetValues].inputs.connection.id}),P=(s=x==null?void 0:x.value)==null?void 0:s.valueAsType;if(!P||!P.id||!P.name||P.type!==r.DefinitionEntity)throw new Error(`${I}The ${A(x,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(P);if(!O)throw new Error(`${I}The ${A(x,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const $=n.find(ce=>{var be;return((be=ce.valueOwner.declaration)==null?void 0:be.id)===G.operation[X.GoogleSheetsBatchGetValues].inputs.spreadsheetId.id}),U=(u=$==null?void 0:$.value)==null?void 0:u.value,Z=ln(U,{errorPrefix:`${I}The ${A($,"Spreadsheet ID","spreadsheetId")} input `}),j=n.find(ce=>{var be;return((be=ce.valueOwner.declaration)==null?void 0:be.id)===G.operation[X.GoogleSheetsBatchGetValues].inputs.ranges.id}),H=(e=j==null?void 0:j.value)==null?void 0:e.value;if(H==null||H==="")throw new Error(`${I}The ${A(j,"Ranges","ranges")} input is missing.`);const ie={Authorization:`Bearer ${await g.getAccessToken()}`},W=`${(f=g.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${g.projectId}/${Zt["google-sheet"]}/${O}`,z=async ce=>Ht.post(W,ce,{headers:ie});let J=Array.isArray(H)?H:[H];if(J.length===0)throw new Error(`${I}The ${A(j,"Ranges","ranges")} input evaluated to an empty array. E.g. ["Sheet1!A1:B2"]`);let ee=new Set;try{const be=((y=(await z({method:"GET",endpoint:`/v4/spreadsheets/${Z}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:y.sheets)||[];ee=new Set(be.map(Ce=>{var Ee;return(Ee=Ce.properties)==null?void 0:Ee.title}).filter(Boolean))}catch{}const Q=ce=>{const be=ce.indexOf("!");if(be>-1){let Ce=ce.substring(0,be).trim();return Ce.startsWith("'")&&Ce.endsWith("'")&&(Ce=Ce.slice(1,-1)),Ce}return null},re=[],ae=[];for(const ce of J){const be=lv(ce,{errorPrefix:`${I}The ${A(j,"Ranges","ranges")} input `}),Ce=Q(be);Ce&&ee.size>0&&!ee.has(Ce)?ae.push({range:be,majorDimension:"ROWS",values:[]}):re.push({a1Range:be})}let le=[];re.length>0&&(le=(((m=(await z({method:"POST",endpoint:`/v4/spreadsheets/${Z}/values:batchGetByDataFilter`,data:{dataFilters:re}})).data)==null?void 0:m.valueRanges)||[]).map(Ce=>Ce.valueRange||Ce));const oe=[...le,...ae];return{value:K.Success,result:{valueRanges:oe},error:null}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return pe.Logger.log("[Google Sheets] error:",b),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:b,result:null}}}})}}function fo(a){if(!a||typeof a!="object")return;const p={};return typeof a.red=="number"&&(p.red=a.red>1?a.red/255:a.red),typeof a.green=="number"&&(p.green=a.green>1?a.green/255:a.green),typeof a.blue=="number"&&(p.blue=a.blue>1?a.blue/255:a.blue),typeof a.alpha=="number"&&(p.alpha=a.alpha),Object.keys(p).length>0?p:void 0}class o1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsFormatCells,version:"1.0.0",description:"Format Cells Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsFormatCells);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"formatCells"),b="["+Ve(t,t.project,"Format cells")+": `"+T+"`] ",R=(ft,Et,pt)=>{const Me=Ve(ft==null?void 0:ft.valueOwner,m==null?void 0:m.logic,Et),Je=Be(ft==null?void 0:ft.valueOwner,m==null?void 0:m.logic,pt);return`"${Me}" (\`${Je}\`)`},I=n.find(ft=>{var Et;return((Et=ft.valueOwner.declaration)==null?void 0:Et.id)===G.operation[X.GoogleSheetsFormatCells].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=ui(A);if(!x)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(ft=>{var Et;return((Et=ft.valueOwner.declaration)==null?void 0:Et.id)===G.operation[X.GoogleSheetsFormatCells].inputs.spreadsheetId.id}),O=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(O,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(ft=>{var Et;return((Et=ft.valueOwner.declaration)==null?void 0:Et.id)===G.operation[X.GoogleSheetsFormatCells].inputs.range.id}),Z=(e=U==null?void 0:U.value)==null?void 0:e.value;if(Z==null)throw new Error(`${b}The ${R(U,"Range","range")} input is missing.`);const H={Authorization:`Bearer ${await m.getAccessToken()}`},Y=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${x}`,ie=async ft=>Ht.post(Y,ft,{headers:H}),W=await Ha(Z,"Id",async()=>(await ie({method:"GET",endpoint:`/v4/spreadsheets/${$}?fields=sheets.properties(sheetId,title)`})).data.sheets.map(Et=>({id:Et.properties.sheetId,name:Et.properties.title}))),z=ps(W,{errorPrefix:`${b}The ${R(U,"Range","range")} input `}),J=G.operation[X.GoogleSheetsFormatCells].inputs,ee=ft=>{var pt;const Et=n.find(Me=>{var Je;return((Je=Me.valueOwner.declaration)==null?void 0:Je.id)===ft});return(pt=Et==null?void 0:Et.value)==null?void 0:pt.value},Q=ee(J.bold.id),re=ee(J.italic.id),ae=ee(J.underline.id),le=ee(J.strikethrough.id),oe=ee(J.fontSize.id),ce=ee(J.fontFamily.id),be=ee(J.textColor.id),Ce=ee(J.backgroundColor.id),Ee=ee(J.horizontalAlignment.id),xe=ee(J.verticalAlignment.id),Le=ee(J.wrapStrategy.id),Fe={},tt=[],We={},et=[];typeof Q=="boolean"&&(We.bold=Q,et.push("bold")),typeof re=="boolean"&&(We.italic=re,et.push("italic")),typeof ae=="boolean"&&(We.underline=ae,et.push("underline")),typeof le=="boolean"&&(We.strikethrough=le,et.push("strikethrough")),typeof oe=="number"&&!isNaN(oe)&&(We.fontSize=oe,et.push("fontSize")),typeof ce=="string"&&ce.trim()!==""&&(We.fontFamily=ce.trim(),et.push("fontFamily"));const qe=fo(be);qe&&(We.foregroundColor=qe,et.push("foregroundColor")),et.length>0&&(Fe.textFormat=We,tt.push(`userEnteredFormat.textFormat(${et.join(",")})`));const ot=fo(Ce);if(ot&&(Fe.backgroundColor=ot,tt.push("userEnteredFormat.backgroundColor")),typeof Ee=="string"&&Ee!==""){const ft={Left:"LEFT",Center:"CENTER",Right:"RIGHT",Justify:"JUSTIFY"};Fe.horizontalAlignment=ft[Ee]||Ee.toUpperCase(),tt.push("userEnteredFormat.horizontalAlignment")}if(typeof xe=="string"&&xe!==""){const ft={Top:"TOP",Middle:"MIDDLE",Bottom:"BOTTOM"};Fe.verticalAlignment=ft[xe]||xe.toUpperCase(),tt.push("userEnteredFormat.verticalAlignment")}if(typeof Le=="string"&&Le!==""){const ft={"Overflow cell":"OVERFLOW_CELL","Wrap text":"WRAP","Clip text":"CLIP"};Fe.wrapStrategy=ft[Le]||Le.toUpperCase(),tt.push("userEnteredFormat.wrapStrategy")}if(tt.length===0)return{value:K.Success,result:null,error:null};const st={repeatCell:{range:z,cell:{userEnteredFormat:Fe},fields:tt.join(",")}};return await ie({method:"POST",endpoint:`/v4/spreadsheets/${$}:batchUpdate`,data:{requests:[st]}}),{value:K.Success,result:null,error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class d1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsSetNumberFormat,version:"1.0.0",description:"Set Number Format Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsSetNumberFormat);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=Be(t,t.project,"setNumberFormat"),R="["+Ve(t,t.project,"Set number format")+": `"+g+"`] ",I=(ae,le,oe)=>{const ce=Ve(ae==null?void 0:ae.valueOwner,T==null?void 0:T.logic,le),be=Be(ae==null?void 0:ae.valueOwner,T==null?void 0:T.logic,oe);return`"${ce}" (\`${be}\`)`},A=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[X.GoogleSheetsSetNumberFormat].inputs.connection.id}),x=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!x||!x.id||!x.name||x.type!==r.DefinitionEntity)throw new Error(`${R}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const P=ui(x);if(!P)throw new Error(`${R}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const O=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[X.GoogleSheetsSetNumberFormat].inputs.spreadsheetId.id}),$=(u=O==null?void 0:O.value)==null?void 0:u.value,U=ln($,{errorPrefix:`${R}The ${I(O,"Spreadsheet ID","spreadsheetId")} input `}),Z=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[X.GoogleSheetsSetNumberFormat].inputs.range.id}),j=(e=Z==null?void 0:Z.value)==null?void 0:e.value;if(j==null)throw new Error(`${R}The ${I(Z,"Range","range")} input is missing.`);const Y={Authorization:`Bearer ${await T.getAccessToken()}`},ie=`${(f=T.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${T.projectId}/${Zt["google-sheet"]}/${P}`,W=async ae=>Ht.post(ie,ae,{headers:Y}),z=await Ha(j,"Id",async()=>(await W({method:"GET",endpoint:`/v4/spreadsheets/${U}?fields=sheets.properties(sheetId,title)`})).data.sheets.map(le=>({id:le.properties.sheetId,name:le.properties.title}))),J=ps(z,{errorPrefix:`${R}The ${I(Z,"Range","range")} input `}),ee=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[X.GoogleSheetsSetNumberFormat].inputs.pattern.id}),Q=(y=ee==null?void 0:ee.value)==null?void 0:y.value;if(Q==null||Q==="")throw new Error(`${R}The ${I(ee,"Pattern","pattern")} input is missing.`);if(typeof Q!="string")throw new Error(`${R}The ${I(ee,"Pattern","pattern")} input value is invalid. It must be a string.`);const re={repeatCell:{range:J,cell:{userEnteredFormat:{numberFormat:{type:"CUSTOM",pattern:Q}}},fields:"userEnteredFormat.numberFormat"}};return await W({method:"POST",endpoint:`/v4/spreadsheets/${U}:batchUpdate`,data:{requests:[re]}}),{value:K.Success,result:null,error:null}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return pe.Logger.log("[Google Sheets] error:",g),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:g,result:null}}}})}}class p1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsMergeCells,version:"1.0.0",description:"Merge Cells Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsMergeCells);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=Be(t,t.project,"mergeCells"),R="["+Ve(t,t.project,"Merge cells")+": `"+g+"`] ",I=(oe,ce,be)=>{const Ce=Ve(oe==null?void 0:oe.valueOwner,T==null?void 0:T.logic,ce),Ee=Be(oe==null?void 0:oe.valueOwner,T==null?void 0:T.logic,be);return`"${Ce}" (\`${Ee}\`)`},A=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[X.GoogleSheetsMergeCells].inputs.connection.id}),x=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!x||!x.id||!x.name||x.type!==r.DefinitionEntity)throw new Error(`${R}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const P=ui(x);if(!P)throw new Error(`${R}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const O=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[X.GoogleSheetsMergeCells].inputs.spreadsheetId.id}),$=(u=O==null?void 0:O.value)==null?void 0:u.value,U=ln($,{errorPrefix:`${R}The ${I(O,"Spreadsheet ID","spreadsheetId")} input `}),Z=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[X.GoogleSheetsMergeCells].inputs.range.id}),j=(e=Z==null?void 0:Z.value)==null?void 0:e.value;if(!j||j==="")throw new Error(`${R}The ${I(Z,"Range","range")} input is missing.`);const H=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[X.GoogleSheetsMergeCells].inputs.mergeType.id}),Y=(f=H==null?void 0:H.value)==null?void 0:f.value,ie={Columns:"MERGE_COLUMNS",Rows:"MERGE_ROWS",Both:"MERGE_ALL","All (combine entire range)":"MERGE_ALL","Columns (merge within columns)":"MERGE_COLUMNS","Rows (merge within rows)":"MERGE_ROWS",MERGE_ALL:"MERGE_ALL",MERGE_COLUMNS:"MERGE_COLUMNS",MERGE_ROWS:"MERGE_ROWS"},W=typeof Y=="string"?Y:String(Y||""),z=ie[W]||(Y?String(Y).toUpperCase():"MERGE_ALL"),ee={Authorization:`Bearer ${await T.getAccessToken()}`},Q=`${(y=T.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${T.projectId}/${Zt["google-sheet"]}/${P}`,re=async oe=>Ht.post(Q,oe,{headers:ee}),ae=await Ha(j,"Id",async()=>{var ce;return(((ce=(await re({method:"GET",endpoint:`/v4/spreadsheets/${U}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:ce.sheets)||[]).map(be=>{var Ce,Ee;return{id:(Ce=be.properties)==null?void 0:Ce.sheetId,name:(Ee=be.properties)==null?void 0:Ee.title}})}),le=ps(ae,{errorPrefix:`${R}The ${I(Z,"Range","range")} input `});return await re({method:"POST",endpoint:`/v4/spreadsheets/${U}:batchUpdate`,data:{requests:[{mergeCells:{range:le,mergeType:z}}]}}),{value:K.Success,error:null,result:null}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return pe.Logger.log("[Google Sheets] error:",g),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:g,result:null}}}})}}class u1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsUnmergeCells,version:"1.0.0",description:"Unmerge Cells Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsUnmergeCells);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"unmergeCells"),b="["+Ve(t,t.project,"Unmerge cells")+": `"+T+"`] ",R=(J,ee,Q)=>{const re=Ve(J==null?void 0:J.valueOwner,m==null?void 0:m.logic,ee),ae=Be(J==null?void 0:J.valueOwner,m==null?void 0:m.logic,Q);return`"${re}" (\`${ae}\`)`},I=n.find(J=>{var ee;return((ee=J.valueOwner.declaration)==null?void 0:ee.id)===G.operation[X.GoogleSheetsUnmergeCells].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=ui(A);if(!x)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(J=>{var ee;return((ee=J.valueOwner.declaration)==null?void 0:ee.id)===G.operation[X.GoogleSheetsUnmergeCells].inputs.spreadsheetId.id}),O=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(O,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(J=>{var ee;return((ee=J.valueOwner.declaration)==null?void 0:ee.id)===G.operation[X.GoogleSheetsUnmergeCells].inputs.range.id}),Z=(e=U==null?void 0:U.value)==null?void 0:e.value;if(!Z||Z==="")throw new Error(`${b}The ${R(U,"Range","range")} input is missing.`);const H={Authorization:`Bearer ${await m.getAccessToken()}`},Y=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${x}`,ie=async J=>Ht.post(Y,J,{headers:H}),W=await Ha(Z,"Id",async()=>{var ee;return(((ee=(await ie({method:"GET",endpoint:`/v4/spreadsheets/${$}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:ee.sheets)||[]).map(Q=>{var re,ae;return{id:(re=Q.properties)==null?void 0:re.sheetId,name:(ae=Q.properties)==null?void 0:ae.title}})}),z=ps(W,{errorPrefix:`${b}The ${R(U,"Range","range")} input `});return await ie({method:"POST",endpoint:`/v4/spreadsheets/${$}:batchUpdate`,data:{requests:[{unmergeCells:{range:z}}]}}),{value:K.Success,error:null,result:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class c1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsAutoResizeDimensions,version:"1.0.0",description:"Auto-Resize Dimensions Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsAutoResizeDimensions);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=Be(t,t.project,"autoResizeDimensions"),R="["+Ve(t,t.project,"Auto-resize dimensions")+": `"+g+"`] ",I=(ae,le,oe)=>{const ce=Ve(ae==null?void 0:ae.valueOwner,T==null?void 0:T.logic,le),be=Be(ae==null?void 0:ae.valueOwner,T==null?void 0:T.logic,oe);return`"${ce}" (\`${be}\`)`},A=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[X.GoogleSheetsAutoResizeDimensions].inputs.connection.id}),x=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!x||!x.id||!x.name||x.type!==r.DefinitionEntity)throw new Error(`${R}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const P=ui(x);if(!P)throw new Error(`${R}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const O=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[X.GoogleSheetsAutoResizeDimensions].inputs.spreadsheetId.id}),$=(u=O==null?void 0:O.value)==null?void 0:u.value,U=ln($,{errorPrefix:`${R}The ${I(O,"Spreadsheet ID","spreadsheetId")} input `}),Z=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[X.GoogleSheetsAutoResizeDimensions].inputs.range.id}),j=(e=Z==null?void 0:Z.value)==null?void 0:e.value;if(j==null)throw new Error(`${R}The ${I(Z,"Range","range")} input is missing.`);const H=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[X.GoogleSheetsAutoResizeDimensions].inputs.dimension.id}),Y=((f=H==null?void 0:H.value)==null?void 0:f.value)||"Both",W={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}/${Zt["google-sheet"]}/${P}`,J=async ae=>Ht.post(z,ae,{headers:W}),ee=await Ha(j,"Id",async()=>{var le;return(((le=(await J({method:"GET",endpoint:`/v4/spreadsheets/${U}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:le.sheets)||[]).map(oe=>{var ce,be;return{id:(ce=oe.properties)==null?void 0:ce.sheetId,name:(be=oe.properties)==null?void 0:be.title}})}),re=U4(ee,typeof Y=="string"?Y:void 0,{errorPrefix:`${R}The ${I(Z,"Range","range")} input `}).map(ae=>({autoResizeDimensions:{dimensions:ae}}));return await J({method:"POST",endpoint:`/v4/spreadsheets/${U}:batchUpdate`,data:{requests:re}}),{value:K.Success,result:null,error:null}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return pe.Logger.log("[Google Sheets] error:",g),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:g,result:null}}}})}}class f1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsFindAndReplace,version:"1.0.0",description:"Find and Replace Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsFindAndReplace);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A;try{const x=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!x||!x.env)throw new Error("Editor context or environment missing");const P=Be(t,t.project,"findAndReplace"),$="["+Ve(t,t.project,"Find and replace")+": `"+P+"`] ",U=(et,qe,ot)=>{const st=Ve(et==null?void 0:et.valueOwner,x==null?void 0:x.logic,qe),ft=Be(et==null?void 0:et.valueOwner,x==null?void 0:x.logic,ot);return`"${st}" (\`${ft}\`)`},Z=n.find(et=>{var qe;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===G.operation[X.GoogleSheetsFindAndReplace].inputs.connection.id}),j=(s=Z==null?void 0:Z.value)==null?void 0:s.valueAsType;if(!j||!j.id||!j.name||j.type!==r.DefinitionEntity)throw new Error(`${$}The ${U(Z,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const H=ui(j);if(!H)throw new Error(`${$}The ${U(Z,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const Y=n.find(et=>{var qe;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===G.operation[X.GoogleSheetsFindAndReplace].inputs.spreadsheetId.id}),ie=(u=Y==null?void 0:Y.value)==null?void 0:u.value,W=ln(ie,{errorPrefix:`${$}The ${U(Y,"Spreadsheet ID","spreadsheetId")} input `}),z=n.find(et=>{var qe;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===G.operation[X.GoogleSheetsFindAndReplace].inputs.range.id}),J=(e=z==null?void 0:z.value)==null?void 0:e.value;if(J==null)throw new Error(`${$}The ${U(z,"Range","range")} input is missing.`);const ee=n.find(et=>{var qe;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===G.operation[X.GoogleSheetsFindAndReplace].inputs.find.id}),Q=(f=ee==null?void 0:ee.value)==null?void 0:f.value;if(!Q||Q==="")throw new Error(`${$}The ${U(ee,"Find","find")} input is missing.`);if(typeof Q!="string")throw new Error(`${$}The ${U(ee,"Find","find")} input value is invalid. It must be a non-empty string.`);const re=n.find(et=>{var qe;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===G.operation[X.GoogleSheetsFindAndReplace].inputs.replace.id}),ae=((y=re==null?void 0:re.value)==null?void 0:y.value)||"";if(typeof ae!="string")throw new Error(`${$}The ${U(re,"Replace","replace")} input value is invalid. It must be a string.`);const le=n.find(et=>{var qe;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===G.operation[X.GoogleSheetsFindAndReplace].inputs.matchCase.id}),oe=!!((m=le==null?void 0:le.value)!=null&&m.value),ce=n.find(et=>{var qe;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===G.operation[X.GoogleSheetsFindAndReplace].inputs.matchEntireCell.id}),be=!!((T=ce==null?void 0:ce.value)!=null&&T.value),Ee={Authorization:`Bearer ${await x.getAccessToken()}`},xe=`${(g=x.env)==null?void 0:g.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${x.projectId}/${Zt["google-sheet"]}/${H}`,Le=async et=>Ht.post(xe,et,{headers:Ee}),Fe={findReplace:{range:ps(J,{errorPrefix:`${$}The ${U(z,"Range","range")} input `}),find:Q,replacement:ae,matchCase:oe,matchEntireCell:be}},We=(await Le({method:"POST",endpoint:`/v4/spreadsheets/${W}:batchUpdate`,data:{requests:[Fe]}})).data||{};return{value:K.Success,result:{occurrencesChanged:((I=(R=(b=We.replies)==null?void 0:b[0])==null?void 0:R.findReplace)==null?void 0:I.occurrencesChanged)||0},error:null}}catch(x){const P=((A=x.response)==null?void 0:A.data)||x.message||x;return pe.Logger.log("[Google Sheets] error:",P),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:P,result:null}}}})}}const e2={"List of items":"ONE_OF_LIST","List from cell range":"ONE_OF_RANGE","Number greater than":"NUMBER_GREATER","Number greater than or equal":"NUMBER_GREATER_THAN_EQ","Number less than":"NUMBER_LESS","Number less than or equal":"NUMBER_LESS_THAN_EQ","Number equal to":"NUMBER_EQ","Number not equal to":"NUMBER_NOT_EQ","Number between":"NUMBER_BETWEEN","Number not between":"NUMBER_NOT_BETWEEN","Text contains":"TEXT_CONTAINS","Text does not contain":"TEXT_NOT_CONTAINS","Text starts with":"TEXT_STARTS_WITH","Text ends with":"TEXT_ENDS_WITH","Text equals":"TEXT_EQ","Text is valid email":"TEXT_IS_EMAIL","Text is valid URL":"TEXT_IS_URL","Date is":"DATE_EQ","Date is before":"DATE_BEFORE","Date is after":"DATE_AFTER","Date is on or before":"DATE_ON_OR_BEFORE","Date is on or after":"DATE_ON_OR_AFTER","Date is between":"DATE_BETWEEN","Date is not between":"DATE_NOT_BETWEEN","Date is valid":"DATE_IS_VALID",Checkbox:"BOOLEAN","Custom formula":"CUSTOM_FORMULA"},ax={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"},ARn=new Set([...Object.values(e2),...Object.keys(ax),...Object.values(ax)]);function y1t(a){if(!a||typeof a!="string")return null;const p=a.trim();if(!p)return null;if(e2[p])return e2[p];const t=p.toUpperCase().replace(/\s+/g,"_");return ax[t]?ax[t]:(ARn.has(t),t)}function DRn(a,p,t){if(a.length===0){t.push(new ht({id:`${p.id}--${Nr.ConditionValuesInvalidFormula}`,message:'Custom formula condition requires a formula string starting with "=" (e.g., ["=SUM(A1:A10)>100"]).',severity:Ie.Error,code:Nr.ConditionValuesInvalidFormula,entity:p}));return}a.length>1&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesInvalidFormula}-count`,message:`Custom formula condition rule accepts only 1 formula string (e.g., ["=SUM(A1:A10)>100"]). You provided ${a.length} items.`,severity:Ie.Error,code:Nr.ConditionValuesInvalidFormula,entity:p}));for(let n=0;n<a.length;n++){const s=String(a[n]).trim();s.startsWith("=")||t.push(new ht({id:`${p.id}--${Nr.ConditionValuesInvalidFormula}-${n}`,message:`Custom formula "${s}" ${a.length>1?`(at index ${n}) `:""}is invalid. A custom formula must start with "=" (e.g., "=A1>100" or "=ISNUMBER(A1)").`,severity:Ie.Error,code:Nr.ConditionValuesInvalidFormula,entity:p}))}}function CRn(a,p,t){if(a.length===0){t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleNumberRequired}`,message:'This numeric condition rule requires 1 numeric target value (e.g., ["100"]).',severity:Ie.Error,code:Nr.ConditionValuesSingleNumberRequired,entity:p}));return}a.length>1&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleNumberRequired}-count`,message:`This numeric condition rule accepts only 1 numeric target value (e.g., ["100"]). You provided ${a.length} items.`,severity:Ie.Error,code:Nr.ConditionValuesSingleNumberRequired,entity:p}));for(let n=0;n<a.length;n++){const s=String(a[n]).trim();(s===""||isNaN(Number(s)))&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleNumberRequired}-${n}`,message:`Condition value "${s}" ${a.length>1?`(at index ${n}) `:""}is invalid. It must be a valid number (e.g., "100").`,severity:Ie.Error,code:Nr.ConditionValuesSingleNumberRequired,entity:p}))}}function wRn(a,p,t){a.length!==2&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesTwoNumbersRequired}`,message:`A "between" condition rule requires exactly 2 boundary values (e.g., ["10", "50"] or ["2024-01-01", "2024-12-31"]). You provided ${a.length} items.`,severity:Ie.Error,code:Nr.ConditionValuesTwoNumbersRequired,entity:p}))}function xRn(a,p,t){if(a.length===0){t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleRangeRequired}`,message:'The "List from cell range" rule requires a valid cell range in A1 notation (e.g., ["Sheet1!A1:A50"]).',severity:Ie.Error,code:Nr.ConditionValuesSingleRangeRequired,entity:p}));return}a.length>1&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleRangeRequired}-count`,message:`The "List from cell range" rule accepts only 1 cell range in A1 notation (e.g., ["Sheet1!A1:A50"]). You provided ${a.length} items.`,severity:Ie.Error,code:Nr.ConditionValuesSingleRangeRequired,entity:p}))}function ORn(a,p,t){a.length===0&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesListEmpty}`,message:'The "List of items" rule requires at least one choice item (e.g., ["Pending", "Approved", "Rejected"]).',severity:Ie.Error,code:Nr.ConditionValuesListEmpty,entity:p}))}function PRn(a,p,t){if(a.length===0){t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleTextRequired}`,message:'This text condition rule requires a non-empty text target value (e.g., ["important"]).',severity:Ie.Error,code:Nr.ConditionValuesSingleTextRequired,entity:p}));return}a.length>1&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleTextRequired}-count`,message:`This text condition rule accepts only 1 text target value (e.g., ["important"]). You provided ${a.length} items.`,severity:Ie.Error,code:Nr.ConditionValuesSingleTextRequired,entity:p}));for(let n=0;n<a.length;n++)String(a[n]).trim()===""&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleTextRequired}-${n}`,message:`Text target value ${a.length>1?`(at index ${n}) `:""}is empty. Expected a non-empty text string.`,severity:Ie.Error,code:Nr.ConditionValuesSingleTextRequired,entity:p}))}function VRn(a,p,t){if(a.length===0){t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleTextRequired}`,message:'This date condition rule requires a target date or relative date string (e.g., ["2024-01-01"]).',severity:Ie.Error,code:Nr.ConditionValuesSingleTextRequired,entity:p}));return}a.length>1&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleTextRequired}-count`,message:`This date condition rule accepts only 1 target date string (e.g., ["2024-01-01"]). You provided ${a.length} items.`,severity:Ie.Error,code:Nr.ConditionValuesSingleTextRequired,entity:p}))}function NRn(a,p,t){a.length>0&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesNoValuesRequired}`,message:`This condition rule does not take any argument values (must be empty list []). You provided ${a.length} items.`,severity:Ie.Error,code:Nr.ConditionValuesNoValuesRequired,entity:p}))}function _Rn(a,p,t,n){if(!p&&p!==0&&p!==!1)return;let s=[];if(typeof p=="string")try{const e=JSON.parse(p);s=Array.isArray(e)?e:[p]}catch{s=p.split(",").map(e=>e.trim()).filter(Boolean)}else Array.isArray(p)?s=p:s=[p];const u=y1t(a);if(u)switch(u){case"CUSTOM_FORMULA":DRn(s,t,n);break;case"ONE_OF_LIST":ORn(s,t,n);break;case"ONE_OF_RANGE":xRn(s,t,n);break;case"NUMBER_GREATER":case"NUMBER_GREATER_THAN_EQ":case"NUMBER_LESS":case"NUMBER_LESS_THAN_EQ":case"NUMBER_EQUAL":case"NUMBER_NOT_EQUAL":CRn(s,t,n);break;case"NUMBER_BETWEEN":case"NUMBER_NOT_BETWEEN":case"DATE_BETWEEN":case"DATE_NOT_BETWEEN":wRn(s,t,n);break;case"TEXT_CONTAINS":case"TEXT_NOT_CONTAINS":case"TEXT_DOES_NOT_CONTAIN":case"TEXT_STARTS_WITH":case"TEXT_ENDS_WITH":case"TEXT_EQ":case"TEXT_EQUAL":PRn(s,t,n);break;case"DATE_EQ":case"DATE_TIME_EQUAL":case"DATE_BEFORE":case"DATE_AFTER":case"DATE_ON_OR_BEFORE":case"DATE_ON_OR_AFTER":VRn(s,t,n);break;case"TEXT_IS_EMAIL":case"TEXT_IS_URL":case"DATE_IS_VALID":case"BOOLEAN":NRn(s,t,n);break}}class h1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsAddDataValidation,version:"1.0.0",description:"Add Data Validation Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsAddDataValidation);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T;try{const g=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!g||!g.env)throw new Error("Editor context or environment missing");const b=Be(t,t.project,"addDataValidation"),I="["+Ve(t,t.project,"Add data validation")+": `"+b+"`] ",A=(xe,Le,Fe)=>{const tt=Ve(xe==null?void 0:xe.valueOwner,g==null?void 0:g.logic,Le),We=Be(xe==null?void 0:xe.valueOwner,g==null?void 0:g.logic,Fe);return`"${tt}" (\`${We}\`)`},x=n.find(xe=>{var Le;return((Le=xe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[X.GoogleSheetsAddDataValidation].inputs.connection.id}),P=(s=x==null?void 0:x.value)==null?void 0:s.valueAsType;if(!P||!P.id||!P.name||P.type!==r.DefinitionEntity)throw new Error(`${I}The ${A(x,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(P);if(!O)throw new Error(`${I}The ${A(x,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const $=n.find(xe=>{var Le;return((Le=xe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[X.GoogleSheetsAddDataValidation].inputs.spreadsheetId.id}),U=(u=$==null?void 0:$.value)==null?void 0:u.value,Z=ln(U,{errorPrefix:`${I}The ${A($,"Spreadsheet ID","spreadsheetId")} input `}),j=n.find(xe=>{var Le;return((Le=xe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[X.GoogleSheetsAddDataValidation].inputs.range.id}),H=(e=j==null?void 0:j.value)==null?void 0:e.value;if(H==null)throw new Error(`${I}The ${A(j,"Range","range")} input is missing.`);const ie={Authorization:`Bearer ${await g.getAccessToken()}`},W=`${(f=g.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${g.projectId}/${Zt["google-sheet"]}/${O}`,z=async xe=>Ht.post(W,xe,{headers:ie}),J=await Ha(H,"Id",async()=>(await z({method:"GET",endpoint:`/v4/spreadsheets/${Z}?fields=sheets.properties(sheetId,title)`})).data.sheets.map(Le=>({id:Le.properties.sheetId,name:Le.properties.title}))),ee=ps(J,{errorPrefix:`${I}The ${A(j,"Range","range")} input `}),Q=n.find(xe=>{var Le;return((Le=xe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[X.GoogleSheetsAddDataValidation].inputs.conditionType.id}),re=(y=Q==null?void 0:Q.value)==null?void 0:y.value;if(!re||re==="")throw new Error(`${I}The ${A(Q,"Condition Type","conditionType")} input is missing.`);if(typeof re!="string")throw new Error(`${I}The ${A(Q,"Condition Type","conditionType")} input value is invalid. It must be a non-empty string.`);const ae=y1t(re)||re,le=n.find(xe=>{var Le;return((Le=xe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[X.GoogleSheetsAddDataValidation].inputs.conditionValues.id}),oe=(m=le==null?void 0:le.value)==null?void 0:m.value;let ce=oe;if(typeof oe=="string")try{ce=JSON.parse(oe)}catch{ce=oe.split(",").map(Le=>Le.trim())}Array.isArray(ce)||(ce=ce?[ce]:[]);let be=ae,Ce=ce.map(xe=>({userEnteredValue:String(xe)}));if(ae==="TEXT_STARTS_WITH"||ae==="TEXT_ENDS_WITH"){const xe=zAt(H),Le=ce.length>0?String(ce[0]):"",Fe=Le.replace(/"/g,'""'),tt=ae==="TEXT_STARTS_WITH"?`=LEFT(${xe}, ${Le.length})="${Fe}"`:`=RIGHT(${xe}, ${Le.length})="${Fe}"`;be="CUSTOM_FORMULA",Ce=[{userEnteredValue:tt}]}const Ee={setDataValidation:{range:ee,rule:{condition:{type:be,values:Ce},showCustomUi:!0}}};return await z({method:"POST",endpoint:`/v4/spreadsheets/${Z}:batchUpdate`,data:{requests:[Ee]}}),{value:K.Success,result:null,error:null}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return pe.Logger.log("[Google Sheets] error:",b),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:b,result:null}}}})}}class m1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsSortRange,version:"1.0.0",description:"Sort Range Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsSortRange);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T;try{const g=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!g||!g.env)throw new Error("Editor context or environment missing");const b=Be(t,t.project,"sortRange"),I="["+Ve(t,t.project,"Sort range")+": `"+b+"`] ",A=(Le,Fe,tt)=>{const We=Ve(Le==null?void 0:Le.valueOwner,g==null?void 0:g.logic,Fe),et=Be(Le==null?void 0:Le.valueOwner,g==null?void 0:g.logic,tt);return`"${We}" (\`${et}\`)`},x=n.find(Le=>{var Fe;return((Fe=Le.valueOwner.declaration)==null?void 0:Fe.id)===G.operation[X.GoogleSheetsSortRange].inputs.connection.id}),P=(s=x==null?void 0:x.value)==null?void 0:s.valueAsType;if(!P||!P.id||!P.name||P.type!==r.DefinitionEntity)throw new Error(`${I}The ${A(x,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(P);if(!O)throw new Error(`${I}The ${A(x,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const $=n.find(Le=>{var Fe;return((Fe=Le.valueOwner.declaration)==null?void 0:Fe.id)===G.operation[X.GoogleSheetsSortRange].inputs.spreadsheetId.id}),U=(u=$==null?void 0:$.value)==null?void 0:u.value,Z=ln(U,{errorPrefix:`${I}The ${A($,"Spreadsheet ID","spreadsheetId")} input `}),j=n.find(Le=>{var Fe;return((Fe=Le.valueOwner.declaration)==null?void 0:Fe.id)===G.operation[X.GoogleSheetsSortRange].inputs.range.id}),H=(e=j==null?void 0:j.value)==null?void 0:e.value;if(H==null)throw new Error(`${I}The ${A(j,"Range","range")} input is missing.`);const ie={Authorization:`Bearer ${await g.getAccessToken()}`},W=`${(f=g.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${g.projectId}/${Zt["google-sheet"]}/${O}`,z=async Le=>Ht.post(W,Le,{headers:ie}),J=await Ha(H,"Id",async()=>(await z({method:"GET",endpoint:`/v4/spreadsheets/${Z}?fields=sheets.properties(sheetId,title)`})).data.sheets.map(Fe=>({id:Fe.properties.sheetId,name:Fe.properties.title}))),ee=ps(J,{errorPrefix:`${I}The ${A(j,"Range","range")} input `}),Q=n.find(Le=>{var Fe;return((Fe=Le.valueOwner.declaration)==null?void 0:Fe.id)===G.operation[X.GoogleSheetsSortRange].inputs.sortColumnIndex.id}),re=(y=Q==null?void 0:Q.value)==null?void 0:y.value;if(re==null)throw new Error(`${I}The ${A(Q,"Sort Column Index","sortColumnIndex")} input is missing.`);if(typeof re!="number")throw new Error(`${I}The ${A(Q,"Sort Column Index","sortColumnIndex")} input value is invalid. It must be a number.`);const ae=n.find(Le=>{var Fe;return((Fe=Le.valueOwner.declaration)==null?void 0:Fe.id)===G.operation[X.GoogleSheetsSortRange].inputs.sortOrder.id}),le=(m=ae==null?void 0:ae.value)==null?void 0:m.value;if(le==null||le==="")throw new Error(`${I}The ${A(ae,"Sort Order","sortOrder")} input is missing.`);if(typeof le!="string")throw new Error(`${I}The ${A(ae,"Sort Order","sortOrder")} input value is invalid. It must be a string.`);const ce={"Ascending (A-Z, 0-9)":"ASCENDING","Descending (Z-A, 9-0)":"DESCENDING",Ascending:"ASCENDING",Descending:"DESCENDING"}[le]||le.toUpperCase(),be=ee.startColumnIndex??0,Ce=ee.endColumnIndex;let Ee;if(re>=1?Ee=be+(re-1):Ee=be+re,Ce!==void 0&&(Ee<be||Ee>=Ce)){const Le=Ce-be;throw new Error(`${I}The ${A(Q,"Sort Column Index","sortColumnIndex")} input value (${re}) is out of bounds for the specified range. The range contains ${Le} column(s).`)}const xe={sortRange:{range:ee,sortSpecs:[{dimensionIndex:Ee,sortOrder:ce}]}};return await z({method:"POST",endpoint:`/v4/spreadsheets/${Z}:batchUpdate`,data:{requests:[xe]}}),{value:K.Success,result:null,error:null}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return pe.Logger.log("[Google Sheets] error:",b),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:b,result:null}}}})}}const $Rn={"Is empty":"BLANK","Is not empty":"NOT_BLANK","Text contains":"TEXT_CONTAINS","Text does not contain":"TEXT_NOT_CONTAINS","Text starts with":"TEXT_STARTS_WITH","Text ends with":"TEXT_ENDS_WITH","Text is exactly":"TEXT_EQ","Greater than":"NUMBER_GREATER","Greater than or equal to":"NUMBER_GREATER_THAN_EQ","Less than":"NUMBER_LESS","Less than or equal to":"NUMBER_LESS_THAN_EQ","Is equal to":"NUMBER_EQUAL","Is not equal to":"NUMBER_NOT_EQUAL","Is between":"NUMBER_BETWEEN","Is not between":"NUMBER_NOT_BETWEEN","Custom formula":"CUSTOM_FORMULA"},GRn={"Ascending (A-Z, 0-9)":"ASCENDING","Descending (Z-A, 9-0)":"DESCENDING",Ascending:"ASCENDING",Descending:"DESCENDING"};class T1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsCreateFilter,version:"1.0.0",description:"Create Filter Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsCreateFilter);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R;try{const I=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!I||!I.env)throw new Error("Editor context or environment missing");const A=Be(t,t.project,"createFilter"),P="["+Ve(t,t.project,"Create filter")+": `"+A+"`] ",O=(pt,Me,Je)=>{const ke=Ve(pt==null?void 0:pt.valueOwner,I==null?void 0:I.logic,Me),lt=Be(pt==null?void 0:pt.valueOwner,I==null?void 0:I.logic,Je);return`"${ke}" (\`${lt}\`)`},$=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===G.operation[X.GoogleSheetsCreateFilter].inputs.connection.id}),U=(s=$==null?void 0:$.value)==null?void 0:s.valueAsType;if(!U||!U.id||!U.name||U.type!==r.DefinitionEntity)throw new Error(`${P}The ${O($,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const Z=ui(U);if(!Z)throw new Error(`${P}The ${O($,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const j=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===G.operation[X.GoogleSheetsCreateFilter].inputs.spreadsheetId.id}),H=(u=j==null?void 0:j.value)==null?void 0:u.value,Y=ln(H,{errorPrefix:`${P}The ${O(j,"Spreadsheet ID","spreadsheetId")} input `}),ie=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===G.operation[X.GoogleSheetsCreateFilter].inputs.range.id}),W=(e=ie==null?void 0:ie.value)==null?void 0:e.value;if(W==null)throw new Error(`${P}The ${O(ie,"Range","range")} input is missing.`);const z=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===G.operation[X.GoogleSheetsCreateFilter].inputs.columnIndex.id}),J=(f=z==null?void 0:z.value)==null?void 0:f.value,ee=typeof J=="number"?J:0,Q=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===G.operation[X.GoogleSheetsCreateFilter].inputs.conditionType.id}),re=(y=Q==null?void 0:Q.value)==null?void 0:y.value,ae=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===G.operation[X.GoogleSheetsCreateFilter].inputs.conditionValues.id}),le=(m=ae==null?void 0:ae.value)==null?void 0:m.value,oe=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===G.operation[X.GoogleSheetsCreateFilter].inputs.hiddenValues.id}),ce=(T=oe==null?void 0:oe.value)==null?void 0:T.value,be=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===G.operation[X.GoogleSheetsCreateFilter].inputs.sortOrder.id}),Ce=(g=be==null?void 0:be.value)==null?void 0:g.value,xe={Authorization:`Bearer ${await I.getAccessToken()}`},Le=`${(b=I.env)==null?void 0:b.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${I.projectId}/${Zt["google-sheet"]}/${Z}`,Fe=async pt=>Ht.post(Le,pt,{headers:xe}),tt=await Ha(W,"Id",async()=>(await Fe({method:"GET",endpoint:`/v4/spreadsheets/${Y}?fields=sheets.properties(sheetId,title)`})).data.sheets.map(Me=>({id:Me.properties.sheetId,name:Me.properties.title}))),We=ps(tt,{errorPrefix:`${P}The ${O(ie,"Range","range")} input `}),et={range:We},qe={},ot=typeof re=="string"?re:String(re||""),st=$Rn[ot]||(re?String(re).toUpperCase():void 0);if(st){const pt=Array.isArray(le)?le.map(Me=>({userEnteredValue:String(Me)})):le!=null&&le!==""?[{userEnteredValue:String(le)}]:void 0;qe.condition={type:st,...pt?{values:pt}:{}}}Array.isArray(ce)&&ce.length>0&&(qe.hiddenValues=ce.map(pt=>String(pt))),Object.keys(qe).length>0&&(et.criteria={[ee]:qe});const ft=typeof Ce=="string"?Ce:String(Ce||""),Et=GRn[ft]||(Ce?String(Ce).toUpperCase():void 0);if(Et){const pt=We.startColumnIndex??0,Me=ee>=1?pt+(ee-1):pt+ee;et.sortSpecs=[{dimensionIndex:Me,sortOrder:Et}]}return await Fe({method:"POST",endpoint:`/v4/spreadsheets/${Y}:batchUpdate`,data:{requests:[{setBasicFilter:{filter:et}}]}}),{value:K.Success,result:null,error:null}}catch(I){const A=((R=I.response)==null?void 0:R.data)||I.message||I;return pe.Logger.log("[Google Sheets] error:",A),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:A,result:null}}}})}}class v1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsRemoveFilter,version:"1.0.0",description:"Remove Filter Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsRemoveFilter);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"removeFilter"),b="["+Ve(t,t.project,"Remove filter")+": `"+T+"`] ",R=(ee,Q,re)=>{const ae=Ve(ee==null?void 0:ee.valueOwner,m==null?void 0:m.logic,Q),le=Be(ee==null?void 0:ee.valueOwner,m==null?void 0:m.logic,re);return`"${ae}" (\`${le}\`)`},I=n.find(ee=>{var Q;return((Q=ee.valueOwner.declaration)==null?void 0:Q.id)===G.operation[X.GoogleSheetsRemoveFilter].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=ui(A);if(!x)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(ee=>{var Q;return((Q=ee.valueOwner.declaration)==null?void 0:Q.id)===G.operation[X.GoogleSheetsRemoveFilter].inputs.spreadsheetId.id}),O=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(O,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(ee=>{var Q;return((Q=ee.valueOwner.declaration)==null?void 0:Q.id)===G.operation[X.GoogleSheetsRemoveFilter].inputs.range.id}),Z=(e=U==null?void 0:U.value)==null?void 0:e.value;if(Z==null)throw new Error(`${b}The ${R(U,"Range","range")} input is missing.`);const H={Authorization:`Bearer ${await m.getAccessToken()}`},Y=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${x}`,ie=async ee=>Ht.post(Y,ee,{headers:H}),W=await Ha(Z,"Id",async()=>(await ie({method:"GET",endpoint:`/v4/spreadsheets/${$}?fields=sheets.properties(sheetId,title)`})).data.sheets.map(Q=>({id:Q.properties.sheetId,name:Q.properties.title}))),J=ps(W,{errorPrefix:`${b}The ${R(U,"Range","range")} input `}).sheetId;return await ie({method:"POST",endpoint:`/v4/spreadsheets/${$}:batchUpdate`,data:{requests:[{clearBasicFilter:{sheetId:J}}]}}),{value:K.Success,result:null,error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class g1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsUpdateSpreadsheetProperties,version:"1.0.0",description:"Update Spreadsheet Properties Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsUpdateSpreadsheetProperties);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I;try{const A=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!A||!A.env)throw new Error("Editor context or environment missing");const x=Be(t,t.project,"updateSpreadsheetProperties"),O="["+Ve(t,t.project,"Update spreadsheet properties")+": `"+x+"`] ",$=(st,ft,Et)=>{const pt=Ve(st==null?void 0:st.valueOwner,A==null?void 0:A.logic,ft),Me=Be(st==null?void 0:st.valueOwner,A==null?void 0:A.logic,Et);return`"${pt}" (\`${Me}\`)`},U=n.find(st=>{var ft;return((ft=st.valueOwner.declaration)==null?void 0:ft.id)===G.operation[X.GoogleSheetsUpdateSpreadsheetProperties].inputs.connection.id}),Z=(s=U==null?void 0:U.value)==null?void 0:s.valueAsType;if(!Z||!Z.id||!Z.name||Z.type!==r.DefinitionEntity)throw new Error(`${O}The ${$(U,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const j=ui(Z);if(!j)throw new Error(`${O}The ${$(U,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const H=n.find(st=>{var ft;return((ft=st.valueOwner.declaration)==null?void 0:ft.id)===G.operation[X.GoogleSheetsUpdateSpreadsheetProperties].inputs.spreadsheetId.id}),Y=(u=H==null?void 0:H.value)==null?void 0:u.value,ie=ln(Y,{errorPrefix:`${O}The ${$(H,"Spreadsheet ID","spreadsheetId")} input `}),W=n.find(st=>{var ft;return((ft=st.valueOwner.declaration)==null?void 0:ft.id)===G.operation[X.GoogleSheetsUpdateSpreadsheetProperties].inputs.title.id}),z=(e=W==null?void 0:W.value)==null?void 0:e.value;if(z!=null&&typeof z!="string")throw new Error(`${O}The ${$(W,"Title","title")} input value is invalid. If present, it must be a string. E.g. "My Spreadsheet"`);const J=n.find(st=>{var ft;return((ft=st.valueOwner.declaration)==null?void 0:ft.id)===G.operation[X.GoogleSheetsUpdateSpreadsheetProperties].inputs.locale.id}),ee=(f=J==null?void 0:J.value)==null?void 0:f.value;if(ee!=null&&typeof ee!="string")throw new Error(`${O}The ${$(J,"Locale","locale")} input value is invalid. If present, it must be a string. E.g. "en_US"`);const Q=n.find(st=>{var ft;return((ft=st.valueOwner.declaration)==null?void 0:ft.id)===G.operation[X.GoogleSheetsUpdateSpreadsheetProperties].inputs.timeZone.id}),re=(y=Q==null?void 0:Q.value)==null?void 0:y.value;if(re!=null&&typeof re!="string")throw new Error(`${O}The ${$(Q,"Time Zone","timeZone")} input value is invalid. If present, it must be a string. E.g. "America/New_York"`);const ae=n.find(st=>{var ft;return((ft=st.valueOwner.declaration)==null?void 0:ft.id)===G.operation[X.GoogleSheetsUpdateSpreadsheetProperties].inputs.autoRecalc.id}),le=(m=ae==null?void 0:ae.value)==null?void 0:m.value;if(le!=null&&typeof le!="string")throw new Error(`${O}The ${$(ae,"Auto Recalculation","autoRecalc")} input value is invalid. If present, it must be a string enum value. E.g. "ON_CHANGE"`);const oe=n.find(st=>{var ft;return((ft=st.valueOwner.declaration)==null?void 0:ft.id)===G.operation[X.GoogleSheetsUpdateSpreadsheetProperties].inputs.defaultFormat.id}),ce=(T=oe==null?void 0:oe.value)==null?void 0:T.value;if(ce!=null&&(typeof ce!="object"||Array.isArray(ce)))throw new Error(`${O}The ${$(oe,"Default Format","defaultFormat")} input value is invalid. If present, it must be an object representing the CellFormat.`);const be=n.find(st=>{var ft;return((ft=st.valueOwner.declaration)==null?void 0:ft.id)===G.operation[X.GoogleSheetsUpdateSpreadsheetProperties].inputs.iterativeCalculationSettings.id}),Ce=(g=be==null?void 0:be.value)==null?void 0:g.value;if(Ce!=null&&(typeof Ce!="object"||Array.isArray(Ce)))throw new Error(`${O}The ${$(be,"Iterative Calculation Settings","iterativeCalculationSettings")} input value is invalid. If present, it must be an object.`);const Ee=n.find(st=>{var ft;return((ft=st.valueOwner.declaration)==null?void 0:ft.id)===G.operation[X.GoogleSheetsUpdateSpreadsheetProperties].inputs.spreadsheetTheme.id}),xe=(b=Ee==null?void 0:Ee.value)==null?void 0:b.value;if(xe!=null&&(typeof xe!="object"||Array.isArray(xe)))throw new Error(`${O}The ${$(Ee,"Spreadsheet Theme","spreadsheetTheme")} input value is invalid. If present, it must be an object.`);const Le={};if(z!=null&&(Le.title=z),ee!=null&&(Le.locale=ee),re!=null&&(Le.timeZone=re),le!=null){const st={"On change":"ON_CHANGE","Every minute":"MINUTE","Every hour":"HOUR"};Le.autoRecalc=st[le]||le.toUpperCase()}ce!=null&&(Le.defaultFormat=ce),Ce!=null&&(Le.iterativeCalculationSettings=Ce),xe!=null&&(Le.spreadsheetTheme=xe);const Fe=(st,ft="")=>{let Et=[];for(const pt in st){if(!Object.prototype.hasOwnProperty.call(st,pt))continue;const Me=st[pt],Je=ft?`${ft}.${pt}`:pt;Me!==null&&typeof Me=="object"&&!Array.isArray(Me)&&Object.keys(Me).length>0?Et.push(...Fe(Me,Je)):Et.push(Je)}return Et},tt=Fe(Le);if(tt.length===0)throw new Error(`${O}At least one property must be provided to update.`);const et={Authorization:`Bearer ${await A.getAccessToken()}`},qe=`${(R=A.env)==null?void 0:R.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${A.projectId}/${Zt["google-sheet"]}/${j}`;return await(async st=>Ht.post(qe,st,{headers:et}))({method:"POST",endpoint:`/v4/spreadsheets/${ie}:batchUpdate`,data:{requests:[{updateSpreadsheetProperties:{properties:Le,fields:tt.join(",")}}]}}),{value:K.Success,result:null,error:null}}catch(A){const x=((I=A.response)==null?void 0:I.data)||A.message||A;return pe.Logger.log("[Google Sheets] error:",x),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:x,result:null}}}})}}const R5=(a,p)=>(pe.Logger.log("[Google Sheets Clone Sheet] error:",p),{value:a.catchesError||a.errorCalls.length?K.CaughtError:K.UnhandledError,error:p,result:null});class b1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsCloneSheet,version:"1.0.0",description:"Google Sheets clone sheet operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsCloneSheet);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A,x,P;try{const O=this.extensionsRegistry.requestContexts(this,[te.Editor])[0],$=Be(t,t.project,"cloneSheet"),Z="["+Ve(t,t.project,"Clone Sheet")+": `"+$+"`] ",j=(qe,ot,st)=>{const ft=Ve(qe==null?void 0:qe.valueOwner,O==null?void 0:O.logic,ot),Et=Be(qe==null?void 0:qe.valueOwner,O==null?void 0:O.logic,st);return`"${ft}" (\`${Et}\`)`},H=G.operation[X.GoogleSheetsCloneSheet],Y=n.find(qe=>{var ot,st;return((st=(ot=qe.valueOwner)==null?void 0:ot.declaration)==null?void 0:st.id)===H.inputs.connection.id}),ie=((s=Y==null?void 0:Y.value)==null?void 0:s.valueAsType)??((u=Y==null?void 0:Y.value)==null?void 0:u.value);if(!ie||!ie.id||!ie.name||ie.type!==r.DefinitionEntity)throw new Error(`${Z}The ${j(Y,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const W=ui(ie);if(!W)throw new Error(`${Z}The ${j(Y,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const z=n.find(qe=>{var ot,st;return((st=(ot=qe.valueOwner)==null?void 0:ot.declaration)==null?void 0:st.id)===H.inputs.spreadsheetId.id}),J=(e=z==null?void 0:z.value)==null?void 0:e.value,ee=ln(J,{errorPrefix:`${Z}The ${j(z,"Spreadsheet ID","spreadsheetId")} input `}),Q=n.find(qe=>{var ot,st;return((st=(ot=qe.valueOwner)==null?void 0:ot.declaration)==null?void 0:st.id)===H.inputs.sheet.id}),re=(f=Q==null?void 0:Q.value)==null?void 0:f.value;if(re==null||re==="")throw new Error(`${Z}The ${j(Q,"Sheet","sheet")} input is missing.`);const ae=(m=(y=n.find(qe=>{var ot,st;return((st=(ot=qe.valueOwner)==null?void 0:ot.declaration)==null?void 0:st.id)===H.inputs.newSheetName.id}))==null?void 0:y.value)==null?void 0:m.value,le=(g=(T=n.find(qe=>{var ot,st;return((st=(ot=qe.valueOwner)==null?void 0:ot.declaration)==null?void 0:st.id)===H.inputs.insertIndex.id}))==null?void 0:T.value)==null?void 0:g.value,ce={Authorization:`Bearer ${await O.getAccessToken()}`},be=`${(b=O.env)==null?void 0:b.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${O.projectId}/${Zt["google-sheet"]}/${W}`,Ce=async qe=>Ht.post(be,qe,{headers:ce});let Ee;if(!isNaN(Number(re)))Ee=Number(re);else{const st=(((R=(await Ce({method:"GET",endpoint:`/v4/spreadsheets/${ee}`})).data)==null?void 0:R.sheets)||[]).find(ft=>{var Et;return((Et=ft.properties)==null?void 0:Et.title)===String(re)});if(!st)return R5(t,`Could not find sheet with name "${re}"`);Ee=st.properties.sheetId}const xe={sourceSheetId:Ee};ae&&(xe.newSheetName=ae),typeof le=="number"&&(xe.insertSheetIndex=le);const tt=((x=(A=(I=((await Ce({method:"POST",endpoint:`/v4/spreadsheets/${ee}:batchUpdate`,data:{requests:[{duplicateSheet:xe}]}})).data||{}).replies)==null?void 0:I[0])==null?void 0:A.duplicateSheet)==null?void 0:x.properties)||{},We=tt.gridProperties||{},et={sheetId:tt.sheetId,title:tt.title,index:tt.index,sheetType:tt.sheetType,rowCount:We.rowCount,columnCount:We.columnCount,frozenRowCount:We.frozenRowCount,frozenColumnCount:We.frozenColumnCount,hideGridlines:We.hideGridlines??!1,rowGroupControlAfter:We.rowGroupControlAfter??!1,columnGroupControlAfter:We.columnGroupControlAfter??!1,hidden:tt.hidden??!1,rightToLeft:tt.rightToLeft??!1,tabColor:tt.tabColor?{red:tt.tabColor.red??0,green:tt.tabColor.green??0,blue:tt.tabColor.blue??0,alpha:tt.tabColor.alpha??1}:null,basicFilter:null,protectedRanges:[],bandedRanges:[],charts:[],conditionalFormatRules:[],mergedCells:[]};return{value:K.Success,error:null,result:et}}catch(O){const $=((P=O.response)==null?void 0:P.data)||O.message||O;return R5(t,$)}}})}}class E1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsDeleteChart,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsDeleteChart);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"deleteChart"),b="["+Ve(t,t.project,"Delete Chart")+": `"+T+"`] ",R=(J,ee,Q)=>{const re=Ve(J==null?void 0:J.valueOwner,m==null?void 0:m.logic,ee),ae=Be(J==null?void 0:J.valueOwner,m==null?void 0:m.logic,Q);return`"${re}" (\`${ae}\`)`},I=n.find(J=>{var ee;return((ee=J.valueOwner.declaration)==null?void 0:ee.id)===G.operation[X.GoogleSheetsDeleteChart].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=ui(A);if(!x)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(J=>{var ee;return((ee=J.valueOwner.declaration)==null?void 0:ee.id)===G.operation[X.GoogleSheetsDeleteChart].inputs.spreadsheetId.id}),O=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(O,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(J=>{var ee;return((ee=J.valueOwner.declaration)==null?void 0:ee.id)===G.operation[X.GoogleSheetsDeleteChart].inputs.chartId.id}),Z=(e=U==null?void 0:U.value)==null?void 0:e.value;let j=typeof Z=="number"?Z:typeof Z=="string"?parseInt(Z,10):NaN;if(isNaN(j))throw new Error(`${b}The ${R(U,"Chart ID","chartId")} input is missing or invalid. Expected a numeric chart ID.`);const Y={Authorization:`Bearer ${await m.getAccessToken()}`},ie=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${x}`,W=async J=>Ht.post(ie,J,{headers:Y});let z={};return z.deleteEmbeddedObject={objectId:j},await W({method:"POST",endpoint:`/v4/spreadsheets/${$}:batchUpdate`,data:{requests:[z]}}),{value:K.Success,result:null,error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class I1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsDeletePivotTable,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsDeletePivotTable);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"deletePivotTable"),b="["+Ve(t,t.project,"Delete Pivot Table")+": `"+T+"`] ",R=(re,ae,le)=>{const oe=Ve(re==null?void 0:re.valueOwner,m==null?void 0:m.logic,ae),ce=Be(re==null?void 0:re.valueOwner,m==null?void 0:m.logic,le);return`"${oe}" (\`${ce}\`)`},I=n.find(re=>{var ae;return((ae=re.valueOwner.declaration)==null?void 0:ae.id)===G.operation[X.GoogleSheetsDeletePivotTable].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=ui(A);if(!x)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(re=>{var ae;return((ae=re.valueOwner.declaration)==null?void 0:ae.id)===G.operation[X.GoogleSheetsDeletePivotTable].inputs.spreadsheetId.id}),O=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(O,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(re=>{var ae;return((ae=re.valueOwner.declaration)==null?void 0:ae.id)===G.operation[X.GoogleSheetsDeletePivotTable].inputs.destination.id}),Z=(e=U==null?void 0:U.value)==null?void 0:e.value;if(Z==null)throw new Error(`${b}The ${R(U,"destination","destination")} input is missing.`);const H={Authorization:`Bearer ${await m.getAccessToken()}`},Y=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${x}`,ie=async re=>Ht.post(Y,re,{headers:H});let W=[];try{W=(await ie({method:"GET",endpoint:`/v4/spreadsheets/${$}?fields=sheets(properties(sheetId,title))`})).data.sheets||[]}catch{}const z=await Ha(Z,"Id",async()=>W.map(re=>({id:re.properties.sheetId,name:re.properties.title}))),J=ps(z,{errorPrefix:`${b}The ${R(U,"destination","destination")} input `});let Q={updateCells:{start:{sheetId:J.sheetId??0,rowIndex:J.startRowIndex??0,columnIndex:J.startColumnIndex??0},rows:[{values:[{pivotTable:null}]}],fields:"pivotTable"}};return await ie({method:"POST",endpoint:`/v4/spreadsheets/${$}:batchUpdate`,data:{requests:[Q]}}),{value:K.Success,result:null,error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class R1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsDeleteDimension,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsDeleteDimension);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b;try{const R=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!R||!R.env)throw new Error("Editor context or environment missing");const I=Be(t,t.project,"deleteDimension"),x="["+Ve(t,t.project,"Delete Dimension")+": `"+I+"`] ",P=(Fe,tt,We)=>{const et=Ve(Fe==null?void 0:Fe.valueOwner,R==null?void 0:R.logic,tt),qe=Be(Fe==null?void 0:Fe.valueOwner,R==null?void 0:R.logic,We);return`"${et}" (\`${qe}\`)`},O=n.find(Fe=>{var tt;return((tt=Fe.valueOwner.declaration)==null?void 0:tt.id)===G.operation[X.GoogleSheetsDeleteDimension].inputs.connection.id}),$=(s=O==null?void 0:O.value)==null?void 0:s.valueAsType;if(!$||!$.id||!$.name||$.type!==r.DefinitionEntity)throw new Error(`${x}The ${P(O,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const U=ui($);if(!U)throw new Error(`${x}The ${P(O,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const Z=n.find(Fe=>{var tt;return((tt=Fe.valueOwner.declaration)==null?void 0:tt.id)===G.operation[X.GoogleSheetsDeleteDimension].inputs.spreadsheetId.id}),j=(u=Z==null?void 0:Z.value)==null?void 0:u.value,H=ln(j,{errorPrefix:`${x}The ${P(Z,"Spreadsheet ID","spreadsheetId")} input `}),Y=n.find(Fe=>{var tt,We;return((tt=Fe.valueOwner.declaration)==null?void 0:tt.id)===((We=G.operation[X.GoogleSheetsDeleteDimension].inputs.sheet)==null?void 0:We.id)}),ie=(e=Y==null?void 0:Y.value)==null?void 0:e.value,W=n.find(Fe=>{var tt,We;return((tt=Fe.valueOwner.declaration)==null?void 0:tt.id)===((We=G.operation[X.GoogleSheetsDeleteDimension].inputs.dimension)==null?void 0:We.id)}),z=(f=W==null?void 0:W.value)==null?void 0:f.value,J=n.find(Fe=>{var tt,We;return((tt=Fe.valueOwner.declaration)==null?void 0:tt.id)===((We=G.operation[X.GoogleSheetsDeleteDimension].inputs.startIndex)==null?void 0:We.id)}),ee=(y=J==null?void 0:J.value)==null?void 0:y.value,Q=n.find(Fe=>{var tt,We;return((tt=Fe.valueOwner.declaration)==null?void 0:tt.id)===((We=G.operation[X.GoogleSheetsDeleteDimension].inputs.endIndex)==null?void 0:We.id)}),re=(m=Q==null?void 0:Q.value)==null?void 0:m.value,le={Authorization:`Bearer ${await R.getAccessToken()}`},oe=`${(T=R.env)==null?void 0:T.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${R.projectId}/${Zt["google-sheet"]}/${U}`,ce=async Fe=>Ht.post(oe,Fe,{headers:le});if(ie==null||ie==="")throw new Error(`${x}The ${P(Y,"Sheet","sheet")} input is missing.`);if(z==null||z==="")throw new Error(`${x}The ${P(W,"Dimension","dimension")} input is missing.`);const be=String(z).trim().toUpperCase();if(be!=="ROWS"&&be!=="COLUMNS")throw new Error(`${x}The ${P(W,"Dimension","dimension")} input is invalid. Expected "Rows" or "Columns".`);const Ce=typeof ee=="number"?ee:parseInt(String(ee),10);if(isNaN(Ce)||Ce<1)throw new Error(`${x}The ${P(J,"Start index","startIndex")} input is missing or invalid. Expected a positive integer starting at 1.`);let Ee=Ce;if(re!=null&&re!==""&&(Ee=typeof re=="number"?re:parseInt(String(re),10),isNaN(Ee)||Ee<Ce))throw new Error(`${x}The ${P(Q,"End index","endIndex")} input is invalid. Expected an integer greater than or equal to Start index.`);let xe;if(typeof ie=="number"||/^\d+$/.test(String(ie).trim()))xe=Number(ie);else{const We=(((g=(await ce({method:"GET",endpoint:`/v4/spreadsheets/${H}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:g.sheets)||[]).find(et=>{var qe;return String((qe=et.properties)==null?void 0:qe.title).trim().toLowerCase()===String(ie).trim().toLowerCase()});if(!We)throw new Error(`${x}The ${P(Y,"Sheet","sheet")} input "${ie}" was not found in spreadsheet.`);xe=We.properties.sheetId}let Le={};return Le.deleteDimension={range:{sheetId:xe,dimension:be,startIndex:Ce-1,endIndex:Ee}},await ce({method:"POST",endpoint:`/v4/spreadsheets/${H}:batchUpdate`,data:{requests:[Le]}}),{value:K.Success,result:null,error:null}}catch(R){const I=((b=R.response)==null?void 0:b.data)||R.message||R;return pe.Logger.log("[Google Sheets] error:",I),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:I,result:null}}}})}}class A1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsDeleteProtectedRange,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsDeleteProtectedRange);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"deleteProtectedRange"),b="["+Ve(t,t.project,"Delete Protected Range")+": `"+T+"`] ",R=(z,J,ee)=>{const Q=Ve(z==null?void 0:z.valueOwner,m==null?void 0:m.logic,J),re=Be(z==null?void 0:z.valueOwner,m==null?void 0:m.logic,ee);return`"${Q}" (\`${re}\`)`},I=n.find(z=>{var J;return((J=z.valueOwner.declaration)==null?void 0:J.id)===G.operation[X.GoogleSheetsDeleteProtectedRange].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=ui(A);if(!x)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(z=>{var J;return((J=z.valueOwner.declaration)==null?void 0:J.id)===G.operation[X.GoogleSheetsDeleteProtectedRange].inputs.spreadsheetId.id}),O=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(O,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(z=>{var J;return((J=z.valueOwner.declaration)==null?void 0:J.id)===G.operation[X.GoogleSheetsDeleteProtectedRange].inputs.protectedRangeId.id}),Z=(e=U==null?void 0:U.value)==null?void 0:e.value;if(Z==null)throw new Error(`${b}The ${R(U,"protectedRangeId","protectedRangeId")} input is missing.`);const H={Authorization:`Bearer ${await m.getAccessToken()}`},Y=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${x}`,ie=async z=>Ht.post(Y,z,{headers:H});let W={};return W.deleteProtectedRange={protectedRangeId:typeof Z=="string"&&Z.trim().startsWith("{")?JSON.parse(Z):Z},await ie({method:"POST",endpoint:`/v4/spreadsheets/${$}:batchUpdate`,data:{requests:[W]}}),{value:K.Success,result:null,error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class D1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsAddBanding,version:"1.0.0",description:"Add Banding Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsAddBanding);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A,x,P,O,$,U;try{const Z=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!Z||!Z.env)throw new Error("Editor context or environment missing");const j=Be(t,t.project,"addBanding"),Y="["+Ve(t,t.project,"Add Banding")+": `"+j+"`] ",ie=(di,bt,dt)=>{const It=Ve(di==null?void 0:di.valueOwner,Z==null?void 0:Z.logic,bt),Wt=Be(di==null?void 0:di.valueOwner,Z==null?void 0:Z.logic,dt);return`"${It}" (\`${Wt}\`)`},W=n.find(di=>{var bt;return((bt=di.valueOwner.declaration)==null?void 0:bt.id)===G.operation[X.GoogleSheetsAddBanding].inputs.connection.id}),z=(s=W==null?void 0:W.value)==null?void 0:s.valueAsType;if(!z||!z.id||!z.name||z.type!==r.DefinitionEntity)throw new Error(`${Y}The ${ie(W,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const J=ui(z);if(!J)throw new Error(`${Y}The ${ie(W,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const ee=n.find(di=>{var bt;return((bt=di.valueOwner.declaration)==null?void 0:bt.id)===G.operation[X.GoogleSheetsAddBanding].inputs.spreadsheetId.id}),Q=(u=ee==null?void 0:ee.value)==null?void 0:u.value,re=ln(Q,{errorPrefix:`${Y}The ${ie(ee,"Spreadsheet ID","spreadsheetId")} input `}),ae=n.find(di=>{var bt;return((bt=di.valueOwner.declaration)==null?void 0:bt.id)===G.operation[X.GoogleSheetsAddBanding].inputs.bandedRange.id}),le=(e=ae==null?void 0:ae.value)==null?void 0:e.value;if(le==null)throw new Error(`${Y}The ${ie(ae,"bandedRange","bandedRange")} input is missing.`);const oe=n.find(di=>{var bt,dt;return((bt=di.valueOwner.declaration)==null?void 0:bt.id)===((dt=G.operation[X.GoogleSheetsAddBanding].inputs.bandingOrientation)==null?void 0:dt.id)}),ce=(f=oe==null?void 0:oe.value)==null?void 0:f.value,be=typeof ce=="string"?ce:"Rows";if(!["Rows","Columns","Grid"].includes(be))throw new Error(`${Y}The ${ie(oe,"Banding Orientation","bandingOrientation")} input must be one of "Rows", "Columns", or "Grid". Received: "${be}".`);const Ce=n.find(di=>{var bt,dt;return((bt=di.valueOwner.declaration)==null?void 0:bt.id)===((dt=G.operation[X.GoogleSheetsAddBanding].inputs.headerColor)==null?void 0:dt.id)}),Ee=(y=Ce==null?void 0:Ce.value)==null?void 0:y.value,xe=n.find(di=>{var bt,dt;return((bt=di.valueOwner.declaration)==null?void 0:bt.id)===((dt=G.operation[X.GoogleSheetsAddBanding].inputs.firstBandColor)==null?void 0:dt.id)}),Le=(m=xe==null?void 0:xe.value)==null?void 0:m.value,Fe=n.find(di=>{var bt,dt;return((bt=di.valueOwner.declaration)==null?void 0:bt.id)===((dt=G.operation[X.GoogleSheetsAddBanding].inputs.secondBandColor)==null?void 0:dt.id)}),tt=(T=Fe==null?void 0:Fe.value)==null?void 0:T.value,We=n.find(di=>{var bt,dt;return((bt=di.valueOwner.declaration)==null?void 0:bt.id)===((dt=G.operation[X.GoogleSheetsAddBanding].inputs.footerColor)==null?void 0:dt.id)}),et=(g=We==null?void 0:We.value)==null?void 0:g.value,qe=n.find(di=>{var bt,dt;return((bt=di.valueOwner.declaration)==null?void 0:bt.id)===((dt=G.operation[X.GoogleSheetsAddBanding].inputs.gridBandColor)==null?void 0:dt.id)}),ot=(b=qe==null?void 0:qe.value)==null?void 0:b.value,st=n.find(di=>{var bt,dt;return((bt=di.valueOwner.declaration)==null?void 0:bt.id)===((dt=G.operation[X.GoogleSheetsAddBanding].inputs.deleteConflictingBanding)==null?void 0:dt.id)}),ft=((R=st==null?void 0:st.value)==null?void 0:R.value)??!0,pt={Authorization:`Bearer ${await Z.getAccessToken()}`},Me=`${(I=Z.env)==null?void 0:I.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${Z.projectId}/${Zt["google-sheet"]}/${J}`,Je=async di=>Ht.post(Me,di,{headers:pt});let ke=[],lt=[];try{lt=(await Je({method:"GET",endpoint:`/v4/spreadsheets/${re}?fields=sheets(properties(sheetId,title),bandedRanges)`})).data.sheets||[]}catch{}const Pt=await Ha(le,"Id",async()=>lt.map(di=>({id:di.properties.sheetId,name:di.properties.title}))),Gt=ps(Pt,{errorPrefix:`${Y}The ${ie(ae,"bandedRange","bandedRange")} input `});let si=null;if(Gt.sheetId!==void 0&&Gt.sheetId!==null)si=lt.find(di=>{var bt;return((bt=di.properties)==null?void 0:bt.sheetId)===Gt.sheetId});else if(Pt&&Pt.sheet!==void 0&&Pt.sheet!==null&&Pt.sheet!==""){const di=String(Pt.sheet).trim().toLowerCase();if(si=lt.find(bt=>{var dt,It;return String((dt=bt.properties)==null?void 0:dt.title).trim().toLowerCase()===di||String((It=bt.properties)==null?void 0:It.sheetId)===di}),!si)throw new Error(`${Y}Sheet "${Pt.sheet}" was not found in the spreadsheet.`);Gt.sheetId=si.properties.sheetId}else si=lt[0],Gt.sheetId=((A=si==null?void 0:si.properties)==null?void 0:A.sheetId)??0;Gt.startRowIndex===void 0&&Gt.endRowIndex===void 0&&Gt.startColumnIndex===void 0&&Gt.endColumnIndex===void 0&&(Gt.startRowIndex=0,Gt.endRowIndex=100,Gt.startColumnIndex=0,Gt.endColumnIndex=26),si!=null&&si.bandedRanges&&(ke=si.bandedRanges);const pi={range:Gt},kt=fo(Ee),Ct=fo(Le),Oi=fo(tt),wn=fo(et),Yr=fo(ot),Jr={firstBandColor:Ct||{red:1,green:1,blue:1,alpha:1},secondBandColor:Oi||{red:.95,green:.95,blue:.95,alpha:1}};kt&&(Jr.headerColor=kt),wn&&(Jr.footerColor=wn);const hi={firstBandColor:be==="Grid"?Yr||Ct||{red:1,green:1,blue:1,alpha:1}:Ct||{red:1,green:1,blue:1,alpha:1},secondBandColor:be==="Grid"?Yr||Oi||{red:.95,green:.95,blue:.95,alpha:1}:Oi||{red:.95,green:.95,blue:.95,alpha:1}};kt&&(hi.headerColor=kt),wn&&(hi.footerColor=wn),be==="Grid"?(pi.rowProperties=Jr,pi.columnProperties=hi):be==="Columns"?pi.columnProperties=hi:pi.rowProperties=Jr;const $t=[];if(ft)for(const di of ke)di.bandedRangeId!==void 0&&$t.push({deleteBanding:{bandedRangeId:di.bandedRangeId}});$t.push({addBanding:{bandedRange:pi}});const ci=(P=(x=(await Je({method:"POST",endpoint:`/v4/spreadsheets/${re}:batchUpdate`,data:{requests:$t}})).data)==null?void 0:x.replies)==null?void 0:P.find(di=>di.addBanding),oi=($=(O=ci==null?void 0:ci.addBanding)==null?void 0:O.bandedRange)==null?void 0:$.bandedRangeId;return{value:K.Success,result:{bandedRangeId:oi},error:null}}catch(Z){const j=((U=Z.response)==null?void 0:U.data)||Z.message||Z;return pe.Logger.log("[Google Sheets] error:",j),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:j,result:null}}}})}}class LRn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsUpdateBanding,version:"1.0.0",description:"Update Banding Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsUpdateBanding);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A;try{const x=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!x||!x.env)throw new Error("Editor context or environment missing");const P=Be(t,t.project,"updateBanding"),$="["+Ve(t,t.project,"Update Banding")+": `"+P+"`] ",U=(ci,oi,di)=>{const bt=Ve(ci==null?void 0:ci.valueOwner,x==null?void 0:x.logic,oi),dt=Be(ci==null?void 0:ci.valueOwner,x==null?void 0:x.logic,di);return`"${bt}" (\`${dt}\`)`},Z=n.find(ci=>{var oi;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===G.operation[X.GoogleSheetsUpdateBanding].inputs.connection.id}),j=(s=Z==null?void 0:Z.value)==null?void 0:s.valueAsType;if(!j||!j.id||!j.name||j.type!==r.DefinitionEntity)throw new Error(`${$}The ${U(Z,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const H=ui(j);if(!H)throw new Error(`${$}The ${U(Z,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const Y=n.find(ci=>{var oi;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===G.operation[X.GoogleSheetsUpdateBanding].inputs.spreadsheetId.id}),ie=(u=Y==null?void 0:Y.value)==null?void 0:u.value,W=ln(ie,{errorPrefix:`${$}The ${U(Y,"Spreadsheet ID","spreadsheetId")} input `}),z=n.find(ci=>{var oi;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===G.operation[X.GoogleSheetsUpdateBanding].inputs.bandedRangeId.id}),J=(e=z==null?void 0:z.value)==null?void 0:e.value;if(J==null||J==="")throw new Error(`${$}The ${U(z,"Banded Range ID","bandedRangeId")} input is missing.`);const ee=Number(J),Q=n.find(ci=>{var oi,di;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===((di=G.operation[X.GoogleSheetsUpdateBanding].inputs.bandedRange)==null?void 0:di.id)}),re=(f=Q==null?void 0:Q.value)==null?void 0:f.value,ae=n.find(ci=>{var oi,di;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===((di=G.operation[X.GoogleSheetsUpdateBanding].inputs.bandingOrientation)==null?void 0:di.id)}),le=(y=ae==null?void 0:ae.value)==null?void 0:y.value,oe=n.find(ci=>{var oi,di;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===((di=G.operation[X.GoogleSheetsUpdateBanding].inputs.headerColor)==null?void 0:di.id)}),ce=(m=oe==null?void 0:oe.value)==null?void 0:m.value,be=n.find(ci=>{var oi,di;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===((di=G.operation[X.GoogleSheetsUpdateBanding].inputs.firstBandColor)==null?void 0:di.id)}),Ce=(T=be==null?void 0:be.value)==null?void 0:T.value,Ee=n.find(ci=>{var oi,di;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===((di=G.operation[X.GoogleSheetsUpdateBanding].inputs.secondBandColor)==null?void 0:di.id)}),xe=(g=Ee==null?void 0:Ee.value)==null?void 0:g.value,Le=n.find(ci=>{var oi,di;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===((di=G.operation[X.GoogleSheetsUpdateBanding].inputs.footerColor)==null?void 0:di.id)}),Fe=(b=Le==null?void 0:Le.value)==null?void 0:b.value,tt=n.find(ci=>{var oi,di;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===((di=G.operation[X.GoogleSheetsUpdateBanding].inputs.gridBandColor)==null?void 0:di.id)}),We=(R=tt==null?void 0:tt.value)==null?void 0:R.value,qe={Authorization:`Bearer ${await x.getAccessToken()}`},ot=`${(I=x.env)==null?void 0:I.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${x.projectId}/${Zt["google-sheet"]}/${H}`,st=async ci=>Ht.post(ot,ci,{headers:qe});let ft=[];try{ft=(await st({method:"GET",endpoint:`/v4/spreadsheets/${W}?fields=sheets(properties(sheetId,title),bandedRanges)`})).data.sheets||[]}catch{}const Et=[];for(const ci of ft)if(ci.bandedRanges)for(const oi of ci.bandedRanges)Et.push({sheet:ci,band:oi});const pt=Et.find(ci=>Number(ci.band.bandedRangeId)===Number(ee));if(Et.length>0&&!pt)throw new Error(`${$}No Banded Range with ID "${ee}" was found in the sheet.`);const Me=pt==null?void 0:pt.band,Je={bandedRangeId:ee};if(re){const ci=await Ha(re,"Id",async()=>ft.map(di=>({id:di.properties.sheetId,name:di.properties.title}))),oi=ps(ci,{errorPrefix:`${$}The ${U(Q,"bandedRange","bandedRange")} input `});(oi.sheetId===void 0||oi.sheetId===null)&&(oi.sheetId=0),Je.range=oi}else Me!=null&&Me.range&&(Je.range=Me.range);const ke=Me!=null&&Me.rowProperties&&(Me!=null&&Me.columnProperties)?"Grid":Me!=null&&Me.columnProperties?"Columns":"Rows",lt=le||ke,Pt=fo(ce),Gt=fo(Ce),si=fo(xe),pi=fo(Fe),kt=fo(We),Ct=(Me==null?void 0:Me.rowProperties)||{},Oi=(Me==null?void 0:Me.columnProperties)||{},wn={firstBandColor:Gt||Ct.firstBandColor||{red:1,green:1,blue:1,alpha:1},secondBandColor:si||Ct.secondBandColor||{red:.95,green:.95,blue:.95,alpha:1}},Yr=Pt||Ct.headerColor;Yr&&(wn.headerColor=Yr);const Jr=pi||Ct.footerColor;Jr&&(wn.footerColor=Jr);const hi={firstBandColor:lt==="Grid"?kt||Gt||Oi.firstBandColor||{red:1,green:1,blue:1,alpha:1}:Gt||Oi.firstBandColor||{red:1,green:1,blue:1,alpha:1},secondBandColor:lt==="Grid"?kt||si||Oi.secondBandColor||{red:.95,green:.95,blue:.95,alpha:1}:si||Oi.secondBandColor||{red:.95,green:.95,blue:.95,alpha:1}},$t=Pt||Oi.headerColor;$t&&(hi.headerColor=$t);const Nt=pi||Oi.footerColor;return Nt&&(hi.footerColor=Nt),lt==="Grid"?(Je.rowProperties=wn,Je.columnProperties=hi):lt==="Columns"?Je.columnProperties=hi:Je.rowProperties=wn,await st({method:"POST",endpoint:`/v4/spreadsheets/${W}:batchUpdate`,data:{requests:[{updateBanding:{bandedRange:Je,fields:"*"}}]}}),{value:K.Success,result:null,error:null}}catch(x){const P=((A=x.response)==null?void 0:A.data)||x.message||x;return pe.Logger.log("[Google Sheets] error:",P),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:P,result:null}}}})}}class BRn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsDeleteBanding,version:"1.0.0",description:"Delete Banding Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsDeleteBanding);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"deleteBanding"),b="["+Ve(t,t.project,"Delete Banding")+": `"+T+"`] ",R=(z,J,ee)=>{const Q=Ve(z==null?void 0:z.valueOwner,m==null?void 0:m.logic,J),re=Be(z==null?void 0:z.valueOwner,m==null?void 0:m.logic,ee);return`"${Q}" (\`${re}\`)`},I=n.find(z=>{var J;return((J=z.valueOwner.declaration)==null?void 0:J.id)===G.operation[X.GoogleSheetsDeleteBanding].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=ui(A);if(!x)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(z=>{var J;return((J=z.valueOwner.declaration)==null?void 0:J.id)===G.operation[X.GoogleSheetsDeleteBanding].inputs.spreadsheetId.id}),O=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(O,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(z=>{var J;return((J=z.valueOwner.declaration)==null?void 0:J.id)===G.operation[X.GoogleSheetsDeleteBanding].inputs.bandedRangeId.id}),Z=(e=U==null?void 0:U.value)==null?void 0:e.value;if(Z==null||Z==="")throw new Error(`${b}The ${R(U,"Banded Range ID","bandedRangeId")} input is missing.`);const j=Number(Z),Y={Authorization:`Bearer ${await m.getAccessToken()}`},ie=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${x}`;return await(async z=>Ht.post(ie,z,{headers:Y}))({method:"POST",endpoint:`/v4/spreadsheets/${$}:batchUpdate`,data:{requests:[{deleteBanding:{bandedRangeId:j}}]}}),{value:K.Success,result:null,error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class C1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsAddChart,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsAddChart);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T;try{const g=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!g||!g.env)throw new Error("Editor context or environment missing");const b=Be(t,t.project,"addChart"),I="["+Ve(t,t.project,"Add Chart")+": `"+b+"`] ",A=(oe,ce,be)=>{const Ce=Ve(oe==null?void 0:oe.valueOwner,g==null?void 0:g.logic,ce),Ee=Be(oe==null?void 0:oe.valueOwner,g==null?void 0:g.logic,be);return`"${Ce}" (\`${Ee}\`)`},x=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[X.GoogleSheetsAddChart].inputs.connection.id}),P=(s=x==null?void 0:x.value)==null?void 0:s.valueAsType;if(!P||!P.id||!P.name||P.type!==r.DefinitionEntity)throw new Error(`${I}The ${A(x,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(P);if(!O)throw new Error(`${I}The ${A(x,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const $=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[X.GoogleSheetsAddChart].inputs.spreadsheetId.id}),U=(u=$==null?void 0:$.value)==null?void 0:u.value,Z=ln(U,{errorPrefix:`${I}The ${A($,"Spreadsheet ID","spreadsheetId")} input `}),j=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[X.GoogleSheetsAddChart].inputs.chart.id}),H=(e=j==null?void 0:j.value)==null?void 0:e.value;if(H==null||typeof H!="object")throw new Error(`${I}The ${A(j,"Chart","chart")} input is missing or invalid. Expected a valid chart object.`);const ie={Authorization:`Bearer ${await g.getAccessToken()}`},W=`${(f=g.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${g.projectId}/${Zt["google-sheet"]}/${O}`,z=async oe=>Ht.post(W,oe,{headers:ie});let J={};J.addChart={chart:H};const Q=(await z({method:"POST",endpoint:`/v4/spreadsheets/${Z}:batchUpdate`,data:{requests:[J]}})).data,re=(m=(y=Q==null?void 0:Q.replies)==null?void 0:y[0])==null?void 0:m.addChart,ae=(re==null?void 0:re.chart)??null,le=(ae==null?void 0:ae.chartId)??null;return{value:K.Success,result:{chartId:le,chart:ae},error:null}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return pe.Logger.log("[Google Sheets] error:",b),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:b,result:null}}}})}}function SRn(a){return{"Number greater than":"NUMBER_GREATER","Number greater than or equal":"NUMBER_GREATER_THAN_EQ","Number less than":"NUMBER_LESS","Number less than or equal":"NUMBER_LESS_THAN_EQ","Number equal to":"NUMBER_EQ","Number not equal to":"NUMBER_NOT_EQ","Number between":"NUMBER_BETWEEN","Number not between":"NUMBER_NOT_BETWEEN","Text contains":"TEXT_CONTAINS","Text does not contain":"TEXT_NOT_CONTAINS","Text starts with":"TEXT_STARTS_WITH","Text ends with":"TEXT_ENDS_WITH","Text equals":"TEXT_EQ","Date is":"DATE_EQ","Date is before":"DATE_BEFORE","Date is after":"DATE_AFTER","Date is on or before":"DATE_ON_OR_BEFORE","Date is on or after":"DATE_ON_OR_AFTER","Cell is empty":"BLANK","Cell is not empty":"NOT_BLANK","Custom formula":"CUSTOM_FORMULA"}[a]||a}class w1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsAddConditionalFormatRule,version:"1.0.0",description:"Add Conditional Format Rule Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsAddConditionalFormatRule);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"addConditionalFormatRule"),b="["+Ve(t,t.project,"Add Conditional Format Rule")+": `"+T+"`] ",R=(pt,Me,Je)=>{const ke=Ve(pt==null?void 0:pt.valueOwner,m==null?void 0:m.logic,Me),lt=Be(pt==null?void 0:pt.valueOwner,m==null?void 0:m.logic,Je);return`"${ke}" (\`${lt}\`)`},I=G.operation[X.GoogleSheetsAddConditionalFormatRule].inputs,A=pt=>{var Je;const Me=n.find(ke=>{var lt;return((lt=ke.valueOwner.declaration)==null?void 0:lt.id)===pt});return(Je=Me==null?void 0:Me.value)==null?void 0:Je.value},x=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===I.connection.id}),P=(s=x==null?void 0:x.value)==null?void 0:s.valueAsType;if(!P||!P.id||!P.name||P.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(x,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(P);if(!O)throw new Error(`${b}The ${R(x,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const $=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===I.spreadsheetId.id}),U=(u=$==null?void 0:$.value)==null?void 0:u.value,Z=ln(U,{errorPrefix:`${b}The ${R($,"Spreadsheet ID","spreadsheetId")} input `}),H={Authorization:`Bearer ${await m.getAccessToken()}`},Y=`${(e=m.env)==null?void 0:e.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${O}`,ie=async pt=>Ht.post(Y,pt,{headers:H}),W=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===I.range.id}),z=A(I.range.id),J=A(I.conditionType.id),ee=A(I.conditionValues.id),Q=A(I.backgroundColor.id),re=A(I.textColor.id),ae=A(I.bold.id),le=A(I.italic.id),oe=A(I.strikethrough.id),ce=A(I.underline.id),be=A(I.index.id),Ce=A(I.fontSize.id),Ee=A(I.fontFamily.id),xe=A(I.horizontalAlignment.id),Le=A(I.verticalAlignment.id),Fe=A(I.wrapStrategy.id);if(!z)throw new Error(`${b}The ${R(W,"Range","range")} input must be provided.`);let tt=ps(z,{errorPrefix:`${b}The Range input `});if(tt.sheetId===void 0){let pt;if(typeof z=="object"&&z!==null&&"sheet"in z?pt=String(z.sheet):typeof z=="string"&&z.includes("!")&&(pt=z.split("!")[0].replace(/^'|'$/g,"")),pt)if(/^\d+$/.test(pt.trim()))tt.sheetId=Number(pt.trim());else{const ke=(((f=(await ie({method:"GET",endpoint:`/v4/spreadsheets/${Z}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:f.sheets)||[]).find(lt=>{var Pt;return String((Pt=lt.properties)==null?void 0:Pt.title).trim().toLowerCase()===pt.trim().toLowerCase()});ke&&(tt.sheetId=ke.properties.sheetId)}}const We=SRn(String(J||"BLANK"));let et=[];Array.isArray(ee)?et=ee.map(pt=>({userEnteredValue:String(pt)})):ee!=null&&ee!==""&&(et=[{userEnteredValue:String(ee)}]);const qe={},ot=fo(Q);ot&&(qe.backgroundColor=ot);const st=fo(re);if(st&&(qe.textFormat=qe.textFormat||{},qe.textFormat.foregroundColor=st),(ae===!0||ae==="true")&&(qe.textFormat=qe.textFormat||{},qe.textFormat.bold=!0),(le===!0||le==="true")&&(qe.textFormat=qe.textFormat||{},qe.textFormat.italic=!0),(oe===!0||oe==="true")&&(qe.textFormat=qe.textFormat||{},qe.textFormat.strikethrough=!0),(ce===!0||ce==="true")&&(qe.textFormat=qe.textFormat||{},qe.textFormat.underline=!0),Ce!=null&&Ce!==""){const pt=typeof Ce=="number"?Ce:parseInt(String(Ce),10);isNaN(pt)||(qe.textFormat=qe.textFormat||{},qe.textFormat.fontSize=pt)}if(typeof Ee=="string"&&Ee.trim()!==""&&(qe.textFormat=qe.textFormat||{},qe.textFormat.fontFamily=Ee.trim()),typeof xe=="string"&&xe!==""){const pt={Left:"LEFT",Center:"CENTER",Right:"RIGHT",Justify:"JUSTIFY"};qe.horizontalAlignment=pt[xe]||xe.toUpperCase()}if(typeof Le=="string"&&Le!==""){const pt={Top:"TOP",Middle:"MIDDLE",Bottom:"BOTTOM"};qe.verticalAlignment=pt[Le]||Le.toUpperCase()}if(typeof Fe=="string"&&Fe!==""){const pt={Overflow:"OVERFLOW_CELL",Wrap:"WRAP",Clip:"CLIP"};qe.wrapStrategy=pt[Fe]||Fe.toUpperCase()}const Et={rule:{ranges:[tt],booleanRule:{condition:{type:We,...et.length?{values:et}:{}},format:qe}}};if(be!=null&&be!==""){const pt=typeof be=="number"?be:parseInt(String(be),10);if(isNaN(pt)||pt<1)throw new Error(`${b}The Index input must be a 1-based positive integer.`);Et.index=pt-1}return await ie({method:"POST",endpoint:`/v4/spreadsheets/${Z}:batchUpdate`,data:{requests:[{addConditionalFormatRule:Et}]}}),{value:K.Success,result:null,error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class x1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsAddProtectedRange,version:"1.0.0",description:"Add Protected Range Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsAddProtectedRange);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A,x,P,O,$;try{const U=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!U||!U.env)throw new Error("Editor context or environment missing");const Z=Be(t,t.project,"addProtectedRange"),H="["+Ve(t,t.project,"Add Protected Range")+": `"+Z+"`] ",Y=(Pt,Gt,si)=>{const pi=Ve(Pt==null?void 0:Pt.valueOwner,U==null?void 0:U.logic,Gt),kt=Be(Pt==null?void 0:Pt.valueOwner,U==null?void 0:U.logic,si);return`"${pi}" (\`${kt}\`)`},ie=n.find(Pt=>{var Gt;return((Gt=Pt.valueOwner.declaration)==null?void 0:Gt.id)===G.operation[X.GoogleSheetsAddProtectedRange].inputs.connection.id}),W=(s=ie==null?void 0:ie.value)==null?void 0:s.valueAsType;if(!W||!W.id||!W.name||W.type!==r.DefinitionEntity)throw new Error(`${H}The ${Y(ie,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const z=ui(W);if(!z)throw new Error(`${H}The ${Y(ie,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const J=n.find(Pt=>{var Gt;return((Gt=Pt.valueOwner.declaration)==null?void 0:Gt.id)===G.operation[X.GoogleSheetsAddProtectedRange].inputs.spreadsheetId.id}),ee=(u=J==null?void 0:J.value)==null?void 0:u.value,Q=ln(ee,{errorPrefix:`${H}The ${Y(J,"Spreadsheet ID","spreadsheetId")} input `}),re=n.find(Pt=>{var Gt;return((Gt=Pt.valueOwner.declaration)==null?void 0:Gt.id)===G.operation[X.GoogleSheetsAddProtectedRange].inputs.range.id}),ae=(e=re==null?void 0:re.value)==null?void 0:e.value;if(ae==null)throw new Error(`${H}The ${Y(re,"Protected Range","range")} input is missing.`);const le=n.find(Pt=>{var Gt;return((Gt=Pt.valueOwner.declaration)==null?void 0:Gt.id)===G.operation[X.GoogleSheetsAddProtectedRange].inputs.description.id}),oe=(f=le==null?void 0:le.value)==null?void 0:f.value,ce=n.find(Pt=>{var Gt;return((Gt=Pt.valueOwner.declaration)==null?void 0:Gt.id)===G.operation[X.GoogleSheetsAddProtectedRange].inputs.warningOnly.id}),be=(y=ce==null?void 0:ce.value)==null?void 0:y.value,Ce=n.find(Pt=>{var Gt;return((Gt=Pt.valueOwner.declaration)==null?void 0:Gt.id)===G.operation[X.GoogleSheetsAddProtectedRange].inputs.editors.id}),Ee=(m=Ce==null?void 0:Ce.value)==null?void 0:m.value,xe=n.find(Pt=>{var Gt;return((Gt=Pt.valueOwner.declaration)==null?void 0:Gt.id)===G.operation[X.GoogleSheetsAddProtectedRange].inputs.domainUsersCanEdit.id}),Le=(T=xe==null?void 0:xe.value)==null?void 0:T.value,tt={Authorization:`Bearer ${await U.getAccessToken()}`},We=`${(g=U.env)==null?void 0:g.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${U.projectId}/${Zt["google-sheet"]}/${z}`,et=async Pt=>Ht.post(We,Pt,{headers:tt});let qe=[];try{qe=((b=(await et({method:"GET",endpoint:`/v4/spreadsheets/${Q}?fields=sheets(properties(sheetId,title))`})).data)==null?void 0:b.sheets)||[]}catch{}const ot=await Ha(ae,"Id",async()=>qe.map(Pt=>{var Gt,si;return{id:(Gt=Pt.properties)==null?void 0:Gt.sheetId,name:(si=Pt.properties)==null?void 0:si.title}})),ft={range:ps(ot,{errorPrefix:`${H}The ${Y(re,"Protected Range","range")} input `})};oe!=null&&oe!==""&&(ft.description=oe);const Et=Array.isArray(Ee)&&Ee.length>0,pt=typeof Le=="boolean";if(be===!0&&Et)throw new Error(`${H}When ${Y(ce,"Warning Only","warningOnly")} is enabled (true), ${Y(Ce,"Editors","editors")} cannot be specified.`);if(be===!0&&pt)throw new Error(`${H}When ${Y(ce,"Warning Only","warningOnly")} is enabled (true), ${Y(xe,"Domain Users Can Edit","domainUsersCanEdit")} cannot be specified.`);if(typeof be=="boolean"&&(ft.warningOnly=be),!ft.warningOnly&&(Et||pt)){const Pt={};Et&&(Pt.users=Ee),pt&&(Pt.domainUsersCanEdit=Le),ft.editors=Pt}const Me=n.find(Pt=>{var Gt;return((Gt=Pt.valueOwner.declaration)==null?void 0:Gt.id)===G.operation[X.GoogleSheetsAddProtectedRange].inputs.unprotectedRanges.id}),Je=(R=Me==null?void 0:Me.value)==null?void 0:R.value;if(Array.isArray(Je)&&Je.length>0){const Pt=await Promise.all(Je.map(async Gt=>{const si=await Ha(Gt,"Id",async()=>qe.map(pi=>{var kt,Ct;return{id:(kt=pi.properties)==null?void 0:kt.sheetId,name:(Ct=pi.properties)==null?void 0:Ct.title}}));return ps(si,{errorPrefix:`${H}The ${Y(Me,"Exception ranges","unprotectedRanges")} input `})}));ft.unprotectedRanges=Pt}const lt=(O=(P=(x=(A=(I=(await et({method:"POST",endpoint:`/v4/spreadsheets/${Q}:batchUpdate`,data:{requests:[{addProtectedRange:{protectedRange:ft}}]}})).data)==null?void 0:I.replies)==null?void 0:A[0])==null?void 0:x.addProtectedRange)==null?void 0:P.protectedRange)==null?void 0:O.protectedRangeId;return{value:K.Success,result:{protectedRangeId:lt},error:null}}catch(U){const Z=(($=U.response)==null?void 0:$.data)||U.message||U;return pe.Logger.log("[Google Sheets] error:",Z),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:Z,result:null}}}})}}class O1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsUpdateChartSpec,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsUpdateChartSpec);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=Be(t,t.project,"updateChartSpec"),R="["+Ve(t,t.project,"Update Chart Spec")+": `"+g+"`] ",I=(ae,le,oe)=>{const ce=Ve(ae==null?void 0:ae.valueOwner,T==null?void 0:T.logic,le),be=Be(ae==null?void 0:ae.valueOwner,T==null?void 0:T.logic,oe);return`"${ce}" (\`${be}\`)`},A=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[X.GoogleSheetsUpdateChartSpec].inputs.connection.id}),x=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!x||!x.id||!x.name||x.type!==r.DefinitionEntity)throw new Error(`${R}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const P=ui(x);if(!P)throw new Error(`${R}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const O=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[X.GoogleSheetsUpdateChartSpec].inputs.spreadsheetId.id}),$=(u=O==null?void 0:O.value)==null?void 0:u.value,U=ln($,{errorPrefix:`${R}The ${I(O,"Spreadsheet ID","spreadsheetId")} input `}),Z=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[X.GoogleSheetsUpdateChartSpec].inputs.chartId.id}),j=(e=Z==null?void 0:Z.value)==null?void 0:e.value;let H=typeof j=="number"?j:typeof j=="string"?parseInt(j,10):NaN;if(isNaN(H))throw new Error(`${R}The ${I(Z,"Chart ID","chartId")} input is missing or invalid. Expected a numeric chart ID.`);const Y=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[X.GoogleSheetsUpdateChartSpec].inputs.chart.id}),ie=(f=Y==null?void 0:Y.value)==null?void 0:f.value;if(ie==null||typeof ie!="object")throw new Error(`${R}The ${I(Y,"Chart Spec","chart")} input is missing or invalid. Expected a valid chart object.`);const z={Authorization:`Bearer ${await T.getAccessToken()}`},J=`${(y=T.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${T.projectId}/${Zt["google-sheet"]}/${P}`,ee=async ae=>Ht.post(J,ae,{headers:z}),Q=ie.spec?ie.spec:ie;let re={};return re.updateChartSpec={chartId:H,spec:Q},await ee({method:"POST",endpoint:`/v4/spreadsheets/${U}:batchUpdate`,data:{requests:[re]}}),{value:K.Success,result:null,error:null}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return pe.Logger.log("[Google Sheets] error:",g),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:g,result:null}}}})}}class P1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsCreatePivotTable,version:"1.0.0",description:"Create Pivot Table Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsCreatePivotTable);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R;try{const I=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!I||!I.env)throw new Error("Editor context or environment missing");const A=Be(t,t.project,"createPivotTable"),P="["+Ve(t,t.project,"Create Pivot Table")+": `"+A+"`] ",O=(ke,lt,Pt)=>{const Gt=Ve(ke==null?void 0:ke.valueOwner,I==null?void 0:I.logic,lt),si=Be(ke==null?void 0:ke.valueOwner,I==null?void 0:I.logic,Pt);return`"${Gt}" (\`${si}\`)`},$=n.find(ke=>{var lt;return((lt=ke.valueOwner.declaration)==null?void 0:lt.id)===G.operation[X.GoogleSheetsCreatePivotTable].inputs.connection.id}),U=(s=$==null?void 0:$.value)==null?void 0:s.valueAsType;if(!U||!U.id||!U.name||U.type!==r.DefinitionEntity)throw new Error(`${P}The ${O($,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const Z=ui(U);if(!Z)throw new Error(`${P}The ${O($,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const j=n.find(ke=>{var lt;return((lt=ke.valueOwner.declaration)==null?void 0:lt.id)===G.operation[X.GoogleSheetsCreatePivotTable].inputs.spreadsheetId.id}),H=(u=j==null?void 0:j.value)==null?void 0:u.value,Y=ln(H,{errorPrefix:`${P}The ${O(j,"Spreadsheet ID","spreadsheetId")} input `}),ie=n.find(ke=>{var lt;return((lt=ke.valueOwner.declaration)==null?void 0:lt.id)===G.operation[X.GoogleSheetsCreatePivotTable].inputs.destination.id}),W=(e=ie==null?void 0:ie.value)==null?void 0:e.value;if(W==null)throw new Error(`${P}The ${O(ie,"Destination","destination")} input is missing.`);const z=n.find(ke=>{var lt;return((lt=ke.valueOwner.declaration)==null?void 0:lt.id)===G.operation[X.GoogleSheetsCreatePivotTable].inputs.source.id}),J=(f=z==null?void 0:z.value)==null?void 0:f.value;if(J==null)throw new Error(`${P}The ${O(z,"Data range","source")} input is missing.`);const ee=n.find(ke=>{var lt;return((lt=ke.valueOwner.declaration)==null?void 0:lt.id)===G.operation[X.GoogleSheetsCreatePivotTable].inputs.rows.id}),Q=((y=ee==null?void 0:ee.value)==null?void 0:y.value)||[],re=n.find(ke=>{var lt;return((lt=ke.valueOwner.declaration)==null?void 0:lt.id)===G.operation[X.GoogleSheetsCreatePivotTable].inputs.columns.id}),ae=((m=re==null?void 0:re.value)==null?void 0:m.value)||[],le=n.find(ke=>{var lt;return((lt=ke.valueOwner.declaration)==null?void 0:lt.id)===G.operation[X.GoogleSheetsCreatePivotTable].inputs.values.id}),oe=((T=le==null?void 0:le.value)==null?void 0:T.value)||[],ce=n.find(ke=>{var lt;return((lt=ke.valueOwner.declaration)==null?void 0:lt.id)===G.operation[X.GoogleSheetsCreatePivotTable].inputs.valueLayout.id}),be=((g=ce==null?void 0:ce.value)==null?void 0:g.value)||"HORIZONTAL",Ee={Authorization:`Bearer ${await I.getAccessToken()}`},xe=`${(b=I.env)==null?void 0:b.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${I.projectId}/${Zt["google-sheet"]}/${Z}`,Le=async ke=>Ht.post(xe,ke,{headers:Ee});let Fe=[];try{Fe=(await Le({method:"GET",endpoint:`/v4/spreadsheets/${Y}?fields=sheets(properties(sheetId,title))`})).data.sheets||[]}catch{}const tt=await Ha(W,"Id",async()=>Fe.map(ke=>({id:ke.properties.sheetId,name:ke.properties.title}))),We=ps(tt,{errorPrefix:`${P}The ${O(ie,"Destination","destination")} input `}),et={sheetId:We.sheetId??0,rowIndex:We.startRowIndex??0,columnIndex:We.startColumnIndex??0},qe=await Ha(J,"Id",async()=>Fe.map(ke=>({id:ke.properties.sheetId,name:ke.properties.title}))),ot=ps(qe,{errorPrefix:`${P}The ${O(z,"Data range","source")} input `});(ot.sheetId===void 0||ot.sheetId===null)&&(ot.sheetId=0);const st=ke=>{if(Array.isArray(ke))return ke;if(typeof ke=="string"){const lt=ke.trim();if(lt.startsWith("["))try{return JSON.parse(lt)}catch{}}return[]},ft=st(Q),Et=st(ae),pt=st(oe),Me={source:ot,rows:ft.map(ke=>({sourceColumnOffset:Number((ke==null?void 0:ke.sourceColumnOffset)??0),sortOrder:(ke==null?void 0:ke.sortOrder)||"ASCENDING",showTotals:(ke==null?void 0:ke.showTotals)!==!1})),columns:Et.map(ke=>({sourceColumnOffset:Number((ke==null?void 0:ke.sourceColumnOffset)??0),sortOrder:(ke==null?void 0:ke.sortOrder)||"ASCENDING",showTotals:(ke==null?void 0:ke.showTotals)!==!1})),values:pt.map(ke=>{const lt={sourceColumnOffset:Number((ke==null?void 0:ke.sourceColumnOffset)??0),summarizeFunction:(ke==null?void 0:ke.summarizeFunction)||"SUM"};return ke!=null&&ke.name&&(lt.name=ke.name),ke!=null&&ke.calculatedDisplayType&&(lt.calculatedDisplayType=ke.calculatedDisplayType),lt}),valueLayout:be||"HORIZONTAL"};let Je={updateCells:{start:et,rows:[{values:[{pivotTable:Me}]}],fields:"pivotTable"}};return await Le({method:"POST",endpoint:`/v4/spreadsheets/${Y}:batchUpdate`,data:{requests:[Je]}}),{value:K.Success,result:null,error:null}}catch(I){const A=((R=I.response)==null?void 0:R.data)||I.message||I;return pe.Logger.log("[Google Sheets] error:",A),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:A,result:null}}}})}}class V1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsInsertDimension,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsInsertDimension);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R;try{const I=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!I||!I.env)throw new Error("Editor context or environment missing");const A=Be(t,t.project,"insertDimension"),P="["+Ve(t,t.project,"Insert Dimension")+": `"+A+"`] ",O=(qe,ot,st)=>{const ft=Ve(qe==null?void 0:qe.valueOwner,I==null?void 0:I.logic,ot),Et=Be(qe==null?void 0:qe.valueOwner,I==null?void 0:I.logic,st);return`"${ft}" (\`${Et}\`)`},$=n.find(qe=>{var ot;return((ot=qe.valueOwner.declaration)==null?void 0:ot.id)===G.operation[X.GoogleSheetsInsertDimension].inputs.connection.id}),U=(s=$==null?void 0:$.value)==null?void 0:s.valueAsType;if(!U||!U.id||!U.name||U.type!==r.DefinitionEntity)throw new Error(`${P}The ${O($,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const Z=ui(U);if(!Z)throw new Error(`${P}The ${O($,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const j=n.find(qe=>{var ot;return((ot=qe.valueOwner.declaration)==null?void 0:ot.id)===G.operation[X.GoogleSheetsInsertDimension].inputs.spreadsheetId.id}),H=(u=j==null?void 0:j.value)==null?void 0:u.value,Y=ln(H,{errorPrefix:`${P}The ${O(j,"Spreadsheet ID","spreadsheetId")} input `}),ie=n.find(qe=>{var ot,st;return((ot=qe.valueOwner.declaration)==null?void 0:ot.id)===((st=G.operation[X.GoogleSheetsInsertDimension].inputs.sheet)==null?void 0:st.id)}),W=(e=ie==null?void 0:ie.value)==null?void 0:e.value,z=n.find(qe=>{var ot,st;return((ot=qe.valueOwner.declaration)==null?void 0:ot.id)===((st=G.operation[X.GoogleSheetsInsertDimension].inputs.dimension)==null?void 0:st.id)}),J=(f=z==null?void 0:z.value)==null?void 0:f.value,ee=n.find(qe=>{var ot,st;return((ot=qe.valueOwner.declaration)==null?void 0:ot.id)===((st=G.operation[X.GoogleSheetsInsertDimension].inputs.startIndex)==null?void 0:st.id)}),Q=(y=ee==null?void 0:ee.value)==null?void 0:y.value,re=n.find(qe=>{var ot,st;return((ot=qe.valueOwner.declaration)==null?void 0:ot.id)===((st=G.operation[X.GoogleSheetsInsertDimension].inputs.endIndex)==null?void 0:st.id)}),ae=(m=re==null?void 0:re.value)==null?void 0:m.value,le=n.find(qe=>{var ot,st;return((ot=qe.valueOwner.declaration)==null?void 0:ot.id)===((st=G.operation[X.GoogleSheetsInsertDimension].inputs.inheritFormatting)==null?void 0:st.id)}),oe=(T=le==null?void 0:le.value)==null?void 0:T.value;let ce;if(typeof oe=="string"){const qe=oe.trim().toLowerCase();qe==="before"?ce=!0:qe==="after"&&(ce=!1)}const Ce={Authorization:`Bearer ${await I.getAccessToken()}`},Ee=`${(g=I.env)==null?void 0:g.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${I.projectId}/${Zt["google-sheet"]}/${Z}`,xe=async qe=>Ht.post(Ee,qe,{headers:Ce});if(W==null||W==="")throw new Error(`${P}The ${O(ie,"Sheet","sheet")} input is missing.`);if(J==null||J==="")throw new Error(`${P}The ${O(z,"Dimension","dimension")} input is missing.`);const Le=String(J).trim().toUpperCase();if(Le!=="ROWS"&&Le!=="COLUMNS")throw new Error(`${P}The ${O(z,"Dimension","dimension")} input is invalid. Expected "Rows" or "Columns".`);const Fe=typeof Q=="number"?Q:parseInt(String(Q),10);if(isNaN(Fe)||Fe<1)throw new Error(`${P}The ${O(ee,"Start index","startIndex")} input is missing or invalid. Expected a positive integer starting at 1.`);let tt=Fe;if(ae!=null&&ae!==""&&(tt=typeof ae=="number"?ae:parseInt(String(ae),10),isNaN(tt)||tt<Fe))throw new Error(`${P}The ${O(re,"End index","endIndex")} input is invalid. Expected an integer greater than or equal to Start index.`);let We;if(typeof W=="number"||/^\d+$/.test(String(W).trim()))We=Number(W);else{const st=(((b=(await xe({method:"GET",endpoint:`/v4/spreadsheets/${Y}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:b.sheets)||[]).find(ft=>{var Et;return String((Et=ft.properties)==null?void 0:Et.title).trim().toLowerCase()===String(W).trim().toLowerCase()});if(!st)throw new Error(`${P}The ${O(ie,"Sheet","sheet")} input "${W}" was not found in spreadsheet.`);We=st.properties.sheetId}const et={range:{sheetId:We,dimension:Le,startIndex:Fe-1,endIndex:tt}};return typeof ce=="boolean"&&(et.inheritFromBefore=ce),await xe({method:"POST",endpoint:`/v4/spreadsheets/${Y}:batchUpdate`,data:{requests:[{insertDimension:et}]}}),{value:K.Success,result:null,error:null}}catch(I){const A=((R=I.response)==null?void 0:R.data)||I.message||I;return pe.Logger.log("[Google Sheets] error:",A),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:A,result:null}}}})}}class N1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsMoveDimension,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsMoveDimension);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R;try{const I=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!I||!I.env)throw new Error("Editor context or environment missing");const A=Be(t,t.project,"moveDimension"),P="["+Ve(t,t.project,"Move Dimension")+": `"+A+"`] ",O=(et,qe,ot)=>{const st=Ve(et==null?void 0:et.valueOwner,I==null?void 0:I.logic,qe),ft=Be(et==null?void 0:et.valueOwner,I==null?void 0:I.logic,ot);return`"${st}" (\`${ft}\`)`},$=n.find(et=>{var qe;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===G.operation[X.GoogleSheetsMoveDimension].inputs.connection.id}),U=(s=$==null?void 0:$.value)==null?void 0:s.valueAsType;if(!U||!U.id||!U.name||U.type!==r.DefinitionEntity)throw new Error(`${P}The ${O($,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const Z=ui(U);if(!Z)throw new Error(`${P}The ${O($,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const j=n.find(et=>{var qe;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===G.operation[X.GoogleSheetsMoveDimension].inputs.spreadsheetId.id}),H=(u=j==null?void 0:j.value)==null?void 0:u.value,Y=ln(H,{errorPrefix:`${P}The ${O(j,"Spreadsheet ID","spreadsheetId")} input `}),ie=n.find(et=>{var qe,ot;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===((ot=G.operation[X.GoogleSheetsMoveDimension].inputs.sheet)==null?void 0:ot.id)}),W=(e=ie==null?void 0:ie.value)==null?void 0:e.value,z=n.find(et=>{var qe,ot;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===((ot=G.operation[X.GoogleSheetsMoveDimension].inputs.dimension)==null?void 0:ot.id)}),J=(f=z==null?void 0:z.value)==null?void 0:f.value,ee=n.find(et=>{var qe,ot;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===((ot=G.operation[X.GoogleSheetsMoveDimension].inputs.startIndex)==null?void 0:ot.id)}),Q=(y=ee==null?void 0:ee.value)==null?void 0:y.value,re=n.find(et=>{var qe,ot;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===((ot=G.operation[X.GoogleSheetsMoveDimension].inputs.endIndex)==null?void 0:ot.id)}),ae=(m=re==null?void 0:re.value)==null?void 0:m.value,le=n.find(et=>{var qe,ot;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===((ot=G.operation[X.GoogleSheetsMoveDimension].inputs.destinationIndex)==null?void 0:ot.id)}),oe=(T=le==null?void 0:le.value)==null?void 0:T.value,be={Authorization:`Bearer ${await I.getAccessToken()}`},Ce=`${(g=I.env)==null?void 0:g.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${I.projectId}/${Zt["google-sheet"]}/${Z}`,Ee=async et=>Ht.post(Ce,et,{headers:be});if(W==null||W==="")throw new Error(`${P}The ${O(ie,"Sheet","sheet")} input is missing.`);if(J==null||J==="")throw new Error(`${P}The ${O(z,"Dimension","dimension")} input is missing.`);const xe=String(J).trim().toUpperCase();if(xe!=="ROWS"&&xe!=="COLUMNS")throw new Error(`${P}The ${O(z,"Dimension","dimension")} input is invalid. Expected "Rows" or "Columns".`);const Le=typeof Q=="number"?Q:parseInt(String(Q),10);if(isNaN(Le)||Le<1)throw new Error(`${P}The ${O(ee,"Start index","startIndex")} input is missing or invalid. Expected a positive integer starting at 1.`);let Fe=Le;if(ae!=null&&ae!==""&&(Fe=typeof ae=="number"?ae:parseInt(String(ae),10),isNaN(Fe)||Fe<Le))throw new Error(`${P}The ${O(re,"End index","endIndex")} input is invalid. Expected an integer greater than or equal to Start index.`);const tt=typeof oe=="number"?oe:parseInt(String(oe),10);if(isNaN(tt)||tt<1)throw new Error(`${P}The ${O(le,"Destination index","destinationIndex")} input is missing or invalid. Expected a positive integer starting at 1.`);let We;if(typeof W=="number"||/^\d+$/.test(String(W).trim()))We=Number(W);else{const ot=(((b=(await Ee({method:"GET",endpoint:`/v4/spreadsheets/${Y}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:b.sheets)||[]).find(st=>{var ft;return String((ft=st.properties)==null?void 0:ft.title).trim().toLowerCase()===String(W).trim().toLowerCase()});if(!ot)throw new Error(`${P}The ${O(ie,"Sheet","sheet")} input "${W}" was not found in spreadsheet.`);We=ot.properties.sheetId}return await Ee({method:"POST",endpoint:`/v4/spreadsheets/${Y}:batchUpdate`,data:{requests:[{moveDimension:{source:{sheetId:We,dimension:xe,startIndex:Le-1,endIndex:Fe},destinationIndex:tt-1}}]}}),{value:K.Success,result:null,error:null}}catch(I){const A=((R=I.response)==null?void 0:R.data)||I.message||I;return pe.Logger.log("[Google Sheets] error:",A),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:A,result:null}}}})}}function MRn(a){return{"Number greater than":"NUMBER_GREATER","Number greater than or equal":"NUMBER_GREATER_THAN_EQ","Number less than":"NUMBER_LESS","Number less than or equal":"NUMBER_LESS_THAN_EQ","Number equal to":"NUMBER_EQ","Number not equal to":"NUMBER_NOT_EQ","Number between":"NUMBER_BETWEEN","Number not between":"NUMBER_NOT_BETWEEN","Text contains":"TEXT_CONTAINS","Text does not contain":"TEXT_NOT_CONTAINS","Text starts with":"TEXT_STARTS_WITH","Text ends with":"TEXT_ENDS_WITH","Text equals":"TEXT_EQ","Date is":"DATE_EQ","Date is before":"DATE_BEFORE","Date is after":"DATE_AFTER","Date is on or before":"DATE_ON_OR_BEFORE","Date is on or after":"DATE_ON_OR_AFTER","Cell is empty":"BLANK","Cell is not empty":"NOT_BLANK","Custom formula":"CUSTOM_FORMULA"}[a]||a}class _1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsUpdateConditionalFormatRule,version:"1.0.0",description:"Update Conditional Format Rule Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsUpdateConditionalFormatRule);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A,x,P;try{const O=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!O||!O.env)throw new Error("Editor context or environment missing");const $=Be(t,t.project,"updateConditionalFormatRule"),Z="["+Ve(t,t.project,"Update Conditional Format Rule")+": `"+$+"`] ",j=(hi,$t,Nt)=>{const ci=Ve(hi==null?void 0:hi.valueOwner,O==null?void 0:O.logic,$t),oi=Be(hi==null?void 0:hi.valueOwner,O==null?void 0:O.logic,Nt);return`"${ci}" (\`${oi}\`)`},H=G.operation[X.GoogleSheetsUpdateConditionalFormatRule].inputs,Y=hi=>{var Nt;const $t=n.find(ci=>{var oi;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===hi});return(Nt=$t==null?void 0:$t.value)==null?void 0:Nt.value},ie=n.find(hi=>{var $t;return(($t=hi.valueOwner.declaration)==null?void 0:$t.id)===H.connection.id}),W=(s=ie==null?void 0:ie.value)==null?void 0:s.valueAsType;if(!W||!W.id||!W.name||W.type!==r.DefinitionEntity)throw new Error(`${Z}The ${j(ie,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const z=ui(W);if(!z)throw new Error(`${Z}The ${j(ie,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const J=n.find(hi=>{var $t;return(($t=hi.valueOwner.declaration)==null?void 0:$t.id)===H.spreadsheetId.id}),ee=(u=J==null?void 0:J.value)==null?void 0:u.value,Q=ln(ee,{errorPrefix:`${Z}The ${j(J,"Spreadsheet ID","spreadsheetId")} input `}),re=n.find(hi=>{var $t;return(($t=hi.valueOwner.declaration)==null?void 0:$t.id)===H.sheet.id}),ae=(e=re==null?void 0:re.value)==null?void 0:e.value;if(ae==null||ae==="")throw new Error(`${Z}The ${j(re,"Sheet","sheet")} input is missing.`);const le=n.find(hi=>{var $t;return(($t=hi.valueOwner.declaration)==null?void 0:$t.id)===H.index.id}),oe=(f=le==null?void 0:le.value)==null?void 0:f.value;if(oe==null||oe==="")throw new Error(`${Z}The ${j(le,"Index","index")} input is missing.`);const ce=typeof oe=="number"?oe:parseInt(String(oe),10);if(isNaN(ce)||ce<1)throw new Error(`${Z}The ${j(le,"Index","index")} input must be a 1-based positive integer.`);const Ce={Authorization:`Bearer ${await O.getAccessToken()}`},Ee=`${(y=O.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${O.projectId}/${Zt["google-sheet"]}/${z}`,xe=async hi=>Ht.post(Ee,hi,{headers:Ce});let Le;if(typeof ae=="number"||/^\d+$/.test(String(ae).trim()))Le=Number(ae);else{const Nt=(((m=(await xe({method:"GET",endpoint:`/v4/spreadsheets/${Q}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:m.sheets)||[]).find(ci=>{var oi;return String((oi=ci.properties)==null?void 0:oi.title).trim().toLowerCase()===String(ae).trim().toLowerCase()});if(!Nt)throw new Error(`${Z}The ${j(re,"Sheet","sheet")} input "${ae}" was not found in spreadsheet.`);Le=Nt.properties.sheetId}const Fe=Y(H.newIndex.id),tt=Y(H.range.id),We=Y(H.conditionType.id),et=Y(H.conditionValues.id),qe=Y(H.backgroundColor.id),ot=Y(H.textColor.id),st=Y(H.bold.id),ft=Y(H.italic.id),Et=Y(H.strikethrough.id),pt=Y(H.underline.id),Me=Y(H.fontSize.id),Je=Y(H.fontFamily.id),ke=Y(H.horizontalAlignment.id),lt=Y(H.verticalAlignment.id),Pt=Y(H.wrapStrategy.id);let Gt=null;try{const Nt=(((T=(await xe({method:"GET",endpoint:`/v4/spreadsheets/${Q}?fields=sheets(properties(sheetId),conditionalFormats)`})).data)==null?void 0:T.sheets)||[]).find(ci=>{var oi;return Number((oi=ci.properties)==null?void 0:oi.sheetId)===Number(Le)});if(Nt&&Array.isArray(Nt.conditionalFormats)){const ci=ce-1;ci>=0&&ci<Nt.conditionalFormats.length&&(Gt=Nt.conditionalFormats[ci])}}catch{}let si=null;tt&&(si=ps(tt,{errorPrefix:`${Z}The Range input `}),si.sheetId===void 0&&(si.sheetId=Le));const pi=si?[si]:Gt&&Gt.ranges||[{sheetId:Le}];let kt=null;if(We!=null&&String(We).trim()!==""){const hi=MRn(String(We));let $t=[];Array.isArray(et)?$t=et.map(Nt=>({userEnteredValue:String(Nt)})):et!=null&&et!==""?$t=[{userEnteredValue:String(et)}]:((b=(g=Gt==null?void 0:Gt.booleanRule)==null?void 0:g.condition)==null?void 0:b.type)===hi&&Array.isArray((I=(R=Gt==null?void 0:Gt.booleanRule)==null?void 0:R.condition)==null?void 0:I.values)&&($t=Gt.booleanRule.condition.values),kt={type:hi,...$t.length?{values:$t}:{}}}else if((A=Gt==null?void 0:Gt.booleanRule)!=null&&A.condition)kt=JSON.parse(JSON.stringify(Gt.booleanRule.condition));else{const hi="BLANK";let $t=[];Array.isArray(et)?$t=et.map(Nt=>({userEnteredValue:String(Nt)})):et!=null&&et!==""&&($t=[{userEnteredValue:String(et)}]),kt={type:hi,...$t.length?{values:$t}:{}}}const Ct=(x=Gt==null?void 0:Gt.booleanRule)!=null&&x.format?JSON.parse(JSON.stringify(Gt.booleanRule.format)):{},Oi=fo(qe);Oi&&(Ct.backgroundColor=Oi);const wn=fo(ot);if(wn&&(Ct.textFormat=Ct.textFormat||{},Ct.textFormat.foregroundColor=wn),st===!0||st==="true"?(Ct.textFormat=Ct.textFormat||{},Ct.textFormat.bold=!0):(st===!1||st==="false")&&Ct.textFormat&&(Ct.textFormat.bold=!1),ft===!0||ft==="true"?(Ct.textFormat=Ct.textFormat||{},Ct.textFormat.italic=!0):(ft===!1||ft==="false")&&Ct.textFormat&&(Ct.textFormat.italic=!1),Et===!0||Et==="true"?(Ct.textFormat=Ct.textFormat||{},Ct.textFormat.strikethrough=!0):(Et===!1||Et==="false")&&Ct.textFormat&&(Ct.textFormat.strikethrough=!1),pt===!0||pt==="true"?(Ct.textFormat=Ct.textFormat||{},Ct.textFormat.underline=!0):(pt===!1||pt==="false")&&Ct.textFormat&&(Ct.textFormat.underline=!1),Me!=null&&Me!==""){const hi=typeof Me=="number"?Me:parseInt(String(Me),10);isNaN(hi)||(Ct.textFormat=Ct.textFormat||{},Ct.textFormat.fontSize=hi)}if(typeof Je=="string"&&Je.trim()!==""&&(Ct.textFormat=Ct.textFormat||{},Ct.textFormat.fontFamily=Je.trim()),typeof ke=="string"&&ke!==""){const hi={Left:"LEFT",Center:"CENTER",Right:"RIGHT",Justify:"JUSTIFY"};Ct.horizontalAlignment=hi[ke]||ke.toUpperCase()}if(typeof lt=="string"&<!==""){const hi={Top:"TOP",Middle:"MIDDLE",Bottom:"BOTTOM"};Ct.verticalAlignment=hi[lt]||lt.toUpperCase()}if(typeof Pt=="string"&&Pt!==""){const hi={Overflow:"OVERFLOW_CELL",Wrap:"WRAP",Clip:"CLIP"};Ct.wrapStrategy=hi[Pt]||Pt.toUpperCase()}const Yr={...Gt||{},ranges:pi,booleanRule:{...(Gt==null?void 0:Gt.booleanRule)||{},condition:kt,format:Ct}},Jr={sheetId:Le,index:ce-1,rule:Yr};if(Fe!=null&&Fe!==""){const hi=typeof Fe=="number"?Fe:parseInt(String(Fe),10);!isNaN(hi)&&hi>=1&&(Jr.newIndex=hi-1)}return await xe({method:"POST",endpoint:`/v4/spreadsheets/${Q}:batchUpdate`,data:{requests:[{updateConditionalFormatRule:Jr}]}}),{value:K.Success,result:null,error:null}}catch(O){const $=((P=O.response)==null?void 0:P.data)||O.message||O;return pe.Logger.log("[Google Sheets] error:",$),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:$,result:null}}}})}}class $1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsUpdateProtectedRange,version:"1.0.0",description:"Update Protected Range Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsUpdateProtectedRange);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A,x;try{const P=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!P||!P.env)throw new Error("Editor context or environment missing");const O=Be(t,t.project,"updateProtectedRange"),U="["+Ve(t,t.project,"Update Protected Range")+": `"+O+"`] ",Z=(Me,Je,ke)=>{const lt=Ve(Me==null?void 0:Me.valueOwner,P==null?void 0:P.logic,Je),Pt=Be(Me==null?void 0:Me.valueOwner,P==null?void 0:P.logic,ke);return`"${lt}" (\`${Pt}\`)`},j=n.find(Me=>{var Je;return((Je=Me.valueOwner.declaration)==null?void 0:Je.id)===G.operation[X.GoogleSheetsUpdateProtectedRange].inputs.connection.id}),H=(s=j==null?void 0:j.value)==null?void 0:s.valueAsType;if(!H||!H.id||!H.name||H.type!==r.DefinitionEntity)throw new Error(`${U}The ${Z(j,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const Y=ui(H);if(!Y)throw new Error(`${U}The ${Z(j,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const ie=n.find(Me=>{var Je;return((Je=Me.valueOwner.declaration)==null?void 0:Je.id)===G.operation[X.GoogleSheetsUpdateProtectedRange].inputs.spreadsheetId.id}),W=(u=ie==null?void 0:ie.value)==null?void 0:u.value,z=ln(W,{errorPrefix:`${U}The ${Z(ie,"Spreadsheet ID","spreadsheetId")} input `}),J=n.find(Me=>{var Je;return((Je=Me.valueOwner.declaration)==null?void 0:Je.id)===G.operation[X.GoogleSheetsUpdateProtectedRange].inputs.protectedRangeId.id}),ee=(e=J==null?void 0:J.value)==null?void 0:e.value;if(ee==null)throw new Error(`${U}The ${Z(J,"Protected Range ID","protectedRangeId")} input is missing.`);const Q=n.find(Me=>{var Je;return((Je=Me.valueOwner.declaration)==null?void 0:Je.id)===G.operation[X.GoogleSheetsUpdateProtectedRange].inputs.range.id}),re=(f=Q==null?void 0:Q.value)==null?void 0:f.value,ae=n.find(Me=>{var Je;return((Je=Me.valueOwner.declaration)==null?void 0:Je.id)===G.operation[X.GoogleSheetsUpdateProtectedRange].inputs.description.id}),le=(y=ae==null?void 0:ae.value)==null?void 0:y.value,oe=n.find(Me=>{var Je;return((Je=Me.valueOwner.declaration)==null?void 0:Je.id)===G.operation[X.GoogleSheetsUpdateProtectedRange].inputs.warningOnly.id}),ce=(m=oe==null?void 0:oe.value)==null?void 0:m.value,be=n.find(Me=>{var Je;return((Je=Me.valueOwner.declaration)==null?void 0:Je.id)===G.operation[X.GoogleSheetsUpdateProtectedRange].inputs.editors.id}),Ce=(T=be==null?void 0:be.value)==null?void 0:T.value,Ee=n.find(Me=>{var Je;return((Je=Me.valueOwner.declaration)==null?void 0:Je.id)===G.operation[X.GoogleSheetsUpdateProtectedRange].inputs.domainUsersCanEdit.id}),xe=(g=Ee==null?void 0:Ee.value)==null?void 0:g.value,Fe={Authorization:`Bearer ${await P.getAccessToken()}`},tt=`${(b=P.env)==null?void 0:b.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${P.projectId}/${Zt["google-sheet"]}/${Y}`,We=async Me=>Ht.post(tt,Me,{headers:Fe}),et={protectedRangeId:typeof ee=="number"?ee:Number(ee)},qe=[];if(re!=null){let Me=[];try{Me=((R=(await We({method:"GET",endpoint:`/v4/spreadsheets/${z}?fields=sheets(properties(sheetId,title))`})).data)==null?void 0:R.sheets)||[]}catch{}const Je=await Ha(re,"Id",async()=>Me.map(ke=>{var lt,Pt;return{id:(lt=ke.properties)==null?void 0:lt.sheetId,name:(Pt=ke.properties)==null?void 0:Pt.title}}));et.range=ps(Je,{errorPrefix:`${U}The ${Z(Q,"Protected Range","range")} input `}),qe.push("range")}le!=null&&(et.description=le,qe.push("description"));const ot=Array.isArray(Ce)&&Ce.length>0,st=typeof xe=="boolean";if(ce===!0&&ot)throw new Error(`${U}When ${Z(oe,"Warning Only","warningOnly")} is enabled (true), ${Z(be,"Editors","editors")} cannot be specified.`);if(ce===!0&&st)throw new Error(`${U}When ${Z(oe,"Warning Only","warningOnly")} is enabled (true), ${Z(Ee,"Domain Users Can Edit","domainUsersCanEdit")} cannot be specified.`);if(typeof ce=="boolean"&&(et.warningOnly=ce,qe.push("warningOnly")),!et.warningOnly&&(ot||st)){const Me={};ot&&(Me.users=Ce),st&&(Me.domainUsersCanEdit=xe),et.editors=Me,qe.push("editors")}const ft=n.find(Me=>{var Je;return((Je=Me.valueOwner.declaration)==null?void 0:Je.id)===G.operation[X.GoogleSheetsUpdateProtectedRange].inputs.unprotectedRanges.id}),Et=(I=ft==null?void 0:ft.value)==null?void 0:I.value;if(Array.isArray(Et)&&Et.length>0){let Me=[];try{Me=((A=(await We({method:"GET",endpoint:`/v4/spreadsheets/${z}?fields=sheets(properties(sheetId,title))`})).data)==null?void 0:A.sheets)||[]}catch{}const Je=await Promise.all(Et.map(async ke=>{const lt=await Ha(ke,"Id",async()=>Me.map(Pt=>{var Gt,si;return{id:(Gt=Pt.properties)==null?void 0:Gt.sheetId,name:(si=Pt.properties)==null?void 0:si.title}}));return ps(lt,{errorPrefix:`${U}The ${Z(ft,"Exception ranges","unprotectedRanges")} input `})}));et.unprotectedRanges=Je,qe.push("unprotectedRanges")}const pt=qe.length>0?qe.join(","):"*";return await We({method:"POST",endpoint:`/v4/spreadsheets/${z}:batchUpdate`,data:{requests:[{updateProtectedRange:{protectedRange:et,fields:pt}}]}}),{value:K.Success,result:null,error:null}}catch(P){const O=((x=P.response)==null?void 0:x.data)||P.message||P;return pe.Logger.log("[Google Sheets] error:",O),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:O,result:null}}}})}}class G1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsAddNamedRange,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsAddNamedRange);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g;try{const b=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!b||!b.env)throw new Error("Editor context or environment missing");const R=Be(t,t.project,"addNamedRange"),A="["+Ve(t,t.project,"Add Named Range")+": `"+R+"`] ",x=(Ee,xe,Le)=>{const Fe=Ve(Ee==null?void 0:Ee.valueOwner,b==null?void 0:b.logic,xe),tt=Be(Ee==null?void 0:Ee.valueOwner,b==null?void 0:b.logic,Le);return`"${Fe}" (\`${tt}\`)`},P=n.find(Ee=>{var xe;return((xe=Ee.valueOwner.declaration)==null?void 0:xe.id)===G.operation[X.GoogleSheetsAddNamedRange].inputs.connection.id}),O=(s=P==null?void 0:P.value)==null?void 0:s.valueAsType;if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${A}The ${x(P,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const $=ui(O);if(!$)throw new Error(`${A}The ${x(P,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const U=n.find(Ee=>{var xe;return((xe=Ee.valueOwner.declaration)==null?void 0:xe.id)===G.operation[X.GoogleSheetsAddNamedRange].inputs.spreadsheetId.id}),Z=(u=U==null?void 0:U.value)==null?void 0:u.value,j=ln(Z,{errorPrefix:`${A}The ${x(U,"Spreadsheet ID","spreadsheetId")} input `}),H=n.find(Ee=>{var xe;return((xe=Ee.valueOwner.declaration)==null?void 0:xe.id)===G.operation[X.GoogleSheetsAddNamedRange].inputs.name.id}),Y=(e=H==null?void 0:H.value)==null?void 0:e.value;if(Y==null)throw new Error(`${A}The ${x(H,"name","name")} input is missing.`);const ie=n.find(Ee=>{var xe;return((xe=Ee.valueOwner.declaration)==null?void 0:xe.id)===G.operation[X.GoogleSheetsAddNamedRange].inputs.range.id}),W=(f=ie==null?void 0:ie.value)==null?void 0:f.value;if(W==null)throw new Error(`${A}The ${x(ie,"range","range")} input is missing.`);const J={Authorization:`Bearer ${await b.getAccessToken()}`},ee=`${(y=b.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${b.projectId}/${Zt["google-sheet"]}/${$}`,Q=async Ee=>Ht.post(ee,Ee,{headers:J}),re=await Ha(W,"Id",async()=>{var xe;return(((xe=(await Q({method:"GET",endpoint:`/v4/spreadsheets/${j}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:xe.sheets)||[]).map(Le=>{var Fe,tt;return{id:(Fe=Le.properties)==null?void 0:Fe.sheetId,name:(tt=Le.properties)==null?void 0:tt.title}})});let ae={};ae.addNamedRange={namedRange:{name:typeof Y=="string"&&Y.trim().startsWith("{")?JSON.parse(Y):Y,range:ps(re,{errorPrefix:`${A}The ${x(ie,"Range","range")} input `})}};const oe=(await Q({method:"POST",endpoint:`/v4/spreadsheets/${j}:batchUpdate`,data:{requests:[ae]}})).data,ce=(T=(m=oe==null?void 0:oe.replies)==null?void 0:m[0])==null?void 0:T.addNamedRange,be=(ce==null?void 0:ce.namedRange)??null,Ce=(be==null?void 0:be.namedRangeId)??null;return{value:K.Success,result:{namedRangeId:Ce},error:null}}catch(b){const R=((g=b.response)==null?void 0:g.data)||b.message||b;return pe.Logger.log("[Google Sheets] error:",R),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:R,result:null}}}})}}class L1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsSetCellNote,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsSetCellNote);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=Be(t,t.project,"setCellNote"),R="["+Ve(t,t.project,"Set Cell Note")+": `"+g+"`] ",I=(re,ae,le)=>{const oe=Ve(re==null?void 0:re.valueOwner,T==null?void 0:T.logic,ae),ce=Be(re==null?void 0:re.valueOwner,T==null?void 0:T.logic,le);return`"${oe}" (\`${ce}\`)`},A=n.find(re=>{var ae;return((ae=re.valueOwner.declaration)==null?void 0:ae.id)===G.operation[X.GoogleSheetsSetCellNote].inputs.connection.id}),x=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!x||!x.id||!x.name||x.type!==r.DefinitionEntity)throw new Error(`${R}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const P=ui(x);if(!P)throw new Error(`${R}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const O=n.find(re=>{var ae;return((ae=re.valueOwner.declaration)==null?void 0:ae.id)===G.operation[X.GoogleSheetsSetCellNote].inputs.spreadsheetId.id}),$=(u=O==null?void 0:O.value)==null?void 0:u.value,U=ln($,{errorPrefix:`${R}The ${I(O,"Spreadsheet ID","spreadsheetId")} input `}),Z=n.find(re=>{var ae;return((ae=re.valueOwner.declaration)==null?void 0:ae.id)===G.operation[X.GoogleSheetsSetCellNote].inputs.range.id}),j=(e=Z==null?void 0:Z.value)==null?void 0:e.value;if(j==null)throw new Error(`${R}The ${I(Z,"range","range")} input is missing.`);const H=n.find(re=>{var ae;return((ae=re.valueOwner.declaration)==null?void 0:ae.id)===G.operation[X.GoogleSheetsSetCellNote].inputs.note.id}),Y=(f=H==null?void 0:H.value)==null?void 0:f.value;if(Y==null)throw new Error(`${R}The ${I(H,"note","note")} input is missing.`);const W={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}/${Zt["google-sheet"]}/${P}`,J=async re=>Ht.post(z,re,{headers:W}),ee=await Ha(j,"Id",async()=>(await J({method:"GET",endpoint:`/v4/spreadsheets/${U}?fields=sheets.properties(sheetId,title)`})).data.sheets.map(ae=>({id:ae.properties.sheetId,name:ae.properties.title})));let Q={repeatCell:{range:ps(ee,{errorPrefix:`${R}The ${I(Z,"Range","range")} input `}),cell:{note:typeof Y=="string"&&Y.trim().startsWith("{")?JSON.parse(Y):Y},fields:"note"}};return await J({method:"POST",endpoint:`/v4/spreadsheets/${U}:batchUpdate`,data:{requests:[Q]}}),{value:K.Success,result:null,error:null}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return pe.Logger.log("[Google Sheets] error:",g),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:g,result:null}}}})}}class B1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsDeleteConditionalFormatRule,version:"1.0.0",description:"Delete Conditional Format Rule Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsDeleteConditionalFormatRule);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T;try{const g=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!g||!g.env)throw new Error("Editor context or environment missing");const b=Be(t,t.project,"deleteConditionalFormatRule"),I="["+Ve(t,t.project,"Delete Conditional Format Rule")+": `"+b+"`] ",A=(le,oe,ce)=>{const be=Ve(le==null?void 0:le.valueOwner,g==null?void 0:g.logic,oe),Ce=Be(le==null?void 0:le.valueOwner,g==null?void 0:g.logic,ce);return`"${be}" (\`${Ce}\`)`},x=G.operation[X.GoogleSheetsDeleteConditionalFormatRule].inputs,P=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===x.connection.id}),O=(s=P==null?void 0:P.value)==null?void 0:s.valueAsType;if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${I}The ${A(P,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const $=ui(O);if(!$)throw new Error(`${I}The ${A(P,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const U=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===x.spreadsheetId.id}),Z=(u=U==null?void 0:U.value)==null?void 0:u.value,j=ln(Z,{errorPrefix:`${I}The ${A(U,"Spreadsheet ID","spreadsheetId")} input `}),H=n.find(le=>{var oe,ce;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===((ce=x.sheet)==null?void 0:ce.id)}),Y=(e=H==null?void 0:H.value)==null?void 0:e.value;if(Y==null||Y==="")throw new Error(`${I}The ${A(H,"Sheet","sheet")} input is missing.`);const ie=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===x.index.id}),W=(f=ie==null?void 0:ie.value)==null?void 0:f.value;if(W==null||W==="")throw new Error(`${I}The ${A(ie,"Index","index")} input is missing.`);const z=typeof W=="number"?W:parseInt(String(W),10);if(isNaN(z)||z<1)throw new Error(`${I}The ${A(ie,"Index","index")} input must be a 1-based positive integer.`);const ee={Authorization:`Bearer ${await g.getAccessToken()}`},Q=`${(y=g.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${g.projectId}/${Zt["google-sheet"]}/${$}`,re=async le=>Ht.post(Q,le,{headers:ee});let ae;if(typeof Y=="number"||/^\d+$/.test(String(Y).trim()))ae=Number(Y);else{const ce=(((m=(await re({method:"GET",endpoint:`/v4/spreadsheets/${j}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:m.sheets)||[]).find(be=>{var Ce;return String((Ce=be.properties)==null?void 0:Ce.title).trim().toLowerCase()===String(Y).trim().toLowerCase()});if(!ce)throw new Error(`${I}The ${A(H,"Sheet","sheet")} input "${Y}" was not found in spreadsheet.`);ae=ce.properties.sheetId}return await re({method:"POST",endpoint:`/v4/spreadsheets/${j}:batchUpdate`,data:{requests:[{deleteConditionalFormatRule:{sheetId:ae,index:z-1}}]}}),{value:K.Success,result:null,error:null}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return pe.Logger.log("[Google Sheets] error:",b),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:b,result:null}}}})}}function FRn(a){return{NUMBER_GREATER:"Number greater than",NUMBER_GREATER_THAN_EQ:"Number greater than or equal",NUMBER_LESS:"Number less than",NUMBER_LESS_THAN_EQ:"Number less than or equal",NUMBER_EQ:"Number equal to",NUMBER_NOT_EQ:"Number not equal to",NUMBER_BETWEEN:"Number between",NUMBER_NOT_BETWEEN:"Number not between",TEXT_CONTAINS:"Text contains",TEXT_NOT_CONTAINS:"Text does not contain",TEXT_STARTS_WITH:"Text starts with",TEXT_ENDS_WITH:"Text ends with",TEXT_EQ:"Text equals",DATE_EQ:"Date is",DATE_BEFORE:"Date is before",DATE_AFTER:"Date is after",DATE_ON_OR_BEFORE:"Date is on or before",DATE_ON_OR_AFTER:"Date is on or after",BLANK:"Cell is empty",NOT_BLANK:"Cell is not empty",CUSTOM_FORMULA:"Custom formula"}[a]||a}function A5(a){let p,t="",n=a+1;for(;n>0;)p=(n-1)%26,t=String.fromCharCode(65+p)+t,n=(n-p-1)/26;return t}function kRn(a,p){if(!a)return"";let t=p?`'${p}'!`:"";const n=a.startColumnIndex!==void 0?A5(a.startColumnIndex):"",s=a.startRowIndex!==void 0?String(a.startRowIndex+1):"",u=a.endColumnIndex!==void 0?A5(a.endColumnIndex-1):"",e=a.endRowIndex!==void 0?String(a.endRowIndex):"";return n&&s&&u&&e?n===u&&s===e?`${t}${n}${s}`:`${t}${n}${s}:${u}${e}`:n&&u&&!s&&!e?`${t}${n}:${u}`:s&&e&&!n&&!u?`${t}${s}:${e}`:`${t}${n}${s}:${u}${e}`.replace(/:$/,"")}class S1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsGetConditionalFormatRules,version:"1.0.0",description:"Get Conditional Format Rules Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsGetConditionalFormatRules);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T;try{const g=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!g||!g.env)throw new Error("Editor context or environment missing");const b=Be(t,t.project,"getConditionalFormatRules"),I="["+Ve(t,t.project,"Get Conditional Format Rules")+": `"+b+"`] ",A=(le,oe,ce)=>{const be=Ve(le==null?void 0:le.valueOwner,g==null?void 0:g.logic,oe),Ce=Be(le==null?void 0:le.valueOwner,g==null?void 0:g.logic,ce);return`"${be}" (\`${Ce}\`)`},x=G.operation[X.GoogleSheetsGetConditionalFormatRules].inputs,P=le=>{var ce;const oe=n.find(be=>{var Ce;return((Ce=be.valueOwner.declaration)==null?void 0:Ce.id)===le});return(ce=oe==null?void 0:oe.value)==null?void 0:ce.value},O=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===x.connection.id}),$=(s=O==null?void 0:O.value)==null?void 0:s.valueAsType;if(!$||!$.id||!$.name||$.type!==r.DefinitionEntity)throw new Error(`${I}The ${A(O,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const U=ui($);if(!U)throw new Error(`${I}The ${A(O,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const Z=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===x.spreadsheetId.id}),j=(u=Z==null?void 0:Z.value)==null?void 0:u.value,H=ln(j,{errorPrefix:`${I}The ${A(Z,"Spreadsheet ID","spreadsheetId")} input `}),Y=P(x.sheet.id),ie=typeof Y=="string"&&Y.trim()!==""?Y.trim():null,z={Authorization:`Bearer ${await g.getAccessToken()}`},J=`${(e=g.env)==null?void 0:e.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${g.projectId}/${Zt["google-sheet"]}/${U}`,re=((f=(await(async le=>Ht.post(J,le,{headers:z}))({method:"GET",endpoint:`/v4/spreadsheets/${H}?fields=sheets(properties(sheetId,title),conditionalFormats)`})).data)==null?void 0:f.sheets)||[],ae=[];for(const le of re){const oe=((y=le.properties)==null?void 0:y.title)||"",ce=(m=le.properties)==null?void 0:m.sheetId;if(ie&&oe.toLowerCase()!==ie.toLowerCase())continue;(le.conditionalFormats||[]).forEach((Ce,Ee)=>{const xe=Ee+1,Le=(Ce.ranges||[]).map(ot=>kRn(ot,oe)),Fe=Ce.booleanRule||{},tt=Fe.condition||{},We=FRn(tt.type||""),et=(tt.values||[]).map(ot=>ot.userEnteredValue||""),qe=Fe.format||{};ae.push({index:xe,sheet:oe,sheetId:ce,ranges:Le,conditionType:We,conditionValues:et,format:qe})})}return{value:K.Success,error:null,result:ae}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return pe.Logger.log("[Google Sheets] error:",b),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:b,result:null}}}})}}function D5(a){let p,t="",n=a+1;for(;n>0;)p=(n-1)%26,t=String.fromCharCode(65+p)+t,n=(n-p-1)/26;return t}function URn(a,p){if(!a)return"";let t=p?`'${p}'!`:"";const n=a.startColumnIndex!==void 0?D5(a.startColumnIndex):"",s=a.startRowIndex!==void 0?String(a.startRowIndex+1):"",u=a.endColumnIndex!==void 0?D5(a.endColumnIndex-1):"",e=a.endRowIndex!==void 0?String(a.endRowIndex):"";return n&&s&&u&&e?n===u&&s===e?`${t}${n}${s}`:`${t}${n}${s}:${u}${e}`:n&&u&&!s&&!e?`${t}${n}:${u}`:s&&e&&!n&&!u?`${t}${s}:${e}`:`${t}${n}${s}:${u}${e}`.replace(/:$/,"")}class M1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsGetProtectedRanges,version:"1.0.0",description:"Get Protected Ranges Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsGetProtectedRanges);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g;try{const b=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!b||!b.env)throw new Error("Editor context or environment missing");const R=Be(t,t.project,"getProtectedRanges"),A="["+Ve(t,t.project,"Get protected ranges")+": `"+R+"`] ",x=(ae,le,oe)=>{const ce=Ve(ae==null?void 0:ae.valueOwner,b==null?void 0:b.logic,le),be=Be(ae==null?void 0:ae.valueOwner,b==null?void 0:b.logic,oe);return`"${ce}" (\`${be}\`)`},P=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[X.GoogleSheetsGetProtectedRanges].inputs.connection.id}),O=(s=P==null?void 0:P.value)==null?void 0:s.valueAsType;if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${A}The ${x(P,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const $=ui(O);if(!$)throw new Error(`${A}The ${x(P,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const U=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[X.GoogleSheetsGetProtectedRanges].inputs.spreadsheetId.id}),Z=(u=U==null?void 0:U.value)==null?void 0:u.value,j=ln(Z,{errorPrefix:`${A}The ${x(U,"Spreadsheet ID","spreadsheetId")} input `}),H=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[X.GoogleSheetsGetProtectedRanges].inputs.sheet.id}),Y=(e=H==null?void 0:H.value)!=null&&e.value?String(H.value.value).trim():null,W={Authorization:`Bearer ${await b.getAccessToken()}`},z=`${(f=b.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${b.projectId}/${Zt["google-sheet"]}/${$}`,Q=((y=(await(async ae=>Ht.post(z,ae,{headers:W}))({method:"GET",endpoint:`/v4/spreadsheets/${j}`})).data)==null?void 0:y.sheets)||[],re=[];for(const ae of Q){const le=(m=ae.properties)==null?void 0:m.title,oe=(T=ae.properties)==null?void 0:T.sheetId;if(Y&&le!==Y)continue;const ce=ae.protectedRanges||[];for(const be of ce){const Ce=URn(be.range,le);re.push({protectedRangeId:be.protectedRangeId,sheet:le,sheetId:oe,range:Ce,description:be.description||"",warningOnly:be.warningOnly??!1,requestingUserCanEdit:be.requestingUserCanEdit??!0})}}return{value:K.Success,error:null,result:re}}catch(b){const R=((g=b.response)==null?void 0:g.data)||b.message||b;return pe.Logger.log("[Google Sheets] error:",R),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:R,result:null}}}})}}function bh(a){if(!a)return null;const p=Math.round((a.red||0)*255),t=Math.round((a.green||0)*255),n=Math.round((a.blue||0)*255),s=u=>u.toString(16).padStart(2,"0");return`#${s(p)}${s(t)}${s(n)}`}function C5(a){let p,t="",n=a+1;for(;n>0;)p=(n-1)%26,t=String.fromCharCode(65+p)+t,n=(n-p-1)/26;return t}function KRn(a,p){if(!a)return"";let t=p?`'${p}'!`:"";const n=a.startColumnIndex!==void 0?C5(a.startColumnIndex):"",s=a.startRowIndex!==void 0?String(a.startRowIndex+1):"",u=a.endColumnIndex!==void 0?C5(a.endColumnIndex-1):"",e=a.endRowIndex!==void 0?String(a.endRowIndex):"";return n&&s&&u&&e?n===u&&s===e?`${t}${n}${s}`:`${t}${n}${s}:${u}${e}`:n&&u&&!s&&!e?`${t}${n}:${u}`:s&&e&&!n&&!u?`${t}${s}:${e}`:`${t}${n}${s}:${u}${e}`.replace(/:$/,"")}class F1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsGetBandedRanges,version:"1.0.0",description:"Get Banded Ranges Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsGetBandedRanges);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A;try{const x=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!x||!x.env)throw new Error("Editor context or environment missing");const P=Be(t,t.project,"getBandedRanges"),$="["+Ve(t,t.project,"Get banded ranges")+": `"+P+"`] ",U=(be,Ce,Ee)=>{const xe=Ve(be==null?void 0:be.valueOwner,x==null?void 0:x.logic,Ce),Le=Be(be==null?void 0:be.valueOwner,x==null?void 0:x.logic,Ee);return`"${xe}" (\`${Le}\`)`},Z=n.find(be=>{var Ce;return((Ce=be.valueOwner.declaration)==null?void 0:Ce.id)===G.operation[X.GoogleSheetsGetBandedRanges].inputs.connection.id}),j=(s=Z==null?void 0:Z.value)==null?void 0:s.valueAsType;if(!j||!j.id||!j.name||j.type!==r.DefinitionEntity)throw new Error(`${$}The ${U(Z,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const H=ui(j);if(!H)throw new Error(`${$}The ${U(Z,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const Y=n.find(be=>{var Ce;return((Ce=be.valueOwner.declaration)==null?void 0:Ce.id)===G.operation[X.GoogleSheetsGetBandedRanges].inputs.spreadsheetId.id}),ie=(u=Y==null?void 0:Y.value)==null?void 0:u.value,W=ln(ie,{errorPrefix:`${$}The ${U(Y,"Spreadsheet ID","spreadsheetId")} input `}),z=n.find(be=>{var Ce;return((Ce=be.valueOwner.declaration)==null?void 0:Ce.id)===G.operation[X.GoogleSheetsGetBandedRanges].inputs.sheet.id}),J=(e=z==null?void 0:z.value)!=null&&e.value?String(z.value.value).trim():null,Q={Authorization:`Bearer ${await x.getAccessToken()}`},re=`${(f=x.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${x.projectId}/${Zt["google-sheet"]}/${H}`,oe=((y=(await(async be=>Ht.post(re,be,{headers:Q}))({method:"GET",endpoint:`/v4/spreadsheets/${W}`})).data)==null?void 0:y.sheets)||[],ce=[];for(const be of oe){const Ce=(m=be.properties)==null?void 0:m.title,Ee=(T=be.properties)==null?void 0:T.sheetId;if(J&&Ce!==J)continue;const xe=be.bandedRanges||[];for(const Le of xe){const Fe=KRn(Le.range,Ce),tt=Le.rowProperties||{};ce.push({bandedRangeId:Le.bandedRangeId,sheet:Ce,sheetId:Ee,range:Fe,headerRowColor:bh(tt.headerColor)||bh((g=tt.headerColorStyle)==null?void 0:g.rgbColor),firstRowColor:bh(tt.firstBandColor)||bh((b=tt.firstBandColorStyle)==null?void 0:b.rgbColor),secondRowColor:bh(tt.secondBandColor)||bh((R=tt.secondBandColorStyle)==null?void 0:R.rgbColor),footerRowColor:bh(tt.footerColor)||bh((I=tt.footerColorStyle)==null?void 0:I.rgbColor)})}}return{value:K.Success,error:null,result:ce}}catch(x){const P=((A=x.response)==null?void 0:A.data)||x.message||x;return pe.Logger.log("[Google Sheets] error:",P),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:P,result:null}}}})}}function w5(a){let p,t="",n=a+1;for(;n>0;)p=(n-1)%26,t=String.fromCharCode(65+p)+t,n=(n-p-1)/26;return t}function jRn(a,p){if(!a)return"";let t=p?`'${p}'!`:"";const n=a.startColumnIndex!==void 0?w5(a.startColumnIndex):"",s=a.startRowIndex!==void 0?String(a.startRowIndex+1):"",u=a.endColumnIndex!==void 0?w5(a.endColumnIndex-1):"",e=a.endRowIndex!==void 0?String(a.endRowIndex):"";return n&&s&&u&&e?n===u&&s===e?`${t}${n}${s}`:`${t}${n}${s}:${u}${e}`:n&&u&&!s&&!e?`${t}${n}:${u}`:s&&e&&!n&&!u?`${t}${s}:${e}`:`${t}${n}${s}:${u}${e}`.replace(/:$/,"")}class k1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsGetNamedRanges,version:"1.0.0",description:"Get Named Ranges Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsGetNamedRanges);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=Be(t,t.project,"getNamedRanges"),R="["+Ve(t,t.project,"Get named ranges")+": `"+g+"`] ",I=(ee,Q,re)=>{const ae=Ve(ee==null?void 0:ee.valueOwner,T==null?void 0:T.logic,Q),le=Be(ee==null?void 0:ee.valueOwner,T==null?void 0:T.logic,re);return`"${ae}" (\`${le}\`)`},A=n.find(ee=>{var Q;return((Q=ee.valueOwner.declaration)==null?void 0:Q.id)===G.operation[X.GoogleSheetsGetNamedRanges].inputs.connection.id}),x=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!x||!x.id||!x.name||x.type!==r.DefinitionEntity)throw new Error(`${R}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const P=ui(x);if(!P)throw new Error(`${R}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const O=n.find(ee=>{var Q;return((Q=ee.valueOwner.declaration)==null?void 0:Q.id)===G.operation[X.GoogleSheetsGetNamedRanges].inputs.spreadsheetId.id}),$=(u=O==null?void 0:O.value)==null?void 0:u.value,U=ln($,{errorPrefix:`${R}The ${I(O,"Spreadsheet ID","spreadsheetId")} input `}),j={Authorization:`Bearer ${await T.getAccessToken()}`},H=`${(e=T.env)==null?void 0:e.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${T.projectId}/${Zt["google-sheet"]}/${P}`,ie=await(async ee=>Ht.post(H,ee,{headers:j}))({method:"GET",endpoint:`/v4/spreadsheets/${U}`}),W={};(((f=ie.data)==null?void 0:f.sheets)||[]).forEach(ee=>{var Q;((Q=ee.properties)==null?void 0:Q.sheetId)!==void 0&&(W[ee.properties.sheetId]=ee.properties.title||"")});const J=(((y=ie.data)==null?void 0:y.namedRanges)||[]).map(ee=>{var ae;const Q=W[(ae=ee.range)==null?void 0:ae.sheetId]||"",re=jRn(ee.range,Q);return{namedRangeId:ee.namedRangeId,name:ee.name,sheet:Q,range:re}});return{value:K.Success,error:null,result:J}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return pe.Logger.log("[Google Sheets] error:",g),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:g,result:null}}}})}}class U1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsGetSheets,version:"1.0.0",description:"Get Sheets Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsGetSheets);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"getSheets"),b="["+Ve(t,t.project,"Get sheets")+": `"+T+"`] ",R=(z,J,ee)=>{const Q=Ve(z==null?void 0:z.valueOwner,m==null?void 0:m.logic,J),re=Be(z==null?void 0:z.valueOwner,m==null?void 0:m.logic,ee);return`"${Q}" (\`${re}\`)`},I=n.find(z=>{var J;return((J=z.valueOwner.declaration)==null?void 0:J.id)===G.operation[X.GoogleSheetsGetSheets].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=ui(A);if(!x)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(z=>{var J;return((J=z.valueOwner.declaration)==null?void 0:J.id)===G.operation[X.GoogleSheetsGetSheets].inputs.spreadsheetId.id}),O=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(O,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),Z={Authorization:`Bearer ${await m.getAccessToken()}`},j=`${(e=m.env)==null?void 0:e.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${x}`,W=(((f=(await(async z=>Ht.post(j,z,{headers:Z}))({method:"GET",endpoint:`/v4/spreadsheets/${$}`})).data)==null?void 0:f.sheets)||[]).map(z=>{var J,ee,Q,re,ae,le,oe,ce,be,Ce,Ee,xe,Le;return{sheetId:(J=z.properties)==null?void 0:J.sheetId,title:(ee=z.properties)==null?void 0:ee.title,index:(Q=z.properties)==null?void 0:Q.index,sheetType:(re=z.properties)==null?void 0:re.sheetType,rowCount:(le=(ae=z.properties)==null?void 0:ae.gridProperties)==null?void 0:le.rowCount,columnCount:(ce=(oe=z.properties)==null?void 0:oe.gridProperties)==null?void 0:ce.columnCount,frozenRowCount:(Ce=(be=z.properties)==null?void 0:be.gridProperties)==null?void 0:Ce.frozenRowCount,frozenColumnCount:(xe=(Ee=z.properties)==null?void 0:Ee.gridProperties)==null?void 0:xe.frozenColumnCount,hidden:((Le=z.properties)==null?void 0:Le.hidden)??!1}});return{value:K.Success,error:null,result:W}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class K1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsGetSheet,version:"1.0.0",description:"Get Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsGetSheet);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=Be(t,t.project,"getSheet"),R="["+Ve(t,t.project,"Get sheet")+": `"+g+"`] ",I=(le,oe,ce)=>{const be=Ve(le==null?void 0:le.valueOwner,T==null?void 0:T.logic,oe),Ce=Be(le==null?void 0:le.valueOwner,T==null?void 0:T.logic,ce);return`"${be}" (\`${Ce}\`)`},A=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[X.GoogleSheetsGetSheet].inputs.connection.id}),x=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!x||!x.id||!x.name||x.type!==r.DefinitionEntity)throw new Error(`${R}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const P=ui(x);if(!P)throw new Error(`${R}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const O=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[X.GoogleSheetsGetSheet].inputs.spreadsheetId.id}),$=(u=O==null?void 0:O.value)==null?void 0:u.value,U=ln($,{errorPrefix:`${R}The ${I(O,"Spreadsheet ID","spreadsheetId")} input `}),Z=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[X.GoogleSheetsGetSheet].inputs.sheet.id}),j=(e=Z==null?void 0:Z.value)==null?void 0:e.value;if(j==null||j==="")throw new Error(`${R}The ${I(Z,"Sheet","sheet")} input is missing.`);const Y={Authorization:`Bearer ${await T.getAccessToken()}`},ie=`${(f=T.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${T.projectId}/${Zt["google-sheet"]}/${P}`,J=((y=(await(async le=>Ht.post(ie,le,{headers:Y}))({method:"GET",endpoint:`/v4/spreadsheets/${U}`})).data)==null?void 0:y.sheets)||[];let ee=null;if(typeof j=="number")ee=J.find(le=>{var oe;return Number((oe=le.properties)==null?void 0:oe.sheetId)===j});else if(typeof j=="string"){const le=j.trim();ee=J.find(oe=>{var ce,be;return((ce=oe.properties)==null?void 0:ce.title)===le||String((be=oe.properties)==null?void 0:be.sheetId)===le})}if(!ee)throw new Error(`${R}Sheet "${j}" was not found in spreadsheet.`);const Q=ee.properties||{},re=Q.gridProperties||{},ae={sheetId:Q.sheetId,title:Q.title,index:Q.index,sheetType:Q.sheetType,rowCount:re.rowCount,columnCount:re.columnCount,frozenRowCount:re.frozenRowCount,frozenColumnCount:re.frozenColumnCount,hideGridlines:re.hideGridlines??!1,rowGroupControlAfter:re.rowGroupControlAfter??!1,columnGroupControlAfter:re.columnGroupControlAfter??!1,hidden:Q.hidden??!1,rightToLeft:Q.rightToLeft??!1,tabColor:Q.tabColor?{red:Q.tabColor.red??0,green:Q.tabColor.green??0,blue:Q.tabColor.blue??0,alpha:Q.tabColor.alpha??1}:null,basicFilter:ee.basicFilter?{range:ee.basicFilter.range}:null,protectedRanges:(ee.protectedRanges||[]).map(le=>({protectedRangeId:le.protectedRangeId,range:le.range,description:le.description??"",warningOnly:le.warningOnly??!1,requestingUserCanEdit:le.requestingUserCanEdit??!1,namedRangeId:le.namedRangeId??null})),bandedRanges:(ee.bandedRanges||[]).map(le=>({bandedRangeId:le.bandedRangeId,range:le.range})),charts:(ee.charts||[]).map(le=>{var oe,ce;return{chartId:le.chartId,title:((oe=le.spec)==null?void 0:oe.title)??"",chartType:((ce=le.spec)==null?void 0:ce.chartType)??""}}),conditionalFormatRules:(ee.conditionalFormats||[]).map((le,oe)=>{var ce;return{ruleIndex:oe,range:(ce=le.ranges)!=null&&ce[0]?`${le.ranges[0].startRowIndex}:${le.ranges[0].endRowIndex}`:""}}),mergedCells:(ee.merges||[]).map(le=>`${le.startRowIndex}:${le.endRowIndex}`)};return{value:K.Success,error:null,result:ae}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return pe.Logger.log("[Google Sheets] error:",g),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:g,result:null}}}})}}function x5(a){let p,t="",n=a+1;for(;n>0;)p=(n-1)%26,t=String.fromCharCode(65+p)+t,n=(n-p-1)/26;return t}function qRn(a,p){if(!a)return"";let t=p?`'${p}'!`:"";const n=a.startColumnIndex!==void 0?x5(a.startColumnIndex):"",s=a.startRowIndex!==void 0?String(a.startRowIndex+1):"",u=a.endColumnIndex!==void 0?x5(a.endColumnIndex-1):"",e=a.endRowIndex!==void 0?String(a.endRowIndex):"";return n&&s&&u&&e?n===u&&s===e?`${t}${n}${s}`:`${t}${n}${s}:${u}${e}`:n&&u&&!s&&!e?`${t}${n}:${u}`:s&&e&&!n&&!u?`${t}${s}:${e}`:`${t}${n}${s}:${u}${e}`.replace(/:$/,"")}class j1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsGetCharts,version:"1.0.0",description:"Get Charts Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsGetCharts);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I;try{const A=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!A||!A.env)throw new Error("Editor context or environment missing");const x=Be(t,t.project,"getCharts"),O="["+Ve(t,t.project,"Get charts")+": `"+x+"`] ",$=(ce,be,Ce)=>{const Ee=Ve(ce==null?void 0:ce.valueOwner,A==null?void 0:A.logic,be),xe=Be(ce==null?void 0:ce.valueOwner,A==null?void 0:A.logic,Ce);return`"${Ee}" (\`${xe}\`)`},U=n.find(ce=>{var be;return((be=ce.valueOwner.declaration)==null?void 0:be.id)===G.operation[X.GoogleSheetsGetCharts].inputs.connection.id}),Z=(s=U==null?void 0:U.value)==null?void 0:s.valueAsType;if(!Z||!Z.id||!Z.name||Z.type!==r.DefinitionEntity)throw new Error(`${O}The ${$(U,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const j=ui(Z);if(!j)throw new Error(`${O}The ${$(U,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const H=n.find(ce=>{var be;return((be=ce.valueOwner.declaration)==null?void 0:be.id)===G.operation[X.GoogleSheetsGetCharts].inputs.spreadsheetId.id}),Y=(u=H==null?void 0:H.value)==null?void 0:u.value,ie=ln(Y,{errorPrefix:`${O}The ${$(H,"Spreadsheet ID","spreadsheetId")} input `}),W=n.find(ce=>{var be;return((be=ce.valueOwner.declaration)==null?void 0:be.id)===G.operation[X.GoogleSheetsGetCharts].inputs.sheet.id}),z=(e=W==null?void 0:W.value)!=null&&e.value?String(W.value.value).trim():null,ee={Authorization:`Bearer ${await A.getAccessToken()}`},Q=`${(f=A.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${A.projectId}/${Zt["google-sheet"]}/${j}`,le=((y=(await(async ce=>Ht.post(Q,ce,{headers:ee}))({method:"GET",endpoint:`/v4/spreadsheets/${ie}`})).data)==null?void 0:y.sheets)||[],oe=[];for(const ce of le){const be=(m=ce.properties)==null?void 0:m.title,Ce=(T=ce.properties)==null?void 0:T.sheetId;if(z&&be!==z)continue;const Ee=ce.charts||[];for(const xe of Ee){const Le=xe.spec||{},Fe=Le.title||"",tt=((g=Le.basicChart)==null?void 0:g.chartType)||(Le.pieChart?"PIE":"UNKNOWN"),We=qRn((R=(b=xe.position)==null?void 0:b.overlayPosition)==null?void 0:R.anchorCell,be);oe.push({chartId:xe.chartId,sheet:be,sheetId:Ce,title:Fe,chartType:tt,positionRange:We})}}return{value:K.Success,error:null,result:oe}}catch(A){const x=((I=A.response)==null?void 0:I.data)||A.message||A;return pe.Logger.log("[Google Sheets] error:",x),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:x,result:null}}}})}}function O5(a){let p,t="",n=a+1;for(;n>0;)p=(n-1)%26,t=String.fromCharCode(65+p)+t,n=(n-p-1)/26;return t}function P5(a,p){if(!a)return"";let t=p?`'${p}'!`:"";const n=a.startColumnIndex!==void 0?O5(a.startColumnIndex):"",s=a.startRowIndex!==void 0?String(a.startRowIndex+1):"",u=a.endColumnIndex!==void 0?O5(a.endColumnIndex-1):"",e=a.endRowIndex!==void 0?String(a.endRowIndex):"";return n&&s&&u&&e?n===u&&s===e?`${t}${n}${s}`:`${t}${n}${s}:${u}${e}`:n&&u&&!s&&!e?`${t}${n}:${u}`:s&&e&&!n&&!u?`${t}${s}:${e}`:`${t}${n}${s}:${u}${e}`.replace(/:$/,"")}class q1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsGetFilter,version:"1.0.0",description:"Get Filter Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsGetFilter);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g;try{const b=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!b||!b.env)throw new Error("Editor context or environment missing");const R=Be(t,t.project,"getFilter"),A="["+Ve(t,t.project,"Get filter")+": `"+R+"`] ",x=(Ce,Ee,xe)=>{const Le=Ve(Ce==null?void 0:Ce.valueOwner,b==null?void 0:b.logic,Ee),Fe=Be(Ce==null?void 0:Ce.valueOwner,b==null?void 0:b.logic,xe);return`"${Le}" (\`${Fe}\`)`},P=n.find(Ce=>{var Ee;return((Ee=Ce.valueOwner.declaration)==null?void 0:Ee.id)===G.operation[X.GoogleSheetsGetFilter].inputs.connection.id}),O=(s=P==null?void 0:P.value)==null?void 0:s.valueAsType;if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${A}The ${x(P,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const $=ui(O);if(!$)throw new Error(`${A}The ${x(P,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const U=n.find(Ce=>{var Ee;return((Ee=Ce.valueOwner.declaration)==null?void 0:Ee.id)===G.operation[X.GoogleSheetsGetFilter].inputs.spreadsheetId.id}),Z=(u=U==null?void 0:U.value)==null?void 0:u.value,j=ln(Z,{errorPrefix:`${A}The ${x(U,"Spreadsheet ID","spreadsheetId")} input `}),H=n.find(Ce=>{var Ee;return((Ee=Ce.valueOwner.declaration)==null?void 0:Ee.id)===G.operation[X.GoogleSheetsGetFilter].inputs.sheet.id}),Y=(e=H==null?void 0:H.value)!=null&&e.value?String(H.value.value).trim():null,W={Authorization:`Bearer ${await b.getAccessToken()}`},z=`${(f=b.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${b.projectId}/${Zt["google-sheet"]}/${$}`,Q=((y=(await(async Ce=>Ht.post(z,Ce,{headers:W}))({method:"GET",endpoint:`/v4/spreadsheets/${j}`})).data)==null?void 0:y.sheets)||[];let re=Q[0];Y&&(re=Q.find(Ce=>{var Ee;return((Ee=Ce.properties)==null?void 0:Ee.title)===Y})||re);const ae=((m=re==null?void 0:re.properties)==null?void 0:m.title)||"",le=((T=re==null?void 0:re.properties)==null?void 0:T.sheetId)??0,oe=re==null?void 0:re.basicFilter,ce=oe?P5(oe.range,ae):null,be=((re==null?void 0:re.filterViews)||[]).map(Ce=>({filterViewId:Ce.filterViewId,title:Ce.title,range:P5(Ce.range,ae)}));return{value:K.Success,error:null,result:{sheet:ae,sheetId:le,filterRange:ce,filterViews:be}}}catch(b){const R=((g=b.response)==null?void 0:g.data)||b.message||b;return pe.Logger.log("[Google Sheets] error:",R),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:R,result:null}}}})}}function V5(a){let p,t="",n=a+1;for(;n>0;)p=(n-1)%26,t=String.fromCharCode(65+p)+t,n=(n-p-1)/26;return t}function ZRn(a,p){if(!a)return"";let t=p?`'${p}'!`:"";const n=a.startColumnIndex!==void 0?V5(a.startColumnIndex):"",s=a.startRowIndex!==void 0?String(a.startRowIndex+1):"",u=a.endColumnIndex!==void 0?V5(a.endColumnIndex-1):"",e=a.endRowIndex!==void 0?String(a.endRowIndex):"";return n&&s&&u&&e?n===u&&s===e?`${t}${n}${s}`:`${t}${n}${s}:${u}${e}`:n&&u&&!s&&!e?`${t}${n}:${u}`:s&&e&&!n&&!u?`${t}${s}:${e}`:`${t}${n}${s}:${u}${e}`.replace(/:$/,"")}class Z1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsGetMergedCells,version:"1.0.0",description:"Get Merged Cells Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsGetMergedCells);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g;try{const b=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!b||!b.env)throw new Error("Editor context or environment missing");const R=Be(t,t.project,"getMergedCells"),A="["+Ve(t,t.project,"Get merged cells")+": `"+R+"`] ",x=(ae,le,oe)=>{const ce=Ve(ae==null?void 0:ae.valueOwner,b==null?void 0:b.logic,le),be=Be(ae==null?void 0:ae.valueOwner,b==null?void 0:b.logic,oe);return`"${ce}" (\`${be}\`)`},P=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[X.GoogleSheetsGetMergedCells].inputs.connection.id}),O=(s=P==null?void 0:P.value)==null?void 0:s.valueAsType;if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${A}The ${x(P,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const $=ui(O);if(!$)throw new Error(`${A}The ${x(P,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const U=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[X.GoogleSheetsGetMergedCells].inputs.spreadsheetId.id}),Z=(u=U==null?void 0:U.value)==null?void 0:u.value,j=ln(Z,{errorPrefix:`${A}The ${x(U,"Spreadsheet ID","spreadsheetId")} input `}),H=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[X.GoogleSheetsGetMergedCells].inputs.sheet.id}),Y=(e=H==null?void 0:H.value)!=null&&e.value?String(H.value.value).trim():null,W={Authorization:`Bearer ${await b.getAccessToken()}`},z=`${(f=b.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${b.projectId}/${Zt["google-sheet"]}/${$}`,Q=((y=(await(async ae=>Ht.post(z,ae,{headers:W}))({method:"GET",endpoint:`/v4/spreadsheets/${j}`})).data)==null?void 0:y.sheets)||[],re=[];for(const ae of Q){const le=(m=ae.properties)==null?void 0:m.title,oe=(T=ae.properties)==null?void 0:T.sheetId;if(Y&&le!==Y)continue;const ce=ae.merges||[];for(const be of ce){const Ce=ZRn(be,le);re.push({sheet:le,sheetId:oe,range:Ce})}}return{value:K.Success,error:null,result:re}}catch(b){const R=((g=b.response)==null?void 0:g.data)||b.message||b;return pe.Logger.log("[Google Sheets] error:",R),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:R,result:null}}}})}}class H1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsResizeDimension,version:"1.0.0",description:"Resize Dimension Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsResizeDimension);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T;try{const g=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!g||!g.env)throw new Error("Editor context or environment missing");const b=Be(t,t.project,"resizeDimension"),I="["+Ve(t,t.project,"Resize dimension")+": `"+b+"`] ",A=(ce,be,Ce)=>{const Ee=Ve(ce==null?void 0:ce.valueOwner,g==null?void 0:g.logic,be),xe=Be(ce==null?void 0:ce.valueOwner,g==null?void 0:g.logic,Ce);return`"${Ee}" (\`${xe}\`)`},x=n.find(ce=>{var be;return((be=ce.valueOwner.declaration)==null?void 0:be.id)===G.operation[X.GoogleSheetsResizeDimension].inputs.connection.id}),P=(s=x==null?void 0:x.value)==null?void 0:s.valueAsType;if(!P||!P.id||!P.name||P.type!==r.DefinitionEntity)throw new Error(`${I}The ${A(x,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(P);if(!O)throw new Error(`${I}The ${A(x,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const $=n.find(ce=>{var be;return((be=ce.valueOwner.declaration)==null?void 0:be.id)===G.operation[X.GoogleSheetsResizeDimension].inputs.spreadsheetId.id}),U=(u=$==null?void 0:$.value)==null?void 0:u.value,Z=ln(U,{errorPrefix:`${I}The ${A($,"Spreadsheet ID","spreadsheetId")} input `}),j=n.find(ce=>{var be;return((be=ce.valueOwner.declaration)==null?void 0:be.id)===G.operation[X.GoogleSheetsResizeDimension].inputs.range.id}),H=(e=j==null?void 0:j.value)==null?void 0:e.value;if(H==null)throw new Error(`${I}The ${A(j,"Range","range")} input is missing.`);const Y=n.find(ce=>{var be;return((be=ce.valueOwner.declaration)==null?void 0:be.id)===G.operation[X.GoogleSheetsResizeDimension].inputs.dimension.id}),ie=((f=Y==null?void 0:Y.value)==null?void 0:f.value)||"Both",W=n.find(ce=>{var be;return((be=ce.valueOwner.declaration)==null?void 0:be.id)===G.operation[X.GoogleSheetsResizeDimension].inputs.pixelSize.id}),z=(y=W==null?void 0:W.value)==null?void 0:y.value;if(z==null||typeof z!="number"||isNaN(z)||z<0)throw new Error(`${I}The ${A(W,"Pixel size","pixelSize")} input is missing or invalid. Expected a non-negative number in pixels.`);const ee={Authorization:`Bearer ${await g.getAccessToken()}`},Q=`${(m=g.env)==null?void 0:m.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${g.projectId}/${Zt["google-sheet"]}/${O}`,re=async ce=>Ht.post(Q,ce,{headers:ee}),ae=await Ha(H,"Id",async()=>{var be;return(((be=(await re({method:"GET",endpoint:`/v4/spreadsheets/${Z}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:be.sheets)||[]).map(Ce=>{var Ee,xe;return{id:(Ee=Ce.properties)==null?void 0:Ee.sheetId,name:(xe=Ce.properties)==null?void 0:xe.title}})}),oe=U4(ae,typeof ie=="string"?ie:void 0,{errorPrefix:`${I}The ${A(j,"Range","range")} input `}).map(ce=>({updateDimensionProperties:{range:ce,properties:{pixelSize:z},fields:"pixelSize"}}));return await re({method:"POST",endpoint:`/v4/spreadsheets/${Z}:batchUpdate`,data:{requests:oe}}),{value:K.Success,result:null,error:null}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return pe.Logger.log("[Google Sheets] error:",b),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:b,result:null}}}})}}class W1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsClearFormatting,version:"1.0.0",description:"Clear Formatting Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsClearFormatting);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"clearFormatting"),b="["+Ve(t,t.project,"Clear formatting")+": `"+T+"`] ",R=(J,ee,Q)=>{const re=Ve(J==null?void 0:J.valueOwner,m==null?void 0:m.logic,ee),ae=Be(J==null?void 0:J.valueOwner,m==null?void 0:m.logic,Q);return`"${re}" (\`${ae}\`)`},I=n.find(J=>{var ee;return((ee=J.valueOwner.declaration)==null?void 0:ee.id)===G.operation[X.GoogleSheetsClearFormatting].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=ui(A);if(!x)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(J=>{var ee;return((ee=J.valueOwner.declaration)==null?void 0:ee.id)===G.operation[X.GoogleSheetsClearFormatting].inputs.spreadsheetId.id}),O=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(O,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(J=>{var ee;return((ee=J.valueOwner.declaration)==null?void 0:ee.id)===G.operation[X.GoogleSheetsClearFormatting].inputs.range.id}),Z=(e=U==null?void 0:U.value)==null?void 0:e.value;if(!Z||Z==="")throw new Error(`${b}The ${R(U,"Range","range")} input is missing.`);const H={Authorization:`Bearer ${await m.getAccessToken()}`},Y=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${x}`,ie=async J=>Ht.post(Y,J,{headers:H}),W=await Ha(Z,"Id",async()=>{var ee;return(((ee=(await ie({method:"GET",endpoint:`/v4/spreadsheets/${$}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:ee.sheets)||[]).map(Q=>{var re,ae;return{id:(re=Q.properties)==null?void 0:re.sheetId,name:(ae=Q.properties)==null?void 0:ae.title}})}),z=ps(W,{errorPrefix:`${b}The ${R(U,"Range","range")} input `});return await ie({method:"POST",endpoint:`/v4/spreadsheets/${$}:batchUpdate`,data:{requests:[{repeatCell:{range:z,cell:{userEnteredFormat:{}},fields:"userEnteredFormat"}}]}}),{value:K.Success,error:null,result:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class z1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_UPLOAD_FILE,version:"1.0.0",description:"Cloud File System: Upload File",initPriority:_e.High,permissions:[$e.All],contexts:[te.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===te.Logic);if(!n)return;const s=n.get(Ye.UploadFile);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"uploadFile"),b="["+Ve(t,t.project,"Upload file")+": `"+T+"`] ",R=n.find(ee=>{var Q,re;return((re=(Q=ee.valueOwner)==null?void 0:Q.declaration)==null?void 0:re.id)===G.operation[Ye.UploadFile].inputs.bucket.id}),I=(s=R==null?void 0:R.value)==null?void 0:s.valueAsType;if(!I||!I.id||!I.name||I.type!==r.DefinitionEntity)throw new Error(`${b}Invalid input "${Ve(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"Storage")}" (\`${Be(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const A=ul(I==null?void 0:I.id,((u=m.branchHead)==null?void 0:u.identifier)||"main");if(!((m==null?void 0:m.liveResources)||[]).find(ee=>ee.resourceId===A))throw new Error(`${b}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const P=n.find(ee=>{var Q,re;return((re=(Q=ee.valueOwner)==null?void 0:Q.declaration)==null?void 0:re.id)===G.operation[Ye.UploadFile].inputs.key.id}),O=(e=P==null?void 0:P.value)==null?void 0:e.value;if(!O||O==="")throw new Error(`${b}The "${Ve(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"key")}\`) input is missing.`);if(typeof O!="string")throw new Error(`${b}The "${Ve(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const $=n.find(ee=>{var Q,re;return((re=(Q=ee.valueOwner)==null?void 0:Q.declaration)==null?void 0:re.id)===G.operation[Ye.UploadFile].inputs.file.id}),U=(f=$==null?void 0:$.value)==null?void 0:f.value;if(!U)throw new Error(`${b}The "${Ve($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"File")}" (\`${Be($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"file")}\`) input is missing'`);if(typeof U!="object"||!U.uri||typeof U.uri!="string")throw new Error(`${b}The "${Ve($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"File")}" (\`${Be($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"file")}\`) input is invalid, should be an object with a text 'uri' property.`);const Z=U.uri,j=U.mimeType||"application/octet-stream",H=O,ie=(y=(await Ht.post(`${m.env.API_BASE_URL}/cloud-files-service/v1/files?bucket=${A}&key=${encodeURIComponent(H)}&contentType=${encodeURIComponent(j)}`,{},{headers:{Authorization:`Bearer ${await m.getAccessToken()}`}})).data)==null?void 0:y.uploadUrl;if(!ie)throw new Error(`${b}Failed to retrieve pre-signed upload URL.`);let W;try{W=await F4(Z,()=>m.getAccessToken())}catch(ee){throw new Error(`${b}Failed to fetch file content from '${Z}': ${(ee==null?void 0:ee.message)||ee}`)}await Ht.put(ie,W,{headers:{"Content-Type":j}});const J={uri:`${m.env.API_BASE_URL}/cloud-files-service/v1/files/download?bucket=${A}&key=${encodeURIComponent(H)}`,name:H.split("/").pop()||H,mimeType:j,size:W.length};return{value:K.Success,error:null,result:J}}catch(m){return{value:K.UnhandledError,error:m,result:null}}}})}}class Y1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_GET_FILE,version:"1.0.0",description:"Cloud File System: Get File",initPriority:_e.High,permissions:[$e.All],contexts:[te.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===te.Logic);if(!n)return;const s=n.get(Ye.GetFile);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e;try{const f=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!f||!f.env)throw new Error("Editor context or environment missing");const y=Be(t,t.project,"getFile"),T="["+Ve(t,t.project,"Get file")+": `"+y+"`] ",g=n.find($=>{var U,Z;return((Z=(U=$.valueOwner)==null?void 0:U.declaration)==null?void 0:Z.id)===G.operation[Ye.GetFile].inputs.bucket.id}),b=(s=g==null?void 0:g.value)==null?void 0:s.valueAsType;if(!b||!b.id||!b.name||b.type!==r.DefinitionEntity)throw new Error(`${T}Invalid input "${Ve(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"Storage")}" (\`${Be(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const R=ul(b==null?void 0:b.id,((u=f.branchHead)==null?void 0:u.identifier)||"main");if(!((f==null?void 0:f.liveResources)||[]).find($=>$.resourceId===R))throw new Error(`${T}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const A=n.find($=>{var U,Z;return((Z=(U=$.valueOwner)==null?void 0:U.declaration)==null?void 0:Z.id)===G.operation[Ye.GetFile].inputs.key.id}),x=(e=A==null?void 0:A.value)==null?void 0:e.value;if(!x||x==="")throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"key")}\`) input is missing.`);if(typeof x!="string")throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const O=(await Ht.get(`${f.env.API_BASE_URL}/cloud-files-service/v1/files/metadata?bucket=${R}&key=${encodeURIComponent(x)}`,{headers:{Authorization:`Bearer ${await f.getAccessToken()}`}})).data;return{value:K.Success,error:null,result:{uri:O.uri,name:O.name,key:O.key,size:O.size,mimeType:O.mimeType,access:O.access,lastModified:O.lastModified}}}catch(f){return{value:K.UnhandledError,error:f,result:null}}}})}}class J1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_LIST_FILES,version:"1.0.0",description:"Cloud File System: List Files",initPriority:_e.High,permissions:[$e.All],contexts:[te.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===te.Logic);if(!n)return;const s=n.get(Ye.ListFiles);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"listFiles"),b="["+Ve(t,t.project,"List files")+": `"+T+"`] ",R=n.find(ae=>{var le,oe;return((oe=(le=ae.valueOwner)==null?void 0:le.declaration)==null?void 0:oe.id)===G.operation[Ye.ListFiles].inputs.bucket.id}),I=(s=R==null?void 0:R.value)==null?void 0:s.valueAsType;if(!I||!I.id||!I.name||I.type!==r.DefinitionEntity)throw new Error(`${b}Invalid input "${Ve(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"Storage")}" (\`${Be(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const A=ul(I==null?void 0:I.id,((u=m.branchHead)==null?void 0:u.identifier)||"main");if(!((m==null?void 0:m.liveResources)||[]).find(ae=>ae.resourceId===A))throw new Error(`${b}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const P=n.find(ae=>{var le,oe;return((oe=(le=ae.valueOwner)==null?void 0:le.declaration)==null?void 0:oe.id)===G.operation[Ye.ListFiles].inputs.path.id}),O=(e=P==null?void 0:P.value)==null?void 0:e.value;if(O!==void 0&&typeof O!="string")throw new Error(`${b}The "${Ve(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"Path")}" (\`${Be(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"path")}\`) input value is invalid, if present, it must be a string.`);const $=n.find(ae=>{var le,oe;return((oe=(le=ae.valueOwner)==null?void 0:le.declaration)==null?void 0:oe.id)===G.operation[Ye.ListFiles].inputs.maxKeys.id}),U=(f=$==null?void 0:$.value)==null?void 0:f.value;if(U!==void 0&&(typeof U!="number"||U<=0))throw new Error(`${b}The "${Ve($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"Max results")}" (\`${Be($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"maxKeys")}\`) input value is invalid, if present, it must be a number greater than 0.`);const Z=n.find(ae=>{var le,oe;return((oe=(le=ae.valueOwner)==null?void 0:le.declaration)==null?void 0:oe.id)===G.operation[Ye.ListFiles].inputs.startAfter.id}),j=(y=Z==null?void 0:Z.value)==null?void 0:y.value;if(j!==void 0&&(typeof j!="string"||j===""))throw new Error(`${b}The "${Ve(Z==null?void 0:Z.valueOwner,m==null?void 0:m.logic,"Start after")}" (\`${Be(Z==null?void 0:Z.valueOwner,m==null?void 0:m.logic,"startAfter")}\`) input value is invalid, if present, it must be a non-empty string.`);let H=`${m.env.API_BASE_URL}/cloud-files-service/v1/files?bucket=${A}`;O&&(H+=`&path=${encodeURIComponent(O)}`),U&&(H+=`&maxKeys=${U}`),j&&(H+=`&startAfter=${encodeURIComponent(j)}`);const Y=await Ht.get(H,{headers:{Authorization:`Bearer ${await m.getAccessToken()}`}}),ie=ae=>{var be;if(!ae)return"application/octet-stream";const le=ae.split(".");if(le.length<=1)return"application/octet-stream";const oe=(be=le.pop())==null?void 0:be.toLowerCase();return oe&&{png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",svg:"image/svg+xml",pdf:"application/pdf",txt:"text/plain",html:"text/html",css:"text/css",js:"application/javascript",json:"application/json",csv:"text/csv",xml:"application/xml",zip:"application/zip",mp3:"audio/mpeg",mp4:"video/mp4",mov:"video/quicktime",wav:"audio/wav"}[oe]||"application/octet-stream"},z=(Y.data.items||Y.data.files||[]).map(ae=>({uri:ae.uri||ae.url||`${m.env.API_BASE_URL}/cloud-files-service/v1/files/download?bucket=${A}&key=${encodeURIComponent(ae.key)}`,name:ae.name,key:ae.key,mimeType:ae.mimeType||ie(ae.key),size:ae.size||0,lastModified:ae.lastModified,access:ae.access})),J=Y.data.total!==void 0?Y.data.total:z.length,ee=Y.data.size!==void 0?Y.data.size:z.reduce((ae,le)=>ae+(le.size||0),0),Q=Y.data.nextStartAfter!==void 0?Y.data.nextStartAfter:null,re=Y.data.hasMore!==void 0?Y.data.hasMore:!1;return{value:K.Success,error:null,result:{items:z,total:J,size:ee,nextStartAfter:Q,hasMore:re}}}catch(m){return{value:K.UnhandledError,error:m,result:null}}}})}}class Q1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_DELETE_FILES,version:"1.0.0",description:"Cloud File System: Delete Files",initPriority:_e.High,permissions:[$e.All],contexts:[te.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===te.Logic);if(!n)return;const s=n.get(Ye.DeleteFiles);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e;try{const f=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!f||!f.env)throw new Error("Editor context or environment missing");const y=Be(t,t.project,"deleteFiles"),T="["+Ve(t,t.project,"Delete files")+": `"+y+"`] ",g=n.find(U=>{var Z,j;return((j=(Z=U.valueOwner)==null?void 0:Z.declaration)==null?void 0:j.id)===G.operation[Ye.DeleteFiles].inputs.bucket.id}),b=(s=g==null?void 0:g.value)==null?void 0:s.valueAsType;if(!b||!b.id||!b.name||b.type!==r.DefinitionEntity)throw new Error(`${T}Invalid input "${Ve(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"Storage")}" (\`${Be(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const R=ul(b==null?void 0:b.id,((u=f.branchHead)==null?void 0:u.identifier)||"main");if(!((f==null?void 0:f.liveResources)||[]).find(U=>U.resourceId===R))throw new Error(`${T}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const A=n.find(U=>{var Z,j;return((j=(Z=U.valueOwner)==null?void 0:Z.declaration)==null?void 0:j.id)===G.operation[Ye.DeleteFiles].inputs.keys.id}),x=(e=A==null?void 0:A.value)==null?void 0:e.value,P=Array.isArray(x)?x:typeof x=="string"&&x!==""?[x]:[];if(!P||P.length===0)throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Keys")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"keys")}\`) input is missing.`);if(!Array.isArray(P)||P.some(U=>typeof U!="string"||U===""))throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Keys")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"keys")}\`) input value is invalid, if present, it must be a list of non-empty strings.`);const $=(await Ht.delete(`${f.env.API_BASE_URL}/cloud-files-service/v1/files`,{headers:{Authorization:`Bearer ${await f.getAccessToken()}`},data:{bucket:R,keys:P}})).data;return{value:K.Success,error:null,result:null}}catch(f){return{value:K.UnhandledError,error:f,result:null}}}})}}class X1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_COPY_FILE,version:"1.0.0",description:"Cloud File System: Copy File",initPriority:_e.High,permissions:[$e.All],contexts:[te.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===te.Logic);if(!n)return;const s=n.get(Ye.CopyFile);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=Be(t,t.project,"copyFile"),R="["+Ve(t,t.project,"Copy file")+": `"+g+"`] ",I=n.find(ee=>{var Q,re;return((re=(Q=ee.valueOwner)==null?void 0:Q.declaration)==null?void 0:re.id)===G.operation[Ye.CopyFile].inputs.bucket.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${R}Invalid input "${Ve(I==null?void 0:I.valueOwner,T==null?void 0:T.logic,"Storage")}" (\`${Be(I==null?void 0:I.valueOwner,T==null?void 0:T.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const x=ul(A==null?void 0:A.id,((u=T.branchHead)==null?void 0:u.identifier)||"main");if(!((T==null?void 0:T.liveResources)||[]).find(ee=>ee.resourceId===x))throw new Error(`${R}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const O=n.find(ee=>{var Q,re;return((re=(Q=ee.valueOwner)==null?void 0:Q.declaration)==null?void 0:re.id)===G.operation[Ye.CopyFile].inputs.sourceKey.id}),$=(e=O==null?void 0:O.value)==null?void 0:e.value;if(!$||$==="")throw new Error(`${R}The "${Ve(O==null?void 0:O.valueOwner,T==null?void 0:T.logic,"Source key")}" (\`${Be(O==null?void 0:O.valueOwner,T==null?void 0:T.logic,"sourceKey")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${R}The "${Ve(O==null?void 0:O.valueOwner,T==null?void 0:T.logic,"Source key")}" (\`${Be(O==null?void 0:O.valueOwner,T==null?void 0:T.logic,"sourceKey")}\`) input value is invalid, if present, it must be a non-empty string.`);const U=n.find(ee=>{var Q,re;return((re=(Q=ee.valueOwner)==null?void 0:Q.declaration)==null?void 0:re.id)===G.operation[Ye.CopyFile].inputs.destinationKey.id}),Z=(f=U==null?void 0:U.value)==null?void 0:f.value;if(!Z||Z==="")throw new Error(`${R}The "${Ve(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"Destination key")}" (\`${Be(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"destinationKey")}\`) input is missing.`);if(typeof Z!="string")throw new Error(`${R}The "${Ve(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"Destination key")}" (\`${Be(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"destinationKey")}\`) input value is invalid, if present, it must be a non-empty string.`);const j=n.find(ee=>{var Q,re;return((re=(Q=ee.valueOwner)==null?void 0:Q.declaration)==null?void 0:re.id)===G.operation[Ye.CopyFile].inputs.destinationBucket.id}),H=(y=j==null?void 0:j.value)==null?void 0:y.valueAsType;if(H&&(!H.id||!H.name||H.type!==r.DefinitionEntity))throw new Error(`${R}Invalid input "${Ve(j==null?void 0:j.valueOwner,T==null?void 0:T.logic,"Destination Storage")}" (\`${Be(j==null?void 0:j.valueOwner,T==null?void 0:T.logic,"destinationBucket")}\`), expected a valid "Cloud file system" node.`);const Y=H!=null&&H.id?ul(H.id,((m=T.branchHead)==null?void 0:m.identifier)||"main"):x;if(!((T==null?void 0:T.liveResources)||[]).find(ee=>ee.resourceId===Y))throw new Error(`${R}The destination "Cloud file system" is not live. Publish the project first, then try again to run the operation node.`);const W={headers:{Authorization:`Bearer ${await T.getAccessToken()}`}},J=(await Ht.post(`${T.env.API_BASE_URL}/cloud-files-service/v1/files/copy`,{bucket:x,destinationBucket:Y,sourceKey:$,destinationKey:Z},W)).data;return{value:K.Success,error:null,result:null}}catch(T){return{value:K.UnhandledError,error:T,result:null}}}})}}class eDt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_MOVE_FILE,version:"1.0.0",description:"Cloud File System: Move File",initPriority:_e.High,permissions:[$e.All],contexts:[te.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===te.Logic);if(!n)return;const s=n.get(Ye.MoveFile);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=Be(t,t.project,"moveFile"),R="["+Ve(t,t.project,"Move file")+": `"+g+"`] ",I=n.find(ee=>{var Q,re;return((re=(Q=ee.valueOwner)==null?void 0:Q.declaration)==null?void 0:re.id)===G.operation[Ye.MoveFile].inputs.bucket.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${R}Invalid input "${Ve(I==null?void 0:I.valueOwner,T==null?void 0:T.logic,"Storage")}" (\`${Be(I==null?void 0:I.valueOwner,T==null?void 0:T.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const x=ul(A==null?void 0:A.id,((u=T.branchHead)==null?void 0:u.identifier)||"main");if(!((T==null?void 0:T.liveResources)||[]).find(ee=>ee.resourceId===x))throw new Error(`${R}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const O=n.find(ee=>{var Q,re;return((re=(Q=ee.valueOwner)==null?void 0:Q.declaration)==null?void 0:re.id)===G.operation[Ye.MoveFile].inputs.sourceKey.id}),$=(e=O==null?void 0:O.value)==null?void 0:e.value;if(!$||$==="")throw new Error(`${R}The "${Ve(O==null?void 0:O.valueOwner,T==null?void 0:T.logic,"Source key")}" (\`${Be(O==null?void 0:O.valueOwner,T==null?void 0:T.logic,"sourceKey")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${R}The "${Ve(O==null?void 0:O.valueOwner,T==null?void 0:T.logic,"Source key")}" (\`${Be(O==null?void 0:O.valueOwner,T==null?void 0:T.logic,"sourceKey")}\`) input value is invalid, if present, it must be a non-empty string.`);const U=n.find(ee=>{var Q,re;return((re=(Q=ee.valueOwner)==null?void 0:Q.declaration)==null?void 0:re.id)===G.operation[Ye.MoveFile].inputs.destinationKey.id}),Z=(f=U==null?void 0:U.value)==null?void 0:f.value;if(!Z||Z==="")throw new Error(`${R}The "${Ve(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"Destination key")}" (\`${Be(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"destinationKey")}\`) input is missing.`);if(typeof Z!="string")throw new Error(`${R}The "${Ve(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"Destination key")}" (\`${Be(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"destinationKey")}\`) input value is invalid, if present, it must be a non-empty string.`);const j=n.find(ee=>{var Q,re;return((re=(Q=ee.valueOwner)==null?void 0:Q.declaration)==null?void 0:re.id)===G.operation[Ye.MoveFile].inputs.destinationBucket.id}),H=(y=j==null?void 0:j.value)==null?void 0:y.valueAsType;if(H&&(!H.id||!H.name||H.type!==r.DefinitionEntity))throw new Error(`${R}Invalid input "${Ve(j==null?void 0:j.valueOwner,T==null?void 0:T.logic,"Destination storage")}" (\`${Be(j==null?void 0:j.valueOwner,T==null?void 0:T.logic,"destinationBucket")}\`), expected a valid "Cloud file system" node.`);const Y=H!=null&&H.id?ul(H.id,((m=T.branchHead)==null?void 0:m.identifier)||"main"):x;if(!((T==null?void 0:T.liveResources)||[]).find(ee=>ee.resourceId===Y))throw new Error(`${R}The destination "Cloud file system" is not live. Publish the project first, then try again to run the operation node.`);const W={headers:{Authorization:`Bearer ${await T.getAccessToken()}`}},J=(await Ht.post(`${T.env.API_BASE_URL}/cloud-files-service/v1/files/move`,{bucket:x,destinationBucket:Y,sourceKey:$,destinationKey:Z},W)).data;return{value:K.Success,error:null,result:null}}catch(T){return{value:K.UnhandledError,error:T,result:null}}}})}}class tDt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_RENAME_FILE,version:"1.0.0",description:"Cloud File System: Rename File",initPriority:_e.High,permissions:[$e.All],contexts:[te.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===te.Logic);if(!n)return;const s=n.get(Ye.RenameFile);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f;try{const y=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!y||!y.env)throw new Error("Editor context or environment missing");const m=Be(t,t.project,"renameFile"),g="["+Ve(t,t.project,"Rename file")+": `"+m+"`] ",b=n.find(ie=>{var W,z;return((z=(W=ie.valueOwner)==null?void 0:W.declaration)==null?void 0:z.id)===G.operation[Ye.RenameFile].inputs.bucket.id}),R=(s=b==null?void 0:b.value)==null?void 0:s.valueAsType;if(!R||!R.id||!R.name||R.type!==r.DefinitionEntity)throw new Error(`${g}Invalid input "${Ve(b==null?void 0:b.valueOwner,y==null?void 0:y.logic,"Storage")}" (\`${Be(b==null?void 0:b.valueOwner,y==null?void 0:y.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const I=ul(R==null?void 0:R.id,((u=y.branchHead)==null?void 0:u.identifier)||"main");if(!((y==null?void 0:y.liveResources)||[]).find(ie=>ie.resourceId===I))throw new Error(`${g}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const x=n.find(ie=>{var W,z;return((z=(W=ie.valueOwner)==null?void 0:W.declaration)==null?void 0:z.id)===G.operation[Ye.RenameFile].inputs.key.id}),P=(e=x==null?void 0:x.value)==null?void 0:e.value;if(!P||P==="")throw new Error(`${g}The "${Ve(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"Key")}" (\`${Be(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"key")}\`) input is missing.`);if(typeof P!="string")throw new Error(`${g}The "${Ve(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"Key")}" (\`${Be(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const O=n.find(ie=>{var W,z;return((z=(W=ie.valueOwner)==null?void 0:W.declaration)==null?void 0:z.id)===G.operation[Ye.RenameFile].inputs.newName.id}),$=(f=O==null?void 0:O.value)==null?void 0:f.value;if(!$||$==="")throw new Error(`${g}The "${Ve(O==null?void 0:O.valueOwner,y==null?void 0:y.logic,"New name")}" (\`${Be(O==null?void 0:O.valueOwner,y==null?void 0:y.logic,"newName")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${g}The "${Ve(O==null?void 0:O.valueOwner,y==null?void 0:y.logic,"New name")}" (\`${Be(O==null?void 0:O.valueOwner,y==null?void 0:y.logic,"newName")}\`) input value is invalid, if present, it must be a non-empty string.`);const U=P.lastIndexOf("/"),j=`${U!==-1?P.substring(0,U+1):""}${$}`,H={headers:{Authorization:`Bearer ${await y.getAccessToken()}`}},Y=await Ht.post(`${y.env.API_BASE_URL}/cloud-files-service/v1/files/rename`,{bucket:I,key:P,newName:$},H);return{value:K.Success,error:null,result:Y.data||{key:P,newName:$,destinationKey:j}}}catch(y){return{value:K.UnhandledError,error:y,result:null}}}})}}class iDt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_GET_FILE_METADATA,version:"1.0.0",description:"Cloud File System: Get File Metadata",initPriority:_e.High,permissions:[$e.All],contexts:[te.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===te.Logic);if(!n)return;const s=n.get(Ye.GetFileMetadata);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e;try{const f=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!f||!f.env)throw new Error("Editor context or environment missing");const y=Be(t,t.project,"getFileMetadata"),T="["+Ve(t,t.project,"Get file metadata")+": `"+y+"`] ",g=n.find(O=>{var $,U;return((U=($=O.valueOwner)==null?void 0:$.declaration)==null?void 0:U.id)===G.operation[Ye.GetFileMetadata].inputs.bucket.id}),b=(s=g==null?void 0:g.value)==null?void 0:s.valueAsType;if(!b||!b.id||!b.name||b.type!==r.DefinitionEntity)throw new Error(`${T}Invalid input "${Ve(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"Storage")}" (\`${Be(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const R=ul(b==null?void 0:b.id,((u=f.branchHead)==null?void 0:u.identifier)||"main");if(!((f==null?void 0:f.liveResources)||[]).find(O=>O.resourceId===R))throw new Error(`${T}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const A=n.find(O=>{var $,U;return((U=($=O.valueOwner)==null?void 0:$.declaration)==null?void 0:U.id)===G.operation[Ye.GetFileMetadata].inputs.key.id}),x=(e=A==null?void 0:A.value)==null?void 0:e.value;if(!x||x==="")throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"key")}\`) input is missing.`);if(typeof x!="string")throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const P=await Ht.get(`${f.env.API_BASE_URL}/cloud-files-service/v1/files/metadata?bucket=${R}&key=${encodeURIComponent(x)}`,{headers:{Authorization:`Bearer ${await f.getAccessToken()}`}});return{value:K.Success,error:null,result:P.data}}catch(f){return{value:K.UnhandledError,error:f,result:null}}}})}}class nDt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_CHECK_FILE_EXISTS,version:"1.0.0",description:"Cloud File System: Check File Exists",initPriority:_e.High,permissions:[$e.All],contexts:[te.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===te.Logic);if(!n)return;const s=n.get(Ye.CheckFileExists);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e;try{const f=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!f||!f.env)throw new Error("Editor context or environment missing");const y=Be(t,t.project,"checkFileExists"),T="["+Ve(t,t.project,"Check File Exists")+": `"+y+"`] ",g=n.find(O=>{var $,U;return((U=($=O.valueOwner)==null?void 0:$.declaration)==null?void 0:U.id)===G.operation[Ye.CheckFileExists].inputs.bucket.id}),b=(s=g==null?void 0:g.value)==null?void 0:s.valueAsType;if(!b||!b.id||!b.name||b.type!==r.DefinitionEntity)throw new Error(`${T}Invalid input "${Ve(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"Storage")}" (\`${Be(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const R=ul(b==null?void 0:b.id,((u=f.branchHead)==null?void 0:u.identifier)||"main");if(!((f==null?void 0:f.liveResources)||[]).find(O=>O.resourceId===R))throw new Error(`${T}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const A=n.find(O=>{var $,U;return((U=($=O.valueOwner)==null?void 0:$.declaration)==null?void 0:U.id)===G.operation[Ye.CheckFileExists].inputs.key.id}),x=(e=A==null?void 0:A.value)==null?void 0:e.value;if(!x||x==="")throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"key")}\`) input is missing.`);if(typeof x!="string")throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const P=await Ht.get(`${f.env.API_BASE_URL}/cloud-files-service/v1/files/exists?bucket=${R}&key=${encodeURIComponent(x)}`,{headers:{Authorization:`Bearer ${await f.getAccessToken()}`}});return{value:K.Success,error:null,result:P.data.exists}}catch(f){return{value:K.UnhandledError,error:f,result:!1}}}})}}class rDt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_GET_PRESIGNED_URL,version:"1.0.0",description:"Cloud File System: Get Pre-signed URL",initPriority:_e.High,permissions:[$e.All],contexts:[te.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===te.Logic);if(!n)return;const s=n.get(Ye.GetPresignedUrl);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"getPresignedUrl"),b="["+Ve(t,t.project,"Get pre-signed URL")+": `"+T+"`] ",R=n.find(z=>{var J,ee;return((ee=(J=z.valueOwner)==null?void 0:J.declaration)==null?void 0:ee.id)===G.operation[Ye.GetPresignedUrl].inputs.bucket.id}),I=(s=R==null?void 0:R.value)==null?void 0:s.valueAsType;if(!I||!I.id||!I.name||I.type!==r.DefinitionEntity)throw new Error(`${b}Invalid input "${Ve(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"Storage")}" (\`${Be(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const A=ul(I==null?void 0:I.id,((u=m.branchHead)==null?void 0:u.identifier)||"main");if(!((m==null?void 0:m.liveResources)||[]).find(z=>z.resourceId===A))throw new Error(`${b}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const P=n.find(z=>{var J,ee;return((ee=(J=z.valueOwner)==null?void 0:J.declaration)==null?void 0:ee.id)===G.operation[Ye.GetPresignedUrl].inputs.key.id}),O=(e=P==null?void 0:P.value)==null?void 0:e.value;if(!O||O==="")throw new Error(`${b}The "${Ve(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"key")}\`) input is missing.`);if(typeof O!="string")throw new Error(`${b}The "${Ve(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const $=n.find(z=>{var J,ee;return((ee=(J=z.valueOwner)==null?void 0:J.declaration)==null?void 0:ee.id)===G.operation[Ye.GetPresignedUrl].inputs.action.id}),U=(f=$==null?void 0:$.value)==null?void 0:f.value,Z=(U||"read").toLowerCase(),j=["read","write","delete","metadata","upload","putobject","head","headobject","getobject","get"];if(!U||U==="")throw new Error(`${b}The "${Ve($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"Action")}" (\`${Be($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"action")}\`) input is missing.`);if(!j.includes(Z))throw new Error(`${b}Invalid "${Ve($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"Action")}" (\`${Be($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"action")}\`) input value, must be one of "read", "write", "delete" or "metadata".`);const H=n.find(z=>{var J,ee;return((ee=(J=z.valueOwner)==null?void 0:J.declaration)==null?void 0:ee.id)===G.operation[Ye.GetPresignedUrl].inputs.expiresInSeconds.id}),Y=(y=H==null?void 0:H.value)==null?void 0:y.value,ie=Y!=null?Number(Y):3600;if(isNaN(ie)||ie<=0)throw new Error(`${b}Invalid "${Ve(H==null?void 0:H.valueOwner,m==null?void 0:m.logic,"Expires in seconds")}" (\`${Be(H==null?void 0:H.valueOwner,m==null?void 0:m.logic,"expiresInSeconds")}\`) input value, expected a positive number.`);const W=await Ht.get(`${m.env.API_BASE_URL}/cloud-files-service/v1/files/presigned-url?bucket=${A}&key=${encodeURIComponent(O)}&action=${Z}&expiresInSeconds=${ie}`,{headers:{Authorization:`Bearer ${await m.getAccessToken()}`}});return{value:K.Success,error:null,result:W.data}}catch(m){return{value:K.UnhandledError,error:m,result:null}}}})}}class aDt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_SET_FILE_ACCESS,version:"1.0.0",description:"Cloud File System: Set File Access",initPriority:_e.High,permissions:[$e.All],contexts:[te.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===te.Logic);if(!n)return;const s=n.get(Ye.SetFileAccess);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f;try{const y=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!y||!y.env)throw new Error("Editor context or environment missing");const m=Be(t,t.project,"setFileAccess"),g="["+Ve(t,t.project,"Set file access")+": `"+m+"`] ",b=n.find(U=>{var Z,j;return((j=(Z=U.valueOwner)==null?void 0:Z.declaration)==null?void 0:j.id)===G.operation[Ye.SetFileAccess].inputs.bucket.id}),R=(s=b==null?void 0:b.value)==null?void 0:s.valueAsType;if(!R||!R.id||!R.name||R.type!==r.DefinitionEntity)throw new Error(`${g}Invalid input "${Ve(b==null?void 0:b.valueOwner,y==null?void 0:y.logic,"Storage")}" (\`${Be(b==null?void 0:b.valueOwner,y==null?void 0:y.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const I=ul(R==null?void 0:R.id,((u=y.branchHead)==null?void 0:u.identifier)||"main");if(!((y==null?void 0:y.liveResources)||[]).find(U=>U.resourceId===I))throw new Error(`${g}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const x=n.find(U=>{var Z,j;return((j=(Z=U.valueOwner)==null?void 0:Z.declaration)==null?void 0:j.id)===G.operation[Ye.SetFileAccess].inputs.key.id}),P=(e=x==null?void 0:x.value)==null?void 0:e.value;if(!P||P==="")throw new Error(`${g}The "${Ve(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"Key")}" (\`${Be(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"key")}\`) input is missing.`);if(typeof P!="string")throw new Error(`${g}The "${Ve(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"Key")}" (\`${Be(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const O=n.find(U=>{var Z,j;return((j=(Z=U.valueOwner)==null?void 0:Z.declaration)==null?void 0:j.id)===G.operation[Ye.SetFileAccess].inputs.access.id}),$=((f=O==null?void 0:O.value)==null?void 0:f.value)??"private";if(!$||$==="")throw new Error(`${g}The "${Ve(O==null?void 0:O.valueOwner,y==null?void 0:y.logic,"Access")}" (\`${Be(O==null?void 0:O.valueOwner,y==null?void 0:y.logic,"access")}\`) input is missing.`);if(typeof $!="string"||!["public","private"].includes($))throw new Error(`${g}The "${Ve(O==null?void 0:O.valueOwner,y==null?void 0:y.logic,"Access")}" (\`${Be(O==null?void 0:O.valueOwner,y==null?void 0:y.logic,"access")}\`) input value is invalid, if present, it must be exactly the "public" or "private" text values.`);return await Ht.post(`${y.env.API_BASE_URL}/cloud-files-service/v1/files/access`,{bucket:I,key:P,access:$},{headers:{Authorization:`Bearer ${await y.getAccessToken()}`}}),{value:K.Success,error:null,result:null}}catch(y){return{value:K.UnhandledError,error:y,result:null}}}})}}class sDt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_CREATE_FOLDER,version:"1.0.0",description:"Cloud File System: Create Folder",initPriority:_e.High,permissions:[$e.All],contexts:[te.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===te.Logic);if(!n)return;const s=n.get(Ye.CreateFolder);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e;try{const f=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!f||!f.env)throw new Error("Editor context or environment missing");const y=Be(t,t.project,"createFolder"),T="["+Ve(t,t.project,"Create folder")+": `"+y+"`] ",g=n.find($=>{var U,Z;return((Z=(U=$.valueOwner)==null?void 0:U.declaration)==null?void 0:Z.id)===G.operation[Ye.CreateFolder].inputs.bucket.id}),b=(s=g==null?void 0:g.value)==null?void 0:s.valueAsType;if(!b||!b.id||!b.name||b.type!==r.DefinitionEntity)throw new Error(`${T}Invalid input "${Ve(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"Storage")}" (\`${Be(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const R=ul(b==null?void 0:b.id,((u=f.branchHead)==null?void 0:u.identifier)||"main");if(!((f==null?void 0:f.liveResources)||[]).find($=>$.resourceId===R))throw new Error(`${T}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const A=n.find($=>{var U,Z;return((Z=(U=$.valueOwner)==null?void 0:U.declaration)==null?void 0:Z.id)===G.operation[Ye.CreateFolder].inputs.folderPath.id}),x=(e=A==null?void 0:A.value)==null?void 0:e.value;if(!x||x==="")throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Folder path")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"folderPath")}\`) input is missing.`);if(typeof x!="string")throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Folder path")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"folderPath")}\`) input value is invalid, if present, it must be a non-empty string.`);const O=(await Ht.post(`${f.env.API_BASE_URL}/cloud-files-service/v1/files/folders`,{bucket:R,folderPath:x},{headers:{Authorization:`Bearer ${await f.getAccessToken()}`}})).data;return{value:K.Success,error:null,result:null}}catch(f){return{value:K.UnhandledError,error:f,result:null}}}})}}class lDt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_DELETE_FOLDERS,version:"1.0.0",description:"Cloud File System: Delete Folders",initPriority:_e.High,permissions:[$e.All],contexts:[te.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===te.Logic);if(!n)return;const s=n.get(Ye.DeleteFolders);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e;try{const f=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!f||!f.env)throw new Error("Editor context or environment missing");const y=Be(t,t.project,"deleteFolders"),T="["+Ve(t,t.project,"Delete folders")+": `"+y+"`] ",g=n.find(U=>{var Z,j;return((j=(Z=U.valueOwner)==null?void 0:Z.declaration)==null?void 0:j.id)===G.operation[Ye.DeleteFolders].inputs.bucket.id}),b=(s=g==null?void 0:g.value)==null?void 0:s.valueAsType;if(!b||!b.id||!b.name||b.type!==r.DefinitionEntity)throw new Error(`${T}Invalid input "${Ve(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"Storage")}" (\`${Be(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const R=ul(b==null?void 0:b.id,((u=f.branchHead)==null?void 0:u.identifier)||"main");if(!((f==null?void 0:f.liveResources)||[]).find(U=>U.resourceId===R))throw new Error(`${T}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const A=n.find(U=>{var Z,j;return((j=(Z=U.valueOwner)==null?void 0:Z.declaration)==null?void 0:j.id)===G.operation[Ye.DeleteFolders].inputs.folderPaths.id}),x=(e=A==null?void 0:A.value)==null?void 0:e.value,P=Array.isArray(x)?x:typeof x=="string"&&x!==""?[x]:[];if(!P||P.length===0)throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Folder paths")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"folderPaths")}\`) input is missing.`);if(!Array.isArray(P)||P.some(U=>typeof U!="string"||U===""))throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Folder paths")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"folderPaths")}\`) input value is invalid, if present, it must be a list of non-empty strings.`);const $=(await Ht.delete(`${f.env.API_BASE_URL}/cloud-files-service/v1/files/folders`,{headers:{Authorization:`Bearer ${await f.getAccessToken()}`},data:{bucket:R,folderPaths:P}})).data;return{value:K.Success,error:null,result:null}}catch(f){return{value:K.UnhandledError,error:f,result:null}}}})}}class oDt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_CREATE_MULTIPART_UPLOAD,version:"1.0.0",description:"Cloud File System: Create Multipart Upload",initPriority:_e.High,permissions:[$e.All],contexts:[te.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===te.Logic);if(!n)return;const s=n.get(Ye.CreateMultipartUpload);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"createMultipartUpload"),b="["+Ve(t,t.project,"Create multipart upload")+": `"+T+"`] ",R=n.find(Z=>{var j,H;return((H=(j=Z.valueOwner)==null?void 0:j.declaration)==null?void 0:H.id)===G.operation[Ye.CreateMultipartUpload].inputs.bucket.id}),I=(s=R==null?void 0:R.value)==null?void 0:s.valueAsType;if(!I||!I.id||!I.name||I.type!==r.DefinitionEntity)throw new Error(`${b}Invalid input "${Ve(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"Storage")}" (\`${Be(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const A=ul(I==null?void 0:I.id,((u=m.branchHead)==null?void 0:u.identifier)||"main"),x=n.find(Z=>{var j,H;return((H=(j=Z.valueOwner)==null?void 0:j.declaration)==null?void 0:H.id)===G.operation[Ye.CreateMultipartUpload].inputs.key.id}),P=(e=x==null?void 0:x.value)==null?void 0:e.value;if(!P||P==="")throw new Error(`${b}The "${Ve(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"key")}\`) input is missing.`);if(typeof P!="string")throw new Error(`${b}The "${Ve(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const O=n.find(Z=>{var j,H;return((H=(j=Z.valueOwner)==null?void 0:j.declaration)==null?void 0:H.id)===G.operation[Ye.CreateMultipartUpload].inputs.contentType.id}),$=((f=O==null?void 0:O.value)==null?void 0:f.value)||"application/octet-stream";if(!$||$==="")throw new Error(`${b}The "${Ve(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"Content Type")}" (\`${Be(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"contentType")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${b}The "${Ve(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"Content Type")}" (\`${Be(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"contentType")}\`) input value is invalid, if present, it must be a non-empty string.`);const U=await Ht.post(`${m.env.API_BASE_URL}/cloud-files-service/v1/files/multipart?bucket=${A}&key=${encodeURIComponent(P)}&contentType=${encodeURIComponent($)}`,{},{headers:{Authorization:`Bearer ${await m.getAccessToken()}`}});return{value:K.Success,error:null,result:{uploadId:typeof U.data=="object"&&((y=U.data)!=null&&y.uploadId)?U.data.uploadId:U.data}}}catch(m){return{value:K.UnhandledError,error:m,result:null}}}})}}class dDt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_GET_UPLOAD_PART_PRESIGNED_URL,version:"1.0.0",description:"Cloud File System: Get Upload Part Pre-signed URL",initPriority:_e.High,permissions:[$e.All],contexts:[te.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===te.Logic);if(!n)return;const s=n.get(Ye.GetUploadPartPresignedUrl);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"getUploadPartPresignedUrl"),b="["+Ve(t,t.project,"Get upload part pre-signed URL")+": `"+T+"`] ",R=n.find(H=>{var Y,ie;return((ie=(Y=H.valueOwner)==null?void 0:Y.declaration)==null?void 0:ie.id)===G.operation[Ye.GetUploadPartPresignedUrl].inputs.bucket.id}),I=(s=R==null?void 0:R.value)==null?void 0:s.valueAsType;if(!I||!I.id||!I.name||I.type!==r.DefinitionEntity)throw new Error(`${b}${b}Invalid input "${Ve(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"Storage")}" (\`${Be(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const A=ul(I==null?void 0:I.id,((u=m.branchHead)==null?void 0:u.identifier)||"main"),x=n.find(H=>{var Y,ie;return((ie=(Y=H.valueOwner)==null?void 0:Y.declaration)==null?void 0:ie.id)===G.operation[Ye.GetUploadPartPresignedUrl].inputs.key.id}),P=(e=x==null?void 0:x.value)==null?void 0:e.value;if(!P||P==="")throw new Error(`${b}The "${Ve(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"key")}\`) input is missing.`);if(typeof P!="string")throw new Error(`${b}The "${Ve(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const O=n.find(H=>{var Y,ie;return((ie=(Y=H.valueOwner)==null?void 0:Y.declaration)==null?void 0:ie.id)===G.operation[Ye.GetUploadPartPresignedUrl].inputs.uploadId.id}),$=(f=O==null?void 0:O.value)==null?void 0:f.value;if(!$||$==="")throw new Error(`${b}The "${Ve(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"Upload ID")}" (\`${Be(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"uploadId")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${b}The "${Ve(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"Upload ID")}" (\`${Be(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"uploadId")}\`) input value is invalid, if present, it must be a non-empty string.`);const U=n.find(H=>{var Y,ie;return((ie=(Y=H.valueOwner)==null?void 0:Y.declaration)==null?void 0:ie.id)===G.operation[Ye.GetUploadPartPresignedUrl].inputs.partNumber.id}),Z=Number((y=U==null?void 0:U.value)==null?void 0:y.value);if(isNaN(Z)||Z<=0)throw new Error(`${b}The "${Ve(U==null?void 0:U.valueOwner,m==null?void 0:m.logic,"Part number")}" (\`${Be(U==null?void 0:U.valueOwner,m==null?void 0:m.logic,"partNumber")}\`) input is missing or invalid.`);const j=await Ht.get(`${m.env.API_BASE_URL}/cloud-files-service/v1/files/multipart/${$}?bucket=${A}&key=${encodeURIComponent(P)}&partNumber=${Z}`,{headers:{Authorization:`Bearer ${await m.getAccessToken()}`}});return{value:K.Success,error:null,result:j.data}}catch(m){return{value:K.UnhandledError,error:m,result:null}}}})}}class pDt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_COMPLETE_MULTIPART_UPLOAD,version:"1.0.0",description:"Cloud File System: Complete Multipart Upload",initPriority:_e.High,permissions:[$e.All],contexts:[te.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===te.Logic);if(!n)return;const s=n.get(Ye.CompleteMultipartUpload);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"completeMultipartUpload"),b="["+Ve(t,t.project,"Complete multipart upload")+": `"+T+"`] ",R=n.find(Y=>{var ie,W;return((W=(ie=Y.valueOwner)==null?void 0:ie.declaration)==null?void 0:W.id)===G.operation[Ye.CompleteMultipartUpload].inputs.bucket.id}),I=(s=R==null?void 0:R.value)==null?void 0:s.valueAsType;if(!I||!I.id||!I.name||I.type!==r.DefinitionEntity)throw new Error(`${b}Invalid input "${Ve(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"Storage")}" (\`${Be(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const A=ul(I==null?void 0:I.id,((u=m.branchHead)==null?void 0:u.identifier)||"main"),x=n.find(Y=>{var ie,W;return((W=(ie=Y.valueOwner)==null?void 0:ie.declaration)==null?void 0:W.id)===G.operation[Ye.CompleteMultipartUpload].inputs.key.id}),P=(e=x==null?void 0:x.value)==null?void 0:e.value;if(!P||P==="")throw new Error(`${b}The "${Ve(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"key")}\`) input is missing.`);if(typeof P!="string")throw new Error(`${b}The "${Ve(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const O=n.find(Y=>{var ie,W;return((W=(ie=Y.valueOwner)==null?void 0:ie.declaration)==null?void 0:W.id)===G.operation[Ye.CompleteMultipartUpload].inputs.uploadId.id}),$=(f=O==null?void 0:O.value)==null?void 0:f.value;if(!$||$==="")throw new Error(`${b}The "${Ve(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"Upload ID")}" (\`${Be(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"uploadId")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${b}The "${Ve(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"Upload ID")}" (\`${Be(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"uploadId")}\`) input value is invalid, if present, it must be a non-empty string.`);const U=n.find(Y=>{var ie,W;return((W=(ie=Y.valueOwner)==null?void 0:ie.declaration)==null?void 0:W.id)===G.operation[Ye.CompleteMultipartUpload].inputs.parts.id}),Z=(y=U==null?void 0:U.value)==null?void 0:y.value;if(!Array.isArray(Z)||Z.length===0)throw new Error(`${b}The "${Ve(U==null?void 0:U.valueOwner,m==null?void 0:m.logic,"Parts")}" (\`${Be(U==null?void 0:U.valueOwner,m==null?void 0:m.logic,"parts")}\`) input is missing or empty.`);if(Z.some(Y=>{let ie=!1,W=!1;return(Y.partNumber&&Number(Y.partNumber)>0||Y.PartNumber&&Number(Y.PartNumber)>0)&&(ie=!0),(Y.etag&&typeof Y.etag=="string"||Y.ETag&&typeof Y.ETag=="string")&&(W=!0),!ie||!W}))throw new Error(`${b}The "${Ve(U==null?void 0:U.valueOwner,m==null?void 0:m.logic,"Parts")}" (\`${Be(U==null?void 0:U.valueOwner,m==null?void 0:m.logic,"parts")}\`) input value is invalid, if present, it must be an array of objects with "partNumber" and "etag" properties.`);const H=(await Ht.post(`${m.env.API_BASE_URL}/cloud-files-service/v1/files/multipart/${$}/complete?bucket=${A}&key=${encodeURIComponent(P)}`,{parts:Z},{headers:{Authorization:`Bearer ${await m.getAccessToken()}`}})).data||{};return{value:K.Success,error:null,result:{location:H.location||H.Location||P,key:H.key||H.Key||P,etag:H.etag||H.ETag||null}}}catch(m){return{value:K.UnhandledError,error:m,result:null}}}})}}class uDt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_ABORT_MULTIPART_UPLOAD,version:"1.0.0",description:"Cloud File System: Abort Multipart Upload",initPriority:_e.High,permissions:[$e.All],contexts:[te.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===te.Logic);if(!n)return;const s=n.get(Ye.AbortMultipartUpload);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f;try{const y=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!y||!y.env)throw new Error("Editor context or environment missing");const m=Be(t,t.project,"abortMultipartUpload"),g="["+Ve(t,t.project,"Abort multipart upload")+": `"+m+"`] ",b=n.find(Z=>{var j,H;return((H=(j=Z.valueOwner)==null?void 0:j.declaration)==null?void 0:H.id)===G.operation[Ye.AbortMultipartUpload].inputs.bucket.id}),R=(s=b==null?void 0:b.value)==null?void 0:s.valueAsType;if(!R||!R.id||!R.name||R.type!==r.DefinitionEntity)throw new Error(`${g}Invalid input "${Ve(b==null?void 0:b.valueOwner,y==null?void 0:y.logic,"Storage")}" (\`${Be(b==null?void 0:b.valueOwner,y==null?void 0:y.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const I=ul(R==null?void 0:R.id,((u=y.branchHead)==null?void 0:u.identifier)||"main"),A=n.find(Z=>{var j,H;return((H=(j=Z.valueOwner)==null?void 0:j.declaration)==null?void 0:H.id)===G.operation[Ye.AbortMultipartUpload].inputs.key.id}),x=(e=A==null?void 0:A.value)==null?void 0:e.value;if(!x||x==="")throw new Error(`${g}The "${Ve(A==null?void 0:A.valueOwner,y==null?void 0:y.logic,"Key")}" (\`${Be(A==null?void 0:A.valueOwner,y==null?void 0:y.logic,"key")}\`) input is missing.`);if(typeof x!="string")throw new Error(`${g}The "${Ve(A==null?void 0:A.valueOwner,y==null?void 0:y.logic,"Key")}" (\`${Be(A==null?void 0:A.valueOwner,y==null?void 0:y.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const P=n.find(Z=>{var j,H;return((H=(j=Z.valueOwner)==null?void 0:j.declaration)==null?void 0:H.id)===G.operation[Ye.AbortMultipartUpload].inputs.uploadId.id}),O=(f=P==null?void 0:P.value)==null?void 0:f.value;if(!O||O==="")throw new Error(`${g}The "${Ve(P==null?void 0:P.valueOwner,y==null?void 0:y.logic,"Upload ID")}" (\`${Be(P==null?void 0:P.valueOwner,y==null?void 0:y.logic,"uploadId")}\`) input is missing.`);if(typeof O!="string")throw new Error(`${g}The "${Ve(P==null?void 0:P.valueOwner,y==null?void 0:y.logic,"Upload ID")}" (\`${Be(P==null?void 0:P.valueOwner,y==null?void 0:y.logic,"uploadId")}\`) input value is invalid, if present, it must be a non-empty string.`);const U=(await Ht.delete(`${y.env.API_BASE_URL}/cloud-files-service/v1/files/multipart/${O}?bucket=${I}&key=${encodeURIComponent(x)}`,{headers:{Authorization:`Bearer ${await y.getAccessToken()}`}})).data;return{value:K.Success,error:null,result:null}}catch(y){return{value:K.UnhandledError,error:y,result:null}}}})}}class HRn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_UPLOAD_FILE_PART,version:"1.0.0",description:"Cloud File System: Upload File Part",initPriority:_e.High,permissions:[$e.All],contexts:[te.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===te.Logic);if(!n)return;const s=n.get(Ye.UploadFilePart);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b;try{const R=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!R||!R.env)throw new Error("Editor context or environment missing");const I=Be(t,t.project,"uploadFilePart"),x="["+Ve(t,t.project,"Upload file part")+": `"+I+"`] ",P=n.find(oe=>{var ce,be;return((be=(ce=oe.valueOwner)==null?void 0:ce.declaration)==null?void 0:be.id)===G.operation[Ye.UploadFilePart].inputs.bucket.id}),O=(s=P==null?void 0:P.value)==null?void 0:s.valueAsType;if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${x}Invalid input "${Ve(P==null?void 0:P.valueOwner,R==null?void 0:R.logic,"Storage")}" (\`${Be(P==null?void 0:P.valueOwner,R==null?void 0:R.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const $=ul(O==null?void 0:O.id,((u=R.branchHead)==null?void 0:u.identifier)||"main");if(!((R==null?void 0:R.liveResources)||[]).find(oe=>oe.resourceId===$))throw new Error(`${x}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const Z=n.find(oe=>{var ce,be;return((be=(ce=oe.valueOwner)==null?void 0:ce.declaration)==null?void 0:be.id)===G.operation[Ye.UploadFilePart].inputs.key.id}),j=(e=Z==null?void 0:Z.value)==null?void 0:e.value;if(!j||j==="")throw new Error(`${x}The "${Ve(Z==null?void 0:Z.valueOwner,R==null?void 0:R.logic,"Key")}" (\`${Be(Z==null?void 0:Z.valueOwner,R==null?void 0:R.logic,"key")}\`) input is missing.`);if(typeof j!="string")throw new Error(`${x}The "${Ve(Z==null?void 0:Z.valueOwner,R==null?void 0:R.logic,"Key")}" (\`${Be(Z==null?void 0:Z.valueOwner,R==null?void 0:R.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const H=n.find(oe=>{var ce,be;return((be=(ce=oe.valueOwner)==null?void 0:ce.declaration)==null?void 0:be.id)===G.operation[Ye.UploadFilePart].inputs.uploadId.id}),Y=(f=H==null?void 0:H.value)==null?void 0:f.value;if(!Y||Y==="")throw new Error(`${x}The "${Ve(H==null?void 0:H.valueOwner,R==null?void 0:R.logic,"Upload ID")}" (\`${Be(H==null?void 0:H.valueOwner,R==null?void 0:R.logic,"uploadId")}\`) input is missing.`);if(typeof Y!="string")throw new Error(`${x}The "${Ve(H==null?void 0:H.valueOwner,R==null?void 0:R.logic,"Upload ID")}" (\`${Be(H==null?void 0:H.valueOwner,R==null?void 0:R.logic,"uploadId")}\`) input value is invalid, if present, it must be a non-empty string.`);const ie=n.find(oe=>{var ce,be;return((be=(ce=oe.valueOwner)==null?void 0:ce.declaration)==null?void 0:be.id)===G.operation[Ye.UploadFilePart].inputs.partNumber.id}),W=Number((y=ie==null?void 0:ie.value)==null?void 0:y.value);if(((m=ie==null?void 0:ie.value)==null?void 0:m.value)===void 0||((T=ie==null?void 0:ie.value)==null?void 0:T.value)===null||isNaN(W)||W<=0)throw new Error(`${x}The "${Ve(ie==null?void 0:ie.valueOwner,R==null?void 0:R.logic,"Part number")}" (\`${Be(ie==null?void 0:ie.valueOwner,R==null?void 0:R.logic,"partNumber")}\`) input is missing or invalid.`);const z=n.find(oe=>{var ce,be;return((be=(ce=oe.valueOwner)==null?void 0:ce.declaration)==null?void 0:be.id)===G.operation[Ye.UploadFilePart].inputs.bytes.id}),J=(g=z==null?void 0:z.value)==null?void 0:g.value;if(J==null)throw new Error(`${x}The "${Ve(z==null?void 0:z.valueOwner,R==null?void 0:R.logic,"Bytes")}" (\`${Be(z==null?void 0:z.valueOwner,R==null?void 0:R.logic,"bytes")}\`) input is missing.`);const Q=(b=(await Ht.get(`${R.env.API_BASE_URL}/cloud-files-service/v1/files/multipart/${Y}?bucket=${$}&key=${encodeURIComponent(j)}&partNumber=${W}`,{headers:{Authorization:`Bearer ${await R.getAccessToken()}`}})).data)==null?void 0:b.uploadUrl;if(!Q)throw new Error(`${x}Failed to obtain presigned upload URL for part ${W}.`);const re=await Ht.put(Q,J,{headers:{"Content-Type":"application/octet-stream"}}),ae=re.headers.etag||re.headers.ETag||"",le=typeof ae=="string"?ae.replace(/"/g,""):"";return{value:K.Success,error:null,result:{partNumber:W,etag:le}}}catch(R){return{value:K.UnhandledError,error:R,result:null}}}})}}function t2(a){return a.subcommands?Array.isArray(a.subcommands)?a.subcommands:Object.values(a.subcommands):[]}function cDt(a){if(!a.subcommands)return{};if(Array.isArray(a.subcommands)){const t={};for(const n of a.subcommands)t[n.name.toLowerCase()]=n;return t}const p={};for(const[t,n]of Object.entries(a.subcommands))p[t.toLowerCase()]=n;return p}function GR(a,p,t,n,s){const u={};for(const e of t)e.id&&(u[e.id]=e),e.type&&(u[e.type]=e);return{context:s,project:s,confirmedParts:t,partsMap:u,activeSegmentText:n,activeCommand:a,activeSubcommand:p,getPartValue:e=>{const f=t.find(y=>y.id===e||y.type===e);return f?f.value:void 0},getPart:e=>t.find(f=>f.id===e||f.type===e)}}function WRn(a,p,t,n){if(!a){const Z=t.startsWith("/"),j=GR(null,null,p,t,n);return{activeCommand:null,activeSubcommand:null,currentStep:null,stepIndex:0,isComplete:!1,placeholder:Z?"Type command...":"How can I help you today?",ghostHint:void 0,allowFreeText:!0,stage:Z?"command":"normal",context:j}}const s=cDt(a),u=Object.keys(s).length>0,e=p.slice(1);let f=null,y=e;if(u){if(e.length===0){const j=t2(a)[0],H="Select Category",Y=`Type category (e.g. ${(j==null?void 0:j.name)||"node"})...`,ie=GR(a,null,p,t,n);return{activeCommand:a,activeSubcommand:null,currentStep:{id:"subcommand",type:"subcommand",label:"Category",placeholder:Y,ghostHint:H,required:!0,allowFreeText:!1,getOptions:async W=>{const z=t2(a),J=W.trim().toLowerCase();return z.filter(ee=>{var Q,re;return!J||ee.name.toLowerCase().includes(J)||((Q=ee.description)==null?void 0:Q.toLowerCase().includes(J))||((re=ee.label)==null?void 0:re.toLowerCase().includes(J))}).map(ee=>({id:ee.name,label:ee.label||ee.name,sublabel:ee.description,categoryTag:ee.category||"Subcommand",icon:ee.icon,namedColor:ee.namedColor}))},resolvePart:(W,z,J)=>{const ee=typeof W=="string"?W:W.id||W.name,Q=typeof W=="string"?W:W.label||W.name||ee;return{index:J,type:"subcommand",label:Q,value:ee,namedColor:"purple"}}},stepIndex:0,isComplete:!1,placeholder:Y,ghostHint:H,allowFreeText:!1,stage:"subcommand",context:ie}}const Z=e[0].value.toLowerCase();if(f=s[Z]||null,!f){const j=GR(a,null,p,t,n);return{activeCommand:a,activeSubcommand:null,currentStep:null,stepIndex:0,isComplete:!1,placeholder:"Unknown category",ghostHint:void 0,allowFreeText:!1,stage:"subcommand",context:j}}y=e.slice(1)}const m=f||a,T=GR(a,f,p,t,n);if(typeof m.getNextStep=="function"){const Z=m.getNextStep(T);if(!Z)return{activeCommand:a,activeSubcommand:f,currentStep:null,stepIndex:y.length,isComplete:!0,placeholder:"Press Enter to execute",ghostHint:void 0,allowFreeText:!1,stage:"args",context:T};const j=typeof Z.required=="function"?Z.required(T):Z.required!==!1,H=typeof Z.allowFreeText=="function"?Z.allowFreeText(T):Z.allowFreeText??Z.type==="argument";let Y="args";Z.type==="option"?Y="option":Z.type==="subcommand"?Y="subcommand":Z.type==="argument"&&(Y="args");const ie=typeof Z.placeholder=="function"?Z.placeholder(T):Z.placeholder||(Z.type==="option"?`Search ${Z.label.toLowerCase()}...`:j?`Enter ${Z.label.toLowerCase()}...`:`Enter ${Z.label.toLowerCase()} (optional, or press Enter)...`),W=typeof Z.ghostHint=="function"?Z.ghostHint(T):Z.ghostHint;return{activeCommand:a,activeSubcommand:f,currentStep:Z,stepIndex:y.length,isComplete:!j,placeholder:ie,ghostHint:W,allowFreeText:H,stage:Y,context:T}}const b=(typeof m.steps=="function"?m.steps(T):m.steps||[]).filter(Z=>typeof Z.isEnabled=="function"?Z.isEnabled(T):!0);if(b.length===0)return{activeCommand:a,activeSubcommand:f,currentStep:null,stepIndex:0,isComplete:!0,placeholder:"Press Enter to execute",ghostHint:void 0,allowFreeText:!1,stage:"args",context:T};const R=y.length;if(R>=b.length)return{activeCommand:a,activeSubcommand:f,currentStep:null,stepIndex:R,isComplete:!0,placeholder:"Press Enter to execute",ghostHint:void 0,allowFreeText:!1,stage:"args",context:T};const I=b[R],A=typeof I.required=="function"?I.required(T):I.required!==!1,x=typeof I.allowFreeText=="function"?I.allowFreeText(T):I.allowFreeText??I.type==="argument";let P="args";I.type==="option"?P="option":I.type==="subcommand"?P="subcommand":I.type==="argument"&&(P="args");const O=typeof I.placeholder=="function"?I.placeholder(T):I.placeholder||(I.type==="option"?`Search ${I.label.toLowerCase()}...`:A?`Enter ${I.label.toLowerCase()}...`:`Enter ${I.label.toLowerCase()} (optional, or press Enter)...`),$=typeof I.ghostHint=="function"?I.ghostHint(T):I.ghostHint;return{activeCommand:a,activeSubcommand:f,currentStep:I,stepIndex:R,isComplete:!A,placeholder:O,ghostHint:$,allowFreeText:x,stage:P,context:T}}class Rg{constructor(p,t){C(this,"step",{required:!0,allowFreeText:!1});this.step.id=p,this.step.label=t,this.step.type="argument"}static option(p,t){const n=new Rg(p,t);return n.step.type="option",n.step.allowFreeText=!1,n}static argument(p,t){const n=new Rg(p,t);return n.step.type="argument",n.step.allowFreeText=!0,n}static custom(p,t){const n=new Rg(p,t);return n.step.type="custom",n}setType(p){return this.step.type=p,this}setPlaceholder(p){return this.step.placeholder=p,this}setGhostHint(p){return this.step.ghostHint=p,this}setRequired(p){return this.step.required=p,this}setAllowFreeText(p){return this.step.allowFreeText=p,this}when(p){return this.step.isEnabled=p,this}setOptions(p){return this.step.getOptions=p,this}setPartResolver(p){return this.step.resolvePart=p,this}setValidator(p){return this.step.validatePart=p,this}onConfirmed(p){return this.step.onConfirmed=p,this}build(){if(!this.step.id||!this.step.label||!this.step.type)throw new Error("StepBuilder requires id, label, and type");return this.step.resolvePart||(this.step.resolvePart=(p,t,n)=>{const s=typeof p=="object"&&p!==null,u=s?p.label||p.name||p.id:String(p),e=s?p.id||p.value||u:String(p);return{index:n,type:this.step.type||"argument",label:u,value:e}}),this.step}}class sx{constructor(p){C(this,"cmd",{});C(this,"staticSteps",[]);C(this,"subcommandsMap",{});this.cmd.name=p}static create(p){return new sx(p)}setLabel(p){return this.cmd.label=p,this}setDescription(p){return this.cmd.description=p,this}setCategory(p){return this.cmd.category=p,this}setIcon(p){return this.cmd.icon=p,this}setNamedColor(p){return this.cmd.namedColor=p,this}addSubcommand(p,t){const n=t instanceof sx?t.build():t;return this.subcommandsMap[p.toLowerCase()]=n,this}setSubcommands(p){return this.cmd.subcommands=p,this}addStep(p){const t=p instanceof Rg?p.build():p;return this.staticSteps.push(t),this}setSteps(p){return this.cmd.steps=p,this}setNextStepResolver(p){return this.cmd.getNextStep=p,this}onPartConfirmed(p){return this.cmd.onPartConfirmed=p,this}onPartRemoved(p){return this.cmd.onPartRemoved=p,this}setValidator(p){return this.cmd.validate=p,this}setBeforeSubmit(p){return this.cmd.beforeSubmit=p,this}setExecutor(p){return this.cmd.execute=p,this}build(){if(!this.cmd.name)throw new Error("CommandBuilder requires a command name");return Object.keys(this.subcommandsMap).length>0&&(this.cmd.subcommands=this.subcommandsMap),this.staticSteps.length>0&&!this.cmd.steps&&!this.cmd.getNextStep&&(this.cmd.steps=this.staticSteps),this.cmd}}function zRn(a){return a}function YRn(a){return a}class i2 extends hV{constructor(p,t,n=t.projectId){super(p,te.Editor),this._editor=t,this.id=n}get ready(){return this._editor.ready}get env(){return this._editor.env}get hasLoadedLogic(){return this._editor.hasLoadedLogic}get destroyed(){return this._editor.destroyed}get logicLoadingPromise(){return this._editor.logicLoadingPromise}get logic(){return this._editor.logic}get lastPublishedProjectState(){return this._editor.lastPublishedProjectState}get branchHead(){return this._editor.branchHead}get branchHeadPromise(){return this._editor.branchHeadPromise}get projectId(){return this._editor.projectId}get sessionId(){return this._editor.sessionId}get userAuthorId(){return this._editor.userAuthorId}get peerConnections(){return this._editor.peerConnections}get test(){return this._editor.test}get localTestValues(){return this._editor.localTestValues}get resolvedValues(){return this._editor.resolvedValues}get persistedExecutionResults(){return this._editor.persistedExecutionResults}get publication(){return this._editor.publication}get livePublishedVersions(){return this._editor.livePublishedVersions}get publications(){return this._editor.publications}get liveResources(){return this._editor.liveResources}get execution(){return this._editor.execution}get project(){return this._editor.logic}get lastExecutionResults(){return this._editor.lastExecutionResults}get undoableStackValueIndex(){return this._editor.undoableStackValueIndex}set undoableStackValueIndex(p){this._editor.undoableStackValueIndex=p}get activeWorkspace(){return this._editor.activeWorkspace}get branches(){return this._editor.branches}get roles(){return this._editor.roles}get READ_ONLY(){return this._editor.READ_ONLY}get isViewingNonHead(){return this._editor.isViewingNonHead}get canEdit(){return this._editor.canEdit}get PROJECT_NOTIFICATIONS_CHANNEL(){return this._editor.PROJECT_NOTIFICATIONS_CHANNEL}getAccessToken(){return this._editor.getAccessToken()}getRefreshToken(){return this._editor.getRefreshToken()}removeValueByOwnerId(p){return this._editor.removeValueByOwnerId(p)}removeValue(p){return this._editor.removeValue(p)}undo(){return this._editor.undo()}redo(){return this._editor.redo()}initTest(p,t){return this._editor.initTest(p,t)}removeTest(p){return this._editor.removeTest(p)}async copyEntities(p,t={}){return this._editor.copyEntities(p,t)}resolveInitialChildrenPositions(p,t,n){return this._editor.resolveInitialChildrenPositions(p,t,n)}publish(p){return this._editor.publish(p)}loadGivenPublication(p){return this._editor.loadGivenPublication(p)}validateProjectState(p){return this._editor.validateProjectState(p)}requestActiveDynamicValue(p,t=!1){return this._editor.requestActiveDynamicValue(p,t)}getValueTypePreference(p){return this._editor.getValueTypePreference(p)}setValueTypePreference(p,t){return this._editor.setValueTypePreference(p,t)}implementFeature(p){return this._editor.implementFeature(p)}getProjectRoles(){return this._editor.getProjectRoles()}getLastPublishedVersionLogic(p){return this._editor.getLastPublishedVersionLogic(p)}initialLoads(p){return this._editor.initialLoads(p)}moveBranchHeadToVersion(p,t,n){return this._editor.moveBranchHeadToVersion(p,t,n)}loadInitialBranchHead(){return this._editor.loadInitialBranchHead()}}function JRn(a,p){return p instanceof i2?p:new i2(a,p)}class n2 extends hV{constructor(p,t){super(p,te.PublicationRun),this._publicationRun=t}get id(){return this._publicationRun.id}get projectAutoIncrementPublicationCount(){return this._publicationRun.projectAutoIncrementPublicationCount}get projectPublishedSemanticVersion(){return this._publicationRun.projectPublishedSemanticVersion}get envIdentifier(){return this._publicationRun.envIdentifier}get projectVersion(){return this._publicationRun.projectVersion}get projectBranchId(){return this._publicationRun.projectBranchId}get projectId(){return this._publicationRun.projectId}get triggeredBy(){return this._publicationRun.triggeredBy}get createdAt(){return this._publicationRun.createdAt}get updatedAt(){return this._publicationRun.updatedAt}get status(){return this._publicationRun.status}get steps(){return this._publicationRun.steps}get cleanupSteps(){return this._publicationRun.cleanupSteps}get editor(){return this._publicationRun.editor}get explicitResources(){return this._publicationRun.explicitResources}get implicitGlobalResources(){return this._publicationRun.implicitGlobalResources}get finalGlobalEvent(){return this._publicationRun.finalGlobalEvent}get finalStatus(){return this._publicationRun.finalStatus}}function QRn(a,p){return p instanceof n2?p:new n2(a,p)}const QG={spec:{title:"Sales Overview",basicChart:{chartType:"COLUMN",legendPosition:"BOTTOM_LEGEND",axis:[{position:"BOTTOM_AXIS",title:"Categories"},{position:"LEFT_AXIS",title:"Values"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"LEFT_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}},XRn={spec:{title:"Revenue Comparison",basicChart:{chartType:"BAR",legendPosition:"BOTTOM_LEGEND",axis:[{position:"LEFT_AXIS",title:"Products"},{position:"BOTTOM_AXIS",title:"Revenue ($)"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"BOTTOM_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}},eAn={spec:{title:"Monthly Performance Trend",basicChart:{chartType:"LINE",legendPosition:"RIGHT_LEGEND",interpolateNulls:!0,axis:[{position:"BOTTOM_AXIS",title:"Month"},{position:"LEFT_AXIS",title:"Active Users"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:12,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:12,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"LEFT_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}},tAn={spec:{title:"Traffic Channels Distribution",basicChart:{chartType:"AREA",legendPosition:"TOP_LEGEND",stackedType:"STACKED",axis:[{position:"BOTTOM_AXIS",title:"Quarter"},{position:"LEFT_AXIS",title:"Visits"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:4,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:4,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"LEFT_AXIS"},{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:4,startColumnIndex:2,endColumnIndex:3}]}},targetAxis:"LEFT_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}},iAn={spec:{title:"Market Share Breakdown",pieChart:{legendPosition:"RIGHT_LEGEND",threeDimensional:!1,pieHole:0,domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:0,endColumnIndex:1}]}},series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:1,endColumnIndex:2}]}}}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:500,heightPixels:350}}},nAn={spec:{title:"Budget Allocation",pieChart:{legendPosition:"BOTTOM_LEGEND",threeDimensional:!1,pieHole:.4,domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:6,startColumnIndex:0,endColumnIndex:1}]}},series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:6,startColumnIndex:1,endColumnIndex:2}]}}}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:500,heightPixels:350}}},rAn={spec:{title:"Quarterly Revenue KPI",scorecardChart:{keyValueData:{sourceRange:{sources:[{sheetId:0,startRowIndex:1,endRowIndex:2,startColumnIndex:1,endColumnIndex:2}]}},baselineValueData:{sourceRange:{sources:[{sheetId:0,startRowIndex:2,endRowIndex:3,startColumnIndex:1,endColumnIndex:2}]}}}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:400,heightPixels:250}}},aAn={spec:{title:"Regional Sales (3D)",basicChart:{chartType:"BAR",legendPosition:"RIGHT_LEGEND",headerCount:1,threeDimensional:!0,axis:[{position:"LEFT_AXIS",title:"Region"},{position:"BOTTOM_AXIS",title:"Units Sold"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"BOTTOM_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}};class sAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][X.GoogleSheetsAddChart].inputs.chart.id,version:"1.0.0",description:'Gives options for and generates useful example values for the chart input of the "Add chart" Google Sheets operation',initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{getOptions:async t=>[{key:"column-chart",label:"Column Chart",disabledReasons:[],hidden:!1},{key:"bar-chart",label:"Bar Chart",disabledReasons:[],hidden:!1},{key:"line-chart",label:"Line Chart",disabledReasons:[],hidden:!1},{key:"area-chart",label:"Stacked Area Chart",disabledReasons:[],hidden:!1},{key:"pie-chart",label:"Pie Chart",disabledReasons:[],hidden:!1},{key:"donut-chart",label:"Donut Chart",disabledReasons:[],hidden:!1},{key:"scorecard-chart",label:"Scorecard KPI Chart",disabledReasons:[],hidden:!1},{key:"3d-bar-chart",label:"3D Bar Chart",disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{const s=n==null?void 0:n.valueKey;if(!s)return{value:QG};switch(s){case"column-chart":case"basic-chart":return{value:QG};case"bar-chart":return{value:XRn};case"line-chart":return{value:eAn};case"area-chart":return{value:tAn};case"pie-chart":return{value:iAn};case"donut-chart":return{value:nAn};case"scorecard-chart":return{value:rAn};case"3d-bar-chart":case"3d-column-chart":return{value:aAn}}return{value:QG}}})}}const XG={spec:{title:"Sales Overview",basicChart:{chartType:"COLUMN",legendPosition:"BOTTOM_LEGEND",axis:[{position:"BOTTOM_AXIS",title:"Categories"},{position:"LEFT_AXIS",title:"Values"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"LEFT_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}},lAn={spec:{title:"Revenue Comparison",basicChart:{chartType:"BAR",legendPosition:"BOTTOM_LEGEND",axis:[{position:"LEFT_AXIS",title:"Products"},{position:"BOTTOM_AXIS",title:"Revenue ($)"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"BOTTOM_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}},oAn={spec:{title:"Monthly Performance Trend",basicChart:{chartType:"LINE",legendPosition:"RIGHT_LEGEND",interpolateNulls:!0,axis:[{position:"BOTTOM_AXIS",title:"Month"},{position:"LEFT_AXIS",title:"Active Users"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:12,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:12,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"LEFT_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}},dAn={spec:{title:"Traffic Channels Distribution",basicChart:{chartType:"AREA",legendPosition:"TOP_LEGEND",stackedType:"STACKED",axis:[{position:"BOTTOM_AXIS",title:"Quarter"},{position:"LEFT_AXIS",title:"Visits"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:4,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:4,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"LEFT_AXIS"},{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:4,startColumnIndex:2,endColumnIndex:3}]}},targetAxis:"LEFT_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}},pAn={spec:{title:"Market Share Breakdown",pieChart:{legendPosition:"RIGHT_LEGEND",threeDimensional:!1,pieHole:0,domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:0,endColumnIndex:1}]}},series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:1,endColumnIndex:2}]}}}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:500,heightPixels:350}}},uAn={spec:{title:"Budget Allocation",pieChart:{legendPosition:"BOTTOM_LEGEND",threeDimensional:!1,pieHole:.4,domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:6,startColumnIndex:0,endColumnIndex:1}]}},series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:6,startColumnIndex:1,endColumnIndex:2}]}}}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:500,heightPixels:350}}},cAn={spec:{title:"Quarterly Revenue KPI",scorecardChart:{keyValueData:{sourceRange:{sources:[{sheetId:0,startRowIndex:1,endRowIndex:2,startColumnIndex:1,endColumnIndex:2}]}},baselineValueData:{sourceRange:{sources:[{sheetId:0,startRowIndex:2,endRowIndex:3,startColumnIndex:1,endColumnIndex:2}]}}}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:400,heightPixels:250}}},fAn={spec:{title:"Regional Sales (3D)",basicChart:{chartType:"BAR",legendPosition:"RIGHT_LEGEND",headerCount:1,threeDimensional:!0,axis:[{position:"LEFT_AXIS",title:"Region"},{position:"BOTTOM_AXIS",title:"Units Sold"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"BOTTOM_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}};class yAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][X.GoogleSheetsUpdateChartSpec].inputs.chart.id,version:"1.0.0",description:'Gives options for and generates useful example values for the chart input of the "Update chart spec" Google Sheets operation',initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{getOptions:async t=>[{key:"column-chart",label:"Column Chart",disabledReasons:[],hidden:!1},{key:"bar-chart",label:"Bar Chart",disabledReasons:[],hidden:!1},{key:"line-chart",label:"Line Chart",disabledReasons:[],hidden:!1},{key:"area-chart",label:"Stacked Area Chart",disabledReasons:[],hidden:!1},{key:"pie-chart",label:"Pie Chart",disabledReasons:[],hidden:!1},{key:"donut-chart",label:"Donut Chart",disabledReasons:[],hidden:!1},{key:"scorecard-chart",label:"Scorecard KPI Chart",disabledReasons:[],hidden:!1},{key:"3d-bar-chart",label:"3D Bar Chart",disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{const s=n==null?void 0:n.valueKey;if(!s)return{value:XG};switch(s){case"column-chart":case"basic-chart":return{value:XG};case"bar-chart":return{value:lAn};case"line-chart":return{value:oAn};case"area-chart":return{value:dAn};case"pie-chart":return{value:pAn};case"donut-chart":return{value:uAn};case"scorecard-chart":return{value:cAn};case"3d-bar-chart":case"3d-column-chart":return{value:fAn}}return{value:XG}}})}}const hAn="Sheet2!A1",mAn='"Copy of Blahhh"!A1';class TAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][X.GoogleSheetsCreatePivotTable].inputs.destination.id,version:"1.0.0",description:'Gives options for and generates useful example values for the destination input of the "Create pivot table" Google Sheets operation',initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{getOptions:async t=>[{key:"sheet2-a1",label:"Sheet2!A1",disabledReasons:[],hidden:!1},{key:"copy-of-blahhh-a1",label:'"Copy of Blahhh"!A1',disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{switch(n==null?void 0:n.valueKey){case"copy-of-blahhh-a1":return{value:mAn};case"sheet2-a1":default:return{value:hAn}}}})}}const vAn="Sheet1!A1:D100",gAn="Sheet1!A1:G500";class bAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][X.GoogleSheetsCreatePivotTable].inputs.source.id,version:"1.0.0",description:'Gives options for and generates useful example values for the source input of the "Create pivot table" Google Sheets operation',initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{getOptions:async t=>[{key:"sales-data",label:"Sales Data Range (Sheet1!A1:D100)",disabledReasons:[],hidden:!1},{key:"financial-data",label:"Financial Data Range (Sheet1!A1:G500)",disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{switch(n==null?void 0:n.valueKey){case"financial-data":return{value:gAn};case"sales-data":default:return{value:vAn}}}})}}const EAn=[{sourceColumnOffset:0,sortOrder:"ASCENDING",showTotals:!0}],IAn=[{sourceColumnOffset:0,sortOrder:"ASCENDING",showTotals:!0},{sourceColumnOffset:1,sortOrder:"ASCENDING",showTotals:!0}];class RAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][X.GoogleSheetsCreatePivotTable].inputs.rows.id,version:"1.0.0",description:'Gives options for and generates useful example values for the rows input of the "Create pivot table" Google Sheets operation',initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{getOptions:async t=>[{key:"single-row-group",label:"Group by First Column (Column 0)",disabledReasons:[],hidden:!1},{key:"multi-row-group",label:"Group by First & Second Columns (Columns 0 & 1)",disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{switch(n==null?void 0:n.valueKey){case"multi-row-group":return{value:IAn};case"single-row-group":default:return{value:EAn}}}})}}const AAn=[{sourceColumnOffset:1,sortOrder:"ASCENDING",showTotals:!0}],DAn=[{sourceColumnOffset:1,sortOrder:"ASCENDING",showTotals:!0},{sourceColumnOffset:2,sortOrder:"ASCENDING",showTotals:!0}];class CAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][X.GoogleSheetsCreatePivotTable].inputs.columns.id,version:"1.0.0",description:'Gives options for and generates useful example values for the columns input of the "Create pivot table" Google Sheets operation',initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{getOptions:async t=>[{key:"single-column-group",label:"Group by Second Column (Column 1)",disabledReasons:[],hidden:!1},{key:"multi-column-group",label:"Group by Second & Third Columns (Columns 1 & 2)",disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{switch(n==null?void 0:n.valueKey){case"multi-column-group":return{value:DAn};case"single-column-group":default:return{value:AAn}}}})}}const wAn=[{sourceColumnOffset:3,summarizeFunction:"SUM",name:"Total Revenue"}],xAn=[{sourceColumnOffset:2,summarizeFunction:"COUNTA",name:"Total Orders"},{sourceColumnOffset:3,summarizeFunction:"SUM",name:"Total Revenue"}],OAn=[{sourceColumnOffset:4,summarizeFunction:"AVERAGE",name:"Average Profit"}];class PAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][X.GoogleSheetsCreatePivotTable].inputs.values.id,version:"1.0.0",description:'Gives options for and generates useful example values for the values input of the "Create pivot table" Google Sheets operation',initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{getOptions:async t=>[{key:"sum-revenue",label:"SUM Revenue (Column 3)",disabledReasons:[],hidden:!1},{key:"sum-and-count",label:"COUNTA Orders (Col 2) & SUM Revenue (Col 3)",disabledReasons:[],hidden:!1},{key:"average-profit",label:"AVERAGE Profit (Column 4)",disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{switch(n==null?void 0:n.valueKey){case"sum-and-count":return{value:xAn};case"average-profit":return{value:OAn};case"sum-revenue":default:return{value:wAn}}}})}}const VAn="Sheet2!A1",NAn='"Copy of Blahhh"!A1';class _An extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][X.GoogleSheetsDeletePivotTable].inputs.destination.id,version:"1.0.0",description:'Gives options for and generates useful example values for the destination input of the "Delete pivot table" Google Sheets operation',initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{getOptions:async t=>[{key:"sheet2-a1",label:"Sheet2!A1",disabledReasons:[],hidden:!1},{key:"copy-of-blahhh-a1",label:'"Copy of Blahhh"!A1',disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{switch(n==null?void 0:n.valueKey){case"copy-of-blahhh-a1":return{value:NAn};case"sheet2-a1":default:return{value:VAn}}}})}}const N5={"Number greater than":"NUMBER_GREATER","Number greater than or equal":"NUMBER_GREATER_THAN_EQ","Number less than":"NUMBER_LESS","Number less than or equal":"NUMBER_LESS_THAN_EQ","Number equal to":"NUMBER_EQ","Number not equal to":"NUMBER_NOT_EQ","Number between":"NUMBER_BETWEEN","Number not between":"NUMBER_NOT_BETWEEN","Text contains":"TEXT_CONTAINS","Text does not contain":"TEXT_NOT_CONTAINS","Text starts with":"TEXT_STARTS_WITH","Text ends with":"TEXT_ENDS_WITH","Text equals":"TEXT_EQ","Date is":"DATE_EQ","Date is before":"DATE_BEFORE","Date is after":"DATE_AFTER","Date is on or before":"DATE_ON_OR_BEFORE","Date is on or after":"DATE_ON_OR_AFTER","Cell is empty":"BLANK","Cell is not empty":"NOT_BLANK","Custom formula":"CUSTOM_FORMULA"};function fDt(a){if(!a||typeof a!="string")return null;const p=a.trim();return p?N5[p]?N5[p]:p.toUpperCase().replace(/\s+/g,"_"):null}function yDt(a,p,t,n){if(p==null)return;let s=[];if(Array.isArray(p))s=p;else if(typeof p=="string"){const e=p.trim();if(!e)return;if(e.startsWith("["))try{const f=JSON.parse(e);Array.isArray(f)?s=f:s=[e]}catch{s=[e]}else s=[e]}const u=fDt(a);if(u==="BLANK"||u==="NOT_BLANK"){s.length>0&&n.push(new ht({id:`${t.id}--${uo.ConditionValuesNoValuesRequired}`,message:`Condition "${a}" does not require any condition values.`,severity:Ie.Error,code:uo.ConditionValuesNoValuesRequired,entity:t}));return}if(u==="CUSTOM_FORMULA"){if(s.length===0)n.push(new ht({id:`${t.id}--${uo.ConditionValuesInvalidFormula}`,message:'Custom formula condition requires a formula string starting with "=" (e.g. ["=A1>100"]).',severity:Ie.Error,code:uo.ConditionValuesInvalidFormula,entity:t}));else for(const e of s){const f=String(e).trim();f.startsWith("=")||n.push(new ht({id:`${t.id}--${uo.ConditionValuesInvalidFormula}`,message:`Custom formula "${f}" must start with "=".`,severity:Ie.Error,code:uo.ConditionValuesInvalidFormula,entity:t}))}return}if(u==="NUMBER_BETWEEN"||u==="NUMBER_NOT_BETWEEN"){s.length!==2&&n.push(new ht({id:`${t.id}--${uo.ConditionValuesTwoNumbersRequired}`,message:`Condition "${a}" requires exactly 2 values (min and max, e.g. ["1", "100"]).`,severity:Ie.Error,code:uo.ConditionValuesTwoNumbersRequired,entity:t}));return}if(u==="NUMBER_GREATER"||u==="NUMBER_GREATER_THAN_EQ"||u==="NUMBER_LESS"||u==="NUMBER_LESS_THAN_EQ"||u==="NUMBER_EQ"||u==="NUMBER_NOT_EQ"){s.length!==1&&n.push(new ht({id:`${t.id}--${uo.ConditionValuesSingleNumberRequired}`,message:`Condition "${a}" requires exactly 1 threshold value (e.g. ["100"]).`,severity:Ie.Error,code:uo.ConditionValuesSingleNumberRequired,entity:t}));return}if(u==="TEXT_CONTAINS"||u==="TEXT_NOT_CONTAINS"||u==="TEXT_STARTS_WITH"||u==="TEXT_ENDS_WITH"||u==="TEXT_EQ"){s.length!==1&&n.push(new ht({id:`${t.id}--${uo.ConditionValuesSingleTextRequired}`,message:`Condition "${a}" requires exactly 1 text string value (e.g. ["Approved"]).`,severity:Ie.Error,code:uo.ConditionValuesSingleTextRequired,entity:t}));return}}const mw={num_100:["100"],num_0:["0"],num_1000:["1000"],between_1_100:["1","100"],between_0_50:["0","50"],between_50_100:["50","100"],text_approved:["Approved"],text_pending:["Pending"],text_rejected:["Rejected"],text_urgent:["Urgent"],date_2026_01_01:["2026-01-01"],date_today:["2026-08-08"],formula_above_avg:["=A1>AVERAGE($A$1:$A$100)"],formula_even:["=ISEVEN(A1)"],formula_duplicates:["=COUNTIF($A$1:$A$100, A1)>1"],default_100:["100"],default_approved:["Approved"],default_formula:["=A1>0"]};function K4(a){const p=fDt(a),t=(n,s)=>({key:n,label:s,disabledReasons:[],hidden:!1});return p==="NUMBER_GREATER"||p==="NUMBER_GREATER_THAN_EQ"||p==="NUMBER_LESS"||p==="NUMBER_LESS_THAN_EQ"||p==="NUMBER_EQ"||p==="NUMBER_NOT_EQ"?[t("num_100","100 (Single threshold)"),t("num_0","0 (Zero threshold)"),t("num_1000","1000 (High threshold)")]:p==="NUMBER_BETWEEN"||p==="NUMBER_NOT_BETWEEN"?[t("between_1_100","Between 1 and 100"),t("between_0_50","Between 0 and 50"),t("between_50_100","Between 50 and 100")]:p==="TEXT_CONTAINS"||p==="TEXT_NOT_CONTAINS"||p==="TEXT_STARTS_WITH"||p==="TEXT_ENDS_WITH"||p==="TEXT_EQ"?[t("text_approved","Approved"),t("text_pending","Pending"),t("text_rejected","Rejected"),t("text_urgent","Urgent")]:p==="DATE_EQ"||p==="DATE_BEFORE"||p==="DATE_AFTER"||p==="DATE_ON_OR_BEFORE"||p==="DATE_ON_OR_AFTER"?[t("date_2026_01_01","Start of 2026 (2026-01-01)"),t("date_today","Current Date (2026-08-08)")]:p==="CUSTOM_FORMULA"?[t("formula_above_avg","Greater than average (=A1>AVERAGE($A$1:$A$100))"),t("formula_even","Even numbers (=ISEVEN(A1))"),t("formula_duplicates","Highlight duplicates (=COUNTIF($A$1:$A$100, A1)>1)")]:p==="BLANK"||p==="NOT_BLANK"?[]:[t("default_100","100"),t("default_approved","Approved"),t("default_formula","Formula (=A1>0)")]}function hDt(a,p){const t=p==null?void 0:p.valueKey;if(t&&mw[t])return{value:mw[t]};const n=K4(a);if(n.length>0){const s=n[0].key;if(mw[s])return{value:mw[s]}}return{value:["100"]}}function _5(a){var u,e;const p=(u=G[r.Operation])==null?void 0:u[X.GoogleSheetsAddConditionalFormatRule];if(!p)return null;const t=a.parent;if(!t)return null;const s=(t.inputs||t.outputs||[]).find(f=>{var y;return((y=f.declaration)==null?void 0:y.id)===p.inputs.conditionType.id||f.id===p.inputs.conditionType.id});return((e=s==null?void 0:s.defaultValue)==null?void 0:e.value)??null}class $An extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][X.GoogleSheetsAddConditionalFormatRule].inputs.conditionValues.id,version:"1.0.0",description:'Gives options for and generates useful example values for conditionValues input of "Add conditional format rule" Google Sheets operation',initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{getOptions:async t=>{const n=_5(t);return K4(n)},getValue:async(t,n)=>{const s=_5(t);return hDt(s,n)}})}}function $5(a){var u,e;const p=(u=G[r.Operation])==null?void 0:u[X.GoogleSheetsUpdateConditionalFormatRule];if(!p)return null;const t=a.parent;if(!t)return null;const s=(t.inputs||t.outputs||[]).find(f=>{var y;return((y=f.declaration)==null?void 0:y.id)===p.inputs.conditionType.id||f.id===p.inputs.conditionType.id});return((e=s==null?void 0:s.defaultValue)==null?void 0:e.value)??null}class GAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][X.GoogleSheetsUpdateConditionalFormatRule].inputs.conditionValues.id,version:"1.0.0",description:'Gives options for and generates useful example values for conditionValues input of "Update conditional format rule" Google Sheets operation',initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{getOptions:async t=>{const n=$5(t);return K4(n)},getValue:async(t,n)=>{const s=$5(t);return hDt(s,n)}})}}const CV=[["Name","Age","Is Active","Notes"],["Alice",30,!0,"New user"],["Bob",25,!1,null],["Charlie",null,!0,"No age provided"]],Mp="1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms",wE={sheetId:0,startRowIndex:0,endRowIndex:10,startColumnIndex:0,endColumnIndex:5},LAn=["Sheet1!A1:B10","Sheet2!C1:D5"],BAn=["Option 1","Option 2","Option 3"],SAn=[{updateSpreadsheetProperties:{properties:{title:"My Renamed Spreadsheet",locale:"en_US",timeZone:"America/New_York"},fields:"title,locale,timeZone"}},{addSheet:{properties:{title:"New Custom Sheet",gridProperties:{rowCount:100,columnCount:20}}}},{mergeCells:{range:{sheetId:0,startRowIndex:0,endRowIndex:2,startColumnIndex:0,endColumnIndex:4},mergeType:"MERGE_ALL"}},{repeatCell:{range:{sheetId:0,startRowIndex:0,endRowIndex:1,startColumnIndex:0,endColumnIndex:5},cell:{userEnteredFormat:{backgroundColor:{red:.2,green:.4,blue:.8},textFormat:{bold:!0,foregroundColor:{red:1,green:1,blue:1}}}},fields:"userEnteredFormat(backgroundColor,textFormat)"}},{findReplace:{find:"Old Value",replacement:"New Value",allSheets:!0,matchCase:!1}}],MAn=[["Date","Product","Revenue ($)","Units Sold"],["2026-01-15","Pro Subscription",299,1],["2026-01-16","Enterprise Add-On",1250.5,2]],FAn=[["Alice Smith","alice@example.com","Engineer","Active"]],kAn=[[null]];class UAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][X.GoogleSheetsAppendRows].inputs.values.id,version:"1.0.0",description:'Gives options for and generates useful example values for the values input of the "Append rows" Google Sheets operation',initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{getOptions:async t=>[{key:"sample-users",label:"Sample User Directory (3 Rows, 4 Columns)",disabledReasons:[],hidden:!1},{key:"sales-report",label:"Sales Report (2 Rows, 4 Columns)",disabledReasons:[],hidden:!1},{key:"single-row",label:"Single Row Entry (1 Row, 4 Columns)",disabledReasons:[],hidden:!1},{key:"empty-grid",label:"Empty Placeholder (1 Row, 1 Column)",disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{switch(n==null?void 0:n.valueKey){case"sales-report":return{value:MAn};case"single-row":return{value:FAn};case"empty-grid":return{value:kAn};case"sample-users":default:return{value:CV}}}})}}const KAn=[["Date","Product","Revenue ($)","Units Sold"],["2026-01-15","Pro Subscription",299,1],["2026-01-16","Enterprise Add-On",1250.5,2]],jAn=[["Alice Smith","alice@example.com","Engineer","Active"]],qAn=[[null]];class ZAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][X.GoogleSheetsUpdateRangeValues].inputs.values.id,version:"1.0.0",description:'Gives options for and generates useful example values for the values input of the "Update range values" Google Sheets operation',initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{getOptions:async t=>[{key:"sample-users",label:"Sample User Directory (3 Rows, 4 Columns)",disabledReasons:[],hidden:!1},{key:"sales-report",label:"Sales Report (2 Rows, 4 Columns)",disabledReasons:[],hidden:!1},{key:"single-row",label:"Single Row Entry (1 Row, 4 Columns)",disabledReasons:[],hidden:!1},{key:"empty-grid",label:"Empty Placeholder (1 Row, 1 Column)",disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{switch(n==null?void 0:n.valueKey){case"sales-report":return{value:KAn};case"single-row":return{value:jAn};case"empty-grid":return{value:qAn};case"sample-users":default:return{value:CV}}}})}}function HAn(a){a.register(new bTt(a)),a.register(new gTt(a)),a.register(new hTt(a)),a.register(new TTt(a)),a.register(new vTt(a)),a.register(new mTt(a)),a.register(new eIt(a)),a.register(new tIt(a)),a.register(new iIt(a)),a.register(new rIt(a)),a.register(new nIt(a)),a.register(new aIt(a)),a.register(new qRt(a)),a.register(new ZRt(a)),a.register(new HRt(a)),a.register(new WRt(a)),a.register(new zRt(a)),a.register(new YRt(a)),a.register(new JRt(a)),a.register(new QRt(a)),a.register(new XRt(a)),a.register(new eAt(a)),a.register(new Xbt(a)),a.register(new eEt(a)),a.register(new tEt(a)),a.register(new iEt(a)),a.register(new nEt(a)),a.register(new rEt(a)),a.register(new aEt(a)),a.register(new sEt(a)),a.register(new lEt(a)),a.register(new oEt(a)),a.register(new dEt(a)),a.register(new pEt(a)),a.register(new uEt(a)),a.register(new cEt(a)),a.register(new fEt(a)),a.register(new yEt(a)),a.register(new hEt(a)),a.register(new mEt(a)),a.register(new TEt(a)),a.register(new bEt(a)),a.register(new EEt(a)),a.register(new IEt(a)),a.register(new gbt(a)),a.register(new bbt(a)),a.register(new Ebt(a)),a.register(new Ibt(a)),a.register(new Rbt(a)),a.register(new Abt(a)),a.register(new Dbt(a)),a.register(new Cbt(a)),a.register(new wbt(a)),a.register(new Obt(a)),a.register(new Pbt(a)),a.register(new Vbt(a)),a.register(new Nbt(a)),a.register(new _bt(a)),a.register(new Sgt(a)),a.register(new dRt(a)),a.register(new lRt(a)),a.register(new oRt(a)),a.register(new Bvt(a)),a.register(new Svt(a)),a.register(new Mvt(a)),a.register(new Fvt(a)),a.register(new kvt(a)),a.register(new Uvt(a)),a.register(new Kvt(a)),a.register(new jvt(a)),a.register(new qvt(a)),a.register(new rgt(a)),a.register(new Ggt(a)),a.register(new Lgt(a)),a.register(new Bgt(a)),a.register(new Zvt(a)),a.register(new Hvt(a)),a.register(new Wvt(a)),a.register(new zvt(a)),a.register(new Yvt(a)),a.register(new Jvt(a)),a.register(new Qvt(a)),a.register(new Xvt(a)),a.register(new egt(a)),a.register(new tgt(a)),a.register(new igt(a)),a.register(new ngt(a)),a.register(new agt(a)),a.register(new sgt(a)),a.register(new lgt(a)),a.register(new ogt(a)),a.register(new dgt(a)),a.register(new pgt(a)),a.register(new ugt(a)),a.register(new cgt(a)),a.register(new fgt(a)),a.register(new ygt(a)),a.register(new hgt(a)),a.register(new mgt(a)),a.register(new Dgt(a)),a.register(new Cgt(a)),a.register(new wgt(a)),a.register(new Tgt(a)),a.register(new vgt(a)),a.register(new ggt(a)),a.register(new bgt(a)),a.register(new Egt(a)),a.register(new Igt(a)),a.register(new Rgt(a)),a.register(new Agt(a)),a.register(new fRt(a)),a.register(new yRt(a)),a.register(new hRt(a)),a.register(new mRt(a)),a.register(new pRt(a)),a.register(new uRt(a)),a.register(new cRt(a)),a.register(new TRt(a)),a.register(new gRt(a)),a.register(new ERt(a)),a.register(new vRt(a)),a.register(new bRt(a)),a.register(new IRt(a)),a.register(new DRt(a)),a.register(new RRt(a)),a.register(new ARt(a)),a.register(new $bt(a)),a.register(new Sbt(a)),a.register(new Mbt(a)),a.register(new Ubt(a)),a.register(new Kbt(a)),a.register(new jbt(a)),a.register(new qbt(a)),a.register(new Zbt(a)),a.register(new Hbt(a)),a.register(new Wbt(a)),a.register(new zbt(a)),a.register(new Fbt(a)),a.register(new kbt(a)),a.register(new z1t(a)),a.register(new Y1t(a)),a.register(new J1t(a)),a.register(new Q1t(a)),a.register(new X1t(a)),a.register(new eDt(a)),a.register(new tDt(a)),a.register(new iDt(a)),a.register(new nDt(a)),a.register(new rDt(a)),a.register(new aDt(a)),a.register(new sDt(a)),a.register(new lDt(a)),a.register(new oDt(a)),a.register(new dDt(a)),a.register(new pDt(a)),a.register(new uDt(a)),a.register(new Lbt(a)),a.register(new Bbt(a)),a.register(new Gbt(a)),a.register(new xbt(a)),a.register(new Jbt(a)),a.register(new Qbt(a)),a.register(new Ybt(a)),a.register(new lIt(a)),a.register(new VIt(a)),a.register(new PIt(a)),a.register(new NIt(a)),a.register(new _It(a)),a.register(new pIt(a)),a.register(new uIt(a)),a.register(new TIt(a)),a.register(new hIt(a)),a.register(new xIt(a)),a.register(new IIt(a)),a.register(new AIt(a)),a.register(new CIt(a)),a.register(new DIt(a)),a.register(new mIt(a)),a.register(new gIt(a)),a.register(new bIt(a)),a.register(new vIt(a)),a.register(new sIt(a)),a.register(new cIt(a)),a.register(new RIt(a)),a.register(new LIt(a)),a.register(new ZL(a)),a.register(new dIt(a)),a.register(new fIt(a)),a.register(new oIt(a)),a.register(new wIt(a)),a.register(new yIt(a)),a.register(new EIt(a)),a.register(new OIt(a)),a.register(new GIt(a)),a.register(new $It(a)),a.register(new BIt(a)),a.register(new ZL(a)),a.register(new MIt(a)),a.register(new SIt(a)),a.register(new FIt(a)),a.register(new BEt(a)),a.register(new SEt(a)),a.register(new MEt(a)),a.register(new AEt(a)),a.register(new gEt(a)),a.register(new xEt(a)),a.register(new NEt(a)),a.register(new vEt(a)),a.register(new _Et(a)),a.register(new LEt(a)),a.register(new PEt(a)),a.register(new OEt(a)),a.register(new tx(a)),a.register(new FEt(a)),a.register(new kEt(a)),a.register(new VEt(a)),a.register(new GEt(a)),a.register(new $Et(a)),a.register(new wEt(a)),a.register(new CEt(a)),a.register(new DEt(a)),a.register(new REt(a)),a.register(new jEt(a)),a.register(new KEt(a)),a.register(new qEt(a)),a.register(new UEt(a)),a.register(new Vgt(a)),a.register(new xgt(a)),a.register(new Pgt(a)),a.register(new Ngt(a)),a.register(new _gt(a)),a.register(new Ogt(a)),a.register(new $gt(a)),a.register(new nAt(a)),a.register(new dAt(a)),a.register(new uAt(a)),a.register(new fAt(a)),a.register(new yAt(a)),a.register(new hAt(a)),a.register(new mAt(a)),a.register(new oAt(a)),a.register(new pAt(a)),a.register(new cAt(a)),a.register(new lAt(a)),a.register(new sAt(a)),a.register(new aAt(a)),a.register(new rAt(a)),a.register(new tAt(a)),a.register(new iAt(a)),a.register(new EAt(a)),a.register(new IAt(a)),a.register(new gAt(a)),a.register(new bAt(a)),a.register(new jRt(a)),a.register(new TAt(a)),a.register(new vAt(a)),a.register(new AAt(a)),a.register(new RAt(a)),a.register(new DAt(a)),a.register(new CAt(a)),a.register(new wAt(a)),a.register(new ETt(a)),a.register(new ITt(a)),a.register(new Xw(a)),a.register(new ex(a)),a.register(new NAt(a)),a.register(new _At(a)),a.register(new LAt(a)),a.register(new HAt(a)),a.register(new SAt(a)),a.register(new $At(a)),a.register(new GAt(a)),a.register(new MAt(a)),a.register(new BAt(a)),a.register(new FAt(a)),a.register(new kAt(a)),a.register(new UAt(a)),a.register(new KAt(a)),a.register(new jAt(a)),a.register(new qAt(a)),a.register(new ZAt(a)),a.register(new WAt(a)),a.register(new YAt(a)),a.register(new JAt(a)),a.register(new QAt(a)),a.register(new XAt(a)),a.register(new e1t(a)),a.register(new t1t(a)),a.register(new i1t(a)),a.register(new W1t(a)),a.register(new n1t(a)),a.register(new r1t(a)),a.register(new g1t(a)),a.register(new a1t(a)),a.register(new s1t(a)),a.register(new l1t(a)),a.register(new o1t(a)),a.register(new d1t(a)),a.register(new p1t(a)),a.register(new u1t(a)),a.register(new c1t(a)),a.register(new f1t(a)),a.register(new h1t(a)),a.register(new m1t(a)),a.register(new T1t(a)),a.register(new v1t(a)),a.register(new b1t(a)),a.register(new H1t(a)),a.register(new I1t(a)),a.register(new V1t(a)),a.register(new w1t(a)),a.register(new x1t(a)),a.register(new C1t(a)),a.register(new $1t(a)),a.register(new E1t(a)),a.register(new R1t(a)),a.register(new G1t(a)),a.register(new _1t(a)),a.register(new B1t(a)),a.register(new S1t(a)),a.register(new M1t(a)),a.register(new F1t(a)),a.register(new k1t(a)),a.register(new U1t(a)),a.register(new K1t(a)),a.register(new j1t(a)),a.register(new q1t(a)),a.register(new Z1t(a)),a.register(new D1t(a)),a.register(new A1t(a)),a.register(new O1t(a)),a.register(new L1t(a)),a.register(new N1t(a)),a.register(new P1t(a)),a.register(new xAt(a)),a.register(new OAt(a)),a.register(new sAn(a)),a.register(new yAn(a)),a.register(new TAn(a)),a.register(new bAn(a)),a.register(new RAn(a)),a.register(new CAn(a)),a.register(new PAn(a)),a.register(new _An(a)),a.register(new $An(a)),a.register(new GAn(a)),a.register(new UAn(a)),a.register(new ZAn(a))}class j4{constructor(p=new pe.Events("extensions-registry-fallback-events")){C(this,"extensionsRegistry",new Map);C(this,"commandsRegistryMap",new Map);C(this,"commandsListCache",null);C(this,"initialized",new Set);C(this,"initializedContexts",new Set);C(this,"onResolveEditorContextCallback",()=>null);C(this,"onResolveProjectLogicContextCallback",()=>null);C(this,"onResolveEditorGUIContextCallback",()=>null);C(this,"onResolveGUIContextCallback",()=>null);C(this,"onResolveCompileContextCallback",()=>null);C(this,"onResolvePublicationRunContextCallback",()=>null);this.events=p,this.off=this.events.off.bind(this.events),this.on=this.events.on.bind(this.events),this.emit=this.events.emit.bind(this.events),this.emitAsync=this.events.emitAsync.bind(this.events),this.emitAsyncAll=this.events.emitAsyncAll.bind(this.events),this.emitAsyncAllSettled=this.events.emitAsyncAllSettled.bind(this.events),this.emitAsyncSequentially=this.events.emitAsyncSequentially.bind(this.events),this.emitAsyncSequentiallyAll=this.events.emitAsyncSequentiallyAll.bind(this.events),this.emitAsyncSequentiallyAllSettled=this.events.emitAsyncSequentiallyAllSettled.bind(this.events)}onResolveEditorContext(p){this.onResolveEditorContextCallback=p}onResolveProjectLogicContext(p){this.onResolveProjectLogicContextCallback=p}onResolveGUIContext(p){this.onResolveGUIContextCallback=p}onResolveEditorGUIContext(p){this.onResolveEditorGUIContextCallback=p}onResolveCompileContext(p){this.onResolveCompileContextCallback=p}onResolvePublicationRunContext(p){this.onResolvePublicationRunContextCallback=p}get extensionInOrder(){return Array.from(this.extensionsRegistry.values()).sort((p,t)=>(p.manifest.initPriority||_e.Normal)-(t.manifest.initPriority||_e.Normal))}async setup(){HAn(this),pe.Logger.log("Initializing extensions without context..."),this.initForReady()}requestContext(p){switch(p){case te.Editor:return this.onResolveEditorContextCallback();case te.Logic:return this.onResolveProjectLogicContextCallback();case te.EditorGUI:return this.onResolveEditorGUIContextCallback();case te.Compile:return this.onResolveCompileContextCallback();case te.PublicationRun:return this.onResolvePublicationRunContextCallback();case te.GUI:return this.onResolveGUIContextCallback();case te.EditorGUI:return this.onResolveEditorGUIContextCallback();default:throw new Error(`Unknown context type: ${p}`)}}requestContexts(p,t=[]){const n=[];t.length===0&&(t=p.manifest.contexts);for(const s of t){const u=this.requestContext(s);u&&n.push(u)}return n}requestExtension(p){const t=this.extensionsRegistry.get(p);if(t)return t;throw new Error(`Unknown extension: ${p}`)}register(p){if(this.extensionsRegistry.set(p.manifest.id,p),p.command){const t=p.command.command||p.command.name;t&&(this.commandsRegistryMap.set(t.toLowerCase(),p),this.commandsListCache=null)}}getCommands(p){if(this.commandsListCache||(this.commandsListCache=Array.from(this.commandsRegistryMap.values())),!p)return this.commandsListCache;const{contextType:t,globalOnly:n}=p;return this.commandsListCache.filter(s=>{var u;return n?!s.manifest.contexts||s.manifest.contexts.length===0:t?(u=s.manifest.contexts)==null?void 0:u.includes(t):!0})}async initAll(){for(const p of this.extensionInOrder){if(this.initialized.has(p.manifest.id))continue;const t=this.requestContexts(p);p.manifest.contexts.every(s=>!!t.find(u=>u.contextType===s))&&(p.module.init&&await p.module.init(t),this.initialized.add(p.manifest.id))}}async initForReady(){pe.Logger.log("Initializing extensions for ready contexts...");for(const p of this.extensionInOrder){if(this.initialized.has(p.manifest.id))continue;const t=this.requestContexts(p);p.manifest.contexts.every(s=>!!t.find(u=>u.contextType===s))?(p.module.init?(pe.Logger.debug("Initializing "+p.manifest.id+" extension..."),await p.module.init(t)):pe.Logger.log("Set "+p.manifest.id+" extension as ready (no init method)..."),this.initialized.add(p.manifest.id)):pe.Logger.warn(`Skipping initialization of ${p.manifest.id} extension, not all contexts are ready.`,`Required contexts: ${p.manifest.contexts.join(", ")}`,`Available contexts: ${t.map(s=>s.contextType).join(", ")}`)}}async destroyAll(){for(const p of[...this.extensionInOrder].reverse())p.module.destroy&&await p.module.destroy();this.events.destroy()}on(p,t){this.events.on(p,t)}emit(p,...t){this.events.emit(p,...t)}off(p,t){this.events.off(p,t)}emitAsync(p,...t){return this.events.emitAsync(p,...t)}emitAsyncAll(p,...t){return this.events.emitAsyncAll(p,...t)}emitAsyncAllSettled(p,...t){return this.events.emitAsyncAllSettled(p,...t)}emitAsyncSequentially(p,...t){return this.events.emitAsyncSequentially(p,...t)}emitAsyncSequentiallyAll(p,...t){return this.events.emitAsyncSequentiallyAll(p,...t)}emitAsyncSequentiallyAllSettled(p,...t){return this.events.emitAsyncSequentiallyAllSettled(p,...t)}async contextAvailable(p){if(this.initializedContexts.has(p)){pe.Logger.warn(`Context ${p} is already initialized. Skipping re-initialization.`);return}switch(this.initializedContexts.add(p),p){case te.Editor:{if(!this.onResolveEditorContextCallback)throw new Error("No editor context resolver callback set. Call onResolveEditorContext first.");break}case te.Logic:{if(!this.onResolveProjectLogicContextCallback)throw new Error("No project logic context resolver callback set. Call onResolveProjectLogicContext first.");break}}pe.Logger.log(`Context ${p} is now available. Initializing extensions for this context...`),await this.initForReady()}getValueTypePreference(p){return window.localStorage.getItem("dynamic-value-type-preference--"+p)||null}setValueTypePreference(p,t){window.localStorage.setItem("dynamic-value-type-preference--"+p,(t==null?void 0:t.toString())||""),this.emit(p,{})}}let Tw=null;const q4={requestExtension:a=>(Tw||(Tw=new j4,Tw.setup()),Tw.requestExtension(a))};function Eh(a){return!(a instanceof Error)&&typeof a=="object"&&a!==null?a:a instanceof Error?{name:a.name,message:a.message,stack:a.stack,...a}:a}function G5(a){var p,t,n;if(a&&typeof a=="object"&&"value"in a){const s=a;return{single:((p=s.value)==null?void 0:p.valueAsTypeSingle)??((t=s.value)==null?void 0:t.value),list:((n=s.value)==null?void 0:n.valueAsTypeList)??null}}return{single:a,list:Array.isArray(a)?a:null}}const Ih={onBeforeEntityExecution:async()=>{},onEntityExecuted:async()=>{}};class r2 extends Error{constructor(){super("Execution was stopped"),this.name="ExecutionStoppedError"}}var Z4=(a=>(a.FinishedSuccess="finished-success",a.FinishedError="finished-error",a.Running="running",a.Paused="paused",a.Stopped="stopped",a.NotStarted="not-started",a))(Z4||{});const mDt={...q4,getValueTypePreference:()=>null,setValueTypePreference:()=>{}};class vg extends pe.Events{constructor(t,n,s,u=null,e=mDt){super();C(this,"project");C(this,"entryPoint");C(this,"state","not-started");C(this,"events",new pe.Events("fe-exec-inst-events"));C(this,"entities",[]);C(this,"parentExecution",null);C(this,"executing",[]);C(this,"executed",[]);C(this,"skipped",[]);C(this,"scheduled",[]);C(this,"localTestValues");C(this,"resolvedValues");C(this,"persistedExecutionResults");C(this,"lastExecutionResults");C(this,"onAddToSkippedListCallback",null);C(this,"onRemoveFromSkippedListCallback",null);C(this,"onAddEntityCallback",null);C(this,"onRemoveEntityCallback",null);C(this,"onAbortExecutionCallback",null);this.parentContext=e,this.entities=n,this.entryPoint=s,this.project=t,this.parentExecution=u,this.localTestValues=new NR(M.UUID.uuid(),this.project),this.resolvedValues=new NR(M.UUID.uuid(),this.project),this.persistedExecutionResults=new NR(M.UUID.uuid(),this.project),this.lastExecutionResults=new NR(M.UUID.uuid(),this.project)}get valueResolutionContext(){return{execution:this,project:this.project,localTestValues:this.localTestValues,resolvedValues:this.resolvedValues,persistedExecutionResults:this.persistedExecutionResults,lastExecutionResults:this.lastExecutionResults,getValueTypePreference:this.parentContext.getValueTypePreference,setValueTypePreference:this.parentContext.setValueTypePreference}}get rootExecution(){let t=this;for(;t.parentExecution;)t=t.parentExecution;return t}get rootState(){return this.rootExecution.state}isStopped(){return this.state==="stopped"||this.rootExecution.state==="stopped"}isPaused(){return this.state==="paused"||this.rootExecution.state==="paused"}async checkStateAndPause(){if(this.isStopped())throw new r2;for(;this.isPaused();){if(this.isStopped())throw new r2;await new Promise(t=>setTimeout(t,100))}}skip(t){this.hasEntity(t)&&(this.removeFromScheduledList(t),!this.skipped.includes(t)&&(this.skipped.push(t),this.onAddToSkippedListCallback&&this.onAddToSkippedListCallback(t),Pr.includes(t.type)&&ri(t).forEach(n=>this.skip(n))))}async schedule(t,n,s){if(this.hasExecuted(t))return null;if(Xi.includes(t.type))return this.executeBranch(t,s,n);if(Vr.includes(t.type)){if(t.calledBy.every(e=>this.hasExecuted(e)||!this.hasEntity(e)))return this.executeBranch(t,s,n);this.scheduled.includes(t)||this.scheduled.push(t)}return null}mergeExernalValuesWithInternalInputs(t,n){const s=[];return Yi.includes(n.type)?s.push(...n.inputs.filter(e=>vT(e))):[...Li,...Xi].includes(n.type)?s.push(...n.inputs):Ni.includes(n.type)&&s.push(...n.outputs.filter(e=>vT(e))),s.map(e=>{var y;let f=t.find(m=>m.valueOwner.id===e.id);if(f)return f;if(!f&&Xi.includes(n.type)&&(f=t.find(m=>{var T;return((T=m.valueOwner.declaration)==null?void 0:T.id)===e.id})),f){const m=(y=f.value)==null?void 0:y.clone(null);return m==null||m.setStandaloneParent(e,null),{...f,valueOwner:e,value:m||null,inheritanceLink:{sources:[f],target:e}}}return ls.includes(e.type)?Xp(e,this.valueResolutionContext):Qu(e,this.valueResolutionContext)}).reduce((e,f)=>{const y=uf(f==null?void 0:f.valueOwner,this.project),m=f?[f]:[];return y.forEach(T=>{var R,I,A;if(T.id===(f==null?void 0:f.valueOwner.id))return;const g=Pn(T.getDataType(null),T,this.project);g==null||g.metaSync({value:(R=f==null?void 0:f.value)==null?void 0:R.value},null),g==null||g.setValueAsTypeList(((I=f==null?void 0:f.value)==null?void 0:I.valueAsTypeList)||null),g==null||g.setValueAsTypeSingle(((A=f==null?void 0:f.value)==null?void 0:A.valueAsTypeSingle)||null);const b={...f,valueOwner:T,value:g};m.push(b)}),[...e,...m]},[]).sort((e,f)=>e.valueOwner.index-f.valueOwner.index)}inheritValuesFromContext(t){this.localTestValues=t.localTestValues,this.resolvedValues=t.resolvedValues,this.persistedExecutionResults=t.persistedExecutionResults}async executeInternalCall(t,n,s,u={}){var f,y;this.logBeforeExecution("executeInternalCall",t,n);const e={...Ih,...u};try{let m={value:K.Success,error:null,result:null};if(n.sort((A,x)=>A.valueOwner.index-x.valueOwner.index),Object.values(ja).includes(t.declaration.id)){const A=this.parentContext.requestExtension(vi+t.declaration.id).module.main;A?m=await A(t,n,this):pe.Logger.warn(`No implementation found for built-in function: ${t.declaration.id}`)}else{const A=await this.executeDetachedFullFunctionDeclarationLogic(t.declaration,n,s,e);m={value:A.value,error:A.error,result:A.result}}let T=null;if(m.error&&t.error){pe.Logger.warn("Raw error executing entity: ",m.error);const{single:A,list:x}=G5(m.error),P=Eh(A),O=(f=t.error)==null?void 0:f.getDataType(null),$=Pn(O||null,t.error,s);O!=null&&O.asType?x!==null?$==null||$.setValueAsTypeList(x):$==null||$.setValueAsTypeSingle(A):$==null||$.metaSync({value:P},null),T={valueOwner:t.error,type:rt.ExecutionResult,inheritanceLink:null,value:$}}const g=t==null?void 0:t.getDataType(null),b=Pn(g,t,s),{single:R,list:I}=G5(m.result);return g!=null&&g.asType?I!==null?b==null||b.setValueAsTypeList(I):b==null||b.setValueAsTypeSingle(R):b==null||b.metaSync({value:R},null),{value:m.value,entity:t,error:T,result:{value:b||null,valueOwner:t,type:rt.ExecutionResult,inheritanceLink:null}}}catch(m){if(m&&(m.name==="ExecutionStoppedError"||m.message==="Execution was stopped"))throw m;pe.Logger.warn("Internal call execution error: ",m);let T=null;if(t.error){const g=Eh(m),b=(y=t.error)==null?void 0:y.getDataType(null),R=Pn(b,t.error,s);b!=null&&b.asType?R==null||R.setValueAsTypeSingle(m):R==null||R.metaSync({value:g},null),T={valueOwner:t.error,type:rt.ExecutionResult,inheritanceLink:null,value:R}}return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,entity:t,error:T,result:null}}}static async executeOperation(t,n,s,u){var e,f;u?u.logBeforeExecution("executeOperation",t,n):console.log(`executeOperation (${t.type}) -> [${De(t,s)}] Inputs:${n.length?`
|
|
61
|
+
`),p}class FAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleDriveUploadFile,version:"2.0.0",description:"Upload a file to Google Drive (media / import+copy) with auto content detection and simplified inputs.",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleDriveUploadFile);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A,x,P,O,$,U,Z,j,H,Y,ie,W,z,J,ee;try{const Q=this.extensionsRegistry.requestContexts(this,[te.Editor])[0],re=Be(t,t.project,"uploadFile"),le="["+Ve(t,t.project,"Upload Google Drive File")+": `"+re+"`] ",oe=G.operation[X.GoogleDriveUploadFile],ce=n.find(kt=>{var Ct,Oi;return((Oi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:Oi.id)===oe.inputs.connection.id}),be=((s=ce==null?void 0:ce.value)==null?void 0:s.valueAsType)??((u=ce==null?void 0:ce.value)==null?void 0:u.value);if(!be||!be.id||!be.name||be.type!==r.DefinitionEntity)throw new Error(`${le}Invalid input "${Ve(ce==null?void 0:ce.valueOwner,Q==null?void 0:Q.logic,"Connection")}" (\`${Be(ce==null?void 0:ce.valueOwner,Q==null?void 0:Q.logic,"connection")}\`), expected a valid connection node.`);const Ce=n.find(kt=>{var Ct,Oi;return((Oi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:Oi.id)===oe.inputs.content.id}),Ee=((e=Ce==null?void 0:Ce.value)==null?void 0:e.valueAsType)??((f=Ce==null?void 0:Ce.value)==null?void 0:f.value),xe=n.find(kt=>{var Ct,Oi;return((Oi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:Oi.id)===oe.inputs.name.id}),Le=(m=(y=xe==null?void 0:xe.value)==null?void 0:y.value)==null?void 0:m.trim();if(!Le||Le==="")throw new Error(`${le}The "${Ve(xe==null?void 0:xe.valueOwner,Q==null?void 0:Q.logic,"File Name")}" (\`${Be(xe==null?void 0:xe.valueOwner,Q==null?void 0:Q.logic,"name")}\`) input is missing.`);const Fe=(((g=(T=n.find(kt=>{var Ct,Oi;return((Oi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:Oi.id)===G.operation[X.GoogleDriveUploadFile].inputs.mimeType.id}))==null?void 0:T.value)==null?void 0:g.valueAsType)??((R=(b=n.find(kt=>{var Ct,Oi;return((Oi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:Oi.id)===G.operation[X.GoogleDriveUploadFile].inputs.mimeType.id}))==null?void 0:b.value)==null?void 0:R.value))||"application/octet-stream",tt=(((A=(I=n.find(kt=>{var Ct,Oi;return((Oi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:Oi.id)===G.operation[X.GoogleDriveUploadFile].inputs.folderId.id}))==null?void 0:I.value)==null?void 0:A.valueAsType)??((P=(x=n.find(kt=>{var Ct,Oi;return((Oi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:Oi.id)===G.operation[X.GoogleDriveUploadFile].inputs.folderId.id}))==null?void 0:x.value)==null?void 0:P.value))||void 0,We=((($=(O=n.find(kt=>{var Ct,Oi;return((Oi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:Oi.id)===G.operation[X.GoogleDriveUploadFile].inputs.description.id}))==null?void 0:O.value)==null?void 0:$.valueAsType)??((Z=(U=n.find(kt=>{var Ct,Oi;return((Oi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:Oi.id)===G.operation[X.GoogleDriveUploadFile].inputs.description.id}))==null?void 0:U.value)==null?void 0:Z.value))||void 0,et=(((H=(j=n.find(kt=>{var Ct,Oi;return((Oi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:Oi.id)===G.operation[X.GoogleDriveUploadFile].inputs.importMimeType.id}))==null?void 0:j.value)==null?void 0:H.valueAsType)??((ie=(Y=n.find(kt=>{var Ct,Oi;return((Oi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:Oi.id)===G.operation[X.GoogleDriveUploadFile].inputs.importMimeType.id}))==null?void 0:Y.value)==null?void 0:ie.value))||"text/plain";if(!Le)return ay(t,"Missing required input: name");const qe=ui(be),st={Authorization:`Bearer ${await Q.getAccessToken()}`},ft=`${((W=Q.env)==null?void 0:W.API_BASE_URL)+"/editor-runtime"}/v2/external-integrations/proxy/${Q.projectId}/${Zt["google-drive"]}/${qe}`,Et=async(kt,Ct,{params:Oi,body:wn,contentType:Yr,providerHeaders:Jr,responseType:hi}={})=>{const $t=`${ft}/${eRn(Ct)}`,Nt={...st};return Yr&&(Nt["Content-Type"]=Yr),(Jr||hi)&&(Nt[XIn]=JSON.stringify({...Jr?{headers:Jr}:{},...hi?{responseType:hi}:{}})),Ht.request({method:kt,url:$t,params:Oi,data:wn,responseType:hi||"json",headers:Nt})},pt=typeof Fe=="string"&&Fe.startsWith("application/vnd.google-apps.");if(pt&&(Ee==null||Ee==="")){const kt={name:Le,mimeType:Fe};tt&&(kt.parents=[tt]),typeof We=="string"&&(kt.description=We);const Ct=await Et("POST","/drive/v3/files",{params:{supportsAllDrives:"true",fields:$R},body:JSON.stringify(kt),contentType:"application/json"});return Ct.status!==200&&Ct.status!==201?ay(t,`Drive create failed (status=${Ct.status})`):JG({file:Ct.data})}if(pt&&Ee!=null){let kt=await iRn(Ee);const Oi=((hi,$t)=>$t||(hi==="application/vnd.google-apps.spreadsheet"?"text/csv":hi==="application/vnd.google-apps.document"||hi==="application/vnd.google-apps.presentation"?"text/html":"text/plain"))(Fe,et),wn=Oi.startsWith("text/")&&!/charset=/i.test(Oi)?`${Oi}; charset=UTF-8`:Oi;Oi.startsWith("text/csv")&&(kt=nRn(kt));const Yr=new TextEncoder().encode(kt);if(Yr.byteLength>I5)return ay(t,`Text body exceeds simple upload limit (${Yr.byteLength} bytes).`);let Jr;try{const hi=await Et("POST","/upload/drive/v3/files",{params:{uploadType:"media",supportsAllDrives:"true",fields:$R},body:Yr,contentType:wn});if(hi.status!==200&&hi.status!==201)return ay(t,`Drive media upload failed (status=${hi.status})`);if(Jr=(z=hi.data)==null?void 0:z.id,!Jr)return ay(t,"Drive media upload did not return an id");const $t={name:Le,mimeType:Fe};tt&&($t.parents=[tt]),typeof We=="string"&&($t.description=We);const Nt=await Et("POST",`/drive/v3/files/${encodeURIComponent(Jr)}/copy`,{params:{supportsAllDrives:"true",fields:$R},body:JSON.stringify($t),contentType:"application/json"});return Nt.status!==200&&Nt.status!==201?ay(t,`Drive copy-convert failed (status=${Nt.status})`):JG({file:Nt.data})}finally{if(Jr)try{await Et("DELETE",`/drive/v3/files/${encodeURIComponent(Jr)}`,{params:{supportsAllDrives:"true"}})}catch{}}}if(Ee==null)return ay(t,"Missing content for non-native upload");const{bytes:Me,inferredMime:Je,isBinary:ke}=await tRn(Ee),lt=Me.byteLength;if(lt>I5)return ay(t,`File too large for simple upload (${lt} bytes).`);const Gt=await Et("POST","/upload/drive/v3/files",{params:{uploadType:"media",supportsAllDrives:"true",fields:$R},body:Me,contentType:Fe||Je||(ke?"application/octet-stream":"text/plain; charset=UTF-8")});if(Gt.status!==200&&Gt.status!==201)return ay(t,`Drive media upload failed (status=${Gt.status})`);let si=Gt.data;const pi=(J=Gt.data)==null?void 0:J.id;return pi&&(tt||Le||We)&&(si=await rRn(Et,pi,Le,We,tt)),JG({file:si})}catch(Q){const re=((ee=Q.response)==null?void 0:ee.data)||Q.message||Q;return pe.Logger.error("[Google Drive] Upload document failed:",re),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:re,result:null}}}})}}function JG(a){return{value:K.Success,error:null,result:a}}function ay(a,p){return pe.Logger.log("[Google Drive] Upload error:",p),{value:a.catchesError||a.errorCalls.length?K.CaughtError:K.UnhandledError,error:p,result:null}}async function rRn(a,p,t,n,s){const u={};t&&(u.name=t),typeof n=="string"&&(u.description=n);const e={supportsAllDrives:"true",fields:$R},f={...e};s&&(f.addParents=s,f.removeParents="root");let y=await a("PATCH",`/drive/v3/files/${encodeURIComponent(p)}`,{params:f,body:JSON.stringify(u),contentType:"application/json"});if(y.status>=400&&s&&(y=await a("PATCH",`/drive/v3/files/${encodeURIComponent(p)}`,{params:{...e,addParents:s},body:JSON.stringify(u),contentType:"application/json"})),y.status!==200)throw new Error(`Drive metadata update failed (status=${y.status})`);return y.data}const aRn="id,name,mimeType,webViewLink",sRn="X-Elyx-Proxy-Config";function lRn(a){return a.startsWith("/")?a.slice(1):a}const oRn=(a,p)=>(pe.Logger.log("[Google Drive Clone Document] error:",p),{value:a.catchesError||a.errorCalls.length?K.CaughtError:K.UnhandledError,error:p,result:null});class kAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleDriveCloneDocument,version:"1.0.0",description:"Google Drive clone document operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleDriveCloneDocument);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A,x;try{const P=this.extensionsRegistry.requestContexts(this,[te.Editor])[0],O=G.operation[X.GoogleDriveCloneDocument],$=Be(t,t.project,"cloneDocument"),Z="["+Ve(t,t.project,"Clone document")+": `"+$+"`] ",j=n.find(Ee=>{var xe,Le;return((Le=(xe=Ee.valueOwner)==null?void 0:xe.declaration)==null?void 0:Le.id)===O.inputs.connection.id}),H=((s=j==null?void 0:j.value)==null?void 0:s.valueAsType)??((u=j==null?void 0:j.value)==null?void 0:u.value);if(!H||!H.id||!H.name||H.type!==r.DefinitionEntity)throw new Error(`${Z}Invalid input "${Ve(j==null?void 0:j.valueOwner,P==null?void 0:P.logic,"Connection")}" (\`${Be(j==null?void 0:j.valueOwner,P==null?void 0:P.logic,"connection")}\`), expected a valid connection node.`);const Y=ui(H);if(!Y)throw new Error(`${Z}The "${Ve(j==null?void 0:j.valueOwner,P==null?void 0:P.logic,"Connection")}" (\`${Be(j==null?void 0:j.valueOwner,P==null?void 0:P.logic,"connection")}\`) input is invalid, missing underlying Connection ID value.`);const ie=n.find(Ee=>{var xe,Le;return((Le=(xe=Ee.valueOwner)==null?void 0:xe.declaration)==null?void 0:Le.id)===O.inputs.documentId.id}),W=(e=ie==null?void 0:ie.value)==null?void 0:e.value;if(!W||W==="")throw new Error(`${Z}The "${Ve(ie==null?void 0:ie.valueOwner,P==null?void 0:P.logic,"Document ID")}" (\`${Be(ie==null?void 0:ie.valueOwner,P==null?void 0:P.logic,"documentId")}\`) input is missing.`);if(typeof W!="string")throw new Error(`${Z}The "${Ve(ie==null?void 0:ie.valueOwner,P==null?void 0:P.logic,"Document ID")}" (\`${Be(ie==null?void 0:ie.valueOwner,P==null?void 0:P.logic,"documentId")}\`) input value is invalid, if present, it must be a non-empty string.`);const z=(y=(f=n.find(Ee=>{var xe,Le;return((Le=(xe=Ee.valueOwner)==null?void 0:xe.declaration)==null?void 0:Le.id)===O.inputs.newName.id}))==null?void 0:f.value)==null?void 0:y.value,J=(T=(m=n.find(Ee=>{var xe,Le;return((Le=(xe=Ee.valueOwner)==null?void 0:xe.declaration)==null?void 0:Le.id)===O.inputs.parentFolderIds.id}))==null?void 0:m.value)==null?void 0:T.value,ee=(b=(g=n.find(Ee=>{var xe,Le;return((Le=(xe=Ee.valueOwner)==null?void 0:xe.declaration)==null?void 0:Le.id)===O.inputs.description.id}))==null?void 0:g.value)==null?void 0:b.value,Q=(I=(R=n.find(Ee=>{var xe,Le;return((Le=(xe=Ee.valueOwner)==null?void 0:xe.declaration)==null?void 0:Le.id)===O.inputs.starred.id}))==null?void 0:R.value)==null?void 0:I.value;ui(H);const ae={Authorization:`Bearer ${await P.getAccessToken()}`},le=`${((A=P.env)==null?void 0:A.API_BASE_URL)+"/editor-runtime"}/v2/external-integrations/proxy/${P.projectId}/${Zt["google-drive"]}/${Y}`,oe=async(Ee,xe,{params:Le,body:Fe,contentType:tt,providerHeaders:We,responseType:et}={})=>{const qe=`${le}/${lRn(xe)}`,ot={...ae};return tt&&(ot["Content-Type"]=tt),(We||et)&&(ot[sRn]=JSON.stringify({...We?{headers:We}:{},...et?{responseType:et}:{}})),Ht({method:Ee,url:qe,headers:ot,params:Le,data:Fe,responseType:et||"json"})},ce={};z&&(ce.name=z),J&&J.length>0&&(ce.parents=J),ee&&(ce.description=ee),Q!==void 0&&(ce.starred=Q);const Ce=(await oe("POST",`/drive/v3/files/${W}/copy`,{params:{fields:aRn,supportsAllDrives:!0},body:ce,contentType:"application/json"})).data;return{value:K.Success,error:null,result:{id:Ce.id,name:Ce.name,mimeType:Ce.mimeType,webViewLink:Ce.webViewLink}}}catch(P){const O=((x=P.response)==null?void 0:x.data)||P.message||P;return oRn(t,O)}}})}}const dRn="X-Elyx-Proxy-Config";function pRn(a){return a.startsWith("/")?a.slice(1):a}const uRn=(a,p)=>(pe.Logger.log("[Google Drive Delete Document] error:",p),{value:a.catchesError||a.errorCalls.length?K.CaughtError:K.UnhandledError,error:p,result:null});class UAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleDriveDeleteDocument,version:"1.0.0",description:"Google Drive delete document operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleDriveDeleteDocument);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T;try{const g=this.extensionsRegistry.requestContexts(this,[te.Editor])[0],b=G.operation[X.GoogleDriveDeleteDocument],R=Be(t,t.project,"deleteDocument"),A="["+Ve(t,t.project,"Delete document")+": `"+R+"`] ",x=n.find(W=>{var z,J;return((J=(z=W.valueOwner)==null?void 0:z.declaration)==null?void 0:J.id)===b.inputs.connection.id}),P=((s=x==null?void 0:x.value)==null?void 0:s.valueAsType)??((u=x==null?void 0:x.value)==null?void 0:u.value);if(!P||!P.id||!P.name||P.type!==r.DefinitionEntity)throw new Error(`${A}Invalid input "${Ve(x==null?void 0:x.valueOwner,g==null?void 0:g.logic,"Connection")}" (\`${Be(x==null?void 0:x.valueOwner,g==null?void 0:g.logic,"connection")}\`), expected a valid connection node.`);const O=ui(P);if(!O)throw new Error(`${A}The "${Ve(x==null?void 0:x.valueOwner,g==null?void 0:g.logic,"Connection")}" (\`${Be(x==null?void 0:x.valueOwner,g==null?void 0:g.logic,"connection")}\`) input is invalid, missing underlying Connection ID value.`);const $=n.find(W=>{var z,J;return((J=(z=W.valueOwner)==null?void 0:z.declaration)==null?void 0:J.id)===b.inputs.documentId.id}),U=(e=$==null?void 0:$.value)==null?void 0:e.value;if(!U||U==="")throw new Error(`${A}The "${Ve($==null?void 0:$.valueOwner,g==null?void 0:g.logic,"Document ID")}" (\`${Be($==null?void 0:$.valueOwner,g==null?void 0:g.logic,"documentId")}\`) input is missing.`);if(typeof U!="string")throw new Error(`${A}The "${Ve($==null?void 0:$.valueOwner,g==null?void 0:g.logic,"Document ID")}" (\`${Be($==null?void 0:$.valueOwner,g==null?void 0:g.logic,"documentId")}\`) input value is invalid, if present, it must be a non-empty string.`);const Z=(y=(f=n.find(W=>{var z,J;return((J=(z=W.valueOwner)==null?void 0:z.declaration)==null?void 0:J.id)===b.inputs.permanent.id}))==null?void 0:f.value)==null?void 0:y.value;ui(P);const H={Authorization:`Bearer ${await g.getAccessToken()}`},Y=`${((m=g.env)==null?void 0:m.API_BASE_URL)+"/editor-runtime"}/v2/external-integrations/proxy/${g.projectId}/${Zt["google-drive"]}/${O}`,ie=async(W,z,{params:J,body:ee,contentType:Q,providerHeaders:re,responseType:ae}={})=>{const le=`${Y}/${pRn(z)}`,oe={...H};return Q&&(oe["Content-Type"]=Q),(re||ae)&&(oe[dRn]=JSON.stringify({...re?{headers:re}:{},...ae?{responseType:ae}:{}})),Ht({method:W,url:le,headers:oe,params:J,data:ee,responseType:ae||"json"})};return Z?await ie("DELETE",`/drive/v3/files/${U}`,{params:{supportsAllDrives:!0}}):await ie("PATCH",`/drive/v3/files/${U}`,{params:{supportsAllDrives:!0},body:{trashed:!0},contentType:"application/json"}),{value:K.Success,error:null,result:null}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return uRn(t,b)}}})}}const cRn="X-Elyx-Proxy-Config";function fRn(a){return a.startsWith("/")?a.slice(1):a}const yRn=(a,p)=>(pe.Logger.log("[Google Drive Create Permission] error:",p),{value:a.catchesError||a.errorCalls.length?K.CaughtError:K.UnhandledError,error:p,result:null});class KAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleDriveCreatePermission,version:"1.0.0",description:"Google Drive create permission operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleDriveCreatePermission);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A,x,P,O,$,U,Z;try{const j=this.extensionsRegistry.requestContexts(this,[te.Editor])[0],H=G.operation[X.GoogleDriveCreatePermission],Y=Be(t,t.project,"createPermission"),W="["+Ve(t,t.project,"Create permission")+": `"+Y+"`] ",z=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===H.inputs.connection.id}),J=((s=z==null?void 0:z.value)==null?void 0:s.valueAsType)??((u=z==null?void 0:z.value)==null?void 0:u.value);if(!J||!J.id||!J.name||J.type!==r.DefinitionEntity)throw new Error(`${W}Invalid input "${Ve(z==null?void 0:z.valueOwner,j==null?void 0:j.logic,"Connection")}" (\`${Be(z==null?void 0:z.valueOwner,j==null?void 0:j.logic,"connection")}\`), expected a valid connection node.`);const ee=ui(J);if(!ee)throw new Error(`${W}The "${Ve(z==null?void 0:z.valueOwner,j==null?void 0:j.logic,"Connection")}" (\`${Be(z==null?void 0:z.valueOwner,j==null?void 0:j.logic,"connection")}\`) input is invalid, missing underlying Connection ID value.`);const Q=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===H.inputs.fileId.id}),re=(e=Q==null?void 0:Q.value)==null?void 0:e.value;if(!re||re==="")throw new Error(`${W}The "${Ve(Q==null?void 0:Q.valueOwner,j==null?void 0:j.logic,"File ID")}" (\`${Be(Q==null?void 0:Q.valueOwner,j==null?void 0:j.logic,"fileId")}\`) input is missing.`);if(typeof re!="string")throw new Error(`${W}The "${Ve(Q==null?void 0:Q.valueOwner,j==null?void 0:j.logic,"File ID")}" (\`${Be(Q==null?void 0:Q.valueOwner,j==null?void 0:j.logic,"fileId")}\`) input value is invalid, if present, it must be a non-empty string.`);const ae=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===H.inputs.role.id}),le=(f=ae==null?void 0:ae.value)==null?void 0:f.value;if(!le||le==="")throw new Error(`${W}The "${Ve(ae==null?void 0:ae.valueOwner,j==null?void 0:j.logic,"Role")}" (\`${Be(ae==null?void 0:ae.valueOwner,j==null?void 0:j.logic,"role")}\`) input is missing.`);if(typeof le!="string")throw new Error(`${W}The "${Ve(ae==null?void 0:ae.valueOwner,j==null?void 0:j.logic,"Role")}" (\`${Be(ae==null?void 0:ae.valueOwner,j==null?void 0:j.logic,"role")}\`) input value is invalid, if present, it must be a non-empty string.`);const oe=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===H.inputs.type.id}),ce=(y=oe==null?void 0:oe.value)==null?void 0:y.value;if(!ce||ce==="")throw new Error(`${W}The "${Ve(oe==null?void 0:oe.valueOwner,j==null?void 0:j.logic,"Type")}" (\`${Be(oe==null?void 0:oe.valueOwner,j==null?void 0:j.logic,"type")}\`) input is missing.`);if(typeof ce!="string")throw new Error(`${W}The "${Ve(oe==null?void 0:oe.valueOwner,j==null?void 0:j.logic,"Type")}" (\`${Be(oe==null?void 0:oe.valueOwner,j==null?void 0:j.logic,"type")}\`) input value is invalid, if present, it must be a non-empty string.`);const be=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===H.inputs.emailAddress.id}),Ce=(m=be==null?void 0:be.value)==null?void 0:m.value,Ee=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===H.inputs.domain.id}),xe=(T=Ee==null?void 0:Ee.value)==null?void 0:T.value;if((ce==="user"||ce==="group")&&(!Ce||Ce.trim()===""))throw new Error(`${W}The "${Ve(be==null?void 0:be.valueOwner,j==null?void 0:j.logic,"Email address")}" (\`${Be(be==null?void 0:be.valueOwner,j==null?void 0:j.logic,"emailAddress")}\`) input is required when type is "${ce}".`);if(ce==="domain"&&(!xe||xe.trim()===""))throw new Error(`${W}The "${Ve(Ee==null?void 0:Ee.valueOwner,j==null?void 0:j.logic,"Domain")}" (\`${Be(Ee==null?void 0:Ee.valueOwner,j==null?void 0:j.logic,"domain")}\`) input is required when type is "domain".`);const Le=(b=(g=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===H.inputs.sendNotificationEmail.id}))==null?void 0:g.value)==null?void 0:b.value,Fe=(I=(R=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===H.inputs.emailMessage.id}))==null?void 0:R.value)==null?void 0:I.value,tt=(x=(A=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===H.inputs.allowFileDiscovery.id}))==null?void 0:A.value)==null?void 0:x.value,We=(O=(P=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===H.inputs.transferOwnership.id}))==null?void 0:P.value)==null?void 0:O.value;ui(J);const qe={Authorization:`Bearer ${await j.getAccessToken()}`},ot=`${(($=j.env)==null?void 0:$.API_BASE_URL)+"/editor-runtime"}/v2/external-integrations/proxy/${j.projectId}/${Zt["google-drive"]}/${ee}`,st=async(Je,ke,{params:lt,body:Pt,contentType:Gt,providerHeaders:si,responseType:pi}={})=>{const kt=`${ot}/${fRn(ke)}`,Ct={...qe};return Gt&&(Ct["Content-Type"]=Gt),(si||pi)&&(Ct[cRn]=JSON.stringify({...si?{headers:si}:{},...pi?{responseType:pi}:{}})),Ht({method:Je,url:kt,headers:Ct,params:lt,data:Pt,responseType:pi||"json"})},ft={supportsAllDrives:!0,fields:"id,type,role,emailAddress,domain,displayName"};Le!==void 0&&(ft.sendNotificationEmail=Le),Fe&&(ft.emailMessage=Fe),We!==void 0&&(ft.transferOwnership=We);const Et={role:le,type:ce};Ce&&(Et.emailAddress=Ce),xe&&(Et.domain=xe),tt!==void 0&&(Et.allowFileDiscovery=tt);const pt=await st("POST",`/drive/v3/files/${re}/permissions`,{params:ft,body:Et,contentType:"application/json"}),Me=((U=pt.data)==null?void 0:U.data)??pt.data;return{value:K.Success,error:null,result:{id:(Me==null?void 0:Me.id)??"",type:(Me==null?void 0:Me.type)??ce,role:(Me==null?void 0:Me.role)??le,emailAddress:(Me==null?void 0:Me.emailAddress)??Ce??"",domain:(Me==null?void 0:Me.domain)??xe??"",displayName:(Me==null?void 0:Me.displayName)??""}}}catch(j){const H=((Z=j.response)==null?void 0:Z.data)||j.message||j;return yRn(t,typeof H=="object"?JSON.stringify(H):String(H))}}})}}const hRn="X-Elyx-Proxy-Config";function mRn(a){return a.startsWith("/")?a.slice(1):a}const TRn=(a,p)=>(pe.Logger.log("[Google Drive Delete Permission] error:",p),{value:a.catchesError||a.errorCalls.length?K.CaughtError:K.UnhandledError,error:p,result:null});class jAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleDriveDeletePermission,version:"1.0.0",description:"Google Drive delete permission operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleDriveDeletePermission);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[te.Editor])[0],g=G.operation[X.GoogleDriveDeletePermission],b=Be(t,t.project,"deletePermission"),I="["+Ve(t,t.project,"Delete permission")+": `"+b+"`] ",A=n.find(W=>{var z,J;return((J=(z=W.valueOwner)==null?void 0:z.declaration)==null?void 0:J.id)===g.inputs.connection.id}),x=((s=A==null?void 0:A.value)==null?void 0:s.valueAsType)??((u=A==null?void 0:A.value)==null?void 0:u.value);if(!x||!x.id||!x.name||x.type!==r.DefinitionEntity)throw new Error(`${I}Invalid input "${Ve(A==null?void 0:A.valueOwner,T==null?void 0:T.logic,"Connection")}" (\`${Be(A==null?void 0:A.valueOwner,T==null?void 0:T.logic,"connection")}\`), expected a valid connection node.`);const P=ui(x);if(!P)throw new Error(`${I}The "${Ve(A==null?void 0:A.valueOwner,T==null?void 0:T.logic,"Connection")}" (\`${Be(A==null?void 0:A.valueOwner,T==null?void 0:T.logic,"connection")}\`) input is invalid, missing underlying Connection ID value.`);const O=n.find(W=>{var z,J;return((J=(z=W.valueOwner)==null?void 0:z.declaration)==null?void 0:J.id)===g.inputs.fileId.id}),$=(e=O==null?void 0:O.value)==null?void 0:e.value;if(!$||$==="")throw new Error(`${I}The "${Ve(O==null?void 0:O.valueOwner,T==null?void 0:T.logic,"File ID")}" (\`${Be(O==null?void 0:O.valueOwner,T==null?void 0:T.logic,"fileId")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${I}The "${Ve(O==null?void 0:O.valueOwner,T==null?void 0:T.logic,"File ID")}" (\`${Be(O==null?void 0:O.valueOwner,T==null?void 0:T.logic,"fileId")}\`) input value is invalid, if present, it must be a non-empty string.`);const U=n.find(W=>{var z,J;return((J=(z=W.valueOwner)==null?void 0:z.declaration)==null?void 0:J.id)===g.inputs.permissionId.id}),Z=(f=U==null?void 0:U.value)==null?void 0:f.value;if(!Z||Z==="")throw new Error(`${I}The "${Ve(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"Permission ID")}" (\`${Be(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"permissionId")}\`) input is missing.`);if(typeof Z!="string")throw new Error(`${I}The "${Ve(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"Permission ID")}" (\`${Be(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"permissionId")}\`) input value is invalid, if present, it must be a non-empty string.`);ui(x);const H={Authorization:`Bearer ${await T.getAccessToken()}`},Y=`${((y=T.env)==null?void 0:y.API_BASE_URL)+"/editor-runtime"}/v2/external-integrations/proxy/${T.projectId}/${Zt["google-drive"]}/${P}`;return await(async(W,z,{params:J,body:ee,contentType:Q,providerHeaders:re,responseType:ae}={})=>{const le=`${Y}/${mRn(z)}`,oe={...H};return Q&&(oe["Content-Type"]=Q),(re||ae)&&(oe[hRn]=JSON.stringify({...re?{headers:re}:{},...ae?{responseType:ae}:{}})),Ht({method:W,url:le,headers:oe,params:J,data:ee,responseType:ae||"json"})})("DELETE",`/drive/v3/files/${$}/permissions/${Z}`,{params:{supportsAllDrives:!0}}),{value:K.Success,error:null,result:void 0}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return TRn(t,typeof g=="object"?JSON.stringify(g):String(g))}}})}}const vRn="X-Elyx-Proxy-Config";function gRn(a){return a.startsWith("/")?a.slice(1):a}const bRn=(a,p)=>(pe.Logger.log("[Google Drive List Permissions] error:",p),{value:a.catchesError||a.errorCalls.length?K.CaughtError:K.UnhandledError,error:p,result:null});class qAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleDriveListPermissions,version:"1.0.0",description:"Google Drive list permissions operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleDriveListPermissions);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R;try{const I=this.extensionsRegistry.requestContexts(this,[te.Editor])[0],A=G.operation[X.GoogleDriveListPermissions],x=Be(t,t.project,"listPermissions"),O="["+Ve(t,t.project,"List permissions")+": `"+x+"`] ",$=n.find(ce=>{var be,Ce;return((Ce=(be=ce.valueOwner)==null?void 0:be.declaration)==null?void 0:Ce.id)===A.inputs.connection.id}),U=((s=$==null?void 0:$.value)==null?void 0:s.valueAsType)??((u=$==null?void 0:$.value)==null?void 0:u.value);if(!U||!U.id||!U.name||U.type!==r.DefinitionEntity)throw new Error(`${O}Invalid input "${Ve($==null?void 0:$.valueOwner,I==null?void 0:I.logic,"Connection")}" (\`${Be($==null?void 0:$.valueOwner,I==null?void 0:I.logic,"connection")}\`), expected a valid connection node.`);const Z=ui(U);if(!Z)throw new Error(`${O}The "${Ve($==null?void 0:$.valueOwner,I==null?void 0:I.logic,"Connection")}" (\`${Be($==null?void 0:$.valueOwner,I==null?void 0:I.logic,"connection")}\`) input is invalid, missing underlying Connection ID value.`);const j=n.find(ce=>{var be,Ce;return((Ce=(be=ce.valueOwner)==null?void 0:be.declaration)==null?void 0:Ce.id)===A.inputs.fileId.id}),H=(e=j==null?void 0:j.value)==null?void 0:e.value;if(!H||H==="")throw new Error(`${O}The "${Ve(j==null?void 0:j.valueOwner,I==null?void 0:I.logic,"File ID")}" (\`${Be(j==null?void 0:j.valueOwner,I==null?void 0:I.logic,"fileId")}\`) input is missing.`);if(typeof H!="string")throw new Error(`${O}The "${Ve(j==null?void 0:j.valueOwner,I==null?void 0:I.logic,"File ID")}" (\`${Be(j==null?void 0:j.valueOwner,I==null?void 0:I.logic,"fileId")}\`) input value is invalid, if present, it must be a non-empty string.`);const Y=(y=(f=n.find(ce=>{var be,Ce;return((Ce=(be=ce.valueOwner)==null?void 0:be.declaration)==null?void 0:Ce.id)===A.inputs.pageSize.id}))==null?void 0:f.value)==null?void 0:y.value,ie=(T=(m=n.find(ce=>{var be,Ce;return((Ce=(be=ce.valueOwner)==null?void 0:be.declaration)==null?void 0:Ce.id)===A.inputs.pageToken.id}))==null?void 0:m.value)==null?void 0:T.value;ui(U);const z={Authorization:`Bearer ${await I.getAccessToken()}`},J=`${((g=I.env)==null?void 0:g.API_BASE_URL)+"/editor-runtime"}/v2/external-integrations/proxy/${I.projectId}/${Zt["google-drive"]}/${Z}`,ee=async(ce,be,{params:Ce,body:Ee,contentType:xe,providerHeaders:Le,responseType:Fe}={})=>{const tt=`${J}/${gRn(be)}`,We={...z};return xe&&(We["Content-Type"]=xe),(Le||Fe)&&(We[vRn]=JSON.stringify({...Le?{headers:Le}:{},...Fe?{responseType:Fe}:{}})),Ht({method:ce,url:tt,headers:We,params:Ce,data:Ee,responseType:Fe||"json"})},Q={supportsAllDrives:!0,fields:"nextPageToken,permissions(id,type,role,emailAddress,domain,displayName)"};Y!=null&&(Q.pageSize=Y),ie&&(Q.pageToken=ie);const re=await ee("GET",`/drive/v3/files/${H}/permissions`,{params:Q}),ae=((b=re.data)==null?void 0:b.data)??re.data,oe=(Array.isArray(ae==null?void 0:ae.permissions)?ae.permissions:[]).map(ce=>({id:(ce==null?void 0:ce.id)??"",type:(ce==null?void 0:ce.type)??"",role:(ce==null?void 0:ce.role)??"",emailAddress:(ce==null?void 0:ce.emailAddress)??"",domain:(ce==null?void 0:ce.domain)??"",displayName:(ce==null?void 0:ce.displayName)??""}));return{value:K.Success,error:null,result:{permissions:oe,nextPageToken:(ae==null?void 0:ae.nextPageToken)??""}}}catch(I){const A=((R=I.response)==null?void 0:R.data)||I.message||I;return bRn(t,typeof A=="object"?JSON.stringify(A):String(A))}}})}}const ERn="X-Elyx-Proxy-Config";function IRn(a){return a.startsWith("/")?a.slice(1):a}const RRn=(a,p)=>(pe.Logger.log("[Google Drive Update Permission] error:",p),{value:a.catchesError||a.errorCalls.length?K.CaughtError:K.UnhandledError,error:p,result:null});class ZAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleDriveUpdatePermission,version:"1.0.0",description:"Google Drive update permission operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleDriveUpdatePermission);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R;try{const I=this.extensionsRegistry.requestContexts(this,[te.Editor])[0],A=G.operation[X.GoogleDriveUpdatePermission],x=Be(t,t.project,"updatePermission"),O="["+Ve(t,t.project,"Update permission")+": `"+x+"`] ",$=n.find(be=>{var Ce,Ee;return((Ee=(Ce=be.valueOwner)==null?void 0:Ce.declaration)==null?void 0:Ee.id)===A.inputs.connection.id}),U=((s=$==null?void 0:$.value)==null?void 0:s.valueAsType)??((u=$==null?void 0:$.value)==null?void 0:u.value);if(!U||!U.id||!U.name||U.type!==r.DefinitionEntity)throw new Error(`${O}Invalid input "${Ve($==null?void 0:$.valueOwner,I==null?void 0:I.logic,"Connection")}" (\`${Be($==null?void 0:$.valueOwner,I==null?void 0:I.logic,"connection")}\`), expected a valid connection node.`);const Z=ui(U);if(!Z)throw new Error(`${O}The "${Ve($==null?void 0:$.valueOwner,I==null?void 0:I.logic,"Connection")}" (\`${Be($==null?void 0:$.valueOwner,I==null?void 0:I.logic,"connection")}\`) input is invalid, missing underlying Connection ID value.`);const j=n.find(be=>{var Ce,Ee;return((Ee=(Ce=be.valueOwner)==null?void 0:Ce.declaration)==null?void 0:Ee.id)===A.inputs.fileId.id}),H=(e=j==null?void 0:j.value)==null?void 0:e.value;if(!H||H==="")throw new Error(`${O}The "${Ve(j==null?void 0:j.valueOwner,I==null?void 0:I.logic,"File ID")}" (\`${Be(j==null?void 0:j.valueOwner,I==null?void 0:I.logic,"fileId")}\`) input is missing.`);if(typeof H!="string")throw new Error(`${O}The "${Ve(j==null?void 0:j.valueOwner,I==null?void 0:I.logic,"File ID")}" (\`${Be(j==null?void 0:j.valueOwner,I==null?void 0:I.logic,"fileId")}\`) input value is invalid, if present, it must be a non-empty string.`);const Y=n.find(be=>{var Ce,Ee;return((Ee=(Ce=be.valueOwner)==null?void 0:Ce.declaration)==null?void 0:Ee.id)===A.inputs.permissionId.id}),ie=(f=Y==null?void 0:Y.value)==null?void 0:f.value;if(!ie||ie==="")throw new Error(`${O}The "${Ve(Y==null?void 0:Y.valueOwner,I==null?void 0:I.logic,"Permission ID")}" (\`${Be(Y==null?void 0:Y.valueOwner,I==null?void 0:I.logic,"permissionId")}\`) input is missing.`);if(typeof ie!="string")throw new Error(`${O}The "${Ve(Y==null?void 0:Y.valueOwner,I==null?void 0:I.logic,"Permission ID")}" (\`${Be(Y==null?void 0:Y.valueOwner,I==null?void 0:I.logic,"permissionId")}\`) input value is invalid, if present, it must be a non-empty string.`);const W=n.find(be=>{var Ce,Ee;return((Ee=(Ce=be.valueOwner)==null?void 0:Ce.declaration)==null?void 0:Ee.id)===A.inputs.role.id}),z=(y=W==null?void 0:W.value)==null?void 0:y.value;if(!z||z==="")throw new Error(`${O}The "${Ve(W==null?void 0:W.valueOwner,I==null?void 0:I.logic,"Role")}" (\`${Be(W==null?void 0:W.valueOwner,I==null?void 0:I.logic,"role")}\`) input is missing.`);if(typeof z!="string")throw new Error(`${O}The "${Ve(W==null?void 0:W.valueOwner,I==null?void 0:I.logic,"Role")}" (\`${Be(W==null?void 0:W.valueOwner,I==null?void 0:I.logic,"role")}\`) input value is invalid, if present, it must be a non-empty string.`);const J=(T=(m=n.find(be=>{var Ce,Ee;return((Ee=(Ce=be.valueOwner)==null?void 0:Ce.declaration)==null?void 0:Ee.id)===A.inputs.transferOwnership.id}))==null?void 0:m.value)==null?void 0:T.value;ui(U);const Q={Authorization:`Bearer ${await I.getAccessToken()}`},re=`${((g=I.env)==null?void 0:g.API_BASE_URL)+"/editor-runtime"}/v2/external-integrations/proxy/${I.projectId}/${Zt["google-drive"]}/${Z}`,ae=async(be,Ce,{params:Ee,body:xe,contentType:Le,providerHeaders:Fe,responseType:tt}={})=>{const We=`${re}/${IRn(Ce)}`,et={...Q};return Le&&(et["Content-Type"]=Le),(Fe||tt)&&(et[ERn]=JSON.stringify({...Fe?{headers:Fe}:{},...tt?{responseType:tt}:{}})),Ht({method:be,url:We,headers:et,params:Ee,data:xe,responseType:tt||"json"})},le={supportsAllDrives:!0,fields:"id,type,role,emailAddress,domain,displayName"};J!=null&&(le.transferOwnership=J);const oe=await ae("PATCH",`/drive/v3/files/${H}/permissions/${ie}`,{params:le,body:{role:z},contentType:"application/json"}),ce=((b=oe.data)==null?void 0:b.data)??oe.data;return{value:K.Success,error:null,result:{id:(ce==null?void 0:ce.id)??ie,type:(ce==null?void 0:ce.type)??"",role:(ce==null?void 0:ce.role)??z,emailAddress:(ce==null?void 0:ce.emailAddress)??"",domain:(ce==null?void 0:ce.domain)??"",displayName:(ce==null?void 0:ce.displayName)??""}}}catch(I){const A=((R=I.response)==null?void 0:R.data)||I.message||I;return RRn(t,typeof A=="object"?JSON.stringify(A):String(A))}}})}}class HAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleGeminiGenerateContent,version:"1.0.0",description:"Send Gmail email operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleGeminiGenerateContent);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[te.Editor])[0],g=Be(t,t.project,"generateContent"),R="["+Ve(t,t.project,"Generate content")+": `"+g+"`] ",I=G.operation[X.GoogleGeminiGenerateContent],A=n.find(H=>{var Y,ie;return((ie=(Y=H.valueOwner)==null?void 0:Y.declaration)==null?void 0:ie.id)===I.inputs.connection.id}),x=((s=A==null?void 0:A.value)==null?void 0:s.valueAsType)??((u=A==null?void 0:A.value)==null?void 0:u.value);if(!x||!x.id||!x.name||x.type!==r.DefinitionEntity)throw new Error(`${R}Invalid input "${Ve(A==null?void 0:A.valueOwner,T==null?void 0:T.logic,"Connection")}" (\`${Be(A==null?void 0:A.valueOwner,T==null?void 0:T.logic,"connection")}\`), expected a valid connection node.`);const P=ui(x);if(!P)throw new Error(`${R}The "${Ve(A==null?void 0:A.valueOwner,T==null?void 0:T.logic,"Connection")}" (\`${Be(A==null?void 0:A.valueOwner,T==null?void 0:T.logic,"connection")}\`) input is invalid, missing underlying Connection ID value.`);const O=n.find(H=>{var Y,ie;return((ie=(Y=H.valueOwner)==null?void 0:Y.declaration)==null?void 0:ie.id)===I.inputs.prompt.id}),$=(e=O==null?void 0:O.value)==null?void 0:e.value;if($==null||$==="")throw new Error(`${R}The "${Ve(O==null?void 0:O.valueOwner,T==null?void 0:T.logic,"Prompt")}" (\`${Be(O==null?void 0:O.valueOwner,T==null?void 0:T.logic,"prompt")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${R}The "${Ve(O==null?void 0:O.valueOwner,T==null?void 0:T.logic,"Prompt")}" (\`${Be(O==null?void 0:O.valueOwner,T==null?void 0:T.logic,"prompt")}\`) input value is invalid, if present, it must be a non-empty string.`);const U=n.find(H=>{var Y,ie;return((ie=(Y=H.valueOwner)==null?void 0:Y.declaration)==null?void 0:ie.id)===I.inputs.model.id}),Z=(f=U==null?void 0:U.value)==null?void 0:f.value;if(Z==null||Z==="")throw new Error(`${R}The "${Ve(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"Model")}" (\`${Be(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"model")}\`) input is missing.`);if(typeof Z!="string")throw new Error(`${R}The "${Ve(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"Model")}" (\`${Be(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"model")}\`) input value is invalid, if present, it must be a non-empty string.`);ui(x),console.log("Triggering Google Gemini generate content action with connectionId:",P);const j=await(await Ht.post(`${(y=T.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v1/external-integrations/trigger-action/${Zt["google-gemini"]}/${P}/generate-content`,{payload:{prompt:$,model:Z}},{headers:{"Content-Type":"application/json",Authorization:`Bearer ${await T.getAccessToken()}`}})).data;return pe.Logger.log("[Google Gemini] Generate content action response:",j),{value:K.Success,error:null,result:{content:j.content}}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return pe.Logger.error("[Google Gemini] Generate content failed:",g),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:g,result:null}}}})}}class WAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsCreateSpreadsheet,version:"1.0.0",description:"Create Spreadsheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsCreateSpreadsheet);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f;try{const y=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!y||!y.env)throw new Error("Editor context or environment missing");const m=Be(t,t.project,"createSpreadsheet"),g="["+Ve(t,t.project,"Create spreadsheet")+": `"+m+"`] ",b=(ie,W,z)=>{const J=Ve(ie==null?void 0:ie.valueOwner,y==null?void 0:y.logic,W),ee=Be(ie==null?void 0:ie.valueOwner,y==null?void 0:y.logic,z);return`"${J}" (\`${ee}\`)`},R=n.find(ie=>{var W;return((W=ie.valueOwner.declaration)==null?void 0:W.id)===G.operation[X.GoogleSheetsCreateSpreadsheet].inputs.connection.id}),I=(s=R==null?void 0:R.value)==null?void 0:s.valueAsType;if(!I||!I.id||!I.name||I.type!==r.DefinitionEntity)throw new Error(`${g}The ${b(R,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const A=ui(I);if(!A)throw new Error(`${g}The ${b(R,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(ie=>{var W;return((W=ie.valueOwner.declaration)==null?void 0:W.id)===G.operation[X.GoogleSheetsCreateSpreadsheet].inputs.title.id}),P=(u=x==null?void 0:x.value)==null?void 0:u.value;if(P&&typeof P!="string")throw new Error(`${g}The ${b(x,"Title","title")} input value is invalid. If present, it must be a non-empty string. E.g. "My Spreadsheet"`);const $={Authorization:`Bearer ${await y.getAccessToken()}`},U=`${(e=y.env)==null?void 0:e.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${y.projectId}/${Zt["google-sheet"]}/${A}`,Z=async ie=>Ht.post(U,ie,{headers:$}),j={};P&&(j.properties={title:P});const Y=(await Z({method:"POST",endpoint:"/v4/spreadsheets",data:j})).data||{};return{value:K.Success,error:null,result:{spreadsheetId:Y.spreadsheetId,spreadsheetUrl:Y.spreadsheetUrl}}}catch(y){const m=((f=y.response)==null?void 0:f.data)||y.message||y;return pe.Logger.log("[Google Sheets] error:",m),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:m,result:null}}}})}}function QL(a){let p="",t=a;for(;t>0;){const n=(t-1)%26;p=String.fromCharCode(65+n)+p,t=Math.floor((t-n)/26)}return p}function DV(a){if(!/^[A-Z]{1,3}$/.test(a))return NaN;let p=0;for(let t=0;t<a.length;t++)p=p*26+(a.charCodeAt(t)-64);return p}function yA(a,p){const t=(p==null?void 0:p.errorPrefix)||"";if(typeof a!="string")throw new Error(`${t}Input must be a string.`);let n,s=a;if(a.includes("!")){const R=a.split("!");let I=R.slice(0,-1).join("!");s=R[R.length-1],I.startsWith("'")&&I.endsWith("'")&&(I=I.slice(1,-1)),n=I}const u=/^(\$?[A-Z]{1,3})?(\$?\d+)?(?::(\$?[A-Z]{1,3})?(\$?\d+)?)?$/i,e=s.match(u);if(!e)throw new Error(`${t}Invalid A1 notation format: ${a}`);const[f,y,m,T,g]=e,b={sheet:n};return y&&(b.startColumn=y.toUpperCase()),m&&(b.startRow=m),T&&(b.endColumn=T.toUpperCase()),g&&(b.endRow=g),b}function k4(a,p){const t=p!=null&&p.errorPrefix?p.errorPrefix:"",n=T=>{if(typeof T=="string"){const g=T.replace("$","");return/^\d+$/.test(g)?parseInt(g,10):NaN}return T},s=T=>{if(typeof T=="string"){const g=T.replace("$","").toUpperCase();return/^\d+$/.test(g)?parseInt(g,10):DV(g)}return T},u=n(a.startRow),e=n(a.endRow),f=s(a.startColumn),y=s(a.endColumn),m=T=>typeof T=="string"&&T.includes("{{")&&T.includes("}}");if(a.startRow!==void 0&&a.startRow!==null&&a.startRow!==""&&isNaN(u)&&!m(a.startRow))throw new Error(`${t}Start Row is invalid.`);if(a.endRow!==void 0&&a.endRow!==null&&a.endRow!==""&&isNaN(e)&&!m(a.endRow))throw new Error(`${t}End Row is invalid.`);if(a.startColumn!==void 0&&a.startColumn!==null&&a.startColumn!==""&&isNaN(f)&&!m(a.startColumn))throw new Error(`${t}Start Column is invalid.`);if(a.endColumn!==void 0&&a.endColumn!==null&&a.endColumn!==""&&isNaN(y)&&!m(a.endColumn))throw new Error(`${t}End Column is invalid.`);if(u!=null&&!isNaN(u)&&u<1)throw new Error(`${t}Start Row must be greater than or equal to 1.`);if(e!=null&&!isNaN(e)&&e<1)throw new Error(`${t}End Row must be greater than or equal to 1.`);if(f!=null&&!isNaN(f)&&f<1)throw new Error(`${t}Start Column must be greater than or equal to 1.`);if(y!=null&&!isNaN(y)&&y<1)throw new Error(`${t}End Column must be greater than or equal to 1.`);if(u!=null&&!isNaN(u)&&e!==void 0&&e!==null&&!isNaN(e)&&u>e)throw new Error(`${t}Start Row must be less than or equal to End Row.`);if(f!=null&&!isNaN(f)&&y!==void 0&&y!==null&&!isNaN(y)&&f>y)throw new Error(`${t}Start Column must be less than or equal to End Column.`);if(typeof a.sheet=="number"&&a.sheet<0)throw new Error(`${t}Sheet ID must be greater than or equal to 0.`)}async function Ha(a,p,t){if(!a)return a;let n=a;if(typeof a=="string"){const f=a.trim();if(f.startsWith("{"))try{n=new Function("return "+f)()}catch{try{n=JSON.parse(f)}catch{}}else try{n=yA(f,{errorPrefix:"Internal"})}catch{}}else if(typeof a=="object"&&a!==null)try{n=JSON.parse(JSON.stringify(a))}catch{n={...a}}if(n.sheet===void 0||n.sheet===null||n.sheet==="")return n;const s=typeof n.sheet=="string",u=typeof n.sheet=="number";if(p==="Name"&&s)return n;if(p==="Id"&&u)return n._resolvedSheetId=n.sheet,n;const e=n.sheet;try{const f=await t();for(const y of f){const m=y.id,T=y.name,g=String(T).trim().toLowerCase()===String(e).trim().toLowerCase(),b=String(m)===String(e);if(g||b)return n._resolvedSheetId=m,n._resolvedSheetName=T,n}}catch{}return n}function lv(a,p){if(!a)return"";if(typeof a=="string")return a;let t=a;if(typeof a=="string"&&a.trim().startsWith("{"))try{t=JSON.parse(a)}catch{}if(k4(t,p),t.namedRange&&t.namedRange.trim()!=="")return t.namedRange;const n=t._resolvedSheetName!==void 0?t._resolvedSheetName:typeof t.sheet=="string"?t.sheet:void 0,s=n?`'${n}'!`:"",u=R=>{if(typeof R=="number")return QL(R);if(typeof R=="string"){const I=R.replace("$","");if(/^\d+$/.test(I))return(R.startsWith("$")?"$":"")+QL(parseInt(I,10))}return R||""},e=u(t.startColumn),f=typeof t.startRow=="number"?t.startRow.toString():t.startRow||"",y=u(t.endColumn),m=typeof t.endRow=="number"?t.endRow.toString():t.endRow||"",T=`${e}${f}`,g=`${y}${m}`;if(T&&g)return`${s}${T}:${g}`;if(T)return`${s}${T}`;const b=s.replace(/!$/,"");return b||"A1"}function ps(a,p){if(!a)return{};let t=a;if(typeof a=="string"){const g=a.trim();if(g.startsWith("{"))try{t=new Function("return "+g)()}catch{try{t=JSON.parse(g)}catch{}}else try{t=yA(g,p)}catch{}}k4(t,p);const n={},s=t._resolvedSheetId!==void 0?t._resolvedSheetId:typeof t.sheet=="number"?t.sheet:/^\d+$/.test(String(t.sheet||""))?Number(t.sheet):void 0;s!=null&&!isNaN(s)&&(n.sheetId=s);const u=g=>{if(g==null)return null;if(typeof g=="string"){const b=g.trim().replace("$","");return b===""?null:/^\d+$/.test(b)?parseInt(b,10):NaN}return typeof g=="number"?g:null},e=g=>{if(g==null)return null;if(typeof g=="string"){const b=g.trim().replace("$","").toUpperCase();return b===""?null:/^\d+$/.test(b)?parseInt(b,10):DV(b)}return typeof g=="number"?g:null},f=u(t.startRow),y=u(t.endRow),m=e(t.startColumn),T=e(t.endColumn);return f!=null&&(n.startRowIndex=f-1),y!=null&&(n.endRowIndex=y),m!=null&&(n.startColumnIndex=m-1),T!=null&&(n.endColumnIndex=T),n}function XL(a,p){if(!a)return{};let t=a;if(typeof a=="string")if(a.trim().startsWith("{"))try{t=JSON.parse(a)}catch{t=yA(a,{errorPrefix:"Internal"})}else t=yA(a,{errorPrefix:"Internal"});k4(t,p);const n={},s=t._resolvedSheetId!==void 0?t._resolvedSheetId:typeof t.sheet=="number"?t.sheet:void 0;s!=null&&(n.sheetId=s);const u=g=>{if(g==null)return null;if(typeof g=="string"){const b=g.trim().replace("$","");return b===""?null:/^\d+$/.test(b)?parseInt(b,10):NaN}return typeof g=="number"?g:null},e=g=>{if(g==null)return null;if(typeof g=="string"){const b=g.trim().replace("$","").toUpperCase();return b===""?null:/^\d+$/.test(b)?parseInt(b,10):DV(b)}return typeof g=="number"?g:null},f=u(t.startRow),y=u(t.endRow),m=e(t.startColumn),T=e(t.endColumn);return f!=null&&(!isNaN(f)||y===null&&m===null&&T===null)?(n.dimension="ROWS",n.startIndex=isNaN(f)?NaN:f-1,y!=null?n.endIndex=y:n.endIndex=isNaN(f)?NaN:f):m!=null?(n.dimension="COLUMNS",n.startIndex=isNaN(m)?NaN:m-1,T!=null?n.endIndex=T:n.endIndex=isNaN(m)?NaN:m):f!=null&&(n.dimension="ROWS",n.startIndex=isNaN(f)?NaN:f-1,y!=null?n.endIndex=y:n.endIndex=isNaN(f)?NaN:f),n}function ln(a,p){const t=(p==null?void 0:p.errorPrefix)||"";if(typeof a!="string")throw new Error(`${t}Spreadsheet ID must be a string.`);const n=a.trim();if(n.length===0)throw new Error(`${t}Spreadsheet ID cannot be empty.`);if(n.includes("docs.google.com")||n.startsWith("http://")||n.startsWith("https://")||n.startsWith("www.google.com")){const u=n.match(/\/spreadsheets\/d\/e\/([a-zA-Z0-9-_]+)/);if(u&&u[1])return u[1];const e=n.match(/\/spreadsheets\/d\/([a-zA-Z0-9-_]+)/);if(e&&e[1])return e[1];throw new Error(`${t}Invalid Google Sheet URL format. Could not extract a valid Spreadsheet ID from the URL.`)}if(n.includes(" "))throw new Error(`${t}Spreadsheet ID cannot contain spaces.`);if(/[^a-zA-Z0-9-_]/.test(n))throw new Error(`${t}Spreadsheet ID contains invalid characters. Only alphanumeric characters, dashes, and underscores are allowed.`);return n}function zAt(a){if(!a)return"A1";const p=lv(a);if(!p)return"A1";const t=p.split("!");return t[t.length-1].trim().split(":")[0].trim().replace(/\$/g,"")||"A1"}function U4(a,p,t){if(!p){const f=XL(a,t);return f?[f]:[]}const n=ps(a,t),s=n.sheetId,u=f=>{const y={dimension:f};return s!=null&&(y.sheetId=s),f==="COLUMNS"?(n.startColumnIndex!==void 0&&n.startColumnIndex!==null&&(y.startIndex=n.startColumnIndex),n.endColumnIndex!==void 0&&n.endColumnIndex!==null&&(y.endIndex=n.endColumnIndex)):(n.startRowIndex!==void 0&&n.startRowIndex!==null&&(y.startIndex=n.startRowIndex),n.endRowIndex!==void 0&&n.endRowIndex!==null&&(y.endIndex=n.endRowIndex)),y},e=String(p).trim().toUpperCase();return e==="COLUMNS"?[u("COLUMNS")]:e==="ROWS"?[u("ROWS")]:e==="BOTH"?[u("COLUMNS"),u("ROWS")]:[XL(a,t)]}class YAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsGetSpreadsheet,version:"1.0.0",description:"Get Spreadsheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsGetSpreadsheet);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g;try{const b=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!b||!b.env)throw new Error("Editor context or environment missing");const R=Be(t,t.project,"getSpreadsheet"),A="["+Ve(t,t.project,"Get spreadsheet")+": `"+R+"`] ",x=(Q,re,ae)=>{const le=Ve(Q==null?void 0:Q.valueOwner,b==null?void 0:b.logic,re),oe=Be(Q==null?void 0:Q.valueOwner,b==null?void 0:b.logic,ae);return`"${le}" (\`${oe}\`)`},P=n.find(Q=>{var re;return((re=Q.valueOwner.declaration)==null?void 0:re.id)===G.operation[X.GoogleSheetsGetSpreadsheet].inputs.connection.id}),O=(s=P==null?void 0:P.value)==null?void 0:s.valueAsType;if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${A}The ${x(P,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const $=ui(O);if(!$)throw new Error(`${A}The ${x(P,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const U=n.find(Q=>{var re;return((re=Q.valueOwner.declaration)==null?void 0:re.id)===G.operation[X.GoogleSheetsGetSpreadsheet].inputs.spreadsheetId.id}),Z=(u=U==null?void 0:U.value)==null?void 0:u.value,j=ln(Z,{errorPrefix:`${A}The ${x(U,"Spreadsheet ID","spreadsheetId")} input `}),Y={Authorization:`Bearer ${await b.getAccessToken()}`},ie=`${(e=b.env)==null?void 0:e.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${b.projectId}/${Zt["google-sheet"]}/${$}`,J=(await(async Q=>Ht.post(ie,Q,{headers:Y}))({method:"GET",endpoint:`/v4/spreadsheets/${j}`})).data||{},ee=(J.sheets||[]).map(Q=>{var re,ae,le,oe,ce,be,Ce,Ee,xe,Le,Fe,tt,We;return{sheetId:(re=Q.properties)==null?void 0:re.sheetId,title:(ae=Q.properties)==null?void 0:ae.title,index:(le=Q.properties)==null?void 0:le.index,sheetType:(oe=Q.properties)==null?void 0:oe.sheetType,rowCount:(be=(ce=Q.properties)==null?void 0:ce.gridProperties)==null?void 0:be.rowCount,columnCount:(Ee=(Ce=Q.properties)==null?void 0:Ce.gridProperties)==null?void 0:Ee.columnCount,frozenRowCount:(Le=(xe=Q.properties)==null?void 0:xe.gridProperties)==null?void 0:Le.frozenRowCount,frozenColumnCount:(tt=(Fe=Q.properties)==null?void 0:Fe.gridProperties)==null?void 0:tt.frozenColumnCount,hidden:((We=Q.properties)==null?void 0:We.hidden)??!1}});return{value:K.Success,error:null,result:{spreadsheetId:J.spreadsheetId,title:(f=J.properties)==null?void 0:f.title,spreadsheetUrl:J.spreadsheetUrl,locale:(y=J.properties)==null?void 0:y.locale,timeZone:(m=J.properties)==null?void 0:m.timeZone,autoRecalc:(T=J.properties)==null?void 0:T.autoRecalc,sheets:ee}}}catch(b){const R=((g=b.response)==null?void 0:g.data)||b.message||b;return pe.Logger.log("[Google Sheets] error:",R),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:R,result:null}}}})}}class JAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsAddSheet,version:"1.0.0",description:"Add Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsAddSheet);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g;try{const b=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!b||!b.env)throw new Error("Editor context or environment missing");const R=Be(t,t.project,"addSheet"),A="["+Ve(t,t.project,"Add sheet")+": `"+R+"`] ",x=(oe,ce,be)=>{const Ce=Ve(oe==null?void 0:oe.valueOwner,b==null?void 0:b.logic,ce),Ee=Be(oe==null?void 0:oe.valueOwner,b==null?void 0:b.logic,be);return`"${Ce}" (\`${Ee}\`)`},P=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[X.GoogleSheetsAddSheet].inputs.connection.id}),O=(s=P==null?void 0:P.value)==null?void 0:s.valueAsType;if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${A}The ${x(P,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const $=ui(O);if(!$)throw new Error(`${A}The ${x(P,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const U=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[X.GoogleSheetsAddSheet].inputs.spreadsheetId.id}),Z=(u=U==null?void 0:U.value)==null?void 0:u.value,j=ln(Z,{errorPrefix:`${A}The ${x(U,"Spreadsheet ID","spreadsheetId")} input `}),H=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[X.GoogleSheetsAddSheet].inputs.title.id}),Y=(e=H==null?void 0:H.value)==null?void 0:e.value;if(Y!=null&&typeof Y!="string")throw new Error(`${A}The ${x(H,"Title","title")} input value is invalid. If present, it must be a string. E.g. "New Sheet"`);const W={Authorization:`Bearer ${await b.getAccessToken()}`},z=`${(f=b.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${b.projectId}/${Zt["google-sheet"]}/${$}`,re=((T=(m=(y=((await(async oe=>Ht.post(z,oe,{headers:W}))({method:"POST",endpoint:`/v4/spreadsheets/${j}:batchUpdate`,data:{requests:[{addSheet:{properties:{title:Y}}}]}})).data||{}).replies)==null?void 0:y[0])==null?void 0:m.addSheet)==null?void 0:T.properties)||{},ae=re.gridProperties||{},le={sheetId:re.sheetId,title:re.title,index:re.index,sheetType:re.sheetType,rowCount:ae.rowCount,columnCount:ae.columnCount,frozenRowCount:ae.frozenRowCount,frozenColumnCount:ae.frozenColumnCount,hideGridlines:ae.hideGridlines??!1,rowGroupControlAfter:ae.rowGroupControlAfter??!1,columnGroupControlAfter:ae.columnGroupControlAfter??!1,hidden:re.hidden??!1,rightToLeft:re.rightToLeft??!1,tabColor:re.tabColor?{red:re.tabColor.red??0,green:re.tabColor.green??0,blue:re.tabColor.blue??0,alpha:re.tabColor.alpha??1}:null,basicFilter:null,protectedRanges:[],bandedRanges:[],charts:[],conditionalFormatRules:[],mergedCells:[]};return{value:K.Success,error:null,result:le}}catch(b){const R=((g=b.response)==null?void 0:g.data)||b.message||b;return pe.Logger.log("[Google Sheets] error:",R),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:R,result:null}}}})}}class QAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsDeleteSheet,version:"1.0.0",description:"Delete Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsDeleteSheet);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T;try{const g=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!g||!g.env)throw new Error("Editor context or environment missing");const b=Be(t,t.project,"deleteSheet"),I="["+Ve(t,t.project,"Delete sheet")+": `"+b+"`] ",A=(ee,Q,re)=>{const ae=Ve(ee==null?void 0:ee.valueOwner,g==null?void 0:g.logic,Q),le=Be(ee==null?void 0:ee.valueOwner,g==null?void 0:g.logic,re);return`"${ae}" (\`${le}\`)`},x=n.find(ee=>{var Q;return((Q=ee.valueOwner.declaration)==null?void 0:Q.id)===G.operation[X.GoogleSheetsDeleteSheet].inputs.connection.id}),P=(s=x==null?void 0:x.value)==null?void 0:s.valueAsType;if(!P||!P.id||!P.name||P.type!==r.DefinitionEntity)throw new Error(`${I}The ${A(x,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(P);if(!O)throw new Error(`${I}The ${A(x,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const $=n.find(ee=>{var Q;return((Q=ee.valueOwner.declaration)==null?void 0:Q.id)===G.operation[X.GoogleSheetsDeleteSheet].inputs.spreadsheetId.id}),U=(u=$==null?void 0:$.value)==null?void 0:u.value,Z=ln(U,{errorPrefix:`${I}The ${A($,"Spreadsheet ID","spreadsheetId")} input `}),j=n.find(ee=>{var Q;return((Q=ee.valueOwner.declaration)==null?void 0:Q.id)===G.operation[X.GoogleSheetsDeleteSheet].inputs.sheetId.id}),H=(e=j==null?void 0:j.value)==null?void 0:e.value;if(H==null||H==="")throw new Error(`${I}The ${A(j,"Sheet (ID or name)","sheetId")} input is missing.`);const ie={Authorization:`Bearer ${await g.getAccessToken()}`},W=`${(f=g.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${g.projectId}/${Zt["google-sheet"]}/${O}`,z=async ee=>Ht.post(W,ee,{headers:ie});let J;if(typeof H=="number")J=H;else if(typeof H=="string"){const ee=H.trim(),Q=await z({method:"GET",endpoint:`/v4/spreadsheets/${Z}?fields=sheets.properties(sheetId,title)`}).catch(()=>null),ae=(((y=Q==null?void 0:Q.data)==null?void 0:y.sheets)||[]).find(le=>{var oe,ce;return((oe=le.properties)==null?void 0:oe.title)===ee||String((ce=le.properties)==null?void 0:ce.sheetId)===ee});if(ae&&((m=ae.properties)==null?void 0:m.sheetId)!==void 0)J=ae.properties.sheetId;else if(/^\d+$/.test(ee))J=parseInt(ee,10);else throw new Error(`${I}Sheet "${H}" was not found in the spreadsheet.`)}else throw new Error(`${I}The ${A(j,"Sheet (ID or name)","sheetId")} input value is invalid. It must be a number or string.`);return await z({method:"POST",endpoint:`/v4/spreadsheets/${Z}:batchUpdate`,data:{requests:[{deleteSheet:{sheetId:J}}]}}),{value:K.Success,error:null,result:null}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return pe.Logger.log("[Google Sheets] error:",b),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:b,result:null}}}})}}class XAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsAppendRows,version:"1.0.0",description:"Append Row(s) Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsAppendRows);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T;try{const g=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!g||!g.env)throw new Error("Editor context or environment missing");const b=Be(t,t.project,"appendRows"),I="["+Ve(t,t.project,"Append rows")+": `"+b+"`] ",A=(oe,ce,be)=>{const Ce=Ve(oe==null?void 0:oe.valueOwner,g==null?void 0:g.logic,ce),Ee=Be(oe==null?void 0:oe.valueOwner,g==null?void 0:g.logic,be);return`"${Ce}" (\`${Ee}\`)`},x=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[X.GoogleSheetsAppendRows].inputs.connection.id}),P=(s=x==null?void 0:x.value)==null?void 0:s.valueAsType;if(!P||!P.id||!P.name||P.type!==r.DefinitionEntity)throw new Error(`${I}The ${A(x,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(P);if(!O)throw new Error(`${I}The ${A(x,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const $=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[X.GoogleSheetsAppendRows].inputs.spreadsheetId.id}),U=(u=$==null?void 0:$.value)==null?void 0:u.value,Z=ln(U,{errorPrefix:`${I}The ${A($,"Spreadsheet ID","spreadsheetId")} input `}),j=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[X.GoogleSheetsAppendRows].inputs.range.id}),H=(e=j==null?void 0:j.value)==null?void 0:e.value;if(!H||H==="")throw new Error(`${I}The ${A(j,"Range","range")} input is missing.`);const Y=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[X.GoogleSheetsAppendRows].inputs.values.id}),ie=(f=Y==null?void 0:Y.value)==null?void 0:f.value;if(ie==null)throw new Error(`${I}The ${A(Y,"Values","values")} input is missing.`);const 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}/${Zt["google-sheet"]}/${O}`,ee=async oe=>Ht.post(J,oe,{headers:z});let Q=ie;if(typeof ie=="string")try{Q=JSON.parse(ie)}catch{}const re=await Ha(H,"Name",async()=>{var ce;return(((ce=(await ee({method:"GET",endpoint:`/v4/spreadsheets/${Z}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:ce.sheets)||[]).map(be=>{var Ce,Ee;return{id:(Ce=be.properties)==null?void 0:Ce.sheetId,name:(Ee=be.properties)==null?void 0:Ee.title}})}),le=(await ee({method:"POST",endpoint:`/v4/spreadsheets/${Z}/values/${lv(re,{errorPrefix:`${I}The ${A(j,"Range","range")} input `})}:append`,params:{valueInputOption:"USER_ENTERED"},data:{values:Array.isArray(Q)?Q:[Q]}})).data||{};return{value:K.Success,error:null,result:{updatedRange:(m=le.updates)==null?void 0:m.updatedRange}}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return pe.Logger.log("[Google Sheets] error:",b),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:b,result:null}}}})}}class e1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsGetRangeValues,version:"1.0.0",description:"Get Range Values Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsGetRangeValues);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"getRangeValues"),b="["+Ve(t,t.project,"Get range values")+": `"+T+"`] ",R=(Q,re,ae)=>{const le=Ve(Q==null?void 0:Q.valueOwner,m==null?void 0:m.logic,re),oe=Be(Q==null?void 0:Q.valueOwner,m==null?void 0:m.logic,ae);return`"${le}" (\`${oe}\`)`},I=n.find(Q=>{var re;return((re=Q.valueOwner.declaration)==null?void 0:re.id)===G.operation[X.GoogleSheetsGetRangeValues].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=ui(A);if(!x)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(Q=>{var re;return((re=Q.valueOwner.declaration)==null?void 0:re.id)===G.operation[X.GoogleSheetsGetRangeValues].inputs.spreadsheetId.id}),O=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(O,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(Q=>{var re;return((re=Q.valueOwner.declaration)==null?void 0:re.id)===G.operation[X.GoogleSheetsGetRangeValues].inputs.range.id}),Z=(e=U==null?void 0:U.value)==null?void 0:e.value;if(!Z||Z==="")throw new Error(`${b}The ${R(U,"Range","range")} input is missing.`);const H={Authorization:`Bearer ${await m.getAccessToken()}`},Y=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${x}`,ie=async Q=>Ht.post(Y,Q,{headers:H}),W=await Ha(Z,"Name",async()=>{var re;return(((re=(await ie({method:"GET",endpoint:`/v4/spreadsheets/${$}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:re.sheets)||[]).map(ae=>{var le,oe;return{id:(le=ae.properties)==null?void 0:le.sheetId,name:(oe=ae.properties)==null?void 0:oe.title}})}),z=lv(W,{errorPrefix:`${b}The ${R(U,"Range","range")} input `}),ee=(await ie({method:"GET",endpoint:`/v4/spreadsheets/${$}/values/${encodeURIComponent(z)}`})).data||{};return{value:K.Success,error:null,result:{values:ee.values}}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class t1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsUpdateRangeValues,version:"1.0.0",description:"Update Range Values Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsUpdateRangeValues);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=Be(t,t.project,"updateRangeValues"),R="["+Ve(t,t.project,"Update range values")+": `"+g+"`] ",I=(le,oe,ce)=>{const be=Ve(le==null?void 0:le.valueOwner,T==null?void 0:T.logic,oe),Ce=Be(le==null?void 0:le.valueOwner,T==null?void 0:T.logic,ce);return`"${be}" (\`${Ce}\`)`},A=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[X.GoogleSheetsUpdateRangeValues].inputs.connection.id}),x=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!x||!x.id||!x.name||x.type!==r.DefinitionEntity)throw new Error(`${R}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const P=ui(x);if(!P)throw new Error(`${R}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const O=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[X.GoogleSheetsUpdateRangeValues].inputs.spreadsheetId.id}),$=(u=O==null?void 0:O.value)==null?void 0:u.value,U=ln($,{errorPrefix:`${R}The ${I(O,"Spreadsheet ID","spreadsheetId")} input `}),Z=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[X.GoogleSheetsUpdateRangeValues].inputs.range.id}),j=(e=Z==null?void 0:Z.value)==null?void 0:e.value;if(!j||j==="")throw new Error(`${R}The ${I(Z,"Range","range")} input is missing.`);const H=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[X.GoogleSheetsUpdateRangeValues].inputs.values.id}),Y=(f=H==null?void 0:H.value)==null?void 0:f.value;if(Y==null)throw new Error(`${R}The ${I(H,"Values","values")} input is missing.`);const W={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}/${Zt["google-sheet"]}/${P}`,J=async le=>Ht.post(z,le,{headers:W});let ee=Y;if(typeof Y=="string")try{ee=JSON.parse(Y)}catch{}const Q=await Ha(j,"Name",async()=>{var oe;return(((oe=(await J({method:"GET",endpoint:`/v4/spreadsheets/${U}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:oe.sheets)||[]).map(ce=>{var be,Ce;return{id:(be=ce.properties)==null?void 0:be.sheetId,name:(Ce=ce.properties)==null?void 0:Ce.title}})}),ae=(await J({method:"PUT",endpoint:`/v4/spreadsheets/${U}/values/${lv(Q,{errorPrefix:`${R}The ${I(Z,"Range","range")} input `})}`,params:{valueInputOption:"USER_ENTERED"},data:{values:Array.isArray(ee)?ee:[ee]}})).data||{};return{value:K.Success,error:null,result:{updatedRange:ae.updatedRange}}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return pe.Logger.log("[Google Sheets] error:",g),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:g,result:null}}}})}}class i1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsClearRange,version:"1.0.0",description:"Clear Range Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsClearRange);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"clearRange"),b="["+Ve(t,t.project,"Clear range")+": `"+T+"`] ",R=(ee,Q,re)=>{const ae=Ve(ee==null?void 0:ee.valueOwner,m==null?void 0:m.logic,Q),le=Be(ee==null?void 0:ee.valueOwner,m==null?void 0:m.logic,re);return`"${ae}" (\`${le}\`)`},I=n.find(ee=>{var Q;return((Q=ee.valueOwner.declaration)==null?void 0:Q.id)===G.operation[X.GoogleSheetsClearRange].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=ui(A);if(!x)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(ee=>{var Q;return((Q=ee.valueOwner.declaration)==null?void 0:Q.id)===G.operation[X.GoogleSheetsClearRange].inputs.spreadsheetId.id}),O=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(O,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(ee=>{var Q;return((Q=ee.valueOwner.declaration)==null?void 0:Q.id)===G.operation[X.GoogleSheetsClearRange].inputs.range.id}),Z=(e=U==null?void 0:U.value)==null?void 0:e.value;if(!Z||Z==="")throw new Error(`${b}The ${R(U,"Range","range")} input is missing.`);const H={Authorization:`Bearer ${await m.getAccessToken()}`},Y=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${x}`,ie=async ee=>Ht.post(Y,ee,{headers:H}),W=await Ha(Z,"Name",async()=>{var Q;return(((Q=(await ie({method:"GET",endpoint:`/v4/spreadsheets/${$}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:Q.sheets)||[]).map(re=>{var ae,le;return{id:(ae=re.properties)==null?void 0:ae.sheetId,name:(le=re.properties)==null?void 0:le.title}})}),J=(await ie({method:"POST",endpoint:`/v4/spreadsheets/${$}/values/${lv(W,{errorPrefix:`${b}The ${R(U,"Range","range")} input `})}:clear`,data:{}})).data||{};return{value:K.Success,error:null,result:{clearedRange:J.clearedRange}}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class n1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsBatchUpdateSpreadsheet,version:"1.0.0",description:"Batch Update Spreadsheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsBatchUpdateSpreadsheet);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"batchUpdateSpreadsheet"),b="["+Ve(t,t.project,"Batch update spreadsheet")+": `"+T+"`] ",R=(ee,Q,re)=>{const ae=Ve(ee==null?void 0:ee.valueOwner,m==null?void 0:m.logic,Q),le=Be(ee==null?void 0:ee.valueOwner,m==null?void 0:m.logic,re);return`"${ae}" (\`${le}\`)`},I=n.find(ee=>{var Q;return((Q=ee.valueOwner.declaration)==null?void 0:Q.id)===G.operation[X.GoogleSheetsBatchUpdateSpreadsheet].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=ui(A);if(!x)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(ee=>{var Q;return((Q=ee.valueOwner.declaration)==null?void 0:Q.id)===G.operation[X.GoogleSheetsBatchUpdateSpreadsheet].inputs.spreadsheetId.id}),O=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(O,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(ee=>{var Q;return((Q=ee.valueOwner.declaration)==null?void 0:Q.id)===G.operation[X.GoogleSheetsBatchUpdateSpreadsheet].inputs.requests.id}),Z=(e=U==null?void 0:U.value)==null?void 0:e.value;if(Z==null||Z==="")throw new Error(`${b}The ${R(U,"Requests","requests")} input is missing.`);let j=Z;if(typeof Z=="string")try{j=JSON.parse(Z)}catch{}if(Array.isArray(j)||(j=[j]),j.length===0)throw new Error(`${b}The ${R(U,"Requests","requests")} input evaluated to an empty array. E.g. [{ addSheet: { properties: { title: "New Sheet" } } }]`);const Y={Authorization:`Bearer ${await m.getAccessToken()}`},ie=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${x}`,J=(await(async ee=>Ht.post(ie,ee,{headers:Y}))({method:"POST",endpoint:`/v4/spreadsheets/${$}:batchUpdate`,data:{requests:j}})).data||{};return{value:K.Success,result:{replies:J.replies||[]},error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class r1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsRenameSheet,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsRenameSheet);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g;try{const b=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!b||!b.env)throw new Error("Editor context or environment missing");const R=Be(t,t.project,"renameSheet"),A="["+Ve(t,t.project,"Rename sheet")+": `"+R+"`] ",x=(oe,ce,be)=>{const Ce=Ve(oe==null?void 0:oe.valueOwner,b==null?void 0:b.logic,ce),Ee=Be(oe==null?void 0:oe.valueOwner,b==null?void 0:b.logic,be);return`"${Ce}" (\`${Ee}\`)`},P=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[X.GoogleSheetsRenameSheet].inputs.connection.id}),O=(s=P==null?void 0:P.value)==null?void 0:s.valueAsType;if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${A}The ${x(P,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const $=ui(O);if(!$)throw new Error(`${A}The ${x(P,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const U=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[X.GoogleSheetsRenameSheet].inputs.spreadsheetId.id}),Z=(u=U==null?void 0:U.value)==null?void 0:u.value,j=ln(Z,{errorPrefix:`${A}The ${x(U,"Spreadsheet ID","spreadsheetId")} input `}),H=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[X.GoogleSheetsRenameSheet].inputs.sheetId.id}),Y=(e=H==null?void 0:H.value)==null?void 0:e.value;if(Y==null||Y==="")throw new Error(`${A}The ${x(H,"Sheet (ID or name)","sheetId")} input is missing.`);const ie=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[X.GoogleSheetsRenameSheet].inputs.title.id}),W=(f=ie==null?void 0:ie.value)==null?void 0:f.value;if(W!=null&&typeof W!="string")throw new Error(`${A}The ${x(ie,"Title","title")} input value is invalid, if present, it must be a string.`);const J={Authorization:`Bearer ${await b.getAccessToken()}`},ee=`${(y=b.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${b.projectId}/${Zt["google-sheet"]}/${$}`,Q=async oe=>Ht.post(ee,oe,{headers:J});let re;if(typeof Y=="number")re=Y;else if(typeof Y=="string"){const oe=Y.trim(),ce=await Q({method:"GET",endpoint:`/v4/spreadsheets/${j}?fields=sheets.properties(sheetId,title)`}).catch(()=>null),Ce=(((m=ce==null?void 0:ce.data)==null?void 0:m.sheets)||[]).find(Ee=>{var xe,Le;return((xe=Ee.properties)==null?void 0:xe.title)===oe||String((Le=Ee.properties)==null?void 0:Le.sheetId)===oe});if(Ce&&((T=Ce.properties)==null?void 0:T.sheetId)!==void 0)re=Ce.properties.sheetId;else if(/^\d+$/.test(oe))re=parseInt(oe,10);else throw new Error(`${A}Sheet "${Y}" was not found in the spreadsheet.`)}else throw new Error(`${A}The ${x(H,"Sheet (ID or name)","sheetId")} input value is invalid. It must be a number or string.`);const ae={sheetId:re},le=[];return ae.title=W||"",le.push("title"),await Q({method:"POST",endpoint:`/v4/spreadsheets/${j}:batchUpdate`,data:{requests:[{updateSheetProperties:{properties:ae,fields:le.join(",")}}]}}),{value:K.Success,result:null,error:null}}catch(b){const R=((g=b.response)==null?void 0:g.data)||b.message||b;return pe.Logger.log("[Google Sheets] error:",R),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:R,result:null}}}})}}class a1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsCopySheet,version:"1.0.0",description:"Copy Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsCopySheet);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b;try{const R=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!R||!R.env)throw new Error("Editor context or environment missing");const I=Be(t,t.project,"copySheet"),x="["+Ve(t,t.project,"Copy sheet")+": `"+I+"`] ",P=(xe,Le,Fe)=>{const tt=Ve(xe==null?void 0:xe.valueOwner,R==null?void 0:R.logic,Le),We=Be(xe==null?void 0:xe.valueOwner,R==null?void 0:R.logic,Fe);return`"${tt}" (\`${We}\`)`},O=n.find(xe=>{var Le;return((Le=xe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[X.GoogleSheetsCopySheet].inputs.connection.id}),$=(s=O==null?void 0:O.value)==null?void 0:s.valueAsType;if(!$||!$.id||!$.name||$.type!==r.DefinitionEntity)throw new Error(`${x}The ${P(O,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const U=ui($);if(!U)throw new Error(`${x}The ${P(O,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const Z=n.find(xe=>{var Le;return((Le=xe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[X.GoogleSheetsCopySheet].inputs.spreadsheetId.id}),j=(u=Z==null?void 0:Z.value)==null?void 0:u.value,H=ln(j,{errorPrefix:`${x}The ${P(Z,"Spreadsheet ID","spreadsheetId")} input `}),Y=n.find(xe=>{var Le;return((Le=xe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[X.GoogleSheetsCopySheet].inputs.sheetId.id}),ie=(e=Y==null?void 0:Y.value)==null?void 0:e.value;if(ie==null||ie==="")throw new Error(`${x}The ${P(Y,"Sheet (ID or name)","sheetId")} input is missing.`);const W=n.find(xe=>{var Le;return((Le=xe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[X.GoogleSheetsCopySheet].inputs.destinationSpreadsheetId.id}),z=(f=W==null?void 0:W.value)==null?void 0:f.value;let J=H;if(z!=null&&String(z).trim()!==""){if(typeof z!="string")throw new Error(`${x}The ${P(W,"Destination Spreadsheet ID","destinationSpreadsheetId")} input value is invalid, if present, it must be a string.`);J=ln(z,{errorPrefix:`${x}The ${P(W,"Destination Spreadsheet ID","destinationSpreadsheetId")} input `})}const ee=n.find(xe=>{var Le;return((Le=xe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[X.GoogleSheetsCopySheet].inputs.newSheetName.id}),Q=(y=ee==null?void 0:ee.value)==null?void 0:y.value;if(Q!=null&&typeof Q!="string")throw new Error(`${x}The ${P(ee,"New Sheet Name","newSheetName")} input value is invalid, if present, it must be a string.`);const ae={Authorization:`Bearer ${await R.getAccessToken()}`},le=`${(m=R.env)==null?void 0:m.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${R.projectId}/${Zt["google-sheet"]}/${U}`,oe=async xe=>Ht.post(le,xe,{headers:ae});let ce;if(typeof ie=="number")ce=ie;else if(typeof ie=="string"){const xe=ie.trim(),Le=await oe({method:"GET",endpoint:`/v4/spreadsheets/${H}?fields=sheets.properties(sheetId,title)`}).catch(()=>null),tt=(((T=Le==null?void 0:Le.data)==null?void 0:T.sheets)||[]).find(We=>{var et,qe;return((et=We.properties)==null?void 0:et.title)===xe||String((qe=We.properties)==null?void 0:qe.sheetId)===xe});if(tt&&((g=tt.properties)==null?void 0:g.sheetId)!==void 0)ce=tt.properties.sheetId;else if(/^\d+$/.test(xe))ce=parseInt(xe,10);else throw new Error(`${x}Sheet "${ie}" was not found in the source spreadsheet.`)}else throw new Error(`${x}The ${P(Y,"Sheet (ID or name)","sheetId")} input value is invalid. It must be a number or string.`);const Ee=((await oe({method:"POST",endpoint:`/v4/spreadsheets/${H}/sheets/${ce}:copyTo`,data:{destinationSpreadsheetId:J}})).data||{}).sheetId;return Q&&typeof Q=="string"&&Q.trim()!==""&&await oe({method:"POST",endpoint:`/v4/spreadsheets/${J}:batchUpdate`,data:{requests:[{updateSheetProperties:{properties:{sheetId:Ee,title:Q.trim()},fields:"title"}}]}}),{value:K.Success,result:{newSheetId:Ee},error:null}}catch(R){const I=((b=R.response)==null?void 0:b.data)||R.message||R;return pe.Logger.log("[Google Sheets] error:",I),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:I,result:null}}}})}}class s1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsClearSheet,version:"1.0.0",description:"Clear Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsClearSheet);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b;try{const R=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!R||!R.env)throw new Error("Editor context or environment missing");const I=Be(t,t.project,"clearSheet"),x="["+Ve(t,t.project,"Clear sheet")+": `"+I+"`] ",P=(le,oe,ce)=>{const be=Ve(le==null?void 0:le.valueOwner,R==null?void 0:R.logic,oe),Ce=Be(le==null?void 0:le.valueOwner,R==null?void 0:R.logic,ce);return`"${be}" (\`${Ce}\`)`},O=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[X.GoogleSheetsClearSheet].inputs.connection.id}),$=(s=O==null?void 0:O.value)==null?void 0:s.valueAsType;if(!$||!$.id||!$.name||$.type!==r.DefinitionEntity)throw new Error(`${x}The ${P(O,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const U=ui($);if(!U)throw new Error(`${x}The ${P(O,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const Z=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[X.GoogleSheetsClearSheet].inputs.spreadsheetId.id}),j=(u=Z==null?void 0:Z.value)==null?void 0:u.value,H=ln(j,{errorPrefix:`${x}The ${P(Z,"Spreadsheet ID","spreadsheetId")} input `}),Y=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[X.GoogleSheetsClearSheet].inputs.sheetName.id}),ie=(e=Y==null?void 0:Y.value)==null?void 0:e.value;if(ie==null||ie==="")throw new Error(`${x}The ${P(Y,"Sheet (ID or name)","sheetName")} input is missing.`);const z={Authorization:`Bearer ${await R.getAccessToken()}`},J=`${(f=R.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${R.projectId}/${Zt["google-sheet"]}/${U}`,ee=async le=>Ht.post(J,le,{headers:z});let Q;if(typeof ie=="string"){const le=ie.trim();if(/^\d+$/.test(le)){const oe=await ee({method:"GET",endpoint:`/v4/spreadsheets/${H}?fields=sheets.properties(sheetId,title)`}).catch(()=>null),be=(((y=oe==null?void 0:oe.data)==null?void 0:y.sheets)||[]).find(Ce=>{var Ee,xe;return String((Ee=Ce.properties)==null?void 0:Ee.sheetId)===le||((xe=Ce.properties)==null?void 0:xe.title)===le});Q=((m=be==null?void 0:be.properties)==null?void 0:m.title)||le}else Q=le}else if(typeof ie=="number"){const ce=(((T=(await ee({method:"GET",endpoint:`/v4/spreadsheets/${H}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:T.sheets)||[]).find(be=>{var Ce;return Number((Ce=be.properties)==null?void 0:Ce.sheetId)===ie});if(!ce||!((g=ce.properties)!=null&&g.title))throw new Error(`${x}Sheet with ID ${ie} was not found in the spreadsheet.`);Q=ce.properties.title}else throw new Error(`${x}The ${P(Y,"Sheet (ID or name)","sheetName")} input value is invalid. It must be a number or string.`);const ae=(await ee({method:"POST",endpoint:`/v4/spreadsheets/${H}/values/${encodeURIComponent(Q)}:clear`,data:{}})).data||{};return{value:K.Success,result:{clearedRange:ae.clearedRange},error:null}}catch(R){const I=((b=R.response)==null?void 0:b.data)||R.message||R;return pe.Logger.log("[Google Sheets] error:",I),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:I,result:null}}}})}}class l1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsBatchGetValues,version:"1.0.0",description:"Batch Get Values Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsBatchGetValues);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T;try{const g=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!g||!g.env)throw new Error("Editor context or environment missing");const b=Be(t,t.project,"batchGetValues"),I="["+Ve(t,t.project,"Batch get values")+": `"+b+"`] ",A=(ce,be,Ce)=>{const Ee=Ve(ce==null?void 0:ce.valueOwner,g==null?void 0:g.logic,be),xe=Be(ce==null?void 0:ce.valueOwner,g==null?void 0:g.logic,Ce);return`"${Ee}" (\`${xe}\`)`},x=n.find(ce=>{var be;return((be=ce.valueOwner.declaration)==null?void 0:be.id)===G.operation[X.GoogleSheetsBatchGetValues].inputs.connection.id}),P=(s=x==null?void 0:x.value)==null?void 0:s.valueAsType;if(!P||!P.id||!P.name||P.type!==r.DefinitionEntity)throw new Error(`${I}The ${A(x,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(P);if(!O)throw new Error(`${I}The ${A(x,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const $=n.find(ce=>{var be;return((be=ce.valueOwner.declaration)==null?void 0:be.id)===G.operation[X.GoogleSheetsBatchGetValues].inputs.spreadsheetId.id}),U=(u=$==null?void 0:$.value)==null?void 0:u.value,Z=ln(U,{errorPrefix:`${I}The ${A($,"Spreadsheet ID","spreadsheetId")} input `}),j=n.find(ce=>{var be;return((be=ce.valueOwner.declaration)==null?void 0:be.id)===G.operation[X.GoogleSheetsBatchGetValues].inputs.ranges.id}),H=(e=j==null?void 0:j.value)==null?void 0:e.value;if(H==null||H==="")throw new Error(`${I}The ${A(j,"Ranges","ranges")} input is missing.`);const ie={Authorization:`Bearer ${await g.getAccessToken()}`},W=`${(f=g.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${g.projectId}/${Zt["google-sheet"]}/${O}`,z=async ce=>Ht.post(W,ce,{headers:ie});let J=Array.isArray(H)?H:[H];if(J.length===0)throw new Error(`${I}The ${A(j,"Ranges","ranges")} input evaluated to an empty array. E.g. ["Sheet1!A1:B2"]`);let ee=new Set;try{const be=((y=(await z({method:"GET",endpoint:`/v4/spreadsheets/${Z}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:y.sheets)||[];ee=new Set(be.map(Ce=>{var Ee;return(Ee=Ce.properties)==null?void 0:Ee.title}).filter(Boolean))}catch{}const Q=ce=>{const be=ce.indexOf("!");if(be>-1){let Ce=ce.substring(0,be).trim();return Ce.startsWith("'")&&Ce.endsWith("'")&&(Ce=Ce.slice(1,-1)),Ce}return null},re=[],ae=[];for(const ce of J){const be=lv(ce,{errorPrefix:`${I}The ${A(j,"Ranges","ranges")} input `}),Ce=Q(be);Ce&&ee.size>0&&!ee.has(Ce)?ae.push({range:be,majorDimension:"ROWS",values:[]}):re.push({a1Range:be})}let le=[];re.length>0&&(le=(((m=(await z({method:"POST",endpoint:`/v4/spreadsheets/${Z}/values:batchGetByDataFilter`,data:{dataFilters:re}})).data)==null?void 0:m.valueRanges)||[]).map(Ce=>Ce.valueRange||Ce));const oe=[...le,...ae];return{value:K.Success,result:{valueRanges:oe},error:null}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return pe.Logger.log("[Google Sheets] error:",b),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:b,result:null}}}})}}function fo(a){if(!a||typeof a!="object")return;const p={};return typeof a.red=="number"&&(p.red=a.red>1?a.red/255:a.red),typeof a.green=="number"&&(p.green=a.green>1?a.green/255:a.green),typeof a.blue=="number"&&(p.blue=a.blue>1?a.blue/255:a.blue),typeof a.alpha=="number"&&(p.alpha=a.alpha),Object.keys(p).length>0?p:void 0}class o1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsFormatCells,version:"1.0.0",description:"Format Cells Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsFormatCells);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"formatCells"),b="["+Ve(t,t.project,"Format cells")+": `"+T+"`] ",R=(ft,Et,pt)=>{const Me=Ve(ft==null?void 0:ft.valueOwner,m==null?void 0:m.logic,Et),Je=Be(ft==null?void 0:ft.valueOwner,m==null?void 0:m.logic,pt);return`"${Me}" (\`${Je}\`)`},I=n.find(ft=>{var Et;return((Et=ft.valueOwner.declaration)==null?void 0:Et.id)===G.operation[X.GoogleSheetsFormatCells].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=ui(A);if(!x)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(ft=>{var Et;return((Et=ft.valueOwner.declaration)==null?void 0:Et.id)===G.operation[X.GoogleSheetsFormatCells].inputs.spreadsheetId.id}),O=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(O,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(ft=>{var Et;return((Et=ft.valueOwner.declaration)==null?void 0:Et.id)===G.operation[X.GoogleSheetsFormatCells].inputs.range.id}),Z=(e=U==null?void 0:U.value)==null?void 0:e.value;if(Z==null)throw new Error(`${b}The ${R(U,"Range","range")} input is missing.`);const H={Authorization:`Bearer ${await m.getAccessToken()}`},Y=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${x}`,ie=async ft=>Ht.post(Y,ft,{headers:H}),W=await Ha(Z,"Id",async()=>(await ie({method:"GET",endpoint:`/v4/spreadsheets/${$}?fields=sheets.properties(sheetId,title)`})).data.sheets.map(Et=>({id:Et.properties.sheetId,name:Et.properties.title}))),z=ps(W,{errorPrefix:`${b}The ${R(U,"Range","range")} input `}),J=G.operation[X.GoogleSheetsFormatCells].inputs,ee=ft=>{var pt;const Et=n.find(Me=>{var Je;return((Je=Me.valueOwner.declaration)==null?void 0:Je.id)===ft});return(pt=Et==null?void 0:Et.value)==null?void 0:pt.value},Q=ee(J.bold.id),re=ee(J.italic.id),ae=ee(J.underline.id),le=ee(J.strikethrough.id),oe=ee(J.fontSize.id),ce=ee(J.fontFamily.id),be=ee(J.textColor.id),Ce=ee(J.backgroundColor.id),Ee=ee(J.horizontalAlignment.id),xe=ee(J.verticalAlignment.id),Le=ee(J.wrapStrategy.id),Fe={},tt=[],We={},et=[];typeof Q=="boolean"&&(We.bold=Q,et.push("bold")),typeof re=="boolean"&&(We.italic=re,et.push("italic")),typeof ae=="boolean"&&(We.underline=ae,et.push("underline")),typeof le=="boolean"&&(We.strikethrough=le,et.push("strikethrough")),typeof oe=="number"&&!isNaN(oe)&&(We.fontSize=oe,et.push("fontSize")),typeof ce=="string"&&ce.trim()!==""&&(We.fontFamily=ce.trim(),et.push("fontFamily"));const qe=fo(be);qe&&(We.foregroundColor=qe,et.push("foregroundColor")),et.length>0&&(Fe.textFormat=We,tt.push(`userEnteredFormat.textFormat(${et.join(",")})`));const ot=fo(Ce);if(ot&&(Fe.backgroundColor=ot,tt.push("userEnteredFormat.backgroundColor")),typeof Ee=="string"&&Ee!==""){const ft={Left:"LEFT",Center:"CENTER",Right:"RIGHT",Justify:"JUSTIFY"};Fe.horizontalAlignment=ft[Ee]||Ee.toUpperCase(),tt.push("userEnteredFormat.horizontalAlignment")}if(typeof xe=="string"&&xe!==""){const ft={Top:"TOP",Middle:"MIDDLE",Bottom:"BOTTOM"};Fe.verticalAlignment=ft[xe]||xe.toUpperCase(),tt.push("userEnteredFormat.verticalAlignment")}if(typeof Le=="string"&&Le!==""){const ft={"Overflow cell":"OVERFLOW_CELL","Wrap text":"WRAP","Clip text":"CLIP"};Fe.wrapStrategy=ft[Le]||Le.toUpperCase(),tt.push("userEnteredFormat.wrapStrategy")}if(tt.length===0)return{value:K.Success,result:null,error:null};const st={repeatCell:{range:z,cell:{userEnteredFormat:Fe},fields:tt.join(",")}};return await ie({method:"POST",endpoint:`/v4/spreadsheets/${$}:batchUpdate`,data:{requests:[st]}}),{value:K.Success,result:null,error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class d1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsSetNumberFormat,version:"1.0.0",description:"Set Number Format Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsSetNumberFormat);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=Be(t,t.project,"setNumberFormat"),R="["+Ve(t,t.project,"Set number format")+": `"+g+"`] ",I=(ae,le,oe)=>{const ce=Ve(ae==null?void 0:ae.valueOwner,T==null?void 0:T.logic,le),be=Be(ae==null?void 0:ae.valueOwner,T==null?void 0:T.logic,oe);return`"${ce}" (\`${be}\`)`},A=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[X.GoogleSheetsSetNumberFormat].inputs.connection.id}),x=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!x||!x.id||!x.name||x.type!==r.DefinitionEntity)throw new Error(`${R}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const P=ui(x);if(!P)throw new Error(`${R}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const O=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[X.GoogleSheetsSetNumberFormat].inputs.spreadsheetId.id}),$=(u=O==null?void 0:O.value)==null?void 0:u.value,U=ln($,{errorPrefix:`${R}The ${I(O,"Spreadsheet ID","spreadsheetId")} input `}),Z=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[X.GoogleSheetsSetNumberFormat].inputs.range.id}),j=(e=Z==null?void 0:Z.value)==null?void 0:e.value;if(j==null)throw new Error(`${R}The ${I(Z,"Range","range")} input is missing.`);const Y={Authorization:`Bearer ${await T.getAccessToken()}`},ie=`${(f=T.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${T.projectId}/${Zt["google-sheet"]}/${P}`,W=async ae=>Ht.post(ie,ae,{headers:Y}),z=await Ha(j,"Id",async()=>(await W({method:"GET",endpoint:`/v4/spreadsheets/${U}?fields=sheets.properties(sheetId,title)`})).data.sheets.map(le=>({id:le.properties.sheetId,name:le.properties.title}))),J=ps(z,{errorPrefix:`${R}The ${I(Z,"Range","range")} input `}),ee=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[X.GoogleSheetsSetNumberFormat].inputs.pattern.id}),Q=(y=ee==null?void 0:ee.value)==null?void 0:y.value;if(Q==null||Q==="")throw new Error(`${R}The ${I(ee,"Pattern","pattern")} input is missing.`);if(typeof Q!="string")throw new Error(`${R}The ${I(ee,"Pattern","pattern")} input value is invalid. It must be a string.`);const re={repeatCell:{range:J,cell:{userEnteredFormat:{numberFormat:{type:"CUSTOM",pattern:Q}}},fields:"userEnteredFormat.numberFormat"}};return await W({method:"POST",endpoint:`/v4/spreadsheets/${U}:batchUpdate`,data:{requests:[re]}}),{value:K.Success,result:null,error:null}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return pe.Logger.log("[Google Sheets] error:",g),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:g,result:null}}}})}}class p1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsMergeCells,version:"1.0.0",description:"Merge Cells Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsMergeCells);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=Be(t,t.project,"mergeCells"),R="["+Ve(t,t.project,"Merge cells")+": `"+g+"`] ",I=(oe,ce,be)=>{const Ce=Ve(oe==null?void 0:oe.valueOwner,T==null?void 0:T.logic,ce),Ee=Be(oe==null?void 0:oe.valueOwner,T==null?void 0:T.logic,be);return`"${Ce}" (\`${Ee}\`)`},A=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[X.GoogleSheetsMergeCells].inputs.connection.id}),x=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!x||!x.id||!x.name||x.type!==r.DefinitionEntity)throw new Error(`${R}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const P=ui(x);if(!P)throw new Error(`${R}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const O=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[X.GoogleSheetsMergeCells].inputs.spreadsheetId.id}),$=(u=O==null?void 0:O.value)==null?void 0:u.value,U=ln($,{errorPrefix:`${R}The ${I(O,"Spreadsheet ID","spreadsheetId")} input `}),Z=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[X.GoogleSheetsMergeCells].inputs.range.id}),j=(e=Z==null?void 0:Z.value)==null?void 0:e.value;if(!j||j==="")throw new Error(`${R}The ${I(Z,"Range","range")} input is missing.`);const H=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[X.GoogleSheetsMergeCells].inputs.mergeType.id}),Y=(f=H==null?void 0:H.value)==null?void 0:f.value,ie={Columns:"MERGE_COLUMNS",Rows:"MERGE_ROWS",Both:"MERGE_ALL","All (combine entire range)":"MERGE_ALL","Columns (merge within columns)":"MERGE_COLUMNS","Rows (merge within rows)":"MERGE_ROWS",MERGE_ALL:"MERGE_ALL",MERGE_COLUMNS:"MERGE_COLUMNS",MERGE_ROWS:"MERGE_ROWS"},W=typeof Y=="string"?Y:String(Y||""),z=ie[W]||(Y?String(Y).toUpperCase():"MERGE_ALL"),ee={Authorization:`Bearer ${await T.getAccessToken()}`},Q=`${(y=T.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${T.projectId}/${Zt["google-sheet"]}/${P}`,re=async oe=>Ht.post(Q,oe,{headers:ee}),ae=await Ha(j,"Id",async()=>{var ce;return(((ce=(await re({method:"GET",endpoint:`/v4/spreadsheets/${U}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:ce.sheets)||[]).map(be=>{var Ce,Ee;return{id:(Ce=be.properties)==null?void 0:Ce.sheetId,name:(Ee=be.properties)==null?void 0:Ee.title}})}),le=ps(ae,{errorPrefix:`${R}The ${I(Z,"Range","range")} input `});return await re({method:"POST",endpoint:`/v4/spreadsheets/${U}:batchUpdate`,data:{requests:[{mergeCells:{range:le,mergeType:z}}]}}),{value:K.Success,error:null,result:null}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return pe.Logger.log("[Google Sheets] error:",g),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:g,result:null}}}})}}class u1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsUnmergeCells,version:"1.0.0",description:"Unmerge Cells Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsUnmergeCells);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"unmergeCells"),b="["+Ve(t,t.project,"Unmerge cells")+": `"+T+"`] ",R=(J,ee,Q)=>{const re=Ve(J==null?void 0:J.valueOwner,m==null?void 0:m.logic,ee),ae=Be(J==null?void 0:J.valueOwner,m==null?void 0:m.logic,Q);return`"${re}" (\`${ae}\`)`},I=n.find(J=>{var ee;return((ee=J.valueOwner.declaration)==null?void 0:ee.id)===G.operation[X.GoogleSheetsUnmergeCells].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=ui(A);if(!x)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(J=>{var ee;return((ee=J.valueOwner.declaration)==null?void 0:ee.id)===G.operation[X.GoogleSheetsUnmergeCells].inputs.spreadsheetId.id}),O=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(O,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(J=>{var ee;return((ee=J.valueOwner.declaration)==null?void 0:ee.id)===G.operation[X.GoogleSheetsUnmergeCells].inputs.range.id}),Z=(e=U==null?void 0:U.value)==null?void 0:e.value;if(!Z||Z==="")throw new Error(`${b}The ${R(U,"Range","range")} input is missing.`);const H={Authorization:`Bearer ${await m.getAccessToken()}`},Y=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${x}`,ie=async J=>Ht.post(Y,J,{headers:H}),W=await Ha(Z,"Id",async()=>{var ee;return(((ee=(await ie({method:"GET",endpoint:`/v4/spreadsheets/${$}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:ee.sheets)||[]).map(Q=>{var re,ae;return{id:(re=Q.properties)==null?void 0:re.sheetId,name:(ae=Q.properties)==null?void 0:ae.title}})}),z=ps(W,{errorPrefix:`${b}The ${R(U,"Range","range")} input `});return await ie({method:"POST",endpoint:`/v4/spreadsheets/${$}:batchUpdate`,data:{requests:[{unmergeCells:{range:z}}]}}),{value:K.Success,error:null,result:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class c1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsAutoResizeDimensions,version:"1.0.0",description:"Auto-Resize Dimensions Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsAutoResizeDimensions);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=Be(t,t.project,"autoResizeDimensions"),R="["+Ve(t,t.project,"Auto-resize dimensions")+": `"+g+"`] ",I=(ae,le,oe)=>{const ce=Ve(ae==null?void 0:ae.valueOwner,T==null?void 0:T.logic,le),be=Be(ae==null?void 0:ae.valueOwner,T==null?void 0:T.logic,oe);return`"${ce}" (\`${be}\`)`},A=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[X.GoogleSheetsAutoResizeDimensions].inputs.connection.id}),x=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!x||!x.id||!x.name||x.type!==r.DefinitionEntity)throw new Error(`${R}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const P=ui(x);if(!P)throw new Error(`${R}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const O=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[X.GoogleSheetsAutoResizeDimensions].inputs.spreadsheetId.id}),$=(u=O==null?void 0:O.value)==null?void 0:u.value,U=ln($,{errorPrefix:`${R}The ${I(O,"Spreadsheet ID","spreadsheetId")} input `}),Z=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[X.GoogleSheetsAutoResizeDimensions].inputs.range.id}),j=(e=Z==null?void 0:Z.value)==null?void 0:e.value;if(j==null)throw new Error(`${R}The ${I(Z,"Range","range")} input is missing.`);const H=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[X.GoogleSheetsAutoResizeDimensions].inputs.dimension.id}),Y=((f=H==null?void 0:H.value)==null?void 0:f.value)||"Both",W={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}/${Zt["google-sheet"]}/${P}`,J=async ae=>Ht.post(z,ae,{headers:W}),ee=await Ha(j,"Id",async()=>{var le;return(((le=(await J({method:"GET",endpoint:`/v4/spreadsheets/${U}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:le.sheets)||[]).map(oe=>{var ce,be;return{id:(ce=oe.properties)==null?void 0:ce.sheetId,name:(be=oe.properties)==null?void 0:be.title}})}),re=U4(ee,typeof Y=="string"?Y:void 0,{errorPrefix:`${R}The ${I(Z,"Range","range")} input `}).map(ae=>({autoResizeDimensions:{dimensions:ae}}));return await J({method:"POST",endpoint:`/v4/spreadsheets/${U}:batchUpdate`,data:{requests:re}}),{value:K.Success,result:null,error:null}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return pe.Logger.log("[Google Sheets] error:",g),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:g,result:null}}}})}}class f1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsFindAndReplace,version:"1.0.0",description:"Find and Replace Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsFindAndReplace);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A;try{const x=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!x||!x.env)throw new Error("Editor context or environment missing");const P=Be(t,t.project,"findAndReplace"),$="["+Ve(t,t.project,"Find and replace")+": `"+P+"`] ",U=(et,qe,ot)=>{const st=Ve(et==null?void 0:et.valueOwner,x==null?void 0:x.logic,qe),ft=Be(et==null?void 0:et.valueOwner,x==null?void 0:x.logic,ot);return`"${st}" (\`${ft}\`)`},Z=n.find(et=>{var qe;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===G.operation[X.GoogleSheetsFindAndReplace].inputs.connection.id}),j=(s=Z==null?void 0:Z.value)==null?void 0:s.valueAsType;if(!j||!j.id||!j.name||j.type!==r.DefinitionEntity)throw new Error(`${$}The ${U(Z,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const H=ui(j);if(!H)throw new Error(`${$}The ${U(Z,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const Y=n.find(et=>{var qe;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===G.operation[X.GoogleSheetsFindAndReplace].inputs.spreadsheetId.id}),ie=(u=Y==null?void 0:Y.value)==null?void 0:u.value,W=ln(ie,{errorPrefix:`${$}The ${U(Y,"Spreadsheet ID","spreadsheetId")} input `}),z=n.find(et=>{var qe;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===G.operation[X.GoogleSheetsFindAndReplace].inputs.range.id}),J=(e=z==null?void 0:z.value)==null?void 0:e.value;if(J==null)throw new Error(`${$}The ${U(z,"Range","range")} input is missing.`);const ee=n.find(et=>{var qe;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===G.operation[X.GoogleSheetsFindAndReplace].inputs.find.id}),Q=(f=ee==null?void 0:ee.value)==null?void 0:f.value;if(!Q||Q==="")throw new Error(`${$}The ${U(ee,"Find","find")} input is missing.`);if(typeof Q!="string")throw new Error(`${$}The ${U(ee,"Find","find")} input value is invalid. It must be a non-empty string.`);const re=n.find(et=>{var qe;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===G.operation[X.GoogleSheetsFindAndReplace].inputs.replace.id}),ae=((y=re==null?void 0:re.value)==null?void 0:y.value)||"";if(typeof ae!="string")throw new Error(`${$}The ${U(re,"Replace","replace")} input value is invalid. It must be a string.`);const le=n.find(et=>{var qe;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===G.operation[X.GoogleSheetsFindAndReplace].inputs.matchCase.id}),oe=!!((m=le==null?void 0:le.value)!=null&&m.value),ce=n.find(et=>{var qe;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===G.operation[X.GoogleSheetsFindAndReplace].inputs.matchEntireCell.id}),be=!!((T=ce==null?void 0:ce.value)!=null&&T.value),Ee={Authorization:`Bearer ${await x.getAccessToken()}`},xe=`${(g=x.env)==null?void 0:g.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${x.projectId}/${Zt["google-sheet"]}/${H}`,Le=async et=>Ht.post(xe,et,{headers:Ee}),Fe={findReplace:{range:ps(J,{errorPrefix:`${$}The ${U(z,"Range","range")} input `}),find:Q,replacement:ae,matchCase:oe,matchEntireCell:be}},We=(await Le({method:"POST",endpoint:`/v4/spreadsheets/${W}:batchUpdate`,data:{requests:[Fe]}})).data||{};return{value:K.Success,result:{occurrencesChanged:((I=(R=(b=We.replies)==null?void 0:b[0])==null?void 0:R.findReplace)==null?void 0:I.occurrencesChanged)||0},error:null}}catch(x){const P=((A=x.response)==null?void 0:A.data)||x.message||x;return pe.Logger.log("[Google Sheets] error:",P),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:P,result:null}}}})}}const e2={"List of items":"ONE_OF_LIST","List from cell range":"ONE_OF_RANGE","Number greater than":"NUMBER_GREATER","Number greater than or equal":"NUMBER_GREATER_THAN_EQ","Number less than":"NUMBER_LESS","Number less than or equal":"NUMBER_LESS_THAN_EQ","Number equal to":"NUMBER_EQ","Number not equal to":"NUMBER_NOT_EQ","Number between":"NUMBER_BETWEEN","Number not between":"NUMBER_NOT_BETWEEN","Text contains":"TEXT_CONTAINS","Text does not contain":"TEXT_NOT_CONTAINS","Text starts with":"TEXT_STARTS_WITH","Text ends with":"TEXT_ENDS_WITH","Text equals":"TEXT_EQ","Text is valid email":"TEXT_IS_EMAIL","Text is valid URL":"TEXT_IS_URL","Date is":"DATE_EQ","Date is before":"DATE_BEFORE","Date is after":"DATE_AFTER","Date is on or before":"DATE_ON_OR_BEFORE","Date is on or after":"DATE_ON_OR_AFTER","Date is between":"DATE_BETWEEN","Date is not between":"DATE_NOT_BETWEEN","Date is valid":"DATE_IS_VALID",Checkbox:"BOOLEAN","Custom formula":"CUSTOM_FORMULA"},ax={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"},ARn=new Set([...Object.values(e2),...Object.keys(ax),...Object.values(ax)]);function y1t(a){if(!a||typeof a!="string")return null;const p=a.trim();if(!p)return null;if(e2[p])return e2[p];const t=p.toUpperCase().replace(/\s+/g,"_");return ax[t]?ax[t]:(ARn.has(t),t)}function DRn(a,p,t){if(a.length===0){t.push(new ht({id:`${p.id}--${Nr.ConditionValuesInvalidFormula}`,message:'Custom formula condition requires a formula string starting with "=" (e.g., ["=SUM(A1:A10)>100"]).',severity:Ie.Error,code:Nr.ConditionValuesInvalidFormula,entity:p}));return}a.length>1&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesInvalidFormula}-count`,message:`Custom formula condition rule accepts only 1 formula string (e.g., ["=SUM(A1:A10)>100"]). You provided ${a.length} items.`,severity:Ie.Error,code:Nr.ConditionValuesInvalidFormula,entity:p}));for(let n=0;n<a.length;n++){const s=String(a[n]).trim();s.startsWith("=")||t.push(new ht({id:`${p.id}--${Nr.ConditionValuesInvalidFormula}-${n}`,message:`Custom formula "${s}" ${a.length>1?`(at index ${n}) `:""}is invalid. A custom formula must start with "=" (e.g., "=A1>100" or "=ISNUMBER(A1)").`,severity:Ie.Error,code:Nr.ConditionValuesInvalidFormula,entity:p}))}}function CRn(a,p,t){if(a.length===0){t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleNumberRequired}`,message:'This numeric condition rule requires 1 numeric target value (e.g., ["100"]).',severity:Ie.Error,code:Nr.ConditionValuesSingleNumberRequired,entity:p}));return}a.length>1&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleNumberRequired}-count`,message:`This numeric condition rule accepts only 1 numeric target value (e.g., ["100"]). You provided ${a.length} items.`,severity:Ie.Error,code:Nr.ConditionValuesSingleNumberRequired,entity:p}));for(let n=0;n<a.length;n++){const s=String(a[n]).trim();(s===""||isNaN(Number(s)))&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleNumberRequired}-${n}`,message:`Condition value "${s}" ${a.length>1?`(at index ${n}) `:""}is invalid. It must be a valid number (e.g., "100").`,severity:Ie.Error,code:Nr.ConditionValuesSingleNumberRequired,entity:p}))}}function wRn(a,p,t){a.length!==2&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesTwoNumbersRequired}`,message:`A "between" condition rule requires exactly 2 boundary values (e.g., ["10", "50"] or ["2024-01-01", "2024-12-31"]). You provided ${a.length} items.`,severity:Ie.Error,code:Nr.ConditionValuesTwoNumbersRequired,entity:p}))}function xRn(a,p,t){if(a.length===0){t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleRangeRequired}`,message:'The "List from cell range" rule requires a valid cell range in A1 notation (e.g., ["Sheet1!A1:A50"]).',severity:Ie.Error,code:Nr.ConditionValuesSingleRangeRequired,entity:p}));return}a.length>1&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleRangeRequired}-count`,message:`The "List from cell range" rule accepts only 1 cell range in A1 notation (e.g., ["Sheet1!A1:A50"]). You provided ${a.length} items.`,severity:Ie.Error,code:Nr.ConditionValuesSingleRangeRequired,entity:p}))}function ORn(a,p,t){a.length===0&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesListEmpty}`,message:'The "List of items" rule requires at least one choice item (e.g., ["Pending", "Approved", "Rejected"]).',severity:Ie.Error,code:Nr.ConditionValuesListEmpty,entity:p}))}function PRn(a,p,t){if(a.length===0){t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleTextRequired}`,message:'This text condition rule requires a non-empty text target value (e.g., ["important"]).',severity:Ie.Error,code:Nr.ConditionValuesSingleTextRequired,entity:p}));return}a.length>1&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleTextRequired}-count`,message:`This text condition rule accepts only 1 text target value (e.g., ["important"]). You provided ${a.length} items.`,severity:Ie.Error,code:Nr.ConditionValuesSingleTextRequired,entity:p}));for(let n=0;n<a.length;n++)String(a[n]).trim()===""&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleTextRequired}-${n}`,message:`Text target value ${a.length>1?`(at index ${n}) `:""}is empty. Expected a non-empty text string.`,severity:Ie.Error,code:Nr.ConditionValuesSingleTextRequired,entity:p}))}function VRn(a,p,t){if(a.length===0){t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleTextRequired}`,message:'This date condition rule requires a target date or relative date string (e.g., ["2024-01-01"]).',severity:Ie.Error,code:Nr.ConditionValuesSingleTextRequired,entity:p}));return}a.length>1&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleTextRequired}-count`,message:`This date condition rule accepts only 1 target date string (e.g., ["2024-01-01"]). You provided ${a.length} items.`,severity:Ie.Error,code:Nr.ConditionValuesSingleTextRequired,entity:p}))}function NRn(a,p,t){a.length>0&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesNoValuesRequired}`,message:`This condition rule does not take any argument values (must be empty list []). You provided ${a.length} items.`,severity:Ie.Error,code:Nr.ConditionValuesNoValuesRequired,entity:p}))}function _Rn(a,p,t,n){if(!p&&p!==0&&p!==!1)return;let s=[];if(typeof p=="string")try{const e=JSON.parse(p);s=Array.isArray(e)?e:[p]}catch{s=p.split(",").map(e=>e.trim()).filter(Boolean)}else Array.isArray(p)?s=p:s=[p];const u=y1t(a);if(u)switch(u){case"CUSTOM_FORMULA":DRn(s,t,n);break;case"ONE_OF_LIST":ORn(s,t,n);break;case"ONE_OF_RANGE":xRn(s,t,n);break;case"NUMBER_GREATER":case"NUMBER_GREATER_THAN_EQ":case"NUMBER_LESS":case"NUMBER_LESS_THAN_EQ":case"NUMBER_EQUAL":case"NUMBER_NOT_EQUAL":CRn(s,t,n);break;case"NUMBER_BETWEEN":case"NUMBER_NOT_BETWEEN":case"DATE_BETWEEN":case"DATE_NOT_BETWEEN":wRn(s,t,n);break;case"TEXT_CONTAINS":case"TEXT_NOT_CONTAINS":case"TEXT_DOES_NOT_CONTAIN":case"TEXT_STARTS_WITH":case"TEXT_ENDS_WITH":case"TEXT_EQ":case"TEXT_EQUAL":PRn(s,t,n);break;case"DATE_EQ":case"DATE_TIME_EQUAL":case"DATE_BEFORE":case"DATE_AFTER":case"DATE_ON_OR_BEFORE":case"DATE_ON_OR_AFTER":VRn(s,t,n);break;case"TEXT_IS_EMAIL":case"TEXT_IS_URL":case"DATE_IS_VALID":case"BOOLEAN":NRn(s,t,n);break}}class h1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsAddDataValidation,version:"1.0.0",description:"Add Data Validation Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsAddDataValidation);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T;try{const g=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!g||!g.env)throw new Error("Editor context or environment missing");const b=Be(t,t.project,"addDataValidation"),I="["+Ve(t,t.project,"Add data validation")+": `"+b+"`] ",A=(xe,Le,Fe)=>{const tt=Ve(xe==null?void 0:xe.valueOwner,g==null?void 0:g.logic,Le),We=Be(xe==null?void 0:xe.valueOwner,g==null?void 0:g.logic,Fe);return`"${tt}" (\`${We}\`)`},x=n.find(xe=>{var Le;return((Le=xe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[X.GoogleSheetsAddDataValidation].inputs.connection.id}),P=(s=x==null?void 0:x.value)==null?void 0:s.valueAsType;if(!P||!P.id||!P.name||P.type!==r.DefinitionEntity)throw new Error(`${I}The ${A(x,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(P);if(!O)throw new Error(`${I}The ${A(x,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const $=n.find(xe=>{var Le;return((Le=xe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[X.GoogleSheetsAddDataValidation].inputs.spreadsheetId.id}),U=(u=$==null?void 0:$.value)==null?void 0:u.value,Z=ln(U,{errorPrefix:`${I}The ${A($,"Spreadsheet ID","spreadsheetId")} input `}),j=n.find(xe=>{var Le;return((Le=xe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[X.GoogleSheetsAddDataValidation].inputs.range.id}),H=(e=j==null?void 0:j.value)==null?void 0:e.value;if(H==null)throw new Error(`${I}The ${A(j,"Range","range")} input is missing.`);const ie={Authorization:`Bearer ${await g.getAccessToken()}`},W=`${(f=g.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${g.projectId}/${Zt["google-sheet"]}/${O}`,z=async xe=>Ht.post(W,xe,{headers:ie}),J=await Ha(H,"Id",async()=>(await z({method:"GET",endpoint:`/v4/spreadsheets/${Z}?fields=sheets.properties(sheetId,title)`})).data.sheets.map(Le=>({id:Le.properties.sheetId,name:Le.properties.title}))),ee=ps(J,{errorPrefix:`${I}The ${A(j,"Range","range")} input `}),Q=n.find(xe=>{var Le;return((Le=xe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[X.GoogleSheetsAddDataValidation].inputs.conditionType.id}),re=(y=Q==null?void 0:Q.value)==null?void 0:y.value;if(!re||re==="")throw new Error(`${I}The ${A(Q,"Condition Type","conditionType")} input is missing.`);if(typeof re!="string")throw new Error(`${I}The ${A(Q,"Condition Type","conditionType")} input value is invalid. It must be a non-empty string.`);const ae=y1t(re)||re,le=n.find(xe=>{var Le;return((Le=xe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[X.GoogleSheetsAddDataValidation].inputs.conditionValues.id}),oe=(m=le==null?void 0:le.value)==null?void 0:m.value;let ce=oe;if(typeof oe=="string")try{ce=JSON.parse(oe)}catch{ce=oe.split(",").map(Le=>Le.trim())}Array.isArray(ce)||(ce=ce?[ce]:[]);let be=ae,Ce=ce.map(xe=>({userEnteredValue:String(xe)}));if(ae==="TEXT_STARTS_WITH"||ae==="TEXT_ENDS_WITH"){const xe=zAt(H),Le=ce.length>0?String(ce[0]):"",Fe=Le.replace(/"/g,'""'),tt=ae==="TEXT_STARTS_WITH"?`=LEFT(${xe}, ${Le.length})="${Fe}"`:`=RIGHT(${xe}, ${Le.length})="${Fe}"`;be="CUSTOM_FORMULA",Ce=[{userEnteredValue:tt}]}const Ee={setDataValidation:{range:ee,rule:{condition:{type:be,values:Ce},showCustomUi:!0}}};return await z({method:"POST",endpoint:`/v4/spreadsheets/${Z}:batchUpdate`,data:{requests:[Ee]}}),{value:K.Success,result:null,error:null}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return pe.Logger.log("[Google Sheets] error:",b),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:b,result:null}}}})}}class m1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsSortRange,version:"1.0.0",description:"Sort Range Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsSortRange);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T;try{const g=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!g||!g.env)throw new Error("Editor context or environment missing");const b=Be(t,t.project,"sortRange"),I="["+Ve(t,t.project,"Sort range")+": `"+b+"`] ",A=(Le,Fe,tt)=>{const We=Ve(Le==null?void 0:Le.valueOwner,g==null?void 0:g.logic,Fe),et=Be(Le==null?void 0:Le.valueOwner,g==null?void 0:g.logic,tt);return`"${We}" (\`${et}\`)`},x=n.find(Le=>{var Fe;return((Fe=Le.valueOwner.declaration)==null?void 0:Fe.id)===G.operation[X.GoogleSheetsSortRange].inputs.connection.id}),P=(s=x==null?void 0:x.value)==null?void 0:s.valueAsType;if(!P||!P.id||!P.name||P.type!==r.DefinitionEntity)throw new Error(`${I}The ${A(x,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(P);if(!O)throw new Error(`${I}The ${A(x,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const $=n.find(Le=>{var Fe;return((Fe=Le.valueOwner.declaration)==null?void 0:Fe.id)===G.operation[X.GoogleSheetsSortRange].inputs.spreadsheetId.id}),U=(u=$==null?void 0:$.value)==null?void 0:u.value,Z=ln(U,{errorPrefix:`${I}The ${A($,"Spreadsheet ID","spreadsheetId")} input `}),j=n.find(Le=>{var Fe;return((Fe=Le.valueOwner.declaration)==null?void 0:Fe.id)===G.operation[X.GoogleSheetsSortRange].inputs.range.id}),H=(e=j==null?void 0:j.value)==null?void 0:e.value;if(H==null)throw new Error(`${I}The ${A(j,"Range","range")} input is missing.`);const ie={Authorization:`Bearer ${await g.getAccessToken()}`},W=`${(f=g.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${g.projectId}/${Zt["google-sheet"]}/${O}`,z=async Le=>Ht.post(W,Le,{headers:ie}),J=await Ha(H,"Id",async()=>(await z({method:"GET",endpoint:`/v4/spreadsheets/${Z}?fields=sheets.properties(sheetId,title)`})).data.sheets.map(Fe=>({id:Fe.properties.sheetId,name:Fe.properties.title}))),ee=ps(J,{errorPrefix:`${I}The ${A(j,"Range","range")} input `}),Q=n.find(Le=>{var Fe;return((Fe=Le.valueOwner.declaration)==null?void 0:Fe.id)===G.operation[X.GoogleSheetsSortRange].inputs.sortColumnIndex.id}),re=(y=Q==null?void 0:Q.value)==null?void 0:y.value;if(re==null)throw new Error(`${I}The ${A(Q,"Sort Column Index","sortColumnIndex")} input is missing.`);if(typeof re!="number")throw new Error(`${I}The ${A(Q,"Sort Column Index","sortColumnIndex")} input value is invalid. It must be a number.`);const ae=n.find(Le=>{var Fe;return((Fe=Le.valueOwner.declaration)==null?void 0:Fe.id)===G.operation[X.GoogleSheetsSortRange].inputs.sortOrder.id}),le=(m=ae==null?void 0:ae.value)==null?void 0:m.value;if(le==null||le==="")throw new Error(`${I}The ${A(ae,"Sort Order","sortOrder")} input is missing.`);if(typeof le!="string")throw new Error(`${I}The ${A(ae,"Sort Order","sortOrder")} input value is invalid. It must be a string.`);const ce={"Ascending (A-Z, 0-9)":"ASCENDING","Descending (Z-A, 9-0)":"DESCENDING",Ascending:"ASCENDING",Descending:"DESCENDING"}[le]||le.toUpperCase(),be=ee.startColumnIndex??0,Ce=ee.endColumnIndex;let Ee;if(re>=1?Ee=be+(re-1):Ee=be+re,Ce!==void 0&&(Ee<be||Ee>=Ce)){const Le=Ce-be;throw new Error(`${I}The ${A(Q,"Sort Column Index","sortColumnIndex")} input value (${re}) is out of bounds for the specified range. The range contains ${Le} column(s).`)}const xe={sortRange:{range:ee,sortSpecs:[{dimensionIndex:Ee,sortOrder:ce}]}};return await z({method:"POST",endpoint:`/v4/spreadsheets/${Z}:batchUpdate`,data:{requests:[xe]}}),{value:K.Success,result:null,error:null}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return pe.Logger.log("[Google Sheets] error:",b),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:b,result:null}}}})}}const $Rn={"Is empty":"BLANK","Is not empty":"NOT_BLANK","Text contains":"TEXT_CONTAINS","Text does not contain":"TEXT_NOT_CONTAINS","Text starts with":"TEXT_STARTS_WITH","Text ends with":"TEXT_ENDS_WITH","Text is exactly":"TEXT_EQ","Greater than":"NUMBER_GREATER","Greater than or equal to":"NUMBER_GREATER_THAN_EQ","Less than":"NUMBER_LESS","Less than or equal to":"NUMBER_LESS_THAN_EQ","Is equal to":"NUMBER_EQUAL","Is not equal to":"NUMBER_NOT_EQUAL","Is between":"NUMBER_BETWEEN","Is not between":"NUMBER_NOT_BETWEEN","Custom formula":"CUSTOM_FORMULA"},GRn={"Ascending (A-Z, 0-9)":"ASCENDING","Descending (Z-A, 9-0)":"DESCENDING",Ascending:"ASCENDING",Descending:"DESCENDING"};class T1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsCreateFilter,version:"1.0.0",description:"Create Filter Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsCreateFilter);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R;try{const I=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!I||!I.env)throw new Error("Editor context or environment missing");const A=Be(t,t.project,"createFilter"),P="["+Ve(t,t.project,"Create filter")+": `"+A+"`] ",O=(pt,Me,Je)=>{const ke=Ve(pt==null?void 0:pt.valueOwner,I==null?void 0:I.logic,Me),lt=Be(pt==null?void 0:pt.valueOwner,I==null?void 0:I.logic,Je);return`"${ke}" (\`${lt}\`)`},$=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===G.operation[X.GoogleSheetsCreateFilter].inputs.connection.id}),U=(s=$==null?void 0:$.value)==null?void 0:s.valueAsType;if(!U||!U.id||!U.name||U.type!==r.DefinitionEntity)throw new Error(`${P}The ${O($,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const Z=ui(U);if(!Z)throw new Error(`${P}The ${O($,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const j=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===G.operation[X.GoogleSheetsCreateFilter].inputs.spreadsheetId.id}),H=(u=j==null?void 0:j.value)==null?void 0:u.value,Y=ln(H,{errorPrefix:`${P}The ${O(j,"Spreadsheet ID","spreadsheetId")} input `}),ie=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===G.operation[X.GoogleSheetsCreateFilter].inputs.range.id}),W=(e=ie==null?void 0:ie.value)==null?void 0:e.value;if(W==null)throw new Error(`${P}The ${O(ie,"Range","range")} input is missing.`);const z=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===G.operation[X.GoogleSheetsCreateFilter].inputs.columnIndex.id}),J=(f=z==null?void 0:z.value)==null?void 0:f.value,ee=typeof J=="number"?J:0,Q=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===G.operation[X.GoogleSheetsCreateFilter].inputs.conditionType.id}),re=(y=Q==null?void 0:Q.value)==null?void 0:y.value,ae=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===G.operation[X.GoogleSheetsCreateFilter].inputs.conditionValues.id}),le=(m=ae==null?void 0:ae.value)==null?void 0:m.value,oe=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===G.operation[X.GoogleSheetsCreateFilter].inputs.hiddenValues.id}),ce=(T=oe==null?void 0:oe.value)==null?void 0:T.value,be=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===G.operation[X.GoogleSheetsCreateFilter].inputs.sortOrder.id}),Ce=(g=be==null?void 0:be.value)==null?void 0:g.value,xe={Authorization:`Bearer ${await I.getAccessToken()}`},Le=`${(b=I.env)==null?void 0:b.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${I.projectId}/${Zt["google-sheet"]}/${Z}`,Fe=async pt=>Ht.post(Le,pt,{headers:xe}),tt=await Ha(W,"Id",async()=>(await Fe({method:"GET",endpoint:`/v4/spreadsheets/${Y}?fields=sheets.properties(sheetId,title)`})).data.sheets.map(Me=>({id:Me.properties.sheetId,name:Me.properties.title}))),We=ps(tt,{errorPrefix:`${P}The ${O(ie,"Range","range")} input `}),et={range:We},qe={},ot=typeof re=="string"?re:String(re||""),st=$Rn[ot]||(re?String(re).toUpperCase():void 0);if(st){const pt=Array.isArray(le)?le.map(Me=>({userEnteredValue:String(Me)})):le!=null&&le!==""?[{userEnteredValue:String(le)}]:void 0;qe.condition={type:st,...pt?{values:pt}:{}}}Array.isArray(ce)&&ce.length>0&&(qe.hiddenValues=ce.map(pt=>String(pt))),Object.keys(qe).length>0&&(et.criteria={[ee]:qe});const ft=typeof Ce=="string"?Ce:String(Ce||""),Et=GRn[ft]||(Ce?String(Ce).toUpperCase():void 0);if(Et){const pt=We.startColumnIndex??0,Me=ee>=1?pt+(ee-1):pt+ee;et.sortSpecs=[{dimensionIndex:Me,sortOrder:Et}]}return await Fe({method:"POST",endpoint:`/v4/spreadsheets/${Y}:batchUpdate`,data:{requests:[{setBasicFilter:{filter:et}}]}}),{value:K.Success,result:null,error:null}}catch(I){const A=((R=I.response)==null?void 0:R.data)||I.message||I;return pe.Logger.log("[Google Sheets] error:",A),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:A,result:null}}}})}}class v1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsRemoveFilter,version:"1.0.0",description:"Remove Filter Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsRemoveFilter);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"removeFilter"),b="["+Ve(t,t.project,"Remove filter")+": `"+T+"`] ",R=(ee,Q,re)=>{const ae=Ve(ee==null?void 0:ee.valueOwner,m==null?void 0:m.logic,Q),le=Be(ee==null?void 0:ee.valueOwner,m==null?void 0:m.logic,re);return`"${ae}" (\`${le}\`)`},I=n.find(ee=>{var Q;return((Q=ee.valueOwner.declaration)==null?void 0:Q.id)===G.operation[X.GoogleSheetsRemoveFilter].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=ui(A);if(!x)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(ee=>{var Q;return((Q=ee.valueOwner.declaration)==null?void 0:Q.id)===G.operation[X.GoogleSheetsRemoveFilter].inputs.spreadsheetId.id}),O=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(O,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(ee=>{var Q;return((Q=ee.valueOwner.declaration)==null?void 0:Q.id)===G.operation[X.GoogleSheetsRemoveFilter].inputs.range.id}),Z=(e=U==null?void 0:U.value)==null?void 0:e.value;if(Z==null)throw new Error(`${b}The ${R(U,"Range","range")} input is missing.`);const H={Authorization:`Bearer ${await m.getAccessToken()}`},Y=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${x}`,ie=async ee=>Ht.post(Y,ee,{headers:H}),W=await Ha(Z,"Id",async()=>(await ie({method:"GET",endpoint:`/v4/spreadsheets/${$}?fields=sheets.properties(sheetId,title)`})).data.sheets.map(Q=>({id:Q.properties.sheetId,name:Q.properties.title}))),J=ps(W,{errorPrefix:`${b}The ${R(U,"Range","range")} input `}).sheetId;return await ie({method:"POST",endpoint:`/v4/spreadsheets/${$}:batchUpdate`,data:{requests:[{clearBasicFilter:{sheetId:J}}]}}),{value:K.Success,result:null,error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class g1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsUpdateSpreadsheetProperties,version:"1.0.0",description:"Update Spreadsheet Properties Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsUpdateSpreadsheetProperties);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I;try{const A=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!A||!A.env)throw new Error("Editor context or environment missing");const x=Be(t,t.project,"updateSpreadsheetProperties"),O="["+Ve(t,t.project,"Update spreadsheet properties")+": `"+x+"`] ",$=(st,ft,Et)=>{const pt=Ve(st==null?void 0:st.valueOwner,A==null?void 0:A.logic,ft),Me=Be(st==null?void 0:st.valueOwner,A==null?void 0:A.logic,Et);return`"${pt}" (\`${Me}\`)`},U=n.find(st=>{var ft;return((ft=st.valueOwner.declaration)==null?void 0:ft.id)===G.operation[X.GoogleSheetsUpdateSpreadsheetProperties].inputs.connection.id}),Z=(s=U==null?void 0:U.value)==null?void 0:s.valueAsType;if(!Z||!Z.id||!Z.name||Z.type!==r.DefinitionEntity)throw new Error(`${O}The ${$(U,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const j=ui(Z);if(!j)throw new Error(`${O}The ${$(U,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const H=n.find(st=>{var ft;return((ft=st.valueOwner.declaration)==null?void 0:ft.id)===G.operation[X.GoogleSheetsUpdateSpreadsheetProperties].inputs.spreadsheetId.id}),Y=(u=H==null?void 0:H.value)==null?void 0:u.value,ie=ln(Y,{errorPrefix:`${O}The ${$(H,"Spreadsheet ID","spreadsheetId")} input `}),W=n.find(st=>{var ft;return((ft=st.valueOwner.declaration)==null?void 0:ft.id)===G.operation[X.GoogleSheetsUpdateSpreadsheetProperties].inputs.title.id}),z=(e=W==null?void 0:W.value)==null?void 0:e.value;if(z!=null&&typeof z!="string")throw new Error(`${O}The ${$(W,"Title","title")} input value is invalid. If present, it must be a string. E.g. "My Spreadsheet"`);const J=n.find(st=>{var ft;return((ft=st.valueOwner.declaration)==null?void 0:ft.id)===G.operation[X.GoogleSheetsUpdateSpreadsheetProperties].inputs.locale.id}),ee=(f=J==null?void 0:J.value)==null?void 0:f.value;if(ee!=null&&typeof ee!="string")throw new Error(`${O}The ${$(J,"Locale","locale")} input value is invalid. If present, it must be a string. E.g. "en_US"`);const Q=n.find(st=>{var ft;return((ft=st.valueOwner.declaration)==null?void 0:ft.id)===G.operation[X.GoogleSheetsUpdateSpreadsheetProperties].inputs.timeZone.id}),re=(y=Q==null?void 0:Q.value)==null?void 0:y.value;if(re!=null&&typeof re!="string")throw new Error(`${O}The ${$(Q,"Time Zone","timeZone")} input value is invalid. If present, it must be a string. E.g. "America/New_York"`);const ae=n.find(st=>{var ft;return((ft=st.valueOwner.declaration)==null?void 0:ft.id)===G.operation[X.GoogleSheetsUpdateSpreadsheetProperties].inputs.autoRecalc.id}),le=(m=ae==null?void 0:ae.value)==null?void 0:m.value;if(le!=null&&typeof le!="string")throw new Error(`${O}The ${$(ae,"Auto Recalculation","autoRecalc")} input value is invalid. If present, it must be a string enum value. E.g. "ON_CHANGE"`);const oe=n.find(st=>{var ft;return((ft=st.valueOwner.declaration)==null?void 0:ft.id)===G.operation[X.GoogleSheetsUpdateSpreadsheetProperties].inputs.defaultFormat.id}),ce=(T=oe==null?void 0:oe.value)==null?void 0:T.value;if(ce!=null&&(typeof ce!="object"||Array.isArray(ce)))throw new Error(`${O}The ${$(oe,"Default Format","defaultFormat")} input value is invalid. If present, it must be an object representing the CellFormat.`);const be=n.find(st=>{var ft;return((ft=st.valueOwner.declaration)==null?void 0:ft.id)===G.operation[X.GoogleSheetsUpdateSpreadsheetProperties].inputs.iterativeCalculationSettings.id}),Ce=(g=be==null?void 0:be.value)==null?void 0:g.value;if(Ce!=null&&(typeof Ce!="object"||Array.isArray(Ce)))throw new Error(`${O}The ${$(be,"Iterative Calculation Settings","iterativeCalculationSettings")} input value is invalid. If present, it must be an object.`);const Ee=n.find(st=>{var ft;return((ft=st.valueOwner.declaration)==null?void 0:ft.id)===G.operation[X.GoogleSheetsUpdateSpreadsheetProperties].inputs.spreadsheetTheme.id}),xe=(b=Ee==null?void 0:Ee.value)==null?void 0:b.value;if(xe!=null&&(typeof xe!="object"||Array.isArray(xe)))throw new Error(`${O}The ${$(Ee,"Spreadsheet Theme","spreadsheetTheme")} input value is invalid. If present, it must be an object.`);const Le={};if(z!=null&&(Le.title=z),ee!=null&&(Le.locale=ee),re!=null&&(Le.timeZone=re),le!=null){const st={"On change":"ON_CHANGE","Every minute":"MINUTE","Every hour":"HOUR"};Le.autoRecalc=st[le]||le.toUpperCase()}ce!=null&&(Le.defaultFormat=ce),Ce!=null&&(Le.iterativeCalculationSettings=Ce),xe!=null&&(Le.spreadsheetTheme=xe);const Fe=(st,ft="")=>{let Et=[];for(const pt in st){if(!Object.prototype.hasOwnProperty.call(st,pt))continue;const Me=st[pt],Je=ft?`${ft}.${pt}`:pt;Me!==null&&typeof Me=="object"&&!Array.isArray(Me)&&Object.keys(Me).length>0?Et.push(...Fe(Me,Je)):Et.push(Je)}return Et},tt=Fe(Le);if(tt.length===0)throw new Error(`${O}At least one property must be provided to update.`);const et={Authorization:`Bearer ${await A.getAccessToken()}`},qe=`${(R=A.env)==null?void 0:R.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${A.projectId}/${Zt["google-sheet"]}/${j}`;return await(async st=>Ht.post(qe,st,{headers:et}))({method:"POST",endpoint:`/v4/spreadsheets/${ie}:batchUpdate`,data:{requests:[{updateSpreadsheetProperties:{properties:Le,fields:tt.join(",")}}]}}),{value:K.Success,result:null,error:null}}catch(A){const x=((I=A.response)==null?void 0:I.data)||A.message||A;return pe.Logger.log("[Google Sheets] error:",x),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:x,result:null}}}})}}const R5=(a,p)=>(pe.Logger.log("[Google Sheets Clone Sheet] error:",p),{value:a.catchesError||a.errorCalls.length?K.CaughtError:K.UnhandledError,error:p,result:null});class b1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsCloneSheet,version:"1.0.0",description:"Google Sheets clone sheet operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsCloneSheet);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A,x,P;try{const O=this.extensionsRegistry.requestContexts(this,[te.Editor])[0],$=Be(t,t.project,"cloneSheet"),Z="["+Ve(t,t.project,"Clone Sheet")+": `"+$+"`] ",j=(qe,ot,st)=>{const ft=Ve(qe==null?void 0:qe.valueOwner,O==null?void 0:O.logic,ot),Et=Be(qe==null?void 0:qe.valueOwner,O==null?void 0:O.logic,st);return`"${ft}" (\`${Et}\`)`},H=G.operation[X.GoogleSheetsCloneSheet],Y=n.find(qe=>{var ot,st;return((st=(ot=qe.valueOwner)==null?void 0:ot.declaration)==null?void 0:st.id)===H.inputs.connection.id}),ie=((s=Y==null?void 0:Y.value)==null?void 0:s.valueAsType)??((u=Y==null?void 0:Y.value)==null?void 0:u.value);if(!ie||!ie.id||!ie.name||ie.type!==r.DefinitionEntity)throw new Error(`${Z}The ${j(Y,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const W=ui(ie);if(!W)throw new Error(`${Z}The ${j(Y,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const z=n.find(qe=>{var ot,st;return((st=(ot=qe.valueOwner)==null?void 0:ot.declaration)==null?void 0:st.id)===H.inputs.spreadsheetId.id}),J=(e=z==null?void 0:z.value)==null?void 0:e.value,ee=ln(J,{errorPrefix:`${Z}The ${j(z,"Spreadsheet ID","spreadsheetId")} input `}),Q=n.find(qe=>{var ot,st;return((st=(ot=qe.valueOwner)==null?void 0:ot.declaration)==null?void 0:st.id)===H.inputs.sheet.id}),re=(f=Q==null?void 0:Q.value)==null?void 0:f.value;if(re==null||re==="")throw new Error(`${Z}The ${j(Q,"Sheet","sheet")} input is missing.`);const ae=(m=(y=n.find(qe=>{var ot,st;return((st=(ot=qe.valueOwner)==null?void 0:ot.declaration)==null?void 0:st.id)===H.inputs.newSheetName.id}))==null?void 0:y.value)==null?void 0:m.value,le=(g=(T=n.find(qe=>{var ot,st;return((st=(ot=qe.valueOwner)==null?void 0:ot.declaration)==null?void 0:st.id)===H.inputs.insertIndex.id}))==null?void 0:T.value)==null?void 0:g.value,ce={Authorization:`Bearer ${await O.getAccessToken()}`},be=`${(b=O.env)==null?void 0:b.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${O.projectId}/${Zt["google-sheet"]}/${W}`,Ce=async qe=>Ht.post(be,qe,{headers:ce});let Ee;if(!isNaN(Number(re)))Ee=Number(re);else{const st=(((R=(await Ce({method:"GET",endpoint:`/v4/spreadsheets/${ee}`})).data)==null?void 0:R.sheets)||[]).find(ft=>{var Et;return((Et=ft.properties)==null?void 0:Et.title)===String(re)});if(!st)return R5(t,`Could not find sheet with name "${re}"`);Ee=st.properties.sheetId}const xe={sourceSheetId:Ee};ae&&(xe.newSheetName=ae),typeof le=="number"&&(xe.insertSheetIndex=le);const tt=((x=(A=(I=((await Ce({method:"POST",endpoint:`/v4/spreadsheets/${ee}:batchUpdate`,data:{requests:[{duplicateSheet:xe}]}})).data||{}).replies)==null?void 0:I[0])==null?void 0:A.duplicateSheet)==null?void 0:x.properties)||{},We=tt.gridProperties||{},et={sheetId:tt.sheetId,title:tt.title,index:tt.index,sheetType:tt.sheetType,rowCount:We.rowCount,columnCount:We.columnCount,frozenRowCount:We.frozenRowCount,frozenColumnCount:We.frozenColumnCount,hideGridlines:We.hideGridlines??!1,rowGroupControlAfter:We.rowGroupControlAfter??!1,columnGroupControlAfter:We.columnGroupControlAfter??!1,hidden:tt.hidden??!1,rightToLeft:tt.rightToLeft??!1,tabColor:tt.tabColor?{red:tt.tabColor.red??0,green:tt.tabColor.green??0,blue:tt.tabColor.blue??0,alpha:tt.tabColor.alpha??1}:null,basicFilter:null,protectedRanges:[],bandedRanges:[],charts:[],conditionalFormatRules:[],mergedCells:[]};return{value:K.Success,error:null,result:et}}catch(O){const $=((P=O.response)==null?void 0:P.data)||O.message||O;return R5(t,$)}}})}}class E1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsDeleteChart,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsDeleteChart);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"deleteChart"),b="["+Ve(t,t.project,"Delete Chart")+": `"+T+"`] ",R=(J,ee,Q)=>{const re=Ve(J==null?void 0:J.valueOwner,m==null?void 0:m.logic,ee),ae=Be(J==null?void 0:J.valueOwner,m==null?void 0:m.logic,Q);return`"${re}" (\`${ae}\`)`},I=n.find(J=>{var ee;return((ee=J.valueOwner.declaration)==null?void 0:ee.id)===G.operation[X.GoogleSheetsDeleteChart].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=ui(A);if(!x)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(J=>{var ee;return((ee=J.valueOwner.declaration)==null?void 0:ee.id)===G.operation[X.GoogleSheetsDeleteChart].inputs.spreadsheetId.id}),O=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(O,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(J=>{var ee;return((ee=J.valueOwner.declaration)==null?void 0:ee.id)===G.operation[X.GoogleSheetsDeleteChart].inputs.chartId.id}),Z=(e=U==null?void 0:U.value)==null?void 0:e.value;let j=typeof Z=="number"?Z:typeof Z=="string"?parseInt(Z,10):NaN;if(isNaN(j))throw new Error(`${b}The ${R(U,"Chart ID","chartId")} input is missing or invalid. Expected a numeric chart ID.`);const Y={Authorization:`Bearer ${await m.getAccessToken()}`},ie=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${x}`,W=async J=>Ht.post(ie,J,{headers:Y});let z={};return z.deleteEmbeddedObject={objectId:j},await W({method:"POST",endpoint:`/v4/spreadsheets/${$}:batchUpdate`,data:{requests:[z]}}),{value:K.Success,result:null,error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class I1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsDeletePivotTable,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsDeletePivotTable);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"deletePivotTable"),b="["+Ve(t,t.project,"Delete Pivot Table")+": `"+T+"`] ",R=(re,ae,le)=>{const oe=Ve(re==null?void 0:re.valueOwner,m==null?void 0:m.logic,ae),ce=Be(re==null?void 0:re.valueOwner,m==null?void 0:m.logic,le);return`"${oe}" (\`${ce}\`)`},I=n.find(re=>{var ae;return((ae=re.valueOwner.declaration)==null?void 0:ae.id)===G.operation[X.GoogleSheetsDeletePivotTable].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=ui(A);if(!x)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(re=>{var ae;return((ae=re.valueOwner.declaration)==null?void 0:ae.id)===G.operation[X.GoogleSheetsDeletePivotTable].inputs.spreadsheetId.id}),O=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(O,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(re=>{var ae;return((ae=re.valueOwner.declaration)==null?void 0:ae.id)===G.operation[X.GoogleSheetsDeletePivotTable].inputs.destination.id}),Z=(e=U==null?void 0:U.value)==null?void 0:e.value;if(Z==null)throw new Error(`${b}The ${R(U,"destination","destination")} input is missing.`);const H={Authorization:`Bearer ${await m.getAccessToken()}`},Y=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${x}`,ie=async re=>Ht.post(Y,re,{headers:H});let W=[];try{W=(await ie({method:"GET",endpoint:`/v4/spreadsheets/${$}?fields=sheets(properties(sheetId,title))`})).data.sheets||[]}catch{}const z=await Ha(Z,"Id",async()=>W.map(re=>({id:re.properties.sheetId,name:re.properties.title}))),J=ps(z,{errorPrefix:`${b}The ${R(U,"destination","destination")} input `});let Q={updateCells:{start:{sheetId:J.sheetId??0,rowIndex:J.startRowIndex??0,columnIndex:J.startColumnIndex??0},rows:[{values:[{pivotTable:null}]}],fields:"pivotTable"}};return await ie({method:"POST",endpoint:`/v4/spreadsheets/${$}:batchUpdate`,data:{requests:[Q]}}),{value:K.Success,result:null,error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class R1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsDeleteDimension,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsDeleteDimension);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b;try{const R=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!R||!R.env)throw new Error("Editor context or environment missing");const I=Be(t,t.project,"deleteDimension"),x="["+Ve(t,t.project,"Delete Dimension")+": `"+I+"`] ",P=(Fe,tt,We)=>{const et=Ve(Fe==null?void 0:Fe.valueOwner,R==null?void 0:R.logic,tt),qe=Be(Fe==null?void 0:Fe.valueOwner,R==null?void 0:R.logic,We);return`"${et}" (\`${qe}\`)`},O=n.find(Fe=>{var tt;return((tt=Fe.valueOwner.declaration)==null?void 0:tt.id)===G.operation[X.GoogleSheetsDeleteDimension].inputs.connection.id}),$=(s=O==null?void 0:O.value)==null?void 0:s.valueAsType;if(!$||!$.id||!$.name||$.type!==r.DefinitionEntity)throw new Error(`${x}The ${P(O,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const U=ui($);if(!U)throw new Error(`${x}The ${P(O,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const Z=n.find(Fe=>{var tt;return((tt=Fe.valueOwner.declaration)==null?void 0:tt.id)===G.operation[X.GoogleSheetsDeleteDimension].inputs.spreadsheetId.id}),j=(u=Z==null?void 0:Z.value)==null?void 0:u.value,H=ln(j,{errorPrefix:`${x}The ${P(Z,"Spreadsheet ID","spreadsheetId")} input `}),Y=n.find(Fe=>{var tt,We;return((tt=Fe.valueOwner.declaration)==null?void 0:tt.id)===((We=G.operation[X.GoogleSheetsDeleteDimension].inputs.sheet)==null?void 0:We.id)}),ie=(e=Y==null?void 0:Y.value)==null?void 0:e.value,W=n.find(Fe=>{var tt,We;return((tt=Fe.valueOwner.declaration)==null?void 0:tt.id)===((We=G.operation[X.GoogleSheetsDeleteDimension].inputs.dimension)==null?void 0:We.id)}),z=(f=W==null?void 0:W.value)==null?void 0:f.value,J=n.find(Fe=>{var tt,We;return((tt=Fe.valueOwner.declaration)==null?void 0:tt.id)===((We=G.operation[X.GoogleSheetsDeleteDimension].inputs.startIndex)==null?void 0:We.id)}),ee=(y=J==null?void 0:J.value)==null?void 0:y.value,Q=n.find(Fe=>{var tt,We;return((tt=Fe.valueOwner.declaration)==null?void 0:tt.id)===((We=G.operation[X.GoogleSheetsDeleteDimension].inputs.endIndex)==null?void 0:We.id)}),re=(m=Q==null?void 0:Q.value)==null?void 0:m.value,le={Authorization:`Bearer ${await R.getAccessToken()}`},oe=`${(T=R.env)==null?void 0:T.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${R.projectId}/${Zt["google-sheet"]}/${U}`,ce=async Fe=>Ht.post(oe,Fe,{headers:le});if(ie==null||ie==="")throw new Error(`${x}The ${P(Y,"Sheet","sheet")} input is missing.`);if(z==null||z==="")throw new Error(`${x}The ${P(W,"Dimension","dimension")} input is missing.`);const be=String(z).trim().toUpperCase();if(be!=="ROWS"&&be!=="COLUMNS")throw new Error(`${x}The ${P(W,"Dimension","dimension")} input is invalid. Expected "Rows" or "Columns".`);const Ce=typeof ee=="number"?ee:parseInt(String(ee),10);if(isNaN(Ce)||Ce<1)throw new Error(`${x}The ${P(J,"Start index","startIndex")} input is missing or invalid. Expected a positive integer starting at 1.`);let Ee=Ce;if(re!=null&&re!==""&&(Ee=typeof re=="number"?re:parseInt(String(re),10),isNaN(Ee)||Ee<Ce))throw new Error(`${x}The ${P(Q,"End index","endIndex")} input is invalid. Expected an integer greater than or equal to Start index.`);let xe;if(typeof ie=="number"||/^\d+$/.test(String(ie).trim()))xe=Number(ie);else{const We=(((g=(await ce({method:"GET",endpoint:`/v4/spreadsheets/${H}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:g.sheets)||[]).find(et=>{var qe;return String((qe=et.properties)==null?void 0:qe.title).trim().toLowerCase()===String(ie).trim().toLowerCase()});if(!We)throw new Error(`${x}The ${P(Y,"Sheet","sheet")} input "${ie}" was not found in spreadsheet.`);xe=We.properties.sheetId}let Le={};return Le.deleteDimension={range:{sheetId:xe,dimension:be,startIndex:Ce-1,endIndex:Ee}},await ce({method:"POST",endpoint:`/v4/spreadsheets/${H}:batchUpdate`,data:{requests:[Le]}}),{value:K.Success,result:null,error:null}}catch(R){const I=((b=R.response)==null?void 0:b.data)||R.message||R;return pe.Logger.log("[Google Sheets] error:",I),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:I,result:null}}}})}}class A1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsDeleteProtectedRange,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsDeleteProtectedRange);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"deleteProtectedRange"),b="["+Ve(t,t.project,"Delete Protected Range")+": `"+T+"`] ",R=(z,J,ee)=>{const Q=Ve(z==null?void 0:z.valueOwner,m==null?void 0:m.logic,J),re=Be(z==null?void 0:z.valueOwner,m==null?void 0:m.logic,ee);return`"${Q}" (\`${re}\`)`},I=n.find(z=>{var J;return((J=z.valueOwner.declaration)==null?void 0:J.id)===G.operation[X.GoogleSheetsDeleteProtectedRange].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=ui(A);if(!x)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(z=>{var J;return((J=z.valueOwner.declaration)==null?void 0:J.id)===G.operation[X.GoogleSheetsDeleteProtectedRange].inputs.spreadsheetId.id}),O=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(O,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(z=>{var J;return((J=z.valueOwner.declaration)==null?void 0:J.id)===G.operation[X.GoogleSheetsDeleteProtectedRange].inputs.protectedRangeId.id}),Z=(e=U==null?void 0:U.value)==null?void 0:e.value;if(Z==null)throw new Error(`${b}The ${R(U,"protectedRangeId","protectedRangeId")} input is missing.`);const H={Authorization:`Bearer ${await m.getAccessToken()}`},Y=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${x}`,ie=async z=>Ht.post(Y,z,{headers:H});let W={};return W.deleteProtectedRange={protectedRangeId:typeof Z=="string"&&Z.trim().startsWith("{")?JSON.parse(Z):Z},await ie({method:"POST",endpoint:`/v4/spreadsheets/${$}:batchUpdate`,data:{requests:[W]}}),{value:K.Success,result:null,error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class D1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsAddBanding,version:"1.0.0",description:"Add Banding Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsAddBanding);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A,x,P,O,$,U;try{const Z=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!Z||!Z.env)throw new Error("Editor context or environment missing");const j=Be(t,t.project,"addBanding"),Y="["+Ve(t,t.project,"Add Banding")+": `"+j+"`] ",ie=(di,bt,dt)=>{const It=Ve(di==null?void 0:di.valueOwner,Z==null?void 0:Z.logic,bt),Wt=Be(di==null?void 0:di.valueOwner,Z==null?void 0:Z.logic,dt);return`"${It}" (\`${Wt}\`)`},W=n.find(di=>{var bt;return((bt=di.valueOwner.declaration)==null?void 0:bt.id)===G.operation[X.GoogleSheetsAddBanding].inputs.connection.id}),z=(s=W==null?void 0:W.value)==null?void 0:s.valueAsType;if(!z||!z.id||!z.name||z.type!==r.DefinitionEntity)throw new Error(`${Y}The ${ie(W,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const J=ui(z);if(!J)throw new Error(`${Y}The ${ie(W,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const ee=n.find(di=>{var bt;return((bt=di.valueOwner.declaration)==null?void 0:bt.id)===G.operation[X.GoogleSheetsAddBanding].inputs.spreadsheetId.id}),Q=(u=ee==null?void 0:ee.value)==null?void 0:u.value,re=ln(Q,{errorPrefix:`${Y}The ${ie(ee,"Spreadsheet ID","spreadsheetId")} input `}),ae=n.find(di=>{var bt;return((bt=di.valueOwner.declaration)==null?void 0:bt.id)===G.operation[X.GoogleSheetsAddBanding].inputs.bandedRange.id}),le=(e=ae==null?void 0:ae.value)==null?void 0:e.value;if(le==null)throw new Error(`${Y}The ${ie(ae,"bandedRange","bandedRange")} input is missing.`);const oe=n.find(di=>{var bt,dt;return((bt=di.valueOwner.declaration)==null?void 0:bt.id)===((dt=G.operation[X.GoogleSheetsAddBanding].inputs.bandingOrientation)==null?void 0:dt.id)}),ce=(f=oe==null?void 0:oe.value)==null?void 0:f.value,be=typeof ce=="string"?ce:"Rows";if(!["Rows","Columns","Grid"].includes(be))throw new Error(`${Y}The ${ie(oe,"Banding Orientation","bandingOrientation")} input must be one of "Rows", "Columns", or "Grid". Received: "${be}".`);const Ce=n.find(di=>{var bt,dt;return((bt=di.valueOwner.declaration)==null?void 0:bt.id)===((dt=G.operation[X.GoogleSheetsAddBanding].inputs.headerColor)==null?void 0:dt.id)}),Ee=(y=Ce==null?void 0:Ce.value)==null?void 0:y.value,xe=n.find(di=>{var bt,dt;return((bt=di.valueOwner.declaration)==null?void 0:bt.id)===((dt=G.operation[X.GoogleSheetsAddBanding].inputs.firstBandColor)==null?void 0:dt.id)}),Le=(m=xe==null?void 0:xe.value)==null?void 0:m.value,Fe=n.find(di=>{var bt,dt;return((bt=di.valueOwner.declaration)==null?void 0:bt.id)===((dt=G.operation[X.GoogleSheetsAddBanding].inputs.secondBandColor)==null?void 0:dt.id)}),tt=(T=Fe==null?void 0:Fe.value)==null?void 0:T.value,We=n.find(di=>{var bt,dt;return((bt=di.valueOwner.declaration)==null?void 0:bt.id)===((dt=G.operation[X.GoogleSheetsAddBanding].inputs.footerColor)==null?void 0:dt.id)}),et=(g=We==null?void 0:We.value)==null?void 0:g.value,qe=n.find(di=>{var bt,dt;return((bt=di.valueOwner.declaration)==null?void 0:bt.id)===((dt=G.operation[X.GoogleSheetsAddBanding].inputs.gridBandColor)==null?void 0:dt.id)}),ot=(b=qe==null?void 0:qe.value)==null?void 0:b.value,st=n.find(di=>{var bt,dt;return((bt=di.valueOwner.declaration)==null?void 0:bt.id)===((dt=G.operation[X.GoogleSheetsAddBanding].inputs.deleteConflictingBanding)==null?void 0:dt.id)}),ft=((R=st==null?void 0:st.value)==null?void 0:R.value)??!0,pt={Authorization:`Bearer ${await Z.getAccessToken()}`},Me=`${(I=Z.env)==null?void 0:I.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${Z.projectId}/${Zt["google-sheet"]}/${J}`,Je=async di=>Ht.post(Me,di,{headers:pt});let ke=[],lt=[];try{lt=(await Je({method:"GET",endpoint:`/v4/spreadsheets/${re}?fields=sheets(properties(sheetId,title),bandedRanges)`})).data.sheets||[]}catch{}const Pt=await Ha(le,"Id",async()=>lt.map(di=>({id:di.properties.sheetId,name:di.properties.title}))),Gt=ps(Pt,{errorPrefix:`${Y}The ${ie(ae,"bandedRange","bandedRange")} input `});let si=null;if(Gt.sheetId!==void 0&&Gt.sheetId!==null)si=lt.find(di=>{var bt;return((bt=di.properties)==null?void 0:bt.sheetId)===Gt.sheetId});else if(Pt&&Pt.sheet!==void 0&&Pt.sheet!==null&&Pt.sheet!==""){const di=String(Pt.sheet).trim().toLowerCase();if(si=lt.find(bt=>{var dt,It;return String((dt=bt.properties)==null?void 0:dt.title).trim().toLowerCase()===di||String((It=bt.properties)==null?void 0:It.sheetId)===di}),!si)throw new Error(`${Y}Sheet "${Pt.sheet}" was not found in the spreadsheet.`);Gt.sheetId=si.properties.sheetId}else si=lt[0],Gt.sheetId=((A=si==null?void 0:si.properties)==null?void 0:A.sheetId)??0;Gt.startRowIndex===void 0&&Gt.endRowIndex===void 0&&Gt.startColumnIndex===void 0&&Gt.endColumnIndex===void 0&&(Gt.startRowIndex=0,Gt.endRowIndex=100,Gt.startColumnIndex=0,Gt.endColumnIndex=26),si!=null&&si.bandedRanges&&(ke=si.bandedRanges);const pi={range:Gt},kt=fo(Ee),Ct=fo(Le),Oi=fo(tt),wn=fo(et),Yr=fo(ot),Jr={firstBandColor:Ct||{red:1,green:1,blue:1,alpha:1},secondBandColor:Oi||{red:.95,green:.95,blue:.95,alpha:1}};kt&&(Jr.headerColor=kt),wn&&(Jr.footerColor=wn);const hi={firstBandColor:be==="Grid"?Yr||Ct||{red:1,green:1,blue:1,alpha:1}:Ct||{red:1,green:1,blue:1,alpha:1},secondBandColor:be==="Grid"?Yr||Oi||{red:.95,green:.95,blue:.95,alpha:1}:Oi||{red:.95,green:.95,blue:.95,alpha:1}};kt&&(hi.headerColor=kt),wn&&(hi.footerColor=wn),be==="Grid"?(pi.rowProperties=Jr,pi.columnProperties=hi):be==="Columns"?pi.columnProperties=hi:pi.rowProperties=Jr;const $t=[];if(ft)for(const di of ke)di.bandedRangeId!==void 0&&$t.push({deleteBanding:{bandedRangeId:di.bandedRangeId}});$t.push({addBanding:{bandedRange:pi}});const ci=(P=(x=(await Je({method:"POST",endpoint:`/v4/spreadsheets/${re}:batchUpdate`,data:{requests:$t}})).data)==null?void 0:x.replies)==null?void 0:P.find(di=>di.addBanding),oi=($=(O=ci==null?void 0:ci.addBanding)==null?void 0:O.bandedRange)==null?void 0:$.bandedRangeId;return{value:K.Success,result:{bandedRangeId:oi},error:null}}catch(Z){const j=((U=Z.response)==null?void 0:U.data)||Z.message||Z;return pe.Logger.log("[Google Sheets] error:",j),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:j,result:null}}}})}}class LRn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsUpdateBanding,version:"1.0.0",description:"Update Banding Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsUpdateBanding);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A;try{const x=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!x||!x.env)throw new Error("Editor context or environment missing");const P=Be(t,t.project,"updateBanding"),$="["+Ve(t,t.project,"Update Banding")+": `"+P+"`] ",U=(ci,oi,di)=>{const bt=Ve(ci==null?void 0:ci.valueOwner,x==null?void 0:x.logic,oi),dt=Be(ci==null?void 0:ci.valueOwner,x==null?void 0:x.logic,di);return`"${bt}" (\`${dt}\`)`},Z=n.find(ci=>{var oi;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===G.operation[X.GoogleSheetsUpdateBanding].inputs.connection.id}),j=(s=Z==null?void 0:Z.value)==null?void 0:s.valueAsType;if(!j||!j.id||!j.name||j.type!==r.DefinitionEntity)throw new Error(`${$}The ${U(Z,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const H=ui(j);if(!H)throw new Error(`${$}The ${U(Z,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const Y=n.find(ci=>{var oi;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===G.operation[X.GoogleSheetsUpdateBanding].inputs.spreadsheetId.id}),ie=(u=Y==null?void 0:Y.value)==null?void 0:u.value,W=ln(ie,{errorPrefix:`${$}The ${U(Y,"Spreadsheet ID","spreadsheetId")} input `}),z=n.find(ci=>{var oi;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===G.operation[X.GoogleSheetsUpdateBanding].inputs.bandedRangeId.id}),J=(e=z==null?void 0:z.value)==null?void 0:e.value;if(J==null||J==="")throw new Error(`${$}The ${U(z,"Banded Range ID","bandedRangeId")} input is missing.`);const ee=Number(J),Q=n.find(ci=>{var oi,di;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===((di=G.operation[X.GoogleSheetsUpdateBanding].inputs.bandedRange)==null?void 0:di.id)}),re=(f=Q==null?void 0:Q.value)==null?void 0:f.value,ae=n.find(ci=>{var oi,di;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===((di=G.operation[X.GoogleSheetsUpdateBanding].inputs.bandingOrientation)==null?void 0:di.id)}),le=(y=ae==null?void 0:ae.value)==null?void 0:y.value,oe=n.find(ci=>{var oi,di;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===((di=G.operation[X.GoogleSheetsUpdateBanding].inputs.headerColor)==null?void 0:di.id)}),ce=(m=oe==null?void 0:oe.value)==null?void 0:m.value,be=n.find(ci=>{var oi,di;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===((di=G.operation[X.GoogleSheetsUpdateBanding].inputs.firstBandColor)==null?void 0:di.id)}),Ce=(T=be==null?void 0:be.value)==null?void 0:T.value,Ee=n.find(ci=>{var oi,di;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===((di=G.operation[X.GoogleSheetsUpdateBanding].inputs.secondBandColor)==null?void 0:di.id)}),xe=(g=Ee==null?void 0:Ee.value)==null?void 0:g.value,Le=n.find(ci=>{var oi,di;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===((di=G.operation[X.GoogleSheetsUpdateBanding].inputs.footerColor)==null?void 0:di.id)}),Fe=(b=Le==null?void 0:Le.value)==null?void 0:b.value,tt=n.find(ci=>{var oi,di;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===((di=G.operation[X.GoogleSheetsUpdateBanding].inputs.gridBandColor)==null?void 0:di.id)}),We=(R=tt==null?void 0:tt.value)==null?void 0:R.value,qe={Authorization:`Bearer ${await x.getAccessToken()}`},ot=`${(I=x.env)==null?void 0:I.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${x.projectId}/${Zt["google-sheet"]}/${H}`,st=async ci=>Ht.post(ot,ci,{headers:qe});let ft=[];try{ft=(await st({method:"GET",endpoint:`/v4/spreadsheets/${W}?fields=sheets(properties(sheetId,title),bandedRanges)`})).data.sheets||[]}catch{}const Et=[];for(const ci of ft)if(ci.bandedRanges)for(const oi of ci.bandedRanges)Et.push({sheet:ci,band:oi});const pt=Et.find(ci=>Number(ci.band.bandedRangeId)===Number(ee));if(Et.length>0&&!pt)throw new Error(`${$}No Banded Range with ID "${ee}" was found in the sheet.`);const Me=pt==null?void 0:pt.band,Je={bandedRangeId:ee};if(re){const ci=await Ha(re,"Id",async()=>ft.map(di=>({id:di.properties.sheetId,name:di.properties.title}))),oi=ps(ci,{errorPrefix:`${$}The ${U(Q,"bandedRange","bandedRange")} input `});(oi.sheetId===void 0||oi.sheetId===null)&&(oi.sheetId=0),Je.range=oi}else Me!=null&&Me.range&&(Je.range=Me.range);const ke=Me!=null&&Me.rowProperties&&(Me!=null&&Me.columnProperties)?"Grid":Me!=null&&Me.columnProperties?"Columns":"Rows",lt=le||ke,Pt=fo(ce),Gt=fo(Ce),si=fo(xe),pi=fo(Fe),kt=fo(We),Ct=(Me==null?void 0:Me.rowProperties)||{},Oi=(Me==null?void 0:Me.columnProperties)||{},wn={firstBandColor:Gt||Ct.firstBandColor||{red:1,green:1,blue:1,alpha:1},secondBandColor:si||Ct.secondBandColor||{red:.95,green:.95,blue:.95,alpha:1}},Yr=Pt||Ct.headerColor;Yr&&(wn.headerColor=Yr);const Jr=pi||Ct.footerColor;Jr&&(wn.footerColor=Jr);const hi={firstBandColor:lt==="Grid"?kt||Gt||Oi.firstBandColor||{red:1,green:1,blue:1,alpha:1}:Gt||Oi.firstBandColor||{red:1,green:1,blue:1,alpha:1},secondBandColor:lt==="Grid"?kt||si||Oi.secondBandColor||{red:.95,green:.95,blue:.95,alpha:1}:si||Oi.secondBandColor||{red:.95,green:.95,blue:.95,alpha:1}},$t=Pt||Oi.headerColor;$t&&(hi.headerColor=$t);const Nt=pi||Oi.footerColor;return Nt&&(hi.footerColor=Nt),lt==="Grid"?(Je.rowProperties=wn,Je.columnProperties=hi):lt==="Columns"?Je.columnProperties=hi:Je.rowProperties=wn,await st({method:"POST",endpoint:`/v4/spreadsheets/${W}:batchUpdate`,data:{requests:[{updateBanding:{bandedRange:Je,fields:"*"}}]}}),{value:K.Success,result:null,error:null}}catch(x){const P=((A=x.response)==null?void 0:A.data)||x.message||x;return pe.Logger.log("[Google Sheets] error:",P),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:P,result:null}}}})}}class BRn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsDeleteBanding,version:"1.0.0",description:"Delete Banding Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsDeleteBanding);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"deleteBanding"),b="["+Ve(t,t.project,"Delete Banding")+": `"+T+"`] ",R=(z,J,ee)=>{const Q=Ve(z==null?void 0:z.valueOwner,m==null?void 0:m.logic,J),re=Be(z==null?void 0:z.valueOwner,m==null?void 0:m.logic,ee);return`"${Q}" (\`${re}\`)`},I=n.find(z=>{var J;return((J=z.valueOwner.declaration)==null?void 0:J.id)===G.operation[X.GoogleSheetsDeleteBanding].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=ui(A);if(!x)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(z=>{var J;return((J=z.valueOwner.declaration)==null?void 0:J.id)===G.operation[X.GoogleSheetsDeleteBanding].inputs.spreadsheetId.id}),O=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(O,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(z=>{var J;return((J=z.valueOwner.declaration)==null?void 0:J.id)===G.operation[X.GoogleSheetsDeleteBanding].inputs.bandedRangeId.id}),Z=(e=U==null?void 0:U.value)==null?void 0:e.value;if(Z==null||Z==="")throw new Error(`${b}The ${R(U,"Banded Range ID","bandedRangeId")} input is missing.`);const j=Number(Z),Y={Authorization:`Bearer ${await m.getAccessToken()}`},ie=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${x}`;return await(async z=>Ht.post(ie,z,{headers:Y}))({method:"POST",endpoint:`/v4/spreadsheets/${$}:batchUpdate`,data:{requests:[{deleteBanding:{bandedRangeId:j}}]}}),{value:K.Success,result:null,error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class C1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsAddChart,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsAddChart);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T;try{const g=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!g||!g.env)throw new Error("Editor context or environment missing");const b=Be(t,t.project,"addChart"),I="["+Ve(t,t.project,"Add Chart")+": `"+b+"`] ",A=(oe,ce,be)=>{const Ce=Ve(oe==null?void 0:oe.valueOwner,g==null?void 0:g.logic,ce),Ee=Be(oe==null?void 0:oe.valueOwner,g==null?void 0:g.logic,be);return`"${Ce}" (\`${Ee}\`)`},x=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[X.GoogleSheetsAddChart].inputs.connection.id}),P=(s=x==null?void 0:x.value)==null?void 0:s.valueAsType;if(!P||!P.id||!P.name||P.type!==r.DefinitionEntity)throw new Error(`${I}The ${A(x,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(P);if(!O)throw new Error(`${I}The ${A(x,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const $=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[X.GoogleSheetsAddChart].inputs.spreadsheetId.id}),U=(u=$==null?void 0:$.value)==null?void 0:u.value,Z=ln(U,{errorPrefix:`${I}The ${A($,"Spreadsheet ID","spreadsheetId")} input `}),j=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[X.GoogleSheetsAddChart].inputs.chart.id}),H=(e=j==null?void 0:j.value)==null?void 0:e.value;if(H==null||typeof H!="object")throw new Error(`${I}The ${A(j,"Chart","chart")} input is missing or invalid. Expected a valid chart object.`);const ie={Authorization:`Bearer ${await g.getAccessToken()}`},W=`${(f=g.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${g.projectId}/${Zt["google-sheet"]}/${O}`,z=async oe=>Ht.post(W,oe,{headers:ie});let J={};J.addChart={chart:H};const Q=(await z({method:"POST",endpoint:`/v4/spreadsheets/${Z}:batchUpdate`,data:{requests:[J]}})).data,re=(m=(y=Q==null?void 0:Q.replies)==null?void 0:y[0])==null?void 0:m.addChart,ae=(re==null?void 0:re.chart)??null,le=(ae==null?void 0:ae.chartId)??null;return{value:K.Success,result:{chartId:le,chart:ae},error:null}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return pe.Logger.log("[Google Sheets] error:",b),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:b,result:null}}}})}}function SRn(a){return{"Number greater than":"NUMBER_GREATER","Number greater than or equal":"NUMBER_GREATER_THAN_EQ","Number less than":"NUMBER_LESS","Number less than or equal":"NUMBER_LESS_THAN_EQ","Number equal to":"NUMBER_EQ","Number not equal to":"NUMBER_NOT_EQ","Number between":"NUMBER_BETWEEN","Number not between":"NUMBER_NOT_BETWEEN","Text contains":"TEXT_CONTAINS","Text does not contain":"TEXT_NOT_CONTAINS","Text starts with":"TEXT_STARTS_WITH","Text ends with":"TEXT_ENDS_WITH","Text equals":"TEXT_EQ","Date is":"DATE_EQ","Date is before":"DATE_BEFORE","Date is after":"DATE_AFTER","Date is on or before":"DATE_ON_OR_BEFORE","Date is on or after":"DATE_ON_OR_AFTER","Cell is empty":"BLANK","Cell is not empty":"NOT_BLANK","Custom formula":"CUSTOM_FORMULA"}[a]||a}class w1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsAddConditionalFormatRule,version:"1.0.0",description:"Add Conditional Format Rule Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsAddConditionalFormatRule);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"addConditionalFormatRule"),b="["+Ve(t,t.project,"Add Conditional Format Rule")+": `"+T+"`] ",R=(pt,Me,Je)=>{const ke=Ve(pt==null?void 0:pt.valueOwner,m==null?void 0:m.logic,Me),lt=Be(pt==null?void 0:pt.valueOwner,m==null?void 0:m.logic,Je);return`"${ke}" (\`${lt}\`)`},I=G.operation[X.GoogleSheetsAddConditionalFormatRule].inputs,A=pt=>{var Je;const Me=n.find(ke=>{var lt;return((lt=ke.valueOwner.declaration)==null?void 0:lt.id)===pt});return(Je=Me==null?void 0:Me.value)==null?void 0:Je.value},x=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===I.connection.id}),P=(s=x==null?void 0:x.value)==null?void 0:s.valueAsType;if(!P||!P.id||!P.name||P.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(x,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(P);if(!O)throw new Error(`${b}The ${R(x,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const $=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===I.spreadsheetId.id}),U=(u=$==null?void 0:$.value)==null?void 0:u.value,Z=ln(U,{errorPrefix:`${b}The ${R($,"Spreadsheet ID","spreadsheetId")} input `}),H={Authorization:`Bearer ${await m.getAccessToken()}`},Y=`${(e=m.env)==null?void 0:e.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${O}`,ie=async pt=>Ht.post(Y,pt,{headers:H}),W=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===I.range.id}),z=A(I.range.id),J=A(I.conditionType.id),ee=A(I.conditionValues.id),Q=A(I.backgroundColor.id),re=A(I.textColor.id),ae=A(I.bold.id),le=A(I.italic.id),oe=A(I.strikethrough.id),ce=A(I.underline.id),be=A(I.index.id),Ce=A(I.fontSize.id),Ee=A(I.fontFamily.id),xe=A(I.horizontalAlignment.id),Le=A(I.verticalAlignment.id),Fe=A(I.wrapStrategy.id);if(!z)throw new Error(`${b}The ${R(W,"Range","range")} input must be provided.`);let tt=ps(z,{errorPrefix:`${b}The Range input `});if(tt.sheetId===void 0){let pt;if(typeof z=="object"&&z!==null&&"sheet"in z?pt=String(z.sheet):typeof z=="string"&&z.includes("!")&&(pt=z.split("!")[0].replace(/^'|'$/g,"")),pt)if(/^\d+$/.test(pt.trim()))tt.sheetId=Number(pt.trim());else{const ke=(((f=(await ie({method:"GET",endpoint:`/v4/spreadsheets/${Z}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:f.sheets)||[]).find(lt=>{var Pt;return String((Pt=lt.properties)==null?void 0:Pt.title).trim().toLowerCase()===pt.trim().toLowerCase()});ke&&(tt.sheetId=ke.properties.sheetId)}}const We=SRn(String(J||"BLANK"));let et=[];Array.isArray(ee)?et=ee.map(pt=>({userEnteredValue:String(pt)})):ee!=null&&ee!==""&&(et=[{userEnteredValue:String(ee)}]);const qe={},ot=fo(Q);ot&&(qe.backgroundColor=ot);const st=fo(re);if(st&&(qe.textFormat=qe.textFormat||{},qe.textFormat.foregroundColor=st),(ae===!0||ae==="true")&&(qe.textFormat=qe.textFormat||{},qe.textFormat.bold=!0),(le===!0||le==="true")&&(qe.textFormat=qe.textFormat||{},qe.textFormat.italic=!0),(oe===!0||oe==="true")&&(qe.textFormat=qe.textFormat||{},qe.textFormat.strikethrough=!0),(ce===!0||ce==="true")&&(qe.textFormat=qe.textFormat||{},qe.textFormat.underline=!0),Ce!=null&&Ce!==""){const pt=typeof Ce=="number"?Ce:parseInt(String(Ce),10);isNaN(pt)||(qe.textFormat=qe.textFormat||{},qe.textFormat.fontSize=pt)}if(typeof Ee=="string"&&Ee.trim()!==""&&(qe.textFormat=qe.textFormat||{},qe.textFormat.fontFamily=Ee.trim()),typeof xe=="string"&&xe!==""){const pt={Left:"LEFT",Center:"CENTER",Right:"RIGHT",Justify:"JUSTIFY"};qe.horizontalAlignment=pt[xe]||xe.toUpperCase()}if(typeof Le=="string"&&Le!==""){const pt={Top:"TOP",Middle:"MIDDLE",Bottom:"BOTTOM"};qe.verticalAlignment=pt[Le]||Le.toUpperCase()}if(typeof Fe=="string"&&Fe!==""){const pt={Overflow:"OVERFLOW_CELL",Wrap:"WRAP",Clip:"CLIP"};qe.wrapStrategy=pt[Fe]||Fe.toUpperCase()}const Et={rule:{ranges:[tt],booleanRule:{condition:{type:We,...et.length?{values:et}:{}},format:qe}}};if(be!=null&&be!==""){const pt=typeof be=="number"?be:parseInt(String(be),10);if(isNaN(pt)||pt<1)throw new Error(`${b}The Index input must be a 1-based positive integer.`);Et.index=pt-1}return await ie({method:"POST",endpoint:`/v4/spreadsheets/${Z}:batchUpdate`,data:{requests:[{addConditionalFormatRule:Et}]}}),{value:K.Success,result:null,error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class x1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsAddProtectedRange,version:"1.0.0",description:"Add Protected Range Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsAddProtectedRange);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A,x,P,O,$;try{const U=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!U||!U.env)throw new Error("Editor context or environment missing");const Z=Be(t,t.project,"addProtectedRange"),H="["+Ve(t,t.project,"Add Protected Range")+": `"+Z+"`] ",Y=(Pt,Gt,si)=>{const pi=Ve(Pt==null?void 0:Pt.valueOwner,U==null?void 0:U.logic,Gt),kt=Be(Pt==null?void 0:Pt.valueOwner,U==null?void 0:U.logic,si);return`"${pi}" (\`${kt}\`)`},ie=n.find(Pt=>{var Gt;return((Gt=Pt.valueOwner.declaration)==null?void 0:Gt.id)===G.operation[X.GoogleSheetsAddProtectedRange].inputs.connection.id}),W=(s=ie==null?void 0:ie.value)==null?void 0:s.valueAsType;if(!W||!W.id||!W.name||W.type!==r.DefinitionEntity)throw new Error(`${H}The ${Y(ie,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const z=ui(W);if(!z)throw new Error(`${H}The ${Y(ie,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const J=n.find(Pt=>{var Gt;return((Gt=Pt.valueOwner.declaration)==null?void 0:Gt.id)===G.operation[X.GoogleSheetsAddProtectedRange].inputs.spreadsheetId.id}),ee=(u=J==null?void 0:J.value)==null?void 0:u.value,Q=ln(ee,{errorPrefix:`${H}The ${Y(J,"Spreadsheet ID","spreadsheetId")} input `}),re=n.find(Pt=>{var Gt;return((Gt=Pt.valueOwner.declaration)==null?void 0:Gt.id)===G.operation[X.GoogleSheetsAddProtectedRange].inputs.range.id}),ae=(e=re==null?void 0:re.value)==null?void 0:e.value;if(ae==null)throw new Error(`${H}The ${Y(re,"Protected Range","range")} input is missing.`);const le=n.find(Pt=>{var Gt;return((Gt=Pt.valueOwner.declaration)==null?void 0:Gt.id)===G.operation[X.GoogleSheetsAddProtectedRange].inputs.description.id}),oe=(f=le==null?void 0:le.value)==null?void 0:f.value,ce=n.find(Pt=>{var Gt;return((Gt=Pt.valueOwner.declaration)==null?void 0:Gt.id)===G.operation[X.GoogleSheetsAddProtectedRange].inputs.warningOnly.id}),be=(y=ce==null?void 0:ce.value)==null?void 0:y.value,Ce=n.find(Pt=>{var Gt;return((Gt=Pt.valueOwner.declaration)==null?void 0:Gt.id)===G.operation[X.GoogleSheetsAddProtectedRange].inputs.editors.id}),Ee=(m=Ce==null?void 0:Ce.value)==null?void 0:m.value,xe=n.find(Pt=>{var Gt;return((Gt=Pt.valueOwner.declaration)==null?void 0:Gt.id)===G.operation[X.GoogleSheetsAddProtectedRange].inputs.domainUsersCanEdit.id}),Le=(T=xe==null?void 0:xe.value)==null?void 0:T.value,tt={Authorization:`Bearer ${await U.getAccessToken()}`},We=`${(g=U.env)==null?void 0:g.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${U.projectId}/${Zt["google-sheet"]}/${z}`,et=async Pt=>Ht.post(We,Pt,{headers:tt});let qe=[];try{qe=((b=(await et({method:"GET",endpoint:`/v4/spreadsheets/${Q}?fields=sheets(properties(sheetId,title))`})).data)==null?void 0:b.sheets)||[]}catch{}const ot=await Ha(ae,"Id",async()=>qe.map(Pt=>{var Gt,si;return{id:(Gt=Pt.properties)==null?void 0:Gt.sheetId,name:(si=Pt.properties)==null?void 0:si.title}})),ft={range:ps(ot,{errorPrefix:`${H}The ${Y(re,"Protected Range","range")} input `})};oe!=null&&oe!==""&&(ft.description=oe);const Et=Array.isArray(Ee)&&Ee.length>0,pt=typeof Le=="boolean";if(be===!0&&Et)throw new Error(`${H}When ${Y(ce,"Warning Only","warningOnly")} is enabled (true), ${Y(Ce,"Editors","editors")} cannot be specified.`);if(be===!0&&pt)throw new Error(`${H}When ${Y(ce,"Warning Only","warningOnly")} is enabled (true), ${Y(xe,"Domain Users Can Edit","domainUsersCanEdit")} cannot be specified.`);if(typeof be=="boolean"&&(ft.warningOnly=be),!ft.warningOnly&&(Et||pt)){const Pt={};Et&&(Pt.users=Ee),pt&&(Pt.domainUsersCanEdit=Le),ft.editors=Pt}const Me=n.find(Pt=>{var Gt;return((Gt=Pt.valueOwner.declaration)==null?void 0:Gt.id)===G.operation[X.GoogleSheetsAddProtectedRange].inputs.unprotectedRanges.id}),Je=(R=Me==null?void 0:Me.value)==null?void 0:R.value;if(Array.isArray(Je)&&Je.length>0){const Pt=await Promise.all(Je.map(async Gt=>{const si=await Ha(Gt,"Id",async()=>qe.map(pi=>{var kt,Ct;return{id:(kt=pi.properties)==null?void 0:kt.sheetId,name:(Ct=pi.properties)==null?void 0:Ct.title}}));return ps(si,{errorPrefix:`${H}The ${Y(Me,"Exception ranges","unprotectedRanges")} input `})}));ft.unprotectedRanges=Pt}const lt=(O=(P=(x=(A=(I=(await et({method:"POST",endpoint:`/v4/spreadsheets/${Q}:batchUpdate`,data:{requests:[{addProtectedRange:{protectedRange:ft}}]}})).data)==null?void 0:I.replies)==null?void 0:A[0])==null?void 0:x.addProtectedRange)==null?void 0:P.protectedRange)==null?void 0:O.protectedRangeId;return{value:K.Success,result:{protectedRangeId:lt},error:null}}catch(U){const Z=(($=U.response)==null?void 0:$.data)||U.message||U;return pe.Logger.log("[Google Sheets] error:",Z),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:Z,result:null}}}})}}class O1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsUpdateChartSpec,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsUpdateChartSpec);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=Be(t,t.project,"updateChartSpec"),R="["+Ve(t,t.project,"Update Chart Spec")+": `"+g+"`] ",I=(ae,le,oe)=>{const ce=Ve(ae==null?void 0:ae.valueOwner,T==null?void 0:T.logic,le),be=Be(ae==null?void 0:ae.valueOwner,T==null?void 0:T.logic,oe);return`"${ce}" (\`${be}\`)`},A=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[X.GoogleSheetsUpdateChartSpec].inputs.connection.id}),x=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!x||!x.id||!x.name||x.type!==r.DefinitionEntity)throw new Error(`${R}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const P=ui(x);if(!P)throw new Error(`${R}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const O=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[X.GoogleSheetsUpdateChartSpec].inputs.spreadsheetId.id}),$=(u=O==null?void 0:O.value)==null?void 0:u.value,U=ln($,{errorPrefix:`${R}The ${I(O,"Spreadsheet ID","spreadsheetId")} input `}),Z=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[X.GoogleSheetsUpdateChartSpec].inputs.chartId.id}),j=(e=Z==null?void 0:Z.value)==null?void 0:e.value;let H=typeof j=="number"?j:typeof j=="string"?parseInt(j,10):NaN;if(isNaN(H))throw new Error(`${R}The ${I(Z,"Chart ID","chartId")} input is missing or invalid. Expected a numeric chart ID.`);const Y=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[X.GoogleSheetsUpdateChartSpec].inputs.chart.id}),ie=(f=Y==null?void 0:Y.value)==null?void 0:f.value;if(ie==null||typeof ie!="object")throw new Error(`${R}The ${I(Y,"Chart Spec","chart")} input is missing or invalid. Expected a valid chart object.`);const z={Authorization:`Bearer ${await T.getAccessToken()}`},J=`${(y=T.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${T.projectId}/${Zt["google-sheet"]}/${P}`,ee=async ae=>Ht.post(J,ae,{headers:z}),Q=ie.spec?ie.spec:ie;let re={};return re.updateChartSpec={chartId:H,spec:Q},await ee({method:"POST",endpoint:`/v4/spreadsheets/${U}:batchUpdate`,data:{requests:[re]}}),{value:K.Success,result:null,error:null}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return pe.Logger.log("[Google Sheets] error:",g),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:g,result:null}}}})}}class P1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsCreatePivotTable,version:"1.0.0",description:"Create Pivot Table Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsCreatePivotTable);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R;try{const I=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!I||!I.env)throw new Error("Editor context or environment missing");const A=Be(t,t.project,"createPivotTable"),P="["+Ve(t,t.project,"Create Pivot Table")+": `"+A+"`] ",O=(ke,lt,Pt)=>{const Gt=Ve(ke==null?void 0:ke.valueOwner,I==null?void 0:I.logic,lt),si=Be(ke==null?void 0:ke.valueOwner,I==null?void 0:I.logic,Pt);return`"${Gt}" (\`${si}\`)`},$=n.find(ke=>{var lt;return((lt=ke.valueOwner.declaration)==null?void 0:lt.id)===G.operation[X.GoogleSheetsCreatePivotTable].inputs.connection.id}),U=(s=$==null?void 0:$.value)==null?void 0:s.valueAsType;if(!U||!U.id||!U.name||U.type!==r.DefinitionEntity)throw new Error(`${P}The ${O($,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const Z=ui(U);if(!Z)throw new Error(`${P}The ${O($,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const j=n.find(ke=>{var lt;return((lt=ke.valueOwner.declaration)==null?void 0:lt.id)===G.operation[X.GoogleSheetsCreatePivotTable].inputs.spreadsheetId.id}),H=(u=j==null?void 0:j.value)==null?void 0:u.value,Y=ln(H,{errorPrefix:`${P}The ${O(j,"Spreadsheet ID","spreadsheetId")} input `}),ie=n.find(ke=>{var lt;return((lt=ke.valueOwner.declaration)==null?void 0:lt.id)===G.operation[X.GoogleSheetsCreatePivotTable].inputs.destination.id}),W=(e=ie==null?void 0:ie.value)==null?void 0:e.value;if(W==null)throw new Error(`${P}The ${O(ie,"Destination","destination")} input is missing.`);const z=n.find(ke=>{var lt;return((lt=ke.valueOwner.declaration)==null?void 0:lt.id)===G.operation[X.GoogleSheetsCreatePivotTable].inputs.source.id}),J=(f=z==null?void 0:z.value)==null?void 0:f.value;if(J==null)throw new Error(`${P}The ${O(z,"Data range","source")} input is missing.`);const ee=n.find(ke=>{var lt;return((lt=ke.valueOwner.declaration)==null?void 0:lt.id)===G.operation[X.GoogleSheetsCreatePivotTable].inputs.rows.id}),Q=((y=ee==null?void 0:ee.value)==null?void 0:y.value)||[],re=n.find(ke=>{var lt;return((lt=ke.valueOwner.declaration)==null?void 0:lt.id)===G.operation[X.GoogleSheetsCreatePivotTable].inputs.columns.id}),ae=((m=re==null?void 0:re.value)==null?void 0:m.value)||[],le=n.find(ke=>{var lt;return((lt=ke.valueOwner.declaration)==null?void 0:lt.id)===G.operation[X.GoogleSheetsCreatePivotTable].inputs.values.id}),oe=((T=le==null?void 0:le.value)==null?void 0:T.value)||[],ce=n.find(ke=>{var lt;return((lt=ke.valueOwner.declaration)==null?void 0:lt.id)===G.operation[X.GoogleSheetsCreatePivotTable].inputs.valueLayout.id}),be=((g=ce==null?void 0:ce.value)==null?void 0:g.value)||"HORIZONTAL",Ee={Authorization:`Bearer ${await I.getAccessToken()}`},xe=`${(b=I.env)==null?void 0:b.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${I.projectId}/${Zt["google-sheet"]}/${Z}`,Le=async ke=>Ht.post(xe,ke,{headers:Ee});let Fe=[];try{Fe=(await Le({method:"GET",endpoint:`/v4/spreadsheets/${Y}?fields=sheets(properties(sheetId,title))`})).data.sheets||[]}catch{}const tt=await Ha(W,"Id",async()=>Fe.map(ke=>({id:ke.properties.sheetId,name:ke.properties.title}))),We=ps(tt,{errorPrefix:`${P}The ${O(ie,"Destination","destination")} input `}),et={sheetId:We.sheetId??0,rowIndex:We.startRowIndex??0,columnIndex:We.startColumnIndex??0},qe=await Ha(J,"Id",async()=>Fe.map(ke=>({id:ke.properties.sheetId,name:ke.properties.title}))),ot=ps(qe,{errorPrefix:`${P}The ${O(z,"Data range","source")} input `});(ot.sheetId===void 0||ot.sheetId===null)&&(ot.sheetId=0);const st=ke=>{if(Array.isArray(ke))return ke;if(typeof ke=="string"){const lt=ke.trim();if(lt.startsWith("["))try{return JSON.parse(lt)}catch{}}return[]},ft=st(Q),Et=st(ae),pt=st(oe),Me={source:ot,rows:ft.map(ke=>({sourceColumnOffset:Number((ke==null?void 0:ke.sourceColumnOffset)??0),sortOrder:(ke==null?void 0:ke.sortOrder)||"ASCENDING",showTotals:(ke==null?void 0:ke.showTotals)!==!1})),columns:Et.map(ke=>({sourceColumnOffset:Number((ke==null?void 0:ke.sourceColumnOffset)??0),sortOrder:(ke==null?void 0:ke.sortOrder)||"ASCENDING",showTotals:(ke==null?void 0:ke.showTotals)!==!1})),values:pt.map(ke=>{const lt={sourceColumnOffset:Number((ke==null?void 0:ke.sourceColumnOffset)??0),summarizeFunction:(ke==null?void 0:ke.summarizeFunction)||"SUM"};return ke!=null&&ke.name&&(lt.name=ke.name),ke!=null&&ke.calculatedDisplayType&&(lt.calculatedDisplayType=ke.calculatedDisplayType),lt}),valueLayout:be||"HORIZONTAL"};let Je={updateCells:{start:et,rows:[{values:[{pivotTable:Me}]}],fields:"pivotTable"}};return await Le({method:"POST",endpoint:`/v4/spreadsheets/${Y}:batchUpdate`,data:{requests:[Je]}}),{value:K.Success,result:null,error:null}}catch(I){const A=((R=I.response)==null?void 0:R.data)||I.message||I;return pe.Logger.log("[Google Sheets] error:",A),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:A,result:null}}}})}}class V1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsInsertDimension,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsInsertDimension);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R;try{const I=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!I||!I.env)throw new Error("Editor context or environment missing");const A=Be(t,t.project,"insertDimension"),P="["+Ve(t,t.project,"Insert Dimension")+": `"+A+"`] ",O=(qe,ot,st)=>{const ft=Ve(qe==null?void 0:qe.valueOwner,I==null?void 0:I.logic,ot),Et=Be(qe==null?void 0:qe.valueOwner,I==null?void 0:I.logic,st);return`"${ft}" (\`${Et}\`)`},$=n.find(qe=>{var ot;return((ot=qe.valueOwner.declaration)==null?void 0:ot.id)===G.operation[X.GoogleSheetsInsertDimension].inputs.connection.id}),U=(s=$==null?void 0:$.value)==null?void 0:s.valueAsType;if(!U||!U.id||!U.name||U.type!==r.DefinitionEntity)throw new Error(`${P}The ${O($,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const Z=ui(U);if(!Z)throw new Error(`${P}The ${O($,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const j=n.find(qe=>{var ot;return((ot=qe.valueOwner.declaration)==null?void 0:ot.id)===G.operation[X.GoogleSheetsInsertDimension].inputs.spreadsheetId.id}),H=(u=j==null?void 0:j.value)==null?void 0:u.value,Y=ln(H,{errorPrefix:`${P}The ${O(j,"Spreadsheet ID","spreadsheetId")} input `}),ie=n.find(qe=>{var ot,st;return((ot=qe.valueOwner.declaration)==null?void 0:ot.id)===((st=G.operation[X.GoogleSheetsInsertDimension].inputs.sheet)==null?void 0:st.id)}),W=(e=ie==null?void 0:ie.value)==null?void 0:e.value,z=n.find(qe=>{var ot,st;return((ot=qe.valueOwner.declaration)==null?void 0:ot.id)===((st=G.operation[X.GoogleSheetsInsertDimension].inputs.dimension)==null?void 0:st.id)}),J=(f=z==null?void 0:z.value)==null?void 0:f.value,ee=n.find(qe=>{var ot,st;return((ot=qe.valueOwner.declaration)==null?void 0:ot.id)===((st=G.operation[X.GoogleSheetsInsertDimension].inputs.startIndex)==null?void 0:st.id)}),Q=(y=ee==null?void 0:ee.value)==null?void 0:y.value,re=n.find(qe=>{var ot,st;return((ot=qe.valueOwner.declaration)==null?void 0:ot.id)===((st=G.operation[X.GoogleSheetsInsertDimension].inputs.endIndex)==null?void 0:st.id)}),ae=(m=re==null?void 0:re.value)==null?void 0:m.value,le=n.find(qe=>{var ot,st;return((ot=qe.valueOwner.declaration)==null?void 0:ot.id)===((st=G.operation[X.GoogleSheetsInsertDimension].inputs.inheritFormatting)==null?void 0:st.id)}),oe=(T=le==null?void 0:le.value)==null?void 0:T.value;let ce;if(typeof oe=="string"){const qe=oe.trim().toLowerCase();qe==="before"?ce=!0:qe==="after"&&(ce=!1)}const Ce={Authorization:`Bearer ${await I.getAccessToken()}`},Ee=`${(g=I.env)==null?void 0:g.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${I.projectId}/${Zt["google-sheet"]}/${Z}`,xe=async qe=>Ht.post(Ee,qe,{headers:Ce});if(W==null||W==="")throw new Error(`${P}The ${O(ie,"Sheet","sheet")} input is missing.`);if(J==null||J==="")throw new Error(`${P}The ${O(z,"Dimension","dimension")} input is missing.`);const Le=String(J).trim().toUpperCase();if(Le!=="ROWS"&&Le!=="COLUMNS")throw new Error(`${P}The ${O(z,"Dimension","dimension")} input is invalid. Expected "Rows" or "Columns".`);const Fe=typeof Q=="number"?Q:parseInt(String(Q),10);if(isNaN(Fe)||Fe<1)throw new Error(`${P}The ${O(ee,"Start index","startIndex")} input is missing or invalid. Expected a positive integer starting at 1.`);let tt=Fe;if(ae!=null&&ae!==""&&(tt=typeof ae=="number"?ae:parseInt(String(ae),10),isNaN(tt)||tt<Fe))throw new Error(`${P}The ${O(re,"End index","endIndex")} input is invalid. Expected an integer greater than or equal to Start index.`);let We;if(typeof W=="number"||/^\d+$/.test(String(W).trim()))We=Number(W);else{const st=(((b=(await xe({method:"GET",endpoint:`/v4/spreadsheets/${Y}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:b.sheets)||[]).find(ft=>{var Et;return String((Et=ft.properties)==null?void 0:Et.title).trim().toLowerCase()===String(W).trim().toLowerCase()});if(!st)throw new Error(`${P}The ${O(ie,"Sheet","sheet")} input "${W}" was not found in spreadsheet.`);We=st.properties.sheetId}const et={range:{sheetId:We,dimension:Le,startIndex:Fe-1,endIndex:tt}};return typeof ce=="boolean"&&(et.inheritFromBefore=ce),await xe({method:"POST",endpoint:`/v4/spreadsheets/${Y}:batchUpdate`,data:{requests:[{insertDimension:et}]}}),{value:K.Success,result:null,error:null}}catch(I){const A=((R=I.response)==null?void 0:R.data)||I.message||I;return pe.Logger.log("[Google Sheets] error:",A),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:A,result:null}}}})}}class N1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsMoveDimension,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsMoveDimension);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R;try{const I=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!I||!I.env)throw new Error("Editor context or environment missing");const A=Be(t,t.project,"moveDimension"),P="["+Ve(t,t.project,"Move Dimension")+": `"+A+"`] ",O=(et,qe,ot)=>{const st=Ve(et==null?void 0:et.valueOwner,I==null?void 0:I.logic,qe),ft=Be(et==null?void 0:et.valueOwner,I==null?void 0:I.logic,ot);return`"${st}" (\`${ft}\`)`},$=n.find(et=>{var qe;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===G.operation[X.GoogleSheetsMoveDimension].inputs.connection.id}),U=(s=$==null?void 0:$.value)==null?void 0:s.valueAsType;if(!U||!U.id||!U.name||U.type!==r.DefinitionEntity)throw new Error(`${P}The ${O($,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const Z=ui(U);if(!Z)throw new Error(`${P}The ${O($,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const j=n.find(et=>{var qe;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===G.operation[X.GoogleSheetsMoveDimension].inputs.spreadsheetId.id}),H=(u=j==null?void 0:j.value)==null?void 0:u.value,Y=ln(H,{errorPrefix:`${P}The ${O(j,"Spreadsheet ID","spreadsheetId")} input `}),ie=n.find(et=>{var qe,ot;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===((ot=G.operation[X.GoogleSheetsMoveDimension].inputs.sheet)==null?void 0:ot.id)}),W=(e=ie==null?void 0:ie.value)==null?void 0:e.value,z=n.find(et=>{var qe,ot;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===((ot=G.operation[X.GoogleSheetsMoveDimension].inputs.dimension)==null?void 0:ot.id)}),J=(f=z==null?void 0:z.value)==null?void 0:f.value,ee=n.find(et=>{var qe,ot;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===((ot=G.operation[X.GoogleSheetsMoveDimension].inputs.startIndex)==null?void 0:ot.id)}),Q=(y=ee==null?void 0:ee.value)==null?void 0:y.value,re=n.find(et=>{var qe,ot;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===((ot=G.operation[X.GoogleSheetsMoveDimension].inputs.endIndex)==null?void 0:ot.id)}),ae=(m=re==null?void 0:re.value)==null?void 0:m.value,le=n.find(et=>{var qe,ot;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===((ot=G.operation[X.GoogleSheetsMoveDimension].inputs.destinationIndex)==null?void 0:ot.id)}),oe=(T=le==null?void 0:le.value)==null?void 0:T.value,be={Authorization:`Bearer ${await I.getAccessToken()}`},Ce=`${(g=I.env)==null?void 0:g.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${I.projectId}/${Zt["google-sheet"]}/${Z}`,Ee=async et=>Ht.post(Ce,et,{headers:be});if(W==null||W==="")throw new Error(`${P}The ${O(ie,"Sheet","sheet")} input is missing.`);if(J==null||J==="")throw new Error(`${P}The ${O(z,"Dimension","dimension")} input is missing.`);const xe=String(J).trim().toUpperCase();if(xe!=="ROWS"&&xe!=="COLUMNS")throw new Error(`${P}The ${O(z,"Dimension","dimension")} input is invalid. Expected "Rows" or "Columns".`);const Le=typeof Q=="number"?Q:parseInt(String(Q),10);if(isNaN(Le)||Le<1)throw new Error(`${P}The ${O(ee,"Start index","startIndex")} input is missing or invalid. Expected a positive integer starting at 1.`);let Fe=Le;if(ae!=null&&ae!==""&&(Fe=typeof ae=="number"?ae:parseInt(String(ae),10),isNaN(Fe)||Fe<Le))throw new Error(`${P}The ${O(re,"End index","endIndex")} input is invalid. Expected an integer greater than or equal to Start index.`);const tt=typeof oe=="number"?oe:parseInt(String(oe),10);if(isNaN(tt)||tt<1)throw new Error(`${P}The ${O(le,"Destination index","destinationIndex")} input is missing or invalid. Expected a positive integer starting at 1.`);let We;if(typeof W=="number"||/^\d+$/.test(String(W).trim()))We=Number(W);else{const ot=(((b=(await Ee({method:"GET",endpoint:`/v4/spreadsheets/${Y}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:b.sheets)||[]).find(st=>{var ft;return String((ft=st.properties)==null?void 0:ft.title).trim().toLowerCase()===String(W).trim().toLowerCase()});if(!ot)throw new Error(`${P}The ${O(ie,"Sheet","sheet")} input "${W}" was not found in spreadsheet.`);We=ot.properties.sheetId}return await Ee({method:"POST",endpoint:`/v4/spreadsheets/${Y}:batchUpdate`,data:{requests:[{moveDimension:{source:{sheetId:We,dimension:xe,startIndex:Le-1,endIndex:Fe},destinationIndex:tt-1}}]}}),{value:K.Success,result:null,error:null}}catch(I){const A=((R=I.response)==null?void 0:R.data)||I.message||I;return pe.Logger.log("[Google Sheets] error:",A),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:A,result:null}}}})}}function MRn(a){return{"Number greater than":"NUMBER_GREATER","Number greater than or equal":"NUMBER_GREATER_THAN_EQ","Number less than":"NUMBER_LESS","Number less than or equal":"NUMBER_LESS_THAN_EQ","Number equal to":"NUMBER_EQ","Number not equal to":"NUMBER_NOT_EQ","Number between":"NUMBER_BETWEEN","Number not between":"NUMBER_NOT_BETWEEN","Text contains":"TEXT_CONTAINS","Text does not contain":"TEXT_NOT_CONTAINS","Text starts with":"TEXT_STARTS_WITH","Text ends with":"TEXT_ENDS_WITH","Text equals":"TEXT_EQ","Date is":"DATE_EQ","Date is before":"DATE_BEFORE","Date is after":"DATE_AFTER","Date is on or before":"DATE_ON_OR_BEFORE","Date is on or after":"DATE_ON_OR_AFTER","Cell is empty":"BLANK","Cell is not empty":"NOT_BLANK","Custom formula":"CUSTOM_FORMULA"}[a]||a}class _1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsUpdateConditionalFormatRule,version:"1.0.0",description:"Update Conditional Format Rule Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsUpdateConditionalFormatRule);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A,x,P;try{const O=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!O||!O.env)throw new Error("Editor context or environment missing");const $=Be(t,t.project,"updateConditionalFormatRule"),Z="["+Ve(t,t.project,"Update Conditional Format Rule")+": `"+$+"`] ",j=(hi,$t,Nt)=>{const ci=Ve(hi==null?void 0:hi.valueOwner,O==null?void 0:O.logic,$t),oi=Be(hi==null?void 0:hi.valueOwner,O==null?void 0:O.logic,Nt);return`"${ci}" (\`${oi}\`)`},H=G.operation[X.GoogleSheetsUpdateConditionalFormatRule].inputs,Y=hi=>{var Nt;const $t=n.find(ci=>{var oi;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===hi});return(Nt=$t==null?void 0:$t.value)==null?void 0:Nt.value},ie=n.find(hi=>{var $t;return(($t=hi.valueOwner.declaration)==null?void 0:$t.id)===H.connection.id}),W=(s=ie==null?void 0:ie.value)==null?void 0:s.valueAsType;if(!W||!W.id||!W.name||W.type!==r.DefinitionEntity)throw new Error(`${Z}The ${j(ie,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const z=ui(W);if(!z)throw new Error(`${Z}The ${j(ie,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const J=n.find(hi=>{var $t;return(($t=hi.valueOwner.declaration)==null?void 0:$t.id)===H.spreadsheetId.id}),ee=(u=J==null?void 0:J.value)==null?void 0:u.value,Q=ln(ee,{errorPrefix:`${Z}The ${j(J,"Spreadsheet ID","spreadsheetId")} input `}),re=n.find(hi=>{var $t;return(($t=hi.valueOwner.declaration)==null?void 0:$t.id)===H.sheet.id}),ae=(e=re==null?void 0:re.value)==null?void 0:e.value;if(ae==null||ae==="")throw new Error(`${Z}The ${j(re,"Sheet","sheet")} input is missing.`);const le=n.find(hi=>{var $t;return(($t=hi.valueOwner.declaration)==null?void 0:$t.id)===H.index.id}),oe=(f=le==null?void 0:le.value)==null?void 0:f.value;if(oe==null||oe==="")throw new Error(`${Z}The ${j(le,"Index","index")} input is missing.`);const ce=typeof oe=="number"?oe:parseInt(String(oe),10);if(isNaN(ce)||ce<1)throw new Error(`${Z}The ${j(le,"Index","index")} input must be a 1-based positive integer.`);const Ce={Authorization:`Bearer ${await O.getAccessToken()}`},Ee=`${(y=O.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${O.projectId}/${Zt["google-sheet"]}/${z}`,xe=async hi=>Ht.post(Ee,hi,{headers:Ce});let Le;if(typeof ae=="number"||/^\d+$/.test(String(ae).trim()))Le=Number(ae);else{const Nt=(((m=(await xe({method:"GET",endpoint:`/v4/spreadsheets/${Q}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:m.sheets)||[]).find(ci=>{var oi;return String((oi=ci.properties)==null?void 0:oi.title).trim().toLowerCase()===String(ae).trim().toLowerCase()});if(!Nt)throw new Error(`${Z}The ${j(re,"Sheet","sheet")} input "${ae}" was not found in spreadsheet.`);Le=Nt.properties.sheetId}const Fe=Y(H.newIndex.id),tt=Y(H.range.id),We=Y(H.conditionType.id),et=Y(H.conditionValues.id),qe=Y(H.backgroundColor.id),ot=Y(H.textColor.id),st=Y(H.bold.id),ft=Y(H.italic.id),Et=Y(H.strikethrough.id),pt=Y(H.underline.id),Me=Y(H.fontSize.id),Je=Y(H.fontFamily.id),ke=Y(H.horizontalAlignment.id),lt=Y(H.verticalAlignment.id),Pt=Y(H.wrapStrategy.id);let Gt=null;try{const Nt=(((T=(await xe({method:"GET",endpoint:`/v4/spreadsheets/${Q}?fields=sheets(properties(sheetId),conditionalFormats)`})).data)==null?void 0:T.sheets)||[]).find(ci=>{var oi;return Number((oi=ci.properties)==null?void 0:oi.sheetId)===Number(Le)});if(Nt&&Array.isArray(Nt.conditionalFormats)){const ci=ce-1;ci>=0&&ci<Nt.conditionalFormats.length&&(Gt=Nt.conditionalFormats[ci])}}catch{}let si=null;tt&&(si=ps(tt,{errorPrefix:`${Z}The Range input `}),si.sheetId===void 0&&(si.sheetId=Le));const pi=si?[si]:Gt&&Gt.ranges||[{sheetId:Le}];let kt=null;if(We!=null&&String(We).trim()!==""){const hi=MRn(String(We));let $t=[];Array.isArray(et)?$t=et.map(Nt=>({userEnteredValue:String(Nt)})):et!=null&&et!==""?$t=[{userEnteredValue:String(et)}]:((b=(g=Gt==null?void 0:Gt.booleanRule)==null?void 0:g.condition)==null?void 0:b.type)===hi&&Array.isArray((I=(R=Gt==null?void 0:Gt.booleanRule)==null?void 0:R.condition)==null?void 0:I.values)&&($t=Gt.booleanRule.condition.values),kt={type:hi,...$t.length?{values:$t}:{}}}else if((A=Gt==null?void 0:Gt.booleanRule)!=null&&A.condition)kt=JSON.parse(JSON.stringify(Gt.booleanRule.condition));else{const hi="BLANK";let $t=[];Array.isArray(et)?$t=et.map(Nt=>({userEnteredValue:String(Nt)})):et!=null&&et!==""&&($t=[{userEnteredValue:String(et)}]),kt={type:hi,...$t.length?{values:$t}:{}}}const Ct=(x=Gt==null?void 0:Gt.booleanRule)!=null&&x.format?JSON.parse(JSON.stringify(Gt.booleanRule.format)):{},Oi=fo(qe);Oi&&(Ct.backgroundColor=Oi);const wn=fo(ot);if(wn&&(Ct.textFormat=Ct.textFormat||{},Ct.textFormat.foregroundColor=wn),st===!0||st==="true"?(Ct.textFormat=Ct.textFormat||{},Ct.textFormat.bold=!0):(st===!1||st==="false")&&Ct.textFormat&&(Ct.textFormat.bold=!1),ft===!0||ft==="true"?(Ct.textFormat=Ct.textFormat||{},Ct.textFormat.italic=!0):(ft===!1||ft==="false")&&Ct.textFormat&&(Ct.textFormat.italic=!1),Et===!0||Et==="true"?(Ct.textFormat=Ct.textFormat||{},Ct.textFormat.strikethrough=!0):(Et===!1||Et==="false")&&Ct.textFormat&&(Ct.textFormat.strikethrough=!1),pt===!0||pt==="true"?(Ct.textFormat=Ct.textFormat||{},Ct.textFormat.underline=!0):(pt===!1||pt==="false")&&Ct.textFormat&&(Ct.textFormat.underline=!1),Me!=null&&Me!==""){const hi=typeof Me=="number"?Me:parseInt(String(Me),10);isNaN(hi)||(Ct.textFormat=Ct.textFormat||{},Ct.textFormat.fontSize=hi)}if(typeof Je=="string"&&Je.trim()!==""&&(Ct.textFormat=Ct.textFormat||{},Ct.textFormat.fontFamily=Je.trim()),typeof ke=="string"&&ke!==""){const hi={Left:"LEFT",Center:"CENTER",Right:"RIGHT",Justify:"JUSTIFY"};Ct.horizontalAlignment=hi[ke]||ke.toUpperCase()}if(typeof lt=="string"&<!==""){const hi={Top:"TOP",Middle:"MIDDLE",Bottom:"BOTTOM"};Ct.verticalAlignment=hi[lt]||lt.toUpperCase()}if(typeof Pt=="string"&&Pt!==""){const hi={Overflow:"OVERFLOW_CELL",Wrap:"WRAP",Clip:"CLIP"};Ct.wrapStrategy=hi[Pt]||Pt.toUpperCase()}const Yr={...Gt||{},ranges:pi,booleanRule:{...(Gt==null?void 0:Gt.booleanRule)||{},condition:kt,format:Ct}},Jr={sheetId:Le,index:ce-1,rule:Yr};if(Fe!=null&&Fe!==""){const hi=typeof Fe=="number"?Fe:parseInt(String(Fe),10);!isNaN(hi)&&hi>=1&&(Jr.newIndex=hi-1)}return await xe({method:"POST",endpoint:`/v4/spreadsheets/${Q}:batchUpdate`,data:{requests:[{updateConditionalFormatRule:Jr}]}}),{value:K.Success,result:null,error:null}}catch(O){const $=((P=O.response)==null?void 0:P.data)||O.message||O;return pe.Logger.log("[Google Sheets] error:",$),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:$,result:null}}}})}}class $1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsUpdateProtectedRange,version:"1.0.0",description:"Update Protected Range Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsUpdateProtectedRange);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A,x;try{const P=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!P||!P.env)throw new Error("Editor context or environment missing");const O=Be(t,t.project,"updateProtectedRange"),U="["+Ve(t,t.project,"Update Protected Range")+": `"+O+"`] ",Z=(Me,Je,ke)=>{const lt=Ve(Me==null?void 0:Me.valueOwner,P==null?void 0:P.logic,Je),Pt=Be(Me==null?void 0:Me.valueOwner,P==null?void 0:P.logic,ke);return`"${lt}" (\`${Pt}\`)`},j=n.find(Me=>{var Je;return((Je=Me.valueOwner.declaration)==null?void 0:Je.id)===G.operation[X.GoogleSheetsUpdateProtectedRange].inputs.connection.id}),H=(s=j==null?void 0:j.value)==null?void 0:s.valueAsType;if(!H||!H.id||!H.name||H.type!==r.DefinitionEntity)throw new Error(`${U}The ${Z(j,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const Y=ui(H);if(!Y)throw new Error(`${U}The ${Z(j,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const ie=n.find(Me=>{var Je;return((Je=Me.valueOwner.declaration)==null?void 0:Je.id)===G.operation[X.GoogleSheetsUpdateProtectedRange].inputs.spreadsheetId.id}),W=(u=ie==null?void 0:ie.value)==null?void 0:u.value,z=ln(W,{errorPrefix:`${U}The ${Z(ie,"Spreadsheet ID","spreadsheetId")} input `}),J=n.find(Me=>{var Je;return((Je=Me.valueOwner.declaration)==null?void 0:Je.id)===G.operation[X.GoogleSheetsUpdateProtectedRange].inputs.protectedRangeId.id}),ee=(e=J==null?void 0:J.value)==null?void 0:e.value;if(ee==null)throw new Error(`${U}The ${Z(J,"Protected Range ID","protectedRangeId")} input is missing.`);const Q=n.find(Me=>{var Je;return((Je=Me.valueOwner.declaration)==null?void 0:Je.id)===G.operation[X.GoogleSheetsUpdateProtectedRange].inputs.range.id}),re=(f=Q==null?void 0:Q.value)==null?void 0:f.value,ae=n.find(Me=>{var Je;return((Je=Me.valueOwner.declaration)==null?void 0:Je.id)===G.operation[X.GoogleSheetsUpdateProtectedRange].inputs.description.id}),le=(y=ae==null?void 0:ae.value)==null?void 0:y.value,oe=n.find(Me=>{var Je;return((Je=Me.valueOwner.declaration)==null?void 0:Je.id)===G.operation[X.GoogleSheetsUpdateProtectedRange].inputs.warningOnly.id}),ce=(m=oe==null?void 0:oe.value)==null?void 0:m.value,be=n.find(Me=>{var Je;return((Je=Me.valueOwner.declaration)==null?void 0:Je.id)===G.operation[X.GoogleSheetsUpdateProtectedRange].inputs.editors.id}),Ce=(T=be==null?void 0:be.value)==null?void 0:T.value,Ee=n.find(Me=>{var Je;return((Je=Me.valueOwner.declaration)==null?void 0:Je.id)===G.operation[X.GoogleSheetsUpdateProtectedRange].inputs.domainUsersCanEdit.id}),xe=(g=Ee==null?void 0:Ee.value)==null?void 0:g.value,Fe={Authorization:`Bearer ${await P.getAccessToken()}`},tt=`${(b=P.env)==null?void 0:b.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${P.projectId}/${Zt["google-sheet"]}/${Y}`,We=async Me=>Ht.post(tt,Me,{headers:Fe}),et={protectedRangeId:typeof ee=="number"?ee:Number(ee)},qe=[];if(re!=null){let Me=[];try{Me=((R=(await We({method:"GET",endpoint:`/v4/spreadsheets/${z}?fields=sheets(properties(sheetId,title))`})).data)==null?void 0:R.sheets)||[]}catch{}const Je=await Ha(re,"Id",async()=>Me.map(ke=>{var lt,Pt;return{id:(lt=ke.properties)==null?void 0:lt.sheetId,name:(Pt=ke.properties)==null?void 0:Pt.title}}));et.range=ps(Je,{errorPrefix:`${U}The ${Z(Q,"Protected Range","range")} input `}),qe.push("range")}le!=null&&(et.description=le,qe.push("description"));const ot=Array.isArray(Ce)&&Ce.length>0,st=typeof xe=="boolean";if(ce===!0&&ot)throw new Error(`${U}When ${Z(oe,"Warning Only","warningOnly")} is enabled (true), ${Z(be,"Editors","editors")} cannot be specified.`);if(ce===!0&&st)throw new Error(`${U}When ${Z(oe,"Warning Only","warningOnly")} is enabled (true), ${Z(Ee,"Domain Users Can Edit","domainUsersCanEdit")} cannot be specified.`);if(typeof ce=="boolean"&&(et.warningOnly=ce,qe.push("warningOnly")),!et.warningOnly&&(ot||st)){const Me={};ot&&(Me.users=Ce),st&&(Me.domainUsersCanEdit=xe),et.editors=Me,qe.push("editors")}const ft=n.find(Me=>{var Je;return((Je=Me.valueOwner.declaration)==null?void 0:Je.id)===G.operation[X.GoogleSheetsUpdateProtectedRange].inputs.unprotectedRanges.id}),Et=(I=ft==null?void 0:ft.value)==null?void 0:I.value;if(Array.isArray(Et)&&Et.length>0){let Me=[];try{Me=((A=(await We({method:"GET",endpoint:`/v4/spreadsheets/${z}?fields=sheets(properties(sheetId,title))`})).data)==null?void 0:A.sheets)||[]}catch{}const Je=await Promise.all(Et.map(async ke=>{const lt=await Ha(ke,"Id",async()=>Me.map(Pt=>{var Gt,si;return{id:(Gt=Pt.properties)==null?void 0:Gt.sheetId,name:(si=Pt.properties)==null?void 0:si.title}}));return ps(lt,{errorPrefix:`${U}The ${Z(ft,"Exception ranges","unprotectedRanges")} input `})}));et.unprotectedRanges=Je,qe.push("unprotectedRanges")}const pt=qe.length>0?qe.join(","):"*";return await We({method:"POST",endpoint:`/v4/spreadsheets/${z}:batchUpdate`,data:{requests:[{updateProtectedRange:{protectedRange:et,fields:pt}}]}}),{value:K.Success,result:null,error:null}}catch(P){const O=((x=P.response)==null?void 0:x.data)||P.message||P;return pe.Logger.log("[Google Sheets] error:",O),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:O,result:null}}}})}}class G1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsAddNamedRange,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsAddNamedRange);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g;try{const b=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!b||!b.env)throw new Error("Editor context or environment missing");const R=Be(t,t.project,"addNamedRange"),A="["+Ve(t,t.project,"Add Named Range")+": `"+R+"`] ",x=(Ee,xe,Le)=>{const Fe=Ve(Ee==null?void 0:Ee.valueOwner,b==null?void 0:b.logic,xe),tt=Be(Ee==null?void 0:Ee.valueOwner,b==null?void 0:b.logic,Le);return`"${Fe}" (\`${tt}\`)`},P=n.find(Ee=>{var xe;return((xe=Ee.valueOwner.declaration)==null?void 0:xe.id)===G.operation[X.GoogleSheetsAddNamedRange].inputs.connection.id}),O=(s=P==null?void 0:P.value)==null?void 0:s.valueAsType;if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${A}The ${x(P,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const $=ui(O);if(!$)throw new Error(`${A}The ${x(P,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const U=n.find(Ee=>{var xe;return((xe=Ee.valueOwner.declaration)==null?void 0:xe.id)===G.operation[X.GoogleSheetsAddNamedRange].inputs.spreadsheetId.id}),Z=(u=U==null?void 0:U.value)==null?void 0:u.value,j=ln(Z,{errorPrefix:`${A}The ${x(U,"Spreadsheet ID","spreadsheetId")} input `}),H=n.find(Ee=>{var xe;return((xe=Ee.valueOwner.declaration)==null?void 0:xe.id)===G.operation[X.GoogleSheetsAddNamedRange].inputs.name.id}),Y=(e=H==null?void 0:H.value)==null?void 0:e.value;if(Y==null)throw new Error(`${A}The ${x(H,"name","name")} input is missing.`);const ie=n.find(Ee=>{var xe;return((xe=Ee.valueOwner.declaration)==null?void 0:xe.id)===G.operation[X.GoogleSheetsAddNamedRange].inputs.range.id}),W=(f=ie==null?void 0:ie.value)==null?void 0:f.value;if(W==null)throw new Error(`${A}The ${x(ie,"range","range")} input is missing.`);const J={Authorization:`Bearer ${await b.getAccessToken()}`},ee=`${(y=b.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${b.projectId}/${Zt["google-sheet"]}/${$}`,Q=async Ee=>Ht.post(ee,Ee,{headers:J}),re=await Ha(W,"Id",async()=>{var xe;return(((xe=(await Q({method:"GET",endpoint:`/v4/spreadsheets/${j}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:xe.sheets)||[]).map(Le=>{var Fe,tt;return{id:(Fe=Le.properties)==null?void 0:Fe.sheetId,name:(tt=Le.properties)==null?void 0:tt.title}})});let ae={};ae.addNamedRange={namedRange:{name:typeof Y=="string"&&Y.trim().startsWith("{")?JSON.parse(Y):Y,range:ps(re,{errorPrefix:`${A}The ${x(ie,"Range","range")} input `})}};const oe=(await Q({method:"POST",endpoint:`/v4/spreadsheets/${j}:batchUpdate`,data:{requests:[ae]}})).data,ce=(T=(m=oe==null?void 0:oe.replies)==null?void 0:m[0])==null?void 0:T.addNamedRange,be=(ce==null?void 0:ce.namedRange)??null,Ce=(be==null?void 0:be.namedRangeId)??null;return{value:K.Success,result:{namedRangeId:Ce},error:null}}catch(b){const R=((g=b.response)==null?void 0:g.data)||b.message||b;return pe.Logger.log("[Google Sheets] error:",R),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:R,result:null}}}})}}class L1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsSetCellNote,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsSetCellNote);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=Be(t,t.project,"setCellNote"),R="["+Ve(t,t.project,"Set Cell Note")+": `"+g+"`] ",I=(re,ae,le)=>{const oe=Ve(re==null?void 0:re.valueOwner,T==null?void 0:T.logic,ae),ce=Be(re==null?void 0:re.valueOwner,T==null?void 0:T.logic,le);return`"${oe}" (\`${ce}\`)`},A=n.find(re=>{var ae;return((ae=re.valueOwner.declaration)==null?void 0:ae.id)===G.operation[X.GoogleSheetsSetCellNote].inputs.connection.id}),x=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!x||!x.id||!x.name||x.type!==r.DefinitionEntity)throw new Error(`${R}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const P=ui(x);if(!P)throw new Error(`${R}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const O=n.find(re=>{var ae;return((ae=re.valueOwner.declaration)==null?void 0:ae.id)===G.operation[X.GoogleSheetsSetCellNote].inputs.spreadsheetId.id}),$=(u=O==null?void 0:O.value)==null?void 0:u.value,U=ln($,{errorPrefix:`${R}The ${I(O,"Spreadsheet ID","spreadsheetId")} input `}),Z=n.find(re=>{var ae;return((ae=re.valueOwner.declaration)==null?void 0:ae.id)===G.operation[X.GoogleSheetsSetCellNote].inputs.range.id}),j=(e=Z==null?void 0:Z.value)==null?void 0:e.value;if(j==null)throw new Error(`${R}The ${I(Z,"range","range")} input is missing.`);const H=n.find(re=>{var ae;return((ae=re.valueOwner.declaration)==null?void 0:ae.id)===G.operation[X.GoogleSheetsSetCellNote].inputs.note.id}),Y=(f=H==null?void 0:H.value)==null?void 0:f.value;if(Y==null)throw new Error(`${R}The ${I(H,"note","note")} input is missing.`);const W={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}/${Zt["google-sheet"]}/${P}`,J=async re=>Ht.post(z,re,{headers:W}),ee=await Ha(j,"Id",async()=>(await J({method:"GET",endpoint:`/v4/spreadsheets/${U}?fields=sheets.properties(sheetId,title)`})).data.sheets.map(ae=>({id:ae.properties.sheetId,name:ae.properties.title})));let Q={repeatCell:{range:ps(ee,{errorPrefix:`${R}The ${I(Z,"Range","range")} input `}),cell:{note:typeof Y=="string"&&Y.trim().startsWith("{")?JSON.parse(Y):Y},fields:"note"}};return await J({method:"POST",endpoint:`/v4/spreadsheets/${U}:batchUpdate`,data:{requests:[Q]}}),{value:K.Success,result:null,error:null}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return pe.Logger.log("[Google Sheets] error:",g),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:g,result:null}}}})}}class B1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsDeleteConditionalFormatRule,version:"1.0.0",description:"Delete Conditional Format Rule Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsDeleteConditionalFormatRule);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T;try{const g=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!g||!g.env)throw new Error("Editor context or environment missing");const b=Be(t,t.project,"deleteConditionalFormatRule"),I="["+Ve(t,t.project,"Delete Conditional Format Rule")+": `"+b+"`] ",A=(le,oe,ce)=>{const be=Ve(le==null?void 0:le.valueOwner,g==null?void 0:g.logic,oe),Ce=Be(le==null?void 0:le.valueOwner,g==null?void 0:g.logic,ce);return`"${be}" (\`${Ce}\`)`},x=G.operation[X.GoogleSheetsDeleteConditionalFormatRule].inputs,P=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===x.connection.id}),O=(s=P==null?void 0:P.value)==null?void 0:s.valueAsType;if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${I}The ${A(P,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const $=ui(O);if(!$)throw new Error(`${I}The ${A(P,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const U=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===x.spreadsheetId.id}),Z=(u=U==null?void 0:U.value)==null?void 0:u.value,j=ln(Z,{errorPrefix:`${I}The ${A(U,"Spreadsheet ID","spreadsheetId")} input `}),H=n.find(le=>{var oe,ce;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===((ce=x.sheet)==null?void 0:ce.id)}),Y=(e=H==null?void 0:H.value)==null?void 0:e.value;if(Y==null||Y==="")throw new Error(`${I}The ${A(H,"Sheet","sheet")} input is missing.`);const ie=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===x.index.id}),W=(f=ie==null?void 0:ie.value)==null?void 0:f.value;if(W==null||W==="")throw new Error(`${I}The ${A(ie,"Index","index")} input is missing.`);const z=typeof W=="number"?W:parseInt(String(W),10);if(isNaN(z)||z<1)throw new Error(`${I}The ${A(ie,"Index","index")} input must be a 1-based positive integer.`);const ee={Authorization:`Bearer ${await g.getAccessToken()}`},Q=`${(y=g.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${g.projectId}/${Zt["google-sheet"]}/${$}`,re=async le=>Ht.post(Q,le,{headers:ee});let ae;if(typeof Y=="number"||/^\d+$/.test(String(Y).trim()))ae=Number(Y);else{const ce=(((m=(await re({method:"GET",endpoint:`/v4/spreadsheets/${j}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:m.sheets)||[]).find(be=>{var Ce;return String((Ce=be.properties)==null?void 0:Ce.title).trim().toLowerCase()===String(Y).trim().toLowerCase()});if(!ce)throw new Error(`${I}The ${A(H,"Sheet","sheet")} input "${Y}" was not found in spreadsheet.`);ae=ce.properties.sheetId}return await re({method:"POST",endpoint:`/v4/spreadsheets/${j}:batchUpdate`,data:{requests:[{deleteConditionalFormatRule:{sheetId:ae,index:z-1}}]}}),{value:K.Success,result:null,error:null}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return pe.Logger.log("[Google Sheets] error:",b),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:b,result:null}}}})}}function FRn(a){return{NUMBER_GREATER:"Number greater than",NUMBER_GREATER_THAN_EQ:"Number greater than or equal",NUMBER_LESS:"Number less than",NUMBER_LESS_THAN_EQ:"Number less than or equal",NUMBER_EQ:"Number equal to",NUMBER_NOT_EQ:"Number not equal to",NUMBER_BETWEEN:"Number between",NUMBER_NOT_BETWEEN:"Number not between",TEXT_CONTAINS:"Text contains",TEXT_NOT_CONTAINS:"Text does not contain",TEXT_STARTS_WITH:"Text starts with",TEXT_ENDS_WITH:"Text ends with",TEXT_EQ:"Text equals",DATE_EQ:"Date is",DATE_BEFORE:"Date is before",DATE_AFTER:"Date is after",DATE_ON_OR_BEFORE:"Date is on or before",DATE_ON_OR_AFTER:"Date is on or after",BLANK:"Cell is empty",NOT_BLANK:"Cell is not empty",CUSTOM_FORMULA:"Custom formula"}[a]||a}function A5(a){let p,t="",n=a+1;for(;n>0;)p=(n-1)%26,t=String.fromCharCode(65+p)+t,n=(n-p-1)/26;return t}function kRn(a,p){if(!a)return"";let t=p?`'${p}'!`:"";const n=a.startColumnIndex!==void 0?A5(a.startColumnIndex):"",s=a.startRowIndex!==void 0?String(a.startRowIndex+1):"",u=a.endColumnIndex!==void 0?A5(a.endColumnIndex-1):"",e=a.endRowIndex!==void 0?String(a.endRowIndex):"";return n&&s&&u&&e?n===u&&s===e?`${t}${n}${s}`:`${t}${n}${s}:${u}${e}`:n&&u&&!s&&!e?`${t}${n}:${u}`:s&&e&&!n&&!u?`${t}${s}:${e}`:`${t}${n}${s}:${u}${e}`.replace(/:$/,"")}class S1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsGetConditionalFormatRules,version:"1.0.0",description:"Get Conditional Format Rules Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsGetConditionalFormatRules);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T;try{const g=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!g||!g.env)throw new Error("Editor context or environment missing");const b=Be(t,t.project,"getConditionalFormatRules"),I="["+Ve(t,t.project,"Get Conditional Format Rules")+": `"+b+"`] ",A=(le,oe,ce)=>{const be=Ve(le==null?void 0:le.valueOwner,g==null?void 0:g.logic,oe),Ce=Be(le==null?void 0:le.valueOwner,g==null?void 0:g.logic,ce);return`"${be}" (\`${Ce}\`)`},x=G.operation[X.GoogleSheetsGetConditionalFormatRules].inputs,P=le=>{var ce;const oe=n.find(be=>{var Ce;return((Ce=be.valueOwner.declaration)==null?void 0:Ce.id)===le});return(ce=oe==null?void 0:oe.value)==null?void 0:ce.value},O=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===x.connection.id}),$=(s=O==null?void 0:O.value)==null?void 0:s.valueAsType;if(!$||!$.id||!$.name||$.type!==r.DefinitionEntity)throw new Error(`${I}The ${A(O,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const U=ui($);if(!U)throw new Error(`${I}The ${A(O,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const Z=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===x.spreadsheetId.id}),j=(u=Z==null?void 0:Z.value)==null?void 0:u.value,H=ln(j,{errorPrefix:`${I}The ${A(Z,"Spreadsheet ID","spreadsheetId")} input `}),Y=P(x.sheet.id),ie=typeof Y=="string"&&Y.trim()!==""?Y.trim():null,z={Authorization:`Bearer ${await g.getAccessToken()}`},J=`${(e=g.env)==null?void 0:e.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${g.projectId}/${Zt["google-sheet"]}/${U}`,re=((f=(await(async le=>Ht.post(J,le,{headers:z}))({method:"GET",endpoint:`/v4/spreadsheets/${H}?fields=sheets(properties(sheetId,title),conditionalFormats)`})).data)==null?void 0:f.sheets)||[],ae=[];for(const le of re){const oe=((y=le.properties)==null?void 0:y.title)||"",ce=(m=le.properties)==null?void 0:m.sheetId;if(ie&&oe.toLowerCase()!==ie.toLowerCase())continue;(le.conditionalFormats||[]).forEach((Ce,Ee)=>{const xe=Ee+1,Le=(Ce.ranges||[]).map(ot=>kRn(ot,oe)),Fe=Ce.booleanRule||{},tt=Fe.condition||{},We=FRn(tt.type||""),et=(tt.values||[]).map(ot=>ot.userEnteredValue||""),qe=Fe.format||{};ae.push({index:xe,sheet:oe,sheetId:ce,ranges:Le,conditionType:We,conditionValues:et,format:qe})})}return{value:K.Success,error:null,result:ae}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return pe.Logger.log("[Google Sheets] error:",b),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:b,result:null}}}})}}function D5(a){let p,t="",n=a+1;for(;n>0;)p=(n-1)%26,t=String.fromCharCode(65+p)+t,n=(n-p-1)/26;return t}function URn(a,p){if(!a)return"";let t=p?`'${p}'!`:"";const n=a.startColumnIndex!==void 0?D5(a.startColumnIndex):"",s=a.startRowIndex!==void 0?String(a.startRowIndex+1):"",u=a.endColumnIndex!==void 0?D5(a.endColumnIndex-1):"",e=a.endRowIndex!==void 0?String(a.endRowIndex):"";return n&&s&&u&&e?n===u&&s===e?`${t}${n}${s}`:`${t}${n}${s}:${u}${e}`:n&&u&&!s&&!e?`${t}${n}:${u}`:s&&e&&!n&&!u?`${t}${s}:${e}`:`${t}${n}${s}:${u}${e}`.replace(/:$/,"")}class M1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsGetProtectedRanges,version:"1.0.0",description:"Get Protected Ranges Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsGetProtectedRanges);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g;try{const b=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!b||!b.env)throw new Error("Editor context or environment missing");const R=Be(t,t.project,"getProtectedRanges"),A="["+Ve(t,t.project,"Get protected ranges")+": `"+R+"`] ",x=(ae,le,oe)=>{const ce=Ve(ae==null?void 0:ae.valueOwner,b==null?void 0:b.logic,le),be=Be(ae==null?void 0:ae.valueOwner,b==null?void 0:b.logic,oe);return`"${ce}" (\`${be}\`)`},P=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[X.GoogleSheetsGetProtectedRanges].inputs.connection.id}),O=(s=P==null?void 0:P.value)==null?void 0:s.valueAsType;if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${A}The ${x(P,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const $=ui(O);if(!$)throw new Error(`${A}The ${x(P,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const U=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[X.GoogleSheetsGetProtectedRanges].inputs.spreadsheetId.id}),Z=(u=U==null?void 0:U.value)==null?void 0:u.value,j=ln(Z,{errorPrefix:`${A}The ${x(U,"Spreadsheet ID","spreadsheetId")} input `}),H=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[X.GoogleSheetsGetProtectedRanges].inputs.sheet.id}),Y=(e=H==null?void 0:H.value)!=null&&e.value?String(H.value.value).trim():null,W={Authorization:`Bearer ${await b.getAccessToken()}`},z=`${(f=b.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${b.projectId}/${Zt["google-sheet"]}/${$}`,Q=((y=(await(async ae=>Ht.post(z,ae,{headers:W}))({method:"GET",endpoint:`/v4/spreadsheets/${j}`})).data)==null?void 0:y.sheets)||[],re=[];for(const ae of Q){const le=(m=ae.properties)==null?void 0:m.title,oe=(T=ae.properties)==null?void 0:T.sheetId;if(Y&&le!==Y)continue;const ce=ae.protectedRanges||[];for(const be of ce){const Ce=URn(be.range,le);re.push({protectedRangeId:be.protectedRangeId,sheet:le,sheetId:oe,range:Ce,description:be.description||"",warningOnly:be.warningOnly??!1,requestingUserCanEdit:be.requestingUserCanEdit??!0})}}return{value:K.Success,error:null,result:re}}catch(b){const R=((g=b.response)==null?void 0:g.data)||b.message||b;return pe.Logger.log("[Google Sheets] error:",R),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:R,result:null}}}})}}function bh(a){if(!a)return null;const p=Math.round((a.red||0)*255),t=Math.round((a.green||0)*255),n=Math.round((a.blue||0)*255),s=u=>u.toString(16).padStart(2,"0");return`#${s(p)}${s(t)}${s(n)}`}function C5(a){let p,t="",n=a+1;for(;n>0;)p=(n-1)%26,t=String.fromCharCode(65+p)+t,n=(n-p-1)/26;return t}function KRn(a,p){if(!a)return"";let t=p?`'${p}'!`:"";const n=a.startColumnIndex!==void 0?C5(a.startColumnIndex):"",s=a.startRowIndex!==void 0?String(a.startRowIndex+1):"",u=a.endColumnIndex!==void 0?C5(a.endColumnIndex-1):"",e=a.endRowIndex!==void 0?String(a.endRowIndex):"";return n&&s&&u&&e?n===u&&s===e?`${t}${n}${s}`:`${t}${n}${s}:${u}${e}`:n&&u&&!s&&!e?`${t}${n}:${u}`:s&&e&&!n&&!u?`${t}${s}:${e}`:`${t}${n}${s}:${u}${e}`.replace(/:$/,"")}class F1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsGetBandedRanges,version:"1.0.0",description:"Get Banded Ranges Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsGetBandedRanges);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A;try{const x=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!x||!x.env)throw new Error("Editor context or environment missing");const P=Be(t,t.project,"getBandedRanges"),$="["+Ve(t,t.project,"Get banded ranges")+": `"+P+"`] ",U=(be,Ce,Ee)=>{const xe=Ve(be==null?void 0:be.valueOwner,x==null?void 0:x.logic,Ce),Le=Be(be==null?void 0:be.valueOwner,x==null?void 0:x.logic,Ee);return`"${xe}" (\`${Le}\`)`},Z=n.find(be=>{var Ce;return((Ce=be.valueOwner.declaration)==null?void 0:Ce.id)===G.operation[X.GoogleSheetsGetBandedRanges].inputs.connection.id}),j=(s=Z==null?void 0:Z.value)==null?void 0:s.valueAsType;if(!j||!j.id||!j.name||j.type!==r.DefinitionEntity)throw new Error(`${$}The ${U(Z,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const H=ui(j);if(!H)throw new Error(`${$}The ${U(Z,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const Y=n.find(be=>{var Ce;return((Ce=be.valueOwner.declaration)==null?void 0:Ce.id)===G.operation[X.GoogleSheetsGetBandedRanges].inputs.spreadsheetId.id}),ie=(u=Y==null?void 0:Y.value)==null?void 0:u.value,W=ln(ie,{errorPrefix:`${$}The ${U(Y,"Spreadsheet ID","spreadsheetId")} input `}),z=n.find(be=>{var Ce;return((Ce=be.valueOwner.declaration)==null?void 0:Ce.id)===G.operation[X.GoogleSheetsGetBandedRanges].inputs.sheet.id}),J=(e=z==null?void 0:z.value)!=null&&e.value?String(z.value.value).trim():null,Q={Authorization:`Bearer ${await x.getAccessToken()}`},re=`${(f=x.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${x.projectId}/${Zt["google-sheet"]}/${H}`,oe=((y=(await(async be=>Ht.post(re,be,{headers:Q}))({method:"GET",endpoint:`/v4/spreadsheets/${W}`})).data)==null?void 0:y.sheets)||[],ce=[];for(const be of oe){const Ce=(m=be.properties)==null?void 0:m.title,Ee=(T=be.properties)==null?void 0:T.sheetId;if(J&&Ce!==J)continue;const xe=be.bandedRanges||[];for(const Le of xe){const Fe=KRn(Le.range,Ce),tt=Le.rowProperties||{};ce.push({bandedRangeId:Le.bandedRangeId,sheet:Ce,sheetId:Ee,range:Fe,headerRowColor:bh(tt.headerColor)||bh((g=tt.headerColorStyle)==null?void 0:g.rgbColor),firstRowColor:bh(tt.firstBandColor)||bh((b=tt.firstBandColorStyle)==null?void 0:b.rgbColor),secondRowColor:bh(tt.secondBandColor)||bh((R=tt.secondBandColorStyle)==null?void 0:R.rgbColor),footerRowColor:bh(tt.footerColor)||bh((I=tt.footerColorStyle)==null?void 0:I.rgbColor)})}}return{value:K.Success,error:null,result:ce}}catch(x){const P=((A=x.response)==null?void 0:A.data)||x.message||x;return pe.Logger.log("[Google Sheets] error:",P),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:P,result:null}}}})}}function w5(a){let p,t="",n=a+1;for(;n>0;)p=(n-1)%26,t=String.fromCharCode(65+p)+t,n=(n-p-1)/26;return t}function jRn(a,p){if(!a)return"";let t=p?`'${p}'!`:"";const n=a.startColumnIndex!==void 0?w5(a.startColumnIndex):"",s=a.startRowIndex!==void 0?String(a.startRowIndex+1):"",u=a.endColumnIndex!==void 0?w5(a.endColumnIndex-1):"",e=a.endRowIndex!==void 0?String(a.endRowIndex):"";return n&&s&&u&&e?n===u&&s===e?`${t}${n}${s}`:`${t}${n}${s}:${u}${e}`:n&&u&&!s&&!e?`${t}${n}:${u}`:s&&e&&!n&&!u?`${t}${s}:${e}`:`${t}${n}${s}:${u}${e}`.replace(/:$/,"")}class k1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsGetNamedRanges,version:"1.0.0",description:"Get Named Ranges Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsGetNamedRanges);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=Be(t,t.project,"getNamedRanges"),R="["+Ve(t,t.project,"Get named ranges")+": `"+g+"`] ",I=(ee,Q,re)=>{const ae=Ve(ee==null?void 0:ee.valueOwner,T==null?void 0:T.logic,Q),le=Be(ee==null?void 0:ee.valueOwner,T==null?void 0:T.logic,re);return`"${ae}" (\`${le}\`)`},A=n.find(ee=>{var Q;return((Q=ee.valueOwner.declaration)==null?void 0:Q.id)===G.operation[X.GoogleSheetsGetNamedRanges].inputs.connection.id}),x=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!x||!x.id||!x.name||x.type!==r.DefinitionEntity)throw new Error(`${R}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const P=ui(x);if(!P)throw new Error(`${R}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const O=n.find(ee=>{var Q;return((Q=ee.valueOwner.declaration)==null?void 0:Q.id)===G.operation[X.GoogleSheetsGetNamedRanges].inputs.spreadsheetId.id}),$=(u=O==null?void 0:O.value)==null?void 0:u.value,U=ln($,{errorPrefix:`${R}The ${I(O,"Spreadsheet ID","spreadsheetId")} input `}),j={Authorization:`Bearer ${await T.getAccessToken()}`},H=`${(e=T.env)==null?void 0:e.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${T.projectId}/${Zt["google-sheet"]}/${P}`,ie=await(async ee=>Ht.post(H,ee,{headers:j}))({method:"GET",endpoint:`/v4/spreadsheets/${U}`}),W={};(((f=ie.data)==null?void 0:f.sheets)||[]).forEach(ee=>{var Q;((Q=ee.properties)==null?void 0:Q.sheetId)!==void 0&&(W[ee.properties.sheetId]=ee.properties.title||"")});const J=(((y=ie.data)==null?void 0:y.namedRanges)||[]).map(ee=>{var ae;const Q=W[(ae=ee.range)==null?void 0:ae.sheetId]||"",re=jRn(ee.range,Q);return{namedRangeId:ee.namedRangeId,name:ee.name,sheet:Q,range:re}});return{value:K.Success,error:null,result:J}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return pe.Logger.log("[Google Sheets] error:",g),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:g,result:null}}}})}}class U1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsGetSheets,version:"1.0.0",description:"Get Sheets Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsGetSheets);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"getSheets"),b="["+Ve(t,t.project,"Get sheets")+": `"+T+"`] ",R=(z,J,ee)=>{const Q=Ve(z==null?void 0:z.valueOwner,m==null?void 0:m.logic,J),re=Be(z==null?void 0:z.valueOwner,m==null?void 0:m.logic,ee);return`"${Q}" (\`${re}\`)`},I=n.find(z=>{var J;return((J=z.valueOwner.declaration)==null?void 0:J.id)===G.operation[X.GoogleSheetsGetSheets].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=ui(A);if(!x)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(z=>{var J;return((J=z.valueOwner.declaration)==null?void 0:J.id)===G.operation[X.GoogleSheetsGetSheets].inputs.spreadsheetId.id}),O=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(O,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),Z={Authorization:`Bearer ${await m.getAccessToken()}`},j=`${(e=m.env)==null?void 0:e.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${x}`,W=(((f=(await(async z=>Ht.post(j,z,{headers:Z}))({method:"GET",endpoint:`/v4/spreadsheets/${$}`})).data)==null?void 0:f.sheets)||[]).map(z=>{var J,ee,Q,re,ae,le,oe,ce,be,Ce,Ee,xe,Le;return{sheetId:(J=z.properties)==null?void 0:J.sheetId,title:(ee=z.properties)==null?void 0:ee.title,index:(Q=z.properties)==null?void 0:Q.index,sheetType:(re=z.properties)==null?void 0:re.sheetType,rowCount:(le=(ae=z.properties)==null?void 0:ae.gridProperties)==null?void 0:le.rowCount,columnCount:(ce=(oe=z.properties)==null?void 0:oe.gridProperties)==null?void 0:ce.columnCount,frozenRowCount:(Ce=(be=z.properties)==null?void 0:be.gridProperties)==null?void 0:Ce.frozenRowCount,frozenColumnCount:(xe=(Ee=z.properties)==null?void 0:Ee.gridProperties)==null?void 0:xe.frozenColumnCount,hidden:((Le=z.properties)==null?void 0:Le.hidden)??!1}});return{value:K.Success,error:null,result:W}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class K1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsGetSheet,version:"1.0.0",description:"Get Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsGetSheet);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=Be(t,t.project,"getSheet"),R="["+Ve(t,t.project,"Get sheet")+": `"+g+"`] ",I=(le,oe,ce)=>{const be=Ve(le==null?void 0:le.valueOwner,T==null?void 0:T.logic,oe),Ce=Be(le==null?void 0:le.valueOwner,T==null?void 0:T.logic,ce);return`"${be}" (\`${Ce}\`)`},A=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[X.GoogleSheetsGetSheet].inputs.connection.id}),x=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!x||!x.id||!x.name||x.type!==r.DefinitionEntity)throw new Error(`${R}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const P=ui(x);if(!P)throw new Error(`${R}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const O=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[X.GoogleSheetsGetSheet].inputs.spreadsheetId.id}),$=(u=O==null?void 0:O.value)==null?void 0:u.value,U=ln($,{errorPrefix:`${R}The ${I(O,"Spreadsheet ID","spreadsheetId")} input `}),Z=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[X.GoogleSheetsGetSheet].inputs.sheet.id}),j=(e=Z==null?void 0:Z.value)==null?void 0:e.value;if(j==null||j==="")throw new Error(`${R}The ${I(Z,"Sheet","sheet")} input is missing.`);const Y={Authorization:`Bearer ${await T.getAccessToken()}`},ie=`${(f=T.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${T.projectId}/${Zt["google-sheet"]}/${P}`,J=((y=(await(async le=>Ht.post(ie,le,{headers:Y}))({method:"GET",endpoint:`/v4/spreadsheets/${U}`})).data)==null?void 0:y.sheets)||[];let ee=null;if(typeof j=="number")ee=J.find(le=>{var oe;return Number((oe=le.properties)==null?void 0:oe.sheetId)===j});else if(typeof j=="string"){const le=j.trim();ee=J.find(oe=>{var ce,be;return((ce=oe.properties)==null?void 0:ce.title)===le||String((be=oe.properties)==null?void 0:be.sheetId)===le})}if(!ee)throw new Error(`${R}Sheet "${j}" was not found in spreadsheet.`);const Q=ee.properties||{},re=Q.gridProperties||{},ae={sheetId:Q.sheetId,title:Q.title,index:Q.index,sheetType:Q.sheetType,rowCount:re.rowCount,columnCount:re.columnCount,frozenRowCount:re.frozenRowCount,frozenColumnCount:re.frozenColumnCount,hideGridlines:re.hideGridlines??!1,rowGroupControlAfter:re.rowGroupControlAfter??!1,columnGroupControlAfter:re.columnGroupControlAfter??!1,hidden:Q.hidden??!1,rightToLeft:Q.rightToLeft??!1,tabColor:Q.tabColor?{red:Q.tabColor.red??0,green:Q.tabColor.green??0,blue:Q.tabColor.blue??0,alpha:Q.tabColor.alpha??1}:null,basicFilter:ee.basicFilter?{range:ee.basicFilter.range}:null,protectedRanges:(ee.protectedRanges||[]).map(le=>({protectedRangeId:le.protectedRangeId,range:le.range,description:le.description??"",warningOnly:le.warningOnly??!1,requestingUserCanEdit:le.requestingUserCanEdit??!1,namedRangeId:le.namedRangeId??null})),bandedRanges:(ee.bandedRanges||[]).map(le=>({bandedRangeId:le.bandedRangeId,range:le.range})),charts:(ee.charts||[]).map(le=>{var oe,ce;return{chartId:le.chartId,title:((oe=le.spec)==null?void 0:oe.title)??"",chartType:((ce=le.spec)==null?void 0:ce.chartType)??""}}),conditionalFormatRules:(ee.conditionalFormats||[]).map((le,oe)=>{var ce;return{ruleIndex:oe,range:(ce=le.ranges)!=null&&ce[0]?`${le.ranges[0].startRowIndex}:${le.ranges[0].endRowIndex}`:""}}),mergedCells:(ee.merges||[]).map(le=>`${le.startRowIndex}:${le.endRowIndex}`)};return{value:K.Success,error:null,result:ae}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return pe.Logger.log("[Google Sheets] error:",g),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:g,result:null}}}})}}function x5(a){let p,t="",n=a+1;for(;n>0;)p=(n-1)%26,t=String.fromCharCode(65+p)+t,n=(n-p-1)/26;return t}function qRn(a,p){if(!a)return"";let t=p?`'${p}'!`:"";const n=a.startColumnIndex!==void 0?x5(a.startColumnIndex):"",s=a.startRowIndex!==void 0?String(a.startRowIndex+1):"",u=a.endColumnIndex!==void 0?x5(a.endColumnIndex-1):"",e=a.endRowIndex!==void 0?String(a.endRowIndex):"";return n&&s&&u&&e?n===u&&s===e?`${t}${n}${s}`:`${t}${n}${s}:${u}${e}`:n&&u&&!s&&!e?`${t}${n}:${u}`:s&&e&&!n&&!u?`${t}${s}:${e}`:`${t}${n}${s}:${u}${e}`.replace(/:$/,"")}class j1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsGetCharts,version:"1.0.0",description:"Get Charts Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsGetCharts);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I;try{const A=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!A||!A.env)throw new Error("Editor context or environment missing");const x=Be(t,t.project,"getCharts"),O="["+Ve(t,t.project,"Get charts")+": `"+x+"`] ",$=(ce,be,Ce)=>{const Ee=Ve(ce==null?void 0:ce.valueOwner,A==null?void 0:A.logic,be),xe=Be(ce==null?void 0:ce.valueOwner,A==null?void 0:A.logic,Ce);return`"${Ee}" (\`${xe}\`)`},U=n.find(ce=>{var be;return((be=ce.valueOwner.declaration)==null?void 0:be.id)===G.operation[X.GoogleSheetsGetCharts].inputs.connection.id}),Z=(s=U==null?void 0:U.value)==null?void 0:s.valueAsType;if(!Z||!Z.id||!Z.name||Z.type!==r.DefinitionEntity)throw new Error(`${O}The ${$(U,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const j=ui(Z);if(!j)throw new Error(`${O}The ${$(U,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const H=n.find(ce=>{var be;return((be=ce.valueOwner.declaration)==null?void 0:be.id)===G.operation[X.GoogleSheetsGetCharts].inputs.spreadsheetId.id}),Y=(u=H==null?void 0:H.value)==null?void 0:u.value,ie=ln(Y,{errorPrefix:`${O}The ${$(H,"Spreadsheet ID","spreadsheetId")} input `}),W=n.find(ce=>{var be;return((be=ce.valueOwner.declaration)==null?void 0:be.id)===G.operation[X.GoogleSheetsGetCharts].inputs.sheet.id}),z=(e=W==null?void 0:W.value)!=null&&e.value?String(W.value.value).trim():null,ee={Authorization:`Bearer ${await A.getAccessToken()}`},Q=`${(f=A.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${A.projectId}/${Zt["google-sheet"]}/${j}`,le=((y=(await(async ce=>Ht.post(Q,ce,{headers:ee}))({method:"GET",endpoint:`/v4/spreadsheets/${ie}`})).data)==null?void 0:y.sheets)||[],oe=[];for(const ce of le){const be=(m=ce.properties)==null?void 0:m.title,Ce=(T=ce.properties)==null?void 0:T.sheetId;if(z&&be!==z)continue;const Ee=ce.charts||[];for(const xe of Ee){const Le=xe.spec||{},Fe=Le.title||"",tt=((g=Le.basicChart)==null?void 0:g.chartType)||(Le.pieChart?"PIE":"UNKNOWN"),We=qRn((R=(b=xe.position)==null?void 0:b.overlayPosition)==null?void 0:R.anchorCell,be);oe.push({chartId:xe.chartId,sheet:be,sheetId:Ce,title:Fe,chartType:tt,positionRange:We})}}return{value:K.Success,error:null,result:oe}}catch(A){const x=((I=A.response)==null?void 0:I.data)||A.message||A;return pe.Logger.log("[Google Sheets] error:",x),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:x,result:null}}}})}}function O5(a){let p,t="",n=a+1;for(;n>0;)p=(n-1)%26,t=String.fromCharCode(65+p)+t,n=(n-p-1)/26;return t}function P5(a,p){if(!a)return"";let t=p?`'${p}'!`:"";const n=a.startColumnIndex!==void 0?O5(a.startColumnIndex):"",s=a.startRowIndex!==void 0?String(a.startRowIndex+1):"",u=a.endColumnIndex!==void 0?O5(a.endColumnIndex-1):"",e=a.endRowIndex!==void 0?String(a.endRowIndex):"";return n&&s&&u&&e?n===u&&s===e?`${t}${n}${s}`:`${t}${n}${s}:${u}${e}`:n&&u&&!s&&!e?`${t}${n}:${u}`:s&&e&&!n&&!u?`${t}${s}:${e}`:`${t}${n}${s}:${u}${e}`.replace(/:$/,"")}class q1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsGetFilter,version:"1.0.0",description:"Get Filter Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsGetFilter);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g;try{const b=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!b||!b.env)throw new Error("Editor context or environment missing");const R=Be(t,t.project,"getFilter"),A="["+Ve(t,t.project,"Get filter")+": `"+R+"`] ",x=(Ce,Ee,xe)=>{const Le=Ve(Ce==null?void 0:Ce.valueOwner,b==null?void 0:b.logic,Ee),Fe=Be(Ce==null?void 0:Ce.valueOwner,b==null?void 0:b.logic,xe);return`"${Le}" (\`${Fe}\`)`},P=n.find(Ce=>{var Ee;return((Ee=Ce.valueOwner.declaration)==null?void 0:Ee.id)===G.operation[X.GoogleSheetsGetFilter].inputs.connection.id}),O=(s=P==null?void 0:P.value)==null?void 0:s.valueAsType;if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${A}The ${x(P,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const $=ui(O);if(!$)throw new Error(`${A}The ${x(P,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const U=n.find(Ce=>{var Ee;return((Ee=Ce.valueOwner.declaration)==null?void 0:Ee.id)===G.operation[X.GoogleSheetsGetFilter].inputs.spreadsheetId.id}),Z=(u=U==null?void 0:U.value)==null?void 0:u.value,j=ln(Z,{errorPrefix:`${A}The ${x(U,"Spreadsheet ID","spreadsheetId")} input `}),H=n.find(Ce=>{var Ee;return((Ee=Ce.valueOwner.declaration)==null?void 0:Ee.id)===G.operation[X.GoogleSheetsGetFilter].inputs.sheet.id}),Y=(e=H==null?void 0:H.value)!=null&&e.value?String(H.value.value).trim():null,W={Authorization:`Bearer ${await b.getAccessToken()}`},z=`${(f=b.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${b.projectId}/${Zt["google-sheet"]}/${$}`,Q=((y=(await(async Ce=>Ht.post(z,Ce,{headers:W}))({method:"GET",endpoint:`/v4/spreadsheets/${j}`})).data)==null?void 0:y.sheets)||[];let re=Q[0];Y&&(re=Q.find(Ce=>{var Ee;return((Ee=Ce.properties)==null?void 0:Ee.title)===Y})||re);const ae=((m=re==null?void 0:re.properties)==null?void 0:m.title)||"",le=((T=re==null?void 0:re.properties)==null?void 0:T.sheetId)??0,oe=re==null?void 0:re.basicFilter,ce=oe?P5(oe.range,ae):null,be=((re==null?void 0:re.filterViews)||[]).map(Ce=>({filterViewId:Ce.filterViewId,title:Ce.title,range:P5(Ce.range,ae)}));return{value:K.Success,error:null,result:{sheet:ae,sheetId:le,filterRange:ce,filterViews:be}}}catch(b){const R=((g=b.response)==null?void 0:g.data)||b.message||b;return pe.Logger.log("[Google Sheets] error:",R),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:R,result:null}}}})}}function V5(a){let p,t="",n=a+1;for(;n>0;)p=(n-1)%26,t=String.fromCharCode(65+p)+t,n=(n-p-1)/26;return t}function ZRn(a,p){if(!a)return"";let t=p?`'${p}'!`:"";const n=a.startColumnIndex!==void 0?V5(a.startColumnIndex):"",s=a.startRowIndex!==void 0?String(a.startRowIndex+1):"",u=a.endColumnIndex!==void 0?V5(a.endColumnIndex-1):"",e=a.endRowIndex!==void 0?String(a.endRowIndex):"";return n&&s&&u&&e?n===u&&s===e?`${t}${n}${s}`:`${t}${n}${s}:${u}${e}`:n&&u&&!s&&!e?`${t}${n}:${u}`:s&&e&&!n&&!u?`${t}${s}:${e}`:`${t}${n}${s}:${u}${e}`.replace(/:$/,"")}class Z1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsGetMergedCells,version:"1.0.0",description:"Get Merged Cells Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsGetMergedCells);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g;try{const b=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!b||!b.env)throw new Error("Editor context or environment missing");const R=Be(t,t.project,"getMergedCells"),A="["+Ve(t,t.project,"Get merged cells")+": `"+R+"`] ",x=(ae,le,oe)=>{const ce=Ve(ae==null?void 0:ae.valueOwner,b==null?void 0:b.logic,le),be=Be(ae==null?void 0:ae.valueOwner,b==null?void 0:b.logic,oe);return`"${ce}" (\`${be}\`)`},P=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[X.GoogleSheetsGetMergedCells].inputs.connection.id}),O=(s=P==null?void 0:P.value)==null?void 0:s.valueAsType;if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${A}The ${x(P,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const $=ui(O);if(!$)throw new Error(`${A}The ${x(P,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const U=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[X.GoogleSheetsGetMergedCells].inputs.spreadsheetId.id}),Z=(u=U==null?void 0:U.value)==null?void 0:u.value,j=ln(Z,{errorPrefix:`${A}The ${x(U,"Spreadsheet ID","spreadsheetId")} input `}),H=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[X.GoogleSheetsGetMergedCells].inputs.sheet.id}),Y=(e=H==null?void 0:H.value)!=null&&e.value?String(H.value.value).trim():null,W={Authorization:`Bearer ${await b.getAccessToken()}`},z=`${(f=b.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${b.projectId}/${Zt["google-sheet"]}/${$}`,Q=((y=(await(async ae=>Ht.post(z,ae,{headers:W}))({method:"GET",endpoint:`/v4/spreadsheets/${j}`})).data)==null?void 0:y.sheets)||[],re=[];for(const ae of Q){const le=(m=ae.properties)==null?void 0:m.title,oe=(T=ae.properties)==null?void 0:T.sheetId;if(Y&&le!==Y)continue;const ce=ae.merges||[];for(const be of ce){const Ce=ZRn(be,le);re.push({sheet:le,sheetId:oe,range:Ce})}}return{value:K.Success,error:null,result:re}}catch(b){const R=((g=b.response)==null?void 0:g.data)||b.message||b;return pe.Logger.log("[Google Sheets] error:",R),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:R,result:null}}}})}}class H1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsResizeDimension,version:"1.0.0",description:"Resize Dimension Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsResizeDimension);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T;try{const g=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!g||!g.env)throw new Error("Editor context or environment missing");const b=Be(t,t.project,"resizeDimension"),I="["+Ve(t,t.project,"Resize dimension")+": `"+b+"`] ",A=(ce,be,Ce)=>{const Ee=Ve(ce==null?void 0:ce.valueOwner,g==null?void 0:g.logic,be),xe=Be(ce==null?void 0:ce.valueOwner,g==null?void 0:g.logic,Ce);return`"${Ee}" (\`${xe}\`)`},x=n.find(ce=>{var be;return((be=ce.valueOwner.declaration)==null?void 0:be.id)===G.operation[X.GoogleSheetsResizeDimension].inputs.connection.id}),P=(s=x==null?void 0:x.value)==null?void 0:s.valueAsType;if(!P||!P.id||!P.name||P.type!==r.DefinitionEntity)throw new Error(`${I}The ${A(x,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(P);if(!O)throw new Error(`${I}The ${A(x,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const $=n.find(ce=>{var be;return((be=ce.valueOwner.declaration)==null?void 0:be.id)===G.operation[X.GoogleSheetsResizeDimension].inputs.spreadsheetId.id}),U=(u=$==null?void 0:$.value)==null?void 0:u.value,Z=ln(U,{errorPrefix:`${I}The ${A($,"Spreadsheet ID","spreadsheetId")} input `}),j=n.find(ce=>{var be;return((be=ce.valueOwner.declaration)==null?void 0:be.id)===G.operation[X.GoogleSheetsResizeDimension].inputs.range.id}),H=(e=j==null?void 0:j.value)==null?void 0:e.value;if(H==null)throw new Error(`${I}The ${A(j,"Range","range")} input is missing.`);const Y=n.find(ce=>{var be;return((be=ce.valueOwner.declaration)==null?void 0:be.id)===G.operation[X.GoogleSheetsResizeDimension].inputs.dimension.id}),ie=((f=Y==null?void 0:Y.value)==null?void 0:f.value)||"Both",W=n.find(ce=>{var be;return((be=ce.valueOwner.declaration)==null?void 0:be.id)===G.operation[X.GoogleSheetsResizeDimension].inputs.pixelSize.id}),z=(y=W==null?void 0:W.value)==null?void 0:y.value;if(z==null||typeof z!="number"||isNaN(z)||z<0)throw new Error(`${I}The ${A(W,"Pixel size","pixelSize")} input is missing or invalid. Expected a non-negative number in pixels.`);const ee={Authorization:`Bearer ${await g.getAccessToken()}`},Q=`${(m=g.env)==null?void 0:m.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${g.projectId}/${Zt["google-sheet"]}/${O}`,re=async ce=>Ht.post(Q,ce,{headers:ee}),ae=await Ha(H,"Id",async()=>{var be;return(((be=(await re({method:"GET",endpoint:`/v4/spreadsheets/${Z}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:be.sheets)||[]).map(Ce=>{var Ee,xe;return{id:(Ee=Ce.properties)==null?void 0:Ee.sheetId,name:(xe=Ce.properties)==null?void 0:xe.title}})}),oe=U4(ae,typeof ie=="string"?ie:void 0,{errorPrefix:`${I}The ${A(j,"Range","range")} input `}).map(ce=>({updateDimensionProperties:{range:ce,properties:{pixelSize:z},fields:"pixelSize"}}));return await re({method:"POST",endpoint:`/v4/spreadsheets/${Z}:batchUpdate`,data:{requests:oe}}),{value:K.Success,result:null,error:null}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return pe.Logger.log("[Google Sheets] error:",b),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:b,result:null}}}})}}class W1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+X.GoogleSheetsClearFormatting,version:"1.0.0",description:"Clear Formatting Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===te.Logic);if(n){const s=n.get(X.GoogleSheetsClearFormatting);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"clearFormatting"),b="["+Ve(t,t.project,"Clear formatting")+": `"+T+"`] ",R=(J,ee,Q)=>{const re=Ve(J==null?void 0:J.valueOwner,m==null?void 0:m.logic,ee),ae=Be(J==null?void 0:J.valueOwner,m==null?void 0:m.logic,Q);return`"${re}" (\`${ae}\`)`},I=n.find(J=>{var ee;return((ee=J.valueOwner.declaration)==null?void 0:ee.id)===G.operation[X.GoogleSheetsClearFormatting].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=ui(A);if(!x)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(J=>{var ee;return((ee=J.valueOwner.declaration)==null?void 0:ee.id)===G.operation[X.GoogleSheetsClearFormatting].inputs.spreadsheetId.id}),O=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(O,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(J=>{var ee;return((ee=J.valueOwner.declaration)==null?void 0:ee.id)===G.operation[X.GoogleSheetsClearFormatting].inputs.range.id}),Z=(e=U==null?void 0:U.value)==null?void 0:e.value;if(!Z||Z==="")throw new Error(`${b}The ${R(U,"Range","range")} input is missing.`);const H={Authorization:`Bearer ${await m.getAccessToken()}`},Y=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${x}`,ie=async J=>Ht.post(Y,J,{headers:H}),W=await Ha(Z,"Id",async()=>{var ee;return(((ee=(await ie({method:"GET",endpoint:`/v4/spreadsheets/${$}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:ee.sheets)||[]).map(Q=>{var re,ae;return{id:(re=Q.properties)==null?void 0:re.sheetId,name:(ae=Q.properties)==null?void 0:ae.title}})}),z=ps(W,{errorPrefix:`${b}The ${R(U,"Range","range")} input `});return await ie({method:"POST",endpoint:`/v4/spreadsheets/${$}:batchUpdate`,data:{requests:[{repeatCell:{range:z,cell:{userEnteredFormat:{}},fields:"userEnteredFormat"}}]}}),{value:K.Success,error:null,result:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class z1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_UPLOAD_FILE,version:"1.0.0",description:"Cloud File System: Upload File",initPriority:_e.High,permissions:[$e.All],contexts:[te.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===te.Logic);if(!n)return;const s=n.get(Ye.UploadFile);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"uploadFile"),b="["+Ve(t,t.project,"Upload file")+": `"+T+"`] ",R=n.find(ee=>{var Q,re;return((re=(Q=ee.valueOwner)==null?void 0:Q.declaration)==null?void 0:re.id)===G.operation[Ye.UploadFile].inputs.bucket.id}),I=(s=R==null?void 0:R.value)==null?void 0:s.valueAsType;if(!I||!I.id||!I.name||I.type!==r.DefinitionEntity)throw new Error(`${b}Invalid input "${Ve(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"Storage")}" (\`${Be(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const A=ul(I==null?void 0:I.id,((u=m.branchHead)==null?void 0:u.identifier)||"main");if(!((m==null?void 0:m.liveResources)||[]).find(ee=>ee.resourceId===A))throw new Error(`${b}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const P=n.find(ee=>{var Q,re;return((re=(Q=ee.valueOwner)==null?void 0:Q.declaration)==null?void 0:re.id)===G.operation[Ye.UploadFile].inputs.key.id}),O=(e=P==null?void 0:P.value)==null?void 0:e.value;if(!O||O==="")throw new Error(`${b}The "${Ve(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"key")}\`) input is missing.`);if(typeof O!="string")throw new Error(`${b}The "${Ve(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const $=n.find(ee=>{var Q,re;return((re=(Q=ee.valueOwner)==null?void 0:Q.declaration)==null?void 0:re.id)===G.operation[Ye.UploadFile].inputs.file.id}),U=(f=$==null?void 0:$.value)==null?void 0:f.value;if(!U)throw new Error(`${b}The "${Ve($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"File")}" (\`${Be($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"file")}\`) input is missing'`);if(typeof U!="object"||!U.uri||typeof U.uri!="string")throw new Error(`${b}The "${Ve($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"File")}" (\`${Be($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"file")}\`) input is invalid, should be an object with a text 'uri' property.`);const Z=U.uri,j=U.mimeType||"application/octet-stream",H=O,ie=(y=(await Ht.post(`${m.env.API_BASE_URL}/cloud-files-service/v1/files?bucket=${A}&key=${encodeURIComponent(H)}&contentType=${encodeURIComponent(j)}`,{},{headers:{Authorization:`Bearer ${await m.getAccessToken()}`}})).data)==null?void 0:y.uploadUrl;if(!ie)throw new Error(`${b}Failed to retrieve pre-signed upload URL.`);let W;try{W=await F4(Z,()=>m.getAccessToken())}catch(ee){throw new Error(`${b}Failed to fetch file content from '${Z}': ${(ee==null?void 0:ee.message)||ee}`)}await Ht.put(ie,W,{headers:{"Content-Type":j}});const J={uri:`${m.env.API_BASE_URL}/cloud-files-service/v1/files/download?bucket=${A}&key=${encodeURIComponent(H)}`,name:H.split("/").pop()||H,mimeType:j,size:W.length};return{value:K.Success,error:null,result:J}}catch(m){return{value:K.UnhandledError,error:m,result:null}}}})}}class Y1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_GET_FILE,version:"1.0.0",description:"Cloud File System: Get File",initPriority:_e.High,permissions:[$e.All],contexts:[te.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===te.Logic);if(!n)return;const s=n.get(Ye.GetFile);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e;try{const f=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!f||!f.env)throw new Error("Editor context or environment missing");const y=Be(t,t.project,"getFile"),T="["+Ve(t,t.project,"Get file")+": `"+y+"`] ",g=n.find($=>{var U,Z;return((Z=(U=$.valueOwner)==null?void 0:U.declaration)==null?void 0:Z.id)===G.operation[Ye.GetFile].inputs.bucket.id}),b=(s=g==null?void 0:g.value)==null?void 0:s.valueAsType;if(!b||!b.id||!b.name||b.type!==r.DefinitionEntity)throw new Error(`${T}Invalid input "${Ve(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"Storage")}" (\`${Be(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const R=ul(b==null?void 0:b.id,((u=f.branchHead)==null?void 0:u.identifier)||"main");if(!((f==null?void 0:f.liveResources)||[]).find($=>$.resourceId===R))throw new Error(`${T}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const A=n.find($=>{var U,Z;return((Z=(U=$.valueOwner)==null?void 0:U.declaration)==null?void 0:Z.id)===G.operation[Ye.GetFile].inputs.key.id}),x=(e=A==null?void 0:A.value)==null?void 0:e.value;if(!x||x==="")throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"key")}\`) input is missing.`);if(typeof x!="string")throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const O=(await Ht.get(`${f.env.API_BASE_URL}/cloud-files-service/v1/files/metadata?bucket=${R}&key=${encodeURIComponent(x)}`,{headers:{Authorization:`Bearer ${await f.getAccessToken()}`}})).data;return{value:K.Success,error:null,result:{uri:O.uri,name:O.name,key:O.key,size:O.size,mimeType:O.mimeType,access:O.access,lastModified:O.lastModified}}}catch(f){return{value:K.UnhandledError,error:f,result:null}}}})}}class J1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_LIST_FILES,version:"1.0.0",description:"Cloud File System: List Files",initPriority:_e.High,permissions:[$e.All],contexts:[te.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===te.Logic);if(!n)return;const s=n.get(Ye.ListFiles);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"listFiles"),b="["+Ve(t,t.project,"List files")+": `"+T+"`] ",R=n.find(ae=>{var le,oe;return((oe=(le=ae.valueOwner)==null?void 0:le.declaration)==null?void 0:oe.id)===G.operation[Ye.ListFiles].inputs.bucket.id}),I=(s=R==null?void 0:R.value)==null?void 0:s.valueAsType;if(!I||!I.id||!I.name||I.type!==r.DefinitionEntity)throw new Error(`${b}Invalid input "${Ve(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"Storage")}" (\`${Be(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const A=ul(I==null?void 0:I.id,((u=m.branchHead)==null?void 0:u.identifier)||"main");if(!((m==null?void 0:m.liveResources)||[]).find(ae=>ae.resourceId===A))throw new Error(`${b}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const P=n.find(ae=>{var le,oe;return((oe=(le=ae.valueOwner)==null?void 0:le.declaration)==null?void 0:oe.id)===G.operation[Ye.ListFiles].inputs.path.id}),O=(e=P==null?void 0:P.value)==null?void 0:e.value;if(O!==void 0&&typeof O!="string")throw new Error(`${b}The "${Ve(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"Path")}" (\`${Be(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"path")}\`) input value is invalid, if present, it must be a string.`);const $=n.find(ae=>{var le,oe;return((oe=(le=ae.valueOwner)==null?void 0:le.declaration)==null?void 0:oe.id)===G.operation[Ye.ListFiles].inputs.maxKeys.id}),U=(f=$==null?void 0:$.value)==null?void 0:f.value;if(U!==void 0&&(typeof U!="number"||U<=0))throw new Error(`${b}The "${Ve($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"Max results")}" (\`${Be($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"maxKeys")}\`) input value is invalid, if present, it must be a number greater than 0.`);const Z=n.find(ae=>{var le,oe;return((oe=(le=ae.valueOwner)==null?void 0:le.declaration)==null?void 0:oe.id)===G.operation[Ye.ListFiles].inputs.startAfter.id}),j=(y=Z==null?void 0:Z.value)==null?void 0:y.value;if(j!==void 0&&(typeof j!="string"||j===""))throw new Error(`${b}The "${Ve(Z==null?void 0:Z.valueOwner,m==null?void 0:m.logic,"Start after")}" (\`${Be(Z==null?void 0:Z.valueOwner,m==null?void 0:m.logic,"startAfter")}\`) input value is invalid, if present, it must be a non-empty string.`);let H=`${m.env.API_BASE_URL}/cloud-files-service/v1/files?bucket=${A}`;O&&(H+=`&path=${encodeURIComponent(O)}`),U&&(H+=`&maxKeys=${U}`),j&&(H+=`&startAfter=${encodeURIComponent(j)}`);const Y=await Ht.get(H,{headers:{Authorization:`Bearer ${await m.getAccessToken()}`}}),ie=ae=>{var be;if(!ae)return"application/octet-stream";const le=ae.split(".");if(le.length<=1)return"application/octet-stream";const oe=(be=le.pop())==null?void 0:be.toLowerCase();return oe&&{png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",svg:"image/svg+xml",pdf:"application/pdf",txt:"text/plain",html:"text/html",css:"text/css",js:"application/javascript",json:"application/json",csv:"text/csv",xml:"application/xml",zip:"application/zip",mp3:"audio/mpeg",mp4:"video/mp4",mov:"video/quicktime",wav:"audio/wav"}[oe]||"application/octet-stream"},z=(Y.data.items||Y.data.files||[]).map(ae=>({uri:ae.uri||ae.url||`${m.env.API_BASE_URL}/cloud-files-service/v1/files/download?bucket=${A}&key=${encodeURIComponent(ae.key)}`,name:ae.name,key:ae.key,mimeType:ae.mimeType||ie(ae.key),size:ae.size||0,lastModified:ae.lastModified,access:ae.access})),J=Y.data.total!==void 0?Y.data.total:z.length,ee=Y.data.size!==void 0?Y.data.size:z.reduce((ae,le)=>ae+(le.size||0),0),Q=Y.data.nextStartAfter!==void 0?Y.data.nextStartAfter:null,re=Y.data.hasMore!==void 0?Y.data.hasMore:!1;return{value:K.Success,error:null,result:{items:z,total:J,size:ee,nextStartAfter:Q,hasMore:re}}}catch(m){return{value:K.UnhandledError,error:m,result:null}}}})}}class Q1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_DELETE_FILES,version:"1.0.0",description:"Cloud File System: Delete Files",initPriority:_e.High,permissions:[$e.All],contexts:[te.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===te.Logic);if(!n)return;const s=n.get(Ye.DeleteFiles);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e;try{const f=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!f||!f.env)throw new Error("Editor context or environment missing");const y=Be(t,t.project,"deleteFiles"),T="["+Ve(t,t.project,"Delete files")+": `"+y+"`] ",g=n.find(U=>{var Z,j;return((j=(Z=U.valueOwner)==null?void 0:Z.declaration)==null?void 0:j.id)===G.operation[Ye.DeleteFiles].inputs.bucket.id}),b=(s=g==null?void 0:g.value)==null?void 0:s.valueAsType;if(!b||!b.id||!b.name||b.type!==r.DefinitionEntity)throw new Error(`${T}Invalid input "${Ve(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"Storage")}" (\`${Be(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const R=ul(b==null?void 0:b.id,((u=f.branchHead)==null?void 0:u.identifier)||"main");if(!((f==null?void 0:f.liveResources)||[]).find(U=>U.resourceId===R))throw new Error(`${T}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const A=n.find(U=>{var Z,j;return((j=(Z=U.valueOwner)==null?void 0:Z.declaration)==null?void 0:j.id)===G.operation[Ye.DeleteFiles].inputs.keys.id}),x=(e=A==null?void 0:A.value)==null?void 0:e.value,P=Array.isArray(x)?x:typeof x=="string"&&x!==""?[x]:[];if(!P||P.length===0)throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Keys")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"keys")}\`) input is missing.`);if(!Array.isArray(P)||P.some(U=>typeof U!="string"||U===""))throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Keys")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"keys")}\`) input value is invalid, if present, it must be a list of non-empty strings.`);const $=(await Ht.delete(`${f.env.API_BASE_URL}/cloud-files-service/v1/files`,{headers:{Authorization:`Bearer ${await f.getAccessToken()}`},data:{bucket:R,keys:P}})).data;return{value:K.Success,error:null,result:null}}catch(f){return{value:K.UnhandledError,error:f,result:null}}}})}}class X1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_COPY_FILE,version:"1.0.0",description:"Cloud File System: Copy File",initPriority:_e.High,permissions:[$e.All],contexts:[te.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===te.Logic);if(!n)return;const s=n.get(Ye.CopyFile);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=Be(t,t.project,"copyFile"),R="["+Ve(t,t.project,"Copy file")+": `"+g+"`] ",I=n.find(ee=>{var Q,re;return((re=(Q=ee.valueOwner)==null?void 0:Q.declaration)==null?void 0:re.id)===G.operation[Ye.CopyFile].inputs.bucket.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${R}Invalid input "${Ve(I==null?void 0:I.valueOwner,T==null?void 0:T.logic,"Storage")}" (\`${Be(I==null?void 0:I.valueOwner,T==null?void 0:T.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const x=ul(A==null?void 0:A.id,((u=T.branchHead)==null?void 0:u.identifier)||"main");if(!((T==null?void 0:T.liveResources)||[]).find(ee=>ee.resourceId===x))throw new Error(`${R}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const O=n.find(ee=>{var Q,re;return((re=(Q=ee.valueOwner)==null?void 0:Q.declaration)==null?void 0:re.id)===G.operation[Ye.CopyFile].inputs.sourceKey.id}),$=(e=O==null?void 0:O.value)==null?void 0:e.value;if(!$||$==="")throw new Error(`${R}The "${Ve(O==null?void 0:O.valueOwner,T==null?void 0:T.logic,"Source key")}" (\`${Be(O==null?void 0:O.valueOwner,T==null?void 0:T.logic,"sourceKey")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${R}The "${Ve(O==null?void 0:O.valueOwner,T==null?void 0:T.logic,"Source key")}" (\`${Be(O==null?void 0:O.valueOwner,T==null?void 0:T.logic,"sourceKey")}\`) input value is invalid, if present, it must be a non-empty string.`);const U=n.find(ee=>{var Q,re;return((re=(Q=ee.valueOwner)==null?void 0:Q.declaration)==null?void 0:re.id)===G.operation[Ye.CopyFile].inputs.destinationKey.id}),Z=(f=U==null?void 0:U.value)==null?void 0:f.value;if(!Z||Z==="")throw new Error(`${R}The "${Ve(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"Destination key")}" (\`${Be(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"destinationKey")}\`) input is missing.`);if(typeof Z!="string")throw new Error(`${R}The "${Ve(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"Destination key")}" (\`${Be(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"destinationKey")}\`) input value is invalid, if present, it must be a non-empty string.`);const j=n.find(ee=>{var Q,re;return((re=(Q=ee.valueOwner)==null?void 0:Q.declaration)==null?void 0:re.id)===G.operation[Ye.CopyFile].inputs.destinationBucket.id}),H=(y=j==null?void 0:j.value)==null?void 0:y.valueAsType;if(H&&(!H.id||!H.name||H.type!==r.DefinitionEntity))throw new Error(`${R}Invalid input "${Ve(j==null?void 0:j.valueOwner,T==null?void 0:T.logic,"Destination Storage")}" (\`${Be(j==null?void 0:j.valueOwner,T==null?void 0:T.logic,"destinationBucket")}\`), expected a valid "Cloud file system" node.`);const Y=H!=null&&H.id?ul(H.id,((m=T.branchHead)==null?void 0:m.identifier)||"main"):x;if(!((T==null?void 0:T.liveResources)||[]).find(ee=>ee.resourceId===Y))throw new Error(`${R}The destination "Cloud file system" is not live. Publish the project first, then try again to run the operation node.`);const W={headers:{Authorization:`Bearer ${await T.getAccessToken()}`}},J=(await Ht.post(`${T.env.API_BASE_URL}/cloud-files-service/v1/files/copy`,{bucket:x,destinationBucket:Y,sourceKey:$,destinationKey:Z},W)).data;return{value:K.Success,error:null,result:null}}catch(T){return{value:K.UnhandledError,error:T,result:null}}}})}}class eDt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_MOVE_FILE,version:"1.0.0",description:"Cloud File System: Move File",initPriority:_e.High,permissions:[$e.All],contexts:[te.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===te.Logic);if(!n)return;const s=n.get(Ye.MoveFile);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f,y,m;try{const T=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const g=Be(t,t.project,"moveFile"),R="["+Ve(t,t.project,"Move file")+": `"+g+"`] ",I=n.find(ee=>{var Q,re;return((re=(Q=ee.valueOwner)==null?void 0:Q.declaration)==null?void 0:re.id)===G.operation[Ye.MoveFile].inputs.bucket.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${R}Invalid input "${Ve(I==null?void 0:I.valueOwner,T==null?void 0:T.logic,"Storage")}" (\`${Be(I==null?void 0:I.valueOwner,T==null?void 0:T.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const x=ul(A==null?void 0:A.id,((u=T.branchHead)==null?void 0:u.identifier)||"main");if(!((T==null?void 0:T.liveResources)||[]).find(ee=>ee.resourceId===x))throw new Error(`${R}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const O=n.find(ee=>{var Q,re;return((re=(Q=ee.valueOwner)==null?void 0:Q.declaration)==null?void 0:re.id)===G.operation[Ye.MoveFile].inputs.sourceKey.id}),$=(e=O==null?void 0:O.value)==null?void 0:e.value;if(!$||$==="")throw new Error(`${R}The "${Ve(O==null?void 0:O.valueOwner,T==null?void 0:T.logic,"Source key")}" (\`${Be(O==null?void 0:O.valueOwner,T==null?void 0:T.logic,"sourceKey")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${R}The "${Ve(O==null?void 0:O.valueOwner,T==null?void 0:T.logic,"Source key")}" (\`${Be(O==null?void 0:O.valueOwner,T==null?void 0:T.logic,"sourceKey")}\`) input value is invalid, if present, it must be a non-empty string.`);const U=n.find(ee=>{var Q,re;return((re=(Q=ee.valueOwner)==null?void 0:Q.declaration)==null?void 0:re.id)===G.operation[Ye.MoveFile].inputs.destinationKey.id}),Z=(f=U==null?void 0:U.value)==null?void 0:f.value;if(!Z||Z==="")throw new Error(`${R}The "${Ve(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"Destination key")}" (\`${Be(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"destinationKey")}\`) input is missing.`);if(typeof Z!="string")throw new Error(`${R}The "${Ve(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"Destination key")}" (\`${Be(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"destinationKey")}\`) input value is invalid, if present, it must be a non-empty string.`);const j=n.find(ee=>{var Q,re;return((re=(Q=ee.valueOwner)==null?void 0:Q.declaration)==null?void 0:re.id)===G.operation[Ye.MoveFile].inputs.destinationBucket.id}),H=(y=j==null?void 0:j.value)==null?void 0:y.valueAsType;if(H&&(!H.id||!H.name||H.type!==r.DefinitionEntity))throw new Error(`${R}Invalid input "${Ve(j==null?void 0:j.valueOwner,T==null?void 0:T.logic,"Destination storage")}" (\`${Be(j==null?void 0:j.valueOwner,T==null?void 0:T.logic,"destinationBucket")}\`), expected a valid "Cloud file system" node.`);const Y=H!=null&&H.id?ul(H.id,((m=T.branchHead)==null?void 0:m.identifier)||"main"):x;if(!((T==null?void 0:T.liveResources)||[]).find(ee=>ee.resourceId===Y))throw new Error(`${R}The destination "Cloud file system" is not live. Publish the project first, then try again to run the operation node.`);const W={headers:{Authorization:`Bearer ${await T.getAccessToken()}`}},J=(await Ht.post(`${T.env.API_BASE_URL}/cloud-files-service/v1/files/move`,{bucket:x,destinationBucket:Y,sourceKey:$,destinationKey:Z},W)).data;return{value:K.Success,error:null,result:null}}catch(T){return{value:K.UnhandledError,error:T,result:null}}}})}}class tDt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_RENAME_FILE,version:"1.0.0",description:"Cloud File System: Rename File",initPriority:_e.High,permissions:[$e.All],contexts:[te.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===te.Logic);if(!n)return;const s=n.get(Ye.RenameFile);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f;try{const y=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!y||!y.env)throw new Error("Editor context or environment missing");const m=Be(t,t.project,"renameFile"),g="["+Ve(t,t.project,"Rename file")+": `"+m+"`] ",b=n.find(ie=>{var W,z;return((z=(W=ie.valueOwner)==null?void 0:W.declaration)==null?void 0:z.id)===G.operation[Ye.RenameFile].inputs.bucket.id}),R=(s=b==null?void 0:b.value)==null?void 0:s.valueAsType;if(!R||!R.id||!R.name||R.type!==r.DefinitionEntity)throw new Error(`${g}Invalid input "${Ve(b==null?void 0:b.valueOwner,y==null?void 0:y.logic,"Storage")}" (\`${Be(b==null?void 0:b.valueOwner,y==null?void 0:y.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const I=ul(R==null?void 0:R.id,((u=y.branchHead)==null?void 0:u.identifier)||"main");if(!((y==null?void 0:y.liveResources)||[]).find(ie=>ie.resourceId===I))throw new Error(`${g}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const x=n.find(ie=>{var W,z;return((z=(W=ie.valueOwner)==null?void 0:W.declaration)==null?void 0:z.id)===G.operation[Ye.RenameFile].inputs.key.id}),P=(e=x==null?void 0:x.value)==null?void 0:e.value;if(!P||P==="")throw new Error(`${g}The "${Ve(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"Key")}" (\`${Be(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"key")}\`) input is missing.`);if(typeof P!="string")throw new Error(`${g}The "${Ve(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"Key")}" (\`${Be(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const O=n.find(ie=>{var W,z;return((z=(W=ie.valueOwner)==null?void 0:W.declaration)==null?void 0:z.id)===G.operation[Ye.RenameFile].inputs.newName.id}),$=(f=O==null?void 0:O.value)==null?void 0:f.value;if(!$||$==="")throw new Error(`${g}The "${Ve(O==null?void 0:O.valueOwner,y==null?void 0:y.logic,"New name")}" (\`${Be(O==null?void 0:O.valueOwner,y==null?void 0:y.logic,"newName")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${g}The "${Ve(O==null?void 0:O.valueOwner,y==null?void 0:y.logic,"New name")}" (\`${Be(O==null?void 0:O.valueOwner,y==null?void 0:y.logic,"newName")}\`) input value is invalid, if present, it must be a non-empty string.`);const U=P.lastIndexOf("/"),j=`${U!==-1?P.substring(0,U+1):""}${$}`,H={headers:{Authorization:`Bearer ${await y.getAccessToken()}`}},Y=await Ht.post(`${y.env.API_BASE_URL}/cloud-files-service/v1/files/rename`,{bucket:I,key:P,newName:$},H);return{value:K.Success,error:null,result:Y.data||{key:P,newName:$,destinationKey:j}}}catch(y){return{value:K.UnhandledError,error:y,result:null}}}})}}class iDt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_GET_FILE_METADATA,version:"1.0.0",description:"Cloud File System: Get File Metadata",initPriority:_e.High,permissions:[$e.All],contexts:[te.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===te.Logic);if(!n)return;const s=n.get(Ye.GetFileMetadata);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e;try{const f=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!f||!f.env)throw new Error("Editor context or environment missing");const y=Be(t,t.project,"getFileMetadata"),T="["+Ve(t,t.project,"Get file metadata")+": `"+y+"`] ",g=n.find(O=>{var $,U;return((U=($=O.valueOwner)==null?void 0:$.declaration)==null?void 0:U.id)===G.operation[Ye.GetFileMetadata].inputs.bucket.id}),b=(s=g==null?void 0:g.value)==null?void 0:s.valueAsType;if(!b||!b.id||!b.name||b.type!==r.DefinitionEntity)throw new Error(`${T}Invalid input "${Ve(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"Storage")}" (\`${Be(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const R=ul(b==null?void 0:b.id,((u=f.branchHead)==null?void 0:u.identifier)||"main");if(!((f==null?void 0:f.liveResources)||[]).find(O=>O.resourceId===R))throw new Error(`${T}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const A=n.find(O=>{var $,U;return((U=($=O.valueOwner)==null?void 0:$.declaration)==null?void 0:U.id)===G.operation[Ye.GetFileMetadata].inputs.key.id}),x=(e=A==null?void 0:A.value)==null?void 0:e.value;if(!x||x==="")throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"key")}\`) input is missing.`);if(typeof x!="string")throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const P=await Ht.get(`${f.env.API_BASE_URL}/cloud-files-service/v1/files/metadata?bucket=${R}&key=${encodeURIComponent(x)}`,{headers:{Authorization:`Bearer ${await f.getAccessToken()}`}});return{value:K.Success,error:null,result:P.data}}catch(f){return{value:K.UnhandledError,error:f,result:null}}}})}}class nDt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_CHECK_FILE_EXISTS,version:"1.0.0",description:"Cloud File System: Check File Exists",initPriority:_e.High,permissions:[$e.All],contexts:[te.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===te.Logic);if(!n)return;const s=n.get(Ye.CheckFileExists);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e;try{const f=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!f||!f.env)throw new Error("Editor context or environment missing");const y=Be(t,t.project,"checkFileExists"),T="["+Ve(t,t.project,"Check File Exists")+": `"+y+"`] ",g=n.find(O=>{var $,U;return((U=($=O.valueOwner)==null?void 0:$.declaration)==null?void 0:U.id)===G.operation[Ye.CheckFileExists].inputs.bucket.id}),b=(s=g==null?void 0:g.value)==null?void 0:s.valueAsType;if(!b||!b.id||!b.name||b.type!==r.DefinitionEntity)throw new Error(`${T}Invalid input "${Ve(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"Storage")}" (\`${Be(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const R=ul(b==null?void 0:b.id,((u=f.branchHead)==null?void 0:u.identifier)||"main");if(!((f==null?void 0:f.liveResources)||[]).find(O=>O.resourceId===R))throw new Error(`${T}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const A=n.find(O=>{var $,U;return((U=($=O.valueOwner)==null?void 0:$.declaration)==null?void 0:U.id)===G.operation[Ye.CheckFileExists].inputs.key.id}),x=(e=A==null?void 0:A.value)==null?void 0:e.value;if(!x||x==="")throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"key")}\`) input is missing.`);if(typeof x!="string")throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const P=await Ht.get(`${f.env.API_BASE_URL}/cloud-files-service/v1/files/exists?bucket=${R}&key=${encodeURIComponent(x)}`,{headers:{Authorization:`Bearer ${await f.getAccessToken()}`}});return{value:K.Success,error:null,result:P.data.exists}}catch(f){return{value:K.UnhandledError,error:f,result:!1}}}})}}class rDt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_GET_PRESIGNED_URL,version:"1.0.0",description:"Cloud File System: Get Pre-signed URL",initPriority:_e.High,permissions:[$e.All],contexts:[te.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===te.Logic);if(!n)return;const s=n.get(Ye.GetPresignedUrl);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"getPresignedUrl"),b="["+Ve(t,t.project,"Get pre-signed URL")+": `"+T+"`] ",R=n.find(z=>{var J,ee;return((ee=(J=z.valueOwner)==null?void 0:J.declaration)==null?void 0:ee.id)===G.operation[Ye.GetPresignedUrl].inputs.bucket.id}),I=(s=R==null?void 0:R.value)==null?void 0:s.valueAsType;if(!I||!I.id||!I.name||I.type!==r.DefinitionEntity)throw new Error(`${b}Invalid input "${Ve(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"Storage")}" (\`${Be(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const A=ul(I==null?void 0:I.id,((u=m.branchHead)==null?void 0:u.identifier)||"main");if(!((m==null?void 0:m.liveResources)||[]).find(z=>z.resourceId===A))throw new Error(`${b}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const P=n.find(z=>{var J,ee;return((ee=(J=z.valueOwner)==null?void 0:J.declaration)==null?void 0:ee.id)===G.operation[Ye.GetPresignedUrl].inputs.key.id}),O=(e=P==null?void 0:P.value)==null?void 0:e.value;if(!O||O==="")throw new Error(`${b}The "${Ve(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"key")}\`) input is missing.`);if(typeof O!="string")throw new Error(`${b}The "${Ve(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const $=n.find(z=>{var J,ee;return((ee=(J=z.valueOwner)==null?void 0:J.declaration)==null?void 0:ee.id)===G.operation[Ye.GetPresignedUrl].inputs.action.id}),U=(f=$==null?void 0:$.value)==null?void 0:f.value,Z=(U||"read").toLowerCase(),j=["read","write","delete","metadata","upload","putobject","head","headobject","getobject","get"];if(!U||U==="")throw new Error(`${b}The "${Ve($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"Action")}" (\`${Be($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"action")}\`) input is missing.`);if(!j.includes(Z))throw new Error(`${b}Invalid "${Ve($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"Action")}" (\`${Be($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"action")}\`) input value, must be one of "read", "write", "delete" or "metadata".`);const H=n.find(z=>{var J,ee;return((ee=(J=z.valueOwner)==null?void 0:J.declaration)==null?void 0:ee.id)===G.operation[Ye.GetPresignedUrl].inputs.expiresInSeconds.id}),Y=(y=H==null?void 0:H.value)==null?void 0:y.value,ie=Y!=null?Number(Y):3600;if(isNaN(ie)||ie<=0)throw new Error(`${b}Invalid "${Ve(H==null?void 0:H.valueOwner,m==null?void 0:m.logic,"Expires in seconds")}" (\`${Be(H==null?void 0:H.valueOwner,m==null?void 0:m.logic,"expiresInSeconds")}\`) input value, expected a positive number.`);const W=await Ht.get(`${m.env.API_BASE_URL}/cloud-files-service/v1/files/presigned-url?bucket=${A}&key=${encodeURIComponent(O)}&action=${Z}&expiresInSeconds=${ie}`,{headers:{Authorization:`Bearer ${await m.getAccessToken()}`}});return{value:K.Success,error:null,result:W.data}}catch(m){return{value:K.UnhandledError,error:m,result:null}}}})}}class aDt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_SET_FILE_ACCESS,version:"1.0.0",description:"Cloud File System: Set File Access",initPriority:_e.High,permissions:[$e.All],contexts:[te.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===te.Logic);if(!n)return;const s=n.get(Ye.SetFileAccess);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f;try{const y=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!y||!y.env)throw new Error("Editor context or environment missing");const m=Be(t,t.project,"setFileAccess"),g="["+Ve(t,t.project,"Set file access")+": `"+m+"`] ",b=n.find(U=>{var Z,j;return((j=(Z=U.valueOwner)==null?void 0:Z.declaration)==null?void 0:j.id)===G.operation[Ye.SetFileAccess].inputs.bucket.id}),R=(s=b==null?void 0:b.value)==null?void 0:s.valueAsType;if(!R||!R.id||!R.name||R.type!==r.DefinitionEntity)throw new Error(`${g}Invalid input "${Ve(b==null?void 0:b.valueOwner,y==null?void 0:y.logic,"Storage")}" (\`${Be(b==null?void 0:b.valueOwner,y==null?void 0:y.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const I=ul(R==null?void 0:R.id,((u=y.branchHead)==null?void 0:u.identifier)||"main");if(!((y==null?void 0:y.liveResources)||[]).find(U=>U.resourceId===I))throw new Error(`${g}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const x=n.find(U=>{var Z,j;return((j=(Z=U.valueOwner)==null?void 0:Z.declaration)==null?void 0:j.id)===G.operation[Ye.SetFileAccess].inputs.key.id}),P=(e=x==null?void 0:x.value)==null?void 0:e.value;if(!P||P==="")throw new Error(`${g}The "${Ve(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"Key")}" (\`${Be(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"key")}\`) input is missing.`);if(typeof P!="string")throw new Error(`${g}The "${Ve(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"Key")}" (\`${Be(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const O=n.find(U=>{var Z,j;return((j=(Z=U.valueOwner)==null?void 0:Z.declaration)==null?void 0:j.id)===G.operation[Ye.SetFileAccess].inputs.access.id}),$=((f=O==null?void 0:O.value)==null?void 0:f.value)??"private";if(!$||$==="")throw new Error(`${g}The "${Ve(O==null?void 0:O.valueOwner,y==null?void 0:y.logic,"Access")}" (\`${Be(O==null?void 0:O.valueOwner,y==null?void 0:y.logic,"access")}\`) input is missing.`);if(typeof $!="string"||!["public","private"].includes($))throw new Error(`${g}The "${Ve(O==null?void 0:O.valueOwner,y==null?void 0:y.logic,"Access")}" (\`${Be(O==null?void 0:O.valueOwner,y==null?void 0:y.logic,"access")}\`) input value is invalid, if present, it must be exactly the "public" or "private" text values.`);return await Ht.post(`${y.env.API_BASE_URL}/cloud-files-service/v1/files/access`,{bucket:I,key:P,access:$},{headers:{Authorization:`Bearer ${await y.getAccessToken()}`}}),{value:K.Success,error:null,result:null}}catch(y){return{value:K.UnhandledError,error:y,result:null}}}})}}class sDt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_CREATE_FOLDER,version:"1.0.0",description:"Cloud File System: Create Folder",initPriority:_e.High,permissions:[$e.All],contexts:[te.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===te.Logic);if(!n)return;const s=n.get(Ye.CreateFolder);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e;try{const f=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!f||!f.env)throw new Error("Editor context or environment missing");const y=Be(t,t.project,"createFolder"),T="["+Ve(t,t.project,"Create folder")+": `"+y+"`] ",g=n.find($=>{var U,Z;return((Z=(U=$.valueOwner)==null?void 0:U.declaration)==null?void 0:Z.id)===G.operation[Ye.CreateFolder].inputs.bucket.id}),b=(s=g==null?void 0:g.value)==null?void 0:s.valueAsType;if(!b||!b.id||!b.name||b.type!==r.DefinitionEntity)throw new Error(`${T}Invalid input "${Ve(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"Storage")}" (\`${Be(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const R=ul(b==null?void 0:b.id,((u=f.branchHead)==null?void 0:u.identifier)||"main");if(!((f==null?void 0:f.liveResources)||[]).find($=>$.resourceId===R))throw new Error(`${T}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const A=n.find($=>{var U,Z;return((Z=(U=$.valueOwner)==null?void 0:U.declaration)==null?void 0:Z.id)===G.operation[Ye.CreateFolder].inputs.folderPath.id}),x=(e=A==null?void 0:A.value)==null?void 0:e.value;if(!x||x==="")throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Folder path")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"folderPath")}\`) input is missing.`);if(typeof x!="string")throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Folder path")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"folderPath")}\`) input value is invalid, if present, it must be a non-empty string.`);const O=(await Ht.post(`${f.env.API_BASE_URL}/cloud-files-service/v1/files/folders`,{bucket:R,folderPath:x},{headers:{Authorization:`Bearer ${await f.getAccessToken()}`}})).data;return{value:K.Success,error:null,result:null}}catch(f){return{value:K.UnhandledError,error:f,result:null}}}})}}class lDt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_DELETE_FOLDERS,version:"1.0.0",description:"Cloud File System: Delete Folders",initPriority:_e.High,permissions:[$e.All],contexts:[te.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===te.Logic);if(!n)return;const s=n.get(Ye.DeleteFolders);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e;try{const f=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!f||!f.env)throw new Error("Editor context or environment missing");const y=Be(t,t.project,"deleteFolders"),T="["+Ve(t,t.project,"Delete folders")+": `"+y+"`] ",g=n.find(U=>{var Z,j;return((j=(Z=U.valueOwner)==null?void 0:Z.declaration)==null?void 0:j.id)===G.operation[Ye.DeleteFolders].inputs.bucket.id}),b=(s=g==null?void 0:g.value)==null?void 0:s.valueAsType;if(!b||!b.id||!b.name||b.type!==r.DefinitionEntity)throw new Error(`${T}Invalid input "${Ve(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"Storage")}" (\`${Be(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const R=ul(b==null?void 0:b.id,((u=f.branchHead)==null?void 0:u.identifier)||"main");if(!((f==null?void 0:f.liveResources)||[]).find(U=>U.resourceId===R))throw new Error(`${T}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const A=n.find(U=>{var Z,j;return((j=(Z=U.valueOwner)==null?void 0:Z.declaration)==null?void 0:j.id)===G.operation[Ye.DeleteFolders].inputs.folderPaths.id}),x=(e=A==null?void 0:A.value)==null?void 0:e.value,P=Array.isArray(x)?x:typeof x=="string"&&x!==""?[x]:[];if(!P||P.length===0)throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Folder paths")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"folderPaths")}\`) input is missing.`);if(!Array.isArray(P)||P.some(U=>typeof U!="string"||U===""))throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Folder paths")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"folderPaths")}\`) input value is invalid, if present, it must be a list of non-empty strings.`);const $=(await Ht.delete(`${f.env.API_BASE_URL}/cloud-files-service/v1/files/folders`,{headers:{Authorization:`Bearer ${await f.getAccessToken()}`},data:{bucket:R,folderPaths:P}})).data;return{value:K.Success,error:null,result:null}}catch(f){return{value:K.UnhandledError,error:f,result:null}}}})}}class oDt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_CREATE_MULTIPART_UPLOAD,version:"1.0.0",description:"Cloud File System: Create Multipart Upload",initPriority:_e.High,permissions:[$e.All],contexts:[te.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===te.Logic);if(!n)return;const s=n.get(Ye.CreateMultipartUpload);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"createMultipartUpload"),b="["+Ve(t,t.project,"Create multipart upload")+": `"+T+"`] ",R=n.find(Z=>{var j,H;return((H=(j=Z.valueOwner)==null?void 0:j.declaration)==null?void 0:H.id)===G.operation[Ye.CreateMultipartUpload].inputs.bucket.id}),I=(s=R==null?void 0:R.value)==null?void 0:s.valueAsType;if(!I||!I.id||!I.name||I.type!==r.DefinitionEntity)throw new Error(`${b}Invalid input "${Ve(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"Storage")}" (\`${Be(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const A=ul(I==null?void 0:I.id,((u=m.branchHead)==null?void 0:u.identifier)||"main"),x=n.find(Z=>{var j,H;return((H=(j=Z.valueOwner)==null?void 0:j.declaration)==null?void 0:H.id)===G.operation[Ye.CreateMultipartUpload].inputs.key.id}),P=(e=x==null?void 0:x.value)==null?void 0:e.value;if(!P||P==="")throw new Error(`${b}The "${Ve(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"key")}\`) input is missing.`);if(typeof P!="string")throw new Error(`${b}The "${Ve(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const O=n.find(Z=>{var j,H;return((H=(j=Z.valueOwner)==null?void 0:j.declaration)==null?void 0:H.id)===G.operation[Ye.CreateMultipartUpload].inputs.contentType.id}),$=((f=O==null?void 0:O.value)==null?void 0:f.value)||"application/octet-stream";if(!$||$==="")throw new Error(`${b}The "${Ve(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"Content Type")}" (\`${Be(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"contentType")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${b}The "${Ve(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"Content Type")}" (\`${Be(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"contentType")}\`) input value is invalid, if present, it must be a non-empty string.`);const U=await Ht.post(`${m.env.API_BASE_URL}/cloud-files-service/v1/files/multipart?bucket=${A}&key=${encodeURIComponent(P)}&contentType=${encodeURIComponent($)}`,{},{headers:{Authorization:`Bearer ${await m.getAccessToken()}`}});return{value:K.Success,error:null,result:{uploadId:typeof U.data=="object"&&((y=U.data)!=null&&y.uploadId)?U.data.uploadId:U.data}}}catch(m){return{value:K.UnhandledError,error:m,result:null}}}})}}class dDt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_GET_UPLOAD_PART_PRESIGNED_URL,version:"1.0.0",description:"Cloud File System: Get Upload Part Pre-signed URL",initPriority:_e.High,permissions:[$e.All],contexts:[te.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===te.Logic);if(!n)return;const s=n.get(Ye.GetUploadPartPresignedUrl);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"getUploadPartPresignedUrl"),b="["+Ve(t,t.project,"Get upload part pre-signed URL")+": `"+T+"`] ",R=n.find(H=>{var Y,ie;return((ie=(Y=H.valueOwner)==null?void 0:Y.declaration)==null?void 0:ie.id)===G.operation[Ye.GetUploadPartPresignedUrl].inputs.bucket.id}),I=(s=R==null?void 0:R.value)==null?void 0:s.valueAsType;if(!I||!I.id||!I.name||I.type!==r.DefinitionEntity)throw new Error(`${b}${b}Invalid input "${Ve(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"Storage")}" (\`${Be(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const A=ul(I==null?void 0:I.id,((u=m.branchHead)==null?void 0:u.identifier)||"main"),x=n.find(H=>{var Y,ie;return((ie=(Y=H.valueOwner)==null?void 0:Y.declaration)==null?void 0:ie.id)===G.operation[Ye.GetUploadPartPresignedUrl].inputs.key.id}),P=(e=x==null?void 0:x.value)==null?void 0:e.value;if(!P||P==="")throw new Error(`${b}The "${Ve(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"key")}\`) input is missing.`);if(typeof P!="string")throw new Error(`${b}The "${Ve(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const O=n.find(H=>{var Y,ie;return((ie=(Y=H.valueOwner)==null?void 0:Y.declaration)==null?void 0:ie.id)===G.operation[Ye.GetUploadPartPresignedUrl].inputs.uploadId.id}),$=(f=O==null?void 0:O.value)==null?void 0:f.value;if(!$||$==="")throw new Error(`${b}The "${Ve(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"Upload ID")}" (\`${Be(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"uploadId")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${b}The "${Ve(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"Upload ID")}" (\`${Be(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"uploadId")}\`) input value is invalid, if present, it must be a non-empty string.`);const U=n.find(H=>{var Y,ie;return((ie=(Y=H.valueOwner)==null?void 0:Y.declaration)==null?void 0:ie.id)===G.operation[Ye.GetUploadPartPresignedUrl].inputs.partNumber.id}),Z=Number((y=U==null?void 0:U.value)==null?void 0:y.value);if(isNaN(Z)||Z<=0)throw new Error(`${b}The "${Ve(U==null?void 0:U.valueOwner,m==null?void 0:m.logic,"Part number")}" (\`${Be(U==null?void 0:U.valueOwner,m==null?void 0:m.logic,"partNumber")}\`) input is missing or invalid.`);const j=await Ht.get(`${m.env.API_BASE_URL}/cloud-files-service/v1/files/multipart/${$}?bucket=${A}&key=${encodeURIComponent(P)}&partNumber=${Z}`,{headers:{Authorization:`Bearer ${await m.getAccessToken()}`}});return{value:K.Success,error:null,result:j.data}}catch(m){return{value:K.UnhandledError,error:m,result:null}}}})}}class pDt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_COMPLETE_MULTIPART_UPLOAD,version:"1.0.0",description:"Cloud File System: Complete Multipart Upload",initPriority:_e.High,permissions:[$e.All],contexts:[te.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===te.Logic);if(!n)return;const s=n.get(Ye.CompleteMultipartUpload);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"completeMultipartUpload"),b="["+Ve(t,t.project,"Complete multipart upload")+": `"+T+"`] ",R=n.find(Y=>{var ie,W;return((W=(ie=Y.valueOwner)==null?void 0:ie.declaration)==null?void 0:W.id)===G.operation[Ye.CompleteMultipartUpload].inputs.bucket.id}),I=(s=R==null?void 0:R.value)==null?void 0:s.valueAsType;if(!I||!I.id||!I.name||I.type!==r.DefinitionEntity)throw new Error(`${b}Invalid input "${Ve(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"Storage")}" (\`${Be(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const A=ul(I==null?void 0:I.id,((u=m.branchHead)==null?void 0:u.identifier)||"main"),x=n.find(Y=>{var ie,W;return((W=(ie=Y.valueOwner)==null?void 0:ie.declaration)==null?void 0:W.id)===G.operation[Ye.CompleteMultipartUpload].inputs.key.id}),P=(e=x==null?void 0:x.value)==null?void 0:e.value;if(!P||P==="")throw new Error(`${b}The "${Ve(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"key")}\`) input is missing.`);if(typeof P!="string")throw new Error(`${b}The "${Ve(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const O=n.find(Y=>{var ie,W;return((W=(ie=Y.valueOwner)==null?void 0:ie.declaration)==null?void 0:W.id)===G.operation[Ye.CompleteMultipartUpload].inputs.uploadId.id}),$=(f=O==null?void 0:O.value)==null?void 0:f.value;if(!$||$==="")throw new Error(`${b}The "${Ve(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"Upload ID")}" (\`${Be(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"uploadId")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${b}The "${Ve(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"Upload ID")}" (\`${Be(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"uploadId")}\`) input value is invalid, if present, it must be a non-empty string.`);const U=n.find(Y=>{var ie,W;return((W=(ie=Y.valueOwner)==null?void 0:ie.declaration)==null?void 0:W.id)===G.operation[Ye.CompleteMultipartUpload].inputs.parts.id}),Z=(y=U==null?void 0:U.value)==null?void 0:y.value;if(!Array.isArray(Z)||Z.length===0)throw new Error(`${b}The "${Ve(U==null?void 0:U.valueOwner,m==null?void 0:m.logic,"Parts")}" (\`${Be(U==null?void 0:U.valueOwner,m==null?void 0:m.logic,"parts")}\`) input is missing or empty.`);if(Z.some(Y=>{let ie=!1,W=!1;return(Y.partNumber&&Number(Y.partNumber)>0||Y.PartNumber&&Number(Y.PartNumber)>0)&&(ie=!0),(Y.etag&&typeof Y.etag=="string"||Y.ETag&&typeof Y.ETag=="string")&&(W=!0),!ie||!W}))throw new Error(`${b}The "${Ve(U==null?void 0:U.valueOwner,m==null?void 0:m.logic,"Parts")}" (\`${Be(U==null?void 0:U.valueOwner,m==null?void 0:m.logic,"parts")}\`) input value is invalid, if present, it must be an array of objects with "partNumber" and "etag" properties.`);const H=(await Ht.post(`${m.env.API_BASE_URL}/cloud-files-service/v1/files/multipart/${$}/complete?bucket=${A}&key=${encodeURIComponent(P)}`,{parts:Z},{headers:{Authorization:`Bearer ${await m.getAccessToken()}`}})).data||{};return{value:K.Success,error:null,result:{location:H.location||H.Location||P,key:H.key||H.Key||P,etag:H.etag||H.ETag||null}}}catch(m){return{value:K.UnhandledError,error:m,result:null}}}})}}class uDt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_ABORT_MULTIPART_UPLOAD,version:"1.0.0",description:"Cloud File System: Abort Multipart Upload",initPriority:_e.High,permissions:[$e.All],contexts:[te.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===te.Logic);if(!n)return;const s=n.get(Ye.AbortMultipartUpload);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f;try{const y=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!y||!y.env)throw new Error("Editor context or environment missing");const m=Be(t,t.project,"abortMultipartUpload"),g="["+Ve(t,t.project,"Abort multipart upload")+": `"+m+"`] ",b=n.find(Z=>{var j,H;return((H=(j=Z.valueOwner)==null?void 0:j.declaration)==null?void 0:H.id)===G.operation[Ye.AbortMultipartUpload].inputs.bucket.id}),R=(s=b==null?void 0:b.value)==null?void 0:s.valueAsType;if(!R||!R.id||!R.name||R.type!==r.DefinitionEntity)throw new Error(`${g}Invalid input "${Ve(b==null?void 0:b.valueOwner,y==null?void 0:y.logic,"Storage")}" (\`${Be(b==null?void 0:b.valueOwner,y==null?void 0:y.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const I=ul(R==null?void 0:R.id,((u=y.branchHead)==null?void 0:u.identifier)||"main"),A=n.find(Z=>{var j,H;return((H=(j=Z.valueOwner)==null?void 0:j.declaration)==null?void 0:H.id)===G.operation[Ye.AbortMultipartUpload].inputs.key.id}),x=(e=A==null?void 0:A.value)==null?void 0:e.value;if(!x||x==="")throw new Error(`${g}The "${Ve(A==null?void 0:A.valueOwner,y==null?void 0:y.logic,"Key")}" (\`${Be(A==null?void 0:A.valueOwner,y==null?void 0:y.logic,"key")}\`) input is missing.`);if(typeof x!="string")throw new Error(`${g}The "${Ve(A==null?void 0:A.valueOwner,y==null?void 0:y.logic,"Key")}" (\`${Be(A==null?void 0:A.valueOwner,y==null?void 0:y.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const P=n.find(Z=>{var j,H;return((H=(j=Z.valueOwner)==null?void 0:j.declaration)==null?void 0:H.id)===G.operation[Ye.AbortMultipartUpload].inputs.uploadId.id}),O=(f=P==null?void 0:P.value)==null?void 0:f.value;if(!O||O==="")throw new Error(`${g}The "${Ve(P==null?void 0:P.valueOwner,y==null?void 0:y.logic,"Upload ID")}" (\`${Be(P==null?void 0:P.valueOwner,y==null?void 0:y.logic,"uploadId")}\`) input is missing.`);if(typeof O!="string")throw new Error(`${g}The "${Ve(P==null?void 0:P.valueOwner,y==null?void 0:y.logic,"Upload ID")}" (\`${Be(P==null?void 0:P.valueOwner,y==null?void 0:y.logic,"uploadId")}\`) input value is invalid, if present, it must be a non-empty string.`);const U=(await Ht.delete(`${y.env.API_BASE_URL}/cloud-files-service/v1/files/multipart/${O}?bucket=${I}&key=${encodeURIComponent(x)}`,{headers:{Authorization:`Bearer ${await y.getAccessToken()}`}})).data;return{value:K.Success,error:null,result:null}}catch(y){return{value:K.UnhandledError,error:y,result:null}}}})}}class HRn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_UPLOAD_FILE_PART,version:"1.0.0",description:"Cloud File System: Upload File Part",initPriority:_e.High,permissions:[$e.All],contexts:[te.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===te.Logic);if(!n)return;const s=n.get(Ye.UploadFilePart);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b;try{const R=this.extensionsRegistry.requestContexts(this,[te.Editor])[0];if(!R||!R.env)throw new Error("Editor context or environment missing");const I=Be(t,t.project,"uploadFilePart"),x="["+Ve(t,t.project,"Upload file part")+": `"+I+"`] ",P=n.find(oe=>{var ce,be;return((be=(ce=oe.valueOwner)==null?void 0:ce.declaration)==null?void 0:be.id)===G.operation[Ye.UploadFilePart].inputs.bucket.id}),O=(s=P==null?void 0:P.value)==null?void 0:s.valueAsType;if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${x}Invalid input "${Ve(P==null?void 0:P.valueOwner,R==null?void 0:R.logic,"Storage")}" (\`${Be(P==null?void 0:P.valueOwner,R==null?void 0:R.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const $=ul(O==null?void 0:O.id,((u=R.branchHead)==null?void 0:u.identifier)||"main");if(!((R==null?void 0:R.liveResources)||[]).find(oe=>oe.resourceId===$))throw new Error(`${x}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const Z=n.find(oe=>{var ce,be;return((be=(ce=oe.valueOwner)==null?void 0:ce.declaration)==null?void 0:be.id)===G.operation[Ye.UploadFilePart].inputs.key.id}),j=(e=Z==null?void 0:Z.value)==null?void 0:e.value;if(!j||j==="")throw new Error(`${x}The "${Ve(Z==null?void 0:Z.valueOwner,R==null?void 0:R.logic,"Key")}" (\`${Be(Z==null?void 0:Z.valueOwner,R==null?void 0:R.logic,"key")}\`) input is missing.`);if(typeof j!="string")throw new Error(`${x}The "${Ve(Z==null?void 0:Z.valueOwner,R==null?void 0:R.logic,"Key")}" (\`${Be(Z==null?void 0:Z.valueOwner,R==null?void 0:R.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const H=n.find(oe=>{var ce,be;return((be=(ce=oe.valueOwner)==null?void 0:ce.declaration)==null?void 0:be.id)===G.operation[Ye.UploadFilePart].inputs.uploadId.id}),Y=(f=H==null?void 0:H.value)==null?void 0:f.value;if(!Y||Y==="")throw new Error(`${x}The "${Ve(H==null?void 0:H.valueOwner,R==null?void 0:R.logic,"Upload ID")}" (\`${Be(H==null?void 0:H.valueOwner,R==null?void 0:R.logic,"uploadId")}\`) input is missing.`);if(typeof Y!="string")throw new Error(`${x}The "${Ve(H==null?void 0:H.valueOwner,R==null?void 0:R.logic,"Upload ID")}" (\`${Be(H==null?void 0:H.valueOwner,R==null?void 0:R.logic,"uploadId")}\`) input value is invalid, if present, it must be a non-empty string.`);const ie=n.find(oe=>{var ce,be;return((be=(ce=oe.valueOwner)==null?void 0:ce.declaration)==null?void 0:be.id)===G.operation[Ye.UploadFilePart].inputs.partNumber.id}),W=Number((y=ie==null?void 0:ie.value)==null?void 0:y.value);if(((m=ie==null?void 0:ie.value)==null?void 0:m.value)===void 0||((T=ie==null?void 0:ie.value)==null?void 0:T.value)===null||isNaN(W)||W<=0)throw new Error(`${x}The "${Ve(ie==null?void 0:ie.valueOwner,R==null?void 0:R.logic,"Part number")}" (\`${Be(ie==null?void 0:ie.valueOwner,R==null?void 0:R.logic,"partNumber")}\`) input is missing or invalid.`);const z=n.find(oe=>{var ce,be;return((be=(ce=oe.valueOwner)==null?void 0:ce.declaration)==null?void 0:be.id)===G.operation[Ye.UploadFilePart].inputs.bytes.id}),J=(g=z==null?void 0:z.value)==null?void 0:g.value;if(J==null)throw new Error(`${x}The "${Ve(z==null?void 0:z.valueOwner,R==null?void 0:R.logic,"Bytes")}" (\`${Be(z==null?void 0:z.valueOwner,R==null?void 0:R.logic,"bytes")}\`) input is missing.`);const Q=(b=(await Ht.get(`${R.env.API_BASE_URL}/cloud-files-service/v1/files/multipart/${Y}?bucket=${$}&key=${encodeURIComponent(j)}&partNumber=${W}`,{headers:{Authorization:`Bearer ${await R.getAccessToken()}`}})).data)==null?void 0:b.uploadUrl;if(!Q)throw new Error(`${x}Failed to obtain presigned upload URL for part ${W}.`);const re=await Ht.put(Q,J,{headers:{"Content-Type":"application/octet-stream"}}),ae=re.headers.etag||re.headers.ETag||"",le=typeof ae=="string"?ae.replace(/"/g,""):"";return{value:K.Success,error:null,result:{partNumber:W,etag:le}}}catch(R){return{value:K.UnhandledError,error:R,result:null}}}})}}function t2(a){return a.subcommands?Array.isArray(a.subcommands)?a.subcommands:Object.values(a.subcommands):[]}function cDt(a){if(!a.subcommands)return{};if(Array.isArray(a.subcommands)){const t={};for(const n of a.subcommands)t[n.name.toLowerCase()]=n;return t}const p={};for(const[t,n]of Object.entries(a.subcommands))p[t.toLowerCase()]=n;return p}function GR(a,p,t,n,s){const u={};for(const e of t)e.id&&(u[e.id]=e),e.type&&(u[e.type]=e);return{context:s,project:s,confirmedParts:t,partsMap:u,activeSegmentText:n,activeCommand:a,activeSubcommand:p,getPartValue:e=>{const f=t.find(y=>y.id===e||y.type===e);return f?f.value:void 0},getPart:e=>t.find(f=>f.id===e||f.type===e)}}function WRn(a,p,t,n){if(!a||p.length===0){const Z=t.startsWith("/"),j=GR(null,null,p,t,n);return{activeCommand:null,activeSubcommand:null,currentStep:null,stepIndex:0,isComplete:!1,placeholder:Z?"Type command...":"How can I help you today?",ghostHint:void 0,allowFreeText:!0,stage:Z?"command":"normal",context:j}}const s=cDt(a),u=Object.keys(s).length>0,e=p.slice(1);let f=null,y=e;if(u){if(e.length===0){const j=t2(a)[0],H="Select Category",Y=`Type category (e.g. ${(j==null?void 0:j.name)||"node"})...`,ie=GR(a,null,p,t,n);return{activeCommand:a,activeSubcommand:null,currentStep:{id:"subcommand",type:"subcommand",label:"Category",placeholder:Y,ghostHint:H,required:!0,allowFreeText:!1,getOptions:async W=>{const z=t2(a),J=W.trim().toLowerCase();return z.filter(ee=>{var Q,re;return!J||ee.name.toLowerCase().includes(J)||((Q=ee.description)==null?void 0:Q.toLowerCase().includes(J))||((re=ee.label)==null?void 0:re.toLowerCase().includes(J))}).map(ee=>({id:ee.name,label:ee.label||ee.name,sublabel:ee.description,categoryTag:ee.category||"Subcommand",icon:ee.icon,namedColor:ee.namedColor}))},resolvePart:(W,z,J)=>{const ee=typeof W=="string"?W:W.id||W.name,Q=typeof W=="string"?W:W.label||W.name||ee;return{index:J,type:"subcommand",label:Q,value:ee,namedColor:"purple"}}},stepIndex:0,isComplete:!1,placeholder:Y,ghostHint:H,allowFreeText:!1,stage:"subcommand",context:ie}}const Z=e[0].value.toLowerCase();if(f=s[Z]||null,!f){const j=GR(a,null,p,t,n);return{activeCommand:a,activeSubcommand:null,currentStep:null,stepIndex:0,isComplete:!1,placeholder:"Unknown category",ghostHint:void 0,allowFreeText:!1,stage:"subcommand",context:j}}y=e.slice(1)}const m=f||a,T=GR(a,f,p,t,n);if(typeof m.getNextStep=="function"){const Z=m.getNextStep(T);if(!Z)return{activeCommand:a,activeSubcommand:f,currentStep:null,stepIndex:y.length,isComplete:!0,placeholder:"Press Enter to execute",ghostHint:void 0,allowFreeText:!1,stage:"args",context:T};const j=typeof Z.required=="function"?Z.required(T):Z.required!==!1,H=typeof Z.allowFreeText=="function"?Z.allowFreeText(T):Z.allowFreeText??Z.type==="argument";let Y="args";Z.type==="option"?Y="option":Z.type==="subcommand"?Y="subcommand":Z.type==="argument"&&(Y="args");const ie=typeof Z.placeholder=="function"?Z.placeholder(T):Z.placeholder||(Z.type==="option"?`Search ${Z.label.toLowerCase()}...`:j?`Enter ${Z.label.toLowerCase()}...`:`Enter ${Z.label.toLowerCase()} (optional, or press Enter)...`),W=typeof Z.ghostHint=="function"?Z.ghostHint(T):Z.ghostHint;return{activeCommand:a,activeSubcommand:f,currentStep:Z,stepIndex:y.length,isComplete:!j,placeholder:ie,ghostHint:W,allowFreeText:H,stage:Y,context:T}}const b=(typeof m.steps=="function"?m.steps(T):m.steps||[]).filter(Z=>typeof Z.isEnabled=="function"?Z.isEnabled(T):!0);if(b.length===0)return{activeCommand:a,activeSubcommand:f,currentStep:null,stepIndex:0,isComplete:!0,placeholder:"Press Enter to execute",ghostHint:void 0,allowFreeText:!1,stage:"args",context:T};const R=y.length;if(R>=b.length)return{activeCommand:a,activeSubcommand:f,currentStep:null,stepIndex:R,isComplete:!0,placeholder:"Press Enter to execute",ghostHint:void 0,allowFreeText:!1,stage:"args",context:T};const I=b[R],A=typeof I.required=="function"?I.required(T):I.required!==!1,x=typeof I.allowFreeText=="function"?I.allowFreeText(T):I.allowFreeText??I.type==="argument";let P="args";I.type==="option"?P="option":I.type==="subcommand"?P="subcommand":I.type==="argument"&&(P="args");const O=typeof I.placeholder=="function"?I.placeholder(T):I.placeholder||(I.type==="option"?`Search ${I.label.toLowerCase()}...`:A?`Enter ${I.label.toLowerCase()}...`:`Enter ${I.label.toLowerCase()} (optional, or press Enter)...`),$=typeof I.ghostHint=="function"?I.ghostHint(T):I.ghostHint;return{activeCommand:a,activeSubcommand:f,currentStep:I,stepIndex:R,isComplete:!A,placeholder:O,ghostHint:$,allowFreeText:x,stage:P,context:T}}class Rg{constructor(p,t){C(this,"step",{required:!0,allowFreeText:!1});this.step.id=p,this.step.label=t,this.step.type="argument"}static option(p,t){const n=new Rg(p,t);return n.step.type="option",n.step.allowFreeText=!1,n}static argument(p,t){const n=new Rg(p,t);return n.step.type="argument",n.step.allowFreeText=!0,n}static custom(p,t){const n=new Rg(p,t);return n.step.type="custom",n}setType(p){return this.step.type=p,this}setPlaceholder(p){return this.step.placeholder=p,this}setGhostHint(p){return this.step.ghostHint=p,this}setRequired(p){return this.step.required=p,this}setAllowFreeText(p){return this.step.allowFreeText=p,this}when(p){return this.step.isEnabled=p,this}setOptions(p){return this.step.getOptions=p,this}setPartResolver(p){return this.step.resolvePart=p,this}setValidator(p){return this.step.validatePart=p,this}onConfirmed(p){return this.step.onConfirmed=p,this}build(){if(!this.step.id||!this.step.label||!this.step.type)throw new Error("StepBuilder requires id, label, and type");return this.step.resolvePart||(this.step.resolvePart=(p,t,n)=>{const s=typeof p=="object"&&p!==null,u=s?p.label||p.name||p.id:String(p),e=s?p.id||p.value||u:String(p);return{index:n,type:this.step.type||"argument",label:u,value:e}}),this.step}}class sx{constructor(p){C(this,"cmd",{});C(this,"staticSteps",[]);C(this,"subcommandsMap",{});this.cmd.name=p}static create(p){return new sx(p)}setLabel(p){return this.cmd.label=p,this}setDescription(p){return this.cmd.description=p,this}setCategory(p){return this.cmd.category=p,this}setIcon(p){return this.cmd.icon=p,this}setNamedColor(p){return this.cmd.namedColor=p,this}addSubcommand(p,t){const n=t instanceof sx?t.build():t;return this.subcommandsMap[p.toLowerCase()]=n,this}setSubcommands(p){return this.cmd.subcommands=p,this}addStep(p){const t=p instanceof Rg?p.build():p;return this.staticSteps.push(t),this}setSteps(p){return this.cmd.steps=p,this}setNextStepResolver(p){return this.cmd.getNextStep=p,this}onPartConfirmed(p){return this.cmd.onPartConfirmed=p,this}onPartRemoved(p){return this.cmd.onPartRemoved=p,this}setValidator(p){return this.cmd.validate=p,this}setBeforeSubmit(p){return this.cmd.beforeSubmit=p,this}setExecutor(p){return this.cmd.execute=p,this}build(){if(!this.cmd.name)throw new Error("CommandBuilder requires a command name");return Object.keys(this.subcommandsMap).length>0&&(this.cmd.subcommands=this.subcommandsMap),this.staticSteps.length>0&&!this.cmd.steps&&!this.cmd.getNextStep&&(this.cmd.steps=this.staticSteps),this.cmd}}function zRn(a){return a}function YRn(a){return a}class i2 extends hV{constructor(p,t,n=t.projectId){super(p,te.Editor),this._editor=t,this.id=n}get ready(){return this._editor.ready}get env(){return this._editor.env}get hasLoadedLogic(){return this._editor.hasLoadedLogic}get destroyed(){return this._editor.destroyed}get logicLoadingPromise(){return this._editor.logicLoadingPromise}get logic(){return this._editor.logic}get lastPublishedProjectState(){return this._editor.lastPublishedProjectState}get branchHead(){return this._editor.branchHead}get branchHeadPromise(){return this._editor.branchHeadPromise}get projectId(){return this._editor.projectId}get sessionId(){return this._editor.sessionId}get userAuthorId(){return this._editor.userAuthorId}get peerConnections(){return this._editor.peerConnections}get test(){return this._editor.test}get localTestValues(){return this._editor.localTestValues}get resolvedValues(){return this._editor.resolvedValues}get persistedExecutionResults(){return this._editor.persistedExecutionResults}get publication(){return this._editor.publication}get livePublishedVersions(){return this._editor.livePublishedVersions}get publications(){return this._editor.publications}get liveResources(){return this._editor.liveResources}get execution(){return this._editor.execution}get project(){return this._editor.logic}get lastExecutionResults(){return this._editor.lastExecutionResults}get undoableStackValueIndex(){return this._editor.undoableStackValueIndex}set undoableStackValueIndex(p){this._editor.undoableStackValueIndex=p}get activeWorkspace(){return this._editor.activeWorkspace}get branches(){return this._editor.branches}get roles(){return this._editor.roles}get READ_ONLY(){return this._editor.READ_ONLY}get isViewingNonHead(){return this._editor.isViewingNonHead}get canEdit(){return this._editor.canEdit}get PROJECT_NOTIFICATIONS_CHANNEL(){return this._editor.PROJECT_NOTIFICATIONS_CHANNEL}getAccessToken(){return this._editor.getAccessToken()}getRefreshToken(){return this._editor.getRefreshToken()}removeValueByOwnerId(p){return this._editor.removeValueByOwnerId(p)}removeValue(p){return this._editor.removeValue(p)}undo(){return this._editor.undo()}redo(){return this._editor.redo()}initTest(p,t){return this._editor.initTest(p,t)}removeTest(p){return this._editor.removeTest(p)}async copyEntities(p,t={}){return this._editor.copyEntities(p,t)}resolveInitialChildrenPositions(p,t,n){return this._editor.resolveInitialChildrenPositions(p,t,n)}publish(p){return this._editor.publish(p)}loadGivenPublication(p){return this._editor.loadGivenPublication(p)}validateProjectState(p){return this._editor.validateProjectState(p)}requestActiveDynamicValue(p,t=!1){return this._editor.requestActiveDynamicValue(p,t)}getValueTypePreference(p){return this._editor.getValueTypePreference(p)}setValueTypePreference(p,t){return this._editor.setValueTypePreference(p,t)}implementFeature(p){return this._editor.implementFeature(p)}getProjectRoles(){return this._editor.getProjectRoles()}getLastPublishedVersionLogic(p){return this._editor.getLastPublishedVersionLogic(p)}initialLoads(p){return this._editor.initialLoads(p)}moveBranchHeadToVersion(p,t,n){return this._editor.moveBranchHeadToVersion(p,t,n)}loadInitialBranchHead(){return this._editor.loadInitialBranchHead()}}function JRn(a,p){return p instanceof i2?p:new i2(a,p)}class n2 extends hV{constructor(p,t){super(p,te.PublicationRun),this._publicationRun=t}get id(){return this._publicationRun.id}get projectAutoIncrementPublicationCount(){return this._publicationRun.projectAutoIncrementPublicationCount}get projectPublishedSemanticVersion(){return this._publicationRun.projectPublishedSemanticVersion}get envIdentifier(){return this._publicationRun.envIdentifier}get projectVersion(){return this._publicationRun.projectVersion}get projectBranchId(){return this._publicationRun.projectBranchId}get projectId(){return this._publicationRun.projectId}get triggeredBy(){return this._publicationRun.triggeredBy}get createdAt(){return this._publicationRun.createdAt}get updatedAt(){return this._publicationRun.updatedAt}get status(){return this._publicationRun.status}get steps(){return this._publicationRun.steps}get cleanupSteps(){return this._publicationRun.cleanupSteps}get editor(){return this._publicationRun.editor}get explicitResources(){return this._publicationRun.explicitResources}get implicitGlobalResources(){return this._publicationRun.implicitGlobalResources}get finalGlobalEvent(){return this._publicationRun.finalGlobalEvent}get finalStatus(){return this._publicationRun.finalStatus}}function QRn(a,p){return p instanceof n2?p:new n2(a,p)}const QG={spec:{title:"Sales Overview",basicChart:{chartType:"COLUMN",legendPosition:"BOTTOM_LEGEND",axis:[{position:"BOTTOM_AXIS",title:"Categories"},{position:"LEFT_AXIS",title:"Values"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"LEFT_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}},XRn={spec:{title:"Revenue Comparison",basicChart:{chartType:"BAR",legendPosition:"BOTTOM_LEGEND",axis:[{position:"LEFT_AXIS",title:"Products"},{position:"BOTTOM_AXIS",title:"Revenue ($)"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"BOTTOM_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}},eAn={spec:{title:"Monthly Performance Trend",basicChart:{chartType:"LINE",legendPosition:"RIGHT_LEGEND",interpolateNulls:!0,axis:[{position:"BOTTOM_AXIS",title:"Month"},{position:"LEFT_AXIS",title:"Active Users"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:12,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:12,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"LEFT_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}},tAn={spec:{title:"Traffic Channels Distribution",basicChart:{chartType:"AREA",legendPosition:"TOP_LEGEND",stackedType:"STACKED",axis:[{position:"BOTTOM_AXIS",title:"Quarter"},{position:"LEFT_AXIS",title:"Visits"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:4,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:4,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"LEFT_AXIS"},{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:4,startColumnIndex:2,endColumnIndex:3}]}},targetAxis:"LEFT_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}},iAn={spec:{title:"Market Share Breakdown",pieChart:{legendPosition:"RIGHT_LEGEND",threeDimensional:!1,pieHole:0,domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:0,endColumnIndex:1}]}},series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:1,endColumnIndex:2}]}}}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:500,heightPixels:350}}},nAn={spec:{title:"Budget Allocation",pieChart:{legendPosition:"BOTTOM_LEGEND",threeDimensional:!1,pieHole:.4,domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:6,startColumnIndex:0,endColumnIndex:1}]}},series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:6,startColumnIndex:1,endColumnIndex:2}]}}}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:500,heightPixels:350}}},rAn={spec:{title:"Quarterly Revenue KPI",scorecardChart:{keyValueData:{sourceRange:{sources:[{sheetId:0,startRowIndex:1,endRowIndex:2,startColumnIndex:1,endColumnIndex:2}]}},baselineValueData:{sourceRange:{sources:[{sheetId:0,startRowIndex:2,endRowIndex:3,startColumnIndex:1,endColumnIndex:2}]}}}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:400,heightPixels:250}}},aAn={spec:{title:"Regional Sales (3D)",basicChart:{chartType:"BAR",legendPosition:"RIGHT_LEGEND",headerCount:1,threeDimensional:!0,axis:[{position:"LEFT_AXIS",title:"Region"},{position:"BOTTOM_AXIS",title:"Units Sold"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"BOTTOM_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}};class sAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][X.GoogleSheetsAddChart].inputs.chart.id,version:"1.0.0",description:'Gives options for and generates useful example values for the chart input of the "Add chart" Google Sheets operation',initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{getOptions:async t=>[{key:"column-chart",label:"Column Chart",disabledReasons:[],hidden:!1},{key:"bar-chart",label:"Bar Chart",disabledReasons:[],hidden:!1},{key:"line-chart",label:"Line Chart",disabledReasons:[],hidden:!1},{key:"area-chart",label:"Stacked Area Chart",disabledReasons:[],hidden:!1},{key:"pie-chart",label:"Pie Chart",disabledReasons:[],hidden:!1},{key:"donut-chart",label:"Donut Chart",disabledReasons:[],hidden:!1},{key:"scorecard-chart",label:"Scorecard KPI Chart",disabledReasons:[],hidden:!1},{key:"3d-bar-chart",label:"3D Bar Chart",disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{const s=n==null?void 0:n.valueKey;if(!s)return{value:QG};switch(s){case"column-chart":case"basic-chart":return{value:QG};case"bar-chart":return{value:XRn};case"line-chart":return{value:eAn};case"area-chart":return{value:tAn};case"pie-chart":return{value:iAn};case"donut-chart":return{value:nAn};case"scorecard-chart":return{value:rAn};case"3d-bar-chart":case"3d-column-chart":return{value:aAn}}return{value:QG}}})}}const XG={spec:{title:"Sales Overview",basicChart:{chartType:"COLUMN",legendPosition:"BOTTOM_LEGEND",axis:[{position:"BOTTOM_AXIS",title:"Categories"},{position:"LEFT_AXIS",title:"Values"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"LEFT_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}},lAn={spec:{title:"Revenue Comparison",basicChart:{chartType:"BAR",legendPosition:"BOTTOM_LEGEND",axis:[{position:"LEFT_AXIS",title:"Products"},{position:"BOTTOM_AXIS",title:"Revenue ($)"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"BOTTOM_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}},oAn={spec:{title:"Monthly Performance Trend",basicChart:{chartType:"LINE",legendPosition:"RIGHT_LEGEND",interpolateNulls:!0,axis:[{position:"BOTTOM_AXIS",title:"Month"},{position:"LEFT_AXIS",title:"Active Users"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:12,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:12,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"LEFT_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}},dAn={spec:{title:"Traffic Channels Distribution",basicChart:{chartType:"AREA",legendPosition:"TOP_LEGEND",stackedType:"STACKED",axis:[{position:"BOTTOM_AXIS",title:"Quarter"},{position:"LEFT_AXIS",title:"Visits"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:4,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:4,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"LEFT_AXIS"},{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:4,startColumnIndex:2,endColumnIndex:3}]}},targetAxis:"LEFT_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}},pAn={spec:{title:"Market Share Breakdown",pieChart:{legendPosition:"RIGHT_LEGEND",threeDimensional:!1,pieHole:0,domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:0,endColumnIndex:1}]}},series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:1,endColumnIndex:2}]}}}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:500,heightPixels:350}}},uAn={spec:{title:"Budget Allocation",pieChart:{legendPosition:"BOTTOM_LEGEND",threeDimensional:!1,pieHole:.4,domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:6,startColumnIndex:0,endColumnIndex:1}]}},series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:6,startColumnIndex:1,endColumnIndex:2}]}}}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:500,heightPixels:350}}},cAn={spec:{title:"Quarterly Revenue KPI",scorecardChart:{keyValueData:{sourceRange:{sources:[{sheetId:0,startRowIndex:1,endRowIndex:2,startColumnIndex:1,endColumnIndex:2}]}},baselineValueData:{sourceRange:{sources:[{sheetId:0,startRowIndex:2,endRowIndex:3,startColumnIndex:1,endColumnIndex:2}]}}}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:400,heightPixels:250}}},fAn={spec:{title:"Regional Sales (3D)",basicChart:{chartType:"BAR",legendPosition:"RIGHT_LEGEND",headerCount:1,threeDimensional:!0,axis:[{position:"LEFT_AXIS",title:"Region"},{position:"BOTTOM_AXIS",title:"Units Sold"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"BOTTOM_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}};class yAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][X.GoogleSheetsUpdateChartSpec].inputs.chart.id,version:"1.0.0",description:'Gives options for and generates useful example values for the chart input of the "Update chart spec" Google Sheets operation',initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{getOptions:async t=>[{key:"column-chart",label:"Column Chart",disabledReasons:[],hidden:!1},{key:"bar-chart",label:"Bar Chart",disabledReasons:[],hidden:!1},{key:"line-chart",label:"Line Chart",disabledReasons:[],hidden:!1},{key:"area-chart",label:"Stacked Area Chart",disabledReasons:[],hidden:!1},{key:"pie-chart",label:"Pie Chart",disabledReasons:[],hidden:!1},{key:"donut-chart",label:"Donut Chart",disabledReasons:[],hidden:!1},{key:"scorecard-chart",label:"Scorecard KPI Chart",disabledReasons:[],hidden:!1},{key:"3d-bar-chart",label:"3D Bar Chart",disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{const s=n==null?void 0:n.valueKey;if(!s)return{value:XG};switch(s){case"column-chart":case"basic-chart":return{value:XG};case"bar-chart":return{value:lAn};case"line-chart":return{value:oAn};case"area-chart":return{value:dAn};case"pie-chart":return{value:pAn};case"donut-chart":return{value:uAn};case"scorecard-chart":return{value:cAn};case"3d-bar-chart":case"3d-column-chart":return{value:fAn}}return{value:XG}}})}}const hAn="Sheet2!A1",mAn='"Copy of Blahhh"!A1';class TAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][X.GoogleSheetsCreatePivotTable].inputs.destination.id,version:"1.0.0",description:'Gives options for and generates useful example values for the destination input of the "Create pivot table" Google Sheets operation',initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{getOptions:async t=>[{key:"sheet2-a1",label:"Sheet2!A1",disabledReasons:[],hidden:!1},{key:"copy-of-blahhh-a1",label:'"Copy of Blahhh"!A1',disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{switch(n==null?void 0:n.valueKey){case"copy-of-blahhh-a1":return{value:mAn};case"sheet2-a1":default:return{value:hAn}}}})}}const vAn="Sheet1!A1:D100",gAn="Sheet1!A1:G500";class bAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][X.GoogleSheetsCreatePivotTable].inputs.source.id,version:"1.0.0",description:'Gives options for and generates useful example values for the source input of the "Create pivot table" Google Sheets operation',initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{getOptions:async t=>[{key:"sales-data",label:"Sales Data Range (Sheet1!A1:D100)",disabledReasons:[],hidden:!1},{key:"financial-data",label:"Financial Data Range (Sheet1!A1:G500)",disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{switch(n==null?void 0:n.valueKey){case"financial-data":return{value:gAn};case"sales-data":default:return{value:vAn}}}})}}const EAn=[{sourceColumnOffset:0,sortOrder:"ASCENDING",showTotals:!0}],IAn=[{sourceColumnOffset:0,sortOrder:"ASCENDING",showTotals:!0},{sourceColumnOffset:1,sortOrder:"ASCENDING",showTotals:!0}];class RAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][X.GoogleSheetsCreatePivotTable].inputs.rows.id,version:"1.0.0",description:'Gives options for and generates useful example values for the rows input of the "Create pivot table" Google Sheets operation',initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{getOptions:async t=>[{key:"single-row-group",label:"Group by First Column (Column 0)",disabledReasons:[],hidden:!1},{key:"multi-row-group",label:"Group by First & Second Columns (Columns 0 & 1)",disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{switch(n==null?void 0:n.valueKey){case"multi-row-group":return{value:IAn};case"single-row-group":default:return{value:EAn}}}})}}const AAn=[{sourceColumnOffset:1,sortOrder:"ASCENDING",showTotals:!0}],DAn=[{sourceColumnOffset:1,sortOrder:"ASCENDING",showTotals:!0},{sourceColumnOffset:2,sortOrder:"ASCENDING",showTotals:!0}];class CAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][X.GoogleSheetsCreatePivotTable].inputs.columns.id,version:"1.0.0",description:'Gives options for and generates useful example values for the columns input of the "Create pivot table" Google Sheets operation',initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{getOptions:async t=>[{key:"single-column-group",label:"Group by Second Column (Column 1)",disabledReasons:[],hidden:!1},{key:"multi-column-group",label:"Group by Second & Third Columns (Columns 1 & 2)",disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{switch(n==null?void 0:n.valueKey){case"multi-column-group":return{value:DAn};case"single-column-group":default:return{value:AAn}}}})}}const wAn=[{sourceColumnOffset:3,summarizeFunction:"SUM",name:"Total Revenue"}],xAn=[{sourceColumnOffset:2,summarizeFunction:"COUNTA",name:"Total Orders"},{sourceColumnOffset:3,summarizeFunction:"SUM",name:"Total Revenue"}],OAn=[{sourceColumnOffset:4,summarizeFunction:"AVERAGE",name:"Average Profit"}];class PAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][X.GoogleSheetsCreatePivotTable].inputs.values.id,version:"1.0.0",description:'Gives options for and generates useful example values for the values input of the "Create pivot table" Google Sheets operation',initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{getOptions:async t=>[{key:"sum-revenue",label:"SUM Revenue (Column 3)",disabledReasons:[],hidden:!1},{key:"sum-and-count",label:"COUNTA Orders (Col 2) & SUM Revenue (Col 3)",disabledReasons:[],hidden:!1},{key:"average-profit",label:"AVERAGE Profit (Column 4)",disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{switch(n==null?void 0:n.valueKey){case"sum-and-count":return{value:xAn};case"average-profit":return{value:OAn};case"sum-revenue":default:return{value:wAn}}}})}}const VAn="Sheet2!A1",NAn='"Copy of Blahhh"!A1';class _An extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][X.GoogleSheetsDeletePivotTable].inputs.destination.id,version:"1.0.0",description:'Gives options for and generates useful example values for the destination input of the "Delete pivot table" Google Sheets operation',initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{getOptions:async t=>[{key:"sheet2-a1",label:"Sheet2!A1",disabledReasons:[],hidden:!1},{key:"copy-of-blahhh-a1",label:'"Copy of Blahhh"!A1',disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{switch(n==null?void 0:n.valueKey){case"copy-of-blahhh-a1":return{value:NAn};case"sheet2-a1":default:return{value:VAn}}}})}}const N5={"Number greater than":"NUMBER_GREATER","Number greater than or equal":"NUMBER_GREATER_THAN_EQ","Number less than":"NUMBER_LESS","Number less than or equal":"NUMBER_LESS_THAN_EQ","Number equal to":"NUMBER_EQ","Number not equal to":"NUMBER_NOT_EQ","Number between":"NUMBER_BETWEEN","Number not between":"NUMBER_NOT_BETWEEN","Text contains":"TEXT_CONTAINS","Text does not contain":"TEXT_NOT_CONTAINS","Text starts with":"TEXT_STARTS_WITH","Text ends with":"TEXT_ENDS_WITH","Text equals":"TEXT_EQ","Date is":"DATE_EQ","Date is before":"DATE_BEFORE","Date is after":"DATE_AFTER","Date is on or before":"DATE_ON_OR_BEFORE","Date is on or after":"DATE_ON_OR_AFTER","Cell is empty":"BLANK","Cell is not empty":"NOT_BLANK","Custom formula":"CUSTOM_FORMULA"};function fDt(a){if(!a||typeof a!="string")return null;const p=a.trim();return p?N5[p]?N5[p]:p.toUpperCase().replace(/\s+/g,"_"):null}function yDt(a,p,t,n){if(p==null)return;let s=[];if(Array.isArray(p))s=p;else if(typeof p=="string"){const e=p.trim();if(!e)return;if(e.startsWith("["))try{const f=JSON.parse(e);Array.isArray(f)?s=f:s=[e]}catch{s=[e]}else s=[e]}const u=fDt(a);if(u==="BLANK"||u==="NOT_BLANK"){s.length>0&&n.push(new ht({id:`${t.id}--${uo.ConditionValuesNoValuesRequired}`,message:`Condition "${a}" does not require any condition values.`,severity:Ie.Error,code:uo.ConditionValuesNoValuesRequired,entity:t}));return}if(u==="CUSTOM_FORMULA"){if(s.length===0)n.push(new ht({id:`${t.id}--${uo.ConditionValuesInvalidFormula}`,message:'Custom formula condition requires a formula string starting with "=" (e.g. ["=A1>100"]).',severity:Ie.Error,code:uo.ConditionValuesInvalidFormula,entity:t}));else for(const e of s){const f=String(e).trim();f.startsWith("=")||n.push(new ht({id:`${t.id}--${uo.ConditionValuesInvalidFormula}`,message:`Custom formula "${f}" must start with "=".`,severity:Ie.Error,code:uo.ConditionValuesInvalidFormula,entity:t}))}return}if(u==="NUMBER_BETWEEN"||u==="NUMBER_NOT_BETWEEN"){s.length!==2&&n.push(new ht({id:`${t.id}--${uo.ConditionValuesTwoNumbersRequired}`,message:`Condition "${a}" requires exactly 2 values (min and max, e.g. ["1", "100"]).`,severity:Ie.Error,code:uo.ConditionValuesTwoNumbersRequired,entity:t}));return}if(u==="NUMBER_GREATER"||u==="NUMBER_GREATER_THAN_EQ"||u==="NUMBER_LESS"||u==="NUMBER_LESS_THAN_EQ"||u==="NUMBER_EQ"||u==="NUMBER_NOT_EQ"){s.length!==1&&n.push(new ht({id:`${t.id}--${uo.ConditionValuesSingleNumberRequired}`,message:`Condition "${a}" requires exactly 1 threshold value (e.g. ["100"]).`,severity:Ie.Error,code:uo.ConditionValuesSingleNumberRequired,entity:t}));return}if(u==="TEXT_CONTAINS"||u==="TEXT_NOT_CONTAINS"||u==="TEXT_STARTS_WITH"||u==="TEXT_ENDS_WITH"||u==="TEXT_EQ"){s.length!==1&&n.push(new ht({id:`${t.id}--${uo.ConditionValuesSingleTextRequired}`,message:`Condition "${a}" requires exactly 1 text string value (e.g. ["Approved"]).`,severity:Ie.Error,code:uo.ConditionValuesSingleTextRequired,entity:t}));return}}const mw={num_100:["100"],num_0:["0"],num_1000:["1000"],between_1_100:["1","100"],between_0_50:["0","50"],between_50_100:["50","100"],text_approved:["Approved"],text_pending:["Pending"],text_rejected:["Rejected"],text_urgent:["Urgent"],date_2026_01_01:["2026-01-01"],date_today:["2026-08-08"],formula_above_avg:["=A1>AVERAGE($A$1:$A$100)"],formula_even:["=ISEVEN(A1)"],formula_duplicates:["=COUNTIF($A$1:$A$100, A1)>1"],default_100:["100"],default_approved:["Approved"],default_formula:["=A1>0"]};function K4(a){const p=fDt(a),t=(n,s)=>({key:n,label:s,disabledReasons:[],hidden:!1});return p==="NUMBER_GREATER"||p==="NUMBER_GREATER_THAN_EQ"||p==="NUMBER_LESS"||p==="NUMBER_LESS_THAN_EQ"||p==="NUMBER_EQ"||p==="NUMBER_NOT_EQ"?[t("num_100","100 (Single threshold)"),t("num_0","0 (Zero threshold)"),t("num_1000","1000 (High threshold)")]:p==="NUMBER_BETWEEN"||p==="NUMBER_NOT_BETWEEN"?[t("between_1_100","Between 1 and 100"),t("between_0_50","Between 0 and 50"),t("between_50_100","Between 50 and 100")]:p==="TEXT_CONTAINS"||p==="TEXT_NOT_CONTAINS"||p==="TEXT_STARTS_WITH"||p==="TEXT_ENDS_WITH"||p==="TEXT_EQ"?[t("text_approved","Approved"),t("text_pending","Pending"),t("text_rejected","Rejected"),t("text_urgent","Urgent")]:p==="DATE_EQ"||p==="DATE_BEFORE"||p==="DATE_AFTER"||p==="DATE_ON_OR_BEFORE"||p==="DATE_ON_OR_AFTER"?[t("date_2026_01_01","Start of 2026 (2026-01-01)"),t("date_today","Current Date (2026-08-08)")]:p==="CUSTOM_FORMULA"?[t("formula_above_avg","Greater than average (=A1>AVERAGE($A$1:$A$100))"),t("formula_even","Even numbers (=ISEVEN(A1))"),t("formula_duplicates","Highlight duplicates (=COUNTIF($A$1:$A$100, A1)>1)")]:p==="BLANK"||p==="NOT_BLANK"?[]:[t("default_100","100"),t("default_approved","Approved"),t("default_formula","Formula (=A1>0)")]}function hDt(a,p){const t=p==null?void 0:p.valueKey;if(t&&mw[t])return{value:mw[t]};const n=K4(a);if(n.length>0){const s=n[0].key;if(mw[s])return{value:mw[s]}}return{value:["100"]}}function _5(a){var u,e;const p=(u=G[r.Operation])==null?void 0:u[X.GoogleSheetsAddConditionalFormatRule];if(!p)return null;const t=a.parent;if(!t)return null;const s=(t.inputs||t.outputs||[]).find(f=>{var y;return((y=f.declaration)==null?void 0:y.id)===p.inputs.conditionType.id||f.id===p.inputs.conditionType.id});return((e=s==null?void 0:s.defaultValue)==null?void 0:e.value)??null}class $An extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][X.GoogleSheetsAddConditionalFormatRule].inputs.conditionValues.id,version:"1.0.0",description:'Gives options for and generates useful example values for conditionValues input of "Add conditional format rule" Google Sheets operation',initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{getOptions:async t=>{const n=_5(t);return K4(n)},getValue:async(t,n)=>{const s=_5(t);return hDt(s,n)}})}}function $5(a){var u,e;const p=(u=G[r.Operation])==null?void 0:u[X.GoogleSheetsUpdateConditionalFormatRule];if(!p)return null;const t=a.parent;if(!t)return null;const s=(t.inputs||t.outputs||[]).find(f=>{var y;return((y=f.declaration)==null?void 0:y.id)===p.inputs.conditionType.id||f.id===p.inputs.conditionType.id});return((e=s==null?void 0:s.defaultValue)==null?void 0:e.value)??null}class GAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][X.GoogleSheetsUpdateConditionalFormatRule].inputs.conditionValues.id,version:"1.0.0",description:'Gives options for and generates useful example values for conditionValues input of "Update conditional format rule" Google Sheets operation',initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{getOptions:async t=>{const n=$5(t);return K4(n)},getValue:async(t,n)=>{const s=$5(t);return hDt(s,n)}})}}const CV=[["Name","Age","Is Active","Notes"],["Alice",30,!0,"New user"],["Bob",25,!1,null],["Charlie",null,!0,"No age provided"]],Mp="1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms",wE={sheetId:0,startRowIndex:0,endRowIndex:10,startColumnIndex:0,endColumnIndex:5},LAn=["Sheet1!A1:B10","Sheet2!C1:D5"],BAn=["Option 1","Option 2","Option 3"],SAn=[{updateSpreadsheetProperties:{properties:{title:"My Renamed Spreadsheet",locale:"en_US",timeZone:"America/New_York"},fields:"title,locale,timeZone"}},{addSheet:{properties:{title:"New Custom Sheet",gridProperties:{rowCount:100,columnCount:20}}}},{mergeCells:{range:{sheetId:0,startRowIndex:0,endRowIndex:2,startColumnIndex:0,endColumnIndex:4},mergeType:"MERGE_ALL"}},{repeatCell:{range:{sheetId:0,startRowIndex:0,endRowIndex:1,startColumnIndex:0,endColumnIndex:5},cell:{userEnteredFormat:{backgroundColor:{red:.2,green:.4,blue:.8},textFormat:{bold:!0,foregroundColor:{red:1,green:1,blue:1}}}},fields:"userEnteredFormat(backgroundColor,textFormat)"}},{findReplace:{find:"Old Value",replacement:"New Value",allSheets:!0,matchCase:!1}}],MAn=[["Date","Product","Revenue ($)","Units Sold"],["2026-01-15","Pro Subscription",299,1],["2026-01-16","Enterprise Add-On",1250.5,2]],FAn=[["Alice Smith","alice@example.com","Engineer","Active"]],kAn=[[null]];class UAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][X.GoogleSheetsAppendRows].inputs.values.id,version:"1.0.0",description:'Gives options for and generates useful example values for the values input of the "Append rows" Google Sheets operation',initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{getOptions:async t=>[{key:"sample-users",label:"Sample User Directory (3 Rows, 4 Columns)",disabledReasons:[],hidden:!1},{key:"sales-report",label:"Sales Report (2 Rows, 4 Columns)",disabledReasons:[],hidden:!1},{key:"single-row",label:"Single Row Entry (1 Row, 4 Columns)",disabledReasons:[],hidden:!1},{key:"empty-grid",label:"Empty Placeholder (1 Row, 1 Column)",disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{switch(n==null?void 0:n.valueKey){case"sales-report":return{value:MAn};case"single-row":return{value:FAn};case"empty-grid":return{value:kAn};case"sample-users":default:return{value:CV}}}})}}const KAn=[["Date","Product","Revenue ($)","Units Sold"],["2026-01-15","Pro Subscription",299,1],["2026-01-16","Enterprise Add-On",1250.5,2]],jAn=[["Alice Smith","alice@example.com","Engineer","Active"]],qAn=[[null]];class ZAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][X.GoogleSheetsUpdateRangeValues].inputs.values.id,version:"1.0.0",description:'Gives options for and generates useful example values for the values input of the "Update range values" Google Sheets operation',initPriority:_e.High,permissions:[$e.All],contexts:[te.Editor,te.Logic]});C(this,"module",{getOptions:async t=>[{key:"sample-users",label:"Sample User Directory (3 Rows, 4 Columns)",disabledReasons:[],hidden:!1},{key:"sales-report",label:"Sales Report (2 Rows, 4 Columns)",disabledReasons:[],hidden:!1},{key:"single-row",label:"Single Row Entry (1 Row, 4 Columns)",disabledReasons:[],hidden:!1},{key:"empty-grid",label:"Empty Placeholder (1 Row, 1 Column)",disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{switch(n==null?void 0:n.valueKey){case"sales-report":return{value:KAn};case"single-row":return{value:jAn};case"empty-grid":return{value:qAn};case"sample-users":default:return{value:CV}}}})}}function HAn(a){a.register(new bTt(a)),a.register(new gTt(a)),a.register(new hTt(a)),a.register(new TTt(a)),a.register(new vTt(a)),a.register(new mTt(a)),a.register(new eIt(a)),a.register(new tIt(a)),a.register(new iIt(a)),a.register(new rIt(a)),a.register(new nIt(a)),a.register(new aIt(a)),a.register(new qRt(a)),a.register(new ZRt(a)),a.register(new HRt(a)),a.register(new WRt(a)),a.register(new zRt(a)),a.register(new YRt(a)),a.register(new JRt(a)),a.register(new QRt(a)),a.register(new XRt(a)),a.register(new eAt(a)),a.register(new Xbt(a)),a.register(new eEt(a)),a.register(new tEt(a)),a.register(new iEt(a)),a.register(new nEt(a)),a.register(new rEt(a)),a.register(new aEt(a)),a.register(new sEt(a)),a.register(new lEt(a)),a.register(new oEt(a)),a.register(new dEt(a)),a.register(new pEt(a)),a.register(new uEt(a)),a.register(new cEt(a)),a.register(new fEt(a)),a.register(new yEt(a)),a.register(new hEt(a)),a.register(new mEt(a)),a.register(new TEt(a)),a.register(new bEt(a)),a.register(new EEt(a)),a.register(new IEt(a)),a.register(new gbt(a)),a.register(new bbt(a)),a.register(new Ebt(a)),a.register(new Ibt(a)),a.register(new Rbt(a)),a.register(new Abt(a)),a.register(new Dbt(a)),a.register(new Cbt(a)),a.register(new wbt(a)),a.register(new Obt(a)),a.register(new Pbt(a)),a.register(new Vbt(a)),a.register(new Nbt(a)),a.register(new _bt(a)),a.register(new Sgt(a)),a.register(new dRt(a)),a.register(new lRt(a)),a.register(new oRt(a)),a.register(new Bvt(a)),a.register(new Svt(a)),a.register(new Mvt(a)),a.register(new Fvt(a)),a.register(new kvt(a)),a.register(new Uvt(a)),a.register(new Kvt(a)),a.register(new jvt(a)),a.register(new qvt(a)),a.register(new rgt(a)),a.register(new Ggt(a)),a.register(new Lgt(a)),a.register(new Bgt(a)),a.register(new Zvt(a)),a.register(new Hvt(a)),a.register(new Wvt(a)),a.register(new zvt(a)),a.register(new Yvt(a)),a.register(new Jvt(a)),a.register(new Qvt(a)),a.register(new Xvt(a)),a.register(new egt(a)),a.register(new tgt(a)),a.register(new igt(a)),a.register(new ngt(a)),a.register(new agt(a)),a.register(new sgt(a)),a.register(new lgt(a)),a.register(new ogt(a)),a.register(new dgt(a)),a.register(new pgt(a)),a.register(new ugt(a)),a.register(new cgt(a)),a.register(new fgt(a)),a.register(new ygt(a)),a.register(new hgt(a)),a.register(new mgt(a)),a.register(new Dgt(a)),a.register(new Cgt(a)),a.register(new wgt(a)),a.register(new Tgt(a)),a.register(new vgt(a)),a.register(new ggt(a)),a.register(new bgt(a)),a.register(new Egt(a)),a.register(new Igt(a)),a.register(new Rgt(a)),a.register(new Agt(a)),a.register(new fRt(a)),a.register(new yRt(a)),a.register(new hRt(a)),a.register(new mRt(a)),a.register(new pRt(a)),a.register(new uRt(a)),a.register(new cRt(a)),a.register(new TRt(a)),a.register(new gRt(a)),a.register(new ERt(a)),a.register(new vRt(a)),a.register(new bRt(a)),a.register(new IRt(a)),a.register(new DRt(a)),a.register(new RRt(a)),a.register(new ARt(a)),a.register(new $bt(a)),a.register(new Sbt(a)),a.register(new Mbt(a)),a.register(new Ubt(a)),a.register(new Kbt(a)),a.register(new jbt(a)),a.register(new qbt(a)),a.register(new Zbt(a)),a.register(new Hbt(a)),a.register(new Wbt(a)),a.register(new zbt(a)),a.register(new Fbt(a)),a.register(new kbt(a)),a.register(new z1t(a)),a.register(new Y1t(a)),a.register(new J1t(a)),a.register(new Q1t(a)),a.register(new X1t(a)),a.register(new eDt(a)),a.register(new tDt(a)),a.register(new iDt(a)),a.register(new nDt(a)),a.register(new rDt(a)),a.register(new aDt(a)),a.register(new sDt(a)),a.register(new lDt(a)),a.register(new oDt(a)),a.register(new dDt(a)),a.register(new pDt(a)),a.register(new uDt(a)),a.register(new Lbt(a)),a.register(new Bbt(a)),a.register(new Gbt(a)),a.register(new xbt(a)),a.register(new Jbt(a)),a.register(new Qbt(a)),a.register(new Ybt(a)),a.register(new lIt(a)),a.register(new VIt(a)),a.register(new PIt(a)),a.register(new NIt(a)),a.register(new _It(a)),a.register(new pIt(a)),a.register(new uIt(a)),a.register(new TIt(a)),a.register(new hIt(a)),a.register(new xIt(a)),a.register(new IIt(a)),a.register(new AIt(a)),a.register(new CIt(a)),a.register(new DIt(a)),a.register(new mIt(a)),a.register(new gIt(a)),a.register(new bIt(a)),a.register(new vIt(a)),a.register(new sIt(a)),a.register(new cIt(a)),a.register(new RIt(a)),a.register(new LIt(a)),a.register(new ZL(a)),a.register(new dIt(a)),a.register(new fIt(a)),a.register(new oIt(a)),a.register(new wIt(a)),a.register(new yIt(a)),a.register(new EIt(a)),a.register(new OIt(a)),a.register(new GIt(a)),a.register(new $It(a)),a.register(new BIt(a)),a.register(new ZL(a)),a.register(new MIt(a)),a.register(new SIt(a)),a.register(new FIt(a)),a.register(new BEt(a)),a.register(new SEt(a)),a.register(new MEt(a)),a.register(new AEt(a)),a.register(new gEt(a)),a.register(new xEt(a)),a.register(new NEt(a)),a.register(new vEt(a)),a.register(new _Et(a)),a.register(new LEt(a)),a.register(new PEt(a)),a.register(new OEt(a)),a.register(new tx(a)),a.register(new FEt(a)),a.register(new kEt(a)),a.register(new VEt(a)),a.register(new GEt(a)),a.register(new $Et(a)),a.register(new wEt(a)),a.register(new CEt(a)),a.register(new DEt(a)),a.register(new REt(a)),a.register(new jEt(a)),a.register(new KEt(a)),a.register(new qEt(a)),a.register(new UEt(a)),a.register(new Vgt(a)),a.register(new xgt(a)),a.register(new Pgt(a)),a.register(new Ngt(a)),a.register(new _gt(a)),a.register(new Ogt(a)),a.register(new $gt(a)),a.register(new nAt(a)),a.register(new dAt(a)),a.register(new uAt(a)),a.register(new fAt(a)),a.register(new yAt(a)),a.register(new hAt(a)),a.register(new mAt(a)),a.register(new oAt(a)),a.register(new pAt(a)),a.register(new cAt(a)),a.register(new lAt(a)),a.register(new sAt(a)),a.register(new aAt(a)),a.register(new rAt(a)),a.register(new tAt(a)),a.register(new iAt(a)),a.register(new EAt(a)),a.register(new IAt(a)),a.register(new gAt(a)),a.register(new bAt(a)),a.register(new jRt(a)),a.register(new TAt(a)),a.register(new vAt(a)),a.register(new AAt(a)),a.register(new RAt(a)),a.register(new DAt(a)),a.register(new CAt(a)),a.register(new wAt(a)),a.register(new ETt(a)),a.register(new ITt(a)),a.register(new Xw(a)),a.register(new ex(a)),a.register(new NAt(a)),a.register(new _At(a)),a.register(new LAt(a)),a.register(new HAt(a)),a.register(new SAt(a)),a.register(new $At(a)),a.register(new GAt(a)),a.register(new MAt(a)),a.register(new BAt(a)),a.register(new FAt(a)),a.register(new kAt(a)),a.register(new UAt(a)),a.register(new KAt(a)),a.register(new jAt(a)),a.register(new qAt(a)),a.register(new ZAt(a)),a.register(new WAt(a)),a.register(new YAt(a)),a.register(new JAt(a)),a.register(new QAt(a)),a.register(new XAt(a)),a.register(new e1t(a)),a.register(new t1t(a)),a.register(new i1t(a)),a.register(new W1t(a)),a.register(new n1t(a)),a.register(new r1t(a)),a.register(new g1t(a)),a.register(new a1t(a)),a.register(new s1t(a)),a.register(new l1t(a)),a.register(new o1t(a)),a.register(new d1t(a)),a.register(new p1t(a)),a.register(new u1t(a)),a.register(new c1t(a)),a.register(new f1t(a)),a.register(new h1t(a)),a.register(new m1t(a)),a.register(new T1t(a)),a.register(new v1t(a)),a.register(new b1t(a)),a.register(new H1t(a)),a.register(new I1t(a)),a.register(new V1t(a)),a.register(new w1t(a)),a.register(new x1t(a)),a.register(new C1t(a)),a.register(new $1t(a)),a.register(new E1t(a)),a.register(new R1t(a)),a.register(new G1t(a)),a.register(new _1t(a)),a.register(new B1t(a)),a.register(new S1t(a)),a.register(new M1t(a)),a.register(new F1t(a)),a.register(new k1t(a)),a.register(new U1t(a)),a.register(new K1t(a)),a.register(new j1t(a)),a.register(new q1t(a)),a.register(new Z1t(a)),a.register(new D1t(a)),a.register(new A1t(a)),a.register(new O1t(a)),a.register(new L1t(a)),a.register(new N1t(a)),a.register(new P1t(a)),a.register(new xAt(a)),a.register(new OAt(a)),a.register(new sAn(a)),a.register(new yAn(a)),a.register(new TAn(a)),a.register(new bAn(a)),a.register(new RAn(a)),a.register(new CAn(a)),a.register(new PAn(a)),a.register(new _An(a)),a.register(new $An(a)),a.register(new GAn(a)),a.register(new UAn(a)),a.register(new ZAn(a))}class j4{constructor(p=new pe.Events("extensions-registry-fallback-events")){C(this,"extensionsRegistry",new Map);C(this,"commandsRegistryMap",new Map);C(this,"commandsListCache",null);C(this,"initialized",new Set);C(this,"initializedContexts",new Set);C(this,"onResolveEditorContextCallback",()=>null);C(this,"onResolveProjectLogicContextCallback",()=>null);C(this,"onResolveEditorGUIContextCallback",()=>null);C(this,"onResolveGUIContextCallback",()=>null);C(this,"onResolveCompileContextCallback",()=>null);C(this,"onResolvePublicationRunContextCallback",()=>null);this.events=p,this.off=this.events.off.bind(this.events),this.on=this.events.on.bind(this.events),this.emit=this.events.emit.bind(this.events),this.emitAsync=this.events.emitAsync.bind(this.events),this.emitAsyncAll=this.events.emitAsyncAll.bind(this.events),this.emitAsyncAllSettled=this.events.emitAsyncAllSettled.bind(this.events),this.emitAsyncSequentially=this.events.emitAsyncSequentially.bind(this.events),this.emitAsyncSequentiallyAll=this.events.emitAsyncSequentiallyAll.bind(this.events),this.emitAsyncSequentiallyAllSettled=this.events.emitAsyncSequentiallyAllSettled.bind(this.events)}onResolveEditorContext(p){this.onResolveEditorContextCallback=p}onResolveProjectLogicContext(p){this.onResolveProjectLogicContextCallback=p}onResolveGUIContext(p){this.onResolveGUIContextCallback=p}onResolveEditorGUIContext(p){this.onResolveEditorGUIContextCallback=p}onResolveCompileContext(p){this.onResolveCompileContextCallback=p}onResolvePublicationRunContext(p){this.onResolvePublicationRunContextCallback=p}get extensionInOrder(){return Array.from(this.extensionsRegistry.values()).sort((p,t)=>(p.manifest.initPriority||_e.Normal)-(t.manifest.initPriority||_e.Normal))}async setup(){HAn(this),pe.Logger.log("Initializing extensions without context..."),this.initForReady()}requestContext(p){switch(p){case te.Editor:return this.onResolveEditorContextCallback();case te.Logic:return this.onResolveProjectLogicContextCallback();case te.EditorGUI:return this.onResolveEditorGUIContextCallback();case te.Compile:return this.onResolveCompileContextCallback();case te.PublicationRun:return this.onResolvePublicationRunContextCallback();case te.GUI:return this.onResolveGUIContextCallback();case te.EditorGUI:return this.onResolveEditorGUIContextCallback();default:throw new Error(`Unknown context type: ${p}`)}}requestContexts(p,t=[]){const n=[];t.length===0&&(t=p.manifest.contexts);for(const s of t){const u=this.requestContext(s);u&&n.push(u)}return n}requestExtension(p){const t=this.extensionsRegistry.get(p);if(t)return t;throw new Error(`Unknown extension: ${p}`)}register(p){if(this.extensionsRegistry.set(p.manifest.id,p),p.command){const t=p.command.command||p.command.name;t&&(this.commandsRegistryMap.set(t.toLowerCase(),p),this.commandsListCache=null)}}getCommands(p){if(this.commandsListCache||(this.commandsListCache=Array.from(this.commandsRegistryMap.values())),!p)return this.commandsListCache;const{contextType:t,globalOnly:n}=p;return this.commandsListCache.filter(s=>{var u;return n?!s.manifest.contexts||s.manifest.contexts.length===0:t?(u=s.manifest.contexts)==null?void 0:u.includes(t):!0})}async initAll(){for(const p of this.extensionInOrder){if(this.initialized.has(p.manifest.id))continue;const t=this.requestContexts(p);p.manifest.contexts.every(s=>!!t.find(u=>u.contextType===s))&&(p.module.init&&await p.module.init(t),this.initialized.add(p.manifest.id))}}async initForReady(){pe.Logger.log("Initializing extensions for ready contexts...");for(const p of this.extensionInOrder){if(this.initialized.has(p.manifest.id))continue;const t=this.requestContexts(p);p.manifest.contexts.every(s=>!!t.find(u=>u.contextType===s))?(p.module.init?(pe.Logger.debug("Initializing "+p.manifest.id+" extension..."),await p.module.init(t)):pe.Logger.log("Set "+p.manifest.id+" extension as ready (no init method)..."),this.initialized.add(p.manifest.id)):pe.Logger.warn(`Skipping initialization of ${p.manifest.id} extension, not all contexts are ready.`,`Required contexts: ${p.manifest.contexts.join(", ")}`,`Available contexts: ${t.map(s=>s.contextType).join(", ")}`)}}async destroyAll(){for(const p of[...this.extensionInOrder].reverse())p.module.destroy&&await p.module.destroy();this.events.destroy()}on(p,t){this.events.on(p,t)}emit(p,...t){this.events.emit(p,...t)}off(p,t){this.events.off(p,t)}emitAsync(p,...t){return this.events.emitAsync(p,...t)}emitAsyncAll(p,...t){return this.events.emitAsyncAll(p,...t)}emitAsyncAllSettled(p,...t){return this.events.emitAsyncAllSettled(p,...t)}emitAsyncSequentially(p,...t){return this.events.emitAsyncSequentially(p,...t)}emitAsyncSequentiallyAll(p,...t){return this.events.emitAsyncSequentiallyAll(p,...t)}emitAsyncSequentiallyAllSettled(p,...t){return this.events.emitAsyncSequentiallyAllSettled(p,...t)}async contextAvailable(p){if(this.initializedContexts.has(p)){pe.Logger.warn(`Context ${p} is already initialized. Skipping re-initialization.`);return}switch(this.initializedContexts.add(p),p){case te.Editor:{if(!this.onResolveEditorContextCallback)throw new Error("No editor context resolver callback set. Call onResolveEditorContext first.");break}case te.Logic:{if(!this.onResolveProjectLogicContextCallback)throw new Error("No project logic context resolver callback set. Call onResolveProjectLogicContext first.");break}}pe.Logger.log(`Context ${p} is now available. Initializing extensions for this context...`),await this.initForReady()}getValueTypePreference(p){return window.localStorage.getItem("dynamic-value-type-preference--"+p)||null}setValueTypePreference(p,t){window.localStorage.setItem("dynamic-value-type-preference--"+p,(t==null?void 0:t.toString())||""),this.emit(p,{})}}let Tw=null;const q4={requestExtension:a=>(Tw||(Tw=new j4,Tw.setup()),Tw.requestExtension(a))};function Eh(a){return!(a instanceof Error)&&typeof a=="object"&&a!==null?a:a instanceof Error?{name:a.name,message:a.message,stack:a.stack,...a}:a}function G5(a){var p,t,n;if(a&&typeof a=="object"&&"value"in a){const s=a;return{single:((p=s.value)==null?void 0:p.valueAsTypeSingle)??((t=s.value)==null?void 0:t.value),list:((n=s.value)==null?void 0:n.valueAsTypeList)??null}}return{single:a,list:Array.isArray(a)?a:null}}const Ih={onBeforeEntityExecution:async()=>{},onEntityExecuted:async()=>{}};class r2 extends Error{constructor(){super("Execution was stopped"),this.name="ExecutionStoppedError"}}var Z4=(a=>(a.FinishedSuccess="finished-success",a.FinishedError="finished-error",a.Running="running",a.Paused="paused",a.Stopped="stopped",a.NotStarted="not-started",a))(Z4||{});const mDt={...q4,getValueTypePreference:()=>null,setValueTypePreference:()=>{}};class vg extends pe.Events{constructor(t,n,s,u=null,e=mDt){super();C(this,"project");C(this,"entryPoint");C(this,"state","not-started");C(this,"events",new pe.Events("fe-exec-inst-events"));C(this,"entities",[]);C(this,"parentExecution",null);C(this,"executing",[]);C(this,"executed",[]);C(this,"skipped",[]);C(this,"scheduled",[]);C(this,"localTestValues");C(this,"resolvedValues");C(this,"persistedExecutionResults");C(this,"lastExecutionResults");C(this,"onAddToSkippedListCallback",null);C(this,"onRemoveFromSkippedListCallback",null);C(this,"onAddEntityCallback",null);C(this,"onRemoveEntityCallback",null);C(this,"onAbortExecutionCallback",null);this.parentContext=e,this.entities=n,this.entryPoint=s,this.project=t,this.parentExecution=u,this.localTestValues=new NR(M.UUID.uuid(),this.project),this.resolvedValues=new NR(M.UUID.uuid(),this.project),this.persistedExecutionResults=new NR(M.UUID.uuid(),this.project),this.lastExecutionResults=new NR(M.UUID.uuid(),this.project)}get valueResolutionContext(){return{execution:this,project:this.project,localTestValues:this.localTestValues,resolvedValues:this.resolvedValues,persistedExecutionResults:this.persistedExecutionResults,lastExecutionResults:this.lastExecutionResults,getValueTypePreference:this.parentContext.getValueTypePreference,setValueTypePreference:this.parentContext.setValueTypePreference}}get rootExecution(){let t=this;for(;t.parentExecution;)t=t.parentExecution;return t}get rootState(){return this.rootExecution.state}isStopped(){return this.state==="stopped"||this.rootExecution.state==="stopped"}isPaused(){return this.state==="paused"||this.rootExecution.state==="paused"}async checkStateAndPause(){if(this.isStopped())throw new r2;for(;this.isPaused();){if(this.isStopped())throw new r2;await new Promise(t=>setTimeout(t,100))}}skip(t){this.hasEntity(t)&&(this.removeFromScheduledList(t),!this.skipped.includes(t)&&(this.skipped.push(t),this.onAddToSkippedListCallback&&this.onAddToSkippedListCallback(t),Pr.includes(t.type)&&ri(t).forEach(n=>this.skip(n))))}async schedule(t,n,s){if(this.hasExecuted(t))return null;if(Xi.includes(t.type))return this.executeBranch(t,s,n);if(Vr.includes(t.type)){if(t.calledBy.every(e=>this.hasExecuted(e)||!this.hasEntity(e)))return this.executeBranch(t,s,n);this.scheduled.includes(t)||this.scheduled.push(t)}return null}mergeExernalValuesWithInternalInputs(t,n){const s=[];return Yi.includes(n.type)?s.push(...n.inputs.filter(e=>vT(e))):[...Li,...Xi].includes(n.type)?s.push(...n.inputs):Ni.includes(n.type)&&s.push(...n.outputs.filter(e=>vT(e))),s.map(e=>{var y;let f=t.find(m=>m.valueOwner.id===e.id);if(f)return f;if(!f&&Xi.includes(n.type)&&(f=t.find(m=>{var T;return((T=m.valueOwner.declaration)==null?void 0:T.id)===e.id})),f){const m=(y=f.value)==null?void 0:y.clone(null);return m==null||m.setStandaloneParent(e,null),{...f,valueOwner:e,value:m||null,inheritanceLink:{sources:[f],target:e}}}return ls.includes(e.type)?Xp(e,this.valueResolutionContext):Qu(e,this.valueResolutionContext)}).reduce((e,f)=>{const y=uf(f==null?void 0:f.valueOwner,this.project),m=f?[f]:[];return y.forEach(T=>{var R,I,A;if(T.id===(f==null?void 0:f.valueOwner.id))return;const g=Pn(T.getDataType(null),T,this.project);g==null||g.metaSync({value:(R=f==null?void 0:f.value)==null?void 0:R.value},null),g==null||g.setValueAsTypeList(((I=f==null?void 0:f.value)==null?void 0:I.valueAsTypeList)||null),g==null||g.setValueAsTypeSingle(((A=f==null?void 0:f.value)==null?void 0:A.valueAsTypeSingle)||null);const b={...f,valueOwner:T,value:g};m.push(b)}),[...e,...m]},[]).sort((e,f)=>e.valueOwner.index-f.valueOwner.index)}inheritValuesFromContext(t){this.localTestValues=t.localTestValues,this.resolvedValues=t.resolvedValues,this.persistedExecutionResults=t.persistedExecutionResults}async executeInternalCall(t,n,s,u={}){var f,y;this.logBeforeExecution("executeInternalCall",t,n);const e={...Ih,...u};try{let m={value:K.Success,error:null,result:null};if(n.sort((A,x)=>A.valueOwner.index-x.valueOwner.index),Object.values(ja).includes(t.declaration.id)){const A=this.parentContext.requestExtension(vi+t.declaration.id).module.main;A?m=await A(t,n,this):pe.Logger.warn(`No implementation found for built-in function: ${t.declaration.id}`)}else{const A=await this.executeDetachedFullFunctionDeclarationLogic(t.declaration,n,s,e);m={value:A.value,error:A.error,result:A.result}}let T=null;if(m.error&&t.error){pe.Logger.warn("Raw error executing entity: ",m.error);const{single:A,list:x}=G5(m.error),P=Eh(A),O=(f=t.error)==null?void 0:f.getDataType(null),$=Pn(O||null,t.error,s);O!=null&&O.asType?x!==null?$==null||$.setValueAsTypeList(x):$==null||$.setValueAsTypeSingle(A):$==null||$.metaSync({value:P},null),T={valueOwner:t.error,type:rt.ExecutionResult,inheritanceLink:null,value:$}}const g=t==null?void 0:t.getDataType(null),b=Pn(g,t,s),{single:R,list:I}=G5(m.result);return g!=null&&g.asType?I!==null?b==null||b.setValueAsTypeList(I):b==null||b.setValueAsTypeSingle(R):b==null||b.metaSync({value:R},null),{value:m.value,entity:t,error:T,result:{value:b||null,valueOwner:t,type:rt.ExecutionResult,inheritanceLink:null}}}catch(m){if(m&&(m.name==="ExecutionStoppedError"||m.message==="Execution was stopped"))throw m;pe.Logger.warn("Internal call execution error: ",m);let T=null;if(t.error){const g=Eh(m),b=(y=t.error)==null?void 0:y.getDataType(null),R=Pn(b,t.error,s);b!=null&&b.asType?R==null||R.setValueAsTypeSingle(m):R==null||R.metaSync({value:g},null),T={valueOwner:t.error,type:rt.ExecutionResult,inheritanceLink:null,value:R}}return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,entity:t,error:T,result:null}}}static async executeOperation(t,n,s,u){var e,f;u?u.logBeforeExecution("executeOperation",t,n):console.log(`executeOperation (${t.type}) -> [${De(t,s)}] Inputs:${n.length?`
|
|
62
62
|
`:""}${n.map(y=>{var m,T,g;return`${(m=y.valueOwner)==null?void 0:m.type} (${(T=y.valueOwner)==null?void 0:T.id}) "${De(y.valueOwner,s)}": ${JSON.stringify((g=y.value)==null?void 0:g.value,null,2)}`}).join(`
|
|
63
63
|
`)}
|
|
64
64
|
`);try{let y={value:K.Success,error:null,result:null};n.sort((b,R)=>b.valueOwner.index-R.valueOwner.index),t.declaration.implementation&&(y=await t.declaration.implementation(t,n.sort((b,R)=>b.valueOwner.index-R.valueOwner.index)));let m=null;if(y.error&&t.error){const b=Eh(y.error),R=((e=t.error)==null?void 0:e.getDataType(null))||null,I=Pn(R,t.error,s);R!=null&&R.asType?I==null||I.setValueAsTypeSingle(y.error):I==null||I.metaSync({value:b},null),m={valueOwner:t.error,type:rt.ExecutionResult,inheritanceLink:null,value:I}}const T=t==null?void 0:t.getDataType(null),g=Pn(T,t,s);return T!=null&&T.asType?g==null||g.setValueAsTypeSingle(y.result):g==null||g.metaSync({value:y.result},null),{value:y.value,entity:t,error:m,result:{value:g||null,valueOwner:t,type:rt.ExecutionResult,inheritanceLink:null}}}catch(y){if(y&&(y.name==="ExecutionStoppedError"||y.message==="Execution was stopped"))throw y;console.warn("Operation execution error: ",y);let m=null;if(t.error){const T=Eh(y),g=(f=t.error)==null?void 0:f.getDataType(null),b=Pn(g,t.error,s);g!=null&&g.asType?b==null||b.setValueAsTypeSingle(y):b==null||b.metaSync({value:T},null),m={valueOwner:t.error,type:rt.ExecutionResult,inheritanceLink:null,value:b}}return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,entity:t,error:m,result:null}}}async executeSearch(t,n,s){var u;this.logBeforeExecution("executeSearch",t,n);try{let e={value:K.Success,error:null,result:null};const f=await(await this.parentContext.requestExtension(je.SEARCH_NODE_IMPLEMENTATION)).module.main(t,n),y=t==null?void 0:t.getDataType(null),m=Pn(y,t,s);return m==null||m.metaSync({value:f},null),f.error?{value:K.UnhandledError,entity:t,error:{valueOwner:t,type:rt.ExecutionResult,inheritanceLink:null,value:m},result:null}:{value:e.value,entity:t,error:null,result:{value:m,valueOwner:t,type:rt.ExecutionResult,inheritanceLink:null}}}catch(e){if(e&&(e.name==="ExecutionStoppedError"||e.message==="Execution was stopped"))throw e;if(pe.Logger.warn(`Search node execution error: ${e}`),!t.error)return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,entity:t,error:null,result:null};const f=Eh(e),y=(u=t.error)==null?void 0:u.getDataType(null),m=Pn(y,t.error,s);return m==null||m.metaSync({value:f},null),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,entity:t,error:{valueOwner:t.error,type:rt.ExecutionResult,inheritanceLink:null,value:m},result:null}}}async executeLoop(t,n,s,u={}){var f,y,m,T,g,b,R,I,A,x,P,O,$,U,Z,j,H;this.logBeforeExecution("executeLoop",t,n);const e={...Ih,...u};try{let Y={value:K.Success,error:null,result:null};const ie=n.map(ae=>{var le,oe;return((le=ae==null?void 0:ae.value)==null?void 0:le.valueAsType)||((oe=ae==null?void 0:ae.value)==null?void 0:oe.value)});let W={};const z=t.body.inputs.find(ae=>ae!==t.currentIterationNumberArgumentDeclaration&&ae!==t.currentValueArgumentDeclaration);if(z){const ae=z,le=Pn(ae.getDataType(null),ae,s);le==null||le.metaSync({value:((f=ae.defaultValue)==null?void 0:f.value)||null},null),W[ae.id]={value:le||null,valueOwner:ae,type:rt.ExecutionResult,inheritanceLink:null}}let J={value:K.Success,entity:t.body,error:null,result:null};switch(t.declaration.id){case G.loop["counted-loop"].id:{const ae=ie[0];let le=1;for(;le<=ae&&le<=1e3;){await this.checkStateAndPause();const oe=t.body.inputs.map(ce=>{if(ce===t.currentIterationNumberArgumentDeclaration){const be=t.currentIterationNumberArgumentDeclaration.getDataType(null),Ce=ly(be),Ee=this.lastExecutionResults.readValue(ce.id);if(Ee){Ee.metaSync({value:le},null);const tt=Xr(Ee,ce);this.lastExecutionResults.writeValue(ce,tt);const We={value:tt,valueOwner:t.currentIterationNumberArgumentDeclaration,type:rt.ExecutionResult,inheritanceLink:null};return W[ce.id]=We,We}const xe={id:M.UUID.uuid(),deletable:!0,editable:!0,type:r.LiteralValue,autogeneration:null,version:M.UUID.uuid(),createdAt:new Date().toISOString(),author:M.sessionAuthor,deleted:!1,previousVersion:null,value:le,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:Ce,standaloneParent:ce.toReference()},Le=Zr(xe,s);this.lastExecutionResults.writeValue(ce,Le);const Fe={value:Le,valueOwner:t.currentIterationNumberArgumentDeclaration,type:rt.ExecutionResult,inheritanceLink:null};return W[ce.id]=Fe,Fe}else return W[ce.id]}).filter(ce=>!!ce);if(J=await this.executeFullFunctionDeclarationLogic(t.body,oe,e),J!=null&&J.result&&J.value!==K.Return){const ce=t.body.inputs.find(be=>be!==t.currentIterationNumberArgumentDeclaration&&be!==t.currentValueArgumentDeclaration);if(ce){let be=(y=J.result.value)==null?void 0:y.value;be===void 0&&(be=null),(m=W[ce.id].value)==null||m.metaSync({value:be},null);const Ce=Xr(W[ce.id].value,ce);this.lastExecutionResults.writeValue(ce,Ce)}}if([K.CaughtError,K.UnhandledError,K.Break,K.Return].includes(J.value))break;le++}break}case G.loop["manual-flow-loop"].id:{let ae=1;for(;ae<=50;){await this.checkStateAndPause();const le=t.body.inputs.map(oe=>{if(oe===t.currentIterationNumberArgumentDeclaration){const ce=this.lastExecutionResults.readValue(oe.id);if(ce){ce.metaSync({value:ae},null);const xe=Xr(ce,oe);this.lastExecutionResults.writeValue(oe,xe);const Le={value:xe,valueOwner:oe,type:rt.ExecutionResult,inheritanceLink:null};return W[oe.id]=Le,Le}const be=t.currentIterationNumberArgumentDeclaration.getDataType(null),Ce=Pn(be,oe,s);return Ce==null||Ce.metaSync({value:ae},null),this.lastExecutionResults.writeValue(oe,Ce),{value:Ce,valueOwner:oe,type:rt.ExecutionResult,inheritanceLink:null}}else return W[oe.id]}).filter(oe=>!!oe);if(J=await this.executeFullFunctionDeclarationLogic(t.body,le,e),J!=null&&J.result&&J.value!==K.Return){const oe=t.body.inputs.find(ce=>ce!==t.currentIterationNumberArgumentDeclaration&&ce!==t.currentValueArgumentDeclaration);if(oe){let ce=(T=J.result.value)==null?void 0:T.value;ce===void 0&&(ce=null),(g=W[oe.id].value)==null||g.metaSync({value:ce},null);const be=Xr(W[oe.id].value,oe);this.lastExecutionResults.writeValue(oe,be)}}if([K.CaughtError,K.UnhandledError,K.Break,K.Return].includes(J.value))break;ae++}break}case G.loop["list-loop"].id:{const ae=ie[0];let le=1;const oe=ae;for(let ce=0;ce<oe.length;ce++){await this.checkStateAndPause();const be=oe[ce],Ce=t.body.inputs.map(Ee=>{if(Ee===t.currentIterationNumberArgumentDeclaration){const xe=this.lastExecutionResults.readValue(Ee.id);if(xe){xe.metaSync({value:le},null);const We=Xr(xe,Ee);return this.lastExecutionResults.writeValue(Ee,We),{value:We,valueOwner:Ee,type:rt.ExecutionResult,inheritanceLink:null}}const Le=t.currentIterationNumberArgumentDeclaration.getDataType(null),Fe=Pn(Le,Ee,s);return Fe==null||Fe.metaSync({value:le},null),this.lastExecutionResults.writeValue(Ee,Fe),{value:Fe,valueOwner:t.currentIterationNumberArgumentDeclaration,type:rt.ExecutionResult,inheritanceLink:null}}else if(Ee===t.currentValueArgumentDeclaration){const xe=t.currentValueArgumentDeclaration.getDataType(null),Le=ly(xe),Fe=this.lastExecutionResults.readValue(Ee.id);if(Fe){Fe.metaSync({value:be},null);const qe=Xr(Fe,Ee);return this.lastExecutionResults.writeValue(Ee,qe),{value:qe,valueOwner:Ee,type:rt.ExecutionResult,inheritanceLink:null}}const tt={id:M.UUID.uuid(),deletable:!0,editable:!0,type:r.LiteralValue,autogeneration:null,version:M.UUID.uuid(),createdAt:new Date().toISOString(),author:M.sessionAuthor,deleted:!1,previousVersion:null,value:be,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:Le,standaloneParent:Ee.toReference()},We=Zr(tt,s);return this.lastExecutionResults.writeValue(Ee,We),{value:We,valueOwner:t.currentValueArgumentDeclaration,type:rt.ExecutionResult,inheritanceLink:null}}else return W[Ee.id]}).filter(Ee=>!!Ee);if(J=await this.executeFullFunctionDeclarationLogic(t.body,Ce,e),J!=null&&J.result&&J.value!==K.Return){const Ee=t.body.inputs.find(xe=>xe!==t.currentIterationNumberArgumentDeclaration&&xe!==t.currentValueArgumentDeclaration);if(Ee){let xe=(b=J.result.value)==null?void 0:b.value;xe===void 0&&(xe=null),(R=W[Ee.id].value)==null||R.metaSync({value:xe},null);const Le=Xr(W[Ee.id].value,Ee);this.lastExecutionResults.writeValue(Ee,Le)}}if([K.CaughtError,K.UnhandledError,K.Break,K.Return].includes(J.value))break;le++}break}case G.loop["object-keys-loop"].id:{const ae=ie[0];let le=1;const oe=ae?Object.keys(ae):[];for(let ce=0;ce<oe.length;ce++){await this.checkStateAndPause();const be=oe[ce],Ce=t.body.inputs.map(Ee=>{if(Ee===t.currentIterationNumberArgumentDeclaration){const xe=this.lastExecutionResults.readValue(Ee.id);if(xe){xe.metaSync({value:le},null);const We=Xr(xe,Ee);return this.lastExecutionResults.writeValue(Ee,We),{value:We,valueOwner:Ee,type:rt.ExecutionResult,inheritanceLink:null}}const Le=t.currentIterationNumberArgumentDeclaration.getDataType(null),Fe=Pn(Le,Ee,s);return Fe==null||Fe.metaSync({value:le},null),this.lastExecutionResults.writeValue(Ee,Fe),{value:Fe,valueOwner:t.currentIterationNumberArgumentDeclaration,type:rt.ExecutionResult,inheritanceLink:null}}else if(Ee===t.currentValueArgumentDeclaration){const xe=t.currentValueArgumentDeclaration.getDataType(null),Le=ly(xe),Fe=this.lastExecutionResults.readValue(Ee.id);if(Fe){Fe.metaSync({value:be},null);const qe=Xr(Fe,Ee);return this.lastExecutionResults.writeValue(Ee,qe),{value:Fe,valueOwner:Ee,type:rt.ExecutionResult,inheritanceLink:null}}const tt={id:M.UUID.uuid(),deletable:!0,editable:!0,type:r.LiteralValue,autogeneration:null,version:M.UUID.uuid(),createdAt:new Date().toISOString(),author:M.sessionAuthor,deleted:!1,previousVersion:null,value:be,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:Le,standaloneParent:Ee.toReference()},We=Zr(tt,s);return this.lastExecutionResults.writeValue(Ee,We),{value:We,valueOwner:t.currentValueArgumentDeclaration,type:rt.ExecutionResult,inheritanceLink:null}}else return W[Ee.id]}).filter(Ee=>!!Ee);if(J=await this.executeFullFunctionDeclarationLogic(t.body,Ce,e),J!=null&&J.result&&J.value!==K.Return){const Ee=t.body.inputs.find(xe=>xe!==t.currentIterationNumberArgumentDeclaration&&xe!==t.currentValueArgumentDeclaration);if(Ee){let xe=(I=J.result.value)==null?void 0:I.value;xe===void 0&&(xe=null),(A=W[Ee.id].value)==null||A.metaSync({value:xe},null);const Le=Xr(W[Ee.id].value,Ee);this.lastExecutionResults.writeValue(Ee,Le)}}if([K.CaughtError,K.UnhandledError,K.Break,K.Return].includes(J.value))break;le++}break}case G.loop["object-values-loop"].id:{const ae=ie[0];let le=1;const oe=ae?Object.values(ae):[];for(let ce=0;ce<oe.length;ce++){await this.checkStateAndPause();const be=oe[ce],Ce=t.body.inputs.map(Ee=>{if(Ee===t.currentIterationNumberArgumentDeclaration){const xe=this.lastExecutionResults.readValue(Ee.id);if(xe){xe.metaSync({value:le},null);const We=Xr(xe,Ee);return this.lastExecutionResults.writeValue(Ee,We),{value:We,valueOwner:Ee,type:rt.ExecutionResult,inheritanceLink:null}}const Le=t.currentIterationNumberArgumentDeclaration.getDataType(null),Fe=Pn(Le,Ee,s);return Fe==null||Fe.metaSync({value:le},null),this.lastExecutionResults.writeValue(Ee,Fe),{value:Fe,valueOwner:t.currentIterationNumberArgumentDeclaration,type:rt.ExecutionResult,inheritanceLink:null}}else if(Ee===t.currentValueArgumentDeclaration){const xe=t.currentValueArgumentDeclaration.getDataType(null),Le=ly(xe),Fe=this.lastExecutionResults.readValue(Ee.id);if(Fe){Fe.metaSync({value:be},null);const qe=Xr(Fe,Ee);return this.lastExecutionResults.writeValue(Ee,qe),{value:Fe,valueOwner:Ee,type:rt.ExecutionResult,inheritanceLink:null}}const tt={id:M.UUID.uuid(),deletable:!0,editable:!0,type:r.LiteralValue,autogeneration:null,version:M.UUID.uuid(),createdAt:new Date().toISOString(),author:M.sessionAuthor,deleted:!1,previousVersion:null,value:be,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:Le,standaloneParent:Ee.toReference()},We=Zr(tt,s);return this.lastExecutionResults.writeValue(Ee,We),{value:We,valueOwner:t.currentValueArgumentDeclaration,type:rt.ExecutionResult,inheritanceLink:null}}else return W[Ee.id]}).filter(Ee=>!!Ee);if(J=await this.executeFullFunctionDeclarationLogic(t.body,Ce,e),J!=null&&J.result&&J.value!==K.Return){const Ee=t.body.inputs.find(xe=>xe!==t.currentIterationNumberArgumentDeclaration&&xe!==t.currentValueArgumentDeclaration);if(Ee){let xe=(x=J.result.value)==null?void 0:x.value;xe===void 0&&(xe=null),(P=W[Ee.id].value)==null||P.metaSync({value:xe},null);const Le=Xr(W[Ee.id].value,Ee);this.lastExecutionResults.writeValue(Ee,Le)}}if([K.CaughtError,K.UnhandledError,K.Break,K.Return].includes(J.value))break;le++}break}case G.loop["string-loop"].id:{const ae=ie[0];let le=1;const oe=ae.split("");for(let ce=0;ce<oe.length;ce++){await this.checkStateAndPause();const be=oe[ce],Ce=t.body.inputs.map(Ee=>{if(Ee===t.currentIterationNumberArgumentDeclaration){const xe=this.lastExecutionResults.readValue(Ee.id);if(xe){xe.metaSync({value:le},null);const We=Xr(xe,Ee);return this.lastExecutionResults.writeValue(Ee,We),{value:We,valueOwner:Ee,type:rt.ExecutionResult,inheritanceLink:null}}const Le=t.currentIterationNumberArgumentDeclaration.getDataType(null),Fe=Pn(Le,Ee,s);return Fe==null||Fe.metaSync({value:le},null),this.lastExecutionResults.writeValue(Ee,Fe),{value:Fe,valueOwner:t.currentIterationNumberArgumentDeclaration,type:rt.ExecutionResult,inheritanceLink:null}}else if(Ee===t.currentValueArgumentDeclaration){const xe=t.currentValueArgumentDeclaration.getDataType(null),Le=ly(xe),Fe=this.lastExecutionResults.readValue(Ee.id);if(Fe){Fe.metaSync({value:be},null);const qe=Xr(Fe,Ee);return this.lastExecutionResults.writeValue(Ee,qe),{value:qe,valueOwner:Ee,type:rt.ExecutionResult,inheritanceLink:null}}const tt={id:M.UUID.uuid(),deletable:!0,editable:!0,type:r.LiteralValue,autogeneration:null,version:M.UUID.uuid(),createdAt:new Date().toISOString(),author:M.sessionAuthor,deleted:!1,previousVersion:null,value:be,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:Le,standaloneParent:Ee.toReference()},We=Zr(tt,s);return this.lastExecutionResults.writeValue(Ee,We),{value:We,valueOwner:t.currentValueArgumentDeclaration,type:rt.ExecutionResult,inheritanceLink:null}}else return W[Ee.id]}).filter(Ee=>!!Ee);if(J=await this.executeFullFunctionDeclarationLogic(t.body,Ce,e),(J.results||[]).forEach(Ee=>{var We,et,qe;if(Ee.valueOwner.type!==r.InputMap||Ni.includes(Ee.valueOwner.parent.type))return;const xe=t.body.inputs.find(ot=>De(ot,s)===De(Ee.valueOwner,s)),Fe=[...(We=W[xe.id].value)==null?void 0:We.value,((et=Ee.value)==null?void 0:et.value)||null];(qe=W[xe.id].value)==null||qe.metaSync({value:Fe},null);const tt=Xr(W[xe.id].value,xe);this.lastExecutionResults.writeValue(xe,tt)}),[K.CaughtError,K.UnhandledError,K.Break,K.Return].includes(J.value))break;le++}break}}let ee=K.Success;if(J.value===K.UnhandledError?t.catchesError||t.errorCalls.length?ee=K.CaughtError:ee=K.UnhandledError:[K.CaughtError,K.Return].includes(J.value)&&(ee=J.value),Y={value:ee,error:(($=(O=J.error)==null?void 0:O.value)==null?void 0:$.value)||null,result:((Z=(U=J==null?void 0:J.result)==null?void 0:U.value)==null?void 0:Z.value)||null},Y.value===K.UnhandledError||Y.value===K.CaughtError){let ae=null;if(t.error){const le=Eh(Y.error),oe=(j=t.error)==null?void 0:j.getDataType(null),ce=Pn(oe||null,t.error,s);oe!=null&&oe.asType?ce==null||ce.setValueAsTypeSingle(Y.error):ce==null||ce.metaSync({value:le},null),ae={valueOwner:t.error,type:rt.ExecutionResult,inheritanceLink:null,value:ce}}return{value:Y.value,entity:t,error:ae,result:null}}const Q=t==null?void 0:t.getDataType(null),re=Pn(Q,t,s);return Q!=null&&Q.asType?re==null||re.setValueAsTypeSingle(Y.result):re==null||re.metaSync({value:Y.result},null),{value:Y.value,entity:t,error:null,result:{value:re||null,valueOwner:t,type:rt.ExecutionResult,inheritanceLink:null}}}catch(Y){if(Y&&(Y.name==="ExecutionStoppedError"||Y.message==="Execution was stopped"))throw Y;if(pe.Logger.warn("Error executing loop: ",Y),t.error){const ie=Eh(Y),W=(H=t.error)==null?void 0:H.getDataType(null),z=Pn(W,t.error,s);return W!=null&&W.asType?z==null||z.setValueAsTypeSingle(Y):z==null||z.metaSync({value:ie},null),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,entity:t,error:{valueOwner:t.error,type:rt.ExecutionResult,inheritanceLink:null,value:z},result:null}}else return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,entity:t,error:null,result:null}}}async executeFunctionCall(t,n,s,u={}){var f,y,m,T,g,b,R,I,A,x,P,O,$,U,Z,j,H,Y,ie,W,z,J,ee,Q,re,ae;const e={...Ih,...u};try{this.logBeforeExecution("executeFunctionCall",t,n);const le=await this.executeDetachedFullFunctionDeclarationLogic(t.declaration,n,s,e);let oe=null;if(le.error&&t.error){pe.Logger.warn("Raw error executing entity: ",le.error);const Ee=(f=t.error)==null?void 0:f.getDataType(null),xe=Pn(Ee||null,t.error,s);Ee!=null&&Ee.asType?(m=(y=le.error)==null?void 0:y.value)!=null&&m.valueAsTypeSingle?xe==null||xe.setValueAsTypeSingle((g=(T=le.error)==null?void 0:T.value)==null?void 0:g.valueAsTypeSingle):(R=(b=le.error)==null?void 0:b.value)!=null&&R.valueAsTypeList&&Array.isArray((A=(I=le.error)==null?void 0:I.value)==null?void 0:A.valueAsTypeList)&&(xe==null||xe.setValueAsTypeList((P=(x=le.error)==null?void 0:x.value)==null?void 0:P.valueAsTypeList)):xe==null||xe.metaSync({value:($=(O=le.error)==null?void 0:O.value)==null?void 0:$.value},null),oe={valueOwner:t.error,type:rt.ExecutionResult,inheritanceLink:null,value:xe}}let ce=K.Success;le.value===K.UnhandledError&&(t.catchesError||t.errorCalls.length?ce=K.CaughtError:ce=K.UnhandledError);const be=t==null?void 0:t.getDataType(null),Ce=Pn(be,t,s);return be!=null&&be.asType?(Z=(U=le.result)==null?void 0:U.value)!=null&&Z.valueAsTypeSingle?Ce==null||Ce.setValueAsTypeSingle((H=(j=le.result)==null?void 0:j.value)==null?void 0:H.valueAsTypeSingle):(ie=(Y=le.result)==null?void 0:Y.value)!=null&&ie.valueAsTypeList&&Array.isArray((z=(W=le.result)==null?void 0:W.value)==null?void 0:z.valueAsTypeList)&&(Ce==null||Ce.setValueAsTypeList((ee=(J=le.result)==null?void 0:J.value)==null?void 0:ee.valueAsTypeList)):Ce==null||Ce.metaSync({value:((re=(Q=le.result)==null?void 0:Q.value)==null?void 0:re.value)||null},null),{value:ce,entity:t,error:oe,result:{value:Ce||null,valueOwner:t,type:rt.ExecutionResult,inheritanceLink:null}}}catch(le){if(le&&(le.name==="ExecutionStoppedError"||le.message==="Execution was stopped"))throw le;if(!t.error)return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,entity:t,error:null,result:null};const oe=Eh(le),ce=(ae=t.error)==null?void 0:ae.getDataType(null),be=Pn(ce,t.error,s);return ce!=null&&ce.asType?be==null||be.setValueAsTypeSingle(le):be==null||be.metaSync({value:oe},null),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,entity:t,error:{valueOwner:t.error,type:rt.ExecutionResult,inheritanceLink:null,value:be},result:null}}}async executeCondition(t,n){var u,e,f,y;this.logBeforeExecution("executeCondition",t,n);let s=!1;switch(t.declaration.id){case qs.BooleanIsTrue:{const m=(e=(u=n[0])==null?void 0:u.value)==null?void 0:e.value;if(typeof m!="boolean")throw new TypeError("BooleanIsTrue expects a boolean input.");s=m===!0;break}case qs.BooleanIsFalse:{const m=(y=(f=n[0])==null?void 0:f.value)==null?void 0:y.value;if(typeof m!="boolean")throw new TypeError("BooleanIsFalse expects a boolean input.");s=m===!1;break}case $a.And:{s=(await Promise.all(t.andChildrenGroup.map(async T=>{const g=this.mergeExernalValuesWithInternalInputs(n,T);return(await this.executeCondition(T,g)).value===K.Success}))).every(T=>T);break}case $a.Or:{s=(await Promise.all(t.orChildrenGroup.map(async T=>{const g=this.mergeExernalValuesWithInternalInputs(n,T);return(await this.executeCondition(T,g)).value===K.Success}))).some(T=>T);break}default:throw new Error(`Condition declaration ${t.declaration.name} does not have an implementation.`)}return{value:s?K.Success:K.ConditionNotMet,entity:t,error:null,result:null}}async executeDetachedFullFunctionDeclarationLogic(t,n,s,u={}){this.logBeforeExecution("executeDetachedFullFunctionDeclarationLogic",t,n);const e={...Ih,...u,onBeforeEntityExecution:(m,T,g)=>{var b;return((b=u==null?void 0:u.onBeforeEntityExecution)==null?void 0:b.call(u,m,T,{...g,detached:!0}))||Promise.resolve()},onEntityExecuted:(m,T,g)=>{var b;return((b=u==null?void 0:u.onEntityExecuted)==null?void 0:b.call(u,m,T,{...g,detached:!0}))||Promise.resolve()}},f=new vg(s,[t,...Rx(t)],t,this,this.parentContext);return f.inheritValuesFromContext(this),await f.execute(e,n)}async executeFullFunctionDeclarationLogic(t,n,s={}){this.logBeforeExecution("executeFullFunctionDeclarationLogic",t,n);const u={...Ih,...s},e=Rx(t),f=[];e.forEach(T=>{if(T.type===r.VariableDeclaration||T.type===r.VariableInstance){const g=T;g.internalCalls&&f.push(...g.internalCalls)}}),e.push(...f),console.log(`[executeFullFunctionDeclarationLogic] Reseting children for: ${De(t,this.project)}
|