@elyx-code/project-logic-tree 0.0.7218 → 0.0.7219

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -58,7 +58,7 @@ This is likely an incorrect strategy, either the '${this.type}' entity doesn't n
58
58
  `)),!p.includes(" ")&&/\\t/.test(p)&&(p=p.replace(/\\t/g," ")),p=p.replace(/\r\n/g,`
59
59
  `).replace(/\r/g,`
60
60
  `),p=p.replace(/\n/g,`\r
61
- `),p}class _At extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.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:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.GoogleDriveUploadFile);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A,O,P,x,$,U,q,Z,H,W,ie,z,Y,ee,J;try{const te=this.extensionsRegistry.requestContexts(this,[X.Editor])[0],re=Be(t,t.project,"uploadFile"),le="["+Ve(t,t.project,"Upload Google Drive File")+": `"+re+"`] ",oe=G.operation[Q.GoogleDriveUploadFile],ce=n.find(kt=>{var Ct,xi;return((xi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:xi.id)===oe.inputs.connection.id}),ge=((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(!ge||!ge.id||!ge.name||ge.type!==r.DefinitionEntity)throw new Error(`${le}Invalid input "${Ve(ce==null?void 0:ce.valueOwner,te==null?void 0:te.logic,"Connection")}" (\`${Be(ce==null?void 0:ce.valueOwner,te==null?void 0:te.logic,"connection")}\`), expected a valid connection node.`);const Ce=n.find(kt=>{var Ct,xi;return((xi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:xi.id)===oe.inputs.content.id}),Ee=((e=Ce==null?void 0:Ce.value)==null?void 0:e.valueAsType)??((f=Ce==null?void 0:Ce.value)==null?void 0:f.value),Oe=n.find(kt=>{var Ct,xi;return((xi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:xi.id)===oe.inputs.name.id}),Le=(m=(y=Oe==null?void 0:Oe.value)==null?void 0:y.value)==null?void 0:m.trim();if(!Le||Le==="")throw new Error(`${le}The "${Ve(Oe==null?void 0:Oe.valueOwner,te==null?void 0:te.logic,"File Name")}" (\`${Be(Oe==null?void 0:Oe.valueOwner,te==null?void 0:te.logic,"name")}\`) input is missing.`);const Fe=(((g=(T=n.find(kt=>{var Ct,xi;return((xi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:xi.id)===G.operation[Q.GoogleDriveUploadFile].inputs.mimeType.id}))==null?void 0:T.value)==null?void 0:g.valueAsType)??((R=(b=n.find(kt=>{var Ct,xi;return((xi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:xi.id)===G.operation[Q.GoogleDriveUploadFile].inputs.mimeType.id}))==null?void 0:b.value)==null?void 0:R.value))||"application/octet-stream",tt=(((A=(I=n.find(kt=>{var Ct,xi;return((xi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:xi.id)===G.operation[Q.GoogleDriveUploadFile].inputs.folderId.id}))==null?void 0:I.value)==null?void 0:A.valueAsType)??((P=(O=n.find(kt=>{var Ct,xi;return((xi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:xi.id)===G.operation[Q.GoogleDriveUploadFile].inputs.folderId.id}))==null?void 0:O.value)==null?void 0:P.value))||void 0,We=((($=(x=n.find(kt=>{var Ct,xi;return((xi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:xi.id)===G.operation[Q.GoogleDriveUploadFile].inputs.description.id}))==null?void 0:x.value)==null?void 0:$.valueAsType)??((q=(U=n.find(kt=>{var Ct,xi;return((xi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:xi.id)===G.operation[Q.GoogleDriveUploadFile].inputs.description.id}))==null?void 0:U.value)==null?void 0:q.value))||void 0,et=(((H=(Z=n.find(kt=>{var Ct,xi;return((xi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:xi.id)===G.operation[Q.GoogleDriveUploadFile].inputs.importMimeType.id}))==null?void 0:Z.value)==null?void 0:H.valueAsType)??((ie=(W=n.find(kt=>{var Ct,xi;return((xi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:xi.id)===G.operation[Q.GoogleDriveUploadFile].inputs.importMimeType.id}))==null?void 0:W.value)==null?void 0:ie.value))||"text/plain";if(!Le)return ay(t,"Missing required input: name");const qe=ui(ge),st={Authorization:`Bearer ${await te.getAccessToken()}`},ft=`${((z=te.env)==null?void 0:z.API_BASE_URL)+"/editor-runtime"}/v2/external-integrations/proxy/${te.projectId}/${Zt["google-drive"]}/${qe}`,Et=async(kt,Ct,{params:xi,body:wn,contentType:Yr,providerHeaders:Jr,responseType:hi}={})=>{const $t=`${ft}/${ZIn(Ct)}`,Nt={...st};return Yr&&(Nt["Content-Type"]=Yr),(Jr||hi)&&(Nt[qIn]=JSON.stringify({...Jr?{headers:Jr}:{},...hi?{responseType:hi}:{}})),Ht.request({method:kt,url:$t,params:xi,data:wn,responseType:hi||"json",headers:Nt})},pt=typeof Fe=="string"&&Fe.startsWith("application/vnd.google-apps.");if(pt&&(Ee==null||Ee==="")){const kt={name:Le,mimeType:Fe};tt&&(kt.parents=[tt]),typeof We=="string"&&(kt.description=We);const Ct=await Et("POST","/drive/v3/files",{params:{supportsAllDrives:"true",fields:_R},body:JSON.stringify(kt),contentType:"application/json"});return Ct.status!==200&&Ct.status!==201?ay(t,`Drive create failed (status=${Ct.status})`):WG({file:Ct.data})}if(pt&&Ee!=null){let kt=await WIn(Ee);const xi=((hi,$t)=>$t||(hi==="application/vnd.google-apps.spreadsheet"?"text/csv":hi==="application/vnd.google-apps.document"||hi==="application/vnd.google-apps.presentation"?"text/html":"text/plain"))(Fe,et),wn=xi.startsWith("text/")&&!/charset=/i.test(xi)?`${xi}; charset=UTF-8`:xi;xi.startsWith("text/csv")&&(kt=zIn(kt));const Yr=new TextEncoder().encode(kt);if(Yr.byteLength>v5)return ay(t,`Text body exceeds simple upload limit (${Yr.byteLength} bytes).`);let Jr;try{const hi=await Et("POST","/upload/drive/v3/files",{params:{uploadType:"media",supportsAllDrives:"true",fields:_R},body:Yr,contentType:wn});if(hi.status!==200&&hi.status!==201)return ay(t,`Drive media upload failed (status=${hi.status})`);if(Jr=(Y=hi.data)==null?void 0:Y.id,!Jr)return ay(t,"Drive media upload did not return an id");const $t={name:Le,mimeType:Fe};tt&&($t.parents=[tt]),typeof We=="string"&&($t.description=We);const Nt=await Et("POST",`/drive/v3/files/${encodeURIComponent(Jr)}/copy`,{params:{supportsAllDrives:"true",fields:_R},body:JSON.stringify($t),contentType:"application/json"});return Nt.status!==200&&Nt.status!==201?ay(t,`Drive copy-convert failed (status=${Nt.status})`):WG({file:Nt.data})}finally{if(Jr)try{await Et("DELETE",`/drive/v3/files/${encodeURIComponent(Jr)}`,{params:{supportsAllDrives:"true"}})}catch{}}}if(Ee==null)return ay(t,"Missing content for non-native upload");const{bytes:Me,inferredMime:Je,isBinary:ke}=await HIn(Ee),lt=Me.byteLength;if(lt>v5)return ay(t,`File too large for simple upload (${lt} bytes).`);const Gt=await Et("POST","/upload/drive/v3/files",{params:{uploadType:"media",supportsAllDrives:"true",fields:_R},body:Me,contentType:Fe||Je||(ke?"application/octet-stream":"text/plain; charset=UTF-8")});if(Gt.status!==200&&Gt.status!==201)return ay(t,`Drive media upload failed (status=${Gt.status})`);let si=Gt.data;const pi=(ee=Gt.data)==null?void 0:ee.id;return pi&&(tt||Le||We)&&(si=await YIn(Et,pi,Le,We,tt)),WG({file:si})}catch(te){const re=((J=te.response)==null?void 0:J.data)||te.message||te;return pe.Logger.error("[Google Drive] Upload document failed:",re),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:re,result:null}}}})}}function WG(a){return{value:K.Success,error:null,result:a}}function ay(a,p){return pe.Logger.log("[Google Drive] Upload error:",p),{value:a.catchesError||a.errorCalls.length?K.CaughtError:K.UnhandledError,error:p,result:null}}async function YIn(a,p,t,n,s){const u={};t&&(u.name=t),typeof n=="string"&&(u.description=n);const e={supportsAllDrives:"true",fields:_R},f={...e};s&&(f.addParents=s,f.removeParents="root");let y=await a("PATCH",`/drive/v3/files/${encodeURIComponent(p)}`,{params:f,body:JSON.stringify(u),contentType:"application/json"});if(y.status>=400&&s&&(y=await a("PATCH",`/drive/v3/files/${encodeURIComponent(p)}`,{params:{...e,addParents:s},body:JSON.stringify(u),contentType:"application/json"})),y.status!==200)throw new Error(`Drive metadata update failed (status=${y.status})`);return y.data}const JIn="id,name,mimeType,webViewLink",QIn="X-Elyx-Proxy-Config";function XIn(a){return a.startsWith("/")?a.slice(1):a}const eRn=(a,p)=>(pe.Logger.log("[Google Drive Clone Document] error:",p),{value:a.catchesError||a.errorCalls.length?K.CaughtError:K.UnhandledError,error:p,result:null});class $At extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleDriveCloneDocument,version:"1.0.0",description:"Google Drive clone document operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.GoogleDriveCloneDocument);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A,O;try{const P=this.extensionsRegistry.requestContexts(this,[X.Editor])[0],x=G.operation[Q.GoogleDriveCloneDocument],$=Be(t,t.project,"cloneDocument"),q="["+Ve(t,t.project,"Clone document")+": `"+$+"`] ",Z=n.find(Ee=>{var Oe,Le;return((Le=(Oe=Ee.valueOwner)==null?void 0:Oe.declaration)==null?void 0:Le.id)===x.inputs.connection.id}),H=((s=Z==null?void 0:Z.value)==null?void 0:s.valueAsType)??((u=Z==null?void 0:Z.value)==null?void 0:u.value);if(!H||!H.id||!H.name||H.type!==r.DefinitionEntity)throw new Error(`${q}Invalid input "${Ve(Z==null?void 0:Z.valueOwner,P==null?void 0:P.logic,"Connection")}" (\`${Be(Z==null?void 0:Z.valueOwner,P==null?void 0:P.logic,"connection")}\`), expected a valid connection node.`);const W=ui(H);if(!W)throw new Error(`${q}The "${Ve(Z==null?void 0:Z.valueOwner,P==null?void 0:P.logic,"Connection")}" (\`${Be(Z==null?void 0:Z.valueOwner,P==null?void 0:P.logic,"connection")}\`) input is invalid, missing underlying Connection ID value.`);const ie=n.find(Ee=>{var Oe,Le;return((Le=(Oe=Ee.valueOwner)==null?void 0:Oe.declaration)==null?void 0:Le.id)===x.inputs.documentId.id}),z=(e=ie==null?void 0:ie.value)==null?void 0:e.value;if(!z||z==="")throw new Error(`${q}The "${Ve(ie==null?void 0:ie.valueOwner,P==null?void 0:P.logic,"Document ID")}" (\`${Be(ie==null?void 0:ie.valueOwner,P==null?void 0:P.logic,"documentId")}\`) input is missing.`);if(typeof z!="string")throw new Error(`${q}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 Y=(y=(f=n.find(Ee=>{var Oe,Le;return((Le=(Oe=Ee.valueOwner)==null?void 0:Oe.declaration)==null?void 0:Le.id)===x.inputs.newName.id}))==null?void 0:f.value)==null?void 0:y.value,ee=(T=(m=n.find(Ee=>{var Oe,Le;return((Le=(Oe=Ee.valueOwner)==null?void 0:Oe.declaration)==null?void 0:Le.id)===x.inputs.parentFolderIds.id}))==null?void 0:m.value)==null?void 0:T.value,J=(b=(g=n.find(Ee=>{var Oe,Le;return((Le=(Oe=Ee.valueOwner)==null?void 0:Oe.declaration)==null?void 0:Le.id)===x.inputs.description.id}))==null?void 0:g.value)==null?void 0:b.value,te=(I=(R=n.find(Ee=>{var Oe,Le;return((Le=(Oe=Ee.valueOwner)==null?void 0:Oe.declaration)==null?void 0:Le.id)===x.inputs.starred.id}))==null?void 0:R.value)==null?void 0:I.value;ui(H);const ae={Authorization:`Bearer ${await P.getAccessToken()}`},le=`${((A=P.env)==null?void 0:A.API_BASE_URL)+"/editor-runtime"}/v2/external-integrations/proxy/${P.projectId}/${Zt["google-drive"]}/${W}`,oe=async(Ee,Oe,{params:Le,body:Fe,contentType:tt,providerHeaders:We,responseType:et}={})=>{const qe=`${le}/${XIn(Oe)}`,ot={...ae};return tt&&(ot["Content-Type"]=tt),(We||et)&&(ot[QIn]=JSON.stringify({...We?{headers:We}:{},...et?{responseType:et}:{}})),Ht({method:Ee,url:qe,headers:ot,params:Le,data:Fe,responseType:et||"json"})},ce={};Y&&(ce.name=Y),ee&&ee.length>0&&(ce.parents=ee),J&&(ce.description=J),te!==void 0&&(ce.starred=te);const Ce=(await oe("POST",`/drive/v3/files/${z}/copy`,{params:{fields:JIn,supportsAllDrives:!0},body:ce,contentType:"application/json"})).data;return{value:K.Success,error:null,result:{id:Ce.id,name:Ce.name,mimeType:Ce.mimeType,webViewLink:Ce.webViewLink}}}catch(P){const x=((O=P.response)==null?void 0:O.data)||P.message||P;return eRn(t,x)}}})}}const tRn="X-Elyx-Proxy-Config";function iRn(a){return a.startsWith("/")?a.slice(1):a}const nRn=(a,p)=>(pe.Logger.log("[Google Drive Delete Document] error:",p),{value:a.catchesError||a.errorCalls.length?K.CaughtError:K.UnhandledError,error:p,result:null});class GAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleDriveDeleteDocument,version:"1.0.0",description:"Google Drive delete document operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.Editor])[0],b=G.operation[Q.GoogleDriveDeleteDocument],R=Be(t,t.project,"deleteDocument"),A="["+Ve(t,t.project,"Delete document")+": `"+R+"`] ",O=n.find(z=>{var Y,ee;return((ee=(Y=z.valueOwner)==null?void 0:Y.declaration)==null?void 0:ee.id)===b.inputs.connection.id}),P=((s=O==null?void 0:O.value)==null?void 0:s.valueAsType)??((u=O==null?void 0:O.value)==null?void 0:u.value);if(!P||!P.id||!P.name||P.type!==r.DefinitionEntity)throw new Error(`${A}Invalid input "${Ve(O==null?void 0:O.valueOwner,g==null?void 0:g.logic,"Connection")}" (\`${Be(O==null?void 0:O.valueOwner,g==null?void 0:g.logic,"connection")}\`), expected a valid connection node.`);const x=ui(P);if(!x)throw new Error(`${A}The "${Ve(O==null?void 0:O.valueOwner,g==null?void 0:g.logic,"Connection")}" (\`${Be(O==null?void 0:O.valueOwner,g==null?void 0:g.logic,"connection")}\`) input is invalid, missing underlying Connection ID value.`);const $=n.find(z=>{var Y,ee;return((ee=(Y=z.valueOwner)==null?void 0:Y.declaration)==null?void 0:ee.id)===b.inputs.documentId.id}),U=(e=$==null?void 0:$.value)==null?void 0:e.value;if(!U||U==="")throw new Error(`${A}The "${Ve($==null?void 0:$.valueOwner,g==null?void 0:g.logic,"Document ID")}" (\`${Be($==null?void 0:$.valueOwner,g==null?void 0:g.logic,"documentId")}\`) input is missing.`);if(typeof U!="string")throw new Error(`${A}The "${Ve($==null?void 0:$.valueOwner,g==null?void 0:g.logic,"Document ID")}" (\`${Be($==null?void 0:$.valueOwner,g==null?void 0:g.logic,"documentId")}\`) input value is invalid, if present, it must be a non-empty string.`);const q=(y=(f=n.find(z=>{var Y,ee;return((ee=(Y=z.valueOwner)==null?void 0:Y.declaration)==null?void 0:ee.id)===b.inputs.permanent.id}))==null?void 0:f.value)==null?void 0:y.value;ui(P);const H={Authorization:`Bearer ${await g.getAccessToken()}`},W=`${((m=g.env)==null?void 0:m.API_BASE_URL)+"/editor-runtime"}/v2/external-integrations/proxy/${g.projectId}/${Zt["google-drive"]}/${x}`,ie=async(z,Y,{params:ee,body:J,contentType:te,providerHeaders:re,responseType:ae}={})=>{const le=`${W}/${iRn(Y)}`,oe={...H};return te&&(oe["Content-Type"]=te),(re||ae)&&(oe[tRn]=JSON.stringify({...re?{headers:re}:{},...ae?{responseType:ae}:{}})),Ht({method:z,url:le,headers:oe,params:ee,data:J,responseType:ae||"json"})};return q?await ie("DELETE",`/drive/v3/files/${U}`,{params:{supportsAllDrives:!0}}):await ie("PATCH",`/drive/v3/files/${U}`,{params:{supportsAllDrives:!0},body:{trashed:!0},contentType:"application/json"}),{value:K.Success,error:null,result:null}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return nRn(t,b)}}})}}const rRn="X-Elyx-Proxy-Config";function aRn(a){return a.startsWith("/")?a.slice(1):a}const sRn=(a,p)=>(pe.Logger.log("[Google Drive Create Permission] error:",p),{value:a.catchesError||a.errorCalls.length?K.CaughtError:K.UnhandledError,error:p,result:null});class LAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleDriveCreatePermission,version:"1.0.0",description:"Google Drive create permission operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.GoogleDriveCreatePermission);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A,O,P,x,$,U,q,Z,H;try{const W=this.extensionsRegistry.requestContexts(this,[X.Editor])[0],ie=G.operation[Q.GoogleDriveCreatePermission],z=Be(t,t.project,"createPermission"),ee="["+Ve(t,t.project,"Create permission")+": `"+z+"`] ",J=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===ie.inputs.connection.id}),te=((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(!te||!te.id||!te.name||te.type!==r.DefinitionEntity)throw new Error(`${ee}Invalid input "${Ve(J==null?void 0:J.valueOwner,W==null?void 0:W.logic,"Connection")}" (\`${Be(J==null?void 0:J.valueOwner,W==null?void 0:W.logic,"connection")}\`), expected a valid connection node.`);const re=ui(te);if(!re)throw new Error(`${ee}The "${Ve(J==null?void 0:J.valueOwner,W==null?void 0:W.logic,"Connection")}" (\`${Be(J==null?void 0:J.valueOwner,W==null?void 0:W.logic,"connection")}\`) input is invalid, missing underlying Connection ID value.`);const ae=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===ie.inputs.fileId.id}),le=(e=ae==null?void 0:ae.value)==null?void 0:e.value;if(!le||le==="")throw new Error(`${ee}The "${Ve(ae==null?void 0:ae.valueOwner,W==null?void 0:W.logic,"File ID")}" (\`${Be(ae==null?void 0:ae.valueOwner,W==null?void 0:W.logic,"fileId")}\`) input is missing.`);if(typeof le!="string")throw new Error(`${ee}The "${Ve(ae==null?void 0:ae.valueOwner,W==null?void 0:W.logic,"File ID")}" (\`${Be(ae==null?void 0:ae.valueOwner,W==null?void 0:W.logic,"fileId")}\`) 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)===ie.inputs.role.id}),ce=(f=oe==null?void 0:oe.value)==null?void 0:f.value;if(!ce||ce==="")throw new Error(`${ee}The "${Ve(oe==null?void 0:oe.valueOwner,W==null?void 0:W.logic,"Role")}" (\`${Be(oe==null?void 0:oe.valueOwner,W==null?void 0:W.logic,"role")}\`) input is missing.`);if(typeof ce!="string")throw new Error(`${ee}The "${Ve(oe==null?void 0:oe.valueOwner,W==null?void 0:W.logic,"Role")}" (\`${Be(oe==null?void 0:oe.valueOwner,W==null?void 0:W.logic,"role")}\`) input value is invalid, if present, it must be a non-empty string.`);const ge=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===ie.inputs.type.id}),Ce=(y=ge==null?void 0:ge.value)==null?void 0:y.value;if(!Ce||Ce==="")throw new Error(`${ee}The "${Ve(ge==null?void 0:ge.valueOwner,W==null?void 0:W.logic,"Type")}" (\`${Be(ge==null?void 0:ge.valueOwner,W==null?void 0:W.logic,"type")}\`) input is missing.`);if(typeof Ce!="string")throw new Error(`${ee}The "${Ve(ge==null?void 0:ge.valueOwner,W==null?void 0:W.logic,"Type")}" (\`${Be(ge==null?void 0:ge.valueOwner,W==null?void 0:W.logic,"type")}\`) input value is invalid, if present, it must be a non-empty string.`);const Ee=(T=(m=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===ie.inputs.emailAddress.id}))==null?void 0:m.value)==null?void 0:T.value,Oe=(b=(g=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===ie.inputs.domain.id}))==null?void 0:g.value)==null?void 0:b.value,Le=(I=(R=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===ie.inputs.sendNotificationEmail.id}))==null?void 0:R.value)==null?void 0:I.value,Fe=(O=(A=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===ie.inputs.emailMessage.id}))==null?void 0:A.value)==null?void 0:O.value,tt=(x=(P=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===ie.inputs.allowFileDiscovery.id}))==null?void 0:P.value)==null?void 0:x.value,We=(U=($=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===ie.inputs.transferOwnership.id}))==null?void 0:$.value)==null?void 0:U.value;ui(te);const qe={Authorization:`Bearer ${await W.getAccessToken()}`},ot=`${((q=W.env)==null?void 0:q.API_BASE_URL)+"/editor-runtime"}/v2/external-integrations/proxy/${W.projectId}/${Zt["google-drive"]}/${re}`,st=async(Je,ke,{params:lt,body:Pt,contentType:Gt,providerHeaders:si,responseType:pi}={})=>{const kt=`${ot}/${aRn(ke)}`,Ct={...qe};return Gt&&(Ct["Content-Type"]=Gt),(si||pi)&&(Ct[rRn]=JSON.stringify({...si?{headers:si}:{},...pi?{responseType:pi}:{}})),Ht({method:Je,url:kt,headers:Ct,params:lt,data:Pt,responseType:pi||"json"})},ft={supportsAllDrives:!0,fields:"id,type,role,emailAddress,domain,displayName"};Le!==void 0&&(ft.sendNotificationEmail=Le),Fe&&(ft.emailMessage=Fe),We!==void 0&&(ft.transferOwnership=We);const Et={role:ce,type:Ce};Ee&&(Et.emailAddress=Ee),Oe&&(Et.domain=Oe),tt!==void 0&&(Et.allowFileDiscovery=tt);const pt=await st("POST",`/drive/v3/files/${le}/permissions`,{params:ft,body:Et,contentType:"application/json"}),Me=((Z=pt.data)==null?void 0:Z.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)??ce,emailAddress:(Me==null?void 0:Me.emailAddress)??Ee??"",domain:(Me==null?void 0:Me.domain)??Oe??"",displayName:(Me==null?void 0:Me.displayName)??""}}}catch(W){const ie=((H=W.response)==null?void 0:H.data)||W.message||W;return sRn(t,typeof ie=="object"?JSON.stringify(ie):String(ie))}}})}}const lRn="X-Elyx-Proxy-Config";function oRn(a){return a.startsWith("/")?a.slice(1):a}const dRn=(a,p)=>(pe.Logger.log("[Google Drive Delete Permission] error:",p),{value:a.catchesError||a.errorCalls.length?K.CaughtError:K.UnhandledError,error:p,result:null});class BAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleDriveDeletePermission,version:"1.0.0",description:"Google Drive delete permission operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.Editor])[0],g=G.operation[Q.GoogleDriveDeletePermission],b=Be(t,t.project,"deletePermission"),I="["+Ve(t,t.project,"Delete permission")+": `"+b+"`] ",A=n.find(z=>{var Y,ee;return((ee=(Y=z.valueOwner)==null?void 0:Y.declaration)==null?void 0:ee.id)===g.inputs.connection.id}),O=((s=A==null?void 0:A.value)==null?void 0:s.valueAsType)??((u=A==null?void 0:A.value)==null?void 0:u.value);if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${I}Invalid input "${Ve(A==null?void 0:A.valueOwner,T==null?void 0:T.logic,"Connection")}" (\`${Be(A==null?void 0:A.valueOwner,T==null?void 0:T.logic,"connection")}\`), expected a valid connection node.`);const P=ui(O);if(!P)throw new Error(`${I}The "${Ve(A==null?void 0:A.valueOwner,T==null?void 0:T.logic,"Connection")}" (\`${Be(A==null?void 0:A.valueOwner,T==null?void 0:T.logic,"connection")}\`) input is invalid, missing underlying Connection ID value.`);const x=n.find(z=>{var Y,ee;return((ee=(Y=z.valueOwner)==null?void 0:Y.declaration)==null?void 0:ee.id)===g.inputs.fileId.id}),$=(e=x==null?void 0:x.value)==null?void 0:e.value;if(!$||$==="")throw new Error(`${I}The "${Ve(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"File ID")}" (\`${Be(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"fileId")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${I}The "${Ve(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"File ID")}" (\`${Be(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"fileId")}\`) input value is invalid, if present, it must be a non-empty string.`);const U=n.find(z=>{var Y,ee;return((ee=(Y=z.valueOwner)==null?void 0:Y.declaration)==null?void 0:ee.id)===g.inputs.permissionId.id}),q=(f=U==null?void 0:U.value)==null?void 0:f.value;if(!q||q==="")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 q!="string")throw new Error(`${I}The "${Ve(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"Permission ID")}" (\`${Be(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"permissionId")}\`) input value is invalid, if present, it must be a non-empty string.`);ui(O);const H={Authorization:`Bearer ${await T.getAccessToken()}`},W=`${((y=T.env)==null?void 0:y.API_BASE_URL)+"/editor-runtime"}/v2/external-integrations/proxy/${T.projectId}/${Zt["google-drive"]}/${P}`;return await(async(z,Y,{params:ee,body:J,contentType:te,providerHeaders:re,responseType:ae}={})=>{const le=`${W}/${oRn(Y)}`,oe={...H};return te&&(oe["Content-Type"]=te),(re||ae)&&(oe[lRn]=JSON.stringify({...re?{headers:re}:{},...ae?{responseType:ae}:{}})),Ht({method:z,url:le,headers:oe,params:ee,data:J,responseType:ae||"json"})})("DELETE",`/drive/v3/files/${$}/permissions/${q}`,{params:{supportsAllDrives:!0}}),{value:K.Success,error:null,result:void 0}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return dRn(t,typeof g=="object"?JSON.stringify(g):String(g))}}})}}const pRn="X-Elyx-Proxy-Config";function uRn(a){return a.startsWith("/")?a.slice(1):a}const cRn=(a,p)=>(pe.Logger.log("[Google Drive List Permissions] error:",p),{value:a.catchesError||a.errorCalls.length?K.CaughtError:K.UnhandledError,error:p,result:null});class SAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleDriveListPermissions,version:"1.0.0",description:"Google Drive list permissions operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.Editor])[0],A=G.operation[Q.GoogleDriveListPermissions],O=Be(t,t.project,"listPermissions"),x="["+Ve(t,t.project,"List permissions")+": `"+O+"`] ",$=n.find(ce=>{var ge,Ce;return((Ce=(ge=ce.valueOwner)==null?void 0:ge.declaration)==null?void 0:Ce.id)===A.inputs.connection.id}),U=((s=$==null?void 0:$.value)==null?void 0:s.valueAsType)??((u=$==null?void 0:$.value)==null?void 0:u.value);if(!U||!U.id||!U.name||U.type!==r.DefinitionEntity)throw new Error(`${x}Invalid input "${Ve($==null?void 0:$.valueOwner,I==null?void 0:I.logic,"Connection")}" (\`${Be($==null?void 0:$.valueOwner,I==null?void 0:I.logic,"connection")}\`), expected a valid connection node.`);const q=ui(U);if(!q)throw new Error(`${x}The "${Ve($==null?void 0:$.valueOwner,I==null?void 0:I.logic,"Connection")}" (\`${Be($==null?void 0:$.valueOwner,I==null?void 0:I.logic,"connection")}\`) input is invalid, missing underlying Connection ID value.`);const Z=n.find(ce=>{var ge,Ce;return((Ce=(ge=ce.valueOwner)==null?void 0:ge.declaration)==null?void 0:Ce.id)===A.inputs.fileId.id}),H=(e=Z==null?void 0:Z.value)==null?void 0:e.value;if(!H||H==="")throw new Error(`${x}The "${Ve(Z==null?void 0:Z.valueOwner,I==null?void 0:I.logic,"File ID")}" (\`${Be(Z==null?void 0:Z.valueOwner,I==null?void 0:I.logic,"fileId")}\`) input is missing.`);if(typeof H!="string")throw new Error(`${x}The "${Ve(Z==null?void 0:Z.valueOwner,I==null?void 0:I.logic,"File ID")}" (\`${Be(Z==null?void 0:Z.valueOwner,I==null?void 0:I.logic,"fileId")}\`) input value is invalid, if present, it must be a non-empty string.`);const W=(y=(f=n.find(ce=>{var ge,Ce;return((Ce=(ge=ce.valueOwner)==null?void 0:ge.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 ge,Ce;return((Ce=(ge=ce.valueOwner)==null?void 0:ge.declaration)==null?void 0:Ce.id)===A.inputs.pageToken.id}))==null?void 0:m.value)==null?void 0:T.value;ui(U);const Y={Authorization:`Bearer ${await I.getAccessToken()}`},ee=`${((g=I.env)==null?void 0:g.API_BASE_URL)+"/editor-runtime"}/v2/external-integrations/proxy/${I.projectId}/${Zt["google-drive"]}/${q}`,J=async(ce,ge,{params:Ce,body:Ee,contentType:Oe,providerHeaders:Le,responseType:Fe}={})=>{const tt=`${ee}/${uRn(ge)}`,We={...Y};return Oe&&(We["Content-Type"]=Oe),(Le||Fe)&&(We[pRn]=JSON.stringify({...Le?{headers:Le}:{},...Fe?{responseType:Fe}:{}})),Ht({method:ce,url:tt,headers:We,params:Ce,data:Ee,responseType:Fe||"json"})},te={supportsAllDrives:!0,fields:"nextPageToken,permissions(id,type,role,emailAddress,domain,displayName)"};W!=null&&(te.pageSize=W),ie&&(te.pageToken=ie);const re=await J("GET",`/drive/v3/files/${H}/permissions`,{params:te}),ae=((b=re.data)==null?void 0:b.data)??re.data,oe=(Array.isArray(ae==null?void 0:ae.permissions)?ae.permissions:[]).map(ce=>({id:(ce==null?void 0:ce.id)??"",type:(ce==null?void 0:ce.type)??"",role:(ce==null?void 0:ce.role)??"",emailAddress:(ce==null?void 0:ce.emailAddress)??"",domain:(ce==null?void 0:ce.domain)??"",displayName:(ce==null?void 0:ce.displayName)??""}));return{value:K.Success,error:null,result:{permissions:oe,nextPageToken:(ae==null?void 0:ae.nextPageToken)??""}}}catch(I){const A=((R=I.response)==null?void 0:R.data)||I.message||I;return cRn(t,typeof A=="object"?JSON.stringify(A):String(A))}}})}}const fRn="X-Elyx-Proxy-Config";function yRn(a){return a.startsWith("/")?a.slice(1):a}const hRn=(a,p)=>(pe.Logger.log("[Google Drive Update Permission] error:",p),{value:a.catchesError||a.errorCalls.length?K.CaughtError:K.UnhandledError,error:p,result:null});class MAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleDriveUpdatePermission,version:"1.0.0",description:"Google Drive update permission operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.Editor])[0],A=G.operation[Q.GoogleDriveUpdatePermission],O=Be(t,t.project,"updatePermission"),x="["+Ve(t,t.project,"Update permission")+": `"+O+"`] ",$=n.find(ge=>{var Ce,Ee;return((Ee=(Ce=ge.valueOwner)==null?void 0:Ce.declaration)==null?void 0:Ee.id)===A.inputs.connection.id}),U=((s=$==null?void 0:$.value)==null?void 0:s.valueAsType)??((u=$==null?void 0:$.value)==null?void 0:u.value);if(!U||!U.id||!U.name||U.type!==r.DefinitionEntity)throw new Error(`${x}Invalid input "${Ve($==null?void 0:$.valueOwner,I==null?void 0:I.logic,"Connection")}" (\`${Be($==null?void 0:$.valueOwner,I==null?void 0:I.logic,"connection")}\`), expected a valid connection node.`);const q=ui(U);if(!q)throw new Error(`${x}The "${Ve($==null?void 0:$.valueOwner,I==null?void 0:I.logic,"Connection")}" (\`${Be($==null?void 0:$.valueOwner,I==null?void 0:I.logic,"connection")}\`) input is invalid, missing underlying Connection ID value.`);const Z=n.find(ge=>{var Ce,Ee;return((Ee=(Ce=ge.valueOwner)==null?void 0:Ce.declaration)==null?void 0:Ee.id)===A.inputs.fileId.id}),H=(e=Z==null?void 0:Z.value)==null?void 0:e.value;if(!H||H==="")throw new Error(`${x}The "${Ve(Z==null?void 0:Z.valueOwner,I==null?void 0:I.logic,"File ID")}" (\`${Be(Z==null?void 0:Z.valueOwner,I==null?void 0:I.logic,"fileId")}\`) input is missing.`);if(typeof H!="string")throw new Error(`${x}The "${Ve(Z==null?void 0:Z.valueOwner,I==null?void 0:I.logic,"File ID")}" (\`${Be(Z==null?void 0:Z.valueOwner,I==null?void 0:I.logic,"fileId")}\`) input value is invalid, if present, it must be a non-empty string.`);const W=n.find(ge=>{var Ce,Ee;return((Ee=(Ce=ge.valueOwner)==null?void 0:Ce.declaration)==null?void 0:Ee.id)===A.inputs.permissionId.id}),ie=(f=W==null?void 0:W.value)==null?void 0:f.value;if(!ie||ie==="")throw new Error(`${x}The "${Ve(W==null?void 0:W.valueOwner,I==null?void 0:I.logic,"Permission ID")}" (\`${Be(W==null?void 0:W.valueOwner,I==null?void 0:I.logic,"permissionId")}\`) input is missing.`);if(typeof ie!="string")throw new Error(`${x}The "${Ve(W==null?void 0:W.valueOwner,I==null?void 0:I.logic,"Permission ID")}" (\`${Be(W==null?void 0:W.valueOwner,I==null?void 0:I.logic,"permissionId")}\`) input value is invalid, if present, it must be a non-empty string.`);const z=n.find(ge=>{var Ce,Ee;return((Ee=(Ce=ge.valueOwner)==null?void 0:Ce.declaration)==null?void 0:Ee.id)===A.inputs.role.id}),Y=(y=z==null?void 0:z.value)==null?void 0:y.value;if(!Y||Y==="")throw new Error(`${x}The "${Ve(z==null?void 0:z.valueOwner,I==null?void 0:I.logic,"Role")}" (\`${Be(z==null?void 0:z.valueOwner,I==null?void 0:I.logic,"role")}\`) input is missing.`);if(typeof Y!="string")throw new Error(`${x}The "${Ve(z==null?void 0:z.valueOwner,I==null?void 0:I.logic,"Role")}" (\`${Be(z==null?void 0:z.valueOwner,I==null?void 0:I.logic,"role")}\`) input value is invalid, if present, it must be a non-empty string.`);const ee=(T=(m=n.find(ge=>{var Ce,Ee;return((Ee=(Ce=ge.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 te={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"]}/${q}`,ae=async(ge,Ce,{params:Ee,body:Oe,contentType:Le,providerHeaders:Fe,responseType:tt}={})=>{const We=`${re}/${yRn(Ce)}`,et={...te};return Le&&(et["Content-Type"]=Le),(Fe||tt)&&(et[fRn]=JSON.stringify({...Fe?{headers:Fe}:{},...tt?{responseType:tt}:{}})),Ht({method:ge,url:We,headers:et,params:Ee,data:Oe,responseType:tt||"json"})},le={supportsAllDrives:!0,fields:"id,type,role,emailAddress,domain,displayName"};ee!=null&&(le.transferOwnership=ee);const oe=await ae("PATCH",`/drive/v3/files/${H}/permissions/${ie}`,{params:le,body:{role:Y},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)??Y,emailAddress:(ce==null?void 0:ce.emailAddress)??"",domain:(ce==null?void 0:ce.domain)??"",displayName:(ce==null?void 0:ce.displayName)??""}}}catch(I){const A=((R=I.response)==null?void 0:R.data)||I.message||I;return hRn(t,typeof A=="object"?JSON.stringify(A):String(A))}}})}}class FAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleGeminiGenerateContent,version:"1.0.0",description:"Send Gmail email operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.Editor])[0],g=Be(t,t.project,"generateContent"),R="["+Ve(t,t.project,"Generate content")+": `"+g+"`] ",I=G.operation[Q.GoogleGeminiGenerateContent],A=n.find(H=>{var W,ie;return((ie=(W=H.valueOwner)==null?void 0:W.declaration)==null?void 0:ie.id)===I.inputs.connection.id}),O=((s=A==null?void 0:A.value)==null?void 0:s.valueAsType)??((u=A==null?void 0:A.value)==null?void 0:u.value);if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${R}Invalid input "${Ve(A==null?void 0:A.valueOwner,T==null?void 0:T.logic,"Connection")}" (\`${Be(A==null?void 0:A.valueOwner,T==null?void 0:T.logic,"connection")}\`), expected a valid connection node.`);const P=ui(O);if(!P)throw new Error(`${R}The "${Ve(A==null?void 0:A.valueOwner,T==null?void 0:T.logic,"Connection")}" (\`${Be(A==null?void 0:A.valueOwner,T==null?void 0:T.logic,"connection")}\`) input is invalid, missing underlying Connection ID value.`);const x=n.find(H=>{var W,ie;return((ie=(W=H.valueOwner)==null?void 0:W.declaration)==null?void 0:ie.id)===I.inputs.prompt.id}),$=(e=x==null?void 0:x.value)==null?void 0:e.value;if($==null||$==="")throw new Error(`${R}The "${Ve(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"Prompt")}" (\`${Be(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"prompt")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${R}The "${Ve(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"Prompt")}" (\`${Be(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"prompt")}\`) input value is invalid, if present, it must be a non-empty string.`);const U=n.find(H=>{var W,ie;return((ie=(W=H.valueOwner)==null?void 0:W.declaration)==null?void 0:ie.id)===I.inputs.model.id}),q=(f=U==null?void 0:U.value)==null?void 0:f.value;if(q==null||q==="")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 q!="string")throw new Error(`${R}The "${Ve(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"Model")}" (\`${Be(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"model")}\`) input value is invalid, if present, it must be a non-empty string.`);ui(O),console.log("Triggering Google Gemini generate content action with connectionId:",P);const Z=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:q}},{headers:{"Content-Type":"application/json",Authorization:`Bearer ${await T.getAccessToken()}`}})).data;return pe.Logger.log("[Google Gemini] Generate content action response:",Z),{value:K.Success,error:null,result:{content:Z.content}}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return pe.Logger.error("[Google Gemini] Generate content failed:",g),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:g,result:null}}}})}}class kAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsCreateSpreadsheet,version:"1.0.0",description:"Create Spreadsheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.GoogleSheetsCreateSpreadsheet);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f;try{const y=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!y||!y.env)throw new Error("Editor context or environment missing");const m=Be(t,t.project,"createSpreadsheet"),g="["+Ve(t,t.project,"Create spreadsheet")+": `"+m+"`] ",b=(ie,z,Y)=>{const ee=Ve(ie==null?void 0:ie.valueOwner,y==null?void 0:y.logic,z),J=Be(ie==null?void 0:ie.valueOwner,y==null?void 0:y.logic,Y);return`"${ee}" (\`${J}\`)`},R=n.find(ie=>{var z;return((z=ie.valueOwner.declaration)==null?void 0:z.id)===G.operation[Q.GoogleSheetsCreateSpreadsheet].inputs.connection.id}),I=(s=R==null?void 0:R.value)==null?void 0:s.valueAsType;if(!I||!I.id||!I.name||I.type!==r.DefinitionEntity)throw new Error(`${g}The ${b(R,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const A=ui(I);if(!A)throw new Error(`${g}The ${b(R,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const O=n.find(ie=>{var z;return((z=ie.valueOwner.declaration)==null?void 0:z.id)===G.operation[Q.GoogleSheetsCreateSpreadsheet].inputs.title.id}),P=(u=O==null?void 0:O.value)==null?void 0:u.value;if(P&&typeof P!="string")throw new Error(`${g}The ${b(O,"Title","title")} input value is invalid. If present, it must be a non-empty string. E.g. "My Spreadsheet"`);const $={Authorization:`Bearer ${await y.getAccessToken()}`},U=`${(e=y.env)==null?void 0:e.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${y.projectId}/${Zt["google-sheet"]}/${A}`,q=async ie=>Ht.post(U,ie,{headers:$}),Z={};P&&(Z.properties={title:P});const W=(await q({method:"POST",endpoint:"/v4/spreadsheets",data:Z})).data||{};return{value:K.Success,error:null,result:{spreadsheetId:W.spreadsheetId,spreadsheetUrl:W.spreadsheetUrl}}}catch(y){const m=((f=y.response)==null?void 0:f.data)||y.message||y;return pe.Logger.log("[Google Sheets] error:",m),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:m,result:null}}}})}}function zL(a){let p="",t=a;for(;t>0;){const n=(t-1)%26;p=String.fromCharCode(65+n)+p,t=Math.floor((t-n)/26)}return p}function IV(a){if(!/^[A-Z]{1,3}$/.test(a))return NaN;let p=0;for(let t=0;t<a.length;t++)p=p*26+(a.charCodeAt(t)-64);return p}function cA(a,p){const t=(p==null?void 0:p.errorPrefix)||"";if(typeof a!="string")throw new Error(`${t}Input must be a string.`);let n,s=a;if(a.includes("!")){const R=a.split("!");let I=R.slice(0,-1).join("!");s=R[R.length-1],I.startsWith("'")&&I.endsWith("'")&&(I=I.slice(1,-1)),n=I}const u=/^(\$?[A-Z]{1,3})?(\$?\d+)?(?::(\$?[A-Z]{1,3})?(\$?\d+)?)?$/i,e=s.match(u);if(!e)throw new Error(`${t}Invalid A1 notation format: ${a}`);const[f,y,m,T,g]=e,b={sheet:n};return y&&(b.startColumn=y.toUpperCase()),m&&(b.startRow=m),T&&(b.endColumn=T.toUpperCase()),g&&(b.endRow=g),b}function B4(a,p){const t=p!=null&&p.errorPrefix?p.errorPrefix:"",n=T=>{if(typeof T=="string"){const g=T.replace("$","");return/^\d+$/.test(g)?parseInt(g,10):NaN}return T},s=T=>{if(typeof T=="string"){const g=T.replace("$","").toUpperCase();return/^\d+$/.test(g)?parseInt(g,10):IV(g)}return T},u=n(a.startRow),e=n(a.endRow),f=s(a.startColumn),y=s(a.endColumn),m=T=>typeof T=="string"&&T.includes("{{")&&T.includes("}}");if(a.startRow!==void 0&&a.startRow!==null&&a.startRow!==""&&isNaN(u)&&!m(a.startRow))throw new Error(`${t}Start Row is invalid.`);if(a.endRow!==void 0&&a.endRow!==null&&a.endRow!==""&&isNaN(e)&&!m(a.endRow))throw new Error(`${t}End Row is invalid.`);if(a.startColumn!==void 0&&a.startColumn!==null&&a.startColumn!==""&&isNaN(f)&&!m(a.startColumn))throw new Error(`${t}Start Column is invalid.`);if(a.endColumn!==void 0&&a.endColumn!==null&&a.endColumn!==""&&isNaN(y)&&!m(a.endColumn))throw new Error(`${t}End Column is invalid.`);if(u!=null&&!isNaN(u)&&u<1)throw new Error(`${t}Start Row must be greater than or equal to 1.`);if(e!=null&&!isNaN(e)&&e<1)throw new Error(`${t}End Row must be greater than or equal to 1.`);if(f!=null&&!isNaN(f)&&f<1)throw new Error(`${t}Start Column must be greater than or equal to 1.`);if(y!=null&&!isNaN(y)&&y<1)throw new Error(`${t}End Column must be greater than or equal to 1.`);if(u!=null&&!isNaN(u)&&e!==void 0&&e!==null&&!isNaN(e)&&u>e)throw new Error(`${t}Start Row must be less than or equal to End Row.`);if(f!=null&&!isNaN(f)&&y!==void 0&&y!==null&&!isNaN(y)&&f>y)throw new Error(`${t}Start Column must be less than or equal to End Column.`);if(typeof a.sheet=="number"&&a.sheet<0)throw new Error(`${t}Sheet ID must be greater than or equal to 0.`)}async function Ha(a,p,t){if(!a)return a;let n=a;if(typeof a=="string"){const f=a.trim();if(f.startsWith("{"))try{n=new Function("return "+f)()}catch{try{n=JSON.parse(f)}catch{}}else try{n=cA(f,{errorPrefix:"Internal"})}catch{}}else if(typeof a=="object"&&a!==null)try{n=JSON.parse(JSON.stringify(a))}catch{n={...a}}if(n.sheet===void 0||n.sheet===null||n.sheet==="")return n;const s=typeof n.sheet=="string",u=typeof n.sheet=="number";if(p==="Name"&&s)return n;if(p==="Id"&&u)return n._resolvedSheetId=n.sheet,n;const e=n.sheet;try{const f=await t();for(const y of f){const m=y.id,T=y.name,g=String(T).trim().toLowerCase()===String(e).trim().toLowerCase(),b=String(m)===String(e);if(g||b)return n._resolvedSheetId=m,n._resolvedSheetName=T,n}}catch{}return n}function lv(a,p){if(!a)return"";if(typeof a=="string")return a;let t=a;if(typeof a=="string"&&a.trim().startsWith("{"))try{t=JSON.parse(a)}catch{}if(B4(t,p),t.namedRange&&t.namedRange.trim()!=="")return t.namedRange;const n=t._resolvedSheetName!==void 0?t._resolvedSheetName:typeof t.sheet=="string"?t.sheet:void 0,s=n?`'${n}'!`:"",u=b=>{if(typeof b=="number")return zL(b);if(typeof b=="string"){const R=b.replace("$","");if(/^\d+$/.test(R))return(b.startsWith("$")?"$":"")+zL(parseInt(R,10))}return b||""},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}`;return T&&g?`${s}${T}:${g}`:T?`${s}${T}`:s.replace(/!$/,"")}function ps(a,p){if(!a)return{};let t=a;if(typeof a=="string"){const g=a.trim();if(g.startsWith("{"))try{t=new Function("return "+g)()}catch{try{t=JSON.parse(g)}catch{}}else try{t=cA(g,p)}catch{}}B4(t,p);const n={},s=t._resolvedSheetId!==void 0?t._resolvedSheetId:typeof t.sheet=="number"?t.sheet:/^\d+$/.test(String(t.sheet||""))?Number(t.sheet):void 0;s!=null&&!isNaN(s)&&(n.sheetId=s);const u=g=>{if(g==null)return null;if(typeof g=="string"){const b=g.trim().replace("$","");return b===""?null:/^\d+$/.test(b)?parseInt(b,10):NaN}return typeof g=="number"?g:null},e=g=>{if(g==null)return null;if(typeof g=="string"){const b=g.trim().replace("$","").toUpperCase();return b===""?null:/^\d+$/.test(b)?parseInt(b,10):IV(b)}return typeof g=="number"?g:null},f=u(t.startRow),y=u(t.endRow),m=e(t.startColumn),T=e(t.endColumn);return f!=null&&(n.startRowIndex=f-1),y!=null&&(n.endRowIndex=y),m!=null&&(n.startColumnIndex=m-1),T!=null&&(n.endColumnIndex=T),n}function YL(a,p){if(!a)return{};let t=a;if(typeof a=="string")if(a.trim().startsWith("{"))try{t=JSON.parse(a)}catch{t=cA(a,{errorPrefix:"Internal"})}else t=cA(a,{errorPrefix:"Internal"});B4(t,p);const n={},s=t._resolvedSheetId!==void 0?t._resolvedSheetId:typeof t.sheet=="number"?t.sheet:void 0;s!=null&&(n.sheetId=s);const u=g=>{if(g==null)return null;if(typeof g=="string"){const b=g.trim().replace("$","");return b===""?null:/^\d+$/.test(b)?parseInt(b,10):NaN}return typeof g=="number"?g:null},e=g=>{if(g==null)return null;if(typeof g=="string"){const b=g.trim().replace("$","").toUpperCase();return b===""?null:/^\d+$/.test(b)?parseInt(b,10):IV(b)}return typeof g=="number"?g:null},f=u(t.startRow),y=u(t.endRow),m=e(t.startColumn),T=e(t.endColumn);return f!=null&&(!isNaN(f)||y===null&&m===null&&T===null)?(n.dimension="ROWS",n.startIndex=isNaN(f)?NaN:f-1,y!=null?n.endIndex=y:n.endIndex=isNaN(f)?NaN:f):m!=null?(n.dimension="COLUMNS",n.startIndex=isNaN(m)?NaN:m-1,T!=null?n.endIndex=T:n.endIndex=isNaN(m)?NaN:m):f!=null&&(n.dimension="ROWS",n.startIndex=isNaN(f)?NaN:f-1,y!=null?n.endIndex=y:n.endIndex=isNaN(f)?NaN:f),n}function ln(a,p){const t=(p==null?void 0:p.errorPrefix)||"";if(typeof a!="string")throw new Error(`${t}Spreadsheet ID must be a string.`);const n=a.trim();if(n.length===0)throw new Error(`${t}Spreadsheet ID cannot be empty.`);if(n.includes("docs.google.com")||n.startsWith("http://")||n.startsWith("https://")||n.startsWith("www.google.com")){const u=n.match(/\/spreadsheets\/d\/e\/([a-zA-Z0-9-_]+)/);if(u&&u[1])return u[1];const e=n.match(/\/spreadsheets\/d\/([a-zA-Z0-9-_]+)/);if(e&&e[1])return e[1];throw new Error(`${t}Invalid Google Sheet URL format. Could not extract a valid Spreadsheet ID from the URL.`)}if(n.includes(" "))throw new Error(`${t}Spreadsheet ID cannot contain spaces.`);if(/[^a-zA-Z0-9-_]/.test(n))throw new Error(`${t}Spreadsheet ID contains invalid characters. Only alphanumeric characters, dashes, and underscores are allowed.`);return n}function UAt(a){if(!a)return"A1";const p=lv(a);if(!p)return"A1";const t=p.split("!");return t[t.length-1].trim().split(":")[0].trim().replace(/\$/g,"")||"A1"}function S4(a,p,t){if(!p){const f=YL(a,t);return f?[f]:[]}const n=ps(a,t),s=n.sheetId,u=f=>{const y={dimension:f};return s!=null&&(y.sheetId=s),f==="COLUMNS"?(n.startColumnIndex!==void 0&&n.startColumnIndex!==null&&(y.startIndex=n.startColumnIndex),n.endColumnIndex!==void 0&&n.endColumnIndex!==null&&(y.endIndex=n.endColumnIndex)):(n.startRowIndex!==void 0&&n.startRowIndex!==null&&(y.startIndex=n.startRowIndex),n.endRowIndex!==void 0&&n.endRowIndex!==null&&(y.endIndex=n.endRowIndex)),y},e=String(p).trim().toUpperCase();return e==="COLUMNS"?[u("COLUMNS")]:e==="ROWS"?[u("ROWS")]:e==="BOTH"?[u("COLUMNS"),u("ROWS")]:[YL(a,t)]}class KAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsGetSpreadsheet,version:"1.0.0",description:"Get Spreadsheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.Editor])[0];if(!b||!b.env)throw new Error("Editor context or environment missing");const R=Be(t,t.project,"getSpreadsheet"),A="["+Ve(t,t.project,"Get spreadsheet")+": `"+R+"`] ",O=(te,re,ae)=>{const le=Ve(te==null?void 0:te.valueOwner,b==null?void 0:b.logic,re),oe=Be(te==null?void 0:te.valueOwner,b==null?void 0:b.logic,ae);return`"${le}" (\`${oe}\`)`},P=n.find(te=>{var re;return((re=te.valueOwner.declaration)==null?void 0:re.id)===G.operation[Q.GoogleSheetsGetSpreadsheet].inputs.connection.id}),x=(s=P==null?void 0:P.value)==null?void 0:s.valueAsType;if(!x||!x.id||!x.name||x.type!==r.DefinitionEntity)throw new Error(`${A}The ${O(P,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const $=ui(x);if(!$)throw new Error(`${A}The ${O(P,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const U=n.find(te=>{var re;return((re=te.valueOwner.declaration)==null?void 0:re.id)===G.operation[Q.GoogleSheetsGetSpreadsheet].inputs.spreadsheetId.id}),q=(u=U==null?void 0:U.value)==null?void 0:u.value,Z=ln(q,{errorPrefix:`${A}The ${O(U,"Spreadsheet ID","spreadsheetId")} input `}),W={Authorization:`Bearer ${await b.getAccessToken()}`},ie=`${(e=b.env)==null?void 0:e.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${b.projectId}/${Zt["google-sheet"]}/${$}`,ee=(await(async te=>Ht.post(ie,te,{headers:W}))({method:"GET",endpoint:`/v4/spreadsheets/${Z}`})).data||{},J=(ee.sheets||[]).map(te=>{var re,ae,le,oe,ce,ge,Ce,Ee,Oe,Le,Fe,tt,We;return{sheetId:(re=te.properties)==null?void 0:re.sheetId,title:(ae=te.properties)==null?void 0:ae.title,index:(le=te.properties)==null?void 0:le.index,sheetType:(oe=te.properties)==null?void 0:oe.sheetType,rowCount:(ge=(ce=te.properties)==null?void 0:ce.gridProperties)==null?void 0:ge.rowCount,columnCount:(Ee=(Ce=te.properties)==null?void 0:Ce.gridProperties)==null?void 0:Ee.columnCount,frozenRowCount:(Le=(Oe=te.properties)==null?void 0:Oe.gridProperties)==null?void 0:Le.frozenRowCount,frozenColumnCount:(tt=(Fe=te.properties)==null?void 0:Fe.gridProperties)==null?void 0:tt.frozenColumnCount,hidden:((We=te.properties)==null?void 0:We.hidden)??!1}});return{value:K.Success,error:null,result:{spreadsheetId:ee.spreadsheetId,title:(f=ee.properties)==null?void 0:f.title,spreadsheetUrl:ee.spreadsheetUrl,locale:(y=ee.properties)==null?void 0:y.locale,timeZone:(m=ee.properties)==null?void 0:m.timeZone,autoRecalc:(T=ee.properties)==null?void 0:T.autoRecalc,sheets:J}}}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+Q.GoogleSheetsAddSheet,version:"1.0.0",description:"Add Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.Editor])[0];if(!b||!b.env)throw new Error("Editor context or environment missing");const R=Be(t,t.project,"addSheet"),A="["+Ve(t,t.project,"Add sheet")+": `"+R+"`] ",O=(oe,ce,ge)=>{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,ge);return`"${Ce}" (\`${Ee}\`)`},P=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[Q.GoogleSheetsAddSheet].inputs.connection.id}),x=(s=P==null?void 0:P.value)==null?void 0:s.valueAsType;if(!x||!x.id||!x.name||x.type!==r.DefinitionEntity)throw new Error(`${A}The ${O(P,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const $=ui(x);if(!$)throw new Error(`${A}The ${O(P,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const U=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[Q.GoogleSheetsAddSheet].inputs.spreadsheetId.id}),q=(u=U==null?void 0:U.value)==null?void 0:u.value,Z=ln(q,{errorPrefix:`${A}The ${O(U,"Spreadsheet ID","spreadsheetId")} input `}),H=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[Q.GoogleSheetsAddSheet].inputs.title.id}),W=(e=H==null?void 0:H.value)==null?void 0:e.value;if(W!=null&&typeof W!="string")throw new Error(`${A}The ${O(H,"Title","title")} input value is invalid. If present, it must be a string. E.g. "New Sheet"`);const z={Authorization:`Bearer ${await b.getAccessToken()}`},Y=`${(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(Y,oe,{headers:z}))({method:"POST",endpoint:`/v4/spreadsheets/${Z}:batchUpdate`,data:{requests:[{addSheet:{properties:{title:W}}}]}})).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+Q.GoogleSheetsDeleteSheet,version:"1.0.0",description:"Delete Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.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=(J,te,re)=>{const ae=Ve(J==null?void 0:J.valueOwner,g==null?void 0:g.logic,te),le=Be(J==null?void 0:J.valueOwner,g==null?void 0:g.logic,re);return`"${ae}" (\`${le}\`)`},O=n.find(J=>{var te;return((te=J.valueOwner.declaration)==null?void 0:te.id)===G.operation[Q.GoogleSheetsDeleteSheet].inputs.connection.id}),P=(s=O==null?void 0:O.value)==null?void 0:s.valueAsType;if(!P||!P.id||!P.name||P.type!==r.DefinitionEntity)throw new Error(`${I}The ${A(O,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=ui(P);if(!x)throw new Error(`${I}The ${A(O,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const $=n.find(J=>{var te;return((te=J.valueOwner.declaration)==null?void 0:te.id)===G.operation[Q.GoogleSheetsDeleteSheet].inputs.spreadsheetId.id}),U=(u=$==null?void 0:$.value)==null?void 0:u.value,q=ln(U,{errorPrefix:`${I}The ${A($,"Spreadsheet ID","spreadsheetId")} input `}),Z=n.find(J=>{var te;return((te=J.valueOwner.declaration)==null?void 0:te.id)===G.operation[Q.GoogleSheetsDeleteSheet].inputs.sheetId.id}),H=(e=Z==null?void 0:Z.value)==null?void 0:e.value;if(H==null||H==="")throw new Error(`${I}The ${A(Z,"Sheet (ID or name)","sheetId")} input is missing.`);const ie={Authorization:`Bearer ${await g.getAccessToken()}`},z=`${(f=g.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${g.projectId}/${Zt["google-sheet"]}/${x}`,Y=async J=>Ht.post(z,J,{headers:ie});let ee;if(typeof H=="number")ee=H;else if(typeof H=="string"){const J=H.trim(),te=await Y({method:"GET",endpoint:`/v4/spreadsheets/${q}?fields=sheets.properties(sheetId,title)`}).catch(()=>null),ae=(((y=te==null?void 0:te.data)==null?void 0:y.sheets)||[]).find(le=>{var oe,ce;return((oe=le.properties)==null?void 0:oe.title)===J||String((ce=le.properties)==null?void 0:ce.sheetId)===J});if(ae&&((m=ae.properties)==null?void 0:m.sheetId)!==void 0)ee=ae.properties.sheetId;else if(/^\d+$/.test(J))ee=parseInt(J,10);else throw new Error(`${I}Sheet "${H}" was not found in the spreadsheet.`)}else throw new Error(`${I}The ${A(Z,"Sheet (ID or name)","sheetId")} input value is invalid. It must be a number or string.`);return await Y({method:"POST",endpoint:`/v4/spreadsheets/${q}:batchUpdate`,data:{requests:[{deleteSheet:{sheetId:ee}}]}}),{value:K.Success,error:null,result:null}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return pe.Logger.log("[Google Sheets] error:",b),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:b,result:null}}}})}}class ZAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsAppendRows,version:"1.0.0",description:"Append Row(s) Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.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,ge)=>{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,ge);return`"${Ce}" (\`${Ee}\`)`},O=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[Q.GoogleSheetsAppendRows].inputs.connection.id}),P=(s=O==null?void 0:O.value)==null?void 0:s.valueAsType;if(!P||!P.id||!P.name||P.type!==r.DefinitionEntity)throw new Error(`${I}The ${A(O,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=ui(P);if(!x)throw new Error(`${I}The ${A(O,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const $=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[Q.GoogleSheetsAppendRows].inputs.spreadsheetId.id}),U=(u=$==null?void 0:$.value)==null?void 0:u.value,q=ln(U,{errorPrefix:`${I}The ${A($,"Spreadsheet ID","spreadsheetId")} input `}),Z=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[Q.GoogleSheetsAppendRows].inputs.range.id}),H=(e=Z==null?void 0:Z.value)==null?void 0:e.value;if(!H||H==="")throw new Error(`${I}The ${A(Z,"Range","range")} input is missing.`);const W=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[Q.GoogleSheetsAppendRows].inputs.values.id}),ie=(f=W==null?void 0:W.value)==null?void 0:f.value;if(ie==null)throw new Error(`${I}The ${A(W,"Values","values")} input is missing.`);const Y={Authorization:`Bearer ${await g.getAccessToken()}`},ee=`${(y=g.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${g.projectId}/${Zt["google-sheet"]}/${x}`,J=async oe=>Ht.post(ee,oe,{headers:Y});let te=ie;if(typeof ie=="string")try{te=JSON.parse(ie)}catch{}const re=await Ha(H,"Name",async()=>{var ce;return(((ce=(await J({method:"GET",endpoint:`/v4/spreadsheets/${q}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:ce.sheets)||[]).map(ge=>{var Ce,Ee;return{id:(Ce=ge.properties)==null?void 0:Ce.sheetId,name:(Ee=ge.properties)==null?void 0:Ee.title}})}),le=(await J({method:"POST",endpoint:`/v4/spreadsheets/${q}/values/${lv(re,{errorPrefix:`${I}The ${A(Z,"Range","range")} input `})}:append`,params:{valueInputOption:"USER_ENTERED"},data:{values:Array.isArray(te)?te:[te]}})).data||{};return{value:K.Success,error:null,result:{updatedRange:(m=le.updates)==null?void 0:m.updatedRange}}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return pe.Logger.log("[Google Sheets] error:",b),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:b,result:null}}}})}}class HAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsGetRangeValues,version:"1.0.0",description:"Get Range Values Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.GoogleSheetsGetRangeValues);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"getRangeValues"),b="["+Ve(t,t.project,"Get range values")+": `"+T+"`] ",R=(te,re,ae)=>{const le=Ve(te==null?void 0:te.valueOwner,m==null?void 0:m.logic,re),oe=Be(te==null?void 0:te.valueOwner,m==null?void 0:m.logic,ae);return`"${le}" (\`${oe}\`)`},I=n.find(te=>{var re;return((re=te.valueOwner.declaration)==null?void 0:re.id)===G.operation[Q.GoogleSheetsGetRangeValues].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(A);if(!O)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(te=>{var re;return((re=te.valueOwner.declaration)==null?void 0:re.id)===G.operation[Q.GoogleSheetsGetRangeValues].inputs.spreadsheetId.id}),x=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(x,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(te=>{var re;return((re=te.valueOwner.declaration)==null?void 0:re.id)===G.operation[Q.GoogleSheetsGetRangeValues].inputs.range.id}),q=(e=U==null?void 0:U.value)==null?void 0:e.value;if(!q||q==="")throw new Error(`${b}The ${R(U,"Range","range")} input is missing.`);const H={Authorization:`Bearer ${await m.getAccessToken()}`},W=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${O}`,ie=async te=>Ht.post(W,te,{headers:H}),z=await Ha(q,"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}})}),Y=lv(z,{errorPrefix:`${b}The ${R(U,"Range","range")} input `}),J=(await ie({method:"GET",endpoint:`/v4/spreadsheets/${$}/values/${encodeURIComponent(Y)}`})).data||{};return{value:K.Success,error:null,result:{values:J.values}}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class WAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsUpdateRangeValues,version:"1.0.0",description:"Update Range Values Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.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 ge=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`"${ge}" (\`${Ce}\`)`},A=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[Q.GoogleSheetsUpdateRangeValues].inputs.connection.id}),O=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${R}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const P=ui(O);if(!P)throw new Error(`${R}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[Q.GoogleSheetsUpdateRangeValues].inputs.spreadsheetId.id}),$=(u=x==null?void 0:x.value)==null?void 0:u.value,U=ln($,{errorPrefix:`${R}The ${I(x,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[Q.GoogleSheetsUpdateRangeValues].inputs.range.id}),Z=(e=q==null?void 0:q.value)==null?void 0:e.value;if(!Z||Z==="")throw new Error(`${R}The ${I(q,"Range","range")} input is missing.`);const H=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[Q.GoogleSheetsUpdateRangeValues].inputs.values.id}),W=(f=H==null?void 0:H.value)==null?void 0:f.value;if(W==null)throw new Error(`${R}The ${I(H,"Values","values")} input is missing.`);const z={Authorization:`Bearer ${await T.getAccessToken()}`},Y=`${(y=T.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${T.projectId}/${Zt["google-sheet"]}/${P}`,ee=async le=>Ht.post(Y,le,{headers:z});let J=W;if(typeof W=="string")try{J=JSON.parse(W)}catch{}const te=await Ha(Z,"Name",async()=>{var oe;return(((oe=(await ee({method:"GET",endpoint:`/v4/spreadsheets/${U}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:oe.sheets)||[]).map(ce=>{var ge,Ce;return{id:(ge=ce.properties)==null?void 0:ge.sheetId,name:(Ce=ce.properties)==null?void 0:Ce.title}})}),ae=(await ee({method:"PUT",endpoint:`/v4/spreadsheets/${U}/values/${lv(te,{errorPrefix:`${R}The ${I(q,"Range","range")} input `})}`,params:{valueInputOption:"USER_ENTERED"},data:{values:Array.isArray(J)?J:[J]}})).data||{};return{value:K.Success,error:null,result:{updatedRange:ae.updatedRange}}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return pe.Logger.log("[Google Sheets] error:",g),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:g,result:null}}}})}}class zAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsClearRange,version:"1.0.0",description:"Clear Range Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.GoogleSheetsClearRange);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"clearRange"),b="["+Ve(t,t.project,"Clear range")+": `"+T+"`] ",R=(J,te,re)=>{const ae=Ve(J==null?void 0:J.valueOwner,m==null?void 0:m.logic,te),le=Be(J==null?void 0:J.valueOwner,m==null?void 0:m.logic,re);return`"${ae}" (\`${le}\`)`},I=n.find(J=>{var te;return((te=J.valueOwner.declaration)==null?void 0:te.id)===G.operation[Q.GoogleSheetsClearRange].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(A);if(!O)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(J=>{var te;return((te=J.valueOwner.declaration)==null?void 0:te.id)===G.operation[Q.GoogleSheetsClearRange].inputs.spreadsheetId.id}),x=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(x,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(J=>{var te;return((te=J.valueOwner.declaration)==null?void 0:te.id)===G.operation[Q.GoogleSheetsClearRange].inputs.range.id}),q=(e=U==null?void 0:U.value)==null?void 0:e.value;if(!q||q==="")throw new Error(`${b}The ${R(U,"Range","range")} input is missing.`);const H={Authorization:`Bearer ${await m.getAccessToken()}`},W=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${O}`,ie=async J=>Ht.post(W,J,{headers:H}),z=await Ha(q,"Name",async()=>{var te;return(((te=(await ie({method:"GET",endpoint:`/v4/spreadsheets/${$}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:te.sheets)||[]).map(re=>{var ae,le;return{id:(ae=re.properties)==null?void 0:ae.sheetId,name:(le=re.properties)==null?void 0:le.title}})}),ee=(await ie({method:"POST",endpoint:`/v4/spreadsheets/${$}/values/${lv(z,{errorPrefix:`${b}The ${R(U,"Range","range")} input `})}:clear`,data:{}})).data||{};return{value:K.Success,error:null,result:{clearedRange:ee.clearedRange}}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class YAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsBatchUpdateSpreadsheet,version:"1.0.0",description:"Batch Update Spreadsheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.GoogleSheetsBatchUpdateSpreadsheet);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"batchUpdateSpreadsheet"),b="["+Ve(t,t.project,"Batch update spreadsheet")+": `"+T+"`] ",R=(J,te,re)=>{const ae=Ve(J==null?void 0:J.valueOwner,m==null?void 0:m.logic,te),le=Be(J==null?void 0:J.valueOwner,m==null?void 0:m.logic,re);return`"${ae}" (\`${le}\`)`},I=n.find(J=>{var te;return((te=J.valueOwner.declaration)==null?void 0:te.id)===G.operation[Q.GoogleSheetsBatchUpdateSpreadsheet].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(A);if(!O)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(J=>{var te;return((te=J.valueOwner.declaration)==null?void 0:te.id)===G.operation[Q.GoogleSheetsBatchUpdateSpreadsheet].inputs.spreadsheetId.id}),x=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(x,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(J=>{var te;return((te=J.valueOwner.declaration)==null?void 0:te.id)===G.operation[Q.GoogleSheetsBatchUpdateSpreadsheet].inputs.requests.id}),q=(e=U==null?void 0:U.value)==null?void 0:e.value;if(q==null||q==="")throw new Error(`${b}The ${R(U,"Requests","requests")} input is missing.`);let Z=q;if(typeof q=="string")try{Z=JSON.parse(q)}catch{}if(Array.isArray(Z)||(Z=[Z]),Z.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 W={Authorization:`Bearer ${await m.getAccessToken()}`},ie=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${O}`,ee=(await(async J=>Ht.post(ie,J,{headers:W}))({method:"POST",endpoint:`/v4/spreadsheets/${$}:batchUpdate`,data:{requests:Z}})).data||{};return{value:K.Success,result:{replies:ee.replies||[]},error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class JAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsRenameSheet,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.Editor])[0];if(!b||!b.env)throw new Error("Editor context or environment missing");const R=Be(t,t.project,"renameSheet"),A="["+Ve(t,t.project,"Rename sheet")+": `"+R+"`] ",O=(oe,ce,ge)=>{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,ge);return`"${Ce}" (\`${Ee}\`)`},P=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[Q.GoogleSheetsRenameSheet].inputs.connection.id}),x=(s=P==null?void 0:P.value)==null?void 0:s.valueAsType;if(!x||!x.id||!x.name||x.type!==r.DefinitionEntity)throw new Error(`${A}The ${O(P,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const $=ui(x);if(!$)throw new Error(`${A}The ${O(P,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const U=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[Q.GoogleSheetsRenameSheet].inputs.spreadsheetId.id}),q=(u=U==null?void 0:U.value)==null?void 0:u.value,Z=ln(q,{errorPrefix:`${A}The ${O(U,"Spreadsheet ID","spreadsheetId")} input `}),H=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[Q.GoogleSheetsRenameSheet].inputs.sheetId.id}),W=(e=H==null?void 0:H.value)==null?void 0:e.value;if(W==null||W==="")throw new Error(`${A}The ${O(H,"Sheet (ID or name)","sheetId")} input is missing.`);const ie=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[Q.GoogleSheetsRenameSheet].inputs.title.id}),z=(f=ie==null?void 0:ie.value)==null?void 0:f.value;if(z!=null&&typeof z!="string")throw new Error(`${A}The ${O(ie,"Title","title")} input value is invalid, if present, it must be a string.`);const ee={Authorization:`Bearer ${await b.getAccessToken()}`},J=`${(y=b.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${b.projectId}/${Zt["google-sheet"]}/${$}`,te=async oe=>Ht.post(J,oe,{headers:ee});let re;if(typeof W=="number")re=W;else if(typeof W=="string"){const oe=W.trim(),ce=await te({method:"GET",endpoint:`/v4/spreadsheets/${Z}?fields=sheets.properties(sheetId,title)`}).catch(()=>null),Ce=(((m=ce==null?void 0:ce.data)==null?void 0:m.sheets)||[]).find(Ee=>{var Oe,Le;return((Oe=Ee.properties)==null?void 0:Oe.title)===oe||String((Le=Ee.properties)==null?void 0:Le.sheetId)===oe});if(Ce&&((T=Ce.properties)==null?void 0:T.sheetId)!==void 0)re=Ce.properties.sheetId;else if(/^\d+$/.test(oe))re=parseInt(oe,10);else throw new Error(`${A}Sheet "${W}" was not found in the spreadsheet.`)}else throw new Error(`${A}The ${O(H,"Sheet (ID or name)","sheetId")} input value is invalid. It must be a number or string.`);const ae={sheetId:re},le=[];return ae.title=z||"",le.push("title"),await te({method:"POST",endpoint:`/v4/spreadsheets/${Z}:batchUpdate`,data:{requests:[{updateSheetProperties:{properties:ae,fields:le.join(",")}}]}}),{value:K.Success,result:null,error:null}}catch(b){const R=((g=b.response)==null?void 0:g.data)||b.message||b;return pe.Logger.log("[Google Sheets] error:",R),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:R,result:null}}}})}}class QAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsCopySheet,version:"1.0.0",description:"Copy Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.Editor])[0];if(!R||!R.env)throw new Error("Editor context or environment missing");const I=Be(t,t.project,"copySheet"),O="["+Ve(t,t.project,"Copy sheet")+": `"+I+"`] ",P=(Oe,Le,Fe)=>{const tt=Ve(Oe==null?void 0:Oe.valueOwner,R==null?void 0:R.logic,Le),We=Be(Oe==null?void 0:Oe.valueOwner,R==null?void 0:R.logic,Fe);return`"${tt}" (\`${We}\`)`},x=n.find(Oe=>{var Le;return((Le=Oe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[Q.GoogleSheetsCopySheet].inputs.connection.id}),$=(s=x==null?void 0:x.value)==null?void 0:s.valueAsType;if(!$||!$.id||!$.name||$.type!==r.DefinitionEntity)throw new Error(`${O}The ${P(x,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const U=ui($);if(!U)throw new Error(`${O}The ${P(x,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const q=n.find(Oe=>{var Le;return((Le=Oe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[Q.GoogleSheetsCopySheet].inputs.spreadsheetId.id}),Z=(u=q==null?void 0:q.value)==null?void 0:u.value,H=ln(Z,{errorPrefix:`${O}The ${P(q,"Spreadsheet ID","spreadsheetId")} input `}),W=n.find(Oe=>{var Le;return((Le=Oe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[Q.GoogleSheetsCopySheet].inputs.sheetId.id}),ie=(e=W==null?void 0:W.value)==null?void 0:e.value;if(ie==null||ie==="")throw new Error(`${O}The ${P(W,"Sheet (ID or name)","sheetId")} input is missing.`);const z=n.find(Oe=>{var Le;return((Le=Oe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[Q.GoogleSheetsCopySheet].inputs.destinationSpreadsheetId.id}),Y=(f=z==null?void 0:z.value)==null?void 0:f.value;let ee=H;if(Y!=null&&String(Y).trim()!==""){if(typeof Y!="string")throw new Error(`${O}The ${P(z,"Destination Spreadsheet ID","destinationSpreadsheetId")} input value is invalid, if present, it must be a string.`);ee=ln(Y,{errorPrefix:`${O}The ${P(z,"Destination Spreadsheet ID","destinationSpreadsheetId")} input `})}const J=n.find(Oe=>{var Le;return((Le=Oe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[Q.GoogleSheetsCopySheet].inputs.newSheetName.id}),te=(y=J==null?void 0:J.value)==null?void 0:y.value;if(te!=null&&typeof te!="string")throw new Error(`${O}The ${P(J,"New Sheet Name","newSheetName")} input value is invalid, if present, it must be a string.`);const ae={Authorization:`Bearer ${await R.getAccessToken()}`},le=`${(m=R.env)==null?void 0:m.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${R.projectId}/${Zt["google-sheet"]}/${U}`,oe=async Oe=>Ht.post(le,Oe,{headers:ae});let ce;if(typeof ie=="number")ce=ie;else if(typeof ie=="string"){const Oe=ie.trim(),Le=await oe({method:"GET",endpoint:`/v4/spreadsheets/${H}?fields=sheets.properties(sheetId,title)`}).catch(()=>null),tt=(((T=Le==null?void 0:Le.data)==null?void 0:T.sheets)||[]).find(We=>{var et,qe;return((et=We.properties)==null?void 0:et.title)===Oe||String((qe=We.properties)==null?void 0:qe.sheetId)===Oe});if(tt&&((g=tt.properties)==null?void 0:g.sheetId)!==void 0)ce=tt.properties.sheetId;else if(/^\d+$/.test(Oe))ce=parseInt(Oe,10);else throw new Error(`${O}Sheet "${ie}" was not found in the source spreadsheet.`)}else throw new Error(`${O}The ${P(W,"Sheet (ID or name)","sheetId")} input value is invalid. It must be a number or string.`);const Ee=((await oe({method:"POST",endpoint:`/v4/spreadsheets/${H}/sheets/${ce}:copyTo`,data:{destinationSpreadsheetId:ee}})).data||{}).sheetId;return te&&typeof te=="string"&&te.trim()!==""&&await oe({method:"POST",endpoint:`/v4/spreadsheets/${ee}:batchUpdate`,data:{requests:[{updateSheetProperties:{properties:{sheetId:Ee,title:te.trim()},fields:"title"}}]}}),{value:K.Success,result:{newSheetId:Ee},error:null}}catch(R){const I=((b=R.response)==null?void 0:b.data)||R.message||R;return pe.Logger.log("[Google Sheets] error:",I),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:I,result:null}}}})}}class XAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsClearSheet,version:"1.0.0",description:"Clear Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.Editor])[0];if(!R||!R.env)throw new Error("Editor context or environment missing");const I=Be(t,t.project,"clearSheet"),O="["+Ve(t,t.project,"Clear sheet")+": `"+I+"`] ",P=(le,oe,ce)=>{const ge=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`"${ge}" (\`${Ce}\`)`},x=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[Q.GoogleSheetsClearSheet].inputs.connection.id}),$=(s=x==null?void 0:x.value)==null?void 0:s.valueAsType;if(!$||!$.id||!$.name||$.type!==r.DefinitionEntity)throw new Error(`${O}The ${P(x,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const U=ui($);if(!U)throw new Error(`${O}The ${P(x,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const q=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[Q.GoogleSheetsClearSheet].inputs.spreadsheetId.id}),Z=(u=q==null?void 0:q.value)==null?void 0:u.value,H=ln(Z,{errorPrefix:`${O}The ${P(q,"Spreadsheet ID","spreadsheetId")} input `}),W=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[Q.GoogleSheetsClearSheet].inputs.sheetName.id}),ie=(e=W==null?void 0:W.value)==null?void 0:e.value;if(ie==null||ie==="")throw new Error(`${O}The ${P(W,"Sheet (ID or name)","sheetName")} input is missing.`);const Y={Authorization:`Bearer ${await R.getAccessToken()}`},ee=`${(f=R.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${R.projectId}/${Zt["google-sheet"]}/${U}`,J=async le=>Ht.post(ee,le,{headers:Y});let te;if(typeof ie=="string"){const le=ie.trim();if(/^\d+$/.test(le)){const oe=await J({method:"GET",endpoint:`/v4/spreadsheets/${H}?fields=sheets.properties(sheetId,title)`}).catch(()=>null),ge=(((y=oe==null?void 0:oe.data)==null?void 0:y.sheets)||[]).find(Ce=>{var Ee,Oe;return String((Ee=Ce.properties)==null?void 0:Ee.sheetId)===le||((Oe=Ce.properties)==null?void 0:Oe.title)===le});te=((m=ge==null?void 0:ge.properties)==null?void 0:m.title)||le}else te=le}else if(typeof ie=="number"){const ce=(((T=(await J({method:"GET",endpoint:`/v4/spreadsheets/${H}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:T.sheets)||[]).find(ge=>{var Ce;return Number((Ce=ge.properties)==null?void 0:Ce.sheetId)===ie});if(!ce||!((g=ce.properties)!=null&&g.title))throw new Error(`${O}Sheet with ID ${ie} was not found in the spreadsheet.`);te=ce.properties.title}else throw new Error(`${O}The ${P(W,"Sheet (ID or name)","sheetName")} input value is invalid. It must be a number or string.`);const ae=(await J({method:"POST",endpoint:`/v4/spreadsheets/${H}/values/${encodeURIComponent(te)}:clear`,data:{}})).data||{};return{value:K.Success,result:{clearedRange:ae.clearedRange},error:null}}catch(R){const I=((b=R.response)==null?void 0:b.data)||R.message||R;return pe.Logger.log("[Google Sheets] error:",I),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:I,result:null}}}})}}class e1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsBatchGetValues,version:"1.0.0",description:"Batch Get Values Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.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,ge,Ce)=>{const Ee=Ve(ce==null?void 0:ce.valueOwner,g==null?void 0:g.logic,ge),Oe=Be(ce==null?void 0:ce.valueOwner,g==null?void 0:g.logic,Ce);return`"${Ee}" (\`${Oe}\`)`},O=n.find(ce=>{var ge;return((ge=ce.valueOwner.declaration)==null?void 0:ge.id)===G.operation[Q.GoogleSheetsBatchGetValues].inputs.connection.id}),P=(s=O==null?void 0:O.value)==null?void 0:s.valueAsType;if(!P||!P.id||!P.name||P.type!==r.DefinitionEntity)throw new Error(`${I}The ${A(O,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=ui(P);if(!x)throw new Error(`${I}The ${A(O,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const $=n.find(ce=>{var ge;return((ge=ce.valueOwner.declaration)==null?void 0:ge.id)===G.operation[Q.GoogleSheetsBatchGetValues].inputs.spreadsheetId.id}),U=(u=$==null?void 0:$.value)==null?void 0:u.value,q=ln(U,{errorPrefix:`${I}The ${A($,"Spreadsheet ID","spreadsheetId")} input `}),Z=n.find(ce=>{var ge;return((ge=ce.valueOwner.declaration)==null?void 0:ge.id)===G.operation[Q.GoogleSheetsBatchGetValues].inputs.ranges.id}),H=(e=Z==null?void 0:Z.value)==null?void 0:e.value;if(H==null||H==="")throw new Error(`${I}The ${A(Z,"Ranges","ranges")} input is missing.`);const ie={Authorization:`Bearer ${await g.getAccessToken()}`},z=`${(f=g.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${g.projectId}/${Zt["google-sheet"]}/${x}`,Y=async ce=>Ht.post(z,ce,{headers:ie});let ee=Array.isArray(H)?H:[H];if(ee.length===0)throw new Error(`${I}The ${A(Z,"Ranges","ranges")} input evaluated to an empty array. E.g. ["Sheet1!A1:B2"]`);let J=new Set;try{const ge=((y=(await Y({method:"GET",endpoint:`/v4/spreadsheets/${q}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:y.sheets)||[];J=new Set(ge.map(Ce=>{var Ee;return(Ee=Ce.properties)==null?void 0:Ee.title}).filter(Boolean))}catch{}const te=ce=>{const ge=ce.indexOf("!");if(ge>-1){let Ce=ce.substring(0,ge).trim();return Ce.startsWith("'")&&Ce.endsWith("'")&&(Ce=Ce.slice(1,-1)),Ce}return null},re=[],ae=[];for(const ce of ee){const ge=lv(ce,{errorPrefix:`${I}The ${A(Z,"Ranges","ranges")} input `}),Ce=te(ge);Ce&&J.size>0&&!J.has(Ce)?ae.push({range:ge,majorDimension:"ROWS",values:[]}):re.push({a1Range:ge})}let le=[];re.length>0&&(le=(((m=(await Y({method:"POST",endpoint:`/v4/spreadsheets/${q}/values:batchGetByDataFilter`,data:{dataFilters:re}})).data)==null?void 0:m.valueRanges)||[]).map(Ce=>Ce.valueRange||Ce));const oe=[...le,...ae];return{value:K.Success,result:{valueRanges:oe},error:null}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return pe.Logger.log("[Google Sheets] error:",b),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:b,result:null}}}})}}function fo(a){if(!a||typeof a!="object")return;const p={};return typeof a.red=="number"&&(p.red=a.red>1?a.red/255:a.red),typeof a.green=="number"&&(p.green=a.green>1?a.green/255:a.green),typeof a.blue=="number"&&(p.blue=a.blue>1?a.blue/255:a.blue),typeof a.alpha=="number"&&(p.alpha=a.alpha),Object.keys(p).length>0?p:void 0}class t1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsFormatCells,version:"1.0.0",description:"Format Cells Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.GoogleSheetsFormatCells);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=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[Q.GoogleSheetsFormatCells].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(A);if(!O)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(ft=>{var Et;return((Et=ft.valueOwner.declaration)==null?void 0:Et.id)===G.operation[Q.GoogleSheetsFormatCells].inputs.spreadsheetId.id}),x=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(x,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(ft=>{var Et;return((Et=ft.valueOwner.declaration)==null?void 0:Et.id)===G.operation[Q.GoogleSheetsFormatCells].inputs.range.id}),q=(e=U==null?void 0:U.value)==null?void 0:e.value;if(q==null)throw new Error(`${b}The ${R(U,"Range","range")} input is missing.`);const H={Authorization:`Bearer ${await m.getAccessToken()}`},W=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${O}`,ie=async ft=>Ht.post(W,ft,{headers:H}),z=await Ha(q,"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}))),Y=ps(z,{errorPrefix:`${b}The ${R(U,"Range","range")} input `}),ee=G.operation[Q.GoogleSheetsFormatCells].inputs,J=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},te=J(ee.bold.id),re=J(ee.italic.id),ae=J(ee.underline.id),le=J(ee.strikethrough.id),oe=J(ee.fontSize.id),ce=J(ee.fontFamily.id),ge=J(ee.textColor.id),Ce=J(ee.backgroundColor.id),Ee=J(ee.horizontalAlignment.id),Oe=J(ee.verticalAlignment.id),Le=J(ee.wrapStrategy.id),Fe={},tt=[],We={},et=[];typeof te=="boolean"&&(We.bold=te,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(ge);qe&&(We.foregroundColor=qe,et.push("foregroundColor")),et.length>0&&(Fe.textFormat=We,tt.push(`userEnteredFormat.textFormat(${et.join(",")})`));const ot=fo(Ce);if(ot&&(Fe.backgroundColor=ot,tt.push("userEnteredFormat.backgroundColor")),typeof Ee=="string"&&Ee!==""){const ft={Left:"LEFT",Center:"CENTER",Right:"RIGHT",Justify:"JUSTIFY"};Fe.horizontalAlignment=ft[Ee]||Ee.toUpperCase(),tt.push("userEnteredFormat.horizontalAlignment")}if(typeof Oe=="string"&&Oe!==""){const ft={Top:"TOP",Middle:"MIDDLE",Bottom:"BOTTOM"};Fe.verticalAlignment=ft[Oe]||Oe.toUpperCase(),tt.push("userEnteredFormat.verticalAlignment")}if(typeof Le=="string"&&Le!==""){const ft={"Overflow cell":"OVERFLOW_CELL","Wrap text":"WRAP","Clip text":"CLIP"};Fe.wrapStrategy=ft[Le]||Le.toUpperCase(),tt.push("userEnteredFormat.wrapStrategy")}if(tt.length===0)return{value:K.Success,result:null,error:null};const st={repeatCell:{range:Y,cell:{userEnteredFormat:Fe},fields:tt.join(",")}};return await ie({method:"POST",endpoint:`/v4/spreadsheets/${$}:batchUpdate`,data:{requests:[st]}}),{value:K.Success,result:null,error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class i1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsSetNumberFormat,version:"1.0.0",description:"Set Number Format Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.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),ge=Be(ae==null?void 0:ae.valueOwner,T==null?void 0:T.logic,oe);return`"${ce}" (\`${ge}\`)`},A=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[Q.GoogleSheetsSetNumberFormat].inputs.connection.id}),O=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${R}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const P=ui(O);if(!P)throw new Error(`${R}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[Q.GoogleSheetsSetNumberFormat].inputs.spreadsheetId.id}),$=(u=x==null?void 0:x.value)==null?void 0:u.value,U=ln($,{errorPrefix:`${R}The ${I(x,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[Q.GoogleSheetsSetNumberFormat].inputs.range.id}),Z=(e=q==null?void 0:q.value)==null?void 0:e.value;if(Z==null)throw new Error(`${R}The ${I(q,"Range","range")} input is missing.`);const W={Authorization:`Bearer ${await T.getAccessToken()}`},ie=`${(f=T.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${T.projectId}/${Zt["google-sheet"]}/${P}`,z=async ae=>Ht.post(ie,ae,{headers:W}),Y=await Ha(Z,"Id",async()=>(await z({method:"GET",endpoint:`/v4/spreadsheets/${U}?fields=sheets.properties(sheetId,title)`})).data.sheets.map(le=>({id:le.properties.sheetId,name:le.properties.title}))),ee=ps(Y,{errorPrefix:`${R}The ${I(q,"Range","range")} input `}),J=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[Q.GoogleSheetsSetNumberFormat].inputs.pattern.id}),te=(y=J==null?void 0:J.value)==null?void 0:y.value;if(te==null||te==="")throw new Error(`${R}The ${I(J,"Pattern","pattern")} input is missing.`);if(typeof te!="string")throw new Error(`${R}The ${I(J,"Pattern","pattern")} input value is invalid. It must be a string.`);const re={repeatCell:{range:ee,cell:{userEnteredFormat:{numberFormat:{type:"CUSTOM",pattern:te}}},fields:"userEnteredFormat.numberFormat"}};return await z({method:"POST",endpoint:`/v4/spreadsheets/${U}:batchUpdate`,data:{requests:[re]}}),{value:K.Success,result:null,error:null}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return pe.Logger.log("[Google Sheets] error:",g),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:g,result:null}}}})}}class n1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsMergeCells,version:"1.0.0",description:"Merge Cells Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.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,ge)=>{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,ge);return`"${Ce}" (\`${Ee}\`)`},A=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[Q.GoogleSheetsMergeCells].inputs.connection.id}),O=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${R}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const P=ui(O);if(!P)throw new Error(`${R}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[Q.GoogleSheetsMergeCells].inputs.spreadsheetId.id}),$=(u=x==null?void 0:x.value)==null?void 0:u.value,U=ln($,{errorPrefix:`${R}The ${I(x,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[Q.GoogleSheetsMergeCells].inputs.range.id}),Z=(e=q==null?void 0:q.value)==null?void 0:e.value;if(!Z||Z==="")throw new Error(`${R}The ${I(q,"Range","range")} input is missing.`);const H=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[Q.GoogleSheetsMergeCells].inputs.mergeType.id}),W=(f=H==null?void 0:H.value)==null?void 0:f.value,ie={Columns:"MERGE_COLUMNS",Rows:"MERGE_ROWS",Both:"MERGE_ALL","All (combine entire range)":"MERGE_ALL","Columns (merge within columns)":"MERGE_COLUMNS","Rows (merge within rows)":"MERGE_ROWS",MERGE_ALL:"MERGE_ALL",MERGE_COLUMNS:"MERGE_COLUMNS",MERGE_ROWS:"MERGE_ROWS"},z=typeof W=="string"?W:String(W||""),Y=ie[z]||(W?String(W).toUpperCase():"MERGE_ALL"),J={Authorization:`Bearer ${await T.getAccessToken()}`},te=`${(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(te,oe,{headers:J}),ae=await Ha(Z,"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(ge=>{var Ce,Ee;return{id:(Ce=ge.properties)==null?void 0:Ce.sheetId,name:(Ee=ge.properties)==null?void 0:Ee.title}})}),le=ps(ae,{errorPrefix:`${R}The ${I(q,"Range","range")} input `});return await re({method:"POST",endpoint:`/v4/spreadsheets/${U}:batchUpdate`,data:{requests:[{mergeCells:{range:le,mergeType:Y}}]}}),{value:K.Success,error:null,result:null}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return pe.Logger.log("[Google Sheets] error:",g),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:g,result:null}}}})}}class r1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsUnmergeCells,version:"1.0.0",description:"Unmerge Cells Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.GoogleSheetsUnmergeCells);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"unmergeCells"),b="["+Ve(t,t.project,"Unmerge cells")+": `"+T+"`] ",R=(ee,J,te)=>{const re=Ve(ee==null?void 0:ee.valueOwner,m==null?void 0:m.logic,J),ae=Be(ee==null?void 0:ee.valueOwner,m==null?void 0:m.logic,te);return`"${re}" (\`${ae}\`)`},I=n.find(ee=>{var J;return((J=ee.valueOwner.declaration)==null?void 0:J.id)===G.operation[Q.GoogleSheetsUnmergeCells].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(A);if(!O)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(ee=>{var J;return((J=ee.valueOwner.declaration)==null?void 0:J.id)===G.operation[Q.GoogleSheetsUnmergeCells].inputs.spreadsheetId.id}),x=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(x,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(ee=>{var J;return((J=ee.valueOwner.declaration)==null?void 0:J.id)===G.operation[Q.GoogleSheetsUnmergeCells].inputs.range.id}),q=(e=U==null?void 0:U.value)==null?void 0:e.value;if(!q||q==="")throw new Error(`${b}The ${R(U,"Range","range")} input is missing.`);const H={Authorization:`Bearer ${await m.getAccessToken()}`},W=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${O}`,ie=async ee=>Ht.post(W,ee,{headers:H}),z=await Ha(q,"Id",async()=>{var J;return(((J=(await ie({method:"GET",endpoint:`/v4/spreadsheets/${$}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:J.sheets)||[]).map(te=>{var re,ae;return{id:(re=te.properties)==null?void 0:re.sheetId,name:(ae=te.properties)==null?void 0:ae.title}})}),Y=ps(z,{errorPrefix:`${b}The ${R(U,"Range","range")} input `});return await ie({method:"POST",endpoint:`/v4/spreadsheets/${$}:batchUpdate`,data:{requests:[{unmergeCells:{range:Y}}]}}),{value:K.Success,error:null,result:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class a1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsAutoResizeDimensions,version:"1.0.0",description:"Auto-Resize Dimensions Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.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),ge=Be(ae==null?void 0:ae.valueOwner,T==null?void 0:T.logic,oe);return`"${ce}" (\`${ge}\`)`},A=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[Q.GoogleSheetsAutoResizeDimensions].inputs.connection.id}),O=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${R}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const P=ui(O);if(!P)throw new Error(`${R}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[Q.GoogleSheetsAutoResizeDimensions].inputs.spreadsheetId.id}),$=(u=x==null?void 0:x.value)==null?void 0:u.value,U=ln($,{errorPrefix:`${R}The ${I(x,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[Q.GoogleSheetsAutoResizeDimensions].inputs.range.id}),Z=(e=q==null?void 0:q.value)==null?void 0:e.value;if(Z==null)throw new Error(`${R}The ${I(q,"Range","range")} input is missing.`);const H=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[Q.GoogleSheetsAutoResizeDimensions].inputs.dimension.id}),W=((f=H==null?void 0:H.value)==null?void 0:f.value)||"Both",z={Authorization:`Bearer ${await T.getAccessToken()}`},Y=`${(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(Y,ae,{headers:z}),J=await Ha(Z,"Id",async()=>{var le;return(((le=(await ee({method:"GET",endpoint:`/v4/spreadsheets/${U}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:le.sheets)||[]).map(oe=>{var ce,ge;return{id:(ce=oe.properties)==null?void 0:ce.sheetId,name:(ge=oe.properties)==null?void 0:ge.title}})}),re=S4(J,typeof W=="string"?W:void 0,{errorPrefix:`${R}The ${I(q,"Range","range")} input `}).map(ae=>({autoResizeDimensions:{dimensions:ae}}));return await ee({method:"POST",endpoint:`/v4/spreadsheets/${U}:batchUpdate`,data:{requests:re}}),{value:K.Success,result:null,error:null}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return pe.Logger.log("[Google Sheets] error:",g),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:g,result:null}}}})}}class s1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsFindAndReplace,version:"1.0.0",description:"Find and Replace Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.GoogleSheetsFindAndReplace);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A;try{const O=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!O||!O.env)throw new Error("Editor context or environment missing");const P=Be(t,t.project,"findAndReplace"),$="["+Ve(t,t.project,"Find and replace")+": `"+P+"`] ",U=(et,qe,ot)=>{const st=Ve(et==null?void 0:et.valueOwner,O==null?void 0:O.logic,qe),ft=Be(et==null?void 0:et.valueOwner,O==null?void 0:O.logic,ot);return`"${st}" (\`${ft}\`)`},q=n.find(et=>{var qe;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===G.operation[Q.GoogleSheetsFindAndReplace].inputs.connection.id}),Z=(s=q==null?void 0:q.value)==null?void 0:s.valueAsType;if(!Z||!Z.id||!Z.name||Z.type!==r.DefinitionEntity)throw new Error(`${$}The ${U(q,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const H=ui(Z);if(!H)throw new Error(`${$}The ${U(q,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const W=n.find(et=>{var qe;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===G.operation[Q.GoogleSheetsFindAndReplace].inputs.spreadsheetId.id}),ie=(u=W==null?void 0:W.value)==null?void 0:u.value,z=ln(ie,{errorPrefix:`${$}The ${U(W,"Spreadsheet ID","spreadsheetId")} input `}),Y=n.find(et=>{var qe;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===G.operation[Q.GoogleSheetsFindAndReplace].inputs.range.id}),ee=(e=Y==null?void 0:Y.value)==null?void 0:e.value;if(ee==null)throw new Error(`${$}The ${U(Y,"Range","range")} input is missing.`);const J=n.find(et=>{var qe;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===G.operation[Q.GoogleSheetsFindAndReplace].inputs.find.id}),te=(f=J==null?void 0:J.value)==null?void 0:f.value;if(!te||te==="")throw new Error(`${$}The ${U(J,"Find","find")} input is missing.`);if(typeof te!="string")throw new Error(`${$}The ${U(J,"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[Q.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[Q.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[Q.GoogleSheetsFindAndReplace].inputs.matchEntireCell.id}),ge=!!((T=ce==null?void 0:ce.value)!=null&&T.value),Ee={Authorization:`Bearer ${await O.getAccessToken()}`},Oe=`${(g=O.env)==null?void 0:g.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${O.projectId}/${Zt["google-sheet"]}/${H}`,Le=async et=>Ht.post(Oe,et,{headers:Ee}),Fe={findReplace:{range:ps(ee,{errorPrefix:`${$}The ${U(Y,"Range","range")} input `}),find:te,replacement:ae,matchCase:oe,matchEntireCell:ge}},We=(await Le({method:"POST",endpoint:`/v4/spreadsheets/${z}:batchUpdate`,data:{requests:[Fe]}})).data||{};return{value:K.Success,result:{occurrencesChanged:((I=(R=(b=We.replies)==null?void 0:b[0])==null?void 0:R.findReplace)==null?void 0:I.occurrencesChanged)||0},error:null}}catch(O){const P=((A=O.response)==null?void 0:A.data)||O.message||O;return pe.Logger.log("[Google Sheets] error:",P),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:P,result:null}}}})}}const JL={"List of items":"ONE_OF_LIST","List from cell range":"ONE_OF_RANGE","Number greater than":"NUMBER_GREATER","Number greater than or equal":"NUMBER_GREATER_THAN_EQ","Number less than":"NUMBER_LESS","Number less than or equal":"NUMBER_LESS_THAN_EQ","Number equal to":"NUMBER_EQ","Number not equal to":"NUMBER_NOT_EQ","Number between":"NUMBER_BETWEEN","Number not between":"NUMBER_NOT_BETWEEN","Text contains":"TEXT_CONTAINS","Text does not contain":"TEXT_NOT_CONTAINS","Text starts with":"TEXT_STARTS_WITH","Text ends with":"TEXT_ENDS_WITH","Text equals":"TEXT_EQ","Text is valid email":"TEXT_IS_EMAIL","Text is valid URL":"TEXT_IS_URL","Date is":"DATE_EQ","Date is before":"DATE_BEFORE","Date is after":"DATE_AFTER","Date is on or before":"DATE_ON_OR_BEFORE","Date is on or after":"DATE_ON_OR_AFTER","Date is between":"DATE_BETWEEN","Date is not between":"DATE_NOT_BETWEEN","Date is valid":"DATE_IS_VALID",Checkbox:"BOOLEAN","Custom formula":"CUSTOM_FORMULA"},nO={NUMBER_EQUAL:"NUMBER_EQ",NUMBER_NOT_EQUAL:"NUMBER_NOT_EQ",TEXT_DOES_NOT_CONTAIN:"TEXT_NOT_CONTAINS",TEXT_EQUAL:"TEXT_EQ",DATE_TIME_EQUAL:"DATE_EQ",DATE_EQUAL:"DATE_EQ"},mRn=new Set([...Object.values(JL),...Object.keys(nO),...Object.values(nO)]);function l1t(a){if(!a||typeof a!="string")return null;const p=a.trim();if(!p)return null;if(JL[p])return JL[p];const t=p.toUpperCase().replace(/\s+/g,"_");return nO[t]?nO[t]:(mRn.has(t),t)}function TRn(a,p,t){if(a.length===0){t.push(new ht({id:`${p.id}--${Nr.ConditionValuesInvalidFormula}`,message:'Custom formula condition requires a formula string starting with "=" (e.g., ["=SUM(A1:A10)>100"]).',severity:Ie.Error,code:Nr.ConditionValuesInvalidFormula,entity:p}));return}a.length>1&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesInvalidFormula}-count`,message:`Custom formula condition rule accepts only 1 formula string (e.g., ["=SUM(A1:A10)>100"]). You provided ${a.length} items.`,severity:Ie.Error,code:Nr.ConditionValuesInvalidFormula,entity:p}));for(let n=0;n<a.length;n++){const s=String(a[n]).trim();s.startsWith("=")||t.push(new ht({id:`${p.id}--${Nr.ConditionValuesInvalidFormula}-${n}`,message:`Custom formula "${s}" ${a.length>1?`(at index ${n}) `:""}is invalid. A custom formula must start with "=" (e.g., "=A1>100" or "=ISNUMBER(A1)").`,severity:Ie.Error,code:Nr.ConditionValuesInvalidFormula,entity:p}))}}function vRn(a,p,t){if(a.length===0){t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleNumberRequired}`,message:'This numeric condition rule requires 1 numeric target value (e.g., ["100"]).',severity:Ie.Error,code:Nr.ConditionValuesSingleNumberRequired,entity:p}));return}a.length>1&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleNumberRequired}-count`,message:`This numeric condition rule accepts only 1 numeric target value (e.g., ["100"]). You provided ${a.length} items.`,severity:Ie.Error,code:Nr.ConditionValuesSingleNumberRequired,entity:p}));for(let n=0;n<a.length;n++){const s=String(a[n]).trim();(s===""||isNaN(Number(s)))&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleNumberRequired}-${n}`,message:`Condition value "${s}" ${a.length>1?`(at index ${n}) `:""}is invalid. It must be a valid number (e.g., "100").`,severity:Ie.Error,code:Nr.ConditionValuesSingleNumberRequired,entity:p}))}}function gRn(a,p,t){a.length!==2&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesTwoNumbersRequired}`,message:`A "between" condition rule requires exactly 2 boundary values (e.g., ["10", "50"] or ["2024-01-01", "2024-12-31"]). You provided ${a.length} items.`,severity:Ie.Error,code:Nr.ConditionValuesTwoNumbersRequired,entity:p}))}function bRn(a,p,t){if(a.length===0){t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleRangeRequired}`,message:'The "List from cell range" rule requires a valid cell range in A1 notation (e.g., ["Sheet1!A1:A50"]).',severity:Ie.Error,code:Nr.ConditionValuesSingleRangeRequired,entity:p}));return}a.length>1&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleRangeRequired}-count`,message:`The "List from cell range" rule accepts only 1 cell range in A1 notation (e.g., ["Sheet1!A1:A50"]). You provided ${a.length} items.`,severity:Ie.Error,code:Nr.ConditionValuesSingleRangeRequired,entity:p}))}function ERn(a,p,t){a.length===0&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesListEmpty}`,message:'The "List of items" rule requires at least one choice item (e.g., ["Pending", "Approved", "Rejected"]).',severity:Ie.Error,code:Nr.ConditionValuesListEmpty,entity:p}))}function IRn(a,p,t){if(a.length===0){t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleTextRequired}`,message:'This text condition rule requires a non-empty text target value (e.g., ["important"]).',severity:Ie.Error,code:Nr.ConditionValuesSingleTextRequired,entity:p}));return}a.length>1&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleTextRequired}-count`,message:`This text condition rule accepts only 1 text target value (e.g., ["important"]). You provided ${a.length} items.`,severity:Ie.Error,code:Nr.ConditionValuesSingleTextRequired,entity:p}));for(let n=0;n<a.length;n++)String(a[n]).trim()===""&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleTextRequired}-${n}`,message:`Text target value ${a.length>1?`(at index ${n}) `:""}is empty. Expected a non-empty text string.`,severity:Ie.Error,code:Nr.ConditionValuesSingleTextRequired,entity:p}))}function RRn(a,p,t){if(a.length===0){t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleTextRequired}`,message:'This date condition rule requires a target date or relative date string (e.g., ["2024-01-01"]).',severity:Ie.Error,code:Nr.ConditionValuesSingleTextRequired,entity:p}));return}a.length>1&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleTextRequired}-count`,message:`This date condition rule accepts only 1 target date string (e.g., ["2024-01-01"]). You provided ${a.length} items.`,severity:Ie.Error,code:Nr.ConditionValuesSingleTextRequired,entity:p}))}function ARn(a,p,t){a.length>0&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesNoValuesRequired}`,message:`This condition rule does not take any argument values (must be empty list []). You provided ${a.length} items.`,severity:Ie.Error,code:Nr.ConditionValuesNoValuesRequired,entity:p}))}function DRn(a,p,t,n){if(!p&&p!==0&&p!==!1)return;let s=[];if(typeof p=="string")try{const e=JSON.parse(p);s=Array.isArray(e)?e:[p]}catch{s=p.split(",").map(e=>e.trim()).filter(Boolean)}else Array.isArray(p)?s=p:s=[p];const u=l1t(a);if(u)switch(u){case"CUSTOM_FORMULA":TRn(s,t,n);break;case"ONE_OF_LIST":ERn(s,t,n);break;case"ONE_OF_RANGE":bRn(s,t,n);break;case"NUMBER_GREATER":case"NUMBER_GREATER_THAN_EQ":case"NUMBER_LESS":case"NUMBER_LESS_THAN_EQ":case"NUMBER_EQUAL":case"NUMBER_NOT_EQUAL":vRn(s,t,n);break;case"NUMBER_BETWEEN":case"NUMBER_NOT_BETWEEN":case"DATE_BETWEEN":case"DATE_NOT_BETWEEN":gRn(s,t,n);break;case"TEXT_CONTAINS":case"TEXT_NOT_CONTAINS":case"TEXT_DOES_NOT_CONTAIN":case"TEXT_STARTS_WITH":case"TEXT_ENDS_WITH":case"TEXT_EQ":case"TEXT_EQUAL":IRn(s,t,n);break;case"DATE_EQ":case"DATE_TIME_EQUAL":case"DATE_BEFORE":case"DATE_AFTER":case"DATE_ON_OR_BEFORE":case"DATE_ON_OR_AFTER":RRn(s,t,n);break;case"TEXT_IS_EMAIL":case"TEXT_IS_URL":case"DATE_IS_VALID":case"BOOLEAN":ARn(s,t,n);break}}class o1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsAddDataValidation,version:"1.0.0",description:"Add Data Validation Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.Editor])[0];if(!g||!g.env)throw new Error("Editor context or environment missing");const b=Be(t,t.project,"addDataValidation"),I="["+Ve(t,t.project,"Add data validation")+": `"+b+"`] ",A=(Oe,Le,Fe)=>{const tt=Ve(Oe==null?void 0:Oe.valueOwner,g==null?void 0:g.logic,Le),We=Be(Oe==null?void 0:Oe.valueOwner,g==null?void 0:g.logic,Fe);return`"${tt}" (\`${We}\`)`},O=n.find(Oe=>{var Le;return((Le=Oe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[Q.GoogleSheetsAddDataValidation].inputs.connection.id}),P=(s=O==null?void 0:O.value)==null?void 0:s.valueAsType;if(!P||!P.id||!P.name||P.type!==r.DefinitionEntity)throw new Error(`${I}The ${A(O,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=ui(P);if(!x)throw new Error(`${I}The ${A(O,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const $=n.find(Oe=>{var Le;return((Le=Oe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[Q.GoogleSheetsAddDataValidation].inputs.spreadsheetId.id}),U=(u=$==null?void 0:$.value)==null?void 0:u.value,q=ln(U,{errorPrefix:`${I}The ${A($,"Spreadsheet ID","spreadsheetId")} input `}),Z=n.find(Oe=>{var Le;return((Le=Oe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[Q.GoogleSheetsAddDataValidation].inputs.range.id}),H=(e=Z==null?void 0:Z.value)==null?void 0:e.value;if(H==null)throw new Error(`${I}The ${A(Z,"Range","range")} input is missing.`);const ie={Authorization:`Bearer ${await g.getAccessToken()}`},z=`${(f=g.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${g.projectId}/${Zt["google-sheet"]}/${x}`,Y=async Oe=>Ht.post(z,Oe,{headers:ie}),ee=await Ha(H,"Id",async()=>(await Y({method:"GET",endpoint:`/v4/spreadsheets/${q}?fields=sheets.properties(sheetId,title)`})).data.sheets.map(Le=>({id:Le.properties.sheetId,name:Le.properties.title}))),J=ps(ee,{errorPrefix:`${I}The ${A(Z,"Range","range")} input `}),te=n.find(Oe=>{var Le;return((Le=Oe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[Q.GoogleSheetsAddDataValidation].inputs.conditionType.id}),re=(y=te==null?void 0:te.value)==null?void 0:y.value;if(!re||re==="")throw new Error(`${I}The ${A(te,"Condition Type","conditionType")} input is missing.`);if(typeof re!="string")throw new Error(`${I}The ${A(te,"Condition Type","conditionType")} input value is invalid. It must be a non-empty string.`);const ae=l1t(re)||re,le=n.find(Oe=>{var Le;return((Le=Oe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[Q.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 ge=ae,Ce=ce.map(Oe=>({userEnteredValue:String(Oe)}));if(ae==="TEXT_STARTS_WITH"||ae==="TEXT_ENDS_WITH"){const Oe=UAt(H),Le=ce.length>0?String(ce[0]):"",Fe=Le.replace(/"/g,'""'),tt=ae==="TEXT_STARTS_WITH"?`=LEFT(${Oe}, ${Le.length})="${Fe}"`:`=RIGHT(${Oe}, ${Le.length})="${Fe}"`;ge="CUSTOM_FORMULA",Ce=[{userEnteredValue:tt}]}const Ee={setDataValidation:{range:J,rule:{condition:{type:ge,values:Ce},showCustomUi:!0}}};return await Y({method:"POST",endpoint:`/v4/spreadsheets/${q}:batchUpdate`,data:{requests:[Ee]}}),{value:K.Success,result:null,error:null}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return pe.Logger.log("[Google Sheets] error:",b),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:b,result:null}}}})}}class d1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsSortRange,version:"1.0.0",description:"Sort Range Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.Editor])[0];if(!g||!g.env)throw new Error("Editor context or environment missing");const b=Be(t,t.project,"sortRange"),I="["+Ve(t,t.project,"Sort range")+": `"+b+"`] ",A=(Le,Fe,tt)=>{const We=Ve(Le==null?void 0:Le.valueOwner,g==null?void 0:g.logic,Fe),et=Be(Le==null?void 0:Le.valueOwner,g==null?void 0:g.logic,tt);return`"${We}" (\`${et}\`)`},O=n.find(Le=>{var Fe;return((Fe=Le.valueOwner.declaration)==null?void 0:Fe.id)===G.operation[Q.GoogleSheetsSortRange].inputs.connection.id}),P=(s=O==null?void 0:O.value)==null?void 0:s.valueAsType;if(!P||!P.id||!P.name||P.type!==r.DefinitionEntity)throw new Error(`${I}The ${A(O,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=ui(P);if(!x)throw new Error(`${I}The ${A(O,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const $=n.find(Le=>{var Fe;return((Fe=Le.valueOwner.declaration)==null?void 0:Fe.id)===G.operation[Q.GoogleSheetsSortRange].inputs.spreadsheetId.id}),U=(u=$==null?void 0:$.value)==null?void 0:u.value,q=ln(U,{errorPrefix:`${I}The ${A($,"Spreadsheet ID","spreadsheetId")} input `}),Z=n.find(Le=>{var Fe;return((Fe=Le.valueOwner.declaration)==null?void 0:Fe.id)===G.operation[Q.GoogleSheetsSortRange].inputs.range.id}),H=(e=Z==null?void 0:Z.value)==null?void 0:e.value;if(H==null)throw new Error(`${I}The ${A(Z,"Range","range")} input is missing.`);const ie={Authorization:`Bearer ${await g.getAccessToken()}`},z=`${(f=g.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${g.projectId}/${Zt["google-sheet"]}/${x}`,Y=async Le=>Ht.post(z,Le,{headers:ie}),ee=await Ha(H,"Id",async()=>(await Y({method:"GET",endpoint:`/v4/spreadsheets/${q}?fields=sheets.properties(sheetId,title)`})).data.sheets.map(Fe=>({id:Fe.properties.sheetId,name:Fe.properties.title}))),J=ps(ee,{errorPrefix:`${I}The ${A(Z,"Range","range")} input `}),te=n.find(Le=>{var Fe;return((Fe=Le.valueOwner.declaration)==null?void 0:Fe.id)===G.operation[Q.GoogleSheetsSortRange].inputs.sortColumnIndex.id}),re=(y=te==null?void 0:te.value)==null?void 0:y.value;if(re==null)throw new Error(`${I}The ${A(te,"Sort Column Index","sortColumnIndex")} input is missing.`);if(typeof re!="number")throw new Error(`${I}The ${A(te,"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[Q.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(),ge=J.startColumnIndex??0,Ce=J.endColumnIndex;let Ee;if(re>=1?Ee=ge+(re-1):Ee=ge+re,Ce!==void 0&&(Ee<ge||Ee>=Ce)){const Le=Ce-ge;throw new Error(`${I}The ${A(te,"Sort Column Index","sortColumnIndex")} input value (${re}) is out of bounds for the specified range. The range contains ${Le} column(s).`)}const Oe={sortRange:{range:J,sortSpecs:[{dimensionIndex:Ee,sortOrder:ce}]}};return await Y({method:"POST",endpoint:`/v4/spreadsheets/${q}:batchUpdate`,data:{requests:[Oe]}}),{value:K.Success,result:null,error:null}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return pe.Logger.log("[Google Sheets] error:",b),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:b,result:null}}}})}}const CRn={"Is empty":"BLANK","Is not empty":"NOT_BLANK","Text contains":"TEXT_CONTAINS","Text does not contain":"TEXT_NOT_CONTAINS","Text starts with":"TEXT_STARTS_WITH","Text ends with":"TEXT_ENDS_WITH","Text is exactly":"TEXT_EQ","Greater than":"NUMBER_GREATER","Greater than or equal to":"NUMBER_GREATER_THAN_EQ","Less than":"NUMBER_LESS","Less than or equal to":"NUMBER_LESS_THAN_EQ","Is equal to":"NUMBER_EQUAL","Is not equal to":"NUMBER_NOT_EQUAL","Is between":"NUMBER_BETWEEN","Is not between":"NUMBER_NOT_BETWEEN","Custom formula":"CUSTOM_FORMULA"},wRn={"Ascending (A-Z, 0-9)":"ASCENDING","Descending (Z-A, 9-0)":"DESCENDING",Ascending:"ASCENDING",Descending:"DESCENDING"};class p1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsCreateFilter,version:"1.0.0",description:"Create Filter Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.Editor])[0];if(!I||!I.env)throw new Error("Editor context or environment missing");const A=Be(t,t.project,"createFilter"),P="["+Ve(t,t.project,"Create filter")+": `"+A+"`] ",x=(pt,Me,Je)=>{const ke=Ve(pt==null?void 0:pt.valueOwner,I==null?void 0:I.logic,Me),lt=Be(pt==null?void 0:pt.valueOwner,I==null?void 0:I.logic,Je);return`"${ke}" (\`${lt}\`)`},$=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===G.operation[Q.GoogleSheetsCreateFilter].inputs.connection.id}),U=(s=$==null?void 0:$.value)==null?void 0:s.valueAsType;if(!U||!U.id||!U.name||U.type!==r.DefinitionEntity)throw new Error(`${P}The ${x($,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const q=ui(U);if(!q)throw new Error(`${P}The ${x($,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const Z=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===G.operation[Q.GoogleSheetsCreateFilter].inputs.spreadsheetId.id}),H=(u=Z==null?void 0:Z.value)==null?void 0:u.value,W=ln(H,{errorPrefix:`${P}The ${x(Z,"Spreadsheet ID","spreadsheetId")} input `}),ie=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===G.operation[Q.GoogleSheetsCreateFilter].inputs.range.id}),z=(e=ie==null?void 0:ie.value)==null?void 0:e.value;if(z==null)throw new Error(`${P}The ${x(ie,"Range","range")} input is missing.`);const Y=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===G.operation[Q.GoogleSheetsCreateFilter].inputs.columnIndex.id}),ee=(f=Y==null?void 0:Y.value)==null?void 0:f.value,J=typeof ee=="number"?ee:0,te=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===G.operation[Q.GoogleSheetsCreateFilter].inputs.conditionType.id}),re=(y=te==null?void 0:te.value)==null?void 0:y.value,ae=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===G.operation[Q.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[Q.GoogleSheetsCreateFilter].inputs.hiddenValues.id}),ce=(T=oe==null?void 0:oe.value)==null?void 0:T.value,ge=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===G.operation[Q.GoogleSheetsCreateFilter].inputs.sortOrder.id}),Ce=(g=ge==null?void 0:ge.value)==null?void 0:g.value,Oe={Authorization:`Bearer ${await I.getAccessToken()}`},Le=`${(b=I.env)==null?void 0:b.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${I.projectId}/${Zt["google-sheet"]}/${q}`,Fe=async pt=>Ht.post(Le,pt,{headers:Oe}),tt=await Ha(z,"Id",async()=>(await Fe({method:"GET",endpoint:`/v4/spreadsheets/${W}?fields=sheets.properties(sheetId,title)`})).data.sheets.map(Me=>({id:Me.properties.sheetId,name:Me.properties.title}))),We=ps(tt,{errorPrefix:`${P}The ${x(ie,"Range","range")} input `}),et={range:We},qe={},ot=typeof re=="string"?re:String(re||""),st=CRn[ot]||(re?String(re).toUpperCase():void 0);if(st){const pt=Array.isArray(le)?le.map(Me=>({userEnteredValue:String(Me)})):le!=null&&le!==""?[{userEnteredValue:String(le)}]:void 0;qe.condition={type:st,...pt?{values:pt}:{}}}Array.isArray(ce)&&ce.length>0&&(qe.hiddenValues=ce.map(pt=>String(pt))),Object.keys(qe).length>0&&(et.criteria={[J]:qe});const ft=typeof Ce=="string"?Ce:String(Ce||""),Et=wRn[ft]||(Ce?String(Ce).toUpperCase():void 0);if(Et){const pt=We.startColumnIndex??0,Me=J>=1?pt+(J-1):pt+J;et.sortSpecs=[{dimensionIndex:Me,sortOrder:Et}]}return await Fe({method:"POST",endpoint:`/v4/spreadsheets/${W}:batchUpdate`,data:{requests:[{setBasicFilter:{filter:et}}]}}),{value:K.Success,result:null,error:null}}catch(I){const A=((R=I.response)==null?void 0:R.data)||I.message||I;return pe.Logger.log("[Google Sheets] error:",A),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:A,result:null}}}})}}class u1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsRemoveFilter,version:"1.0.0",description:"Remove Filter Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.GoogleSheetsRemoveFilter);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"removeFilter"),b="["+Ve(t,t.project,"Remove filter")+": `"+T+"`] ",R=(J,te,re)=>{const ae=Ve(J==null?void 0:J.valueOwner,m==null?void 0:m.logic,te),le=Be(J==null?void 0:J.valueOwner,m==null?void 0:m.logic,re);return`"${ae}" (\`${le}\`)`},I=n.find(J=>{var te;return((te=J.valueOwner.declaration)==null?void 0:te.id)===G.operation[Q.GoogleSheetsRemoveFilter].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(A);if(!O)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(J=>{var te;return((te=J.valueOwner.declaration)==null?void 0:te.id)===G.operation[Q.GoogleSheetsRemoveFilter].inputs.spreadsheetId.id}),x=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(x,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(J=>{var te;return((te=J.valueOwner.declaration)==null?void 0:te.id)===G.operation[Q.GoogleSheetsRemoveFilter].inputs.range.id}),q=(e=U==null?void 0:U.value)==null?void 0:e.value;if(q==null)throw new Error(`${b}The ${R(U,"Range","range")} input is missing.`);const H={Authorization:`Bearer ${await m.getAccessToken()}`},W=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${O}`,ie=async J=>Ht.post(W,J,{headers:H}),z=await Ha(q,"Id",async()=>(await ie({method:"GET",endpoint:`/v4/spreadsheets/${$}?fields=sheets.properties(sheetId,title)`})).data.sheets.map(te=>({id:te.properties.sheetId,name:te.properties.title}))),ee=ps(z,{errorPrefix:`${b}The ${R(U,"Range","range")} input `}).sheetId;return await ie({method:"POST",endpoint:`/v4/spreadsheets/${$}:batchUpdate`,data:{requests:[{clearBasicFilter:{sheetId:ee}}]}}),{value:K.Success,result:null,error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class c1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsUpdateSpreadsheetProperties,version:"1.0.0",description:"Update Spreadsheet Properties Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.Editor])[0];if(!A||!A.env)throw new Error("Editor context or environment missing");const O=Be(t,t.project,"updateSpreadsheetProperties"),x="["+Ve(t,t.project,"Update spreadsheet properties")+": `"+O+"`] ",$=(st,ft,Et)=>{const pt=Ve(st==null?void 0:st.valueOwner,A==null?void 0:A.logic,ft),Me=Be(st==null?void 0:st.valueOwner,A==null?void 0:A.logic,Et);return`"${pt}" (\`${Me}\`)`},U=n.find(st=>{var ft;return((ft=st.valueOwner.declaration)==null?void 0:ft.id)===G.operation[Q.GoogleSheetsUpdateSpreadsheetProperties].inputs.connection.id}),q=(s=U==null?void 0:U.value)==null?void 0:s.valueAsType;if(!q||!q.id||!q.name||q.type!==r.DefinitionEntity)throw new Error(`${x}The ${$(U,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const Z=ui(q);if(!Z)throw new Error(`${x}The ${$(U,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const H=n.find(st=>{var ft;return((ft=st.valueOwner.declaration)==null?void 0:ft.id)===G.operation[Q.GoogleSheetsUpdateSpreadsheetProperties].inputs.spreadsheetId.id}),W=(u=H==null?void 0:H.value)==null?void 0:u.value,ie=ln(W,{errorPrefix:`${x}The ${$(H,"Spreadsheet ID","spreadsheetId")} input `}),z=n.find(st=>{var ft;return((ft=st.valueOwner.declaration)==null?void 0:ft.id)===G.operation[Q.GoogleSheetsUpdateSpreadsheetProperties].inputs.title.id}),Y=(e=z==null?void 0:z.value)==null?void 0:e.value;if(Y!=null&&typeof Y!="string")throw new Error(`${x}The ${$(z,"Title","title")} input value is invalid. If present, it must be a string. E.g. "My Spreadsheet"`);const ee=n.find(st=>{var ft;return((ft=st.valueOwner.declaration)==null?void 0:ft.id)===G.operation[Q.GoogleSheetsUpdateSpreadsheetProperties].inputs.locale.id}),J=(f=ee==null?void 0:ee.value)==null?void 0:f.value;if(J!=null&&typeof J!="string")throw new Error(`${x}The ${$(ee,"Locale","locale")} input value is invalid. If present, it must be a string. E.g. "en_US"`);const te=n.find(st=>{var ft;return((ft=st.valueOwner.declaration)==null?void 0:ft.id)===G.operation[Q.GoogleSheetsUpdateSpreadsheetProperties].inputs.timeZone.id}),re=(y=te==null?void 0:te.value)==null?void 0:y.value;if(re!=null&&typeof re!="string")throw new Error(`${x}The ${$(te,"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[Q.GoogleSheetsUpdateSpreadsheetProperties].inputs.autoRecalc.id}),le=(m=ae==null?void 0:ae.value)==null?void 0:m.value;if(le!=null&&typeof le!="string")throw new Error(`${x}The ${$(ae,"Auto Recalculation","autoRecalc")} input value is invalid. If present, it must be a string enum value. E.g. "ON_CHANGE"`);const oe=n.find(st=>{var ft;return((ft=st.valueOwner.declaration)==null?void 0:ft.id)===G.operation[Q.GoogleSheetsUpdateSpreadsheetProperties].inputs.defaultFormat.id}),ce=(T=oe==null?void 0:oe.value)==null?void 0:T.value;if(ce!=null&&(typeof ce!="object"||Array.isArray(ce)))throw new Error(`${x}The ${$(oe,"Default Format","defaultFormat")} input value is invalid. If present, it must be an object representing the CellFormat.`);const ge=n.find(st=>{var ft;return((ft=st.valueOwner.declaration)==null?void 0:ft.id)===G.operation[Q.GoogleSheetsUpdateSpreadsheetProperties].inputs.iterativeCalculationSettings.id}),Ce=(g=ge==null?void 0:ge.value)==null?void 0:g.value;if(Ce!=null&&(typeof Ce!="object"||Array.isArray(Ce)))throw new Error(`${x}The ${$(ge,"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[Q.GoogleSheetsUpdateSpreadsheetProperties].inputs.spreadsheetTheme.id}),Oe=(b=Ee==null?void 0:Ee.value)==null?void 0:b.value;if(Oe!=null&&(typeof Oe!="object"||Array.isArray(Oe)))throw new Error(`${x}The ${$(Ee,"Spreadsheet Theme","spreadsheetTheme")} input value is invalid. If present, it must be an object.`);const Le={};if(Y!=null&&(Le.title=Y),J!=null&&(Le.locale=J),re!=null&&(Le.timeZone=re),le!=null){const st={"On change":"ON_CHANGE","Every minute":"MINUTE","Every hour":"HOUR"};Le.autoRecalc=st[le]||le.toUpperCase()}ce!=null&&(Le.defaultFormat=ce),Ce!=null&&(Le.iterativeCalculationSettings=Ce),Oe!=null&&(Le.spreadsheetTheme=Oe);const Fe=(st,ft="")=>{let Et=[];for(const pt in st){if(!Object.prototype.hasOwnProperty.call(st,pt))continue;const Me=st[pt],Je=ft?`${ft}.${pt}`:pt;Me!==null&&typeof Me=="object"&&!Array.isArray(Me)&&Object.keys(Me).length>0?Et.push(...Fe(Me,Je)):Et.push(Je)}return Et},tt=Fe(Le);if(tt.length===0)throw new Error(`${x}At least one property must be provided to update.`);const et={Authorization:`Bearer ${await A.getAccessToken()}`},qe=`${(R=A.env)==null?void 0:R.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${A.projectId}/${Zt["google-sheet"]}/${Z}`;return await(async st=>Ht.post(qe,st,{headers:et}))({method:"POST",endpoint:`/v4/spreadsheets/${ie}:batchUpdate`,data:{requests:[{updateSpreadsheetProperties:{properties:Le,fields:tt.join(",")}}]}}),{value:K.Success,result:null,error:null}}catch(A){const O=((I=A.response)==null?void 0:I.data)||A.message||A;return pe.Logger.log("[Google Sheets] error:",O),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:O,result:null}}}})}}const g5=(a,p)=>(pe.Logger.log("[Google Sheets Clone Sheet] error:",p),{value:a.catchesError||a.errorCalls.length?K.CaughtError:K.UnhandledError,error:p,result:null});class f1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsCloneSheet,version:"1.0.0",description:"Google Sheets clone sheet operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.GoogleSheetsCloneSheet);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A,O,P;try{const x=this.extensionsRegistry.requestContexts(this,[X.Editor])[0],$=Be(t,t.project,"cloneSheet"),q="["+Ve(t,t.project,"Clone Sheet")+": `"+$+"`] ",Z=(qe,ot,st)=>{const ft=Ve(qe==null?void 0:qe.valueOwner,x==null?void 0:x.logic,ot),Et=Be(qe==null?void 0:qe.valueOwner,x==null?void 0:x.logic,st);return`"${ft}" (\`${Et}\`)`},H=G.operation[Q.GoogleSheetsCloneSheet],W=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=W==null?void 0:W.value)==null?void 0:s.valueAsType)??((u=W==null?void 0:W.value)==null?void 0:u.value);if(!ie||!ie.id||!ie.name||ie.type!==r.DefinitionEntity)throw new Error(`${q}The ${Z(W,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const z=ui(ie);if(!z)throw new Error(`${q}The ${Z(W,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const Y=n.find(qe=>{var ot,st;return((st=(ot=qe.valueOwner)==null?void 0:ot.declaration)==null?void 0:st.id)===H.inputs.spreadsheetId.id}),ee=(e=Y==null?void 0:Y.value)==null?void 0:e.value,J=ln(ee,{errorPrefix:`${q}The ${Z(Y,"Spreadsheet ID","spreadsheetId")} input `}),te=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=te==null?void 0:te.value)==null?void 0:f.value;if(re==null||re==="")throw new Error(`${q}The ${Z(te,"Sheet","sheet")} input is missing.`);const ae=(m=(y=n.find(qe=>{var ot,st;return((st=(ot=qe.valueOwner)==null?void 0:ot.declaration)==null?void 0:st.id)===H.inputs.newSheetName.id}))==null?void 0:y.value)==null?void 0:m.value,le=(g=(T=n.find(qe=>{var ot,st;return((st=(ot=qe.valueOwner)==null?void 0:ot.declaration)==null?void 0:st.id)===H.inputs.insertIndex.id}))==null?void 0:T.value)==null?void 0:g.value,ce={Authorization:`Bearer ${await x.getAccessToken()}`},ge=`${(b=x.env)==null?void 0:b.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${x.projectId}/${Zt["google-sheet"]}/${z}`,Ce=async qe=>Ht.post(ge,qe,{headers:ce});let Ee;if(!isNaN(Number(re)))Ee=Number(re);else{const st=(((R=(await Ce({method:"GET",endpoint:`/v4/spreadsheets/${J}`})).data)==null?void 0:R.sheets)||[]).find(ft=>{var Et;return((Et=ft.properties)==null?void 0:Et.title)===String(re)});if(!st)return g5(t,`Could not find sheet with name "${re}"`);Ee=st.properties.sheetId}const Oe={sourceSheetId:Ee};ae&&(Oe.newSheetName=ae),typeof le=="number"&&(Oe.insertSheetIndex=le);const tt=((O=(A=(I=((await Ce({method:"POST",endpoint:`/v4/spreadsheets/${J}:batchUpdate`,data:{requests:[{duplicateSheet:Oe}]}})).data||{}).replies)==null?void 0:I[0])==null?void 0:A.duplicateSheet)==null?void 0:O.properties)||{},We=tt.gridProperties||{},et={sheetId:tt.sheetId,title:tt.title,index:tt.index,sheetType:tt.sheetType,rowCount:We.rowCount,columnCount:We.columnCount,frozenRowCount:We.frozenRowCount,frozenColumnCount:We.frozenColumnCount,hideGridlines:We.hideGridlines??!1,rowGroupControlAfter:We.rowGroupControlAfter??!1,columnGroupControlAfter:We.columnGroupControlAfter??!1,hidden:tt.hidden??!1,rightToLeft:tt.rightToLeft??!1,tabColor:tt.tabColor?{red:tt.tabColor.red??0,green:tt.tabColor.green??0,blue:tt.tabColor.blue??0,alpha:tt.tabColor.alpha??1}:null,basicFilter:null,protectedRanges:[],bandedRanges:[],charts:[],conditionalFormatRules:[],mergedCells:[]};return{value:K.Success,error:null,result:et}}catch(x){const $=((P=x.response)==null?void 0:P.data)||x.message||x;return g5(t,$)}}})}}class y1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsDeleteChart,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.GoogleSheetsDeleteChart);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"deleteChart"),b="["+Ve(t,t.project,"Delete Chart")+": `"+T+"`] ",R=(ee,J,te)=>{const re=Ve(ee==null?void 0:ee.valueOwner,m==null?void 0:m.logic,J),ae=Be(ee==null?void 0:ee.valueOwner,m==null?void 0:m.logic,te);return`"${re}" (\`${ae}\`)`},I=n.find(ee=>{var J;return((J=ee.valueOwner.declaration)==null?void 0:J.id)===G.operation[Q.GoogleSheetsDeleteChart].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(A);if(!O)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(ee=>{var J;return((J=ee.valueOwner.declaration)==null?void 0:J.id)===G.operation[Q.GoogleSheetsDeleteChart].inputs.spreadsheetId.id}),x=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(x,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(ee=>{var J;return((J=ee.valueOwner.declaration)==null?void 0:J.id)===G.operation[Q.GoogleSheetsDeleteChart].inputs.chartId.id}),q=(e=U==null?void 0:U.value)==null?void 0:e.value;let Z=typeof q=="number"?q:typeof q=="string"?parseInt(q,10):NaN;if(isNaN(Z))throw new Error(`${b}The ${R(U,"Chart ID","chartId")} input is missing or invalid. Expected a numeric chart ID.`);const W={Authorization:`Bearer ${await m.getAccessToken()}`},ie=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${O}`,z=async ee=>Ht.post(ie,ee,{headers:W});let Y={};return Y.deleteEmbeddedObject={objectId:Z},await z({method:"POST",endpoint:`/v4/spreadsheets/${$}:batchUpdate`,data:{requests:[Y]}}),{value:K.Success,result:null,error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class h1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsDeletePivotTable,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.GoogleSheetsDeletePivotTable);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=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[Q.GoogleSheetsDeletePivotTable].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(A);if(!O)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(re=>{var ae;return((ae=re.valueOwner.declaration)==null?void 0:ae.id)===G.operation[Q.GoogleSheetsDeletePivotTable].inputs.spreadsheetId.id}),x=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(x,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(re=>{var ae;return((ae=re.valueOwner.declaration)==null?void 0:ae.id)===G.operation[Q.GoogleSheetsDeletePivotTable].inputs.destination.id}),q=(e=U==null?void 0:U.value)==null?void 0:e.value;if(q==null)throw new Error(`${b}The ${R(U,"destination","destination")} input is missing.`);const H={Authorization:`Bearer ${await m.getAccessToken()}`},W=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${O}`,ie=async re=>Ht.post(W,re,{headers:H});let z=[];try{z=(await ie({method:"GET",endpoint:`/v4/spreadsheets/${$}?fields=sheets(properties(sheetId,title))`})).data.sheets||[]}catch{}const Y=await Ha(q,"Id",async()=>z.map(re=>({id:re.properties.sheetId,name:re.properties.title}))),ee=ps(Y,{errorPrefix:`${b}The ${R(U,"destination","destination")} input `});let te={updateCells:{start:{sheetId:ee.sheetId??0,rowIndex:ee.startRowIndex??0,columnIndex:ee.startColumnIndex??0},rows:[{values:[{pivotTable:null}]}],fields:"pivotTable"}};return await ie({method:"POST",endpoint:`/v4/spreadsheets/${$}:batchUpdate`,data:{requests:[te]}}),{value:K.Success,result:null,error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class m1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsDeleteDimension,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.Editor])[0];if(!R||!R.env)throw new Error("Editor context or environment missing");const I=Be(t,t.project,"deleteDimension"),O="["+Ve(t,t.project,"Delete Dimension")+": `"+I+"`] ",P=(Fe,tt,We)=>{const et=Ve(Fe==null?void 0:Fe.valueOwner,R==null?void 0:R.logic,tt),qe=Be(Fe==null?void 0:Fe.valueOwner,R==null?void 0:R.logic,We);return`"${et}" (\`${qe}\`)`},x=n.find(Fe=>{var tt;return((tt=Fe.valueOwner.declaration)==null?void 0:tt.id)===G.operation[Q.GoogleSheetsDeleteDimension].inputs.connection.id}),$=(s=x==null?void 0:x.value)==null?void 0:s.valueAsType;if(!$||!$.id||!$.name||$.type!==r.DefinitionEntity)throw new Error(`${O}The ${P(x,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const U=ui($);if(!U)throw new Error(`${O}The ${P(x,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const q=n.find(Fe=>{var tt;return((tt=Fe.valueOwner.declaration)==null?void 0:tt.id)===G.operation[Q.GoogleSheetsDeleteDimension].inputs.spreadsheetId.id}),Z=(u=q==null?void 0:q.value)==null?void 0:u.value,H=ln(Z,{errorPrefix:`${O}The ${P(q,"Spreadsheet ID","spreadsheetId")} input `}),W=n.find(Fe=>{var tt,We;return((tt=Fe.valueOwner.declaration)==null?void 0:tt.id)===((We=G.operation[Q.GoogleSheetsDeleteDimension].inputs.sheet)==null?void 0:We.id)}),ie=(e=W==null?void 0:W.value)==null?void 0:e.value,z=n.find(Fe=>{var tt,We;return((tt=Fe.valueOwner.declaration)==null?void 0:tt.id)===((We=G.operation[Q.GoogleSheetsDeleteDimension].inputs.dimension)==null?void 0:We.id)}),Y=(f=z==null?void 0:z.value)==null?void 0:f.value,ee=n.find(Fe=>{var tt,We;return((tt=Fe.valueOwner.declaration)==null?void 0:tt.id)===((We=G.operation[Q.GoogleSheetsDeleteDimension].inputs.startIndex)==null?void 0:We.id)}),J=(y=ee==null?void 0:ee.value)==null?void 0:y.value,te=n.find(Fe=>{var tt,We;return((tt=Fe.valueOwner.declaration)==null?void 0:tt.id)===((We=G.operation[Q.GoogleSheetsDeleteDimension].inputs.endIndex)==null?void 0:We.id)}),re=(m=te==null?void 0:te.value)==null?void 0:m.value,le={Authorization:`Bearer ${await R.getAccessToken()}`},oe=`${(T=R.env)==null?void 0:T.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${R.projectId}/${Zt["google-sheet"]}/${U}`,ce=async Fe=>Ht.post(oe,Fe,{headers:le});if(ie==null||ie==="")throw new Error(`${O}The ${P(W,"Sheet","sheet")} input is missing.`);if(Y==null||Y==="")throw new Error(`${O}The ${P(z,"Dimension","dimension")} input is missing.`);const ge=String(Y).trim().toUpperCase();if(ge!=="ROWS"&&ge!=="COLUMNS")throw new Error(`${O}The ${P(z,"Dimension","dimension")} input is invalid. Expected "Rows" or "Columns".`);const Ce=typeof J=="number"?J:parseInt(String(J),10);if(isNaN(Ce)||Ce<1)throw new Error(`${O}The ${P(ee,"Start index","startIndex")} input is missing or invalid. Expected a positive integer starting at 1.`);let Ee=Ce;if(re!=null&&re!==""&&(Ee=typeof re=="number"?re:parseInt(String(re),10),isNaN(Ee)||Ee<Ce))throw new Error(`${O}The ${P(te,"End index","endIndex")} input is invalid. Expected an integer greater than or equal to Start index.`);let Oe;if(typeof ie=="number"||/^\d+$/.test(String(ie).trim()))Oe=Number(ie);else{const We=(((g=(await ce({method:"GET",endpoint:`/v4/spreadsheets/${H}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:g.sheets)||[]).find(et=>{var qe;return String((qe=et.properties)==null?void 0:qe.title).trim().toLowerCase()===String(ie).trim().toLowerCase()});if(!We)throw new Error(`${O}The ${P(W,"Sheet","sheet")} input "${ie}" was not found in spreadsheet.`);Oe=We.properties.sheetId}let Le={};return Le.deleteDimension={range:{sheetId:Oe,dimension:ge,startIndex:Ce-1,endIndex:Ee}},await ce({method:"POST",endpoint:`/v4/spreadsheets/${H}:batchUpdate`,data:{requests:[Le]}}),{value:K.Success,result:null,error:null}}catch(R){const I=((b=R.response)==null?void 0:b.data)||R.message||R;return pe.Logger.log("[Google Sheets] error:",I),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:I,result:null}}}})}}class T1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsDeleteProtectedRange,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.GoogleSheetsDeleteProtectedRange);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"deleteProtectedRange"),b="["+Ve(t,t.project,"Delete Protected Range")+": `"+T+"`] ",R=(Y,ee,J)=>{const te=Ve(Y==null?void 0:Y.valueOwner,m==null?void 0:m.logic,ee),re=Be(Y==null?void 0:Y.valueOwner,m==null?void 0:m.logic,J);return`"${te}" (\`${re}\`)`},I=n.find(Y=>{var ee;return((ee=Y.valueOwner.declaration)==null?void 0:ee.id)===G.operation[Q.GoogleSheetsDeleteProtectedRange].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(A);if(!O)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(Y=>{var ee;return((ee=Y.valueOwner.declaration)==null?void 0:ee.id)===G.operation[Q.GoogleSheetsDeleteProtectedRange].inputs.spreadsheetId.id}),x=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(x,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(Y=>{var ee;return((ee=Y.valueOwner.declaration)==null?void 0:ee.id)===G.operation[Q.GoogleSheetsDeleteProtectedRange].inputs.protectedRangeId.id}),q=(e=U==null?void 0:U.value)==null?void 0:e.value;if(q==null)throw new Error(`${b}The ${R(U,"protectedRangeId","protectedRangeId")} input is missing.`);const H={Authorization:`Bearer ${await m.getAccessToken()}`},W=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${O}`,ie=async Y=>Ht.post(W,Y,{headers:H});let z={};return z.deleteProtectedRange={protectedRangeId:typeof q=="string"&&q.trim().startsWith("{")?JSON.parse(q):q},await ie({method:"POST",endpoint:`/v4/spreadsheets/${$}:batchUpdate`,data:{requests:[z]}}),{value:K.Success,result:null,error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class v1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsAddBanding,version:"1.0.0",description:"Add Banding Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.GoogleSheetsAddBanding);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A,O,P,x,$,U;try{const q=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!q||!q.env)throw new Error("Editor context or environment missing");const Z=Be(t,t.project,"addBanding"),W="["+Ve(t,t.project,"Add Banding")+": `"+Z+"`] ",ie=(di,bt,dt)=>{const It=Ve(di==null?void 0:di.valueOwner,q==null?void 0:q.logic,bt),Wt=Be(di==null?void 0:di.valueOwner,q==null?void 0:q.logic,dt);return`"${It}" (\`${Wt}\`)`},z=n.find(di=>{var bt;return((bt=di.valueOwner.declaration)==null?void 0:bt.id)===G.operation[Q.GoogleSheetsAddBanding].inputs.connection.id}),Y=(s=z==null?void 0:z.value)==null?void 0:s.valueAsType;if(!Y||!Y.id||!Y.name||Y.type!==r.DefinitionEntity)throw new Error(`${W}The ${ie(z,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const ee=ui(Y);if(!ee)throw new Error(`${W}The ${ie(z,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const J=n.find(di=>{var bt;return((bt=di.valueOwner.declaration)==null?void 0:bt.id)===G.operation[Q.GoogleSheetsAddBanding].inputs.spreadsheetId.id}),te=(u=J==null?void 0:J.value)==null?void 0:u.value,re=ln(te,{errorPrefix:`${W}The ${ie(J,"Spreadsheet ID","spreadsheetId")} input `}),ae=n.find(di=>{var bt;return((bt=di.valueOwner.declaration)==null?void 0:bt.id)===G.operation[Q.GoogleSheetsAddBanding].inputs.bandedRange.id}),le=(e=ae==null?void 0:ae.value)==null?void 0:e.value;if(le==null)throw new Error(`${W}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[Q.GoogleSheetsAddBanding].inputs.bandingOrientation)==null?void 0:dt.id)}),ce=(f=oe==null?void 0:oe.value)==null?void 0:f.value,ge=typeof ce=="string"?ce:"Rows";if(!["Rows","Columns","Grid"].includes(ge))throw new Error(`${W}The ${ie(oe,"Banding Orientation","bandingOrientation")} input must be one of "Rows", "Columns", or "Grid". Received: "${ge}".`);const Ce=n.find(di=>{var bt,dt;return((bt=di.valueOwner.declaration)==null?void 0:bt.id)===((dt=G.operation[Q.GoogleSheetsAddBanding].inputs.headerColor)==null?void 0:dt.id)}),Ee=(y=Ce==null?void 0:Ce.value)==null?void 0:y.value,Oe=n.find(di=>{var bt,dt;return((bt=di.valueOwner.declaration)==null?void 0:bt.id)===((dt=G.operation[Q.GoogleSheetsAddBanding].inputs.firstBandColor)==null?void 0:dt.id)}),Le=(m=Oe==null?void 0:Oe.value)==null?void 0:m.value,Fe=n.find(di=>{var bt,dt;return((bt=di.valueOwner.declaration)==null?void 0:bt.id)===((dt=G.operation[Q.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[Q.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[Q.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[Q.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 q.getAccessToken()}`},Me=`${(I=q.env)==null?void 0:I.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${q.projectId}/${Zt["google-sheet"]}/${ee}`,Je=async di=>Ht.post(Me,di,{headers:pt});let ke=[],lt=[];try{lt=(await Je({method:"GET",endpoint:`/v4/spreadsheets/${re}?fields=sheets(properties(sheetId,title),bandedRanges)`})).data.sheets||[]}catch{}const Pt=await Ha(le,"Id",async()=>lt.map(di=>({id:di.properties.sheetId,name:di.properties.title}))),Gt=ps(Pt,{errorPrefix:`${W}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(`${W}Sheet "${Pt.sheet}" was not found in the spreadsheet.`);Gt.sheetId=si.properties.sheetId}else si=lt[0],Gt.sheetId=((A=si==null?void 0:si.properties)==null?void 0:A.sheetId)??0;Gt.startRowIndex===void 0&&Gt.endRowIndex===void 0&&Gt.startColumnIndex===void 0&&Gt.endColumnIndex===void 0&&(Gt.startRowIndex=0,Gt.endRowIndex=100,Gt.startColumnIndex=0,Gt.endColumnIndex=26),si!=null&&si.bandedRanges&&(ke=si.bandedRanges);const pi={range:Gt},kt=fo(Ee),Ct=fo(Le),xi=fo(tt),wn=fo(et),Yr=fo(ot),Jr={firstBandColor:Ct||{red:1,green:1,blue:1,alpha:1},secondBandColor:xi||{red:.95,green:.95,blue:.95,alpha:1}};kt&&(Jr.headerColor=kt),wn&&(Jr.footerColor=wn);const hi={firstBandColor:ge==="Grid"?Yr||Ct||{red:1,green:1,blue:1,alpha:1}:Ct||{red:1,green:1,blue:1,alpha:1},secondBandColor:ge==="Grid"?Yr||xi||{red:.95,green:.95,blue:.95,alpha:1}:xi||{red:.95,green:.95,blue:.95,alpha:1}};kt&&(hi.headerColor=kt),wn&&(hi.footerColor=wn),ge==="Grid"?(pi.rowProperties=Jr,pi.columnProperties=hi):ge==="Columns"?pi.columnProperties=hi:pi.rowProperties=Jr;const $t=[];if(ft)for(const di of ke)di.bandedRangeId!==void 0&&$t.push({deleteBanding:{bandedRangeId:di.bandedRangeId}});$t.push({addBanding:{bandedRange:pi}});const ci=(P=(O=(await Je({method:"POST",endpoint:`/v4/spreadsheets/${re}:batchUpdate`,data:{requests:$t}})).data)==null?void 0:O.replies)==null?void 0:P.find(di=>di.addBanding),oi=($=(x=ci==null?void 0:ci.addBanding)==null?void 0:x.bandedRange)==null?void 0:$.bandedRangeId;return{value:K.Success,result:{bandedRangeId:oi},error:null}}catch(q){const Z=((U=q.response)==null?void 0:U.data)||q.message||q;return pe.Logger.log("[Google Sheets] error:",Z),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:Z,result:null}}}})}}class ORn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsUpdateBanding,version:"1.0.0",description:"Update Banding Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.GoogleSheetsUpdateBanding);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A;try{const O=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!O||!O.env)throw new Error("Editor context or environment missing");const P=Be(t,t.project,"updateBanding"),$="["+Ve(t,t.project,"Update Banding")+": `"+P+"`] ",U=(ci,oi,di)=>{const bt=Ve(ci==null?void 0:ci.valueOwner,O==null?void 0:O.logic,oi),dt=Be(ci==null?void 0:ci.valueOwner,O==null?void 0:O.logic,di);return`"${bt}" (\`${dt}\`)`},q=n.find(ci=>{var oi;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===G.operation[Q.GoogleSheetsUpdateBanding].inputs.connection.id}),Z=(s=q==null?void 0:q.value)==null?void 0:s.valueAsType;if(!Z||!Z.id||!Z.name||Z.type!==r.DefinitionEntity)throw new Error(`${$}The ${U(q,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const H=ui(Z);if(!H)throw new Error(`${$}The ${U(q,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const W=n.find(ci=>{var oi;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===G.operation[Q.GoogleSheetsUpdateBanding].inputs.spreadsheetId.id}),ie=(u=W==null?void 0:W.value)==null?void 0:u.value,z=ln(ie,{errorPrefix:`${$}The ${U(W,"Spreadsheet ID","spreadsheetId")} input `}),Y=n.find(ci=>{var oi;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===G.operation[Q.GoogleSheetsUpdateBanding].inputs.bandedRangeId.id}),ee=(e=Y==null?void 0:Y.value)==null?void 0:e.value;if(ee==null||ee==="")throw new Error(`${$}The ${U(Y,"Banded Range ID","bandedRangeId")} input is missing.`);const J=Number(ee),te=n.find(ci=>{var oi,di;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===((di=G.operation[Q.GoogleSheetsUpdateBanding].inputs.bandedRange)==null?void 0:di.id)}),re=(f=te==null?void 0:te.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[Q.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[Q.GoogleSheetsUpdateBanding].inputs.headerColor)==null?void 0:di.id)}),ce=(m=oe==null?void 0:oe.value)==null?void 0:m.value,ge=n.find(ci=>{var oi,di;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===((di=G.operation[Q.GoogleSheetsUpdateBanding].inputs.firstBandColor)==null?void 0:di.id)}),Ce=(T=ge==null?void 0:ge.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[Q.GoogleSheetsUpdateBanding].inputs.secondBandColor)==null?void 0:di.id)}),Oe=(g=Ee==null?void 0:Ee.value)==null?void 0:g.value,Le=n.find(ci=>{var oi,di;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===((di=G.operation[Q.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[Q.GoogleSheetsUpdateBanding].inputs.gridBandColor)==null?void 0:di.id)}),We=(R=tt==null?void 0:tt.value)==null?void 0:R.value,qe={Authorization:`Bearer ${await O.getAccessToken()}`},ot=`${(I=O.env)==null?void 0:I.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${O.projectId}/${Zt["google-sheet"]}/${H}`,st=async ci=>Ht.post(ot,ci,{headers:qe});let ft=[];try{ft=(await st({method:"GET",endpoint:`/v4/spreadsheets/${z}?fields=sheets(properties(sheetId,title),bandedRanges)`})).data.sheets||[]}catch{}const Et=[];for(const ci of ft)if(ci.bandedRanges)for(const oi of ci.bandedRanges)Et.push({sheet:ci,band:oi});const pt=Et.find(ci=>Number(ci.band.bandedRangeId)===Number(J));if(Et.length>0&&!pt)throw new Error(`${$}No Banded Range with ID "${J}" was found in the sheet.`);const Me=pt==null?void 0:pt.band,Je={bandedRangeId:J};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(te,"bandedRange","bandedRange")} input `});(oi.sheetId===void 0||oi.sheetId===null)&&(oi.sheetId=0),Je.range=oi}else Me!=null&&Me.range&&(Je.range=Me.range);const ke=Me!=null&&Me.rowProperties&&(Me!=null&&Me.columnProperties)?"Grid":Me!=null&&Me.columnProperties?"Columns":"Rows",lt=le||ke,Pt=fo(ce),Gt=fo(Ce),si=fo(Oe),pi=fo(Fe),kt=fo(We),Ct=(Me==null?void 0:Me.rowProperties)||{},xi=(Me==null?void 0:Me.columnProperties)||{},wn={firstBandColor:Gt||Ct.firstBandColor||{red:1,green:1,blue:1,alpha:1},secondBandColor:si||Ct.secondBandColor||{red:.95,green:.95,blue:.95,alpha:1}},Yr=Pt||Ct.headerColor;Yr&&(wn.headerColor=Yr);const Jr=pi||Ct.footerColor;Jr&&(wn.footerColor=Jr);const hi={firstBandColor:lt==="Grid"?kt||Gt||xi.firstBandColor||{red:1,green:1,blue:1,alpha:1}:Gt||xi.firstBandColor||{red:1,green:1,blue:1,alpha:1},secondBandColor:lt==="Grid"?kt||si||xi.secondBandColor||{red:.95,green:.95,blue:.95,alpha:1}:si||xi.secondBandColor||{red:.95,green:.95,blue:.95,alpha:1}},$t=Pt||xi.headerColor;$t&&(hi.headerColor=$t);const Nt=pi||xi.footerColor;return Nt&&(hi.footerColor=Nt),lt==="Grid"?(Je.rowProperties=wn,Je.columnProperties=hi):lt==="Columns"?Je.columnProperties=hi:Je.rowProperties=wn,await st({method:"POST",endpoint:`/v4/spreadsheets/${z}:batchUpdate`,data:{requests:[{updateBanding:{bandedRange:Je,fields:"*"}}]}}),{value:K.Success,result:null,error:null}}catch(O){const P=((A=O.response)==null?void 0:A.data)||O.message||O;return pe.Logger.log("[Google Sheets] error:",P),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:P,result:null}}}})}}class xRn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsDeleteBanding,version:"1.0.0",description:"Delete Banding Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.GoogleSheetsDeleteBanding);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"deleteBanding"),b="["+Ve(t,t.project,"Delete Banding")+": `"+T+"`] ",R=(Y,ee,J)=>{const te=Ve(Y==null?void 0:Y.valueOwner,m==null?void 0:m.logic,ee),re=Be(Y==null?void 0:Y.valueOwner,m==null?void 0:m.logic,J);return`"${te}" (\`${re}\`)`},I=n.find(Y=>{var ee;return((ee=Y.valueOwner.declaration)==null?void 0:ee.id)===G.operation[Q.GoogleSheetsDeleteBanding].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(A);if(!O)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(Y=>{var ee;return((ee=Y.valueOwner.declaration)==null?void 0:ee.id)===G.operation[Q.GoogleSheetsDeleteBanding].inputs.spreadsheetId.id}),x=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(x,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(Y=>{var ee;return((ee=Y.valueOwner.declaration)==null?void 0:ee.id)===G.operation[Q.GoogleSheetsDeleteBanding].inputs.bandedRangeId.id}),q=(e=U==null?void 0:U.value)==null?void 0:e.value;if(q==null||q==="")throw new Error(`${b}The ${R(U,"Banded Range ID","bandedRangeId")} input is missing.`);const Z=Number(q),W={Authorization:`Bearer ${await m.getAccessToken()}`},ie=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${O}`;return await(async Y=>Ht.post(ie,Y,{headers:W}))({method:"POST",endpoint:`/v4/spreadsheets/${$}:batchUpdate`,data:{requests:[{deleteBanding:{bandedRangeId: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 g1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsAddChart,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.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,ge)=>{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,ge);return`"${Ce}" (\`${Ee}\`)`},O=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[Q.GoogleSheetsAddChart].inputs.connection.id}),P=(s=O==null?void 0:O.value)==null?void 0:s.valueAsType;if(!P||!P.id||!P.name||P.type!==r.DefinitionEntity)throw new Error(`${I}The ${A(O,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=ui(P);if(!x)throw new Error(`${I}The ${A(O,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const $=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[Q.GoogleSheetsAddChart].inputs.spreadsheetId.id}),U=(u=$==null?void 0:$.value)==null?void 0:u.value,q=ln(U,{errorPrefix:`${I}The ${A($,"Spreadsheet ID","spreadsheetId")} input `}),Z=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[Q.GoogleSheetsAddChart].inputs.chart.id}),H=(e=Z==null?void 0:Z.value)==null?void 0:e.value;if(H==null||typeof H!="object")throw new Error(`${I}The ${A(Z,"Chart","chart")} input is missing or invalid. Expected a valid chart object.`);const ie={Authorization:`Bearer ${await g.getAccessToken()}`},z=`${(f=g.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${g.projectId}/${Zt["google-sheet"]}/${x}`,Y=async oe=>Ht.post(z,oe,{headers:ie});let ee={};ee.addChart={chart:H};const te=(await Y({method:"POST",endpoint:`/v4/spreadsheets/${q}:batchUpdate`,data:{requests:[ee]}})).data,re=(m=(y=te==null?void 0:te.replies)==null?void 0:y[0])==null?void 0:m.addChart,ae=(re==null?void 0:re.chart)??null,le=(ae==null?void 0:ae.chartId)??null;return{value:K.Success,result:{chartId:le,chart:ae},error:null}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return pe.Logger.log("[Google Sheets] error:",b),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:b,result:null}}}})}}function PRn(a){return{"Number greater than":"NUMBER_GREATER","Number greater than or equal":"NUMBER_GREATER_THAN_EQ","Number less than":"NUMBER_LESS","Number less than or equal":"NUMBER_LESS_THAN_EQ","Number equal to":"NUMBER_EQ","Number not equal to":"NUMBER_NOT_EQ","Number between":"NUMBER_BETWEEN","Number not between":"NUMBER_NOT_BETWEEN","Text contains":"TEXT_CONTAINS","Text does not contain":"TEXT_NOT_CONTAINS","Text starts with":"TEXT_STARTS_WITH","Text ends with":"TEXT_ENDS_WITH","Text equals":"TEXT_EQ","Date is":"DATE_EQ","Date is before":"DATE_BEFORE","Date is after":"DATE_AFTER","Date is on or before":"DATE_ON_OR_BEFORE","Date is on or after":"DATE_ON_OR_AFTER","Cell is empty":"BLANK","Cell is not empty":"NOT_BLANK","Custom formula":"CUSTOM_FORMULA"}[a]||a}class b1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsAddConditionalFormatRule,version:"1.0.0",description:"Add Conditional Format Rule Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.GoogleSheetsAddConditionalFormatRule);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=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[Q.GoogleSheetsAddConditionalFormatRule].inputs,A=pt=>{var Je;const Me=n.find(ke=>{var lt;return((lt=ke.valueOwner.declaration)==null?void 0:lt.id)===pt});return(Je=Me==null?void 0:Me.value)==null?void 0:Je.value},O=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===I.connection.id}),P=(s=O==null?void 0:O.value)==null?void 0:s.valueAsType;if(!P||!P.id||!P.name||P.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(O,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=ui(P);if(!x)throw new Error(`${b}The ${R(O,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const $=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===I.spreadsheetId.id}),U=(u=$==null?void 0:$.value)==null?void 0:u.value,q=ln(U,{errorPrefix:`${b}The ${R($,"Spreadsheet ID","spreadsheetId")} input `}),H={Authorization:`Bearer ${await m.getAccessToken()}`},W=`${(e=m.env)==null?void 0:e.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${x}`,ie=async pt=>Ht.post(W,pt,{headers:H}),z=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===I.range.id}),Y=A(I.range.id),ee=A(I.conditionType.id),J=A(I.conditionValues.id),te=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),ge=A(I.index.id),Ce=A(I.fontSize.id),Ee=A(I.fontFamily.id),Oe=A(I.horizontalAlignment.id),Le=A(I.verticalAlignment.id),Fe=A(I.wrapStrategy.id);if(!Y)throw new Error(`${b}The ${R(z,"Range","range")} input must be provided.`);let tt=ps(Y,{errorPrefix:`${b}The Range input `});if(tt.sheetId===void 0){let pt;if(typeof Y=="object"&&Y!==null&&"sheet"in Y?pt=String(Y.sheet):typeof Y=="string"&&Y.includes("!")&&(pt=Y.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/${q}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:f.sheets)||[]).find(lt=>{var Pt;return String((Pt=lt.properties)==null?void 0:Pt.title).trim().toLowerCase()===pt.trim().toLowerCase()});ke&&(tt.sheetId=ke.properties.sheetId)}}const We=PRn(String(ee||"BLANK"));let et=[];Array.isArray(J)?et=J.map(pt=>({userEnteredValue:String(pt)})):J!=null&&J!==""&&(et=[{userEnteredValue:String(J)}]);const qe={},ot=fo(te);ot&&(qe.backgroundColor=ot);const st=fo(re);if(st&&(qe.textFormat=qe.textFormat||{},qe.textFormat.foregroundColor=st),(ae===!0||ae==="true")&&(qe.textFormat=qe.textFormat||{},qe.textFormat.bold=!0),(le===!0||le==="true")&&(qe.textFormat=qe.textFormat||{},qe.textFormat.italic=!0),(oe===!0||oe==="true")&&(qe.textFormat=qe.textFormat||{},qe.textFormat.strikethrough=!0),(ce===!0||ce==="true")&&(qe.textFormat=qe.textFormat||{},qe.textFormat.underline=!0),Ce!=null&&Ce!==""){const pt=typeof Ce=="number"?Ce:parseInt(String(Ce),10);isNaN(pt)||(qe.textFormat=qe.textFormat||{},qe.textFormat.fontSize=pt)}if(typeof Ee=="string"&&Ee.trim()!==""&&(qe.textFormat=qe.textFormat||{},qe.textFormat.fontFamily=Ee.trim()),typeof Oe=="string"&&Oe!==""){const pt={Left:"LEFT",Center:"CENTER",Right:"RIGHT",Justify:"JUSTIFY"};qe.horizontalAlignment=pt[Oe]||Oe.toUpperCase()}if(typeof Le=="string"&&Le!==""){const pt={Top:"TOP",Middle:"MIDDLE",Bottom:"BOTTOM"};qe.verticalAlignment=pt[Le]||Le.toUpperCase()}if(typeof Fe=="string"&&Fe!==""){const pt={Overflow:"OVERFLOW_CELL",Wrap:"WRAP",Clip:"CLIP"};qe.wrapStrategy=pt[Fe]||Fe.toUpperCase()}const Et={rule:{ranges:[tt],booleanRule:{condition:{type:We,...et.length?{values:et}:{}},format:qe}}};if(ge!=null&&ge!==""){const pt=typeof ge=="number"?ge:parseInt(String(ge),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/${q}:batchUpdate`,data:{requests:[{addConditionalFormatRule:Et}]}}),{value:K.Success,result:null,error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class E1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsAddProtectedRange,version:"1.0.0",description:"Add Protected Range Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.GoogleSheetsAddProtectedRange);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A,O,P,x,$;try{const U=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!U||!U.env)throw new Error("Editor context or environment missing");const q=Be(t,t.project,"addProtectedRange"),H="["+Ve(t,t.project,"Add Protected Range")+": `"+q+"`] ",W=(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[Q.GoogleSheetsAddProtectedRange].inputs.connection.id}),z=(s=ie==null?void 0:ie.value)==null?void 0:s.valueAsType;if(!z||!z.id||!z.name||z.type!==r.DefinitionEntity)throw new Error(`${H}The ${W(ie,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const Y=ui(z);if(!Y)throw new Error(`${H}The ${W(ie,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const ee=n.find(Pt=>{var Gt;return((Gt=Pt.valueOwner.declaration)==null?void 0:Gt.id)===G.operation[Q.GoogleSheetsAddProtectedRange].inputs.spreadsheetId.id}),J=(u=ee==null?void 0:ee.value)==null?void 0:u.value,te=ln(J,{errorPrefix:`${H}The ${W(ee,"Spreadsheet ID","spreadsheetId")} input `}),re=n.find(Pt=>{var Gt;return((Gt=Pt.valueOwner.declaration)==null?void 0:Gt.id)===G.operation[Q.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 ${W(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[Q.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[Q.GoogleSheetsAddProtectedRange].inputs.warningOnly.id}),ge=(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[Q.GoogleSheetsAddProtectedRange].inputs.editors.id}),Ee=(m=Ce==null?void 0:Ce.value)==null?void 0:m.value,Oe=n.find(Pt=>{var Gt;return((Gt=Pt.valueOwner.declaration)==null?void 0:Gt.id)===G.operation[Q.GoogleSheetsAddProtectedRange].inputs.domainUsersCanEdit.id}),Le=(T=Oe==null?void 0:Oe.value)==null?void 0:T.value,tt={Authorization:`Bearer ${await U.getAccessToken()}`},We=`${(g=U.env)==null?void 0:g.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${U.projectId}/${Zt["google-sheet"]}/${Y}`,et=async Pt=>Ht.post(We,Pt,{headers:tt});let qe=[];try{qe=((b=(await et({method:"GET",endpoint:`/v4/spreadsheets/${te}?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 ${W(re,"Protected Range","range")} input `})};oe!=null&&oe!==""&&(ft.description=oe);const Et=Array.isArray(Ee)&&Ee.length>0,pt=typeof Le=="boolean";if(ge===!0&&Et)throw new Error(`${H}When ${W(ce,"Warning Only","warningOnly")} is enabled (true), ${W(Ce,"Editors","editors")} cannot be specified.`);if(ge===!0&&pt)throw new Error(`${H}When ${W(ce,"Warning Only","warningOnly")} is enabled (true), ${W(Oe,"Domain Users Can Edit","domainUsersCanEdit")} cannot be specified.`);if(typeof ge=="boolean"&&(ft.warningOnly=ge),!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[Q.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 ${W(Me,"Exception ranges","unprotectedRanges")} input `})}));ft.unprotectedRanges=Pt}const lt=(x=(P=(O=(A=(I=(await et({method:"POST",endpoint:`/v4/spreadsheets/${te}:batchUpdate`,data:{requests:[{addProtectedRange:{protectedRange:ft}}]}})).data)==null?void 0:I.replies)==null?void 0:A[0])==null?void 0:O.addProtectedRange)==null?void 0:P.protectedRange)==null?void 0:x.protectedRangeId;return{value:K.Success,result:{protectedRangeId:lt},error:null}}catch(U){const q=(($=U.response)==null?void 0:$.data)||U.message||U;return pe.Logger.log("[Google Sheets] error:",q),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:q,result:null}}}})}}class I1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsUpdateChartSpec,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.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),ge=Be(ae==null?void 0:ae.valueOwner,T==null?void 0:T.logic,oe);return`"${ce}" (\`${ge}\`)`},A=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[Q.GoogleSheetsUpdateChartSpec].inputs.connection.id}),O=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${R}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const P=ui(O);if(!P)throw new Error(`${R}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[Q.GoogleSheetsUpdateChartSpec].inputs.spreadsheetId.id}),$=(u=x==null?void 0:x.value)==null?void 0:u.value,U=ln($,{errorPrefix:`${R}The ${I(x,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[Q.GoogleSheetsUpdateChartSpec].inputs.chartId.id}),Z=(e=q==null?void 0:q.value)==null?void 0:e.value;let H=typeof Z=="number"?Z:typeof Z=="string"?parseInt(Z,10):NaN;if(isNaN(H))throw new Error(`${R}The ${I(q,"Chart ID","chartId")} input is missing or invalid. Expected a numeric chart ID.`);const W=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[Q.GoogleSheetsUpdateChartSpec].inputs.chart.id}),ie=(f=W==null?void 0:W.value)==null?void 0:f.value;if(ie==null||typeof ie!="object")throw new Error(`${R}The ${I(W,"Chart Spec","chart")} input is missing or invalid. Expected a valid chart object.`);const Y={Authorization:`Bearer ${await T.getAccessToken()}`},ee=`${(y=T.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${T.projectId}/${Zt["google-sheet"]}/${P}`,J=async ae=>Ht.post(ee,ae,{headers:Y}),te=ie.spec?ie.spec:ie;let re={};return re.updateChartSpec={chartId:H,spec:te},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 R1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsCreatePivotTable,version:"1.0.0",description:"Create Pivot Table Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.Editor])[0];if(!I||!I.env)throw new Error("Editor context or environment missing");const A=Be(t,t.project,"createPivotTable"),P="["+Ve(t,t.project,"Create Pivot Table")+": `"+A+"`] ",x=(ke,lt,Pt)=>{const Gt=Ve(ke==null?void 0:ke.valueOwner,I==null?void 0:I.logic,lt),si=Be(ke==null?void 0:ke.valueOwner,I==null?void 0:I.logic,Pt);return`"${Gt}" (\`${si}\`)`},$=n.find(ke=>{var lt;return((lt=ke.valueOwner.declaration)==null?void 0:lt.id)===G.operation[Q.GoogleSheetsCreatePivotTable].inputs.connection.id}),U=(s=$==null?void 0:$.value)==null?void 0:s.valueAsType;if(!U||!U.id||!U.name||U.type!==r.DefinitionEntity)throw new Error(`${P}The ${x($,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const q=ui(U);if(!q)throw new Error(`${P}The ${x($,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const Z=n.find(ke=>{var lt;return((lt=ke.valueOwner.declaration)==null?void 0:lt.id)===G.operation[Q.GoogleSheetsCreatePivotTable].inputs.spreadsheetId.id}),H=(u=Z==null?void 0:Z.value)==null?void 0:u.value,W=ln(H,{errorPrefix:`${P}The ${x(Z,"Spreadsheet ID","spreadsheetId")} input `}),ie=n.find(ke=>{var lt;return((lt=ke.valueOwner.declaration)==null?void 0:lt.id)===G.operation[Q.GoogleSheetsCreatePivotTable].inputs.destination.id}),z=(e=ie==null?void 0:ie.value)==null?void 0:e.value;if(z==null)throw new Error(`${P}The ${x(ie,"Destination","destination")} input is missing.`);const Y=n.find(ke=>{var lt;return((lt=ke.valueOwner.declaration)==null?void 0:lt.id)===G.operation[Q.GoogleSheetsCreatePivotTable].inputs.source.id}),ee=(f=Y==null?void 0:Y.value)==null?void 0:f.value;if(ee==null)throw new Error(`${P}The ${x(Y,"Data range","source")} input is missing.`);const J=n.find(ke=>{var lt;return((lt=ke.valueOwner.declaration)==null?void 0:lt.id)===G.operation[Q.GoogleSheetsCreatePivotTable].inputs.rows.id}),te=((y=J==null?void 0:J.value)==null?void 0:y.value)||[],re=n.find(ke=>{var lt;return((lt=ke.valueOwner.declaration)==null?void 0:lt.id)===G.operation[Q.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[Q.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[Q.GoogleSheetsCreatePivotTable].inputs.valueLayout.id}),ge=((g=ce==null?void 0:ce.value)==null?void 0:g.value)||"HORIZONTAL",Ee={Authorization:`Bearer ${await I.getAccessToken()}`},Oe=`${(b=I.env)==null?void 0:b.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${I.projectId}/${Zt["google-sheet"]}/${q}`,Le=async ke=>Ht.post(Oe,ke,{headers:Ee});let Fe=[];try{Fe=(await Le({method:"GET",endpoint:`/v4/spreadsheets/${W}?fields=sheets(properties(sheetId,title))`})).data.sheets||[]}catch{}const tt=await Ha(z,"Id",async()=>Fe.map(ke=>({id:ke.properties.sheetId,name:ke.properties.title}))),We=ps(tt,{errorPrefix:`${P}The ${x(ie,"Destination","destination")} input `}),et={sheetId:We.sheetId??0,rowIndex:We.startRowIndex??0,columnIndex:We.startColumnIndex??0},qe=await Ha(ee,"Id",async()=>Fe.map(ke=>({id:ke.properties.sheetId,name:ke.properties.title}))),ot=ps(qe,{errorPrefix:`${P}The ${x(Y,"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(te),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:ge||"HORIZONTAL"};let Je={updateCells:{start:et,rows:[{values:[{pivotTable:Me}]}],fields:"pivotTable"}};return await Le({method:"POST",endpoint:`/v4/spreadsheets/${W}:batchUpdate`,data:{requests:[Je]}}),{value:K.Success,result:null,error:null}}catch(I){const A=((R=I.response)==null?void 0:R.data)||I.message||I;return pe.Logger.log("[Google Sheets] error:",A),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:A,result:null}}}})}}class A1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsInsertDimension,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.Editor])[0];if(!I||!I.env)throw new Error("Editor context or environment missing");const A=Be(t,t.project,"insertDimension"),P="["+Ve(t,t.project,"Insert Dimension")+": `"+A+"`] ",x=(qe,ot,st)=>{const ft=Ve(qe==null?void 0:qe.valueOwner,I==null?void 0:I.logic,ot),Et=Be(qe==null?void 0:qe.valueOwner,I==null?void 0:I.logic,st);return`"${ft}" (\`${Et}\`)`},$=n.find(qe=>{var ot;return((ot=qe.valueOwner.declaration)==null?void 0:ot.id)===G.operation[Q.GoogleSheetsInsertDimension].inputs.connection.id}),U=(s=$==null?void 0:$.value)==null?void 0:s.valueAsType;if(!U||!U.id||!U.name||U.type!==r.DefinitionEntity)throw new Error(`${P}The ${x($,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const q=ui(U);if(!q)throw new Error(`${P}The ${x($,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const Z=n.find(qe=>{var ot;return((ot=qe.valueOwner.declaration)==null?void 0:ot.id)===G.operation[Q.GoogleSheetsInsertDimension].inputs.spreadsheetId.id}),H=(u=Z==null?void 0:Z.value)==null?void 0:u.value,W=ln(H,{errorPrefix:`${P}The ${x(Z,"Spreadsheet ID","spreadsheetId")} input `}),ie=n.find(qe=>{var ot,st;return((ot=qe.valueOwner.declaration)==null?void 0:ot.id)===((st=G.operation[Q.GoogleSheetsInsertDimension].inputs.sheet)==null?void 0:st.id)}),z=(e=ie==null?void 0:ie.value)==null?void 0:e.value,Y=n.find(qe=>{var ot,st;return((ot=qe.valueOwner.declaration)==null?void 0:ot.id)===((st=G.operation[Q.GoogleSheetsInsertDimension].inputs.dimension)==null?void 0:st.id)}),ee=(f=Y==null?void 0:Y.value)==null?void 0:f.value,J=n.find(qe=>{var ot,st;return((ot=qe.valueOwner.declaration)==null?void 0:ot.id)===((st=G.operation[Q.GoogleSheetsInsertDimension].inputs.startIndex)==null?void 0:st.id)}),te=(y=J==null?void 0:J.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[Q.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[Q.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"]}/${q}`,Oe=async qe=>Ht.post(Ee,qe,{headers:Ce});if(z==null||z==="")throw new Error(`${P}The ${x(ie,"Sheet","sheet")} input is missing.`);if(ee==null||ee==="")throw new Error(`${P}The ${x(Y,"Dimension","dimension")} input is missing.`);const Le=String(ee).trim().toUpperCase();if(Le!=="ROWS"&&Le!=="COLUMNS")throw new Error(`${P}The ${x(Y,"Dimension","dimension")} input is invalid. Expected "Rows" or "Columns".`);const Fe=typeof te=="number"?te:parseInt(String(te),10);if(isNaN(Fe)||Fe<1)throw new Error(`${P}The ${x(J,"Start index","startIndex")} input is missing or invalid. Expected a positive integer starting at 1.`);let tt=Fe;if(ae!=null&&ae!==""&&(tt=typeof ae=="number"?ae:parseInt(String(ae),10),isNaN(tt)||tt<Fe))throw new Error(`${P}The ${x(re,"End index","endIndex")} input is invalid. Expected an integer greater than or equal to Start index.`);let We;if(typeof z=="number"||/^\d+$/.test(String(z).trim()))We=Number(z);else{const st=(((b=(await Oe({method:"GET",endpoint:`/v4/spreadsheets/${W}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:b.sheets)||[]).find(ft=>{var Et;return String((Et=ft.properties)==null?void 0:Et.title).trim().toLowerCase()===String(z).trim().toLowerCase()});if(!st)throw new Error(`${P}The ${x(ie,"Sheet","sheet")} input "${z}" was not found in spreadsheet.`);We=st.properties.sheetId}const et={range:{sheetId:We,dimension:Le,startIndex:Fe-1,endIndex:tt}};return typeof ce=="boolean"&&(et.inheritFromBefore=ce),await Oe({method:"POST",endpoint:`/v4/spreadsheets/${W}:batchUpdate`,data:{requests:[{insertDimension:et}]}}),{value:K.Success,result:null,error:null}}catch(I){const A=((R=I.response)==null?void 0:R.data)||I.message||I;return pe.Logger.log("[Google Sheets] error:",A),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:A,result:null}}}})}}class D1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsMoveDimension,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.Editor])[0];if(!I||!I.env)throw new Error("Editor context or environment missing");const A=Be(t,t.project,"moveDimension"),P="["+Ve(t,t.project,"Move Dimension")+": `"+A+"`] ",x=(et,qe,ot)=>{const st=Ve(et==null?void 0:et.valueOwner,I==null?void 0:I.logic,qe),ft=Be(et==null?void 0:et.valueOwner,I==null?void 0:I.logic,ot);return`"${st}" (\`${ft}\`)`},$=n.find(et=>{var qe;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===G.operation[Q.GoogleSheetsMoveDimension].inputs.connection.id}),U=(s=$==null?void 0:$.value)==null?void 0:s.valueAsType;if(!U||!U.id||!U.name||U.type!==r.DefinitionEntity)throw new Error(`${P}The ${x($,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const q=ui(U);if(!q)throw new Error(`${P}The ${x($,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const Z=n.find(et=>{var qe;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===G.operation[Q.GoogleSheetsMoveDimension].inputs.spreadsheetId.id}),H=(u=Z==null?void 0:Z.value)==null?void 0:u.value,W=ln(H,{errorPrefix:`${P}The ${x(Z,"Spreadsheet ID","spreadsheetId")} input `}),ie=n.find(et=>{var qe,ot;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===((ot=G.operation[Q.GoogleSheetsMoveDimension].inputs.sheet)==null?void 0:ot.id)}),z=(e=ie==null?void 0:ie.value)==null?void 0:e.value,Y=n.find(et=>{var qe,ot;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===((ot=G.operation[Q.GoogleSheetsMoveDimension].inputs.dimension)==null?void 0:ot.id)}),ee=(f=Y==null?void 0:Y.value)==null?void 0:f.value,J=n.find(et=>{var qe,ot;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===((ot=G.operation[Q.GoogleSheetsMoveDimension].inputs.startIndex)==null?void 0:ot.id)}),te=(y=J==null?void 0:J.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[Q.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[Q.GoogleSheetsMoveDimension].inputs.destinationIndex)==null?void 0:ot.id)}),oe=(T=le==null?void 0:le.value)==null?void 0:T.value,ge={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"]}/${q}`,Ee=async et=>Ht.post(Ce,et,{headers:ge});if(z==null||z==="")throw new Error(`${P}The ${x(ie,"Sheet","sheet")} input is missing.`);if(ee==null||ee==="")throw new Error(`${P}The ${x(Y,"Dimension","dimension")} input is missing.`);const Oe=String(ee).trim().toUpperCase();if(Oe!=="ROWS"&&Oe!=="COLUMNS")throw new Error(`${P}The ${x(Y,"Dimension","dimension")} input is invalid. Expected "Rows" or "Columns".`);const Le=typeof te=="number"?te:parseInt(String(te),10);if(isNaN(Le)||Le<1)throw new Error(`${P}The ${x(J,"Start index","startIndex")} input is missing or invalid. Expected a positive integer starting at 1.`);let Fe=Le;if(ae!=null&&ae!==""&&(Fe=typeof ae=="number"?ae:parseInt(String(ae),10),isNaN(Fe)||Fe<Le))throw new Error(`${P}The ${x(re,"End index","endIndex")} input is invalid. Expected an integer greater than or equal to Start index.`);const tt=typeof oe=="number"?oe:parseInt(String(oe),10);if(isNaN(tt)||tt<1)throw new Error(`${P}The ${x(le,"Destination index","destinationIndex")} input is missing or invalid. Expected a positive integer starting at 1.`);let We;if(typeof z=="number"||/^\d+$/.test(String(z).trim()))We=Number(z);else{const ot=(((b=(await Ee({method:"GET",endpoint:`/v4/spreadsheets/${W}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:b.sheets)||[]).find(st=>{var ft;return String((ft=st.properties)==null?void 0:ft.title).trim().toLowerCase()===String(z).trim().toLowerCase()});if(!ot)throw new Error(`${P}The ${x(ie,"Sheet","sheet")} input "${z}" was not found in spreadsheet.`);We=ot.properties.sheetId}return await Ee({method:"POST",endpoint:`/v4/spreadsheets/${W}:batchUpdate`,data:{requests:[{moveDimension:{source:{sheetId:We,dimension:Oe,startIndex:Le-1,endIndex:Fe},destinationIndex:tt-1}}]}}),{value:K.Success,result:null,error:null}}catch(I){const A=((R=I.response)==null?void 0:R.data)||I.message||I;return pe.Logger.log("[Google Sheets] error:",A),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:A,result:null}}}})}}function VRn(a){return{"Number greater than":"NUMBER_GREATER","Number greater than or equal":"NUMBER_GREATER_THAN_EQ","Number less than":"NUMBER_LESS","Number less than or equal":"NUMBER_LESS_THAN_EQ","Number equal to":"NUMBER_EQ","Number not equal to":"NUMBER_NOT_EQ","Number between":"NUMBER_BETWEEN","Number not between":"NUMBER_NOT_BETWEEN","Text contains":"TEXT_CONTAINS","Text does not contain":"TEXT_NOT_CONTAINS","Text starts with":"TEXT_STARTS_WITH","Text ends with":"TEXT_ENDS_WITH","Text equals":"TEXT_EQ","Date is":"DATE_EQ","Date is before":"DATE_BEFORE","Date is after":"DATE_AFTER","Date is on or before":"DATE_ON_OR_BEFORE","Date is on or after":"DATE_ON_OR_AFTER","Cell is empty":"BLANK","Cell is not empty":"NOT_BLANK","Custom formula":"CUSTOM_FORMULA"}[a]||a}class C1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsUpdateConditionalFormatRule,version:"1.0.0",description:"Update Conditional Format Rule Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.GoogleSheetsUpdateConditionalFormatRule);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A,O,P;try{const x=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!x||!x.env)throw new Error("Editor context or environment missing");const $=Be(t,t.project,"updateConditionalFormatRule"),q="["+Ve(t,t.project,"Update Conditional Format Rule")+": `"+$+"`] ",Z=(hi,$t,Nt)=>{const ci=Ve(hi==null?void 0:hi.valueOwner,x==null?void 0:x.logic,$t),oi=Be(hi==null?void 0:hi.valueOwner,x==null?void 0:x.logic,Nt);return`"${ci}" (\`${oi}\`)`},H=G.operation[Q.GoogleSheetsUpdateConditionalFormatRule].inputs,W=hi=>{var Nt;const $t=n.find(ci=>{var oi;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===hi});return(Nt=$t==null?void 0:$t.value)==null?void 0:Nt.value},ie=n.find(hi=>{var $t;return(($t=hi.valueOwner.declaration)==null?void 0:$t.id)===H.connection.id}),z=(s=ie==null?void 0:ie.value)==null?void 0:s.valueAsType;if(!z||!z.id||!z.name||z.type!==r.DefinitionEntity)throw new Error(`${q}The ${Z(ie,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const Y=ui(z);if(!Y)throw new Error(`${q}The ${Z(ie,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const ee=n.find(hi=>{var $t;return(($t=hi.valueOwner.declaration)==null?void 0:$t.id)===H.spreadsheetId.id}),J=(u=ee==null?void 0:ee.value)==null?void 0:u.value,te=ln(J,{errorPrefix:`${q}The ${Z(ee,"Spreadsheet ID","spreadsheetId")} input `}),re=n.find(hi=>{var $t;return(($t=hi.valueOwner.declaration)==null?void 0:$t.id)===H.sheet.id}),ae=(e=re==null?void 0:re.value)==null?void 0:e.value;if(ae==null||ae==="")throw new Error(`${q}The ${Z(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(`${q}The ${Z(le,"Index","index")} input is missing.`);const ce=typeof oe=="number"?oe:parseInt(String(oe),10);if(isNaN(ce)||ce<1)throw new Error(`${q}The ${Z(le,"Index","index")} input must be a 1-based positive integer.`);const Ce={Authorization:`Bearer ${await x.getAccessToken()}`},Ee=`${(y=x.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${x.projectId}/${Zt["google-sheet"]}/${Y}`,Oe=async hi=>Ht.post(Ee,hi,{headers:Ce});let Le;if(typeof ae=="number"||/^\d+$/.test(String(ae).trim()))Le=Number(ae);else{const Nt=(((m=(await Oe({method:"GET",endpoint:`/v4/spreadsheets/${te}?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(`${q}The ${Z(re,"Sheet","sheet")} input "${ae}" was not found in spreadsheet.`);Le=Nt.properties.sheetId}const Fe=W(H.newIndex.id),tt=W(H.range.id),We=W(H.conditionType.id),et=W(H.conditionValues.id),qe=W(H.backgroundColor.id),ot=W(H.textColor.id),st=W(H.bold.id),ft=W(H.italic.id),Et=W(H.strikethrough.id),pt=W(H.underline.id),Me=W(H.fontSize.id),Je=W(H.fontFamily.id),ke=W(H.horizontalAlignment.id),lt=W(H.verticalAlignment.id),Pt=W(H.wrapStrategy.id);let Gt=null;try{const Nt=(((T=(await Oe({method:"GET",endpoint:`/v4/spreadsheets/${te}?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:`${q}The Range input `}),si.sheetId===void 0&&(si.sheetId=Le));const pi=si?[si]:Gt&&Gt.ranges||[{sheetId:Le}];let kt=null;if(We!=null&&String(We).trim()!==""){const hi=VRn(String(We));let $t=[];Array.isArray(et)?$t=et.map(Nt=>({userEnteredValue:String(Nt)})):et!=null&&et!==""?$t=[{userEnteredValue:String(et)}]:((b=(g=Gt==null?void 0:Gt.booleanRule)==null?void 0:g.condition)==null?void 0:b.type)===hi&&Array.isArray((I=(R=Gt==null?void 0:Gt.booleanRule)==null?void 0:R.condition)==null?void 0:I.values)&&($t=Gt.booleanRule.condition.values),kt={type:hi,...$t.length?{values:$t}:{}}}else if((A=Gt==null?void 0:Gt.booleanRule)!=null&&A.condition)kt=JSON.parse(JSON.stringify(Gt.booleanRule.condition));else{const hi="BLANK";let $t=[];Array.isArray(et)?$t=et.map(Nt=>({userEnteredValue:String(Nt)})):et!=null&&et!==""&&($t=[{userEnteredValue:String(et)}]),kt={type:hi,...$t.length?{values:$t}:{}}}const Ct=(O=Gt==null?void 0:Gt.booleanRule)!=null&&O.format?JSON.parse(JSON.stringify(Gt.booleanRule.format)):{},xi=fo(qe);xi&&(Ct.backgroundColor=xi);const wn=fo(ot);if(wn&&(Ct.textFormat=Ct.textFormat||{},Ct.textFormat.foregroundColor=wn),st===!0||st==="true"?(Ct.textFormat=Ct.textFormat||{},Ct.textFormat.bold=!0):(st===!1||st==="false")&&Ct.textFormat&&(Ct.textFormat.bold=!1),ft===!0||ft==="true"?(Ct.textFormat=Ct.textFormat||{},Ct.textFormat.italic=!0):(ft===!1||ft==="false")&&Ct.textFormat&&(Ct.textFormat.italic=!1),Et===!0||Et==="true"?(Ct.textFormat=Ct.textFormat||{},Ct.textFormat.strikethrough=!0):(Et===!1||Et==="false")&&Ct.textFormat&&(Ct.textFormat.strikethrough=!1),pt===!0||pt==="true"?(Ct.textFormat=Ct.textFormat||{},Ct.textFormat.underline=!0):(pt===!1||pt==="false")&&Ct.textFormat&&(Ct.textFormat.underline=!1),Me!=null&&Me!==""){const hi=typeof Me=="number"?Me:parseInt(String(Me),10);isNaN(hi)||(Ct.textFormat=Ct.textFormat||{},Ct.textFormat.fontSize=hi)}if(typeof Je=="string"&&Je.trim()!==""&&(Ct.textFormat=Ct.textFormat||{},Ct.textFormat.fontFamily=Je.trim()),typeof ke=="string"&&ke!==""){const hi={Left:"LEFT",Center:"CENTER",Right:"RIGHT",Justify:"JUSTIFY"};Ct.horizontalAlignment=hi[ke]||ke.toUpperCase()}if(typeof lt=="string"&&lt!==""){const hi={Top:"TOP",Middle:"MIDDLE",Bottom:"BOTTOM"};Ct.verticalAlignment=hi[lt]||lt.toUpperCase()}if(typeof Pt=="string"&&Pt!==""){const hi={Overflow:"OVERFLOW_CELL",Wrap:"WRAP",Clip:"CLIP"};Ct.wrapStrategy=hi[Pt]||Pt.toUpperCase()}const Yr={...Gt||{},ranges:pi,booleanRule:{...(Gt==null?void 0:Gt.booleanRule)||{},condition:kt,format:Ct}},Jr={sheetId:Le,index:ce-1,rule:Yr};if(Fe!=null&&Fe!==""){const hi=typeof Fe=="number"?Fe:parseInt(String(Fe),10);!isNaN(hi)&&hi>=1&&(Jr.newIndex=hi-1)}return await Oe({method:"POST",endpoint:`/v4/spreadsheets/${te}:batchUpdate`,data:{requests:[{updateConditionalFormatRule:Jr}]}}),{value:K.Success,result:null,error:null}}catch(x){const $=((P=x.response)==null?void 0:P.data)||x.message||x;return pe.Logger.log("[Google Sheets] error:",$),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:$,result:null}}}})}}class w1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsUpdateProtectedRange,version:"1.0.0",description:"Update Protected Range Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.GoogleSheetsUpdateProtectedRange);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A,O;try{const P=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!P||!P.env)throw new Error("Editor context or environment missing");const x=Be(t,t.project,"updateProtectedRange"),U="["+Ve(t,t.project,"Update Protected Range")+": `"+x+"`] ",q=(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}\`)`},Z=n.find(Me=>{var Je;return((Je=Me.valueOwner.declaration)==null?void 0:Je.id)===G.operation[Q.GoogleSheetsUpdateProtectedRange].inputs.connection.id}),H=(s=Z==null?void 0:Z.value)==null?void 0:s.valueAsType;if(!H||!H.id||!H.name||H.type!==r.DefinitionEntity)throw new Error(`${U}The ${q(Z,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const W=ui(H);if(!W)throw new Error(`${U}The ${q(Z,"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[Q.GoogleSheetsUpdateProtectedRange].inputs.spreadsheetId.id}),z=(u=ie==null?void 0:ie.value)==null?void 0:u.value,Y=ln(z,{errorPrefix:`${U}The ${q(ie,"Spreadsheet ID","spreadsheetId")} input `}),ee=n.find(Me=>{var Je;return((Je=Me.valueOwner.declaration)==null?void 0:Je.id)===G.operation[Q.GoogleSheetsUpdateProtectedRange].inputs.protectedRangeId.id}),J=(e=ee==null?void 0:ee.value)==null?void 0:e.value;if(J==null)throw new Error(`${U}The ${q(ee,"Protected Range ID","protectedRangeId")} input is missing.`);const te=n.find(Me=>{var Je;return((Je=Me.valueOwner.declaration)==null?void 0:Je.id)===G.operation[Q.GoogleSheetsUpdateProtectedRange].inputs.range.id}),re=(f=te==null?void 0:te.value)==null?void 0:f.value,ae=n.find(Me=>{var Je;return((Je=Me.valueOwner.declaration)==null?void 0:Je.id)===G.operation[Q.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[Q.GoogleSheetsUpdateProtectedRange].inputs.warningOnly.id}),ce=(m=oe==null?void 0:oe.value)==null?void 0:m.value,ge=n.find(Me=>{var Je;return((Je=Me.valueOwner.declaration)==null?void 0:Je.id)===G.operation[Q.GoogleSheetsUpdateProtectedRange].inputs.editors.id}),Ce=(T=ge==null?void 0:ge.value)==null?void 0:T.value,Ee=n.find(Me=>{var Je;return((Je=Me.valueOwner.declaration)==null?void 0:Je.id)===G.operation[Q.GoogleSheetsUpdateProtectedRange].inputs.domainUsersCanEdit.id}),Oe=(g=Ee==null?void 0:Ee.value)==null?void 0:g.value,Fe={Authorization:`Bearer ${await P.getAccessToken()}`},tt=`${(b=P.env)==null?void 0:b.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${P.projectId}/${Zt["google-sheet"]}/${W}`,We=async Me=>Ht.post(tt,Me,{headers:Fe}),et={protectedRangeId:typeof J=="number"?J:Number(J)},qe=[];if(re!=null){let Me=[];try{Me=((R=(await We({method:"GET",endpoint:`/v4/spreadsheets/${Y}?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 ${q(te,"Protected Range","range")} input `}),qe.push("range")}le!=null&&(et.description=le,qe.push("description"));const ot=Array.isArray(Ce)&&Ce.length>0,st=typeof Oe=="boolean";if(ce===!0&&ot)throw new Error(`${U}When ${q(oe,"Warning Only","warningOnly")} is enabled (true), ${q(ge,"Editors","editors")} cannot be specified.`);if(ce===!0&&st)throw new Error(`${U}When ${q(oe,"Warning Only","warningOnly")} is enabled (true), ${q(Ee,"Domain Users Can Edit","domainUsersCanEdit")} cannot be specified.`);if(typeof ce=="boolean"&&(et.warningOnly=ce,qe.push("warningOnly")),!et.warningOnly&&(ot||st)){const Me={};ot&&(Me.users=Ce),st&&(Me.domainUsersCanEdit=Oe),et.editors=Me,qe.push("editors")}const ft=n.find(Me=>{var Je;return((Je=Me.valueOwner.declaration)==null?void 0:Je.id)===G.operation[Q.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/${Y}?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 ${q(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/${Y}:batchUpdate`,data:{requests:[{updateProtectedRange:{protectedRange:et,fields:pt}}]}}),{value:K.Success,result:null,error:null}}catch(P){const x=((O=P.response)==null?void 0:O.data)||P.message||P;return pe.Logger.log("[Google Sheets] error:",x),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:x,result:null}}}})}}class O1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsAddNamedRange,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.Editor])[0];if(!b||!b.env)throw new Error("Editor context or environment missing");const R=Be(t,t.project,"addNamedRange"),A="["+Ve(t,t.project,"Add Named Range")+": `"+R+"`] ",O=(Ee,Oe,Le)=>{const Fe=Ve(Ee==null?void 0:Ee.valueOwner,b==null?void 0:b.logic,Oe),tt=Be(Ee==null?void 0:Ee.valueOwner,b==null?void 0:b.logic,Le);return`"${Fe}" (\`${tt}\`)`},P=n.find(Ee=>{var Oe;return((Oe=Ee.valueOwner.declaration)==null?void 0:Oe.id)===G.operation[Q.GoogleSheetsAddNamedRange].inputs.connection.id}),x=(s=P==null?void 0:P.value)==null?void 0:s.valueAsType;if(!x||!x.id||!x.name||x.type!==r.DefinitionEntity)throw new Error(`${A}The ${O(P,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const $=ui(x);if(!$)throw new Error(`${A}The ${O(P,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const U=n.find(Ee=>{var Oe;return((Oe=Ee.valueOwner.declaration)==null?void 0:Oe.id)===G.operation[Q.GoogleSheetsAddNamedRange].inputs.spreadsheetId.id}),q=(u=U==null?void 0:U.value)==null?void 0:u.value,Z=ln(q,{errorPrefix:`${A}The ${O(U,"Spreadsheet ID","spreadsheetId")} input `}),H=n.find(Ee=>{var Oe;return((Oe=Ee.valueOwner.declaration)==null?void 0:Oe.id)===G.operation[Q.GoogleSheetsAddNamedRange].inputs.name.id}),W=(e=H==null?void 0:H.value)==null?void 0:e.value;if(W==null)throw new Error(`${A}The ${O(H,"name","name")} input is missing.`);const ie=n.find(Ee=>{var Oe;return((Oe=Ee.valueOwner.declaration)==null?void 0:Oe.id)===G.operation[Q.GoogleSheetsAddNamedRange].inputs.range.id}),z=(f=ie==null?void 0:ie.value)==null?void 0:f.value;if(z==null)throw new Error(`${A}The ${O(ie,"range","range")} input is missing.`);const ee={Authorization:`Bearer ${await b.getAccessToken()}`},J=`${(y=b.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${b.projectId}/${Zt["google-sheet"]}/${$}`,te=async Ee=>Ht.post(J,Ee,{headers:ee}),re=await Ha(z,"Id",async()=>{var Oe;return(((Oe=(await te({method:"GET",endpoint:`/v4/spreadsheets/${Z}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:Oe.sheets)||[]).map(Le=>{var Fe,tt;return{id:(Fe=Le.properties)==null?void 0:Fe.sheetId,name:(tt=Le.properties)==null?void 0:tt.title}})});let ae={};ae.addNamedRange={namedRange:{name:typeof W=="string"&&W.trim().startsWith("{")?JSON.parse(W):W,range:ps(re,{errorPrefix:`${A}The ${O(ie,"Range","range")} input `})}};const oe=(await te({method:"POST",endpoint:`/v4/spreadsheets/${Z}:batchUpdate`,data:{requests:[ae]}})).data,ce=(T=(m=oe==null?void 0:oe.replies)==null?void 0:m[0])==null?void 0:T.addNamedRange,ge=(ce==null?void 0:ce.namedRange)??null,Ce=(ge==null?void 0:ge.namedRangeId)??null;return{value:K.Success,result:{namedRangeId:Ce},error:null}}catch(b){const R=((g=b.response)==null?void 0:g.data)||b.message||b;return pe.Logger.log("[Google Sheets] error:",R),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:R,result:null}}}})}}class x1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsSetCellNote,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.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[Q.GoogleSheetsSetCellNote].inputs.connection.id}),O=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${R}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const P=ui(O);if(!P)throw new Error(`${R}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(re=>{var ae;return((ae=re.valueOwner.declaration)==null?void 0:ae.id)===G.operation[Q.GoogleSheetsSetCellNote].inputs.spreadsheetId.id}),$=(u=x==null?void 0:x.value)==null?void 0:u.value,U=ln($,{errorPrefix:`${R}The ${I(x,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(re=>{var ae;return((ae=re.valueOwner.declaration)==null?void 0:ae.id)===G.operation[Q.GoogleSheetsSetCellNote].inputs.range.id}),Z=(e=q==null?void 0:q.value)==null?void 0:e.value;if(Z==null)throw new Error(`${R}The ${I(q,"range","range")} input is missing.`);const H=n.find(re=>{var ae;return((ae=re.valueOwner.declaration)==null?void 0:ae.id)===G.operation[Q.GoogleSheetsSetCellNote].inputs.note.id}),W=(f=H==null?void 0:H.value)==null?void 0:f.value;if(W==null)throw new Error(`${R}The ${I(H,"note","note")} input is missing.`);const z={Authorization:`Bearer ${await T.getAccessToken()}`},Y=`${(y=T.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${T.projectId}/${Zt["google-sheet"]}/${P}`,ee=async re=>Ht.post(Y,re,{headers:z}),J=await Ha(Z,"Id",async()=>(await ee({method:"GET",endpoint:`/v4/spreadsheets/${U}?fields=sheets.properties(sheetId,title)`})).data.sheets.map(ae=>({id:ae.properties.sheetId,name:ae.properties.title})));let te={repeatCell:{range:ps(J,{errorPrefix:`${R}The ${I(q,"Range","range")} input `}),cell:{note:typeof W=="string"&&W.trim().startsWith("{")?JSON.parse(W):W},fields:"note"}};return await ee({method:"POST",endpoint:`/v4/spreadsheets/${U}:batchUpdate`,data:{requests:[te]}}),{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+Q.GoogleSheetsDeleteConditionalFormatRule,version:"1.0.0",description:"Delete Conditional Format Rule Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.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 ge=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`"${ge}" (\`${Ce}\`)`},O=G.operation[Q.GoogleSheetsDeleteConditionalFormatRule].inputs,P=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===O.connection.id}),x=(s=P==null?void 0:P.value)==null?void 0:s.valueAsType;if(!x||!x.id||!x.name||x.type!==r.DefinitionEntity)throw new Error(`${I}The ${A(P,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const $=ui(x);if(!$)throw new Error(`${I}The ${A(P,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const U=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===O.spreadsheetId.id}),q=(u=U==null?void 0:U.value)==null?void 0:u.value,Z=ln(q,{errorPrefix:`${I}The ${A(U,"Spreadsheet ID","spreadsheetId")} input `}),H=n.find(le=>{var oe,ce;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===((ce=O.sheet)==null?void 0:ce.id)}),W=(e=H==null?void 0:H.value)==null?void 0:e.value;if(W==null||W==="")throw new Error(`${I}The ${A(H,"Sheet","sheet")} input is missing.`);const ie=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===O.index.id}),z=(f=ie==null?void 0:ie.value)==null?void 0:f.value;if(z==null||z==="")throw new Error(`${I}The ${A(ie,"Index","index")} input is missing.`);const Y=typeof z=="number"?z:parseInt(String(z),10);if(isNaN(Y)||Y<1)throw new Error(`${I}The ${A(ie,"Index","index")} input must be a 1-based positive integer.`);const J={Authorization:`Bearer ${await g.getAccessToken()}`},te=`${(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(te,le,{headers:J});let ae;if(typeof W=="number"||/^\d+$/.test(String(W).trim()))ae=Number(W);else{const ce=(((m=(await re({method:"GET",endpoint:`/v4/spreadsheets/${Z}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:m.sheets)||[]).find(ge=>{var Ce;return String((Ce=ge.properties)==null?void 0:Ce.title).trim().toLowerCase()===String(W).trim().toLowerCase()});if(!ce)throw new Error(`${I}The ${A(H,"Sheet","sheet")} input "${W}" was not found in spreadsheet.`);ae=ce.properties.sheetId}return await re({method:"POST",endpoint:`/v4/spreadsheets/${Z}:batchUpdate`,data:{requests:[{deleteConditionalFormatRule:{sheetId:ae,index:Y-1}}]}}),{value:K.Success,result:null,error:null}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return pe.Logger.log("[Google Sheets] error:",b),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:b,result:null}}}})}}function NRn(a){return{NUMBER_GREATER:"Number greater than",NUMBER_GREATER_THAN_EQ:"Number greater than or equal",NUMBER_LESS:"Number less than",NUMBER_LESS_THAN_EQ:"Number less than or equal",NUMBER_EQ:"Number equal to",NUMBER_NOT_EQ:"Number not equal to",NUMBER_BETWEEN:"Number between",NUMBER_NOT_BETWEEN:"Number not between",TEXT_CONTAINS:"Text contains",TEXT_NOT_CONTAINS:"Text does not contain",TEXT_STARTS_WITH:"Text starts with",TEXT_ENDS_WITH:"Text ends with",TEXT_EQ:"Text equals",DATE_EQ:"Date is",DATE_BEFORE:"Date is before",DATE_AFTER:"Date is after",DATE_ON_OR_BEFORE:"Date is on or before",DATE_ON_OR_AFTER:"Date is on or after",BLANK:"Cell is empty",NOT_BLANK:"Cell is not empty",CUSTOM_FORMULA:"Custom formula"}[a]||a}function b5(a){let p,t="",n=a+1;for(;n>0;)p=(n-1)%26,t=String.fromCharCode(65+p)+t,n=(n-p-1)/26;return t}function _Rn(a,p){if(!a)return"";let t=p?`'${p}'!`:"";const n=a.startColumnIndex!==void 0?b5(a.startColumnIndex):"",s=a.startRowIndex!==void 0?String(a.startRowIndex+1):"",u=a.endColumnIndex!==void 0?b5(a.endColumnIndex-1):"",e=a.endRowIndex!==void 0?String(a.endRowIndex):"";return n&&s&&u&&e?n===u&&s===e?`${t}${n}${s}`:`${t}${n}${s}:${u}${e}`:n&&u&&!s&&!e?`${t}${n}:${u}`:s&&e&&!n&&!u?`${t}${s}:${e}`:`${t}${n}${s}:${u}${e}`.replace(/:$/,"")}class V1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsGetConditionalFormatRules,version:"1.0.0",description:"Get Conditional Format Rules Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.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 ge=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`"${ge}" (\`${Ce}\`)`},O=G.operation[Q.GoogleSheetsGetConditionalFormatRules].inputs,P=le=>{var ce;const oe=n.find(ge=>{var Ce;return((Ce=ge.valueOwner.declaration)==null?void 0:Ce.id)===le});return(ce=oe==null?void 0:oe.value)==null?void 0:ce.value},x=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===O.connection.id}),$=(s=x==null?void 0:x.value)==null?void 0:s.valueAsType;if(!$||!$.id||!$.name||$.type!==r.DefinitionEntity)throw new Error(`${I}The ${A(x,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const U=ui($);if(!U)throw new Error(`${I}The ${A(x,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const q=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===O.spreadsheetId.id}),Z=(u=q==null?void 0:q.value)==null?void 0:u.value,H=ln(Z,{errorPrefix:`${I}The ${A(q,"Spreadsheet ID","spreadsheetId")} input `}),W=P(O.sheet.id),ie=typeof W=="string"&&W.trim()!==""?W.trim():null,Y={Authorization:`Bearer ${await g.getAccessToken()}`},ee=`${(e=g.env)==null?void 0:e.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${g.projectId}/${Zt["google-sheet"]}/${U}`,re=((f=(await(async le=>Ht.post(ee,le,{headers:Y}))({method:"GET",endpoint:`/v4/spreadsheets/${H}?fields=sheets(properties(sheetId,title),conditionalFormats)`})).data)==null?void 0:f.sheets)||[],ae=[];for(const le of re){const oe=((y=le.properties)==null?void 0:y.title)||"",ce=(m=le.properties)==null?void 0:m.sheetId;if(ie&&oe.toLowerCase()!==ie.toLowerCase())continue;(le.conditionalFormats||[]).forEach((Ce,Ee)=>{const Oe=Ee+1,Le=(Ce.ranges||[]).map(ot=>_Rn(ot,oe)),Fe=Ce.booleanRule||{},tt=Fe.condition||{},We=NRn(tt.type||""),et=(tt.values||[]).map(ot=>ot.userEnteredValue||""),qe=Fe.format||{};ae.push({index:Oe,sheet:oe,sheetId:ce,ranges:Le,conditionType:We,conditionValues:et,format:qe})})}return{value:K.Success,error:null,result:ae}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return pe.Logger.log("[Google Sheets] error:",b),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:b,result:null}}}})}}function E5(a){let p,t="",n=a+1;for(;n>0;)p=(n-1)%26,t=String.fromCharCode(65+p)+t,n=(n-p-1)/26;return t}function $Rn(a,p){if(!a)return"";let t=p?`'${p}'!`:"";const n=a.startColumnIndex!==void 0?E5(a.startColumnIndex):"",s=a.startRowIndex!==void 0?String(a.startRowIndex+1):"",u=a.endColumnIndex!==void 0?E5(a.endColumnIndex-1):"",e=a.endRowIndex!==void 0?String(a.endRowIndex):"";return n&&s&&u&&e?n===u&&s===e?`${t}${n}${s}`:`${t}${n}${s}:${u}${e}`:n&&u&&!s&&!e?`${t}${n}:${u}`:s&&e&&!n&&!u?`${t}${s}:${e}`:`${t}${n}${s}:${u}${e}`.replace(/:$/,"")}class N1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsGetProtectedRanges,version:"1.0.0",description:"Get Protected Ranges Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.Editor])[0];if(!b||!b.env)throw new Error("Editor context or environment missing");const R=Be(t,t.project,"getProtectedRanges"),A="["+Ve(t,t.project,"Get protected ranges")+": `"+R+"`] ",O=(ae,le,oe)=>{const ce=Ve(ae==null?void 0:ae.valueOwner,b==null?void 0:b.logic,le),ge=Be(ae==null?void 0:ae.valueOwner,b==null?void 0:b.logic,oe);return`"${ce}" (\`${ge}\`)`},P=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[Q.GoogleSheetsGetProtectedRanges].inputs.connection.id}),x=(s=P==null?void 0:P.value)==null?void 0:s.valueAsType;if(!x||!x.id||!x.name||x.type!==r.DefinitionEntity)throw new Error(`${A}The ${O(P,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const $=ui(x);if(!$)throw new Error(`${A}The ${O(P,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const U=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[Q.GoogleSheetsGetProtectedRanges].inputs.spreadsheetId.id}),q=(u=U==null?void 0:U.value)==null?void 0:u.value,Z=ln(q,{errorPrefix:`${A}The ${O(U,"Spreadsheet ID","spreadsheetId")} input `}),H=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[Q.GoogleSheetsGetProtectedRanges].inputs.sheet.id}),W=(e=H==null?void 0:H.value)!=null&&e.value?String(H.value.value).trim():null,z={Authorization:`Bearer ${await b.getAccessToken()}`},Y=`${(f=b.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${b.projectId}/${Zt["google-sheet"]}/${$}`,te=((y=(await(async ae=>Ht.post(Y,ae,{headers:z}))({method:"GET",endpoint:`/v4/spreadsheets/${Z}`})).data)==null?void 0:y.sheets)||[],re=[];for(const ae of te){const le=(m=ae.properties)==null?void 0:m.title,oe=(T=ae.properties)==null?void 0:T.sheetId;if(W&&le!==W)continue;const ce=ae.protectedRanges||[];for(const ge of ce){const Ce=$Rn(ge.range,le);re.push({protectedRangeId:ge.protectedRangeId,sheet:le,sheetId:oe,range:Ce,description:ge.description||"",warningOnly:ge.warningOnly??!1,requestingUserCanEdit:ge.requestingUserCanEdit??!0})}}return{value:K.Success,error:null,result:re}}catch(b){const R=((g=b.response)==null?void 0:g.data)||b.message||b;return pe.Logger.log("[Google Sheets] error:",R),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:R,result:null}}}})}}function bh(a){if(!a)return null;const p=Math.round((a.red||0)*255),t=Math.round((a.green||0)*255),n=Math.round((a.blue||0)*255),s=u=>u.toString(16).padStart(2,"0");return`#${s(p)}${s(t)}${s(n)}`}function I5(a){let p,t="",n=a+1;for(;n>0;)p=(n-1)%26,t=String.fromCharCode(65+p)+t,n=(n-p-1)/26;return t}function GRn(a,p){if(!a)return"";let t=p?`'${p}'!`:"";const n=a.startColumnIndex!==void 0?I5(a.startColumnIndex):"",s=a.startRowIndex!==void 0?String(a.startRowIndex+1):"",u=a.endColumnIndex!==void 0?I5(a.endColumnIndex-1):"",e=a.endRowIndex!==void 0?String(a.endRowIndex):"";return n&&s&&u&&e?n===u&&s===e?`${t}${n}${s}`:`${t}${n}${s}:${u}${e}`:n&&u&&!s&&!e?`${t}${n}:${u}`:s&&e&&!n&&!u?`${t}${s}:${e}`:`${t}${n}${s}:${u}${e}`.replace(/:$/,"")}class _1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsGetBandedRanges,version:"1.0.0",description:"Get Banded Ranges Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.GoogleSheetsGetBandedRanges);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A;try{const O=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!O||!O.env)throw new Error("Editor context or environment missing");const P=Be(t,t.project,"getBandedRanges"),$="["+Ve(t,t.project,"Get banded ranges")+": `"+P+"`] ",U=(ge,Ce,Ee)=>{const Oe=Ve(ge==null?void 0:ge.valueOwner,O==null?void 0:O.logic,Ce),Le=Be(ge==null?void 0:ge.valueOwner,O==null?void 0:O.logic,Ee);return`"${Oe}" (\`${Le}\`)`},q=n.find(ge=>{var Ce;return((Ce=ge.valueOwner.declaration)==null?void 0:Ce.id)===G.operation[Q.GoogleSheetsGetBandedRanges].inputs.connection.id}),Z=(s=q==null?void 0:q.value)==null?void 0:s.valueAsType;if(!Z||!Z.id||!Z.name||Z.type!==r.DefinitionEntity)throw new Error(`${$}The ${U(q,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const H=ui(Z);if(!H)throw new Error(`${$}The ${U(q,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const W=n.find(ge=>{var Ce;return((Ce=ge.valueOwner.declaration)==null?void 0:Ce.id)===G.operation[Q.GoogleSheetsGetBandedRanges].inputs.spreadsheetId.id}),ie=(u=W==null?void 0:W.value)==null?void 0:u.value,z=ln(ie,{errorPrefix:`${$}The ${U(W,"Spreadsheet ID","spreadsheetId")} input `}),Y=n.find(ge=>{var Ce;return((Ce=ge.valueOwner.declaration)==null?void 0:Ce.id)===G.operation[Q.GoogleSheetsGetBandedRanges].inputs.sheet.id}),ee=(e=Y==null?void 0:Y.value)!=null&&e.value?String(Y.value.value).trim():null,te={Authorization:`Bearer ${await O.getAccessToken()}`},re=`${(f=O.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${O.projectId}/${Zt["google-sheet"]}/${H}`,oe=((y=(await(async ge=>Ht.post(re,ge,{headers:te}))({method:"GET",endpoint:`/v4/spreadsheets/${z}`})).data)==null?void 0:y.sheets)||[],ce=[];for(const ge of oe){const Ce=(m=ge.properties)==null?void 0:m.title,Ee=(T=ge.properties)==null?void 0:T.sheetId;if(ee&&Ce!==ee)continue;const Oe=ge.bandedRanges||[];for(const Le of Oe){const Fe=GRn(Le.range,Ce),tt=Le.rowProperties||{};ce.push({bandedRangeId:Le.bandedRangeId,sheet:Ce,sheetId:Ee,range:Fe,headerRowColor:bh(tt.headerColor)||bh((g=tt.headerColorStyle)==null?void 0:g.rgbColor),firstRowColor:bh(tt.firstBandColor)||bh((b=tt.firstBandColorStyle)==null?void 0:b.rgbColor),secondRowColor:bh(tt.secondBandColor)||bh((R=tt.secondBandColorStyle)==null?void 0:R.rgbColor),footerRowColor:bh(tt.footerColor)||bh((I=tt.footerColorStyle)==null?void 0:I.rgbColor)})}}return{value:K.Success,error:null,result:ce}}catch(O){const P=((A=O.response)==null?void 0:A.data)||O.message||O;return pe.Logger.log("[Google Sheets] error:",P),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:P,result:null}}}})}}function R5(a){let p,t="",n=a+1;for(;n>0;)p=(n-1)%26,t=String.fromCharCode(65+p)+t,n=(n-p-1)/26;return t}function LRn(a,p){if(!a)return"";let t=p?`'${p}'!`:"";const n=a.startColumnIndex!==void 0?R5(a.startColumnIndex):"",s=a.startRowIndex!==void 0?String(a.startRowIndex+1):"",u=a.endColumnIndex!==void 0?R5(a.endColumnIndex-1):"",e=a.endRowIndex!==void 0?String(a.endRowIndex):"";return n&&s&&u&&e?n===u&&s===e?`${t}${n}${s}`:`${t}${n}${s}:${u}${e}`:n&&u&&!s&&!e?`${t}${n}:${u}`:s&&e&&!n&&!u?`${t}${s}:${e}`:`${t}${n}${s}:${u}${e}`.replace(/:$/,"")}class $1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsGetNamedRanges,version:"1.0.0",description:"Get Named Ranges Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.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=(J,te,re)=>{const ae=Ve(J==null?void 0:J.valueOwner,T==null?void 0:T.logic,te),le=Be(J==null?void 0:J.valueOwner,T==null?void 0:T.logic,re);return`"${ae}" (\`${le}\`)`},A=n.find(J=>{var te;return((te=J.valueOwner.declaration)==null?void 0:te.id)===G.operation[Q.GoogleSheetsGetNamedRanges].inputs.connection.id}),O=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${R}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const P=ui(O);if(!P)throw new Error(`${R}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(J=>{var te;return((te=J.valueOwner.declaration)==null?void 0:te.id)===G.operation[Q.GoogleSheetsGetNamedRanges].inputs.spreadsheetId.id}),$=(u=x==null?void 0:x.value)==null?void 0:u.value,U=ln($,{errorPrefix:`${R}The ${I(x,"Spreadsheet ID","spreadsheetId")} input `}),Z={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 J=>Ht.post(H,J,{headers:Z}))({method:"GET",endpoint:`/v4/spreadsheets/${U}`}),z={};(((f=ie.data)==null?void 0:f.sheets)||[]).forEach(J=>{var te;((te=J.properties)==null?void 0:te.sheetId)!==void 0&&(z[J.properties.sheetId]=J.properties.title||"")});const ee=(((y=ie.data)==null?void 0:y.namedRanges)||[]).map(J=>{var ae;const te=z[(ae=J.range)==null?void 0:ae.sheetId]||"",re=LRn(J.range,te);return{namedRangeId:J.namedRangeId,name:J.name,sheet:te,range:re}});return{value:K.Success,error:null,result:ee}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return pe.Logger.log("[Google Sheets] error:",g),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:g,result:null}}}})}}class G1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsGetSheets,version:"1.0.0",description:"Get Sheets Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.GoogleSheetsGetSheets);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"getSheets"),b="["+Ve(t,t.project,"Get sheets")+": `"+T+"`] ",R=(Y,ee,J)=>{const te=Ve(Y==null?void 0:Y.valueOwner,m==null?void 0:m.logic,ee),re=Be(Y==null?void 0:Y.valueOwner,m==null?void 0:m.logic,J);return`"${te}" (\`${re}\`)`},I=n.find(Y=>{var ee;return((ee=Y.valueOwner.declaration)==null?void 0:ee.id)===G.operation[Q.GoogleSheetsGetSheets].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(A);if(!O)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(Y=>{var ee;return((ee=Y.valueOwner.declaration)==null?void 0:ee.id)===G.operation[Q.GoogleSheetsGetSheets].inputs.spreadsheetId.id}),x=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(x,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),q={Authorization:`Bearer ${await m.getAccessToken()}`},Z=`${(e=m.env)==null?void 0:e.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${O}`,z=(((f=(await(async Y=>Ht.post(Z,Y,{headers:q}))({method:"GET",endpoint:`/v4/spreadsheets/${$}`})).data)==null?void 0:f.sheets)||[]).map(Y=>{var ee,J,te,re,ae,le,oe,ce,ge,Ce,Ee,Oe,Le;return{sheetId:(ee=Y.properties)==null?void 0:ee.sheetId,title:(J=Y.properties)==null?void 0:J.title,index:(te=Y.properties)==null?void 0:te.index,sheetType:(re=Y.properties)==null?void 0:re.sheetType,rowCount:(le=(ae=Y.properties)==null?void 0:ae.gridProperties)==null?void 0:le.rowCount,columnCount:(ce=(oe=Y.properties)==null?void 0:oe.gridProperties)==null?void 0:ce.columnCount,frozenRowCount:(Ce=(ge=Y.properties)==null?void 0:ge.gridProperties)==null?void 0:Ce.frozenRowCount,frozenColumnCount:(Oe=(Ee=Y.properties)==null?void 0:Ee.gridProperties)==null?void 0:Oe.frozenColumnCount,hidden:((Le=Y.properties)==null?void 0:Le.hidden)??!1}});return{value:K.Success,error:null,result:z}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class L1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsGetSheet,version:"1.0.0",description:"Get Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.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 ge=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`"${ge}" (\`${Ce}\`)`},A=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[Q.GoogleSheetsGetSheet].inputs.connection.id}),O=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${R}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const P=ui(O);if(!P)throw new Error(`${R}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[Q.GoogleSheetsGetSheet].inputs.spreadsheetId.id}),$=(u=x==null?void 0:x.value)==null?void 0:u.value,U=ln($,{errorPrefix:`${R}The ${I(x,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[Q.GoogleSheetsGetSheet].inputs.sheet.id}),Z=(e=q==null?void 0:q.value)==null?void 0:e.value;if(Z==null||Z==="")throw new Error(`${R}The ${I(q,"Sheet","sheet")} input is missing.`);const W={Authorization:`Bearer ${await T.getAccessToken()}`},ie=`${(f=T.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${T.projectId}/${Zt["google-sheet"]}/${P}`,ee=((y=(await(async le=>Ht.post(ie,le,{headers:W}))({method:"GET",endpoint:`/v4/spreadsheets/${U}`})).data)==null?void 0:y.sheets)||[];let J=null;if(typeof Z=="number")J=ee.find(le=>{var oe;return Number((oe=le.properties)==null?void 0:oe.sheetId)===Z});else if(typeof Z=="string"){const le=Z.trim();J=ee.find(oe=>{var ce,ge;return((ce=oe.properties)==null?void 0:ce.title)===le||String((ge=oe.properties)==null?void 0:ge.sheetId)===le})}if(!J)throw new Error(`${R}Sheet "${Z}" was not found in spreadsheet.`);const te=J.properties||{},re=te.gridProperties||{},ae={sheetId:te.sheetId,title:te.title,index:te.index,sheetType:te.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:te.hidden??!1,rightToLeft:te.rightToLeft??!1,tabColor:te.tabColor?{red:te.tabColor.red??0,green:te.tabColor.green??0,blue:te.tabColor.blue??0,alpha:te.tabColor.alpha??1}:null,basicFilter:J.basicFilter?{range:J.basicFilter.range}:null,protectedRanges:(J.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:(J.bandedRanges||[]).map(le=>({bandedRangeId:le.bandedRangeId,range:le.range})),charts:(J.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:(J.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:(J.merges||[]).map(le=>`${le.startRowIndex}:${le.endRowIndex}`)};return{value:K.Success,error:null,result:ae}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return pe.Logger.log("[Google Sheets] error:",g),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:g,result:null}}}})}}function A5(a){let p,t="",n=a+1;for(;n>0;)p=(n-1)%26,t=String.fromCharCode(65+p)+t,n=(n-p-1)/26;return t}function BRn(a,p){if(!a)return"";let t=p?`'${p}'!`:"";const n=a.startColumnIndex!==void 0?A5(a.startColumnIndex):"",s=a.startRowIndex!==void 0?String(a.startRowIndex+1):"",u=a.endColumnIndex!==void 0?A5(a.endColumnIndex-1):"",e=a.endRowIndex!==void 0?String(a.endRowIndex):"";return n&&s&&u&&e?n===u&&s===e?`${t}${n}${s}`:`${t}${n}${s}:${u}${e}`:n&&u&&!s&&!e?`${t}${n}:${u}`:s&&e&&!n&&!u?`${t}${s}:${e}`:`${t}${n}${s}:${u}${e}`.replace(/:$/,"")}class B1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsGetCharts,version:"1.0.0",description:"Get Charts Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.Editor])[0];if(!A||!A.env)throw new Error("Editor context or environment missing");const O=Be(t,t.project,"getCharts"),x="["+Ve(t,t.project,"Get charts")+": `"+O+"`] ",$=(ce,ge,Ce)=>{const Ee=Ve(ce==null?void 0:ce.valueOwner,A==null?void 0:A.logic,ge),Oe=Be(ce==null?void 0:ce.valueOwner,A==null?void 0:A.logic,Ce);return`"${Ee}" (\`${Oe}\`)`},U=n.find(ce=>{var ge;return((ge=ce.valueOwner.declaration)==null?void 0:ge.id)===G.operation[Q.GoogleSheetsGetCharts].inputs.connection.id}),q=(s=U==null?void 0:U.value)==null?void 0:s.valueAsType;if(!q||!q.id||!q.name||q.type!==r.DefinitionEntity)throw new Error(`${x}The ${$(U,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const Z=ui(q);if(!Z)throw new Error(`${x}The ${$(U,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const H=n.find(ce=>{var ge;return((ge=ce.valueOwner.declaration)==null?void 0:ge.id)===G.operation[Q.GoogleSheetsGetCharts].inputs.spreadsheetId.id}),W=(u=H==null?void 0:H.value)==null?void 0:u.value,ie=ln(W,{errorPrefix:`${x}The ${$(H,"Spreadsheet ID","spreadsheetId")} input `}),z=n.find(ce=>{var ge;return((ge=ce.valueOwner.declaration)==null?void 0:ge.id)===G.operation[Q.GoogleSheetsGetCharts].inputs.sheet.id}),Y=(e=z==null?void 0:z.value)!=null&&e.value?String(z.value.value).trim():null,J={Authorization:`Bearer ${await A.getAccessToken()}`},te=`${(f=A.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${A.projectId}/${Zt["google-sheet"]}/${Z}`,le=((y=(await(async ce=>Ht.post(te,ce,{headers:J}))({method:"GET",endpoint:`/v4/spreadsheets/${ie}`})).data)==null?void 0:y.sheets)||[],oe=[];for(const ce of le){const ge=(m=ce.properties)==null?void 0:m.title,Ce=(T=ce.properties)==null?void 0:T.sheetId;if(Y&&ge!==Y)continue;const Ee=ce.charts||[];for(const Oe of Ee){const Le=Oe.spec||{},Fe=Le.title||"",tt=((g=Le.basicChart)==null?void 0:g.chartType)||(Le.pieChart?"PIE":"UNKNOWN"),We=BRn((R=(b=Oe.position)==null?void 0:b.overlayPosition)==null?void 0:R.anchorCell,ge);oe.push({chartId:Oe.chartId,sheet:ge,sheetId:Ce,title:Fe,chartType:tt,positionRange:We})}}return{value:K.Success,error:null,result:oe}}catch(A){const O=((I=A.response)==null?void 0:I.data)||A.message||A;return pe.Logger.log("[Google Sheets] error:",O),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:O,result:null}}}})}}function D5(a){let p,t="",n=a+1;for(;n>0;)p=(n-1)%26,t=String.fromCharCode(65+p)+t,n=(n-p-1)/26;return t}function C5(a,p){if(!a)return"";let t=p?`'${p}'!`:"";const n=a.startColumnIndex!==void 0?D5(a.startColumnIndex):"",s=a.startRowIndex!==void 0?String(a.startRowIndex+1):"",u=a.endColumnIndex!==void 0?D5(a.endColumnIndex-1):"",e=a.endRowIndex!==void 0?String(a.endRowIndex):"";return n&&s&&u&&e?n===u&&s===e?`${t}${n}${s}`:`${t}${n}${s}:${u}${e}`:n&&u&&!s&&!e?`${t}${n}:${u}`:s&&e&&!n&&!u?`${t}${s}:${e}`:`${t}${n}${s}:${u}${e}`.replace(/:$/,"")}class S1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsGetFilter,version:"1.0.0",description:"Get Filter Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.Editor])[0];if(!b||!b.env)throw new Error("Editor context or environment missing");const R=Be(t,t.project,"getFilter"),A="["+Ve(t,t.project,"Get filter")+": `"+R+"`] ",O=(Ce,Ee,Oe)=>{const Le=Ve(Ce==null?void 0:Ce.valueOwner,b==null?void 0:b.logic,Ee),Fe=Be(Ce==null?void 0:Ce.valueOwner,b==null?void 0:b.logic,Oe);return`"${Le}" (\`${Fe}\`)`},P=n.find(Ce=>{var Ee;return((Ee=Ce.valueOwner.declaration)==null?void 0:Ee.id)===G.operation[Q.GoogleSheetsGetFilter].inputs.connection.id}),x=(s=P==null?void 0:P.value)==null?void 0:s.valueAsType;if(!x||!x.id||!x.name||x.type!==r.DefinitionEntity)throw new Error(`${A}The ${O(P,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const $=ui(x);if(!$)throw new Error(`${A}The ${O(P,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const U=n.find(Ce=>{var Ee;return((Ee=Ce.valueOwner.declaration)==null?void 0:Ee.id)===G.operation[Q.GoogleSheetsGetFilter].inputs.spreadsheetId.id}),q=(u=U==null?void 0:U.value)==null?void 0:u.value,Z=ln(q,{errorPrefix:`${A}The ${O(U,"Spreadsheet ID","spreadsheetId")} input `}),H=n.find(Ce=>{var Ee;return((Ee=Ce.valueOwner.declaration)==null?void 0:Ee.id)===G.operation[Q.GoogleSheetsGetFilter].inputs.sheet.id}),W=(e=H==null?void 0:H.value)!=null&&e.value?String(H.value.value).trim():null,z={Authorization:`Bearer ${await b.getAccessToken()}`},Y=`${(f=b.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${b.projectId}/${Zt["google-sheet"]}/${$}`,te=((y=(await(async Ce=>Ht.post(Y,Ce,{headers:z}))({method:"GET",endpoint:`/v4/spreadsheets/${Z}`})).data)==null?void 0:y.sheets)||[];let re=te[0];W&&(re=te.find(Ce=>{var Ee;return((Ee=Ce.properties)==null?void 0:Ee.title)===W})||re);const ae=((m=re==null?void 0:re.properties)==null?void 0:m.title)||"",le=((T=re==null?void 0:re.properties)==null?void 0:T.sheetId)??0,oe=re==null?void 0:re.basicFilter,ce=oe?C5(oe.range,ae):null,ge=((re==null?void 0:re.filterViews)||[]).map(Ce=>({filterViewId:Ce.filterViewId,title:Ce.title,range:C5(Ce.range,ae)}));return{value:K.Success,error:null,result:{sheet:ae,sheetId:le,filterRange:ce,filterViews:ge}}}catch(b){const R=((g=b.response)==null?void 0:g.data)||b.message||b;return pe.Logger.log("[Google Sheets] error:",R),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:R,result:null}}}})}}function w5(a){let p,t="",n=a+1;for(;n>0;)p=(n-1)%26,t=String.fromCharCode(65+p)+t,n=(n-p-1)/26;return t}function SRn(a,p){if(!a)return"";let t=p?`'${p}'!`:"";const n=a.startColumnIndex!==void 0?w5(a.startColumnIndex):"",s=a.startRowIndex!==void 0?String(a.startRowIndex+1):"",u=a.endColumnIndex!==void 0?w5(a.endColumnIndex-1):"",e=a.endRowIndex!==void 0?String(a.endRowIndex):"";return n&&s&&u&&e?n===u&&s===e?`${t}${n}${s}`:`${t}${n}${s}:${u}${e}`:n&&u&&!s&&!e?`${t}${n}:${u}`:s&&e&&!n&&!u?`${t}${s}:${e}`:`${t}${n}${s}:${u}${e}`.replace(/:$/,"")}class M1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsGetMergedCells,version:"1.0.0",description:"Get Merged Cells Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.Editor])[0];if(!b||!b.env)throw new Error("Editor context or environment missing");const R=Be(t,t.project,"getMergedCells"),A="["+Ve(t,t.project,"Get merged cells")+": `"+R+"`] ",O=(ae,le,oe)=>{const ce=Ve(ae==null?void 0:ae.valueOwner,b==null?void 0:b.logic,le),ge=Be(ae==null?void 0:ae.valueOwner,b==null?void 0:b.logic,oe);return`"${ce}" (\`${ge}\`)`},P=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[Q.GoogleSheetsGetMergedCells].inputs.connection.id}),x=(s=P==null?void 0:P.value)==null?void 0:s.valueAsType;if(!x||!x.id||!x.name||x.type!==r.DefinitionEntity)throw new Error(`${A}The ${O(P,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const $=ui(x);if(!$)throw new Error(`${A}The ${O(P,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const U=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[Q.GoogleSheetsGetMergedCells].inputs.spreadsheetId.id}),q=(u=U==null?void 0:U.value)==null?void 0:u.value,Z=ln(q,{errorPrefix:`${A}The ${O(U,"Spreadsheet ID","spreadsheetId")} input `}),H=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[Q.GoogleSheetsGetMergedCells].inputs.sheet.id}),W=(e=H==null?void 0:H.value)!=null&&e.value?String(H.value.value).trim():null,z={Authorization:`Bearer ${await b.getAccessToken()}`},Y=`${(f=b.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${b.projectId}/${Zt["google-sheet"]}/${$}`,te=((y=(await(async ae=>Ht.post(Y,ae,{headers:z}))({method:"GET",endpoint:`/v4/spreadsheets/${Z}`})).data)==null?void 0:y.sheets)||[],re=[];for(const ae of te){const le=(m=ae.properties)==null?void 0:m.title,oe=(T=ae.properties)==null?void 0:T.sheetId;if(W&&le!==W)continue;const ce=ae.merges||[];for(const ge of ce){const Ce=SRn(ge,le);re.push({sheet:le,sheetId:oe,range:Ce})}}return{value:K.Success,error:null,result:re}}catch(b){const R=((g=b.response)==null?void 0:g.data)||b.message||b;return pe.Logger.log("[Google Sheets] error:",R),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:R,result:null}}}})}}class F1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsResizeDimension,version:"1.0.0",description:"Resize Dimension Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.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,ge,Ce)=>{const Ee=Ve(ce==null?void 0:ce.valueOwner,g==null?void 0:g.logic,ge),Oe=Be(ce==null?void 0:ce.valueOwner,g==null?void 0:g.logic,Ce);return`"${Ee}" (\`${Oe}\`)`},O=n.find(ce=>{var ge;return((ge=ce.valueOwner.declaration)==null?void 0:ge.id)===G.operation[Q.GoogleSheetsResizeDimension].inputs.connection.id}),P=(s=O==null?void 0:O.value)==null?void 0:s.valueAsType;if(!P||!P.id||!P.name||P.type!==r.DefinitionEntity)throw new Error(`${I}The ${A(O,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=ui(P);if(!x)throw new Error(`${I}The ${A(O,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const $=n.find(ce=>{var ge;return((ge=ce.valueOwner.declaration)==null?void 0:ge.id)===G.operation[Q.GoogleSheetsResizeDimension].inputs.spreadsheetId.id}),U=(u=$==null?void 0:$.value)==null?void 0:u.value,q=ln(U,{errorPrefix:`${I}The ${A($,"Spreadsheet ID","spreadsheetId")} input `}),Z=n.find(ce=>{var ge;return((ge=ce.valueOwner.declaration)==null?void 0:ge.id)===G.operation[Q.GoogleSheetsResizeDimension].inputs.range.id}),H=(e=Z==null?void 0:Z.value)==null?void 0:e.value;if(H==null)throw new Error(`${I}The ${A(Z,"Range","range")} input is missing.`);const W=n.find(ce=>{var ge;return((ge=ce.valueOwner.declaration)==null?void 0:ge.id)===G.operation[Q.GoogleSheetsResizeDimension].inputs.dimension.id}),ie=((f=W==null?void 0:W.value)==null?void 0:f.value)||"Both",z=n.find(ce=>{var ge;return((ge=ce.valueOwner.declaration)==null?void 0:ge.id)===G.operation[Q.GoogleSheetsResizeDimension].inputs.pixelSize.id}),Y=(y=z==null?void 0:z.value)==null?void 0:y.value;if(Y==null||typeof Y!="number"||isNaN(Y)||Y<0)throw new Error(`${I}The ${A(z,"Pixel size","pixelSize")} input is missing or invalid. Expected a non-negative number in pixels.`);const J={Authorization:`Bearer ${await g.getAccessToken()}`},te=`${(m=g.env)==null?void 0:m.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${g.projectId}/${Zt["google-sheet"]}/${x}`,re=async ce=>Ht.post(te,ce,{headers:J}),ae=await Ha(H,"Id",async()=>{var ge;return(((ge=(await re({method:"GET",endpoint:`/v4/spreadsheets/${q}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:ge.sheets)||[]).map(Ce=>{var Ee,Oe;return{id:(Ee=Ce.properties)==null?void 0:Ee.sheetId,name:(Oe=Ce.properties)==null?void 0:Oe.title}})}),oe=S4(ae,typeof ie=="string"?ie:void 0,{errorPrefix:`${I}The ${A(Z,"Range","range")} input `}).map(ce=>({updateDimensionProperties:{range:ce,properties:{pixelSize:Y},fields:"pixelSize"}}));return await re({method:"POST",endpoint:`/v4/spreadsheets/${q}:batchUpdate`,data:{requests:oe}}),{value:K.Success,result:null,error:null}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return pe.Logger.log("[Google Sheets] error:",b),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:b,result:null}}}})}}class k1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsClearFormatting,version:"1.0.0",description:"Clear Formatting Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.GoogleSheetsClearFormatting);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"clearFormatting"),b="["+Ve(t,t.project,"Clear formatting")+": `"+T+"`] ",R=(ee,J,te)=>{const re=Ve(ee==null?void 0:ee.valueOwner,m==null?void 0:m.logic,J),ae=Be(ee==null?void 0:ee.valueOwner,m==null?void 0:m.logic,te);return`"${re}" (\`${ae}\`)`},I=n.find(ee=>{var J;return((J=ee.valueOwner.declaration)==null?void 0:J.id)===G.operation[Q.GoogleSheetsClearFormatting].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(A);if(!O)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(ee=>{var J;return((J=ee.valueOwner.declaration)==null?void 0:J.id)===G.operation[Q.GoogleSheetsClearFormatting].inputs.spreadsheetId.id}),x=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(x,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(ee=>{var J;return((J=ee.valueOwner.declaration)==null?void 0:J.id)===G.operation[Q.GoogleSheetsClearFormatting].inputs.range.id}),q=(e=U==null?void 0:U.value)==null?void 0:e.value;if(!q||q==="")throw new Error(`${b}The ${R(U,"Range","range")} input is missing.`);const H={Authorization:`Bearer ${await m.getAccessToken()}`},W=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${O}`,ie=async ee=>Ht.post(W,ee,{headers:H}),z=await Ha(q,"Id",async()=>{var J;return(((J=(await ie({method:"GET",endpoint:`/v4/spreadsheets/${$}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:J.sheets)||[]).map(te=>{var re,ae;return{id:(re=te.properties)==null?void 0:re.sheetId,name:(ae=te.properties)==null?void 0:ae.title}})}),Y=ps(z,{errorPrefix:`${b}The ${R(U,"Range","range")} input `});return await ie({method:"POST",endpoint:`/v4/spreadsheets/${$}:batchUpdate`,data:{requests:[{repeatCell:{range:Y,cell:{userEnteredFormat:{}},fields:"userEnteredFormat"}}]}}),{value:K.Success,error:null,result:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class U1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_UPLOAD_FILE,version:"1.0.0",description:"Cloud File System: Upload File",initPriority:_e.High,permissions:[$e.All],contexts:[X.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===X.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,[X.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(J=>{var te,re;return((re=(te=J.valueOwner)==null?void 0:te.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(J=>J.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(J=>{var te,re;return((re=(te=J.valueOwner)==null?void 0:te.declaration)==null?void 0:re.id)===G.operation[Ye.UploadFile].inputs.key.id}),x=(e=P==null?void 0:P.value)==null?void 0:e.value;if(!x||x==="")throw new Error(`${b}The "${Ve(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"key")}\`) input is missing.`);if(typeof x!="string")throw new Error(`${b}The "${Ve(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const $=n.find(J=>{var te,re;return((re=(te=J.valueOwner)==null?void 0:te.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 q=U.uri,Z=U.mimeType||"application/octet-stream",H=x,ie=(y=(await Ht.post(`${m.env.API_BASE_URL}/cloud-files-service/v1/files?bucket=${A}&key=${encodeURIComponent(H)}&contentType=${encodeURIComponent(Z)}`,{},{headers:{Authorization:`Bearer ${await m.getAccessToken()}`}})).data)==null?void 0:y.uploadUrl;if(!ie)throw new Error(`${b}Failed to retrieve pre-signed upload URL.`);let z;try{z=await L4(q,()=>m.getAccessToken())}catch(J){throw new Error(`${b}Failed to fetch file content from '${q}': ${(J==null?void 0:J.message)||J}`)}await Ht.put(ie,z,{headers:{"Content-Type":Z}});const ee={uri:`${m.env.API_BASE_URL}/cloud-files-service/v1/files/download?bucket=${A}&key=${encodeURIComponent(H)}`,name:H.split("/").pop()||H,mimeType:Z,size:z.length};return{value:K.Success,error:null,result:ee}}catch(m){return{value:K.UnhandledError,error:m,result:null}}}})}}class K1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_GET_FILE,version:"1.0.0",description:"Cloud File System: Get File",initPriority:_e.High,permissions:[$e.All],contexts:[X.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===X.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,[X.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,q;return((q=(U=$.valueOwner)==null?void 0:U.declaration)==null?void 0:q.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,q;return((q=(U=$.valueOwner)==null?void 0:U.declaration)==null?void 0:q.id)===G.operation[Ye.GetFile].inputs.key.id}),O=(e=A==null?void 0:A.value)==null?void 0:e.value;if(!O||O==="")throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"key")}\`) input is missing.`);if(typeof O!="string")throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const x=(await Ht.get(`${f.env.API_BASE_URL}/cloud-files-service/v1/files/metadata?bucket=${R}&key=${encodeURIComponent(O)}`,{headers:{Authorization:`Bearer ${await f.getAccessToken()}`}})).data;return{value:K.Success,error:null,result:{uri:x.uri,name:x.name,key:x.key,size:x.size,mimeType:x.mimeType,access:x.access,lastModified:x.lastModified}}}catch(f){return{value:K.UnhandledError,error:f,result:null}}}})}}class j1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_LIST_FILES,version:"1.0.0",description:"Cloud File System: List Files",initPriority:_e.High,permissions:[$e.All],contexts:[X.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===X.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,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"listFiles"),b="["+Ve(t,t.project,"List files")+": `"+T+"`] ",R=n.find(ae=>{var le,oe;return((oe=(le=ae.valueOwner)==null?void 0:le.declaration)==null?void 0:oe.id)===G.operation[Ye.ListFiles].inputs.bucket.id}),I=(s=R==null?void 0:R.value)==null?void 0:s.valueAsType;if(!I||!I.id||!I.name||I.type!==r.DefinitionEntity)throw new Error(`${b}Invalid input "${Ve(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"Storage")}" (\`${Be(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const A=ul(I==null?void 0:I.id,((u=m.branchHead)==null?void 0:u.identifier)||"main");if(!((m==null?void 0:m.liveResources)||[]).find(ae=>ae.resourceId===A))throw new Error(`${b}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const P=n.find(ae=>{var le,oe;return((oe=(le=ae.valueOwner)==null?void 0:le.declaration)==null?void 0:oe.id)===G.operation[Ye.ListFiles].inputs.path.id}),x=(e=P==null?void 0:P.value)==null?void 0:e.value;if(x!==void 0&&typeof x!="string")throw new Error(`${b}The "${Ve(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"Path")}" (\`${Be(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"path")}\`) input value is invalid, if present, it must be a string.`);const $=n.find(ae=>{var le,oe;return((oe=(le=ae.valueOwner)==null?void 0:le.declaration)==null?void 0:oe.id)===G.operation[Ye.ListFiles].inputs.maxKeys.id}),U=(f=$==null?void 0:$.value)==null?void 0:f.value;if(U!==void 0&&(typeof U!="number"||U<=0))throw new Error(`${b}The "${Ve($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"Max results")}" (\`${Be($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"maxKeys")}\`) input value is invalid, if present, it must be a number greater than 0.`);const q=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}),Z=(y=q==null?void 0:q.value)==null?void 0:y.value;if(Z!==void 0&&(typeof Z!="string"||Z===""))throw new Error(`${b}The "${Ve(q==null?void 0:q.valueOwner,m==null?void 0:m.logic,"Start after")}" (\`${Be(q==null?void 0:q.valueOwner,m==null?void 0:m.logic,"startAfter")}\`) input value is invalid, if present, it must be a non-empty string.`);let H=`${m.env.API_BASE_URL}/cloud-files-service/v1/files?bucket=${A}`;x&&(H+=`&path=${encodeURIComponent(x)}`),U&&(H+=`&maxKeys=${U}`),Z&&(H+=`&startAfter=${encodeURIComponent(Z)}`);const W=await Ht.get(H,{headers:{Authorization:`Bearer ${await m.getAccessToken()}`}}),ie=ae=>{var ge;if(!ae)return"application/octet-stream";const le=ae.split(".");if(le.length<=1)return"application/octet-stream";const oe=(ge=le.pop())==null?void 0:ge.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"},Y=(W.data.items||W.data.files||[]).map(ae=>({uri:ae.uri||ae.url||`${m.env.API_BASE_URL}/cloud-files-service/v1/files/download?bucket=${A}&key=${encodeURIComponent(ae.key)}`,name:ae.name,key:ae.key,mimeType:ae.mimeType||ie(ae.key),size:ae.size||0,lastModified:ae.lastModified,access:ae.access})),ee=W.data.total!==void 0?W.data.total:Y.length,J=W.data.size!==void 0?W.data.size:Y.reduce((ae,le)=>ae+(le.size||0),0),te=W.data.nextStartAfter!==void 0?W.data.nextStartAfter:null,re=W.data.hasMore!==void 0?W.data.hasMore:!1;return{value:K.Success,error:null,result:{items:Y,total:ee,size:J,nextStartAfter:te,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:[X.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===X.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,[X.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 q,Z;return((Z=(q=U.valueOwner)==null?void 0:q.declaration)==null?void 0:Z.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 q,Z;return((Z=(q=U.valueOwner)==null?void 0:q.declaration)==null?void 0:Z.id)===G.operation[Ye.DeleteFiles].inputs.keys.id}),O=(e=A==null?void 0:A.value)==null?void 0:e.value,P=Array.isArray(O)?O:typeof O=="string"&&O!==""?[O]:[];if(!P||P.length===0)throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Keys")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"keys")}\`) input is missing.`);if(!Array.isArray(P)||P.some(U=>typeof U!="string"||U===""))throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Keys")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"keys")}\`) input value is invalid, if present, it must be a list of non-empty strings.`);const $=(await Ht.delete(`${f.env.API_BASE_URL}/cloud-files-service/v1/files`,{headers:{Authorization:`Bearer ${await f.getAccessToken()}`},data:{bucket:R,keys:P}})).data;return{value:K.Success,error:null,result:null}}catch(f){return{value:K.UnhandledError,error:f,result:null}}}})}}class Z1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_COPY_FILE,version:"1.0.0",description:"Cloud File System: Copy File",initPriority:_e.High,permissions:[$e.All],contexts:[X.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===X.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,[X.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(J=>{var te,re;return((re=(te=J.valueOwner)==null?void 0:te.declaration)==null?void 0:re.id)===G.operation[Ye.CopyFile].inputs.bucket.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${R}Invalid input "${Ve(I==null?void 0:I.valueOwner,T==null?void 0:T.logic,"Storage")}" (\`${Be(I==null?void 0:I.valueOwner,T==null?void 0:T.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const O=ul(A==null?void 0:A.id,((u=T.branchHead)==null?void 0:u.identifier)||"main");if(!((T==null?void 0:T.liveResources)||[]).find(J=>J.resourceId===O))throw new Error(`${R}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const x=n.find(J=>{var te,re;return((re=(te=J.valueOwner)==null?void 0:te.declaration)==null?void 0:re.id)===G.operation[Ye.CopyFile].inputs.sourceKey.id}),$=(e=x==null?void 0:x.value)==null?void 0:e.value;if(!$||$==="")throw new Error(`${R}The "${Ve(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"Source key")}" (\`${Be(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"sourceKey")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${R}The "${Ve(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"Source key")}" (\`${Be(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"sourceKey")}\`) input value is invalid, if present, it must be a non-empty string.`);const U=n.find(J=>{var te,re;return((re=(te=J.valueOwner)==null?void 0:te.declaration)==null?void 0:re.id)===G.operation[Ye.CopyFile].inputs.destinationKey.id}),q=(f=U==null?void 0:U.value)==null?void 0:f.value;if(!q||q==="")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 q!="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 Z=n.find(J=>{var te,re;return((re=(te=J.valueOwner)==null?void 0:te.declaration)==null?void 0:re.id)===G.operation[Ye.CopyFile].inputs.destinationBucket.id}),H=(y=Z==null?void 0:Z.value)==null?void 0:y.valueAsType;if(H&&(!H.id||!H.name||H.type!==r.DefinitionEntity))throw new Error(`${R}Invalid input "${Ve(Z==null?void 0:Z.valueOwner,T==null?void 0:T.logic,"Destination Storage")}" (\`${Be(Z==null?void 0:Z.valueOwner,T==null?void 0:T.logic,"destinationBucket")}\`), expected a valid "Cloud file system" node.`);const W=H!=null&&H.id?ul(H.id,((m=T.branchHead)==null?void 0:m.identifier)||"main"):O;if(!((T==null?void 0:T.liveResources)||[]).find(J=>J.resourceId===W))throw new Error(`${R}The destination "Cloud file system" is not live. Publish the project first, then try again to run the operation node.`);const z={headers:{Authorization:`Bearer ${await T.getAccessToken()}`}},ee=(await Ht.post(`${T.env.API_BASE_URL}/cloud-files-service/v1/files/copy`,{bucket:O,destinationBucket:W,sourceKey:$,destinationKey:q},z)).data;return{value:K.Success,error:null,result:null}}catch(T){return{value:K.UnhandledError,error:T,result:null}}}})}}class H1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_MOVE_FILE,version:"1.0.0",description:"Cloud File System: Move File",initPriority:_e.High,permissions:[$e.All],contexts:[X.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===X.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,[X.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(J=>{var te,re;return((re=(te=J.valueOwner)==null?void 0:te.declaration)==null?void 0:re.id)===G.operation[Ye.MoveFile].inputs.bucket.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${R}Invalid input "${Ve(I==null?void 0:I.valueOwner,T==null?void 0:T.logic,"Storage")}" (\`${Be(I==null?void 0:I.valueOwner,T==null?void 0:T.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const O=ul(A==null?void 0:A.id,((u=T.branchHead)==null?void 0:u.identifier)||"main");if(!((T==null?void 0:T.liveResources)||[]).find(J=>J.resourceId===O))throw new Error(`${R}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const x=n.find(J=>{var te,re;return((re=(te=J.valueOwner)==null?void 0:te.declaration)==null?void 0:re.id)===G.operation[Ye.MoveFile].inputs.sourceKey.id}),$=(e=x==null?void 0:x.value)==null?void 0:e.value;if(!$||$==="")throw new Error(`${R}The "${Ve(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"Source key")}" (\`${Be(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"sourceKey")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${R}The "${Ve(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"Source key")}" (\`${Be(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"sourceKey")}\`) input value is invalid, if present, it must be a non-empty string.`);const U=n.find(J=>{var te,re;return((re=(te=J.valueOwner)==null?void 0:te.declaration)==null?void 0:re.id)===G.operation[Ye.MoveFile].inputs.destinationKey.id}),q=(f=U==null?void 0:U.value)==null?void 0:f.value;if(!q||q==="")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 q!="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 Z=n.find(J=>{var te,re;return((re=(te=J.valueOwner)==null?void 0:te.declaration)==null?void 0:re.id)===G.operation[Ye.MoveFile].inputs.destinationBucket.id}),H=(y=Z==null?void 0:Z.value)==null?void 0:y.valueAsType;if(H&&(!H.id||!H.name||H.type!==r.DefinitionEntity))throw new Error(`${R}Invalid input "${Ve(Z==null?void 0:Z.valueOwner,T==null?void 0:T.logic,"Destination storage")}" (\`${Be(Z==null?void 0:Z.valueOwner,T==null?void 0:T.logic,"destinationBucket")}\`), expected a valid "Cloud file system" node.`);const W=H!=null&&H.id?ul(H.id,((m=T.branchHead)==null?void 0:m.identifier)||"main"):O;if(!((T==null?void 0:T.liveResources)||[]).find(J=>J.resourceId===W))throw new Error(`${R}The destination "Cloud file system" is not live. Publish the project first, then try again to run the operation node.`);const z={headers:{Authorization:`Bearer ${await T.getAccessToken()}`}},ee=(await Ht.post(`${T.env.API_BASE_URL}/cloud-files-service/v1/files/move`,{bucket:O,destinationBucket:W,sourceKey:$,destinationKey:q},z)).data;return{value:K.Success,error:null,result:null}}catch(T){return{value:K.UnhandledError,error:T,result:null}}}})}}class W1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_RENAME_FILE,version:"1.0.0",description:"Cloud File System: Rename File",initPriority:_e.High,permissions:[$e.All],contexts:[X.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===X.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,[X.Editor])[0];if(!y||!y.env)throw new Error("Editor context or environment missing");const m=Be(t,t.project,"renameFile"),g="["+Ve(t,t.project,"Rename file")+": `"+m+"`] ",b=n.find(ie=>{var z,Y;return((Y=(z=ie.valueOwner)==null?void 0:z.declaration)==null?void 0:Y.id)===G.operation[Ye.RenameFile].inputs.bucket.id}),R=(s=b==null?void 0:b.value)==null?void 0:s.valueAsType;if(!R||!R.id||!R.name||R.type!==r.DefinitionEntity)throw new Error(`${g}Invalid input "${Ve(b==null?void 0:b.valueOwner,y==null?void 0:y.logic,"Storage")}" (\`${Be(b==null?void 0:b.valueOwner,y==null?void 0:y.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const I=ul(R==null?void 0:R.id,((u=y.branchHead)==null?void 0:u.identifier)||"main");if(!((y==null?void 0:y.liveResources)||[]).find(ie=>ie.resourceId===I))throw new Error(`${g}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const O=n.find(ie=>{var z,Y;return((Y=(z=ie.valueOwner)==null?void 0:z.declaration)==null?void 0:Y.id)===G.operation[Ye.RenameFile].inputs.key.id}),P=(e=O==null?void 0:O.value)==null?void 0:e.value;if(!P||P==="")throw new Error(`${g}The "${Ve(O==null?void 0:O.valueOwner,y==null?void 0:y.logic,"Key")}" (\`${Be(O==null?void 0:O.valueOwner,y==null?void 0:y.logic,"key")}\`) input is missing.`);if(typeof P!="string")throw new Error(`${g}The "${Ve(O==null?void 0:O.valueOwner,y==null?void 0:y.logic,"Key")}" (\`${Be(O==null?void 0:O.valueOwner,y==null?void 0:y.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const x=n.find(ie=>{var z,Y;return((Y=(z=ie.valueOwner)==null?void 0:z.declaration)==null?void 0:Y.id)===G.operation[Ye.RenameFile].inputs.newName.id}),$=(f=x==null?void 0:x.value)==null?void 0:f.value;if(!$||$==="")throw new Error(`${g}The "${Ve(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"New name")}" (\`${Be(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"newName")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${g}The "${Ve(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"New name")}" (\`${Be(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"newName")}\`) input value is invalid, if present, it must be a non-empty string.`);const U=P.lastIndexOf("/"),Z=`${U!==-1?P.substring(0,U+1):""}${$}`,H={headers:{Authorization:`Bearer ${await y.getAccessToken()}`}},W=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:W.data||{key:P,newName:$,destinationKey:Z}}}catch(y){return{value:K.UnhandledError,error:y,result:null}}}})}}class z1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_GET_FILE_METADATA,version:"1.0.0",description:"Cloud File System: Get File Metadata",initPriority:_e.High,permissions:[$e.All],contexts:[X.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===X.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,[X.Editor])[0];if(!f||!f.env)throw new Error("Editor context or environment missing");const y=Be(t,t.project,"getFileMetadata"),T="["+Ve(t,t.project,"Get file metadata")+": `"+y+"`] ",g=n.find(x=>{var $,U;return((U=($=x.valueOwner)==null?void 0:$.declaration)==null?void 0:U.id)===G.operation[Ye.GetFileMetadata].inputs.bucket.id}),b=(s=g==null?void 0:g.value)==null?void 0:s.valueAsType;if(!b||!b.id||!b.name||b.type!==r.DefinitionEntity)throw new Error(`${T}Invalid input "${Ve(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"Storage")}" (\`${Be(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const R=ul(b==null?void 0:b.id,((u=f.branchHead)==null?void 0:u.identifier)||"main");if(!((f==null?void 0:f.liveResources)||[]).find(x=>x.resourceId===R))throw new Error(`${T}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const A=n.find(x=>{var $,U;return((U=($=x.valueOwner)==null?void 0:$.declaration)==null?void 0:U.id)===G.operation[Ye.GetFileMetadata].inputs.key.id}),O=(e=A==null?void 0:A.value)==null?void 0:e.value;if(!O||O==="")throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"key")}\`) input is missing.`);if(typeof O!="string")throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const P=await Ht.get(`${f.env.API_BASE_URL}/cloud-files-service/v1/files/metadata?bucket=${R}&key=${encodeURIComponent(O)}`,{headers:{Authorization:`Bearer ${await f.getAccessToken()}`}});return{value:K.Success,error:null,result:P.data}}catch(f){return{value:K.UnhandledError,error:f,result:null}}}})}}class Y1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_CHECK_FILE_EXISTS,version:"1.0.0",description:"Cloud File System: Check File Exists",initPriority:_e.High,permissions:[$e.All],contexts:[X.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===X.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,[X.Editor])[0];if(!f||!f.env)throw new Error("Editor context or environment missing");const y=Be(t,t.project,"checkFileExists"),T="["+Ve(t,t.project,"Check File Exists")+": `"+y+"`] ",g=n.find(x=>{var $,U;return((U=($=x.valueOwner)==null?void 0:$.declaration)==null?void 0:U.id)===G.operation[Ye.CheckFileExists].inputs.bucket.id}),b=(s=g==null?void 0:g.value)==null?void 0:s.valueAsType;if(!b||!b.id||!b.name||b.type!==r.DefinitionEntity)throw new Error(`${T}Invalid input "${Ve(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"Storage")}" (\`${Be(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const R=ul(b==null?void 0:b.id,((u=f.branchHead)==null?void 0:u.identifier)||"main");if(!((f==null?void 0:f.liveResources)||[]).find(x=>x.resourceId===R))throw new Error(`${T}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const A=n.find(x=>{var $,U;return((U=($=x.valueOwner)==null?void 0:$.declaration)==null?void 0:U.id)===G.operation[Ye.CheckFileExists].inputs.key.id}),O=(e=A==null?void 0:A.value)==null?void 0:e.value;if(!O||O==="")throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"key")}\`) input is missing.`);if(typeof O!="string")throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const P=await Ht.get(`${f.env.API_BASE_URL}/cloud-files-service/v1/files/exists?bucket=${R}&key=${encodeURIComponent(O)}`,{headers:{Authorization:`Bearer ${await f.getAccessToken()}`}});return{value:K.Success,error:null,result:P.data.exists}}catch(f){return{value:K.UnhandledError,error:f,result:!1}}}})}}class J1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_GET_PRESIGNED_URL,version:"1.0.0",description:"Cloud File System: Get Pre-signed URL",initPriority:_e.High,permissions:[$e.All],contexts:[X.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===X.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,[X.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(Y=>{var ee,J;return((J=(ee=Y.valueOwner)==null?void 0:ee.declaration)==null?void 0:J.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(Y=>Y.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(Y=>{var ee,J;return((J=(ee=Y.valueOwner)==null?void 0:ee.declaration)==null?void 0:J.id)===G.operation[Ye.GetPresignedUrl].inputs.key.id}),x=(e=P==null?void 0:P.value)==null?void 0:e.value;if(!x||x==="")throw new Error(`${b}The "${Ve(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"key")}\`) input is missing.`);if(typeof x!="string")throw new Error(`${b}The "${Ve(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const $=n.find(Y=>{var ee,J;return((J=(ee=Y.valueOwner)==null?void 0:ee.declaration)==null?void 0:J.id)===G.operation[Ye.GetPresignedUrl].inputs.action.id}),U=(f=$==null?void 0:$.value)==null?void 0:f.value,q=(U||"read").toLowerCase(),Z=["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(!Z.includes(q))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(Y=>{var ee,J;return((J=(ee=Y.valueOwner)==null?void 0:ee.declaration)==null?void 0:J.id)===G.operation[Ye.GetPresignedUrl].inputs.expiresInSeconds.id}),W=(y=H==null?void 0:H.value)==null?void 0:y.value,ie=W!=null?Number(W):3600;if(isNaN(ie)||ie<=0)throw new Error(`${b}Invalid "${Ve(H==null?void 0:H.valueOwner,m==null?void 0:m.logic,"Expires in seconds")}" (\`${Be(H==null?void 0:H.valueOwner,m==null?void 0:m.logic,"expiresInSeconds")}\`) input value, expected a positive number.`);const z=await Ht.get(`${m.env.API_BASE_URL}/cloud-files-service/v1/files/presigned-url?bucket=${A}&key=${encodeURIComponent(x)}&action=${q}&expiresInSeconds=${ie}`,{headers:{Authorization:`Bearer ${await m.getAccessToken()}`}});return{value:K.Success,error:null,result:z.data}}catch(m){return{value:K.UnhandledError,error:m,result:null}}}})}}class Q1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_SET_FILE_ACCESS,version:"1.0.0",description:"Cloud File System: Set File Access",initPriority:_e.High,permissions:[$e.All],contexts:[X.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===X.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,[X.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 q,Z;return((Z=(q=U.valueOwner)==null?void 0:q.declaration)==null?void 0:Z.id)===G.operation[Ye.SetFileAccess].inputs.bucket.id}),R=(s=b==null?void 0:b.value)==null?void 0:s.valueAsType;if(!R||!R.id||!R.name||R.type!==r.DefinitionEntity)throw new Error(`${g}Invalid input "${Ve(b==null?void 0:b.valueOwner,y==null?void 0:y.logic,"Storage")}" (\`${Be(b==null?void 0:b.valueOwner,y==null?void 0:y.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const I=ul(R==null?void 0:R.id,((u=y.branchHead)==null?void 0:u.identifier)||"main");if(!((y==null?void 0:y.liveResources)||[]).find(U=>U.resourceId===I))throw new Error(`${g}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const O=n.find(U=>{var q,Z;return((Z=(q=U.valueOwner)==null?void 0:q.declaration)==null?void 0:Z.id)===G.operation[Ye.SetFileAccess].inputs.key.id}),P=(e=O==null?void 0:O.value)==null?void 0:e.value;if(!P||P==="")throw new Error(`${g}The "${Ve(O==null?void 0:O.valueOwner,y==null?void 0:y.logic,"Key")}" (\`${Be(O==null?void 0:O.valueOwner,y==null?void 0:y.logic,"key")}\`) input is missing.`);if(typeof P!="string")throw new Error(`${g}The "${Ve(O==null?void 0:O.valueOwner,y==null?void 0:y.logic,"Key")}" (\`${Be(O==null?void 0:O.valueOwner,y==null?void 0:y.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const x=n.find(U=>{var q,Z;return((Z=(q=U.valueOwner)==null?void 0:q.declaration)==null?void 0:Z.id)===G.operation[Ye.SetFileAccess].inputs.access.id}),$=((f=x==null?void 0:x.value)==null?void 0:f.value)??"private";if(!$||$==="")throw new Error(`${g}The "${Ve(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"Access")}" (\`${Be(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"access")}\`) input is missing.`);if(typeof $!="string"||!["public","private"].includes($))throw new Error(`${g}The "${Ve(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"Access")}" (\`${Be(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"access")}\`) input value is invalid, if present, it must be exactly the "public" or "private" text values.`);return await Ht.post(`${y.env.API_BASE_URL}/cloud-files-service/v1/files/access`,{bucket:I,key:P,access:$},{headers:{Authorization:`Bearer ${await y.getAccessToken()}`}}),{value:K.Success,error:null,result:null}}catch(y){return{value:K.UnhandledError,error:y,result:null}}}})}}class X1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_CREATE_FOLDER,version:"1.0.0",description:"Cloud File System: Create Folder",initPriority:_e.High,permissions:[$e.All],contexts:[X.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===X.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,[X.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,q;return((q=(U=$.valueOwner)==null?void 0:U.declaration)==null?void 0:q.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,q;return((q=(U=$.valueOwner)==null?void 0:U.declaration)==null?void 0:q.id)===G.operation[Ye.CreateFolder].inputs.folderPath.id}),O=(e=A==null?void 0:A.value)==null?void 0:e.value;if(!O||O==="")throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Folder path")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"folderPath")}\`) input is missing.`);if(typeof O!="string")throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Folder path")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"folderPath")}\`) input value is invalid, if present, it must be a non-empty string.`);const x=(await Ht.post(`${f.env.API_BASE_URL}/cloud-files-service/v1/files/folders`,{bucket:R,folderPath:O},{headers:{Authorization:`Bearer ${await f.getAccessToken()}`}})).data;return{value:K.Success,error:null,result:null}}catch(f){return{value:K.UnhandledError,error:f,result:null}}}})}}class eDt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_DELETE_FOLDERS,version:"1.0.0",description:"Cloud File System: Delete Folders",initPriority:_e.High,permissions:[$e.All],contexts:[X.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===X.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,[X.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 q,Z;return((Z=(q=U.valueOwner)==null?void 0:q.declaration)==null?void 0:Z.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 q,Z;return((Z=(q=U.valueOwner)==null?void 0:q.declaration)==null?void 0:Z.id)===G.operation[Ye.DeleteFolders].inputs.folderPaths.id}),O=(e=A==null?void 0:A.value)==null?void 0:e.value,P=Array.isArray(O)?O:typeof O=="string"&&O!==""?[O]:[];if(!P||P.length===0)throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Folder paths")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"folderPaths")}\`) input is missing.`);if(!Array.isArray(P)||P.some(U=>typeof U!="string"||U===""))throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Folder paths")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"folderPaths")}\`) input value is invalid, if present, it must be a list of non-empty strings.`);const $=(await Ht.delete(`${f.env.API_BASE_URL}/cloud-files-service/v1/files/folders`,{headers:{Authorization:`Bearer ${await f.getAccessToken()}`},data:{bucket:R,folderPaths:P}})).data;return{value:K.Success,error:null,result:null}}catch(f){return{value:K.UnhandledError,error:f,result:null}}}})}}class tDt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_CREATE_MULTIPART_UPLOAD,version:"1.0.0",description:"Cloud File System: Create Multipart Upload",initPriority:_e.High,permissions:[$e.All],contexts:[X.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===X.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,[X.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(q=>{var Z,H;return((H=(Z=q.valueOwner)==null?void 0:Z.declaration)==null?void 0:H.id)===G.operation[Ye.CreateMultipartUpload].inputs.bucket.id}),I=(s=R==null?void 0:R.value)==null?void 0:s.valueAsType;if(!I||!I.id||!I.name||I.type!==r.DefinitionEntity)throw new Error(`${b}Invalid input "${Ve(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"Storage")}" (\`${Be(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const A=ul(I==null?void 0:I.id,((u=m.branchHead)==null?void 0:u.identifier)||"main"),O=n.find(q=>{var Z,H;return((H=(Z=q.valueOwner)==null?void 0:Z.declaration)==null?void 0:H.id)===G.operation[Ye.CreateMultipartUpload].inputs.key.id}),P=(e=O==null?void 0:O.value)==null?void 0:e.value;if(!P||P==="")throw new Error(`${b}The "${Ve(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"key")}\`) input is missing.`);if(typeof P!="string")throw new Error(`${b}The "${Ve(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const x=n.find(q=>{var Z,H;return((H=(Z=q.valueOwner)==null?void 0:Z.declaration)==null?void 0:H.id)===G.operation[Ye.CreateMultipartUpload].inputs.contentType.id}),$=((f=x==null?void 0:x.value)==null?void 0:f.value)||"application/octet-stream";if(!$||$==="")throw new Error(`${b}The "${Ve(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"Content Type")}" (\`${Be(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"contentType")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${b}The "${Ve(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"Content Type")}" (\`${Be(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"contentType")}\`) input value is invalid, if present, it must be a non-empty string.`);const U=await Ht.post(`${m.env.API_BASE_URL}/cloud-files-service/v1/files/multipart?bucket=${A}&key=${encodeURIComponent(P)}&contentType=${encodeURIComponent($)}`,{},{headers:{Authorization:`Bearer ${await m.getAccessToken()}`}});return{value:K.Success,error:null,result:{uploadId:typeof U.data=="object"&&((y=U.data)!=null&&y.uploadId)?U.data.uploadId:U.data}}}catch(m){return{value:K.UnhandledError,error:m,result:null}}}})}}class iDt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_GET_UPLOAD_PART_PRESIGNED_URL,version:"1.0.0",description:"Cloud File System: Get Upload Part Pre-signed URL",initPriority:_e.High,permissions:[$e.All],contexts:[X.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===X.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,[X.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 W,ie;return((ie=(W=H.valueOwner)==null?void 0:W.declaration)==null?void 0:ie.id)===G.operation[Ye.GetUploadPartPresignedUrl].inputs.bucket.id}),I=(s=R==null?void 0:R.value)==null?void 0:s.valueAsType;if(!I||!I.id||!I.name||I.type!==r.DefinitionEntity)throw new Error(`${b}${b}Invalid input "${Ve(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"Storage")}" (\`${Be(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const A=ul(I==null?void 0:I.id,((u=m.branchHead)==null?void 0:u.identifier)||"main"),O=n.find(H=>{var W,ie;return((ie=(W=H.valueOwner)==null?void 0:W.declaration)==null?void 0:ie.id)===G.operation[Ye.GetUploadPartPresignedUrl].inputs.key.id}),P=(e=O==null?void 0:O.value)==null?void 0:e.value;if(!P||P==="")throw new Error(`${b}The "${Ve(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"key")}\`) input is missing.`);if(typeof P!="string")throw new Error(`${b}The "${Ve(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const x=n.find(H=>{var W,ie;return((ie=(W=H.valueOwner)==null?void 0:W.declaration)==null?void 0:ie.id)===G.operation[Ye.GetUploadPartPresignedUrl].inputs.uploadId.id}),$=(f=x==null?void 0:x.value)==null?void 0:f.value;if(!$||$==="")throw new Error(`${b}The "${Ve(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"Upload ID")}" (\`${Be(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"uploadId")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${b}The "${Ve(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"Upload ID")}" (\`${Be(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"uploadId")}\`) input value is invalid, if present, it must be a non-empty string.`);const U=n.find(H=>{var W,ie;return((ie=(W=H.valueOwner)==null?void 0:W.declaration)==null?void 0:ie.id)===G.operation[Ye.GetUploadPartPresignedUrl].inputs.partNumber.id}),q=Number((y=U==null?void 0:U.value)==null?void 0:y.value);if(isNaN(q)||q<=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 Z=await Ht.get(`${m.env.API_BASE_URL}/cloud-files-service/v1/files/multipart/${$}?bucket=${A}&key=${encodeURIComponent(P)}&partNumber=${q}`,{headers:{Authorization:`Bearer ${await m.getAccessToken()}`}});return{value:K.Success,error:null,result:Z.data}}catch(m){return{value:K.UnhandledError,error:m,result:null}}}})}}class nDt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_COMPLETE_MULTIPART_UPLOAD,version:"1.0.0",description:"Cloud File System: Complete Multipart Upload",initPriority:_e.High,permissions:[$e.All],contexts:[X.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===X.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,[X.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(W=>{var ie,z;return((z=(ie=W.valueOwner)==null?void 0:ie.declaration)==null?void 0:z.id)===G.operation[Ye.CompleteMultipartUpload].inputs.bucket.id}),I=(s=R==null?void 0:R.value)==null?void 0:s.valueAsType;if(!I||!I.id||!I.name||I.type!==r.DefinitionEntity)throw new Error(`${b}Invalid input "${Ve(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"Storage")}" (\`${Be(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const A=ul(I==null?void 0:I.id,((u=m.branchHead)==null?void 0:u.identifier)||"main"),O=n.find(W=>{var ie,z;return((z=(ie=W.valueOwner)==null?void 0:ie.declaration)==null?void 0:z.id)===G.operation[Ye.CompleteMultipartUpload].inputs.key.id}),P=(e=O==null?void 0:O.value)==null?void 0:e.value;if(!P||P==="")throw new Error(`${b}The "${Ve(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"key")}\`) input is missing.`);if(typeof P!="string")throw new Error(`${b}The "${Ve(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const x=n.find(W=>{var ie,z;return((z=(ie=W.valueOwner)==null?void 0:ie.declaration)==null?void 0:z.id)===G.operation[Ye.CompleteMultipartUpload].inputs.uploadId.id}),$=(f=x==null?void 0:x.value)==null?void 0:f.value;if(!$||$==="")throw new Error(`${b}The "${Ve(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"Upload ID")}" (\`${Be(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"uploadId")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${b}The "${Ve(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"Upload ID")}" (\`${Be(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"uploadId")}\`) input value is invalid, if present, it must be a non-empty string.`);const U=n.find(W=>{var ie,z;return((z=(ie=W.valueOwner)==null?void 0:ie.declaration)==null?void 0:z.id)===G.operation[Ye.CompleteMultipartUpload].inputs.parts.id}),q=(y=U==null?void 0:U.value)==null?void 0:y.value;if(!Array.isArray(q)||q.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(q.some(W=>{let ie=!1,z=!1;return(W.partNumber&&Number(W.partNumber)>0||W.PartNumber&&Number(W.PartNumber)>0)&&(ie=!0),(W.etag&&typeof W.etag=="string"||W.ETag&&typeof W.ETag=="string")&&(z=!0),!ie||!z}))throw new Error(`${b}The "${Ve(U==null?void 0:U.valueOwner,m==null?void 0:m.logic,"Parts")}" (\`${Be(U==null?void 0:U.valueOwner,m==null?void 0:m.logic,"parts")}\`) input value is invalid, if present, it must be an array of objects with "partNumber" and "etag" properties.`);const H=(await Ht.post(`${m.env.API_BASE_URL}/cloud-files-service/v1/files/multipart/${$}/complete?bucket=${A}&key=${encodeURIComponent(P)}`,{parts:q},{headers:{Authorization:`Bearer ${await m.getAccessToken()}`}})).data||{};return{value:K.Success,error:null,result:{location:H.location||H.Location||P,key:H.key||H.Key||P,etag:H.etag||H.ETag||null}}}catch(m){return{value:K.UnhandledError,error:m,result:null}}}})}}class rDt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_ABORT_MULTIPART_UPLOAD,version:"1.0.0",description:"Cloud File System: Abort Multipart Upload",initPriority:_e.High,permissions:[$e.All],contexts:[X.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===X.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,[X.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(q=>{var Z,H;return((H=(Z=q.valueOwner)==null?void 0:Z.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(q=>{var Z,H;return((H=(Z=q.valueOwner)==null?void 0:Z.declaration)==null?void 0:H.id)===G.operation[Ye.AbortMultipartUpload].inputs.key.id}),O=(e=A==null?void 0:A.value)==null?void 0:e.value;if(!O||O==="")throw new Error(`${g}The "${Ve(A==null?void 0:A.valueOwner,y==null?void 0:y.logic,"Key")}" (\`${Be(A==null?void 0:A.valueOwner,y==null?void 0:y.logic,"key")}\`) input is missing.`);if(typeof O!="string")throw new Error(`${g}The "${Ve(A==null?void 0:A.valueOwner,y==null?void 0:y.logic,"Key")}" (\`${Be(A==null?void 0:A.valueOwner,y==null?void 0:y.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const P=n.find(q=>{var Z,H;return((H=(Z=q.valueOwner)==null?void 0:Z.declaration)==null?void 0:H.id)===G.operation[Ye.AbortMultipartUpload].inputs.uploadId.id}),x=(f=P==null?void 0:P.value)==null?void 0:f.value;if(!x||x==="")throw new Error(`${g}The "${Ve(P==null?void 0:P.valueOwner,y==null?void 0:y.logic,"Upload ID")}" (\`${Be(P==null?void 0:P.valueOwner,y==null?void 0:y.logic,"uploadId")}\`) input is missing.`);if(typeof x!="string")throw new Error(`${g}The "${Ve(P==null?void 0:P.valueOwner,y==null?void 0:y.logic,"Upload ID")}" (\`${Be(P==null?void 0:P.valueOwner,y==null?void 0:y.logic,"uploadId")}\`) input value is invalid, if present, it must be a non-empty string.`);const U=(await Ht.delete(`${y.env.API_BASE_URL}/cloud-files-service/v1/files/multipart/${x}?bucket=${I}&key=${encodeURIComponent(O)}`,{headers:{Authorization:`Bearer ${await y.getAccessToken()}`}})).data;return{value:K.Success,error:null,result:null}}catch(y){return{value:K.UnhandledError,error:y,result:null}}}})}}class MRn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_UPLOAD_FILE_PART,version:"1.0.0",description:"Cloud File System: Upload File Part",initPriority:_e.High,permissions:[$e.All],contexts:[X.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===X.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,[X.Editor])[0];if(!R||!R.env)throw new Error("Editor context or environment missing");const I=Be(t,t.project,"uploadFilePart"),O="["+Ve(t,t.project,"Upload file part")+": `"+I+"`] ",P=n.find(oe=>{var ce,ge;return((ge=(ce=oe.valueOwner)==null?void 0:ce.declaration)==null?void 0:ge.id)===G.operation[Ye.UploadFilePart].inputs.bucket.id}),x=(s=P==null?void 0:P.value)==null?void 0:s.valueAsType;if(!x||!x.id||!x.name||x.type!==r.DefinitionEntity)throw new Error(`${O}Invalid input "${Ve(P==null?void 0:P.valueOwner,R==null?void 0:R.logic,"Storage")}" (\`${Be(P==null?void 0:P.valueOwner,R==null?void 0:R.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const $=ul(x==null?void 0:x.id,((u=R.branchHead)==null?void 0:u.identifier)||"main");if(!((R==null?void 0:R.liveResources)||[]).find(oe=>oe.resourceId===$))throw new Error(`${O}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const q=n.find(oe=>{var ce,ge;return((ge=(ce=oe.valueOwner)==null?void 0:ce.declaration)==null?void 0:ge.id)===G.operation[Ye.UploadFilePart].inputs.key.id}),Z=(e=q==null?void 0:q.value)==null?void 0:e.value;if(!Z||Z==="")throw new Error(`${O}The "${Ve(q==null?void 0:q.valueOwner,R==null?void 0:R.logic,"Key")}" (\`${Be(q==null?void 0:q.valueOwner,R==null?void 0:R.logic,"key")}\`) input is missing.`);if(typeof Z!="string")throw new Error(`${O}The "${Ve(q==null?void 0:q.valueOwner,R==null?void 0:R.logic,"Key")}" (\`${Be(q==null?void 0:q.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,ge;return((ge=(ce=oe.valueOwner)==null?void 0:ce.declaration)==null?void 0:ge.id)===G.operation[Ye.UploadFilePart].inputs.uploadId.id}),W=(f=H==null?void 0:H.value)==null?void 0:f.value;if(!W||W==="")throw new Error(`${O}The "${Ve(H==null?void 0:H.valueOwner,R==null?void 0:R.logic,"Upload ID")}" (\`${Be(H==null?void 0:H.valueOwner,R==null?void 0:R.logic,"uploadId")}\`) input is missing.`);if(typeof W!="string")throw new Error(`${O}The "${Ve(H==null?void 0:H.valueOwner,R==null?void 0:R.logic,"Upload ID")}" (\`${Be(H==null?void 0:H.valueOwner,R==null?void 0:R.logic,"uploadId")}\`) input value is invalid, if present, it must be a non-empty string.`);const ie=n.find(oe=>{var ce,ge;return((ge=(ce=oe.valueOwner)==null?void 0:ce.declaration)==null?void 0:ge.id)===G.operation[Ye.UploadFilePart].inputs.partNumber.id}),z=Number((y=ie==null?void 0:ie.value)==null?void 0:y.value);if(((m=ie==null?void 0:ie.value)==null?void 0:m.value)===void 0||((T=ie==null?void 0:ie.value)==null?void 0:T.value)===null||isNaN(z)||z<=0)throw new Error(`${O}The "${Ve(ie==null?void 0:ie.valueOwner,R==null?void 0:R.logic,"Part number")}" (\`${Be(ie==null?void 0:ie.valueOwner,R==null?void 0:R.logic,"partNumber")}\`) input is missing or invalid.`);const Y=n.find(oe=>{var ce,ge;return((ge=(ce=oe.valueOwner)==null?void 0:ce.declaration)==null?void 0:ge.id)===G.operation[Ye.UploadFilePart].inputs.bytes.id}),ee=(g=Y==null?void 0:Y.value)==null?void 0:g.value;if(ee==null)throw new Error(`${O}The "${Ve(Y==null?void 0:Y.valueOwner,R==null?void 0:R.logic,"Bytes")}" (\`${Be(Y==null?void 0:Y.valueOwner,R==null?void 0:R.logic,"bytes")}\`) input is missing.`);const te=(b=(await Ht.get(`${R.env.API_BASE_URL}/cloud-files-service/v1/files/multipart/${W}?bucket=${$}&key=${encodeURIComponent(Z)}&partNumber=${z}`,{headers:{Authorization:`Bearer ${await R.getAccessToken()}`}})).data)==null?void 0:b.uploadUrl;if(!te)throw new Error(`${O}Failed to obtain presigned upload URL for part ${z}.`);const re=await Ht.put(te,ee,{headers:{"Content-Type":"application/octet-stream"}}),ae=re.headers.etag||re.headers.ETag||"",le=typeof ae=="string"?ae.replace(/"/g,""):"";return{value:K.Success,error:null,result:{partNumber:z,etag:le}}}catch(R){return{value:K.UnhandledError,error:R,result:null}}}})}}class QL extends cV{constructor(p,t,n=t.projectId){super(p,X.Editor),this._editor=t,this.id=n}get ready(){return this._editor.ready}get env(){return this._editor.env}get hasLoadedLogic(){return this._editor.hasLoadedLogic}get destroyed(){return this._editor.destroyed}get logicLoadingPromise(){return this._editor.logicLoadingPromise}get logic(){return this._editor.logic}get lastPublishedProjectState(){return this._editor.lastPublishedProjectState}get branchHead(){return this._editor.branchHead}get branchHeadPromise(){return this._editor.branchHeadPromise}get projectId(){return this._editor.projectId}get sessionId(){return this._editor.sessionId}get userAuthorId(){return this._editor.userAuthorId}get peerConnections(){return this._editor.peerConnections}get test(){return this._editor.test}get localTestValues(){return this._editor.localTestValues}get resolvedValues(){return this._editor.resolvedValues}get persistedExecutionResults(){return this._editor.persistedExecutionResults}get publication(){return this._editor.publication}get livePublishedVersions(){return this._editor.livePublishedVersions}get publications(){return this._editor.publications}get liveResources(){return this._editor.liveResources}get execution(){return this._editor.execution}get project(){return this._editor.logic}get lastExecutionResults(){return this._editor.lastExecutionResults}get undoableStackValueIndex(){return this._editor.undoableStackValueIndex}set undoableStackValueIndex(p){this._editor.undoableStackValueIndex=p}get activeWorkspace(){return this._editor.activeWorkspace}get branches(){return this._editor.branches}get roles(){return this._editor.roles}get READ_ONLY(){return this._editor.READ_ONLY}get isViewingNonHead(){return this._editor.isViewingNonHead}get canEdit(){return this._editor.canEdit}get PROJECT_NOTIFICATIONS_CHANNEL(){return this._editor.PROJECT_NOTIFICATIONS_CHANNEL}getAccessToken(){return this._editor.getAccessToken()}getRefreshToken(){return this._editor.getRefreshToken()}removeValueByOwnerId(p){return this._editor.removeValueByOwnerId(p)}removeValue(p){return this._editor.removeValue(p)}undo(){return this._editor.undo()}redo(){return this._editor.redo()}initTest(p,t){return this._editor.initTest(p,t)}removeTest(p){return this._editor.removeTest(p)}async copyEntities(p,t={}){return this._editor.copyEntities(p,t)}resolveInitialChildrenPositions(p,t,n){return this._editor.resolveInitialChildrenPositions(p,t,n)}publish(){return this._editor.publish()}loadGivenPublication(p){return this._editor.loadGivenPublication(p)}validateProjectState(p){return this._editor.validateProjectState(p)}requestActiveDynamicValue(p,t=!1){return this._editor.requestActiveDynamicValue(p,t)}getValueTypePreference(p){return this._editor.getValueTypePreference(p)}setValueTypePreference(p,t){return this._editor.setValueTypePreference(p,t)}implementFeature(p){return this._editor.implementFeature(p)}getProjectRoles(){return this._editor.getProjectRoles()}getLastPublishedVersionLogic(p){return this._editor.getLastPublishedVersionLogic(p)}initialLoads(p){return this._editor.initialLoads(p)}moveBranchHeadToVersion(p,t,n){return this._editor.moveBranchHeadToVersion(p,t,n)}loadInitialBranchHead(){return this._editor.loadInitialBranchHead()}}function FRn(a,p){return p instanceof QL?p:new QL(a,p)}class XL extends cV{constructor(p,t){super(p,X.PublicationRun),this._publicationRun=t}get id(){return this._publicationRun.id}get projectAutoIncrementPublicationCount(){return this._publicationRun.projectAutoIncrementPublicationCount}get projectPublishedSemanticVersion(){return this._publicationRun.projectPublishedSemanticVersion}get envIdentifier(){return this._publicationRun.envIdentifier}get projectVersion(){return this._publicationRun.projectVersion}get projectBranchId(){return this._publicationRun.projectBranchId}get projectId(){return this._publicationRun.projectId}get triggeredBy(){return this._publicationRun.triggeredBy}get createdAt(){return this._publicationRun.createdAt}get updatedAt(){return this._publicationRun.updatedAt}get status(){return this._publicationRun.status}get steps(){return this._publicationRun.steps}get cleanupSteps(){return this._publicationRun.cleanupSteps}get editor(){return this._publicationRun.editor}get explicitResources(){return this._publicationRun.explicitResources}get implicitGlobalResources(){return this._publicationRun.implicitGlobalResources}get finalGlobalEvent(){return this._publicationRun.finalGlobalEvent}get finalStatus(){return this._publicationRun.finalStatus}}function kRn(a,p){return p instanceof XL?p:new XL(a,p)}const zG={spec:{title:"Sales Overview",basicChart:{chartType:"COLUMN",legendPosition:"BOTTOM_LEGEND",axis:[{position:"BOTTOM_AXIS",title:"Categories"},{position:"LEFT_AXIS",title:"Values"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"LEFT_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}},URn={spec:{title:"Revenue Comparison",basicChart:{chartType:"BAR",legendPosition:"BOTTOM_LEGEND",axis:[{position:"LEFT_AXIS",title:"Products"},{position:"BOTTOM_AXIS",title:"Revenue ($)"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"BOTTOM_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}},KRn={spec:{title:"Monthly Performance Trend",basicChart:{chartType:"LINE",legendPosition:"RIGHT_LEGEND",interpolateNulls:!0,axis:[{position:"BOTTOM_AXIS",title:"Month"},{position:"LEFT_AXIS",title:"Active Users"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:12,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:12,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"LEFT_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}},jRn={spec:{title:"Traffic Channels Distribution",basicChart:{chartType:"AREA",legendPosition:"TOP_LEGEND",stackedType:"STACKED",axis:[{position:"BOTTOM_AXIS",title:"Quarter"},{position:"LEFT_AXIS",title:"Visits"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:4,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:4,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"LEFT_AXIS"},{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:4,startColumnIndex:2,endColumnIndex:3}]}},targetAxis:"LEFT_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}},qRn={spec:{title:"Market Share Breakdown",pieChart:{legendPosition:"RIGHT_LEGEND",threeDimensional:!1,pieHole:0,domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:0,endColumnIndex:1}]}},series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:1,endColumnIndex:2}]}}}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:500,heightPixels:350}}},ZRn={spec:{title:"Budget Allocation",pieChart:{legendPosition:"BOTTOM_LEGEND",threeDimensional:!1,pieHole:.4,domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:6,startColumnIndex:0,endColumnIndex:1}]}},series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:6,startColumnIndex:1,endColumnIndex:2}]}}}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:500,heightPixels:350}}},HRn={spec:{title:"Quarterly Revenue KPI",scorecardChart:{keyValueData:{sourceRange:{sources:[{sheetId:0,startRowIndex:1,endRowIndex:2,startColumnIndex:1,endColumnIndex:2}]}},baselineValueData:{sourceRange:{sources:[{sheetId:0,startRowIndex:2,endRowIndex:3,startColumnIndex:1,endColumnIndex:2}]}}}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:400,heightPixels:250}}},WRn={spec:{title:"Regional Sales (3D)",basicChart:{chartType:"BAR",legendPosition:"RIGHT_LEGEND",headerCount:1,threeDimensional:!0,axis:[{position:"LEFT_AXIS",title:"Region"},{position:"BOTTOM_AXIS",title:"Units Sold"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"BOTTOM_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}};class zRn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][Q.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:[X.Editor,X.Logic]});C(this,"module",{getOptions:async t=>[{key:"column-chart",label:"Column Chart",disabledReasons:[],hidden:!1},{key:"bar-chart",label:"Bar Chart",disabledReasons:[],hidden:!1},{key:"line-chart",label:"Line Chart",disabledReasons:[],hidden:!1},{key:"area-chart",label:"Stacked Area Chart",disabledReasons:[],hidden:!1},{key:"pie-chart",label:"Pie Chart",disabledReasons:[],hidden:!1},{key:"donut-chart",label:"Donut Chart",disabledReasons:[],hidden:!1},{key:"scorecard-chart",label:"Scorecard KPI Chart",disabledReasons:[],hidden:!1},{key:"3d-bar-chart",label:"3D Bar Chart",disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{const s=n==null?void 0:n.valueKey;if(!s)return{value:zG};switch(s){case"column-chart":case"basic-chart":return{value:zG};case"bar-chart":return{value:URn};case"line-chart":return{value:KRn};case"area-chart":return{value:jRn};case"pie-chart":return{value:qRn};case"donut-chart":return{value:ZRn};case"scorecard-chart":return{value:HRn};case"3d-bar-chart":case"3d-column-chart":return{value:WRn}}return{value:zG}}})}}const YG={spec:{title:"Sales Overview",basicChart:{chartType:"COLUMN",legendPosition:"BOTTOM_LEGEND",axis:[{position:"BOTTOM_AXIS",title:"Categories"},{position:"LEFT_AXIS",title:"Values"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"LEFT_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}},YRn={spec:{title:"Revenue Comparison",basicChart:{chartType:"BAR",legendPosition:"BOTTOM_LEGEND",axis:[{position:"LEFT_AXIS",title:"Products"},{position:"BOTTOM_AXIS",title:"Revenue ($)"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"BOTTOM_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}},JRn={spec:{title:"Monthly Performance Trend",basicChart:{chartType:"LINE",legendPosition:"RIGHT_LEGEND",interpolateNulls:!0,axis:[{position:"BOTTOM_AXIS",title:"Month"},{position:"LEFT_AXIS",title:"Active Users"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:12,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:12,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"LEFT_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}},QRn={spec:{title:"Traffic Channels Distribution",basicChart:{chartType:"AREA",legendPosition:"TOP_LEGEND",stackedType:"STACKED",axis:[{position:"BOTTOM_AXIS",title:"Quarter"},{position:"LEFT_AXIS",title:"Visits"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:4,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:4,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"LEFT_AXIS"},{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:4,startColumnIndex:2,endColumnIndex:3}]}},targetAxis:"LEFT_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}},XRn={spec:{title:"Market Share Breakdown",pieChart:{legendPosition:"RIGHT_LEGEND",threeDimensional:!1,pieHole:0,domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:0,endColumnIndex:1}]}},series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:1,endColumnIndex:2}]}}}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:500,heightPixels:350}}},eAn={spec:{title:"Budget Allocation",pieChart:{legendPosition:"BOTTOM_LEGEND",threeDimensional:!1,pieHole:.4,domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:6,startColumnIndex:0,endColumnIndex:1}]}},series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:6,startColumnIndex:1,endColumnIndex:2}]}}}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:500,heightPixels:350}}},tAn={spec:{title:"Quarterly Revenue KPI",scorecardChart:{keyValueData:{sourceRange:{sources:[{sheetId:0,startRowIndex:1,endRowIndex:2,startColumnIndex:1,endColumnIndex:2}]}},baselineValueData:{sourceRange:{sources:[{sheetId:0,startRowIndex:2,endRowIndex:3,startColumnIndex:1,endColumnIndex:2}]}}}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:400,heightPixels:250}}},iAn={spec:{title:"Regional Sales (3D)",basicChart:{chartType:"BAR",legendPosition:"RIGHT_LEGEND",headerCount:1,threeDimensional:!0,axis:[{position:"LEFT_AXIS",title:"Region"},{position:"BOTTOM_AXIS",title:"Units Sold"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"BOTTOM_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}};class nAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][Q.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:[X.Editor,X.Logic]});C(this,"module",{getOptions:async t=>[{key:"column-chart",label:"Column Chart",disabledReasons:[],hidden:!1},{key:"bar-chart",label:"Bar Chart",disabledReasons:[],hidden:!1},{key:"line-chart",label:"Line Chart",disabledReasons:[],hidden:!1},{key:"area-chart",label:"Stacked Area Chart",disabledReasons:[],hidden:!1},{key:"pie-chart",label:"Pie Chart",disabledReasons:[],hidden:!1},{key:"donut-chart",label:"Donut Chart",disabledReasons:[],hidden:!1},{key:"scorecard-chart",label:"Scorecard KPI Chart",disabledReasons:[],hidden:!1},{key:"3d-bar-chart",label:"3D Bar Chart",disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{const s=n==null?void 0:n.valueKey;if(!s)return{value:YG};switch(s){case"column-chart":case"basic-chart":return{value:YG};case"bar-chart":return{value:YRn};case"line-chart":return{value:JRn};case"area-chart":return{value:QRn};case"pie-chart":return{value:XRn};case"donut-chart":return{value:eAn};case"scorecard-chart":return{value:tAn};case"3d-bar-chart":case"3d-column-chart":return{value:iAn}}return{value:YG}}})}}const rAn="Sheet2!A1",aAn='"Copy of Blahhh"!A1';class sAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][Q.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:[X.Editor,X.Logic]});C(this,"module",{getOptions:async t=>[{key:"sheet2-a1",label:"Sheet2!A1",disabledReasons:[],hidden:!1},{key:"copy-of-blahhh-a1",label:'"Copy of Blahhh"!A1',disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{switch(n==null?void 0:n.valueKey){case"copy-of-blahhh-a1":return{value:aAn};case"sheet2-a1":default:return{value:rAn}}}})}}const lAn="Sheet1!A1:D100",oAn="Sheet1!A1:G500";class dAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][Q.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:[X.Editor,X.Logic]});C(this,"module",{getOptions:async t=>[{key:"sales-data",label:"Sales Data Range (Sheet1!A1:D100)",disabledReasons:[],hidden:!1},{key:"financial-data",label:"Financial Data Range (Sheet1!A1:G500)",disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{switch(n==null?void 0:n.valueKey){case"financial-data":return{value:oAn};case"sales-data":default:return{value:lAn}}}})}}const pAn=[{sourceColumnOffset:0,sortOrder:"ASCENDING",showTotals:!0}],uAn=[{sourceColumnOffset:0,sortOrder:"ASCENDING",showTotals:!0},{sourceColumnOffset:1,sortOrder:"ASCENDING",showTotals:!0}];class cAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][Q.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:[X.Editor,X.Logic]});C(this,"module",{getOptions:async t=>[{key:"single-row-group",label:"Group by First Column (Column 0)",disabledReasons:[],hidden:!1},{key:"multi-row-group",label:"Group by First & Second Columns (Columns 0 & 1)",disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{switch(n==null?void 0:n.valueKey){case"multi-row-group":return{value:uAn};case"single-row-group":default:return{value:pAn}}}})}}const fAn=[{sourceColumnOffset:1,sortOrder:"ASCENDING",showTotals:!0}],yAn=[{sourceColumnOffset:1,sortOrder:"ASCENDING",showTotals:!0},{sourceColumnOffset:2,sortOrder:"ASCENDING",showTotals:!0}];class hAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][Q.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:[X.Editor,X.Logic]});C(this,"module",{getOptions:async t=>[{key:"single-column-group",label:"Group by Second Column (Column 1)",disabledReasons:[],hidden:!1},{key:"multi-column-group",label:"Group by Second & Third Columns (Columns 1 & 2)",disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{switch(n==null?void 0:n.valueKey){case"multi-column-group":return{value:yAn};case"single-column-group":default:return{value:fAn}}}})}}const mAn=[{sourceColumnOffset:3,summarizeFunction:"SUM",name:"Total Revenue"}],TAn=[{sourceColumnOffset:2,summarizeFunction:"COUNTA",name:"Total Orders"},{sourceColumnOffset:3,summarizeFunction:"SUM",name:"Total Revenue"}],vAn=[{sourceColumnOffset:4,summarizeFunction:"AVERAGE",name:"Average Profit"}];class gAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][Q.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:[X.Editor,X.Logic]});C(this,"module",{getOptions:async t=>[{key:"sum-revenue",label:"SUM Revenue (Column 3)",disabledReasons:[],hidden:!1},{key:"sum-and-count",label:"COUNTA Orders (Col 2) & SUM Revenue (Col 3)",disabledReasons:[],hidden:!1},{key:"average-profit",label:"AVERAGE Profit (Column 4)",disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{switch(n==null?void 0:n.valueKey){case"sum-and-count":return{value:TAn};case"average-profit":return{value:vAn};case"sum-revenue":default:return{value:mAn}}}})}}const bAn="Sheet2!A1",EAn='"Copy of Blahhh"!A1';class IAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][Q.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:[X.Editor,X.Logic]});C(this,"module",{getOptions:async t=>[{key:"sheet2-a1",label:"Sheet2!A1",disabledReasons:[],hidden:!1},{key:"copy-of-blahhh-a1",label:'"Copy of Blahhh"!A1',disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{switch(n==null?void 0:n.valueKey){case"copy-of-blahhh-a1":return{value:EAn};case"sheet2-a1":default:return{value:bAn}}}})}}const O5={"Number greater than":"NUMBER_GREATER","Number greater than or equal":"NUMBER_GREATER_THAN_EQ","Number less than":"NUMBER_LESS","Number less than or equal":"NUMBER_LESS_THAN_EQ","Number equal to":"NUMBER_EQ","Number not equal to":"NUMBER_NOT_EQ","Number between":"NUMBER_BETWEEN","Number not between":"NUMBER_NOT_BETWEEN","Text contains":"TEXT_CONTAINS","Text does not contain":"TEXT_NOT_CONTAINS","Text starts with":"TEXT_STARTS_WITH","Text ends with":"TEXT_ENDS_WITH","Text equals":"TEXT_EQ","Date is":"DATE_EQ","Date is before":"DATE_BEFORE","Date is after":"DATE_AFTER","Date is on or before":"DATE_ON_OR_BEFORE","Date is on or after":"DATE_ON_OR_AFTER","Cell is empty":"BLANK","Cell is not empty":"NOT_BLANK","Custom formula":"CUSTOM_FORMULA"};function aDt(a){if(!a||typeof a!="string")return null;const p=a.trim();return p?O5[p]?O5[p]:p.toUpperCase().replace(/\s+/g,"_"):null}function sDt(a,p,t,n){if(p==null)return;let s=[];if(Array.isArray(p))s=p;else if(typeof p=="string"){const e=p.trim();if(!e)return;if(e.startsWith("["))try{const f=JSON.parse(e);Array.isArray(f)?s=f:s=[e]}catch{s=[e]}else s=[e]}const u=aDt(a);if(u==="BLANK"||u==="NOT_BLANK"){s.length>0&&n.push(new ht({id:`${t.id}--${uo.ConditionValuesNoValuesRequired}`,message:`Condition "${a}" does not require any condition values.`,severity:Ie.Error,code:uo.ConditionValuesNoValuesRequired,entity:t}));return}if(u==="CUSTOM_FORMULA"){if(s.length===0)n.push(new ht({id:`${t.id}--${uo.ConditionValuesInvalidFormula}`,message:'Custom formula condition requires a formula string starting with "=" (e.g. ["=A1>100"]).',severity:Ie.Error,code:uo.ConditionValuesInvalidFormula,entity:t}));else for(const e of s){const f=String(e).trim();f.startsWith("=")||n.push(new ht({id:`${t.id}--${uo.ConditionValuesInvalidFormula}`,message:`Custom formula "${f}" must start with "=".`,severity:Ie.Error,code:uo.ConditionValuesInvalidFormula,entity:t}))}return}if(u==="NUMBER_BETWEEN"||u==="NUMBER_NOT_BETWEEN"){s.length!==2&&n.push(new ht({id:`${t.id}--${uo.ConditionValuesTwoNumbersRequired}`,message:`Condition "${a}" requires exactly 2 values (min and max, e.g. ["1", "100"]).`,severity:Ie.Error,code:uo.ConditionValuesTwoNumbersRequired,entity:t}));return}if(u==="NUMBER_GREATER"||u==="NUMBER_GREATER_THAN_EQ"||u==="NUMBER_LESS"||u==="NUMBER_LESS_THAN_EQ"||u==="NUMBER_EQ"||u==="NUMBER_NOT_EQ"){s.length!==1&&n.push(new ht({id:`${t.id}--${uo.ConditionValuesSingleNumberRequired}`,message:`Condition "${a}" requires exactly 1 threshold value (e.g. ["100"]).`,severity:Ie.Error,code:uo.ConditionValuesSingleNumberRequired,entity:t}));return}if(u==="TEXT_CONTAINS"||u==="TEXT_NOT_CONTAINS"||u==="TEXT_STARTS_WITH"||u==="TEXT_ENDS_WITH"||u==="TEXT_EQ"){s.length!==1&&n.push(new ht({id:`${t.id}--${uo.ConditionValuesSingleTextRequired}`,message:`Condition "${a}" requires exactly 1 text string value (e.g. ["Approved"]).`,severity:Ie.Error,code:uo.ConditionValuesSingleTextRequired,entity:t}));return}}const yw={num_100:["100"],num_0:["0"],num_1000:["1000"],between_1_100:["1","100"],between_0_50:["0","50"],between_50_100:["50","100"],text_approved:["Approved"],text_pending:["Pending"],text_rejected:["Rejected"],text_urgent:["Urgent"],date_2026_01_01:["2026-01-01"],date_today:["2026-08-08"],formula_above_avg:["=A1>AVERAGE($A$1:$A$100)"],formula_even:["=ISEVEN(A1)"],formula_duplicates:["=COUNTIF($A$1:$A$100, A1)>1"],default_100:["100"],default_approved:["Approved"],default_formula:["=A1>0"]};function M4(a){const p=aDt(a),t=(n,s)=>({key:n,label:s,disabledReasons:[],hidden:!1});return p==="NUMBER_GREATER"||p==="NUMBER_GREATER_THAN_EQ"||p==="NUMBER_LESS"||p==="NUMBER_LESS_THAN_EQ"||p==="NUMBER_EQ"||p==="NUMBER_NOT_EQ"?[t("num_100","100 (Single threshold)"),t("num_0","0 (Zero threshold)"),t("num_1000","1000 (High threshold)")]:p==="NUMBER_BETWEEN"||p==="NUMBER_NOT_BETWEEN"?[t("between_1_100","Between 1 and 100"),t("between_0_50","Between 0 and 50"),t("between_50_100","Between 50 and 100")]:p==="TEXT_CONTAINS"||p==="TEXT_NOT_CONTAINS"||p==="TEXT_STARTS_WITH"||p==="TEXT_ENDS_WITH"||p==="TEXT_EQ"?[t("text_approved","Approved"),t("text_pending","Pending"),t("text_rejected","Rejected"),t("text_urgent","Urgent")]:p==="DATE_EQ"||p==="DATE_BEFORE"||p==="DATE_AFTER"||p==="DATE_ON_OR_BEFORE"||p==="DATE_ON_OR_AFTER"?[t("date_2026_01_01","Start of 2026 (2026-01-01)"),t("date_today","Current Date (2026-08-08)")]:p==="CUSTOM_FORMULA"?[t("formula_above_avg","Greater than average (=A1>AVERAGE($A$1:$A$100))"),t("formula_even","Even numbers (=ISEVEN(A1))"),t("formula_duplicates","Highlight duplicates (=COUNTIF($A$1:$A$100, A1)>1)")]:p==="BLANK"||p==="NOT_BLANK"?[]:[t("default_100","100"),t("default_approved","Approved"),t("default_formula","Formula (=A1>0)")]}function lDt(a,p){const t=p==null?void 0:p.valueKey;if(t&&yw[t])return{value:yw[t]};const n=M4(a);if(n.length>0){const s=n[0].key;if(yw[s])return{value:yw[s]}}return{value:["100"]}}function x5(a){var u,e;const p=(u=G[r.Operation])==null?void 0:u[Q.GoogleSheetsAddConditionalFormatRule];if(!p)return null;const t=a.parent;if(!t)return null;const s=(t.inputs||t.outputs||[]).find(f=>{var y;return((y=f.declaration)==null?void 0:y.id)===p.inputs.conditionType.id||f.id===p.inputs.conditionType.id});return((e=s==null?void 0:s.defaultValue)==null?void 0:e.value)??null}class RAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][Q.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:[X.Editor,X.Logic]});C(this,"module",{getOptions:async t=>{const n=x5(t);return M4(n)},getValue:async(t,n)=>{const s=x5(t);return lDt(s,n)}})}}function P5(a){var u,e;const p=(u=G[r.Operation])==null?void 0:u[Q.GoogleSheetsUpdateConditionalFormatRule];if(!p)return null;const t=a.parent;if(!t)return null;const s=(t.inputs||t.outputs||[]).find(f=>{var y;return((y=f.declaration)==null?void 0:y.id)===p.inputs.conditionType.id||f.id===p.inputs.conditionType.id});return((e=s==null?void 0:s.defaultValue)==null?void 0:e.value)??null}class AAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][Q.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:[X.Editor,X.Logic]});C(this,"module",{getOptions:async t=>{const n=P5(t);return M4(n)},getValue:async(t,n)=>{const s=P5(t);return lDt(s,n)}})}}const RV=[["Name","Age","Is Active","Notes"],["Alice",30,!0,"New user"],["Bob",25,!1,null],["Charlie",null,!0,"No age provided"]],Mp="1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms",CE={sheetId:0,startRowIndex:0,endRowIndex:10,startColumnIndex:0,endColumnIndex:5},DAn=["Sheet1!A1:B10","Sheet2!C1:D5"],CAn=["Option 1","Option 2","Option 3"],wAn=[{updateSpreadsheetProperties:{properties:{title:"My Renamed Spreadsheet",locale:"en_US",timeZone:"America/New_York"},fields:"title,locale,timeZone"}},{addSheet:{properties:{title:"New Custom Sheet",gridProperties:{rowCount:100,columnCount:20}}}},{mergeCells:{range:{sheetId:0,startRowIndex:0,endRowIndex:2,startColumnIndex:0,endColumnIndex:4},mergeType:"MERGE_ALL"}},{repeatCell:{range:{sheetId:0,startRowIndex:0,endRowIndex:1,startColumnIndex:0,endColumnIndex:5},cell:{userEnteredFormat:{backgroundColor:{red:.2,green:.4,blue:.8},textFormat:{bold:!0,foregroundColor:{red:1,green:1,blue:1}}}},fields:"userEnteredFormat(backgroundColor,textFormat)"}},{findReplace:{find:"Old Value",replacement:"New Value",allSheets:!0,matchCase:!1}}],OAn=[["Date","Product","Revenue ($)","Units Sold"],["2026-01-15","Pro Subscription",299,1],["2026-01-16","Enterprise Add-On",1250.5,2]],xAn=[["Alice Smith","alice@example.com","Engineer","Active"]],PAn=[[null]];class VAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][Q.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:[X.Editor,X.Logic]});C(this,"module",{getOptions:async t=>[{key:"sample-users",label:"Sample User Directory (3 Rows, 4 Columns)",disabledReasons:[],hidden:!1},{key:"sales-report",label:"Sales Report (2 Rows, 4 Columns)",disabledReasons:[],hidden:!1},{key:"single-row",label:"Single Row Entry (1 Row, 4 Columns)",disabledReasons:[],hidden:!1},{key:"empty-grid",label:"Empty Placeholder (1 Row, 1 Column)",disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{switch(n==null?void 0:n.valueKey){case"sales-report":return{value:OAn};case"single-row":return{value:xAn};case"empty-grid":return{value:PAn};case"sample-users":default:return{value:RV}}}})}}const NAn=[["Date","Product","Revenue ($)","Units Sold"],["2026-01-15","Pro Subscription",299,1],["2026-01-16","Enterprise Add-On",1250.5,2]],_An=[["Alice Smith","alice@example.com","Engineer","Active"]],$An=[[null]];class GAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][Q.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:[X.Editor,X.Logic]});C(this,"module",{getOptions:async t=>[{key:"sample-users",label:"Sample User Directory (3 Rows, 4 Columns)",disabledReasons:[],hidden:!1},{key:"sales-report",label:"Sales Report (2 Rows, 4 Columns)",disabledReasons:[],hidden:!1},{key:"single-row",label:"Single Row Entry (1 Row, 4 Columns)",disabledReasons:[],hidden:!1},{key:"empty-grid",label:"Empty Placeholder (1 Row, 1 Column)",disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{switch(n==null?void 0:n.valueKey){case"sales-report":return{value:NAn};case"single-row":return{value:_An};case"empty-grid":return{value:$An};case"sample-users":default:return{value:RV}}}})}}function LAn(a){a.register(new fTt(a)),a.register(new cTt(a)),a.register(new oTt(a)),a.register(new pTt(a)),a.register(new uTt(a)),a.register(new dTt(a)),a.register(new HEt(a)),a.register(new WEt(a)),a.register(new zEt(a)),a.register(new JEt(a)),a.register(new YEt(a)),a.register(new QEt(a)),a.register(new SRt(a)),a.register(new MRt(a)),a.register(new FRt(a)),a.register(new kRt(a)),a.register(new URt(a)),a.register(new KRt(a)),a.register(new jRt(a)),a.register(new qRt(a)),a.register(new ZRt(a)),a.register(new HRt(a)),a.register(new Zbt(a)),a.register(new Hbt(a)),a.register(new Wbt(a)),a.register(new zbt(a)),a.register(new Ybt(a)),a.register(new Jbt(a)),a.register(new Qbt(a)),a.register(new Xbt(a)),a.register(new eEt(a)),a.register(new tEt(a)),a.register(new iEt(a)),a.register(new nEt(a)),a.register(new rEt(a)),a.register(new aEt(a)),a.register(new sEt(a)),a.register(new lEt(a)),a.register(new oEt(a)),a.register(new dEt(a)),a.register(new pEt(a)),a.register(new fEt(a)),a.register(new yEt(a)),a.register(new hEt(a)),a.register(new cbt(a)),a.register(new fbt(a)),a.register(new ybt(a)),a.register(new hbt(a)),a.register(new mbt(a)),a.register(new Tbt(a)),a.register(new vbt(a)),a.register(new gbt(a)),a.register(new bbt(a)),a.register(new Ibt(a)),a.register(new Rbt(a)),a.register(new Abt(a)),a.register(new Dbt(a)),a.register(new Cbt(a)),a.register(new Vgt(a)),a.register(new iRt(a)),a.register(new eRt(a)),a.register(new tRt(a)),a.register(new Pvt(a)),a.register(new Vvt(a)),a.register(new Nvt(a)),a.register(new _vt(a)),a.register(new $vt(a)),a.register(new Gvt(a)),a.register(new Lvt(a)),a.register(new Bvt(a)),a.register(new Svt(a)),a.register(new Jvt(a)),a.register(new Ogt(a)),a.register(new xgt(a)),a.register(new Pgt(a)),a.register(new Mvt(a)),a.register(new Fvt(a)),a.register(new kvt(a)),a.register(new Uvt(a)),a.register(new Kvt(a)),a.register(new jvt(a)),a.register(new qvt(a)),a.register(new Zvt(a)),a.register(new Hvt(a)),a.register(new Wvt(a)),a.register(new zvt(a)),a.register(new Yvt(a)),a.register(new Qvt(a)),a.register(new Xvt(a)),a.register(new egt(a)),a.register(new tgt(a)),a.register(new igt(a)),a.register(new ngt(a)),a.register(new rgt(a)),a.register(new agt(a)),a.register(new sgt(a)),a.register(new lgt(a)),a.register(new ogt(a)),a.register(new dgt(a)),a.register(new vgt(a)),a.register(new ggt(a)),a.register(new bgt(a)),a.register(new pgt(a)),a.register(new ugt(a)),a.register(new cgt(a)),a.register(new fgt(a)),a.register(new ygt(a)),a.register(new hgt(a)),a.register(new mgt(a)),a.register(new Tgt(a)),a.register(new sRt(a)),a.register(new lRt(a)),a.register(new oRt(a)),a.register(new dRt(a)),a.register(new nRt(a)),a.register(new rRt(a)),a.register(new aRt(a)),a.register(new pRt(a)),a.register(new cRt(a)),a.register(new yRt(a)),a.register(new uRt(a)),a.register(new fRt(a)),a.register(new hRt(a)),a.register(new vRt(a)),a.register(new mRt(a)),a.register(new TRt(a)),a.register(new wbt(a)),a.register(new Vbt(a)),a.register(new Nbt(a)),a.register(new Gbt(a)),a.register(new Lbt(a)),a.register(new Bbt(a)),a.register(new Sbt(a)),a.register(new Mbt(a)),a.register(new Fbt(a)),a.register(new kbt(a)),a.register(new Ubt(a)),a.register(new _bt(a)),a.register(new $bt(a)),a.register(new U1t(a)),a.register(new K1t(a)),a.register(new j1t(a)),a.register(new q1t(a)),a.register(new Z1t(a)),a.register(new H1t(a)),a.register(new W1t(a)),a.register(new z1t(a)),a.register(new Y1t(a)),a.register(new J1t(a)),a.register(new Q1t(a)),a.register(new X1t(a)),a.register(new eDt(a)),a.register(new tDt(a)),a.register(new iDt(a)),a.register(new nDt(a)),a.register(new rDt(a)),a.register(new xbt(a)),a.register(new Pbt(a)),a.register(new Obt(a)),a.register(new Ebt(a)),a.register(new jbt(a)),a.register(new qbt(a)),a.register(new Kbt(a)),a.register(new eIt(a)),a.register(new AIt(a)),a.register(new RIt(a)),a.register(new DIt(a)),a.register(new CIt(a)),a.register(new nIt(a)),a.register(new rIt(a)),a.register(new pIt(a)),a.register(new oIt(a)),a.register(new EIt(a)),a.register(new hIt(a)),a.register(new TIt(a)),a.register(new gIt(a)),a.register(new vIt(a)),a.register(new dIt(a)),a.register(new cIt(a)),a.register(new fIt(a)),a.register(new uIt(a)),a.register(new XEt(a)),a.register(new aIt(a)),a.register(new mIt(a)),a.register(new xIt(a)),a.register(new KL(a)),a.register(new iIt(a)),a.register(new sIt(a)),a.register(new tIt(a)),a.register(new bIt(a)),a.register(new lIt(a)),a.register(new yIt(a)),a.register(new IIt(a)),a.register(new OIt(a)),a.register(new wIt(a)),a.register(new PIt(a)),a.register(new KL(a)),a.register(new NIt(a)),a.register(new VIt(a)),a.register(new _It(a)),a.register(new PEt(a)),a.register(new VEt(a)),a.register(new NEt(a)),a.register(new TEt(a)),a.register(new cEt(a)),a.register(new EEt(a)),a.register(new DEt(a)),a.register(new uEt(a)),a.register(new CEt(a)),a.register(new xEt(a)),a.register(new REt(a)),a.register(new IEt(a)),a.register(new Xw(a)),a.register(new _Et(a)),a.register(new $Et(a)),a.register(new AEt(a)),a.register(new OEt(a)),a.register(new wEt(a)),a.register(new bEt(a)),a.register(new gEt(a)),a.register(new vEt(a)),a.register(new mEt(a)),a.register(new BEt(a)),a.register(new LEt(a)),a.register(new SEt(a)),a.register(new GEt(a)),a.register(new Agt(a)),a.register(new Egt(a)),a.register(new Rgt(a)),a.register(new Dgt(a)),a.register(new Cgt(a)),a.register(new Igt(a)),a.register(new wgt(a)),a.register(new YRt(a)),a.register(new iAt(a)),a.register(new rAt(a)),a.register(new sAt(a)),a.register(new lAt(a)),a.register(new oAt(a)),a.register(new dAt(a)),a.register(new tAt(a)),a.register(new nAt(a)),a.register(new aAt(a)),a.register(new eAt(a)),a.register(new XRt(a)),a.register(new QRt(a)),a.register(new JRt(a)),a.register(new WRt(a)),a.register(new zRt(a)),a.register(new yAt(a)),a.register(new hAt(a)),a.register(new cAt(a)),a.register(new fAt(a)),a.register(new BRt(a)),a.register(new pAt(a)),a.register(new uAt(a)),a.register(new TAt(a)),a.register(new mAt(a)),a.register(new vAt(a)),a.register(new gAt(a)),a.register(new bAt(a)),a.register(new yTt(a)),a.register(new hTt(a)),a.register(new Jw(a)),a.register(new Qw(a)),a.register(new DAt(a)),a.register(new CAt(a)),a.register(new xAt(a)),a.register(new FAt(a)),a.register(new VAt(a)),a.register(new wAt(a)),a.register(new OAt(a)),a.register(new NAt(a)),a.register(new PAt(a)),a.register(new _At(a)),a.register(new $At(a)),a.register(new GAt(a)),a.register(new LAt(a)),a.register(new BAt(a)),a.register(new SAt(a)),a.register(new MAt(a)),a.register(new kAt(a)),a.register(new KAt(a)),a.register(new jAt(a)),a.register(new qAt(a)),a.register(new ZAt(a)),a.register(new HAt(a)),a.register(new WAt(a)),a.register(new zAt(a)),a.register(new k1t(a)),a.register(new YAt(a)),a.register(new JAt(a)),a.register(new c1t(a)),a.register(new QAt(a)),a.register(new XAt(a)),a.register(new e1t(a)),a.register(new t1t(a)),a.register(new i1t(a)),a.register(new n1t(a)),a.register(new r1t(a)),a.register(new a1t(a)),a.register(new s1t(a)),a.register(new o1t(a)),a.register(new d1t(a)),a.register(new p1t(a)),a.register(new u1t(a)),a.register(new f1t(a)),a.register(new F1t(a)),a.register(new h1t(a)),a.register(new A1t(a)),a.register(new b1t(a)),a.register(new E1t(a)),a.register(new g1t(a)),a.register(new w1t(a)),a.register(new y1t(a)),a.register(new m1t(a)),a.register(new O1t(a)),a.register(new C1t(a)),a.register(new P1t(a)),a.register(new V1t(a)),a.register(new N1t(a)),a.register(new _1t(a)),a.register(new $1t(a)),a.register(new G1t(a)),a.register(new L1t(a)),a.register(new B1t(a)),a.register(new S1t(a)),a.register(new M1t(a)),a.register(new v1t(a)),a.register(new T1t(a)),a.register(new I1t(a)),a.register(new x1t(a)),a.register(new D1t(a)),a.register(new R1t(a)),a.register(new EAt(a)),a.register(new IAt(a)),a.register(new zRn(a)),a.register(new nAn(a)),a.register(new sAn(a)),a.register(new dAn(a)),a.register(new cAn(a)),a.register(new hAn(a)),a.register(new gAn(a)),a.register(new IAn(a)),a.register(new RAn(a)),a.register(new AAn(a)),a.register(new VAn(a)),a.register(new GAn(a))}class F4{constructor(p=new pe.Events("extensions-registry-fallback-events")){C(this,"extensionsRegistry",new Map);C(this,"initialized",new Set);C(this,"initializedContexts",new Set);C(this,"onResolveEditorContextCallback",()=>null);C(this,"onResolveProjectLogicContextCallback",()=>null);C(this,"onResolveEditorGUIContextCallback",()=>null);C(this,"onResolveGUIContextCallback",()=>null);C(this,"onResolveCompileContextCallback",()=>null);C(this,"onResolvePublicationRunContextCallback",()=>null);this.events=p,this.off=this.events.off.bind(this.events),this.on=this.events.on.bind(this.events),this.emit=this.events.emit.bind(this.events),this.emitAsync=this.events.emitAsync.bind(this.events),this.emitAsyncAll=this.events.emitAsyncAll.bind(this.events),this.emitAsyncAllSettled=this.events.emitAsyncAllSettled.bind(this.events),this.emitAsyncSequentially=this.events.emitAsyncSequentially.bind(this.events),this.emitAsyncSequentiallyAll=this.events.emitAsyncSequentiallyAll.bind(this.events),this.emitAsyncSequentiallyAllSettled=this.events.emitAsyncSequentiallyAllSettled.bind(this.events)}onResolveEditorContext(p){this.onResolveEditorContextCallback=p}onResolveProjectLogicContext(p){this.onResolveProjectLogicContextCallback=p}onResolveGUIContext(p){this.onResolveGUIContextCallback=p}onResolveEditorGUIContext(p){this.onResolveEditorGUIContextCallback=p}onResolveCompileContext(p){this.onResolveCompileContextCallback=p}onResolvePublicationRunContext(p){this.onResolvePublicationRunContextCallback=p}get extensionInOrder(){return Array.from(this.extensionsRegistry.values()).sort((p,t)=>(p.manifest.initPriority||_e.Normal)-(t.manifest.initPriority||_e.Normal))}async setup(){LAn(this),pe.Logger.log("Initializing extensions without context..."),this.initForReady()}requestContext(p){switch(p){case X.Editor:return this.onResolveEditorContextCallback();case X.Logic:return this.onResolveProjectLogicContextCallback();case X.EditorGUI:return this.onResolveEditorGUIContextCallback();case X.Compile:return this.onResolveCompileContextCallback();case X.PublicationRun:return this.onResolvePublicationRunContextCallback();case X.GUI:return this.onResolveGUIContextCallback();case X.EditorGUI:return this.onResolveEditorGUIContextCallback();default:throw new Error(`Unknown context type: ${p}`)}}requestContexts(p,t=[]){const n=[];t.length===0&&(t=p.manifest.contexts);for(const s of t){const u=this.requestContext(s);u&&n.push(u)}return n}requestExtension(p){const t=this.extensionsRegistry.get(p);if(t)return t;throw new Error(`Unknown extension: ${p}`)}register(p){this.extensionsRegistry.set(p.manifest.id,p)}async initAll(){for(const p of this.extensionInOrder){if(this.initialized.has(p.manifest.id))continue;const t=this.requestContexts(p);p.manifest.contexts.every(s=>!!t.find(u=>u.contextType===s))&&(p.module.init&&await p.module.init(t),this.initialized.add(p.manifest.id))}}async initForReady(){pe.Logger.log("Initializing extensions for ready contexts...");for(const p of this.extensionInOrder){if(this.initialized.has(p.manifest.id))continue;const t=this.requestContexts(p);p.manifest.contexts.every(s=>!!t.find(u=>u.contextType===s))?(p.module.init?(pe.Logger.debug("Initializing "+p.manifest.id+" extension..."),await p.module.init(t)):pe.Logger.log("Set "+p.manifest.id+" extension as ready (no init method)..."),this.initialized.add(p.manifest.id)):pe.Logger.warn(`Skipping initialization of ${p.manifest.id} extension, not all contexts are ready.`,`Required contexts: ${p.manifest.contexts.join(", ")}`,`Available contexts: ${t.map(s=>s.contextType).join(", ")}`)}}async destroyAll(){for(const p of[...this.extensionInOrder].reverse())p.module.destroy&&await p.module.destroy();this.events.destroy()}on(p,t){this.events.on(p,t)}emit(p,...t){this.events.emit(p,...t)}off(p,t){this.events.off(p,t)}emitAsync(p,...t){return this.events.emitAsync(p,...t)}emitAsyncAll(p,...t){return this.events.emitAsyncAll(p,...t)}emitAsyncAllSettled(p,...t){return this.events.emitAsyncAllSettled(p,...t)}emitAsyncSequentially(p,...t){return this.events.emitAsyncSequentially(p,...t)}emitAsyncSequentiallyAll(p,...t){return this.events.emitAsyncSequentiallyAll(p,...t)}emitAsyncSequentiallyAllSettled(p,...t){return this.events.emitAsyncSequentiallyAllSettled(p,...t)}async contextAvailable(p){if(this.initializedContexts.has(p)){pe.Logger.warn(`Context ${p} is already initialized. Skipping re-initialization.`);return}switch(this.initializedContexts.add(p),p){case X.Editor:{if(!this.onResolveEditorContextCallback)throw new Error("No editor context resolver callback set. Call onResolveEditorContext first.");break}case X.Logic:{if(!this.onResolveProjectLogicContextCallback)throw new Error("No project logic context resolver callback set. Call onResolveProjectLogicContext first.");break}}pe.Logger.log(`Context ${p} is now available. Initializing extensions for this context...`),await this.initForReady()}getValueTypePreference(p){return window.localStorage.getItem("dynamic-value-type-preference--"+p)||null}setValueTypePreference(p,t){window.localStorage.setItem("dynamic-value-type-preference--"+p,(t==null?void 0:t.toString())||""),this.emit(p,{})}}let hw=null;const k4={requestExtension:a=>(hw||(hw=new F4,hw.setup()),hw.requestExtension(a))};function Eh(a){return!(a instanceof Error)&&typeof a=="object"&&a!==null?a:a instanceof Error?{name:a.name,message:a.message,stack:a.stack,...a}:a}function V5(a){var p,t,n;if(a&&typeof a=="object"&&"value"in a){const s=a;return{single:((p=s.value)==null?void 0:p.valueAsTypeSingle)??((t=s.value)==null?void 0:t.value),list:((n=s.value)==null?void 0:n.valueAsTypeList)??null}}return{single:a,list:Array.isArray(a)?a:null}}const Ih={onBeforeEntityExecution:async()=>{},onEntityExecuted:async()=>{}};class e2 extends Error{constructor(){super("Execution was stopped"),this.name="ExecutionStoppedError"}}var U4=(a=>(a.FinishedSuccess="finished-success",a.FinishedError="finished-error",a.Running="running",a.Paused="paused",a.Stopped="stopped",a.NotStarted="not-started",a))(U4||{});const oDt={...k4,getValueTypePreference:()=>null,setValueTypePreference:()=>{}};class vg extends pe.Events{constructor(t,n,s,u=null,e=oDt){super();C(this,"project");C(this,"entryPoint");C(this,"state","not-started");C(this,"events",new pe.Events("fe-exec-inst-events"));C(this,"entities",[]);C(this,"parentExecution",null);C(this,"executing",[]);C(this,"executed",[]);C(this,"skipped",[]);C(this,"scheduled",[]);C(this,"localTestValues");C(this,"resolvedValues");C(this,"persistedExecutionResults");C(this,"lastExecutionResults");C(this,"onAddToSkippedListCallback",null);C(this,"onRemoveFromSkippedListCallback",null);C(this,"onAddEntityCallback",null);C(this,"onRemoveEntityCallback",null);C(this,"onAbortExecutionCallback",null);this.parentContext=e,this.entities=n,this.entryPoint=s,this.project=t,this.parentExecution=u,this.localTestValues=new VR(M.UUID.uuid(),this.project),this.resolvedValues=new VR(M.UUID.uuid(),this.project),this.persistedExecutionResults=new VR(M.UUID.uuid(),this.project),this.lastExecutionResults=new VR(M.UUID.uuid(),this.project)}get valueResolutionContext(){return{execution:this,project:this.project,localTestValues:this.localTestValues,resolvedValues:this.resolvedValues,persistedExecutionResults:this.persistedExecutionResults,lastExecutionResults:this.lastExecutionResults,getValueTypePreference:this.parentContext.getValueTypePreference,setValueTypePreference:this.parentContext.setValueTypePreference}}get rootExecution(){let t=this;for(;t.parentExecution;)t=t.parentExecution;return t}get rootState(){return this.rootExecution.state}isStopped(){return this.state==="stopped"||this.rootExecution.state==="stopped"}isPaused(){return this.state==="paused"||this.rootExecution.state==="paused"}async checkStateAndPause(){if(this.isStopped())throw new e2;for(;this.isPaused();){if(this.isStopped())throw new e2;await new Promise(t=>setTimeout(t,100))}}skip(t){this.hasEntity(t)&&(this.removeFromScheduledList(t),!this.skipped.includes(t)&&(this.skipped.push(t),this.onAddToSkippedListCallback&&this.onAddToSkippedListCallback(t),Pr.includes(t.type)&&ri(t).forEach(n=>this.skip(n))))}async schedule(t,n,s){if(this.hasExecuted(t))return null;if(Xi.includes(t.type))return this.executeBranch(t,s,n);if(Vr.includes(t.type)){if(t.calledBy.every(e=>this.hasExecuted(e)||!this.hasEntity(e)))return this.executeBranch(t,s,n);this.scheduled.includes(t)||this.scheduled.push(t)}return null}mergeExernalValuesWithInternalInputs(t,n){const s=[];return Yi.includes(n.type)?s.push(...n.inputs.filter(e=>vT(e))):[...Li,...Xi].includes(n.type)?s.push(...n.inputs):Ni.includes(n.type)&&s.push(...n.outputs.filter(e=>vT(e))),s.map(e=>{var y;let f=t.find(m=>m.valueOwner.id===e.id);if(f)return f;if(!f&&Xi.includes(n.type)&&(f=t.find(m=>{var T;return((T=m.valueOwner.declaration)==null?void 0:T.id)===e.id})),f){const m=(y=f.value)==null?void 0:y.clone(null);return m==null||m.setStandaloneParent(e,null),{...f,valueOwner:e,value:m||null,inheritanceLink:{sources:[f],target:e}}}return ls.includes(e.type)?Xp(e,this.valueResolutionContext):Qu(e,this.valueResolutionContext)}).reduce((e,f)=>{const y=uf(f==null?void 0:f.valueOwner,this.project),m=f?[f]:[];return y.forEach(T=>{var R,I,A;if(T.id===(f==null?void 0:f.valueOwner.id))return;const g=Pn(T.getDataType(null),T,this.project);g==null||g.metaSync({value:(R=f==null?void 0:f.value)==null?void 0:R.value},null),g==null||g.setValueAsTypeList(((I=f==null?void 0:f.value)==null?void 0:I.valueAsTypeList)||null),g==null||g.setValueAsTypeSingle(((A=f==null?void 0:f.value)==null?void 0:A.valueAsTypeSingle)||null);const b={...f,valueOwner:T,value:g};m.push(b)}),[...e,...m]},[]).sort((e,f)=>e.valueOwner.index-f.valueOwner.index)}inheritValuesFromContext(t){this.localTestValues=t.localTestValues,this.resolvedValues=t.resolvedValues,this.persistedExecutionResults=t.persistedExecutionResults}async executeInternalCall(t,n,s,u={}){var f,y;this.logBeforeExecution("executeInternalCall",t,n);const e={...Ih,...u};try{let m={value:K.Success,error:null,result:null};if(n.sort((A,O)=>A.valueOwner.index-O.valueOwner.index),Object.values(ja).includes(t.declaration.id)){const A=this.parentContext.requestExtension(vi+t.declaration.id).module.main;A?m=await A(t,n,this):pe.Logger.warn(`No implementation found for built-in function: ${t.declaration.id}`)}else{const A=await this.executeDetachedFullFunctionDeclarationLogic(t.declaration,n,s,e);m={value:A.value,error:A.error,result:A.result}}let T=null;if(m.error&&t.error){pe.Logger.warn("Raw error executing entity: ",m.error);const{single:A,list:O}=V5(m.error),P=Eh(A),x=(f=t.error)==null?void 0:f.getDataType(null),$=Pn(x||null,t.error,s);x!=null&&x.asType?O!==null?$==null||$.setValueAsTypeList(O):$==null||$.setValueAsTypeSingle(A):$==null||$.metaSync({value:P},null),T={valueOwner:t.error,type:rt.ExecutionResult,inheritanceLink:null,value:$}}const g=t==null?void 0:t.getDataType(null),b=Pn(g,t,s),{single:R,list:I}=V5(m.result);return g!=null&&g.asType?I!==null?b==null||b.setValueAsTypeList(I):b==null||b.setValueAsTypeSingle(R):b==null||b.metaSync({value:R},null),{value:m.value,entity:t,error:T,result:{value:b||null,valueOwner:t,type:rt.ExecutionResult,inheritanceLink:null}}}catch(m){if(m&&(m.name==="ExecutionStoppedError"||m.message==="Execution was stopped"))throw m;pe.Logger.warn("Internal call execution error: ",m);let T=null;if(t.error){const g=Eh(m),b=(y=t.error)==null?void 0:y.getDataType(null),R=Pn(b,t.error,s);b!=null&&b.asType?R==null||R.setValueAsTypeSingle(m):R==null||R.metaSync({value:g},null),T={valueOwner:t.error,type:rt.ExecutionResult,inheritanceLink:null,value:R}}return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,entity:t,error:T,result:null}}}static async executeOperation(t,n,s,u){var e,f;u?u.logBeforeExecution("executeOperation",t,n):console.log(`executeOperation (${t.type}) -> [${De(t,s)}] Inputs:${n.length?`
61
+ `),p}class _At extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.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:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.GoogleDriveUploadFile);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A,O,P,x,$,U,q,Z,H,W,ie,z,Y,ee,J;try{const te=this.extensionsRegistry.requestContexts(this,[X.Editor])[0],re=Be(t,t.project,"uploadFile"),le="["+Ve(t,t.project,"Upload Google Drive File")+": `"+re+"`] ",oe=G.operation[Q.GoogleDriveUploadFile],ce=n.find(kt=>{var Ct,xi;return((xi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:xi.id)===oe.inputs.connection.id}),ge=((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(!ge||!ge.id||!ge.name||ge.type!==r.DefinitionEntity)throw new Error(`${le}Invalid input "${Ve(ce==null?void 0:ce.valueOwner,te==null?void 0:te.logic,"Connection")}" (\`${Be(ce==null?void 0:ce.valueOwner,te==null?void 0:te.logic,"connection")}\`), expected a valid connection node.`);const Ce=n.find(kt=>{var Ct,xi;return((xi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:xi.id)===oe.inputs.content.id}),Ee=((e=Ce==null?void 0:Ce.value)==null?void 0:e.valueAsType)??((f=Ce==null?void 0:Ce.value)==null?void 0:f.value),Oe=n.find(kt=>{var Ct,xi;return((xi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:xi.id)===oe.inputs.name.id}),Le=(m=(y=Oe==null?void 0:Oe.value)==null?void 0:y.value)==null?void 0:m.trim();if(!Le||Le==="")throw new Error(`${le}The "${Ve(Oe==null?void 0:Oe.valueOwner,te==null?void 0:te.logic,"File Name")}" (\`${Be(Oe==null?void 0:Oe.valueOwner,te==null?void 0:te.logic,"name")}\`) input is missing.`);const Fe=(((g=(T=n.find(kt=>{var Ct,xi;return((xi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:xi.id)===G.operation[Q.GoogleDriveUploadFile].inputs.mimeType.id}))==null?void 0:T.value)==null?void 0:g.valueAsType)??((R=(b=n.find(kt=>{var Ct,xi;return((xi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:xi.id)===G.operation[Q.GoogleDriveUploadFile].inputs.mimeType.id}))==null?void 0:b.value)==null?void 0:R.value))||"application/octet-stream",tt=(((A=(I=n.find(kt=>{var Ct,xi;return((xi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:xi.id)===G.operation[Q.GoogleDriveUploadFile].inputs.folderId.id}))==null?void 0:I.value)==null?void 0:A.valueAsType)??((P=(O=n.find(kt=>{var Ct,xi;return((xi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:xi.id)===G.operation[Q.GoogleDriveUploadFile].inputs.folderId.id}))==null?void 0:O.value)==null?void 0:P.value))||void 0,We=((($=(x=n.find(kt=>{var Ct,xi;return((xi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:xi.id)===G.operation[Q.GoogleDriveUploadFile].inputs.description.id}))==null?void 0:x.value)==null?void 0:$.valueAsType)??((q=(U=n.find(kt=>{var Ct,xi;return((xi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:xi.id)===G.operation[Q.GoogleDriveUploadFile].inputs.description.id}))==null?void 0:U.value)==null?void 0:q.value))||void 0,et=(((H=(Z=n.find(kt=>{var Ct,xi;return((xi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:xi.id)===G.operation[Q.GoogleDriveUploadFile].inputs.importMimeType.id}))==null?void 0:Z.value)==null?void 0:H.valueAsType)??((ie=(W=n.find(kt=>{var Ct,xi;return((xi=(Ct=kt.valueOwner)==null?void 0:Ct.declaration)==null?void 0:xi.id)===G.operation[Q.GoogleDriveUploadFile].inputs.importMimeType.id}))==null?void 0:W.value)==null?void 0:ie.value))||"text/plain";if(!Le)return ay(t,"Missing required input: name");const qe=ui(ge),st={Authorization:`Bearer ${await te.getAccessToken()}`},ft=`${((z=te.env)==null?void 0:z.API_BASE_URL)+"/editor-runtime"}/v2/external-integrations/proxy/${te.projectId}/${Zt["google-drive"]}/${qe}`,Et=async(kt,Ct,{params:xi,body:wn,contentType:Yr,providerHeaders:Jr,responseType:hi}={})=>{const $t=`${ft}/${ZIn(Ct)}`,Nt={...st};return Yr&&(Nt["Content-Type"]=Yr),(Jr||hi)&&(Nt[qIn]=JSON.stringify({...Jr?{headers:Jr}:{},...hi?{responseType:hi}:{}})),Ht.request({method:kt,url:$t,params:xi,data:wn,responseType:hi||"json",headers:Nt})},pt=typeof Fe=="string"&&Fe.startsWith("application/vnd.google-apps.");if(pt&&(Ee==null||Ee==="")){const kt={name:Le,mimeType:Fe};tt&&(kt.parents=[tt]),typeof We=="string"&&(kt.description=We);const Ct=await Et("POST","/drive/v3/files",{params:{supportsAllDrives:"true",fields:_R},body:JSON.stringify(kt),contentType:"application/json"});return Ct.status!==200&&Ct.status!==201?ay(t,`Drive create failed (status=${Ct.status})`):WG({file:Ct.data})}if(pt&&Ee!=null){let kt=await WIn(Ee);const xi=((hi,$t)=>$t||(hi==="application/vnd.google-apps.spreadsheet"?"text/csv":hi==="application/vnd.google-apps.document"||hi==="application/vnd.google-apps.presentation"?"text/html":"text/plain"))(Fe,et),wn=xi.startsWith("text/")&&!/charset=/i.test(xi)?`${xi}; charset=UTF-8`:xi;xi.startsWith("text/csv")&&(kt=zIn(kt));const Yr=new TextEncoder().encode(kt);if(Yr.byteLength>v5)return ay(t,`Text body exceeds simple upload limit (${Yr.byteLength} bytes).`);let Jr;try{const hi=await Et("POST","/upload/drive/v3/files",{params:{uploadType:"media",supportsAllDrives:"true",fields:_R},body:Yr,contentType:wn});if(hi.status!==200&&hi.status!==201)return ay(t,`Drive media upload failed (status=${hi.status})`);if(Jr=(Y=hi.data)==null?void 0:Y.id,!Jr)return ay(t,"Drive media upload did not return an id");const $t={name:Le,mimeType:Fe};tt&&($t.parents=[tt]),typeof We=="string"&&($t.description=We);const Nt=await Et("POST",`/drive/v3/files/${encodeURIComponent(Jr)}/copy`,{params:{supportsAllDrives:"true",fields:_R},body:JSON.stringify($t),contentType:"application/json"});return Nt.status!==200&&Nt.status!==201?ay(t,`Drive copy-convert failed (status=${Nt.status})`):WG({file:Nt.data})}finally{if(Jr)try{await Et("DELETE",`/drive/v3/files/${encodeURIComponent(Jr)}`,{params:{supportsAllDrives:"true"}})}catch{}}}if(Ee==null)return ay(t,"Missing content for non-native upload");const{bytes:Me,inferredMime:Je,isBinary:ke}=await HIn(Ee),lt=Me.byteLength;if(lt>v5)return ay(t,`File too large for simple upload (${lt} bytes).`);const Gt=await Et("POST","/upload/drive/v3/files",{params:{uploadType:"media",supportsAllDrives:"true",fields:_R},body:Me,contentType:Fe||Je||(ke?"application/octet-stream":"text/plain; charset=UTF-8")});if(Gt.status!==200&&Gt.status!==201)return ay(t,`Drive media upload failed (status=${Gt.status})`);let si=Gt.data;const pi=(ee=Gt.data)==null?void 0:ee.id;return pi&&(tt||Le||We)&&(si=await YIn(Et,pi,Le,We,tt)),WG({file:si})}catch(te){const re=((J=te.response)==null?void 0:J.data)||te.message||te;return pe.Logger.error("[Google Drive] Upload document failed:",re),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:re,result:null}}}})}}function WG(a){return{value:K.Success,error:null,result:a}}function ay(a,p){return pe.Logger.log("[Google Drive] Upload error:",p),{value:a.catchesError||a.errorCalls.length?K.CaughtError:K.UnhandledError,error:p,result:null}}async function YIn(a,p,t,n,s){const u={};t&&(u.name=t),typeof n=="string"&&(u.description=n);const e={supportsAllDrives:"true",fields:_R},f={...e};s&&(f.addParents=s,f.removeParents="root");let y=await a("PATCH",`/drive/v3/files/${encodeURIComponent(p)}`,{params:f,body:JSON.stringify(u),contentType:"application/json"});if(y.status>=400&&s&&(y=await a("PATCH",`/drive/v3/files/${encodeURIComponent(p)}`,{params:{...e,addParents:s},body:JSON.stringify(u),contentType:"application/json"})),y.status!==200)throw new Error(`Drive metadata update failed (status=${y.status})`);return y.data}const JIn="id,name,mimeType,webViewLink",QIn="X-Elyx-Proxy-Config";function XIn(a){return a.startsWith("/")?a.slice(1):a}const eRn=(a,p)=>(pe.Logger.log("[Google Drive Clone Document] error:",p),{value:a.catchesError||a.errorCalls.length?K.CaughtError:K.UnhandledError,error:p,result:null});class $At extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleDriveCloneDocument,version:"1.0.0",description:"Google Drive clone document operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.GoogleDriveCloneDocument);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A,O;try{const P=this.extensionsRegistry.requestContexts(this,[X.Editor])[0],x=G.operation[Q.GoogleDriveCloneDocument],$=Be(t,t.project,"cloneDocument"),q="["+Ve(t,t.project,"Clone document")+": `"+$+"`] ",Z=n.find(Ee=>{var Oe,Le;return((Le=(Oe=Ee.valueOwner)==null?void 0:Oe.declaration)==null?void 0:Le.id)===x.inputs.connection.id}),H=((s=Z==null?void 0:Z.value)==null?void 0:s.valueAsType)??((u=Z==null?void 0:Z.value)==null?void 0:u.value);if(!H||!H.id||!H.name||H.type!==r.DefinitionEntity)throw new Error(`${q}Invalid input "${Ve(Z==null?void 0:Z.valueOwner,P==null?void 0:P.logic,"Connection")}" (\`${Be(Z==null?void 0:Z.valueOwner,P==null?void 0:P.logic,"connection")}\`), expected a valid connection node.`);const W=ui(H);if(!W)throw new Error(`${q}The "${Ve(Z==null?void 0:Z.valueOwner,P==null?void 0:P.logic,"Connection")}" (\`${Be(Z==null?void 0:Z.valueOwner,P==null?void 0:P.logic,"connection")}\`) input is invalid, missing underlying Connection ID value.`);const ie=n.find(Ee=>{var Oe,Le;return((Le=(Oe=Ee.valueOwner)==null?void 0:Oe.declaration)==null?void 0:Le.id)===x.inputs.documentId.id}),z=(e=ie==null?void 0:ie.value)==null?void 0:e.value;if(!z||z==="")throw new Error(`${q}The "${Ve(ie==null?void 0:ie.valueOwner,P==null?void 0:P.logic,"Document ID")}" (\`${Be(ie==null?void 0:ie.valueOwner,P==null?void 0:P.logic,"documentId")}\`) input is missing.`);if(typeof z!="string")throw new Error(`${q}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 Y=(y=(f=n.find(Ee=>{var Oe,Le;return((Le=(Oe=Ee.valueOwner)==null?void 0:Oe.declaration)==null?void 0:Le.id)===x.inputs.newName.id}))==null?void 0:f.value)==null?void 0:y.value,ee=(T=(m=n.find(Ee=>{var Oe,Le;return((Le=(Oe=Ee.valueOwner)==null?void 0:Oe.declaration)==null?void 0:Le.id)===x.inputs.parentFolderIds.id}))==null?void 0:m.value)==null?void 0:T.value,J=(b=(g=n.find(Ee=>{var Oe,Le;return((Le=(Oe=Ee.valueOwner)==null?void 0:Oe.declaration)==null?void 0:Le.id)===x.inputs.description.id}))==null?void 0:g.value)==null?void 0:b.value,te=(I=(R=n.find(Ee=>{var Oe,Le;return((Le=(Oe=Ee.valueOwner)==null?void 0:Oe.declaration)==null?void 0:Le.id)===x.inputs.starred.id}))==null?void 0:R.value)==null?void 0:I.value;ui(H);const ae={Authorization:`Bearer ${await P.getAccessToken()}`},le=`${((A=P.env)==null?void 0:A.API_BASE_URL)+"/editor-runtime"}/v2/external-integrations/proxy/${P.projectId}/${Zt["google-drive"]}/${W}`,oe=async(Ee,Oe,{params:Le,body:Fe,contentType:tt,providerHeaders:We,responseType:et}={})=>{const qe=`${le}/${XIn(Oe)}`,ot={...ae};return tt&&(ot["Content-Type"]=tt),(We||et)&&(ot[QIn]=JSON.stringify({...We?{headers:We}:{},...et?{responseType:et}:{}})),Ht({method:Ee,url:qe,headers:ot,params:Le,data:Fe,responseType:et||"json"})},ce={};Y&&(ce.name=Y),ee&&ee.length>0&&(ce.parents=ee),J&&(ce.description=J),te!==void 0&&(ce.starred=te);const Ce=(await oe("POST",`/drive/v3/files/${z}/copy`,{params:{fields:JIn,supportsAllDrives:!0},body:ce,contentType:"application/json"})).data;return{value:K.Success,error:null,result:{id:Ce.id,name:Ce.name,mimeType:Ce.mimeType,webViewLink:Ce.webViewLink}}}catch(P){const x=((O=P.response)==null?void 0:O.data)||P.message||P;return eRn(t,x)}}})}}const tRn="X-Elyx-Proxy-Config";function iRn(a){return a.startsWith("/")?a.slice(1):a}const nRn=(a,p)=>(pe.Logger.log("[Google Drive Delete Document] error:",p),{value:a.catchesError||a.errorCalls.length?K.CaughtError:K.UnhandledError,error:p,result:null});class GAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleDriveDeleteDocument,version:"1.0.0",description:"Google Drive delete document operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.Editor])[0],b=G.operation[Q.GoogleDriveDeleteDocument],R=Be(t,t.project,"deleteDocument"),A="["+Ve(t,t.project,"Delete document")+": `"+R+"`] ",O=n.find(z=>{var Y,ee;return((ee=(Y=z.valueOwner)==null?void 0:Y.declaration)==null?void 0:ee.id)===b.inputs.connection.id}),P=((s=O==null?void 0:O.value)==null?void 0:s.valueAsType)??((u=O==null?void 0:O.value)==null?void 0:u.value);if(!P||!P.id||!P.name||P.type!==r.DefinitionEntity)throw new Error(`${A}Invalid input "${Ve(O==null?void 0:O.valueOwner,g==null?void 0:g.logic,"Connection")}" (\`${Be(O==null?void 0:O.valueOwner,g==null?void 0:g.logic,"connection")}\`), expected a valid connection node.`);const x=ui(P);if(!x)throw new Error(`${A}The "${Ve(O==null?void 0:O.valueOwner,g==null?void 0:g.logic,"Connection")}" (\`${Be(O==null?void 0:O.valueOwner,g==null?void 0:g.logic,"connection")}\`) input is invalid, missing underlying Connection ID value.`);const $=n.find(z=>{var Y,ee;return((ee=(Y=z.valueOwner)==null?void 0:Y.declaration)==null?void 0:ee.id)===b.inputs.documentId.id}),U=(e=$==null?void 0:$.value)==null?void 0:e.value;if(!U||U==="")throw new Error(`${A}The "${Ve($==null?void 0:$.valueOwner,g==null?void 0:g.logic,"Document ID")}" (\`${Be($==null?void 0:$.valueOwner,g==null?void 0:g.logic,"documentId")}\`) input is missing.`);if(typeof U!="string")throw new Error(`${A}The "${Ve($==null?void 0:$.valueOwner,g==null?void 0:g.logic,"Document ID")}" (\`${Be($==null?void 0:$.valueOwner,g==null?void 0:g.logic,"documentId")}\`) input value is invalid, if present, it must be a non-empty string.`);const q=(y=(f=n.find(z=>{var Y,ee;return((ee=(Y=z.valueOwner)==null?void 0:Y.declaration)==null?void 0:ee.id)===b.inputs.permanent.id}))==null?void 0:f.value)==null?void 0:y.value;ui(P);const H={Authorization:`Bearer ${await g.getAccessToken()}`},W=`${((m=g.env)==null?void 0:m.API_BASE_URL)+"/editor-runtime"}/v2/external-integrations/proxy/${g.projectId}/${Zt["google-drive"]}/${x}`,ie=async(z,Y,{params:ee,body:J,contentType:te,providerHeaders:re,responseType:ae}={})=>{const le=`${W}/${iRn(Y)}`,oe={...H};return te&&(oe["Content-Type"]=te),(re||ae)&&(oe[tRn]=JSON.stringify({...re?{headers:re}:{},...ae?{responseType:ae}:{}})),Ht({method:z,url:le,headers:oe,params:ee,data:J,responseType:ae||"json"})};return q?await ie("DELETE",`/drive/v3/files/${U}`,{params:{supportsAllDrives:!0}}):await ie("PATCH",`/drive/v3/files/${U}`,{params:{supportsAllDrives:!0},body:{trashed:!0},contentType:"application/json"}),{value:K.Success,error:null,result:null}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return nRn(t,b)}}})}}const rRn="X-Elyx-Proxy-Config";function aRn(a){return a.startsWith("/")?a.slice(1):a}const sRn=(a,p)=>(pe.Logger.log("[Google Drive Create Permission] error:",p),{value:a.catchesError||a.errorCalls.length?K.CaughtError:K.UnhandledError,error:p,result:null});class LAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleDriveCreatePermission,version:"1.0.0",description:"Google Drive create permission operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.GoogleDriveCreatePermission);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A,O,P,x,$,U,q,Z,H;try{const W=this.extensionsRegistry.requestContexts(this,[X.Editor])[0],ie=G.operation[Q.GoogleDriveCreatePermission],z=Be(t,t.project,"createPermission"),ee="["+Ve(t,t.project,"Create permission")+": `"+z+"`] ",J=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===ie.inputs.connection.id}),te=((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(!te||!te.id||!te.name||te.type!==r.DefinitionEntity)throw new Error(`${ee}Invalid input "${Ve(J==null?void 0:J.valueOwner,W==null?void 0:W.logic,"Connection")}" (\`${Be(J==null?void 0:J.valueOwner,W==null?void 0:W.logic,"connection")}\`), expected a valid connection node.`);const re=ui(te);if(!re)throw new Error(`${ee}The "${Ve(J==null?void 0:J.valueOwner,W==null?void 0:W.logic,"Connection")}" (\`${Be(J==null?void 0:J.valueOwner,W==null?void 0:W.logic,"connection")}\`) input is invalid, missing underlying Connection ID value.`);const ae=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===ie.inputs.fileId.id}),le=(e=ae==null?void 0:ae.value)==null?void 0:e.value;if(!le||le==="")throw new Error(`${ee}The "${Ve(ae==null?void 0:ae.valueOwner,W==null?void 0:W.logic,"File ID")}" (\`${Be(ae==null?void 0:ae.valueOwner,W==null?void 0:W.logic,"fileId")}\`) input is missing.`);if(typeof le!="string")throw new Error(`${ee}The "${Ve(ae==null?void 0:ae.valueOwner,W==null?void 0:W.logic,"File ID")}" (\`${Be(ae==null?void 0:ae.valueOwner,W==null?void 0:W.logic,"fileId")}\`) 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)===ie.inputs.role.id}),ce=(f=oe==null?void 0:oe.value)==null?void 0:f.value;if(!ce||ce==="")throw new Error(`${ee}The "${Ve(oe==null?void 0:oe.valueOwner,W==null?void 0:W.logic,"Role")}" (\`${Be(oe==null?void 0:oe.valueOwner,W==null?void 0:W.logic,"role")}\`) input is missing.`);if(typeof ce!="string")throw new Error(`${ee}The "${Ve(oe==null?void 0:oe.valueOwner,W==null?void 0:W.logic,"Role")}" (\`${Be(oe==null?void 0:oe.valueOwner,W==null?void 0:W.logic,"role")}\`) input value is invalid, if present, it must be a non-empty string.`);const ge=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===ie.inputs.type.id}),Ce=(y=ge==null?void 0:ge.value)==null?void 0:y.value;if(!Ce||Ce==="")throw new Error(`${ee}The "${Ve(ge==null?void 0:ge.valueOwner,W==null?void 0:W.logic,"Type")}" (\`${Be(ge==null?void 0:ge.valueOwner,W==null?void 0:W.logic,"type")}\`) input is missing.`);if(typeof Ce!="string")throw new Error(`${ee}The "${Ve(ge==null?void 0:ge.valueOwner,W==null?void 0:W.logic,"Type")}" (\`${Be(ge==null?void 0:ge.valueOwner,W==null?void 0:W.logic,"type")}\`) input value is invalid, if present, it must be a non-empty string.`);const Ee=(T=(m=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===ie.inputs.emailAddress.id}))==null?void 0:m.value)==null?void 0:T.value,Oe=(b=(g=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===ie.inputs.domain.id}))==null?void 0:g.value)==null?void 0:b.value,Le=(I=(R=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===ie.inputs.sendNotificationEmail.id}))==null?void 0:R.value)==null?void 0:I.value,Fe=(O=(A=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===ie.inputs.emailMessage.id}))==null?void 0:A.value)==null?void 0:O.value,tt=(x=(P=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===ie.inputs.allowFileDiscovery.id}))==null?void 0:P.value)==null?void 0:x.value,We=(U=($=n.find(Je=>{var ke,lt;return((lt=(ke=Je.valueOwner)==null?void 0:ke.declaration)==null?void 0:lt.id)===ie.inputs.transferOwnership.id}))==null?void 0:$.value)==null?void 0:U.value;ui(te);const qe={Authorization:`Bearer ${await W.getAccessToken()}`},ot=`${((q=W.env)==null?void 0:q.API_BASE_URL)+"/editor-runtime"}/v2/external-integrations/proxy/${W.projectId}/${Zt["google-drive"]}/${re}`,st=async(Je,ke,{params:lt,body:Pt,contentType:Gt,providerHeaders:si,responseType:pi}={})=>{const kt=`${ot}/${aRn(ke)}`,Ct={...qe};return Gt&&(Ct["Content-Type"]=Gt),(si||pi)&&(Ct[rRn]=JSON.stringify({...si?{headers:si}:{},...pi?{responseType:pi}:{}})),Ht({method:Je,url:kt,headers:Ct,params:lt,data:Pt,responseType:pi||"json"})},ft={supportsAllDrives:!0,fields:"id,type,role,emailAddress,domain,displayName"};Le!==void 0&&(ft.sendNotificationEmail=Le),Fe&&(ft.emailMessage=Fe),We!==void 0&&(ft.transferOwnership=We);const Et={role:ce,type:Ce};Ee&&(Et.emailAddress=Ee),Oe&&(Et.domain=Oe),tt!==void 0&&(Et.allowFileDiscovery=tt);const pt=await st("POST",`/drive/v3/files/${le}/permissions`,{params:ft,body:Et,contentType:"application/json"}),Me=((Z=pt.data)==null?void 0:Z.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)??ce,emailAddress:(Me==null?void 0:Me.emailAddress)??Ee??"",domain:(Me==null?void 0:Me.domain)??Oe??"",displayName:(Me==null?void 0:Me.displayName)??""}}}catch(W){const ie=((H=W.response)==null?void 0:H.data)||W.message||W;return sRn(t,typeof ie=="object"?JSON.stringify(ie):String(ie))}}})}}const lRn="X-Elyx-Proxy-Config";function oRn(a){return a.startsWith("/")?a.slice(1):a}const dRn=(a,p)=>(pe.Logger.log("[Google Drive Delete Permission] error:",p),{value:a.catchesError||a.errorCalls.length?K.CaughtError:K.UnhandledError,error:p,result:null});class BAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleDriveDeletePermission,version:"1.0.0",description:"Google Drive delete permission operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.Editor])[0],g=G.operation[Q.GoogleDriveDeletePermission],b=Be(t,t.project,"deletePermission"),I="["+Ve(t,t.project,"Delete permission")+": `"+b+"`] ",A=n.find(z=>{var Y,ee;return((ee=(Y=z.valueOwner)==null?void 0:Y.declaration)==null?void 0:ee.id)===g.inputs.connection.id}),O=((s=A==null?void 0:A.value)==null?void 0:s.valueAsType)??((u=A==null?void 0:A.value)==null?void 0:u.value);if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${I}Invalid input "${Ve(A==null?void 0:A.valueOwner,T==null?void 0:T.logic,"Connection")}" (\`${Be(A==null?void 0:A.valueOwner,T==null?void 0:T.logic,"connection")}\`), expected a valid connection node.`);const P=ui(O);if(!P)throw new Error(`${I}The "${Ve(A==null?void 0:A.valueOwner,T==null?void 0:T.logic,"Connection")}" (\`${Be(A==null?void 0:A.valueOwner,T==null?void 0:T.logic,"connection")}\`) input is invalid, missing underlying Connection ID value.`);const x=n.find(z=>{var Y,ee;return((ee=(Y=z.valueOwner)==null?void 0:Y.declaration)==null?void 0:ee.id)===g.inputs.fileId.id}),$=(e=x==null?void 0:x.value)==null?void 0:e.value;if(!$||$==="")throw new Error(`${I}The "${Ve(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"File ID")}" (\`${Be(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"fileId")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${I}The "${Ve(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"File ID")}" (\`${Be(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"fileId")}\`) input value is invalid, if present, it must be a non-empty string.`);const U=n.find(z=>{var Y,ee;return((ee=(Y=z.valueOwner)==null?void 0:Y.declaration)==null?void 0:ee.id)===g.inputs.permissionId.id}),q=(f=U==null?void 0:U.value)==null?void 0:f.value;if(!q||q==="")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 q!="string")throw new Error(`${I}The "${Ve(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"Permission ID")}" (\`${Be(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"permissionId")}\`) input value is invalid, if present, it must be a non-empty string.`);ui(O);const H={Authorization:`Bearer ${await T.getAccessToken()}`},W=`${((y=T.env)==null?void 0:y.API_BASE_URL)+"/editor-runtime"}/v2/external-integrations/proxy/${T.projectId}/${Zt["google-drive"]}/${P}`;return await(async(z,Y,{params:ee,body:J,contentType:te,providerHeaders:re,responseType:ae}={})=>{const le=`${W}/${oRn(Y)}`,oe={...H};return te&&(oe["Content-Type"]=te),(re||ae)&&(oe[lRn]=JSON.stringify({...re?{headers:re}:{},...ae?{responseType:ae}:{}})),Ht({method:z,url:le,headers:oe,params:ee,data:J,responseType:ae||"json"})})("DELETE",`/drive/v3/files/${$}/permissions/${q}`,{params:{supportsAllDrives:!0}}),{value:K.Success,error:null,result:void 0}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return dRn(t,typeof g=="object"?JSON.stringify(g):String(g))}}})}}const pRn="X-Elyx-Proxy-Config";function uRn(a){return a.startsWith("/")?a.slice(1):a}const cRn=(a,p)=>(pe.Logger.log("[Google Drive List Permissions] error:",p),{value:a.catchesError||a.errorCalls.length?K.CaughtError:K.UnhandledError,error:p,result:null});class SAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleDriveListPermissions,version:"1.0.0",description:"Google Drive list permissions operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.Editor])[0],A=G.operation[Q.GoogleDriveListPermissions],O=Be(t,t.project,"listPermissions"),x="["+Ve(t,t.project,"List permissions")+": `"+O+"`] ",$=n.find(ce=>{var ge,Ce;return((Ce=(ge=ce.valueOwner)==null?void 0:ge.declaration)==null?void 0:Ce.id)===A.inputs.connection.id}),U=((s=$==null?void 0:$.value)==null?void 0:s.valueAsType)??((u=$==null?void 0:$.value)==null?void 0:u.value);if(!U||!U.id||!U.name||U.type!==r.DefinitionEntity)throw new Error(`${x}Invalid input "${Ve($==null?void 0:$.valueOwner,I==null?void 0:I.logic,"Connection")}" (\`${Be($==null?void 0:$.valueOwner,I==null?void 0:I.logic,"connection")}\`), expected a valid connection node.`);const q=ui(U);if(!q)throw new Error(`${x}The "${Ve($==null?void 0:$.valueOwner,I==null?void 0:I.logic,"Connection")}" (\`${Be($==null?void 0:$.valueOwner,I==null?void 0:I.logic,"connection")}\`) input is invalid, missing underlying Connection ID value.`);const Z=n.find(ce=>{var ge,Ce;return((Ce=(ge=ce.valueOwner)==null?void 0:ge.declaration)==null?void 0:Ce.id)===A.inputs.fileId.id}),H=(e=Z==null?void 0:Z.value)==null?void 0:e.value;if(!H||H==="")throw new Error(`${x}The "${Ve(Z==null?void 0:Z.valueOwner,I==null?void 0:I.logic,"File ID")}" (\`${Be(Z==null?void 0:Z.valueOwner,I==null?void 0:I.logic,"fileId")}\`) input is missing.`);if(typeof H!="string")throw new Error(`${x}The "${Ve(Z==null?void 0:Z.valueOwner,I==null?void 0:I.logic,"File ID")}" (\`${Be(Z==null?void 0:Z.valueOwner,I==null?void 0:I.logic,"fileId")}\`) input value is invalid, if present, it must be a non-empty string.`);const W=(y=(f=n.find(ce=>{var ge,Ce;return((Ce=(ge=ce.valueOwner)==null?void 0:ge.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 ge,Ce;return((Ce=(ge=ce.valueOwner)==null?void 0:ge.declaration)==null?void 0:Ce.id)===A.inputs.pageToken.id}))==null?void 0:m.value)==null?void 0:T.value;ui(U);const Y={Authorization:`Bearer ${await I.getAccessToken()}`},ee=`${((g=I.env)==null?void 0:g.API_BASE_URL)+"/editor-runtime"}/v2/external-integrations/proxy/${I.projectId}/${Zt["google-drive"]}/${q}`,J=async(ce,ge,{params:Ce,body:Ee,contentType:Oe,providerHeaders:Le,responseType:Fe}={})=>{const tt=`${ee}/${uRn(ge)}`,We={...Y};return Oe&&(We["Content-Type"]=Oe),(Le||Fe)&&(We[pRn]=JSON.stringify({...Le?{headers:Le}:{},...Fe?{responseType:Fe}:{}})),Ht({method:ce,url:tt,headers:We,params:Ce,data:Ee,responseType:Fe||"json"})},te={supportsAllDrives:!0,fields:"nextPageToken,permissions(id,type,role,emailAddress,domain,displayName)"};W!=null&&(te.pageSize=W),ie&&(te.pageToken=ie);const re=await J("GET",`/drive/v3/files/${H}/permissions`,{params:te}),ae=((b=re.data)==null?void 0:b.data)??re.data,oe=(Array.isArray(ae==null?void 0:ae.permissions)?ae.permissions:[]).map(ce=>({id:(ce==null?void 0:ce.id)??"",type:(ce==null?void 0:ce.type)??"",role:(ce==null?void 0:ce.role)??"",emailAddress:(ce==null?void 0:ce.emailAddress)??"",domain:(ce==null?void 0:ce.domain)??"",displayName:(ce==null?void 0:ce.displayName)??""}));return{value:K.Success,error:null,result:{permissions:oe,nextPageToken:(ae==null?void 0:ae.nextPageToken)??""}}}catch(I){const A=((R=I.response)==null?void 0:R.data)||I.message||I;return cRn(t,typeof A=="object"?JSON.stringify(A):String(A))}}})}}const fRn="X-Elyx-Proxy-Config";function yRn(a){return a.startsWith("/")?a.slice(1):a}const hRn=(a,p)=>(pe.Logger.log("[Google Drive Update Permission] error:",p),{value:a.catchesError||a.errorCalls.length?K.CaughtError:K.UnhandledError,error:p,result:null});class MAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleDriveUpdatePermission,version:"1.0.0",description:"Google Drive update permission operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.Editor])[0],A=G.operation[Q.GoogleDriveUpdatePermission],O=Be(t,t.project,"updatePermission"),x="["+Ve(t,t.project,"Update permission")+": `"+O+"`] ",$=n.find(ge=>{var Ce,Ee;return((Ee=(Ce=ge.valueOwner)==null?void 0:Ce.declaration)==null?void 0:Ee.id)===A.inputs.connection.id}),U=((s=$==null?void 0:$.value)==null?void 0:s.valueAsType)??((u=$==null?void 0:$.value)==null?void 0:u.value);if(!U||!U.id||!U.name||U.type!==r.DefinitionEntity)throw new Error(`${x}Invalid input "${Ve($==null?void 0:$.valueOwner,I==null?void 0:I.logic,"Connection")}" (\`${Be($==null?void 0:$.valueOwner,I==null?void 0:I.logic,"connection")}\`), expected a valid connection node.`);const q=ui(U);if(!q)throw new Error(`${x}The "${Ve($==null?void 0:$.valueOwner,I==null?void 0:I.logic,"Connection")}" (\`${Be($==null?void 0:$.valueOwner,I==null?void 0:I.logic,"connection")}\`) input is invalid, missing underlying Connection ID value.`);const Z=n.find(ge=>{var Ce,Ee;return((Ee=(Ce=ge.valueOwner)==null?void 0:Ce.declaration)==null?void 0:Ee.id)===A.inputs.fileId.id}),H=(e=Z==null?void 0:Z.value)==null?void 0:e.value;if(!H||H==="")throw new Error(`${x}The "${Ve(Z==null?void 0:Z.valueOwner,I==null?void 0:I.logic,"File ID")}" (\`${Be(Z==null?void 0:Z.valueOwner,I==null?void 0:I.logic,"fileId")}\`) input is missing.`);if(typeof H!="string")throw new Error(`${x}The "${Ve(Z==null?void 0:Z.valueOwner,I==null?void 0:I.logic,"File ID")}" (\`${Be(Z==null?void 0:Z.valueOwner,I==null?void 0:I.logic,"fileId")}\`) input value is invalid, if present, it must be a non-empty string.`);const W=n.find(ge=>{var Ce,Ee;return((Ee=(Ce=ge.valueOwner)==null?void 0:Ce.declaration)==null?void 0:Ee.id)===A.inputs.permissionId.id}),ie=(f=W==null?void 0:W.value)==null?void 0:f.value;if(!ie||ie==="")throw new Error(`${x}The "${Ve(W==null?void 0:W.valueOwner,I==null?void 0:I.logic,"Permission ID")}" (\`${Be(W==null?void 0:W.valueOwner,I==null?void 0:I.logic,"permissionId")}\`) input is missing.`);if(typeof ie!="string")throw new Error(`${x}The "${Ve(W==null?void 0:W.valueOwner,I==null?void 0:I.logic,"Permission ID")}" (\`${Be(W==null?void 0:W.valueOwner,I==null?void 0:I.logic,"permissionId")}\`) input value is invalid, if present, it must be a non-empty string.`);const z=n.find(ge=>{var Ce,Ee;return((Ee=(Ce=ge.valueOwner)==null?void 0:Ce.declaration)==null?void 0:Ee.id)===A.inputs.role.id}),Y=(y=z==null?void 0:z.value)==null?void 0:y.value;if(!Y||Y==="")throw new Error(`${x}The "${Ve(z==null?void 0:z.valueOwner,I==null?void 0:I.logic,"Role")}" (\`${Be(z==null?void 0:z.valueOwner,I==null?void 0:I.logic,"role")}\`) input is missing.`);if(typeof Y!="string")throw new Error(`${x}The "${Ve(z==null?void 0:z.valueOwner,I==null?void 0:I.logic,"Role")}" (\`${Be(z==null?void 0:z.valueOwner,I==null?void 0:I.logic,"role")}\`) input value is invalid, if present, it must be a non-empty string.`);const ee=(T=(m=n.find(ge=>{var Ce,Ee;return((Ee=(Ce=ge.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 te={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"]}/${q}`,ae=async(ge,Ce,{params:Ee,body:Oe,contentType:Le,providerHeaders:Fe,responseType:tt}={})=>{const We=`${re}/${yRn(Ce)}`,et={...te};return Le&&(et["Content-Type"]=Le),(Fe||tt)&&(et[fRn]=JSON.stringify({...Fe?{headers:Fe}:{},...tt?{responseType:tt}:{}})),Ht({method:ge,url:We,headers:et,params:Ee,data:Oe,responseType:tt||"json"})},le={supportsAllDrives:!0,fields:"id,type,role,emailAddress,domain,displayName"};ee!=null&&(le.transferOwnership=ee);const oe=await ae("PATCH",`/drive/v3/files/${H}/permissions/${ie}`,{params:le,body:{role:Y},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)??Y,emailAddress:(ce==null?void 0:ce.emailAddress)??"",domain:(ce==null?void 0:ce.domain)??"",displayName:(ce==null?void 0:ce.displayName)??""}}}catch(I){const A=((R=I.response)==null?void 0:R.data)||I.message||I;return hRn(t,typeof A=="object"?JSON.stringify(A):String(A))}}})}}class FAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleGeminiGenerateContent,version:"1.0.0",description:"Send Gmail email operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.Editor])[0],g=Be(t,t.project,"generateContent"),R="["+Ve(t,t.project,"Generate content")+": `"+g+"`] ",I=G.operation[Q.GoogleGeminiGenerateContent],A=n.find(H=>{var W,ie;return((ie=(W=H.valueOwner)==null?void 0:W.declaration)==null?void 0:ie.id)===I.inputs.connection.id}),O=((s=A==null?void 0:A.value)==null?void 0:s.valueAsType)??((u=A==null?void 0:A.value)==null?void 0:u.value);if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${R}Invalid input "${Ve(A==null?void 0:A.valueOwner,T==null?void 0:T.logic,"Connection")}" (\`${Be(A==null?void 0:A.valueOwner,T==null?void 0:T.logic,"connection")}\`), expected a valid connection node.`);const P=ui(O);if(!P)throw new Error(`${R}The "${Ve(A==null?void 0:A.valueOwner,T==null?void 0:T.logic,"Connection")}" (\`${Be(A==null?void 0:A.valueOwner,T==null?void 0:T.logic,"connection")}\`) input is invalid, missing underlying Connection ID value.`);const x=n.find(H=>{var W,ie;return((ie=(W=H.valueOwner)==null?void 0:W.declaration)==null?void 0:ie.id)===I.inputs.prompt.id}),$=(e=x==null?void 0:x.value)==null?void 0:e.value;if($==null||$==="")throw new Error(`${R}The "${Ve(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"Prompt")}" (\`${Be(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"prompt")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${R}The "${Ve(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"Prompt")}" (\`${Be(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"prompt")}\`) input value is invalid, if present, it must be a non-empty string.`);const U=n.find(H=>{var W,ie;return((ie=(W=H.valueOwner)==null?void 0:W.declaration)==null?void 0:ie.id)===I.inputs.model.id}),q=(f=U==null?void 0:U.value)==null?void 0:f.value;if(q==null||q==="")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 q!="string")throw new Error(`${R}The "${Ve(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"Model")}" (\`${Be(U==null?void 0:U.valueOwner,T==null?void 0:T.logic,"model")}\`) input value is invalid, if present, it must be a non-empty string.`);ui(O),console.log("Triggering Google Gemini generate content action with connectionId:",P);const Z=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:q}},{headers:{"Content-Type":"application/json",Authorization:`Bearer ${await T.getAccessToken()}`}})).data;return pe.Logger.log("[Google Gemini] Generate content action response:",Z),{value:K.Success,error:null,result:{content:Z.content}}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return pe.Logger.error("[Google Gemini] Generate content failed:",g),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:g,result:null}}}})}}class kAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsCreateSpreadsheet,version:"1.0.0",description:"Create Spreadsheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.GoogleSheetsCreateSpreadsheet);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f;try{const y=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!y||!y.env)throw new Error("Editor context or environment missing");const m=Be(t,t.project,"createSpreadsheet"),g="["+Ve(t,t.project,"Create spreadsheet")+": `"+m+"`] ",b=(ie,z,Y)=>{const ee=Ve(ie==null?void 0:ie.valueOwner,y==null?void 0:y.logic,z),J=Be(ie==null?void 0:ie.valueOwner,y==null?void 0:y.logic,Y);return`"${ee}" (\`${J}\`)`},R=n.find(ie=>{var z;return((z=ie.valueOwner.declaration)==null?void 0:z.id)===G.operation[Q.GoogleSheetsCreateSpreadsheet].inputs.connection.id}),I=(s=R==null?void 0:R.value)==null?void 0:s.valueAsType;if(!I||!I.id||!I.name||I.type!==r.DefinitionEntity)throw new Error(`${g}The ${b(R,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const A=ui(I);if(!A)throw new Error(`${g}The ${b(R,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const O=n.find(ie=>{var z;return((z=ie.valueOwner.declaration)==null?void 0:z.id)===G.operation[Q.GoogleSheetsCreateSpreadsheet].inputs.title.id}),P=(u=O==null?void 0:O.value)==null?void 0:u.value;if(P&&typeof P!="string")throw new Error(`${g}The ${b(O,"Title","title")} input value is invalid. If present, it must be a non-empty string. E.g. "My Spreadsheet"`);const $={Authorization:`Bearer ${await y.getAccessToken()}`},U=`${(e=y.env)==null?void 0:e.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${y.projectId}/${Zt["google-sheet"]}/${A}`,q=async ie=>Ht.post(U,ie,{headers:$}),Z={};P&&(Z.properties={title:P});const W=(await q({method:"POST",endpoint:"/v4/spreadsheets",data:Z})).data||{};return{value:K.Success,error:null,result:{spreadsheetId:W.spreadsheetId,spreadsheetUrl:W.spreadsheetUrl}}}catch(y){const m=((f=y.response)==null?void 0:f.data)||y.message||y;return pe.Logger.log("[Google Sheets] error:",m),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:m,result:null}}}})}}function zL(a){let p="",t=a;for(;t>0;){const n=(t-1)%26;p=String.fromCharCode(65+n)+p,t=Math.floor((t-n)/26)}return p}function IV(a){if(!/^[A-Z]{1,3}$/.test(a))return NaN;let p=0;for(let t=0;t<a.length;t++)p=p*26+(a.charCodeAt(t)-64);return p}function cA(a,p){const t=(p==null?void 0:p.errorPrefix)||"";if(typeof a!="string")throw new Error(`${t}Input must be a string.`);let n,s=a;if(a.includes("!")){const R=a.split("!");let I=R.slice(0,-1).join("!");s=R[R.length-1],I.startsWith("'")&&I.endsWith("'")&&(I=I.slice(1,-1)),n=I}const u=/^(\$?[A-Z]{1,3})?(\$?\d+)?(?::(\$?[A-Z]{1,3})?(\$?\d+)?)?$/i,e=s.match(u);if(!e)throw new Error(`${t}Invalid A1 notation format: ${a}`);const[f,y,m,T,g]=e,b={sheet:n};return y&&(b.startColumn=y.toUpperCase()),m&&(b.startRow=m),T&&(b.endColumn=T.toUpperCase()),g&&(b.endRow=g),b}function B4(a,p){const t=p!=null&&p.errorPrefix?p.errorPrefix:"",n=T=>{if(typeof T=="string"){const g=T.replace("$","");return/^\d+$/.test(g)?parseInt(g,10):NaN}return T},s=T=>{if(typeof T=="string"){const g=T.replace("$","").toUpperCase();return/^\d+$/.test(g)?parseInt(g,10):IV(g)}return T},u=n(a.startRow),e=n(a.endRow),f=s(a.startColumn),y=s(a.endColumn),m=T=>typeof T=="string"&&T.includes("{{")&&T.includes("}}");if(a.startRow!==void 0&&a.startRow!==null&&a.startRow!==""&&isNaN(u)&&!m(a.startRow))throw new Error(`${t}Start Row is invalid.`);if(a.endRow!==void 0&&a.endRow!==null&&a.endRow!==""&&isNaN(e)&&!m(a.endRow))throw new Error(`${t}End Row is invalid.`);if(a.startColumn!==void 0&&a.startColumn!==null&&a.startColumn!==""&&isNaN(f)&&!m(a.startColumn))throw new Error(`${t}Start Column is invalid.`);if(a.endColumn!==void 0&&a.endColumn!==null&&a.endColumn!==""&&isNaN(y)&&!m(a.endColumn))throw new Error(`${t}End Column is invalid.`);if(u!=null&&!isNaN(u)&&u<1)throw new Error(`${t}Start Row must be greater than or equal to 1.`);if(e!=null&&!isNaN(e)&&e<1)throw new Error(`${t}End Row must be greater than or equal to 1.`);if(f!=null&&!isNaN(f)&&f<1)throw new Error(`${t}Start Column must be greater than or equal to 1.`);if(y!=null&&!isNaN(y)&&y<1)throw new Error(`${t}End Column must be greater than or equal to 1.`);if(u!=null&&!isNaN(u)&&e!==void 0&&e!==null&&!isNaN(e)&&u>e)throw new Error(`${t}Start Row must be less than or equal to End Row.`);if(f!=null&&!isNaN(f)&&y!==void 0&&y!==null&&!isNaN(y)&&f>y)throw new Error(`${t}Start Column must be less than or equal to End Column.`);if(typeof a.sheet=="number"&&a.sheet<0)throw new Error(`${t}Sheet ID must be greater than or equal to 0.`)}async function Ha(a,p,t){if(!a)return a;let n=a;if(typeof a=="string"){const f=a.trim();if(f.startsWith("{"))try{n=new Function("return "+f)()}catch{try{n=JSON.parse(f)}catch{}}else try{n=cA(f,{errorPrefix:"Internal"})}catch{}}else if(typeof a=="object"&&a!==null)try{n=JSON.parse(JSON.stringify(a))}catch{n={...a}}if(n.sheet===void 0||n.sheet===null||n.sheet==="")return n;const s=typeof n.sheet=="string",u=typeof n.sheet=="number";if(p==="Name"&&s)return n;if(p==="Id"&&u)return n._resolvedSheetId=n.sheet,n;const e=n.sheet;try{const f=await t();for(const y of f){const m=y.id,T=y.name,g=String(T).trim().toLowerCase()===String(e).trim().toLowerCase(),b=String(m)===String(e);if(g||b)return n._resolvedSheetId=m,n._resolvedSheetName=T,n}}catch{}return n}function lv(a,p){if(!a)return"";if(typeof a=="string")return a;let t=a;if(typeof a=="string"&&a.trim().startsWith("{"))try{t=JSON.parse(a)}catch{}if(B4(t,p),t.namedRange&&t.namedRange.trim()!=="")return t.namedRange;const n=t._resolvedSheetName!==void 0?t._resolvedSheetName:typeof t.sheet=="string"?t.sheet:void 0,s=n?`'${n}'!`:"",u=R=>{if(typeof R=="number")return zL(R);if(typeof R=="string"){const I=R.replace("$","");if(/^\d+$/.test(I))return(R.startsWith("$")?"$":"")+zL(parseInt(I,10))}return R||""},e=u(t.startColumn),f=typeof t.startRow=="number"?t.startRow.toString():t.startRow||"",y=u(t.endColumn),m=typeof t.endRow=="number"?t.endRow.toString():t.endRow||"",T=`${e}${f}`,g=`${y}${m}`;if(T&&g)return`${s}${T}:${g}`;if(T)return`${s}${T}`;const b=s.replace(/!$/,"");return b||"A1"}function ps(a,p){if(!a)return{};let t=a;if(typeof a=="string"){const g=a.trim();if(g.startsWith("{"))try{t=new Function("return "+g)()}catch{try{t=JSON.parse(g)}catch{}}else try{t=cA(g,p)}catch{}}B4(t,p);const n={},s=t._resolvedSheetId!==void 0?t._resolvedSheetId:typeof t.sheet=="number"?t.sheet:/^\d+$/.test(String(t.sheet||""))?Number(t.sheet):void 0;s!=null&&!isNaN(s)&&(n.sheetId=s);const u=g=>{if(g==null)return null;if(typeof g=="string"){const b=g.trim().replace("$","");return b===""?null:/^\d+$/.test(b)?parseInt(b,10):NaN}return typeof g=="number"?g:null},e=g=>{if(g==null)return null;if(typeof g=="string"){const b=g.trim().replace("$","").toUpperCase();return b===""?null:/^\d+$/.test(b)?parseInt(b,10):IV(b)}return typeof g=="number"?g:null},f=u(t.startRow),y=u(t.endRow),m=e(t.startColumn),T=e(t.endColumn);return f!=null&&(n.startRowIndex=f-1),y!=null&&(n.endRowIndex=y),m!=null&&(n.startColumnIndex=m-1),T!=null&&(n.endColumnIndex=T),n}function YL(a,p){if(!a)return{};let t=a;if(typeof a=="string")if(a.trim().startsWith("{"))try{t=JSON.parse(a)}catch{t=cA(a,{errorPrefix:"Internal"})}else t=cA(a,{errorPrefix:"Internal"});B4(t,p);const n={},s=t._resolvedSheetId!==void 0?t._resolvedSheetId:typeof t.sheet=="number"?t.sheet:void 0;s!=null&&(n.sheetId=s);const u=g=>{if(g==null)return null;if(typeof g=="string"){const b=g.trim().replace("$","");return b===""?null:/^\d+$/.test(b)?parseInt(b,10):NaN}return typeof g=="number"?g:null},e=g=>{if(g==null)return null;if(typeof g=="string"){const b=g.trim().replace("$","").toUpperCase();return b===""?null:/^\d+$/.test(b)?parseInt(b,10):IV(b)}return typeof g=="number"?g:null},f=u(t.startRow),y=u(t.endRow),m=e(t.startColumn),T=e(t.endColumn);return f!=null&&(!isNaN(f)||y===null&&m===null&&T===null)?(n.dimension="ROWS",n.startIndex=isNaN(f)?NaN:f-1,y!=null?n.endIndex=y:n.endIndex=isNaN(f)?NaN:f):m!=null?(n.dimension="COLUMNS",n.startIndex=isNaN(m)?NaN:m-1,T!=null?n.endIndex=T:n.endIndex=isNaN(m)?NaN:m):f!=null&&(n.dimension="ROWS",n.startIndex=isNaN(f)?NaN:f-1,y!=null?n.endIndex=y:n.endIndex=isNaN(f)?NaN:f),n}function ln(a,p){const t=(p==null?void 0:p.errorPrefix)||"";if(typeof a!="string")throw new Error(`${t}Spreadsheet ID must be a string.`);const n=a.trim();if(n.length===0)throw new Error(`${t}Spreadsheet ID cannot be empty.`);if(n.includes("docs.google.com")||n.startsWith("http://")||n.startsWith("https://")||n.startsWith("www.google.com")){const u=n.match(/\/spreadsheets\/d\/e\/([a-zA-Z0-9-_]+)/);if(u&&u[1])return u[1];const e=n.match(/\/spreadsheets\/d\/([a-zA-Z0-9-_]+)/);if(e&&e[1])return e[1];throw new Error(`${t}Invalid Google Sheet URL format. Could not extract a valid Spreadsheet ID from the URL.`)}if(n.includes(" "))throw new Error(`${t}Spreadsheet ID cannot contain spaces.`);if(/[^a-zA-Z0-9-_]/.test(n))throw new Error(`${t}Spreadsheet ID contains invalid characters. Only alphanumeric characters, dashes, and underscores are allowed.`);return n}function UAt(a){if(!a)return"A1";const p=lv(a);if(!p)return"A1";const t=p.split("!");return t[t.length-1].trim().split(":")[0].trim().replace(/\$/g,"")||"A1"}function S4(a,p,t){if(!p){const f=YL(a,t);return f?[f]:[]}const n=ps(a,t),s=n.sheetId,u=f=>{const y={dimension:f};return s!=null&&(y.sheetId=s),f==="COLUMNS"?(n.startColumnIndex!==void 0&&n.startColumnIndex!==null&&(y.startIndex=n.startColumnIndex),n.endColumnIndex!==void 0&&n.endColumnIndex!==null&&(y.endIndex=n.endColumnIndex)):(n.startRowIndex!==void 0&&n.startRowIndex!==null&&(y.startIndex=n.startRowIndex),n.endRowIndex!==void 0&&n.endRowIndex!==null&&(y.endIndex=n.endRowIndex)),y},e=String(p).trim().toUpperCase();return e==="COLUMNS"?[u("COLUMNS")]:e==="ROWS"?[u("ROWS")]:e==="BOTH"?[u("COLUMNS"),u("ROWS")]:[YL(a,t)]}class KAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsGetSpreadsheet,version:"1.0.0",description:"Get Spreadsheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.Editor])[0];if(!b||!b.env)throw new Error("Editor context or environment missing");const R=Be(t,t.project,"getSpreadsheet"),A="["+Ve(t,t.project,"Get spreadsheet")+": `"+R+"`] ",O=(te,re,ae)=>{const le=Ve(te==null?void 0:te.valueOwner,b==null?void 0:b.logic,re),oe=Be(te==null?void 0:te.valueOwner,b==null?void 0:b.logic,ae);return`"${le}" (\`${oe}\`)`},P=n.find(te=>{var re;return((re=te.valueOwner.declaration)==null?void 0:re.id)===G.operation[Q.GoogleSheetsGetSpreadsheet].inputs.connection.id}),x=(s=P==null?void 0:P.value)==null?void 0:s.valueAsType;if(!x||!x.id||!x.name||x.type!==r.DefinitionEntity)throw new Error(`${A}The ${O(P,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const $=ui(x);if(!$)throw new Error(`${A}The ${O(P,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const U=n.find(te=>{var re;return((re=te.valueOwner.declaration)==null?void 0:re.id)===G.operation[Q.GoogleSheetsGetSpreadsheet].inputs.spreadsheetId.id}),q=(u=U==null?void 0:U.value)==null?void 0:u.value,Z=ln(q,{errorPrefix:`${A}The ${O(U,"Spreadsheet ID","spreadsheetId")} input `}),W={Authorization:`Bearer ${await b.getAccessToken()}`},ie=`${(e=b.env)==null?void 0:e.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${b.projectId}/${Zt["google-sheet"]}/${$}`,ee=(await(async te=>Ht.post(ie,te,{headers:W}))({method:"GET",endpoint:`/v4/spreadsheets/${Z}`})).data||{},J=(ee.sheets||[]).map(te=>{var re,ae,le,oe,ce,ge,Ce,Ee,Oe,Le,Fe,tt,We;return{sheetId:(re=te.properties)==null?void 0:re.sheetId,title:(ae=te.properties)==null?void 0:ae.title,index:(le=te.properties)==null?void 0:le.index,sheetType:(oe=te.properties)==null?void 0:oe.sheetType,rowCount:(ge=(ce=te.properties)==null?void 0:ce.gridProperties)==null?void 0:ge.rowCount,columnCount:(Ee=(Ce=te.properties)==null?void 0:Ce.gridProperties)==null?void 0:Ee.columnCount,frozenRowCount:(Le=(Oe=te.properties)==null?void 0:Oe.gridProperties)==null?void 0:Le.frozenRowCount,frozenColumnCount:(tt=(Fe=te.properties)==null?void 0:Fe.gridProperties)==null?void 0:tt.frozenColumnCount,hidden:((We=te.properties)==null?void 0:We.hidden)??!1}});return{value:K.Success,error:null,result:{spreadsheetId:ee.spreadsheetId,title:(f=ee.properties)==null?void 0:f.title,spreadsheetUrl:ee.spreadsheetUrl,locale:(y=ee.properties)==null?void 0:y.locale,timeZone:(m=ee.properties)==null?void 0:m.timeZone,autoRecalc:(T=ee.properties)==null?void 0:T.autoRecalc,sheets:J}}}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+Q.GoogleSheetsAddSheet,version:"1.0.0",description:"Add Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.Editor])[0];if(!b||!b.env)throw new Error("Editor context or environment missing");const R=Be(t,t.project,"addSheet"),A="["+Ve(t,t.project,"Add sheet")+": `"+R+"`] ",O=(oe,ce,ge)=>{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,ge);return`"${Ce}" (\`${Ee}\`)`},P=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[Q.GoogleSheetsAddSheet].inputs.connection.id}),x=(s=P==null?void 0:P.value)==null?void 0:s.valueAsType;if(!x||!x.id||!x.name||x.type!==r.DefinitionEntity)throw new Error(`${A}The ${O(P,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const $=ui(x);if(!$)throw new Error(`${A}The ${O(P,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const U=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[Q.GoogleSheetsAddSheet].inputs.spreadsheetId.id}),q=(u=U==null?void 0:U.value)==null?void 0:u.value,Z=ln(q,{errorPrefix:`${A}The ${O(U,"Spreadsheet ID","spreadsheetId")} input `}),H=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[Q.GoogleSheetsAddSheet].inputs.title.id}),W=(e=H==null?void 0:H.value)==null?void 0:e.value;if(W!=null&&typeof W!="string")throw new Error(`${A}The ${O(H,"Title","title")} input value is invalid. If present, it must be a string. E.g. "New Sheet"`);const z={Authorization:`Bearer ${await b.getAccessToken()}`},Y=`${(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(Y,oe,{headers:z}))({method:"POST",endpoint:`/v4/spreadsheets/${Z}:batchUpdate`,data:{requests:[{addSheet:{properties:{title:W}}}]}})).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+Q.GoogleSheetsDeleteSheet,version:"1.0.0",description:"Delete Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.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=(J,te,re)=>{const ae=Ve(J==null?void 0:J.valueOwner,g==null?void 0:g.logic,te),le=Be(J==null?void 0:J.valueOwner,g==null?void 0:g.logic,re);return`"${ae}" (\`${le}\`)`},O=n.find(J=>{var te;return((te=J.valueOwner.declaration)==null?void 0:te.id)===G.operation[Q.GoogleSheetsDeleteSheet].inputs.connection.id}),P=(s=O==null?void 0:O.value)==null?void 0:s.valueAsType;if(!P||!P.id||!P.name||P.type!==r.DefinitionEntity)throw new Error(`${I}The ${A(O,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=ui(P);if(!x)throw new Error(`${I}The ${A(O,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const $=n.find(J=>{var te;return((te=J.valueOwner.declaration)==null?void 0:te.id)===G.operation[Q.GoogleSheetsDeleteSheet].inputs.spreadsheetId.id}),U=(u=$==null?void 0:$.value)==null?void 0:u.value,q=ln(U,{errorPrefix:`${I}The ${A($,"Spreadsheet ID","spreadsheetId")} input `}),Z=n.find(J=>{var te;return((te=J.valueOwner.declaration)==null?void 0:te.id)===G.operation[Q.GoogleSheetsDeleteSheet].inputs.sheetId.id}),H=(e=Z==null?void 0:Z.value)==null?void 0:e.value;if(H==null||H==="")throw new Error(`${I}The ${A(Z,"Sheet (ID or name)","sheetId")} input is missing.`);const ie={Authorization:`Bearer ${await g.getAccessToken()}`},z=`${(f=g.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${g.projectId}/${Zt["google-sheet"]}/${x}`,Y=async J=>Ht.post(z,J,{headers:ie});let ee;if(typeof H=="number")ee=H;else if(typeof H=="string"){const J=H.trim(),te=await Y({method:"GET",endpoint:`/v4/spreadsheets/${q}?fields=sheets.properties(sheetId,title)`}).catch(()=>null),ae=(((y=te==null?void 0:te.data)==null?void 0:y.sheets)||[]).find(le=>{var oe,ce;return((oe=le.properties)==null?void 0:oe.title)===J||String((ce=le.properties)==null?void 0:ce.sheetId)===J});if(ae&&((m=ae.properties)==null?void 0:m.sheetId)!==void 0)ee=ae.properties.sheetId;else if(/^\d+$/.test(J))ee=parseInt(J,10);else throw new Error(`${I}Sheet "${H}" was not found in the spreadsheet.`)}else throw new Error(`${I}The ${A(Z,"Sheet (ID or name)","sheetId")} input value is invalid. It must be a number or string.`);return await Y({method:"POST",endpoint:`/v4/spreadsheets/${q}:batchUpdate`,data:{requests:[{deleteSheet:{sheetId:ee}}]}}),{value:K.Success,error:null,result:null}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return pe.Logger.log("[Google Sheets] error:",b),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:b,result:null}}}})}}class ZAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsAppendRows,version:"1.0.0",description:"Append Row(s) Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.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,ge)=>{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,ge);return`"${Ce}" (\`${Ee}\`)`},O=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[Q.GoogleSheetsAppendRows].inputs.connection.id}),P=(s=O==null?void 0:O.value)==null?void 0:s.valueAsType;if(!P||!P.id||!P.name||P.type!==r.DefinitionEntity)throw new Error(`${I}The ${A(O,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=ui(P);if(!x)throw new Error(`${I}The ${A(O,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const $=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[Q.GoogleSheetsAppendRows].inputs.spreadsheetId.id}),U=(u=$==null?void 0:$.value)==null?void 0:u.value,q=ln(U,{errorPrefix:`${I}The ${A($,"Spreadsheet ID","spreadsheetId")} input `}),Z=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[Q.GoogleSheetsAppendRows].inputs.range.id}),H=(e=Z==null?void 0:Z.value)==null?void 0:e.value;if(!H||H==="")throw new Error(`${I}The ${A(Z,"Range","range")} input is missing.`);const W=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[Q.GoogleSheetsAppendRows].inputs.values.id}),ie=(f=W==null?void 0:W.value)==null?void 0:f.value;if(ie==null)throw new Error(`${I}The ${A(W,"Values","values")} input is missing.`);const Y={Authorization:`Bearer ${await g.getAccessToken()}`},ee=`${(y=g.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${g.projectId}/${Zt["google-sheet"]}/${x}`,J=async oe=>Ht.post(ee,oe,{headers:Y});let te=ie;if(typeof ie=="string")try{te=JSON.parse(ie)}catch{}const re=await Ha(H,"Name",async()=>{var ce;return(((ce=(await J({method:"GET",endpoint:`/v4/spreadsheets/${q}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:ce.sheets)||[]).map(ge=>{var Ce,Ee;return{id:(Ce=ge.properties)==null?void 0:Ce.sheetId,name:(Ee=ge.properties)==null?void 0:Ee.title}})}),le=(await J({method:"POST",endpoint:`/v4/spreadsheets/${q}/values/${lv(re,{errorPrefix:`${I}The ${A(Z,"Range","range")} input `})}:append`,params:{valueInputOption:"USER_ENTERED"},data:{values:Array.isArray(te)?te:[te]}})).data||{};return{value:K.Success,error:null,result:{updatedRange:(m=le.updates)==null?void 0:m.updatedRange}}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return pe.Logger.log("[Google Sheets] error:",b),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:b,result:null}}}})}}class HAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsGetRangeValues,version:"1.0.0",description:"Get Range Values Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.GoogleSheetsGetRangeValues);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"getRangeValues"),b="["+Ve(t,t.project,"Get range values")+": `"+T+"`] ",R=(te,re,ae)=>{const le=Ve(te==null?void 0:te.valueOwner,m==null?void 0:m.logic,re),oe=Be(te==null?void 0:te.valueOwner,m==null?void 0:m.logic,ae);return`"${le}" (\`${oe}\`)`},I=n.find(te=>{var re;return((re=te.valueOwner.declaration)==null?void 0:re.id)===G.operation[Q.GoogleSheetsGetRangeValues].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(A);if(!O)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(te=>{var re;return((re=te.valueOwner.declaration)==null?void 0:re.id)===G.operation[Q.GoogleSheetsGetRangeValues].inputs.spreadsheetId.id}),x=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(x,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(te=>{var re;return((re=te.valueOwner.declaration)==null?void 0:re.id)===G.operation[Q.GoogleSheetsGetRangeValues].inputs.range.id}),q=(e=U==null?void 0:U.value)==null?void 0:e.value;if(!q||q==="")throw new Error(`${b}The ${R(U,"Range","range")} input is missing.`);const H={Authorization:`Bearer ${await m.getAccessToken()}`},W=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${O}`,ie=async te=>Ht.post(W,te,{headers:H}),z=await Ha(q,"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}})}),Y=lv(z,{errorPrefix:`${b}The ${R(U,"Range","range")} input `}),J=(await ie({method:"GET",endpoint:`/v4/spreadsheets/${$}/values/${encodeURIComponent(Y)}`})).data||{};return{value:K.Success,error:null,result:{values:J.values}}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class WAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsUpdateRangeValues,version:"1.0.0",description:"Update Range Values Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.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 ge=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`"${ge}" (\`${Ce}\`)`},A=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[Q.GoogleSheetsUpdateRangeValues].inputs.connection.id}),O=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${R}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const P=ui(O);if(!P)throw new Error(`${R}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[Q.GoogleSheetsUpdateRangeValues].inputs.spreadsheetId.id}),$=(u=x==null?void 0:x.value)==null?void 0:u.value,U=ln($,{errorPrefix:`${R}The ${I(x,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[Q.GoogleSheetsUpdateRangeValues].inputs.range.id}),Z=(e=q==null?void 0:q.value)==null?void 0:e.value;if(!Z||Z==="")throw new Error(`${R}The ${I(q,"Range","range")} input is missing.`);const H=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[Q.GoogleSheetsUpdateRangeValues].inputs.values.id}),W=(f=H==null?void 0:H.value)==null?void 0:f.value;if(W==null)throw new Error(`${R}The ${I(H,"Values","values")} input is missing.`);const z={Authorization:`Bearer ${await T.getAccessToken()}`},Y=`${(y=T.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${T.projectId}/${Zt["google-sheet"]}/${P}`,ee=async le=>Ht.post(Y,le,{headers:z});let J=W;if(typeof W=="string")try{J=JSON.parse(W)}catch{}const te=await Ha(Z,"Name",async()=>{var oe;return(((oe=(await ee({method:"GET",endpoint:`/v4/spreadsheets/${U}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:oe.sheets)||[]).map(ce=>{var ge,Ce;return{id:(ge=ce.properties)==null?void 0:ge.sheetId,name:(Ce=ce.properties)==null?void 0:Ce.title}})}),ae=(await ee({method:"PUT",endpoint:`/v4/spreadsheets/${U}/values/${lv(te,{errorPrefix:`${R}The ${I(q,"Range","range")} input `})}`,params:{valueInputOption:"USER_ENTERED"},data:{values:Array.isArray(J)?J:[J]}})).data||{};return{value:K.Success,error:null,result:{updatedRange:ae.updatedRange}}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return pe.Logger.log("[Google Sheets] error:",g),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:g,result:null}}}})}}class zAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsClearRange,version:"1.0.0",description:"Clear Range Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.GoogleSheetsClearRange);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"clearRange"),b="["+Ve(t,t.project,"Clear range")+": `"+T+"`] ",R=(J,te,re)=>{const ae=Ve(J==null?void 0:J.valueOwner,m==null?void 0:m.logic,te),le=Be(J==null?void 0:J.valueOwner,m==null?void 0:m.logic,re);return`"${ae}" (\`${le}\`)`},I=n.find(J=>{var te;return((te=J.valueOwner.declaration)==null?void 0:te.id)===G.operation[Q.GoogleSheetsClearRange].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(A);if(!O)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(J=>{var te;return((te=J.valueOwner.declaration)==null?void 0:te.id)===G.operation[Q.GoogleSheetsClearRange].inputs.spreadsheetId.id}),x=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(x,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(J=>{var te;return((te=J.valueOwner.declaration)==null?void 0:te.id)===G.operation[Q.GoogleSheetsClearRange].inputs.range.id}),q=(e=U==null?void 0:U.value)==null?void 0:e.value;if(!q||q==="")throw new Error(`${b}The ${R(U,"Range","range")} input is missing.`);const H={Authorization:`Bearer ${await m.getAccessToken()}`},W=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${O}`,ie=async J=>Ht.post(W,J,{headers:H}),z=await Ha(q,"Name",async()=>{var te;return(((te=(await ie({method:"GET",endpoint:`/v4/spreadsheets/${$}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:te.sheets)||[]).map(re=>{var ae,le;return{id:(ae=re.properties)==null?void 0:ae.sheetId,name:(le=re.properties)==null?void 0:le.title}})}),ee=(await ie({method:"POST",endpoint:`/v4/spreadsheets/${$}/values/${lv(z,{errorPrefix:`${b}The ${R(U,"Range","range")} input `})}:clear`,data:{}})).data||{};return{value:K.Success,error:null,result:{clearedRange:ee.clearedRange}}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class YAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsBatchUpdateSpreadsheet,version:"1.0.0",description:"Batch Update Spreadsheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.GoogleSheetsBatchUpdateSpreadsheet);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"batchUpdateSpreadsheet"),b="["+Ve(t,t.project,"Batch update spreadsheet")+": `"+T+"`] ",R=(J,te,re)=>{const ae=Ve(J==null?void 0:J.valueOwner,m==null?void 0:m.logic,te),le=Be(J==null?void 0:J.valueOwner,m==null?void 0:m.logic,re);return`"${ae}" (\`${le}\`)`},I=n.find(J=>{var te;return((te=J.valueOwner.declaration)==null?void 0:te.id)===G.operation[Q.GoogleSheetsBatchUpdateSpreadsheet].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(A);if(!O)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(J=>{var te;return((te=J.valueOwner.declaration)==null?void 0:te.id)===G.operation[Q.GoogleSheetsBatchUpdateSpreadsheet].inputs.spreadsheetId.id}),x=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(x,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(J=>{var te;return((te=J.valueOwner.declaration)==null?void 0:te.id)===G.operation[Q.GoogleSheetsBatchUpdateSpreadsheet].inputs.requests.id}),q=(e=U==null?void 0:U.value)==null?void 0:e.value;if(q==null||q==="")throw new Error(`${b}The ${R(U,"Requests","requests")} input is missing.`);let Z=q;if(typeof q=="string")try{Z=JSON.parse(q)}catch{}if(Array.isArray(Z)||(Z=[Z]),Z.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 W={Authorization:`Bearer ${await m.getAccessToken()}`},ie=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${O}`,ee=(await(async J=>Ht.post(ie,J,{headers:W}))({method:"POST",endpoint:`/v4/spreadsheets/${$}:batchUpdate`,data:{requests:Z}})).data||{};return{value:K.Success,result:{replies:ee.replies||[]},error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class JAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsRenameSheet,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.Editor])[0];if(!b||!b.env)throw new Error("Editor context or environment missing");const R=Be(t,t.project,"renameSheet"),A="["+Ve(t,t.project,"Rename sheet")+": `"+R+"`] ",O=(oe,ce,ge)=>{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,ge);return`"${Ce}" (\`${Ee}\`)`},P=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[Q.GoogleSheetsRenameSheet].inputs.connection.id}),x=(s=P==null?void 0:P.value)==null?void 0:s.valueAsType;if(!x||!x.id||!x.name||x.type!==r.DefinitionEntity)throw new Error(`${A}The ${O(P,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const $=ui(x);if(!$)throw new Error(`${A}The ${O(P,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const U=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[Q.GoogleSheetsRenameSheet].inputs.spreadsheetId.id}),q=(u=U==null?void 0:U.value)==null?void 0:u.value,Z=ln(q,{errorPrefix:`${A}The ${O(U,"Spreadsheet ID","spreadsheetId")} input `}),H=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[Q.GoogleSheetsRenameSheet].inputs.sheetId.id}),W=(e=H==null?void 0:H.value)==null?void 0:e.value;if(W==null||W==="")throw new Error(`${A}The ${O(H,"Sheet (ID or name)","sheetId")} input is missing.`);const ie=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[Q.GoogleSheetsRenameSheet].inputs.title.id}),z=(f=ie==null?void 0:ie.value)==null?void 0:f.value;if(z!=null&&typeof z!="string")throw new Error(`${A}The ${O(ie,"Title","title")} input value is invalid, if present, it must be a string.`);const ee={Authorization:`Bearer ${await b.getAccessToken()}`},J=`${(y=b.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${b.projectId}/${Zt["google-sheet"]}/${$}`,te=async oe=>Ht.post(J,oe,{headers:ee});let re;if(typeof W=="number")re=W;else if(typeof W=="string"){const oe=W.trim(),ce=await te({method:"GET",endpoint:`/v4/spreadsheets/${Z}?fields=sheets.properties(sheetId,title)`}).catch(()=>null),Ce=(((m=ce==null?void 0:ce.data)==null?void 0:m.sheets)||[]).find(Ee=>{var Oe,Le;return((Oe=Ee.properties)==null?void 0:Oe.title)===oe||String((Le=Ee.properties)==null?void 0:Le.sheetId)===oe});if(Ce&&((T=Ce.properties)==null?void 0:T.sheetId)!==void 0)re=Ce.properties.sheetId;else if(/^\d+$/.test(oe))re=parseInt(oe,10);else throw new Error(`${A}Sheet "${W}" was not found in the spreadsheet.`)}else throw new Error(`${A}The ${O(H,"Sheet (ID or name)","sheetId")} input value is invalid. It must be a number or string.`);const ae={sheetId:re},le=[];return ae.title=z||"",le.push("title"),await te({method:"POST",endpoint:`/v4/spreadsheets/${Z}:batchUpdate`,data:{requests:[{updateSheetProperties:{properties:ae,fields:le.join(",")}}]}}),{value:K.Success,result:null,error:null}}catch(b){const R=((g=b.response)==null?void 0:g.data)||b.message||b;return pe.Logger.log("[Google Sheets] error:",R),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:R,result:null}}}})}}class QAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsCopySheet,version:"1.0.0",description:"Copy Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.Editor])[0];if(!R||!R.env)throw new Error("Editor context or environment missing");const I=Be(t,t.project,"copySheet"),O="["+Ve(t,t.project,"Copy sheet")+": `"+I+"`] ",P=(Oe,Le,Fe)=>{const tt=Ve(Oe==null?void 0:Oe.valueOwner,R==null?void 0:R.logic,Le),We=Be(Oe==null?void 0:Oe.valueOwner,R==null?void 0:R.logic,Fe);return`"${tt}" (\`${We}\`)`},x=n.find(Oe=>{var Le;return((Le=Oe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[Q.GoogleSheetsCopySheet].inputs.connection.id}),$=(s=x==null?void 0:x.value)==null?void 0:s.valueAsType;if(!$||!$.id||!$.name||$.type!==r.DefinitionEntity)throw new Error(`${O}The ${P(x,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const U=ui($);if(!U)throw new Error(`${O}The ${P(x,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const q=n.find(Oe=>{var Le;return((Le=Oe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[Q.GoogleSheetsCopySheet].inputs.spreadsheetId.id}),Z=(u=q==null?void 0:q.value)==null?void 0:u.value,H=ln(Z,{errorPrefix:`${O}The ${P(q,"Spreadsheet ID","spreadsheetId")} input `}),W=n.find(Oe=>{var Le;return((Le=Oe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[Q.GoogleSheetsCopySheet].inputs.sheetId.id}),ie=(e=W==null?void 0:W.value)==null?void 0:e.value;if(ie==null||ie==="")throw new Error(`${O}The ${P(W,"Sheet (ID or name)","sheetId")} input is missing.`);const z=n.find(Oe=>{var Le;return((Le=Oe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[Q.GoogleSheetsCopySheet].inputs.destinationSpreadsheetId.id}),Y=(f=z==null?void 0:z.value)==null?void 0:f.value;let ee=H;if(Y!=null&&String(Y).trim()!==""){if(typeof Y!="string")throw new Error(`${O}The ${P(z,"Destination Spreadsheet ID","destinationSpreadsheetId")} input value is invalid, if present, it must be a string.`);ee=ln(Y,{errorPrefix:`${O}The ${P(z,"Destination Spreadsheet ID","destinationSpreadsheetId")} input `})}const J=n.find(Oe=>{var Le;return((Le=Oe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[Q.GoogleSheetsCopySheet].inputs.newSheetName.id}),te=(y=J==null?void 0:J.value)==null?void 0:y.value;if(te!=null&&typeof te!="string")throw new Error(`${O}The ${P(J,"New Sheet Name","newSheetName")} input value is invalid, if present, it must be a string.`);const ae={Authorization:`Bearer ${await R.getAccessToken()}`},le=`${(m=R.env)==null?void 0:m.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${R.projectId}/${Zt["google-sheet"]}/${U}`,oe=async Oe=>Ht.post(le,Oe,{headers:ae});let ce;if(typeof ie=="number")ce=ie;else if(typeof ie=="string"){const Oe=ie.trim(),Le=await oe({method:"GET",endpoint:`/v4/spreadsheets/${H}?fields=sheets.properties(sheetId,title)`}).catch(()=>null),tt=(((T=Le==null?void 0:Le.data)==null?void 0:T.sheets)||[]).find(We=>{var et,qe;return((et=We.properties)==null?void 0:et.title)===Oe||String((qe=We.properties)==null?void 0:qe.sheetId)===Oe});if(tt&&((g=tt.properties)==null?void 0:g.sheetId)!==void 0)ce=tt.properties.sheetId;else if(/^\d+$/.test(Oe))ce=parseInt(Oe,10);else throw new Error(`${O}Sheet "${ie}" was not found in the source spreadsheet.`)}else throw new Error(`${O}The ${P(W,"Sheet (ID or name)","sheetId")} input value is invalid. It must be a number or string.`);const Ee=((await oe({method:"POST",endpoint:`/v4/spreadsheets/${H}/sheets/${ce}:copyTo`,data:{destinationSpreadsheetId:ee}})).data||{}).sheetId;return te&&typeof te=="string"&&te.trim()!==""&&await oe({method:"POST",endpoint:`/v4/spreadsheets/${ee}:batchUpdate`,data:{requests:[{updateSheetProperties:{properties:{sheetId:Ee,title:te.trim()},fields:"title"}}]}}),{value:K.Success,result:{newSheetId:Ee},error:null}}catch(R){const I=((b=R.response)==null?void 0:b.data)||R.message||R;return pe.Logger.log("[Google Sheets] error:",I),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:I,result:null}}}})}}class XAt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsClearSheet,version:"1.0.0",description:"Clear Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.Editor])[0];if(!R||!R.env)throw new Error("Editor context or environment missing");const I=Be(t,t.project,"clearSheet"),O="["+Ve(t,t.project,"Clear sheet")+": `"+I+"`] ",P=(le,oe,ce)=>{const ge=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`"${ge}" (\`${Ce}\`)`},x=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[Q.GoogleSheetsClearSheet].inputs.connection.id}),$=(s=x==null?void 0:x.value)==null?void 0:s.valueAsType;if(!$||!$.id||!$.name||$.type!==r.DefinitionEntity)throw new Error(`${O}The ${P(x,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const U=ui($);if(!U)throw new Error(`${O}The ${P(x,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const q=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[Q.GoogleSheetsClearSheet].inputs.spreadsheetId.id}),Z=(u=q==null?void 0:q.value)==null?void 0:u.value,H=ln(Z,{errorPrefix:`${O}The ${P(q,"Spreadsheet ID","spreadsheetId")} input `}),W=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[Q.GoogleSheetsClearSheet].inputs.sheetName.id}),ie=(e=W==null?void 0:W.value)==null?void 0:e.value;if(ie==null||ie==="")throw new Error(`${O}The ${P(W,"Sheet (ID or name)","sheetName")} input is missing.`);const Y={Authorization:`Bearer ${await R.getAccessToken()}`},ee=`${(f=R.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${R.projectId}/${Zt["google-sheet"]}/${U}`,J=async le=>Ht.post(ee,le,{headers:Y});let te;if(typeof ie=="string"){const le=ie.trim();if(/^\d+$/.test(le)){const oe=await J({method:"GET",endpoint:`/v4/spreadsheets/${H}?fields=sheets.properties(sheetId,title)`}).catch(()=>null),ge=(((y=oe==null?void 0:oe.data)==null?void 0:y.sheets)||[]).find(Ce=>{var Ee,Oe;return String((Ee=Ce.properties)==null?void 0:Ee.sheetId)===le||((Oe=Ce.properties)==null?void 0:Oe.title)===le});te=((m=ge==null?void 0:ge.properties)==null?void 0:m.title)||le}else te=le}else if(typeof ie=="number"){const ce=(((T=(await J({method:"GET",endpoint:`/v4/spreadsheets/${H}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:T.sheets)||[]).find(ge=>{var Ce;return Number((Ce=ge.properties)==null?void 0:Ce.sheetId)===ie});if(!ce||!((g=ce.properties)!=null&&g.title))throw new Error(`${O}Sheet with ID ${ie} was not found in the spreadsheet.`);te=ce.properties.title}else throw new Error(`${O}The ${P(W,"Sheet (ID or name)","sheetName")} input value is invalid. It must be a number or string.`);const ae=(await J({method:"POST",endpoint:`/v4/spreadsheets/${H}/values/${encodeURIComponent(te)}:clear`,data:{}})).data||{};return{value:K.Success,result:{clearedRange:ae.clearedRange},error:null}}catch(R){const I=((b=R.response)==null?void 0:b.data)||R.message||R;return pe.Logger.log("[Google Sheets] error:",I),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:I,result:null}}}})}}class e1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsBatchGetValues,version:"1.0.0",description:"Batch Get Values Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.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,ge,Ce)=>{const Ee=Ve(ce==null?void 0:ce.valueOwner,g==null?void 0:g.logic,ge),Oe=Be(ce==null?void 0:ce.valueOwner,g==null?void 0:g.logic,Ce);return`"${Ee}" (\`${Oe}\`)`},O=n.find(ce=>{var ge;return((ge=ce.valueOwner.declaration)==null?void 0:ge.id)===G.operation[Q.GoogleSheetsBatchGetValues].inputs.connection.id}),P=(s=O==null?void 0:O.value)==null?void 0:s.valueAsType;if(!P||!P.id||!P.name||P.type!==r.DefinitionEntity)throw new Error(`${I}The ${A(O,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=ui(P);if(!x)throw new Error(`${I}The ${A(O,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const $=n.find(ce=>{var ge;return((ge=ce.valueOwner.declaration)==null?void 0:ge.id)===G.operation[Q.GoogleSheetsBatchGetValues].inputs.spreadsheetId.id}),U=(u=$==null?void 0:$.value)==null?void 0:u.value,q=ln(U,{errorPrefix:`${I}The ${A($,"Spreadsheet ID","spreadsheetId")} input `}),Z=n.find(ce=>{var ge;return((ge=ce.valueOwner.declaration)==null?void 0:ge.id)===G.operation[Q.GoogleSheetsBatchGetValues].inputs.ranges.id}),H=(e=Z==null?void 0:Z.value)==null?void 0:e.value;if(H==null||H==="")throw new Error(`${I}The ${A(Z,"Ranges","ranges")} input is missing.`);const ie={Authorization:`Bearer ${await g.getAccessToken()}`},z=`${(f=g.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${g.projectId}/${Zt["google-sheet"]}/${x}`,Y=async ce=>Ht.post(z,ce,{headers:ie});let ee=Array.isArray(H)?H:[H];if(ee.length===0)throw new Error(`${I}The ${A(Z,"Ranges","ranges")} input evaluated to an empty array. E.g. ["Sheet1!A1:B2"]`);let J=new Set;try{const ge=((y=(await Y({method:"GET",endpoint:`/v4/spreadsheets/${q}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:y.sheets)||[];J=new Set(ge.map(Ce=>{var Ee;return(Ee=Ce.properties)==null?void 0:Ee.title}).filter(Boolean))}catch{}const te=ce=>{const ge=ce.indexOf("!");if(ge>-1){let Ce=ce.substring(0,ge).trim();return Ce.startsWith("'")&&Ce.endsWith("'")&&(Ce=Ce.slice(1,-1)),Ce}return null},re=[],ae=[];for(const ce of ee){const ge=lv(ce,{errorPrefix:`${I}The ${A(Z,"Ranges","ranges")} input `}),Ce=te(ge);Ce&&J.size>0&&!J.has(Ce)?ae.push({range:ge,majorDimension:"ROWS",values:[]}):re.push({a1Range:ge})}let le=[];re.length>0&&(le=(((m=(await Y({method:"POST",endpoint:`/v4/spreadsheets/${q}/values:batchGetByDataFilter`,data:{dataFilters:re}})).data)==null?void 0:m.valueRanges)||[]).map(Ce=>Ce.valueRange||Ce));const oe=[...le,...ae];return{value:K.Success,result:{valueRanges:oe},error:null}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return pe.Logger.log("[Google Sheets] error:",b),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:b,result:null}}}})}}function fo(a){if(!a||typeof a!="object")return;const p={};return typeof a.red=="number"&&(p.red=a.red>1?a.red/255:a.red),typeof a.green=="number"&&(p.green=a.green>1?a.green/255:a.green),typeof a.blue=="number"&&(p.blue=a.blue>1?a.blue/255:a.blue),typeof a.alpha=="number"&&(p.alpha=a.alpha),Object.keys(p).length>0?p:void 0}class t1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsFormatCells,version:"1.0.0",description:"Format Cells Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.GoogleSheetsFormatCells);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=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[Q.GoogleSheetsFormatCells].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(A);if(!O)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(ft=>{var Et;return((Et=ft.valueOwner.declaration)==null?void 0:Et.id)===G.operation[Q.GoogleSheetsFormatCells].inputs.spreadsheetId.id}),x=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(x,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(ft=>{var Et;return((Et=ft.valueOwner.declaration)==null?void 0:Et.id)===G.operation[Q.GoogleSheetsFormatCells].inputs.range.id}),q=(e=U==null?void 0:U.value)==null?void 0:e.value;if(q==null)throw new Error(`${b}The ${R(U,"Range","range")} input is missing.`);const H={Authorization:`Bearer ${await m.getAccessToken()}`},W=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${O}`,ie=async ft=>Ht.post(W,ft,{headers:H}),z=await Ha(q,"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}))),Y=ps(z,{errorPrefix:`${b}The ${R(U,"Range","range")} input `}),ee=G.operation[Q.GoogleSheetsFormatCells].inputs,J=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},te=J(ee.bold.id),re=J(ee.italic.id),ae=J(ee.underline.id),le=J(ee.strikethrough.id),oe=J(ee.fontSize.id),ce=J(ee.fontFamily.id),ge=J(ee.textColor.id),Ce=J(ee.backgroundColor.id),Ee=J(ee.horizontalAlignment.id),Oe=J(ee.verticalAlignment.id),Le=J(ee.wrapStrategy.id),Fe={},tt=[],We={},et=[];typeof te=="boolean"&&(We.bold=te,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(ge);qe&&(We.foregroundColor=qe,et.push("foregroundColor")),et.length>0&&(Fe.textFormat=We,tt.push(`userEnteredFormat.textFormat(${et.join(",")})`));const ot=fo(Ce);if(ot&&(Fe.backgroundColor=ot,tt.push("userEnteredFormat.backgroundColor")),typeof Ee=="string"&&Ee!==""){const ft={Left:"LEFT",Center:"CENTER",Right:"RIGHT",Justify:"JUSTIFY"};Fe.horizontalAlignment=ft[Ee]||Ee.toUpperCase(),tt.push("userEnteredFormat.horizontalAlignment")}if(typeof Oe=="string"&&Oe!==""){const ft={Top:"TOP",Middle:"MIDDLE",Bottom:"BOTTOM"};Fe.verticalAlignment=ft[Oe]||Oe.toUpperCase(),tt.push("userEnteredFormat.verticalAlignment")}if(typeof Le=="string"&&Le!==""){const ft={"Overflow cell":"OVERFLOW_CELL","Wrap text":"WRAP","Clip text":"CLIP"};Fe.wrapStrategy=ft[Le]||Le.toUpperCase(),tt.push("userEnteredFormat.wrapStrategy")}if(tt.length===0)return{value:K.Success,result:null,error:null};const st={repeatCell:{range:Y,cell:{userEnteredFormat:Fe},fields:tt.join(",")}};return await ie({method:"POST",endpoint:`/v4/spreadsheets/${$}:batchUpdate`,data:{requests:[st]}}),{value:K.Success,result:null,error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class i1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsSetNumberFormat,version:"1.0.0",description:"Set Number Format Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.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),ge=Be(ae==null?void 0:ae.valueOwner,T==null?void 0:T.logic,oe);return`"${ce}" (\`${ge}\`)`},A=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[Q.GoogleSheetsSetNumberFormat].inputs.connection.id}),O=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${R}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const P=ui(O);if(!P)throw new Error(`${R}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[Q.GoogleSheetsSetNumberFormat].inputs.spreadsheetId.id}),$=(u=x==null?void 0:x.value)==null?void 0:u.value,U=ln($,{errorPrefix:`${R}The ${I(x,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[Q.GoogleSheetsSetNumberFormat].inputs.range.id}),Z=(e=q==null?void 0:q.value)==null?void 0:e.value;if(Z==null)throw new Error(`${R}The ${I(q,"Range","range")} input is missing.`);const W={Authorization:`Bearer ${await T.getAccessToken()}`},ie=`${(f=T.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${T.projectId}/${Zt["google-sheet"]}/${P}`,z=async ae=>Ht.post(ie,ae,{headers:W}),Y=await Ha(Z,"Id",async()=>(await z({method:"GET",endpoint:`/v4/spreadsheets/${U}?fields=sheets.properties(sheetId,title)`})).data.sheets.map(le=>({id:le.properties.sheetId,name:le.properties.title}))),ee=ps(Y,{errorPrefix:`${R}The ${I(q,"Range","range")} input `}),J=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[Q.GoogleSheetsSetNumberFormat].inputs.pattern.id}),te=(y=J==null?void 0:J.value)==null?void 0:y.value;if(te==null||te==="")throw new Error(`${R}The ${I(J,"Pattern","pattern")} input is missing.`);if(typeof te!="string")throw new Error(`${R}The ${I(J,"Pattern","pattern")} input value is invalid. It must be a string.`);const re={repeatCell:{range:ee,cell:{userEnteredFormat:{numberFormat:{type:"CUSTOM",pattern:te}}},fields:"userEnteredFormat.numberFormat"}};return await z({method:"POST",endpoint:`/v4/spreadsheets/${U}:batchUpdate`,data:{requests:[re]}}),{value:K.Success,result:null,error:null}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return pe.Logger.log("[Google Sheets] error:",g),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:g,result:null}}}})}}class n1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsMergeCells,version:"1.0.0",description:"Merge Cells Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.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,ge)=>{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,ge);return`"${Ce}" (\`${Ee}\`)`},A=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[Q.GoogleSheetsMergeCells].inputs.connection.id}),O=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${R}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const P=ui(O);if(!P)throw new Error(`${R}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[Q.GoogleSheetsMergeCells].inputs.spreadsheetId.id}),$=(u=x==null?void 0:x.value)==null?void 0:u.value,U=ln($,{errorPrefix:`${R}The ${I(x,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[Q.GoogleSheetsMergeCells].inputs.range.id}),Z=(e=q==null?void 0:q.value)==null?void 0:e.value;if(!Z||Z==="")throw new Error(`${R}The ${I(q,"Range","range")} input is missing.`);const H=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[Q.GoogleSheetsMergeCells].inputs.mergeType.id}),W=(f=H==null?void 0:H.value)==null?void 0:f.value,ie={Columns:"MERGE_COLUMNS",Rows:"MERGE_ROWS",Both:"MERGE_ALL","All (combine entire range)":"MERGE_ALL","Columns (merge within columns)":"MERGE_COLUMNS","Rows (merge within rows)":"MERGE_ROWS",MERGE_ALL:"MERGE_ALL",MERGE_COLUMNS:"MERGE_COLUMNS",MERGE_ROWS:"MERGE_ROWS"},z=typeof W=="string"?W:String(W||""),Y=ie[z]||(W?String(W).toUpperCase():"MERGE_ALL"),J={Authorization:`Bearer ${await T.getAccessToken()}`},te=`${(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(te,oe,{headers:J}),ae=await Ha(Z,"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(ge=>{var Ce,Ee;return{id:(Ce=ge.properties)==null?void 0:Ce.sheetId,name:(Ee=ge.properties)==null?void 0:Ee.title}})}),le=ps(ae,{errorPrefix:`${R}The ${I(q,"Range","range")} input `});return await re({method:"POST",endpoint:`/v4/spreadsheets/${U}:batchUpdate`,data:{requests:[{mergeCells:{range:le,mergeType:Y}}]}}),{value:K.Success,error:null,result:null}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return pe.Logger.log("[Google Sheets] error:",g),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:g,result:null}}}})}}class r1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsUnmergeCells,version:"1.0.0",description:"Unmerge Cells Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.GoogleSheetsUnmergeCells);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"unmergeCells"),b="["+Ve(t,t.project,"Unmerge cells")+": `"+T+"`] ",R=(ee,J,te)=>{const re=Ve(ee==null?void 0:ee.valueOwner,m==null?void 0:m.logic,J),ae=Be(ee==null?void 0:ee.valueOwner,m==null?void 0:m.logic,te);return`"${re}" (\`${ae}\`)`},I=n.find(ee=>{var J;return((J=ee.valueOwner.declaration)==null?void 0:J.id)===G.operation[Q.GoogleSheetsUnmergeCells].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(A);if(!O)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(ee=>{var J;return((J=ee.valueOwner.declaration)==null?void 0:J.id)===G.operation[Q.GoogleSheetsUnmergeCells].inputs.spreadsheetId.id}),x=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(x,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(ee=>{var J;return((J=ee.valueOwner.declaration)==null?void 0:J.id)===G.operation[Q.GoogleSheetsUnmergeCells].inputs.range.id}),q=(e=U==null?void 0:U.value)==null?void 0:e.value;if(!q||q==="")throw new Error(`${b}The ${R(U,"Range","range")} input is missing.`);const H={Authorization:`Bearer ${await m.getAccessToken()}`},W=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${O}`,ie=async ee=>Ht.post(W,ee,{headers:H}),z=await Ha(q,"Id",async()=>{var J;return(((J=(await ie({method:"GET",endpoint:`/v4/spreadsheets/${$}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:J.sheets)||[]).map(te=>{var re,ae;return{id:(re=te.properties)==null?void 0:re.sheetId,name:(ae=te.properties)==null?void 0:ae.title}})}),Y=ps(z,{errorPrefix:`${b}The ${R(U,"Range","range")} input `});return await ie({method:"POST",endpoint:`/v4/spreadsheets/${$}:batchUpdate`,data:{requests:[{unmergeCells:{range:Y}}]}}),{value:K.Success,error:null,result:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class a1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsAutoResizeDimensions,version:"1.0.0",description:"Auto-Resize Dimensions Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.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),ge=Be(ae==null?void 0:ae.valueOwner,T==null?void 0:T.logic,oe);return`"${ce}" (\`${ge}\`)`},A=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[Q.GoogleSheetsAutoResizeDimensions].inputs.connection.id}),O=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${R}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const P=ui(O);if(!P)throw new Error(`${R}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[Q.GoogleSheetsAutoResizeDimensions].inputs.spreadsheetId.id}),$=(u=x==null?void 0:x.value)==null?void 0:u.value,U=ln($,{errorPrefix:`${R}The ${I(x,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[Q.GoogleSheetsAutoResizeDimensions].inputs.range.id}),Z=(e=q==null?void 0:q.value)==null?void 0:e.value;if(Z==null)throw new Error(`${R}The ${I(q,"Range","range")} input is missing.`);const H=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[Q.GoogleSheetsAutoResizeDimensions].inputs.dimension.id}),W=((f=H==null?void 0:H.value)==null?void 0:f.value)||"Both",z={Authorization:`Bearer ${await T.getAccessToken()}`},Y=`${(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(Y,ae,{headers:z}),J=await Ha(Z,"Id",async()=>{var le;return(((le=(await ee({method:"GET",endpoint:`/v4/spreadsheets/${U}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:le.sheets)||[]).map(oe=>{var ce,ge;return{id:(ce=oe.properties)==null?void 0:ce.sheetId,name:(ge=oe.properties)==null?void 0:ge.title}})}),re=S4(J,typeof W=="string"?W:void 0,{errorPrefix:`${R}The ${I(q,"Range","range")} input `}).map(ae=>({autoResizeDimensions:{dimensions:ae}}));return await ee({method:"POST",endpoint:`/v4/spreadsheets/${U}:batchUpdate`,data:{requests:re}}),{value:K.Success,result:null,error:null}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return pe.Logger.log("[Google Sheets] error:",g),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:g,result:null}}}})}}class s1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsFindAndReplace,version:"1.0.0",description:"Find and Replace Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.GoogleSheetsFindAndReplace);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A;try{const O=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!O||!O.env)throw new Error("Editor context or environment missing");const P=Be(t,t.project,"findAndReplace"),$="["+Ve(t,t.project,"Find and replace")+": `"+P+"`] ",U=(et,qe,ot)=>{const st=Ve(et==null?void 0:et.valueOwner,O==null?void 0:O.logic,qe),ft=Be(et==null?void 0:et.valueOwner,O==null?void 0:O.logic,ot);return`"${st}" (\`${ft}\`)`},q=n.find(et=>{var qe;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===G.operation[Q.GoogleSheetsFindAndReplace].inputs.connection.id}),Z=(s=q==null?void 0:q.value)==null?void 0:s.valueAsType;if(!Z||!Z.id||!Z.name||Z.type!==r.DefinitionEntity)throw new Error(`${$}The ${U(q,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const H=ui(Z);if(!H)throw new Error(`${$}The ${U(q,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const W=n.find(et=>{var qe;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===G.operation[Q.GoogleSheetsFindAndReplace].inputs.spreadsheetId.id}),ie=(u=W==null?void 0:W.value)==null?void 0:u.value,z=ln(ie,{errorPrefix:`${$}The ${U(W,"Spreadsheet ID","spreadsheetId")} input `}),Y=n.find(et=>{var qe;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===G.operation[Q.GoogleSheetsFindAndReplace].inputs.range.id}),ee=(e=Y==null?void 0:Y.value)==null?void 0:e.value;if(ee==null)throw new Error(`${$}The ${U(Y,"Range","range")} input is missing.`);const J=n.find(et=>{var qe;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===G.operation[Q.GoogleSheetsFindAndReplace].inputs.find.id}),te=(f=J==null?void 0:J.value)==null?void 0:f.value;if(!te||te==="")throw new Error(`${$}The ${U(J,"Find","find")} input is missing.`);if(typeof te!="string")throw new Error(`${$}The ${U(J,"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[Q.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[Q.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[Q.GoogleSheetsFindAndReplace].inputs.matchEntireCell.id}),ge=!!((T=ce==null?void 0:ce.value)!=null&&T.value),Ee={Authorization:`Bearer ${await O.getAccessToken()}`},Oe=`${(g=O.env)==null?void 0:g.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${O.projectId}/${Zt["google-sheet"]}/${H}`,Le=async et=>Ht.post(Oe,et,{headers:Ee}),Fe={findReplace:{range:ps(ee,{errorPrefix:`${$}The ${U(Y,"Range","range")} input `}),find:te,replacement:ae,matchCase:oe,matchEntireCell:ge}},We=(await Le({method:"POST",endpoint:`/v4/spreadsheets/${z}:batchUpdate`,data:{requests:[Fe]}})).data||{};return{value:K.Success,result:{occurrencesChanged:((I=(R=(b=We.replies)==null?void 0:b[0])==null?void 0:R.findReplace)==null?void 0:I.occurrencesChanged)||0},error:null}}catch(O){const P=((A=O.response)==null?void 0:A.data)||O.message||O;return pe.Logger.log("[Google Sheets] error:",P),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:P,result:null}}}})}}const JL={"List of items":"ONE_OF_LIST","List from cell range":"ONE_OF_RANGE","Number greater than":"NUMBER_GREATER","Number greater than or equal":"NUMBER_GREATER_THAN_EQ","Number less than":"NUMBER_LESS","Number less than or equal":"NUMBER_LESS_THAN_EQ","Number equal to":"NUMBER_EQ","Number not equal to":"NUMBER_NOT_EQ","Number between":"NUMBER_BETWEEN","Number not between":"NUMBER_NOT_BETWEEN","Text contains":"TEXT_CONTAINS","Text does not contain":"TEXT_NOT_CONTAINS","Text starts with":"TEXT_STARTS_WITH","Text ends with":"TEXT_ENDS_WITH","Text equals":"TEXT_EQ","Text is valid email":"TEXT_IS_EMAIL","Text is valid URL":"TEXT_IS_URL","Date is":"DATE_EQ","Date is before":"DATE_BEFORE","Date is after":"DATE_AFTER","Date is on or before":"DATE_ON_OR_BEFORE","Date is on or after":"DATE_ON_OR_AFTER","Date is between":"DATE_BETWEEN","Date is not between":"DATE_NOT_BETWEEN","Date is valid":"DATE_IS_VALID",Checkbox:"BOOLEAN","Custom formula":"CUSTOM_FORMULA"},nO={NUMBER_EQUAL:"NUMBER_EQ",NUMBER_NOT_EQUAL:"NUMBER_NOT_EQ",TEXT_DOES_NOT_CONTAIN:"TEXT_NOT_CONTAINS",TEXT_EQUAL:"TEXT_EQ",DATE_TIME_EQUAL:"DATE_EQ",DATE_EQUAL:"DATE_EQ"},mRn=new Set([...Object.values(JL),...Object.keys(nO),...Object.values(nO)]);function l1t(a){if(!a||typeof a!="string")return null;const p=a.trim();if(!p)return null;if(JL[p])return JL[p];const t=p.toUpperCase().replace(/\s+/g,"_");return nO[t]?nO[t]:(mRn.has(t),t)}function TRn(a,p,t){if(a.length===0){t.push(new ht({id:`${p.id}--${Nr.ConditionValuesInvalidFormula}`,message:'Custom formula condition requires a formula string starting with "=" (e.g., ["=SUM(A1:A10)>100"]).',severity:Ie.Error,code:Nr.ConditionValuesInvalidFormula,entity:p}));return}a.length>1&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesInvalidFormula}-count`,message:`Custom formula condition rule accepts only 1 formula string (e.g., ["=SUM(A1:A10)>100"]). You provided ${a.length} items.`,severity:Ie.Error,code:Nr.ConditionValuesInvalidFormula,entity:p}));for(let n=0;n<a.length;n++){const s=String(a[n]).trim();s.startsWith("=")||t.push(new ht({id:`${p.id}--${Nr.ConditionValuesInvalidFormula}-${n}`,message:`Custom formula "${s}" ${a.length>1?`(at index ${n}) `:""}is invalid. A custom formula must start with "=" (e.g., "=A1>100" or "=ISNUMBER(A1)").`,severity:Ie.Error,code:Nr.ConditionValuesInvalidFormula,entity:p}))}}function vRn(a,p,t){if(a.length===0){t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleNumberRequired}`,message:'This numeric condition rule requires 1 numeric target value (e.g., ["100"]).',severity:Ie.Error,code:Nr.ConditionValuesSingleNumberRequired,entity:p}));return}a.length>1&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleNumberRequired}-count`,message:`This numeric condition rule accepts only 1 numeric target value (e.g., ["100"]). You provided ${a.length} items.`,severity:Ie.Error,code:Nr.ConditionValuesSingleNumberRequired,entity:p}));for(let n=0;n<a.length;n++){const s=String(a[n]).trim();(s===""||isNaN(Number(s)))&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleNumberRequired}-${n}`,message:`Condition value "${s}" ${a.length>1?`(at index ${n}) `:""}is invalid. It must be a valid number (e.g., "100").`,severity:Ie.Error,code:Nr.ConditionValuesSingleNumberRequired,entity:p}))}}function gRn(a,p,t){a.length!==2&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesTwoNumbersRequired}`,message:`A "between" condition rule requires exactly 2 boundary values (e.g., ["10", "50"] or ["2024-01-01", "2024-12-31"]). You provided ${a.length} items.`,severity:Ie.Error,code:Nr.ConditionValuesTwoNumbersRequired,entity:p}))}function bRn(a,p,t){if(a.length===0){t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleRangeRequired}`,message:'The "List from cell range" rule requires a valid cell range in A1 notation (e.g., ["Sheet1!A1:A50"]).',severity:Ie.Error,code:Nr.ConditionValuesSingleRangeRequired,entity:p}));return}a.length>1&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleRangeRequired}-count`,message:`The "List from cell range" rule accepts only 1 cell range in A1 notation (e.g., ["Sheet1!A1:A50"]). You provided ${a.length} items.`,severity:Ie.Error,code:Nr.ConditionValuesSingleRangeRequired,entity:p}))}function ERn(a,p,t){a.length===0&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesListEmpty}`,message:'The "List of items" rule requires at least one choice item (e.g., ["Pending", "Approved", "Rejected"]).',severity:Ie.Error,code:Nr.ConditionValuesListEmpty,entity:p}))}function IRn(a,p,t){if(a.length===0){t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleTextRequired}`,message:'This text condition rule requires a non-empty text target value (e.g., ["important"]).',severity:Ie.Error,code:Nr.ConditionValuesSingleTextRequired,entity:p}));return}a.length>1&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleTextRequired}-count`,message:`This text condition rule accepts only 1 text target value (e.g., ["important"]). You provided ${a.length} items.`,severity:Ie.Error,code:Nr.ConditionValuesSingleTextRequired,entity:p}));for(let n=0;n<a.length;n++)String(a[n]).trim()===""&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleTextRequired}-${n}`,message:`Text target value ${a.length>1?`(at index ${n}) `:""}is empty. Expected a non-empty text string.`,severity:Ie.Error,code:Nr.ConditionValuesSingleTextRequired,entity:p}))}function RRn(a,p,t){if(a.length===0){t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleTextRequired}`,message:'This date condition rule requires a target date or relative date string (e.g., ["2024-01-01"]).',severity:Ie.Error,code:Nr.ConditionValuesSingleTextRequired,entity:p}));return}a.length>1&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesSingleTextRequired}-count`,message:`This date condition rule accepts only 1 target date string (e.g., ["2024-01-01"]). You provided ${a.length} items.`,severity:Ie.Error,code:Nr.ConditionValuesSingleTextRequired,entity:p}))}function ARn(a,p,t){a.length>0&&t.push(new ht({id:`${p.id}--${Nr.ConditionValuesNoValuesRequired}`,message:`This condition rule does not take any argument values (must be empty list []). You provided ${a.length} items.`,severity:Ie.Error,code:Nr.ConditionValuesNoValuesRequired,entity:p}))}function DRn(a,p,t,n){if(!p&&p!==0&&p!==!1)return;let s=[];if(typeof p=="string")try{const e=JSON.parse(p);s=Array.isArray(e)?e:[p]}catch{s=p.split(",").map(e=>e.trim()).filter(Boolean)}else Array.isArray(p)?s=p:s=[p];const u=l1t(a);if(u)switch(u){case"CUSTOM_FORMULA":TRn(s,t,n);break;case"ONE_OF_LIST":ERn(s,t,n);break;case"ONE_OF_RANGE":bRn(s,t,n);break;case"NUMBER_GREATER":case"NUMBER_GREATER_THAN_EQ":case"NUMBER_LESS":case"NUMBER_LESS_THAN_EQ":case"NUMBER_EQUAL":case"NUMBER_NOT_EQUAL":vRn(s,t,n);break;case"NUMBER_BETWEEN":case"NUMBER_NOT_BETWEEN":case"DATE_BETWEEN":case"DATE_NOT_BETWEEN":gRn(s,t,n);break;case"TEXT_CONTAINS":case"TEXT_NOT_CONTAINS":case"TEXT_DOES_NOT_CONTAIN":case"TEXT_STARTS_WITH":case"TEXT_ENDS_WITH":case"TEXT_EQ":case"TEXT_EQUAL":IRn(s,t,n);break;case"DATE_EQ":case"DATE_TIME_EQUAL":case"DATE_BEFORE":case"DATE_AFTER":case"DATE_ON_OR_BEFORE":case"DATE_ON_OR_AFTER":RRn(s,t,n);break;case"TEXT_IS_EMAIL":case"TEXT_IS_URL":case"DATE_IS_VALID":case"BOOLEAN":ARn(s,t,n);break}}class o1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsAddDataValidation,version:"1.0.0",description:"Add Data Validation Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.Editor])[0];if(!g||!g.env)throw new Error("Editor context or environment missing");const b=Be(t,t.project,"addDataValidation"),I="["+Ve(t,t.project,"Add data validation")+": `"+b+"`] ",A=(Oe,Le,Fe)=>{const tt=Ve(Oe==null?void 0:Oe.valueOwner,g==null?void 0:g.logic,Le),We=Be(Oe==null?void 0:Oe.valueOwner,g==null?void 0:g.logic,Fe);return`"${tt}" (\`${We}\`)`},O=n.find(Oe=>{var Le;return((Le=Oe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[Q.GoogleSheetsAddDataValidation].inputs.connection.id}),P=(s=O==null?void 0:O.value)==null?void 0:s.valueAsType;if(!P||!P.id||!P.name||P.type!==r.DefinitionEntity)throw new Error(`${I}The ${A(O,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=ui(P);if(!x)throw new Error(`${I}The ${A(O,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const $=n.find(Oe=>{var Le;return((Le=Oe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[Q.GoogleSheetsAddDataValidation].inputs.spreadsheetId.id}),U=(u=$==null?void 0:$.value)==null?void 0:u.value,q=ln(U,{errorPrefix:`${I}The ${A($,"Spreadsheet ID","spreadsheetId")} input `}),Z=n.find(Oe=>{var Le;return((Le=Oe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[Q.GoogleSheetsAddDataValidation].inputs.range.id}),H=(e=Z==null?void 0:Z.value)==null?void 0:e.value;if(H==null)throw new Error(`${I}The ${A(Z,"Range","range")} input is missing.`);const ie={Authorization:`Bearer ${await g.getAccessToken()}`},z=`${(f=g.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${g.projectId}/${Zt["google-sheet"]}/${x}`,Y=async Oe=>Ht.post(z,Oe,{headers:ie}),ee=await Ha(H,"Id",async()=>(await Y({method:"GET",endpoint:`/v4/spreadsheets/${q}?fields=sheets.properties(sheetId,title)`})).data.sheets.map(Le=>({id:Le.properties.sheetId,name:Le.properties.title}))),J=ps(ee,{errorPrefix:`${I}The ${A(Z,"Range","range")} input `}),te=n.find(Oe=>{var Le;return((Le=Oe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[Q.GoogleSheetsAddDataValidation].inputs.conditionType.id}),re=(y=te==null?void 0:te.value)==null?void 0:y.value;if(!re||re==="")throw new Error(`${I}The ${A(te,"Condition Type","conditionType")} input is missing.`);if(typeof re!="string")throw new Error(`${I}The ${A(te,"Condition Type","conditionType")} input value is invalid. It must be a non-empty string.`);const ae=l1t(re)||re,le=n.find(Oe=>{var Le;return((Le=Oe.valueOwner.declaration)==null?void 0:Le.id)===G.operation[Q.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 ge=ae,Ce=ce.map(Oe=>({userEnteredValue:String(Oe)}));if(ae==="TEXT_STARTS_WITH"||ae==="TEXT_ENDS_WITH"){const Oe=UAt(H),Le=ce.length>0?String(ce[0]):"",Fe=Le.replace(/"/g,'""'),tt=ae==="TEXT_STARTS_WITH"?`=LEFT(${Oe}, ${Le.length})="${Fe}"`:`=RIGHT(${Oe}, ${Le.length})="${Fe}"`;ge="CUSTOM_FORMULA",Ce=[{userEnteredValue:tt}]}const Ee={setDataValidation:{range:J,rule:{condition:{type:ge,values:Ce},showCustomUi:!0}}};return await Y({method:"POST",endpoint:`/v4/spreadsheets/${q}:batchUpdate`,data:{requests:[Ee]}}),{value:K.Success,result:null,error:null}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return pe.Logger.log("[Google Sheets] error:",b),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:b,result:null}}}})}}class d1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsSortRange,version:"1.0.0",description:"Sort Range Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.Editor])[0];if(!g||!g.env)throw new Error("Editor context or environment missing");const b=Be(t,t.project,"sortRange"),I="["+Ve(t,t.project,"Sort range")+": `"+b+"`] ",A=(Le,Fe,tt)=>{const We=Ve(Le==null?void 0:Le.valueOwner,g==null?void 0:g.logic,Fe),et=Be(Le==null?void 0:Le.valueOwner,g==null?void 0:g.logic,tt);return`"${We}" (\`${et}\`)`},O=n.find(Le=>{var Fe;return((Fe=Le.valueOwner.declaration)==null?void 0:Fe.id)===G.operation[Q.GoogleSheetsSortRange].inputs.connection.id}),P=(s=O==null?void 0:O.value)==null?void 0:s.valueAsType;if(!P||!P.id||!P.name||P.type!==r.DefinitionEntity)throw new Error(`${I}The ${A(O,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=ui(P);if(!x)throw new Error(`${I}The ${A(O,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const $=n.find(Le=>{var Fe;return((Fe=Le.valueOwner.declaration)==null?void 0:Fe.id)===G.operation[Q.GoogleSheetsSortRange].inputs.spreadsheetId.id}),U=(u=$==null?void 0:$.value)==null?void 0:u.value,q=ln(U,{errorPrefix:`${I}The ${A($,"Spreadsheet ID","spreadsheetId")} input `}),Z=n.find(Le=>{var Fe;return((Fe=Le.valueOwner.declaration)==null?void 0:Fe.id)===G.operation[Q.GoogleSheetsSortRange].inputs.range.id}),H=(e=Z==null?void 0:Z.value)==null?void 0:e.value;if(H==null)throw new Error(`${I}The ${A(Z,"Range","range")} input is missing.`);const ie={Authorization:`Bearer ${await g.getAccessToken()}`},z=`${(f=g.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${g.projectId}/${Zt["google-sheet"]}/${x}`,Y=async Le=>Ht.post(z,Le,{headers:ie}),ee=await Ha(H,"Id",async()=>(await Y({method:"GET",endpoint:`/v4/spreadsheets/${q}?fields=sheets.properties(sheetId,title)`})).data.sheets.map(Fe=>({id:Fe.properties.sheetId,name:Fe.properties.title}))),J=ps(ee,{errorPrefix:`${I}The ${A(Z,"Range","range")} input `}),te=n.find(Le=>{var Fe;return((Fe=Le.valueOwner.declaration)==null?void 0:Fe.id)===G.operation[Q.GoogleSheetsSortRange].inputs.sortColumnIndex.id}),re=(y=te==null?void 0:te.value)==null?void 0:y.value;if(re==null)throw new Error(`${I}The ${A(te,"Sort Column Index","sortColumnIndex")} input is missing.`);if(typeof re!="number")throw new Error(`${I}The ${A(te,"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[Q.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(),ge=J.startColumnIndex??0,Ce=J.endColumnIndex;let Ee;if(re>=1?Ee=ge+(re-1):Ee=ge+re,Ce!==void 0&&(Ee<ge||Ee>=Ce)){const Le=Ce-ge;throw new Error(`${I}The ${A(te,"Sort Column Index","sortColumnIndex")} input value (${re}) is out of bounds for the specified range. The range contains ${Le} column(s).`)}const Oe={sortRange:{range:J,sortSpecs:[{dimensionIndex:Ee,sortOrder:ce}]}};return await Y({method:"POST",endpoint:`/v4/spreadsheets/${q}:batchUpdate`,data:{requests:[Oe]}}),{value:K.Success,result:null,error:null}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return pe.Logger.log("[Google Sheets] error:",b),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:b,result:null}}}})}}const CRn={"Is empty":"BLANK","Is not empty":"NOT_BLANK","Text contains":"TEXT_CONTAINS","Text does not contain":"TEXT_NOT_CONTAINS","Text starts with":"TEXT_STARTS_WITH","Text ends with":"TEXT_ENDS_WITH","Text is exactly":"TEXT_EQ","Greater than":"NUMBER_GREATER","Greater than or equal to":"NUMBER_GREATER_THAN_EQ","Less than":"NUMBER_LESS","Less than or equal to":"NUMBER_LESS_THAN_EQ","Is equal to":"NUMBER_EQUAL","Is not equal to":"NUMBER_NOT_EQUAL","Is between":"NUMBER_BETWEEN","Is not between":"NUMBER_NOT_BETWEEN","Custom formula":"CUSTOM_FORMULA"},wRn={"Ascending (A-Z, 0-9)":"ASCENDING","Descending (Z-A, 9-0)":"DESCENDING",Ascending:"ASCENDING",Descending:"DESCENDING"};class p1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsCreateFilter,version:"1.0.0",description:"Create Filter Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.Editor])[0];if(!I||!I.env)throw new Error("Editor context or environment missing");const A=Be(t,t.project,"createFilter"),P="["+Ve(t,t.project,"Create filter")+": `"+A+"`] ",x=(pt,Me,Je)=>{const ke=Ve(pt==null?void 0:pt.valueOwner,I==null?void 0:I.logic,Me),lt=Be(pt==null?void 0:pt.valueOwner,I==null?void 0:I.logic,Je);return`"${ke}" (\`${lt}\`)`},$=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===G.operation[Q.GoogleSheetsCreateFilter].inputs.connection.id}),U=(s=$==null?void 0:$.value)==null?void 0:s.valueAsType;if(!U||!U.id||!U.name||U.type!==r.DefinitionEntity)throw new Error(`${P}The ${x($,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const q=ui(U);if(!q)throw new Error(`${P}The ${x($,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const Z=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===G.operation[Q.GoogleSheetsCreateFilter].inputs.spreadsheetId.id}),H=(u=Z==null?void 0:Z.value)==null?void 0:u.value,W=ln(H,{errorPrefix:`${P}The ${x(Z,"Spreadsheet ID","spreadsheetId")} input `}),ie=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===G.operation[Q.GoogleSheetsCreateFilter].inputs.range.id}),z=(e=ie==null?void 0:ie.value)==null?void 0:e.value;if(z==null)throw new Error(`${P}The ${x(ie,"Range","range")} input is missing.`);const Y=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===G.operation[Q.GoogleSheetsCreateFilter].inputs.columnIndex.id}),ee=(f=Y==null?void 0:Y.value)==null?void 0:f.value,J=typeof ee=="number"?ee:0,te=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===G.operation[Q.GoogleSheetsCreateFilter].inputs.conditionType.id}),re=(y=te==null?void 0:te.value)==null?void 0:y.value,ae=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===G.operation[Q.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[Q.GoogleSheetsCreateFilter].inputs.hiddenValues.id}),ce=(T=oe==null?void 0:oe.value)==null?void 0:T.value,ge=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===G.operation[Q.GoogleSheetsCreateFilter].inputs.sortOrder.id}),Ce=(g=ge==null?void 0:ge.value)==null?void 0:g.value,Oe={Authorization:`Bearer ${await I.getAccessToken()}`},Le=`${(b=I.env)==null?void 0:b.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${I.projectId}/${Zt["google-sheet"]}/${q}`,Fe=async pt=>Ht.post(Le,pt,{headers:Oe}),tt=await Ha(z,"Id",async()=>(await Fe({method:"GET",endpoint:`/v4/spreadsheets/${W}?fields=sheets.properties(sheetId,title)`})).data.sheets.map(Me=>({id:Me.properties.sheetId,name:Me.properties.title}))),We=ps(tt,{errorPrefix:`${P}The ${x(ie,"Range","range")} input `}),et={range:We},qe={},ot=typeof re=="string"?re:String(re||""),st=CRn[ot]||(re?String(re).toUpperCase():void 0);if(st){const pt=Array.isArray(le)?le.map(Me=>({userEnteredValue:String(Me)})):le!=null&&le!==""?[{userEnteredValue:String(le)}]:void 0;qe.condition={type:st,...pt?{values:pt}:{}}}Array.isArray(ce)&&ce.length>0&&(qe.hiddenValues=ce.map(pt=>String(pt))),Object.keys(qe).length>0&&(et.criteria={[J]:qe});const ft=typeof Ce=="string"?Ce:String(Ce||""),Et=wRn[ft]||(Ce?String(Ce).toUpperCase():void 0);if(Et){const pt=We.startColumnIndex??0,Me=J>=1?pt+(J-1):pt+J;et.sortSpecs=[{dimensionIndex:Me,sortOrder:Et}]}return await Fe({method:"POST",endpoint:`/v4/spreadsheets/${W}:batchUpdate`,data:{requests:[{setBasicFilter:{filter:et}}]}}),{value:K.Success,result:null,error:null}}catch(I){const A=((R=I.response)==null?void 0:R.data)||I.message||I;return pe.Logger.log("[Google Sheets] error:",A),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:A,result:null}}}})}}class u1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsRemoveFilter,version:"1.0.0",description:"Remove Filter Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.GoogleSheetsRemoveFilter);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"removeFilter"),b="["+Ve(t,t.project,"Remove filter")+": `"+T+"`] ",R=(J,te,re)=>{const ae=Ve(J==null?void 0:J.valueOwner,m==null?void 0:m.logic,te),le=Be(J==null?void 0:J.valueOwner,m==null?void 0:m.logic,re);return`"${ae}" (\`${le}\`)`},I=n.find(J=>{var te;return((te=J.valueOwner.declaration)==null?void 0:te.id)===G.operation[Q.GoogleSheetsRemoveFilter].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(A);if(!O)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(J=>{var te;return((te=J.valueOwner.declaration)==null?void 0:te.id)===G.operation[Q.GoogleSheetsRemoveFilter].inputs.spreadsheetId.id}),x=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(x,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(J=>{var te;return((te=J.valueOwner.declaration)==null?void 0:te.id)===G.operation[Q.GoogleSheetsRemoveFilter].inputs.range.id}),q=(e=U==null?void 0:U.value)==null?void 0:e.value;if(q==null)throw new Error(`${b}The ${R(U,"Range","range")} input is missing.`);const H={Authorization:`Bearer ${await m.getAccessToken()}`},W=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${O}`,ie=async J=>Ht.post(W,J,{headers:H}),z=await Ha(q,"Id",async()=>(await ie({method:"GET",endpoint:`/v4/spreadsheets/${$}?fields=sheets.properties(sheetId,title)`})).data.sheets.map(te=>({id:te.properties.sheetId,name:te.properties.title}))),ee=ps(z,{errorPrefix:`${b}The ${R(U,"Range","range")} input `}).sheetId;return await ie({method:"POST",endpoint:`/v4/spreadsheets/${$}:batchUpdate`,data:{requests:[{clearBasicFilter:{sheetId:ee}}]}}),{value:K.Success,result:null,error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class c1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsUpdateSpreadsheetProperties,version:"1.0.0",description:"Update Spreadsheet Properties Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.Editor])[0];if(!A||!A.env)throw new Error("Editor context or environment missing");const O=Be(t,t.project,"updateSpreadsheetProperties"),x="["+Ve(t,t.project,"Update spreadsheet properties")+": `"+O+"`] ",$=(st,ft,Et)=>{const pt=Ve(st==null?void 0:st.valueOwner,A==null?void 0:A.logic,ft),Me=Be(st==null?void 0:st.valueOwner,A==null?void 0:A.logic,Et);return`"${pt}" (\`${Me}\`)`},U=n.find(st=>{var ft;return((ft=st.valueOwner.declaration)==null?void 0:ft.id)===G.operation[Q.GoogleSheetsUpdateSpreadsheetProperties].inputs.connection.id}),q=(s=U==null?void 0:U.value)==null?void 0:s.valueAsType;if(!q||!q.id||!q.name||q.type!==r.DefinitionEntity)throw new Error(`${x}The ${$(U,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const Z=ui(q);if(!Z)throw new Error(`${x}The ${$(U,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const H=n.find(st=>{var ft;return((ft=st.valueOwner.declaration)==null?void 0:ft.id)===G.operation[Q.GoogleSheetsUpdateSpreadsheetProperties].inputs.spreadsheetId.id}),W=(u=H==null?void 0:H.value)==null?void 0:u.value,ie=ln(W,{errorPrefix:`${x}The ${$(H,"Spreadsheet ID","spreadsheetId")} input `}),z=n.find(st=>{var ft;return((ft=st.valueOwner.declaration)==null?void 0:ft.id)===G.operation[Q.GoogleSheetsUpdateSpreadsheetProperties].inputs.title.id}),Y=(e=z==null?void 0:z.value)==null?void 0:e.value;if(Y!=null&&typeof Y!="string")throw new Error(`${x}The ${$(z,"Title","title")} input value is invalid. If present, it must be a string. E.g. "My Spreadsheet"`);const ee=n.find(st=>{var ft;return((ft=st.valueOwner.declaration)==null?void 0:ft.id)===G.operation[Q.GoogleSheetsUpdateSpreadsheetProperties].inputs.locale.id}),J=(f=ee==null?void 0:ee.value)==null?void 0:f.value;if(J!=null&&typeof J!="string")throw new Error(`${x}The ${$(ee,"Locale","locale")} input value is invalid. If present, it must be a string. E.g. "en_US"`);const te=n.find(st=>{var ft;return((ft=st.valueOwner.declaration)==null?void 0:ft.id)===G.operation[Q.GoogleSheetsUpdateSpreadsheetProperties].inputs.timeZone.id}),re=(y=te==null?void 0:te.value)==null?void 0:y.value;if(re!=null&&typeof re!="string")throw new Error(`${x}The ${$(te,"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[Q.GoogleSheetsUpdateSpreadsheetProperties].inputs.autoRecalc.id}),le=(m=ae==null?void 0:ae.value)==null?void 0:m.value;if(le!=null&&typeof le!="string")throw new Error(`${x}The ${$(ae,"Auto Recalculation","autoRecalc")} input value is invalid. If present, it must be a string enum value. E.g. "ON_CHANGE"`);const oe=n.find(st=>{var ft;return((ft=st.valueOwner.declaration)==null?void 0:ft.id)===G.operation[Q.GoogleSheetsUpdateSpreadsheetProperties].inputs.defaultFormat.id}),ce=(T=oe==null?void 0:oe.value)==null?void 0:T.value;if(ce!=null&&(typeof ce!="object"||Array.isArray(ce)))throw new Error(`${x}The ${$(oe,"Default Format","defaultFormat")} input value is invalid. If present, it must be an object representing the CellFormat.`);const ge=n.find(st=>{var ft;return((ft=st.valueOwner.declaration)==null?void 0:ft.id)===G.operation[Q.GoogleSheetsUpdateSpreadsheetProperties].inputs.iterativeCalculationSettings.id}),Ce=(g=ge==null?void 0:ge.value)==null?void 0:g.value;if(Ce!=null&&(typeof Ce!="object"||Array.isArray(Ce)))throw new Error(`${x}The ${$(ge,"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[Q.GoogleSheetsUpdateSpreadsheetProperties].inputs.spreadsheetTheme.id}),Oe=(b=Ee==null?void 0:Ee.value)==null?void 0:b.value;if(Oe!=null&&(typeof Oe!="object"||Array.isArray(Oe)))throw new Error(`${x}The ${$(Ee,"Spreadsheet Theme","spreadsheetTheme")} input value is invalid. If present, it must be an object.`);const Le={};if(Y!=null&&(Le.title=Y),J!=null&&(Le.locale=J),re!=null&&(Le.timeZone=re),le!=null){const st={"On change":"ON_CHANGE","Every minute":"MINUTE","Every hour":"HOUR"};Le.autoRecalc=st[le]||le.toUpperCase()}ce!=null&&(Le.defaultFormat=ce),Ce!=null&&(Le.iterativeCalculationSettings=Ce),Oe!=null&&(Le.spreadsheetTheme=Oe);const Fe=(st,ft="")=>{let Et=[];for(const pt in st){if(!Object.prototype.hasOwnProperty.call(st,pt))continue;const Me=st[pt],Je=ft?`${ft}.${pt}`:pt;Me!==null&&typeof Me=="object"&&!Array.isArray(Me)&&Object.keys(Me).length>0?Et.push(...Fe(Me,Je)):Et.push(Je)}return Et},tt=Fe(Le);if(tt.length===0)throw new Error(`${x}At least one property must be provided to update.`);const et={Authorization:`Bearer ${await A.getAccessToken()}`},qe=`${(R=A.env)==null?void 0:R.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${A.projectId}/${Zt["google-sheet"]}/${Z}`;return await(async st=>Ht.post(qe,st,{headers:et}))({method:"POST",endpoint:`/v4/spreadsheets/${ie}:batchUpdate`,data:{requests:[{updateSpreadsheetProperties:{properties:Le,fields:tt.join(",")}}]}}),{value:K.Success,result:null,error:null}}catch(A){const O=((I=A.response)==null?void 0:I.data)||A.message||A;return pe.Logger.log("[Google Sheets] error:",O),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:O,result:null}}}})}}const g5=(a,p)=>(pe.Logger.log("[Google Sheets Clone Sheet] error:",p),{value:a.catchesError||a.errorCalls.length?K.CaughtError:K.UnhandledError,error:p,result:null});class f1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsCloneSheet,version:"1.0.0",description:"Google Sheets clone sheet operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.GoogleSheetsCloneSheet);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A,O,P;try{const x=this.extensionsRegistry.requestContexts(this,[X.Editor])[0],$=Be(t,t.project,"cloneSheet"),q="["+Ve(t,t.project,"Clone Sheet")+": `"+$+"`] ",Z=(qe,ot,st)=>{const ft=Ve(qe==null?void 0:qe.valueOwner,x==null?void 0:x.logic,ot),Et=Be(qe==null?void 0:qe.valueOwner,x==null?void 0:x.logic,st);return`"${ft}" (\`${Et}\`)`},H=G.operation[Q.GoogleSheetsCloneSheet],W=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=W==null?void 0:W.value)==null?void 0:s.valueAsType)??((u=W==null?void 0:W.value)==null?void 0:u.value);if(!ie||!ie.id||!ie.name||ie.type!==r.DefinitionEntity)throw new Error(`${q}The ${Z(W,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const z=ui(ie);if(!z)throw new Error(`${q}The ${Z(W,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const Y=n.find(qe=>{var ot,st;return((st=(ot=qe.valueOwner)==null?void 0:ot.declaration)==null?void 0:st.id)===H.inputs.spreadsheetId.id}),ee=(e=Y==null?void 0:Y.value)==null?void 0:e.value,J=ln(ee,{errorPrefix:`${q}The ${Z(Y,"Spreadsheet ID","spreadsheetId")} input `}),te=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=te==null?void 0:te.value)==null?void 0:f.value;if(re==null||re==="")throw new Error(`${q}The ${Z(te,"Sheet","sheet")} input is missing.`);const ae=(m=(y=n.find(qe=>{var ot,st;return((st=(ot=qe.valueOwner)==null?void 0:ot.declaration)==null?void 0:st.id)===H.inputs.newSheetName.id}))==null?void 0:y.value)==null?void 0:m.value,le=(g=(T=n.find(qe=>{var ot,st;return((st=(ot=qe.valueOwner)==null?void 0:ot.declaration)==null?void 0:st.id)===H.inputs.insertIndex.id}))==null?void 0:T.value)==null?void 0:g.value,ce={Authorization:`Bearer ${await x.getAccessToken()}`},ge=`${(b=x.env)==null?void 0:b.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${x.projectId}/${Zt["google-sheet"]}/${z}`,Ce=async qe=>Ht.post(ge,qe,{headers:ce});let Ee;if(!isNaN(Number(re)))Ee=Number(re);else{const st=(((R=(await Ce({method:"GET",endpoint:`/v4/spreadsheets/${J}`})).data)==null?void 0:R.sheets)||[]).find(ft=>{var Et;return((Et=ft.properties)==null?void 0:Et.title)===String(re)});if(!st)return g5(t,`Could not find sheet with name "${re}"`);Ee=st.properties.sheetId}const Oe={sourceSheetId:Ee};ae&&(Oe.newSheetName=ae),typeof le=="number"&&(Oe.insertSheetIndex=le);const tt=((O=(A=(I=((await Ce({method:"POST",endpoint:`/v4/spreadsheets/${J}:batchUpdate`,data:{requests:[{duplicateSheet:Oe}]}})).data||{}).replies)==null?void 0:I[0])==null?void 0:A.duplicateSheet)==null?void 0:O.properties)||{},We=tt.gridProperties||{},et={sheetId:tt.sheetId,title:tt.title,index:tt.index,sheetType:tt.sheetType,rowCount:We.rowCount,columnCount:We.columnCount,frozenRowCount:We.frozenRowCount,frozenColumnCount:We.frozenColumnCount,hideGridlines:We.hideGridlines??!1,rowGroupControlAfter:We.rowGroupControlAfter??!1,columnGroupControlAfter:We.columnGroupControlAfter??!1,hidden:tt.hidden??!1,rightToLeft:tt.rightToLeft??!1,tabColor:tt.tabColor?{red:tt.tabColor.red??0,green:tt.tabColor.green??0,blue:tt.tabColor.blue??0,alpha:tt.tabColor.alpha??1}:null,basicFilter:null,protectedRanges:[],bandedRanges:[],charts:[],conditionalFormatRules:[],mergedCells:[]};return{value:K.Success,error:null,result:et}}catch(x){const $=((P=x.response)==null?void 0:P.data)||x.message||x;return g5(t,$)}}})}}class y1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsDeleteChart,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.GoogleSheetsDeleteChart);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"deleteChart"),b="["+Ve(t,t.project,"Delete Chart")+": `"+T+"`] ",R=(ee,J,te)=>{const re=Ve(ee==null?void 0:ee.valueOwner,m==null?void 0:m.logic,J),ae=Be(ee==null?void 0:ee.valueOwner,m==null?void 0:m.logic,te);return`"${re}" (\`${ae}\`)`},I=n.find(ee=>{var J;return((J=ee.valueOwner.declaration)==null?void 0:J.id)===G.operation[Q.GoogleSheetsDeleteChart].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(A);if(!O)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(ee=>{var J;return((J=ee.valueOwner.declaration)==null?void 0:J.id)===G.operation[Q.GoogleSheetsDeleteChart].inputs.spreadsheetId.id}),x=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(x,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(ee=>{var J;return((J=ee.valueOwner.declaration)==null?void 0:J.id)===G.operation[Q.GoogleSheetsDeleteChart].inputs.chartId.id}),q=(e=U==null?void 0:U.value)==null?void 0:e.value;let Z=typeof q=="number"?q:typeof q=="string"?parseInt(q,10):NaN;if(isNaN(Z))throw new Error(`${b}The ${R(U,"Chart ID","chartId")} input is missing or invalid. Expected a numeric chart ID.`);const W={Authorization:`Bearer ${await m.getAccessToken()}`},ie=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${O}`,z=async ee=>Ht.post(ie,ee,{headers:W});let Y={};return Y.deleteEmbeddedObject={objectId:Z},await z({method:"POST",endpoint:`/v4/spreadsheets/${$}:batchUpdate`,data:{requests:[Y]}}),{value:K.Success,result:null,error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class h1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsDeletePivotTable,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.GoogleSheetsDeletePivotTable);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=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[Q.GoogleSheetsDeletePivotTable].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(A);if(!O)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(re=>{var ae;return((ae=re.valueOwner.declaration)==null?void 0:ae.id)===G.operation[Q.GoogleSheetsDeletePivotTable].inputs.spreadsheetId.id}),x=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(x,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(re=>{var ae;return((ae=re.valueOwner.declaration)==null?void 0:ae.id)===G.operation[Q.GoogleSheetsDeletePivotTable].inputs.destination.id}),q=(e=U==null?void 0:U.value)==null?void 0:e.value;if(q==null)throw new Error(`${b}The ${R(U,"destination","destination")} input is missing.`);const H={Authorization:`Bearer ${await m.getAccessToken()}`},W=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${O}`,ie=async re=>Ht.post(W,re,{headers:H});let z=[];try{z=(await ie({method:"GET",endpoint:`/v4/spreadsheets/${$}?fields=sheets(properties(sheetId,title))`})).data.sheets||[]}catch{}const Y=await Ha(q,"Id",async()=>z.map(re=>({id:re.properties.sheetId,name:re.properties.title}))),ee=ps(Y,{errorPrefix:`${b}The ${R(U,"destination","destination")} input `});let te={updateCells:{start:{sheetId:ee.sheetId??0,rowIndex:ee.startRowIndex??0,columnIndex:ee.startColumnIndex??0},rows:[{values:[{pivotTable:null}]}],fields:"pivotTable"}};return await ie({method:"POST",endpoint:`/v4/spreadsheets/${$}:batchUpdate`,data:{requests:[te]}}),{value:K.Success,result:null,error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class m1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsDeleteDimension,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.Editor])[0];if(!R||!R.env)throw new Error("Editor context or environment missing");const I=Be(t,t.project,"deleteDimension"),O="["+Ve(t,t.project,"Delete Dimension")+": `"+I+"`] ",P=(Fe,tt,We)=>{const et=Ve(Fe==null?void 0:Fe.valueOwner,R==null?void 0:R.logic,tt),qe=Be(Fe==null?void 0:Fe.valueOwner,R==null?void 0:R.logic,We);return`"${et}" (\`${qe}\`)`},x=n.find(Fe=>{var tt;return((tt=Fe.valueOwner.declaration)==null?void 0:tt.id)===G.operation[Q.GoogleSheetsDeleteDimension].inputs.connection.id}),$=(s=x==null?void 0:x.value)==null?void 0:s.valueAsType;if(!$||!$.id||!$.name||$.type!==r.DefinitionEntity)throw new Error(`${O}The ${P(x,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const U=ui($);if(!U)throw new Error(`${O}The ${P(x,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const q=n.find(Fe=>{var tt;return((tt=Fe.valueOwner.declaration)==null?void 0:tt.id)===G.operation[Q.GoogleSheetsDeleteDimension].inputs.spreadsheetId.id}),Z=(u=q==null?void 0:q.value)==null?void 0:u.value,H=ln(Z,{errorPrefix:`${O}The ${P(q,"Spreadsheet ID","spreadsheetId")} input `}),W=n.find(Fe=>{var tt,We;return((tt=Fe.valueOwner.declaration)==null?void 0:tt.id)===((We=G.operation[Q.GoogleSheetsDeleteDimension].inputs.sheet)==null?void 0:We.id)}),ie=(e=W==null?void 0:W.value)==null?void 0:e.value,z=n.find(Fe=>{var tt,We;return((tt=Fe.valueOwner.declaration)==null?void 0:tt.id)===((We=G.operation[Q.GoogleSheetsDeleteDimension].inputs.dimension)==null?void 0:We.id)}),Y=(f=z==null?void 0:z.value)==null?void 0:f.value,ee=n.find(Fe=>{var tt,We;return((tt=Fe.valueOwner.declaration)==null?void 0:tt.id)===((We=G.operation[Q.GoogleSheetsDeleteDimension].inputs.startIndex)==null?void 0:We.id)}),J=(y=ee==null?void 0:ee.value)==null?void 0:y.value,te=n.find(Fe=>{var tt,We;return((tt=Fe.valueOwner.declaration)==null?void 0:tt.id)===((We=G.operation[Q.GoogleSheetsDeleteDimension].inputs.endIndex)==null?void 0:We.id)}),re=(m=te==null?void 0:te.value)==null?void 0:m.value,le={Authorization:`Bearer ${await R.getAccessToken()}`},oe=`${(T=R.env)==null?void 0:T.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${R.projectId}/${Zt["google-sheet"]}/${U}`,ce=async Fe=>Ht.post(oe,Fe,{headers:le});if(ie==null||ie==="")throw new Error(`${O}The ${P(W,"Sheet","sheet")} input is missing.`);if(Y==null||Y==="")throw new Error(`${O}The ${P(z,"Dimension","dimension")} input is missing.`);const ge=String(Y).trim().toUpperCase();if(ge!=="ROWS"&&ge!=="COLUMNS")throw new Error(`${O}The ${P(z,"Dimension","dimension")} input is invalid. Expected "Rows" or "Columns".`);const Ce=typeof J=="number"?J:parseInt(String(J),10);if(isNaN(Ce)||Ce<1)throw new Error(`${O}The ${P(ee,"Start index","startIndex")} input is missing or invalid. Expected a positive integer starting at 1.`);let Ee=Ce;if(re!=null&&re!==""&&(Ee=typeof re=="number"?re:parseInt(String(re),10),isNaN(Ee)||Ee<Ce))throw new Error(`${O}The ${P(te,"End index","endIndex")} input is invalid. Expected an integer greater than or equal to Start index.`);let Oe;if(typeof ie=="number"||/^\d+$/.test(String(ie).trim()))Oe=Number(ie);else{const We=(((g=(await ce({method:"GET",endpoint:`/v4/spreadsheets/${H}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:g.sheets)||[]).find(et=>{var qe;return String((qe=et.properties)==null?void 0:qe.title).trim().toLowerCase()===String(ie).trim().toLowerCase()});if(!We)throw new Error(`${O}The ${P(W,"Sheet","sheet")} input "${ie}" was not found in spreadsheet.`);Oe=We.properties.sheetId}let Le={};return Le.deleteDimension={range:{sheetId:Oe,dimension:ge,startIndex:Ce-1,endIndex:Ee}},await ce({method:"POST",endpoint:`/v4/spreadsheets/${H}:batchUpdate`,data:{requests:[Le]}}),{value:K.Success,result:null,error:null}}catch(R){const I=((b=R.response)==null?void 0:b.data)||R.message||R;return pe.Logger.log("[Google Sheets] error:",I),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:I,result:null}}}})}}class T1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsDeleteProtectedRange,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.GoogleSheetsDeleteProtectedRange);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"deleteProtectedRange"),b="["+Ve(t,t.project,"Delete Protected Range")+": `"+T+"`] ",R=(Y,ee,J)=>{const te=Ve(Y==null?void 0:Y.valueOwner,m==null?void 0:m.logic,ee),re=Be(Y==null?void 0:Y.valueOwner,m==null?void 0:m.logic,J);return`"${te}" (\`${re}\`)`},I=n.find(Y=>{var ee;return((ee=Y.valueOwner.declaration)==null?void 0:ee.id)===G.operation[Q.GoogleSheetsDeleteProtectedRange].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(A);if(!O)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(Y=>{var ee;return((ee=Y.valueOwner.declaration)==null?void 0:ee.id)===G.operation[Q.GoogleSheetsDeleteProtectedRange].inputs.spreadsheetId.id}),x=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(x,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(Y=>{var ee;return((ee=Y.valueOwner.declaration)==null?void 0:ee.id)===G.operation[Q.GoogleSheetsDeleteProtectedRange].inputs.protectedRangeId.id}),q=(e=U==null?void 0:U.value)==null?void 0:e.value;if(q==null)throw new Error(`${b}The ${R(U,"protectedRangeId","protectedRangeId")} input is missing.`);const H={Authorization:`Bearer ${await m.getAccessToken()}`},W=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${O}`,ie=async Y=>Ht.post(W,Y,{headers:H});let z={};return z.deleteProtectedRange={protectedRangeId:typeof q=="string"&&q.trim().startsWith("{")?JSON.parse(q):q},await ie({method:"POST",endpoint:`/v4/spreadsheets/${$}:batchUpdate`,data:{requests:[z]}}),{value:K.Success,result:null,error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class v1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsAddBanding,version:"1.0.0",description:"Add Banding Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.GoogleSheetsAddBanding);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A,O,P,x,$,U;try{const q=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!q||!q.env)throw new Error("Editor context or environment missing");const Z=Be(t,t.project,"addBanding"),W="["+Ve(t,t.project,"Add Banding")+": `"+Z+"`] ",ie=(di,bt,dt)=>{const It=Ve(di==null?void 0:di.valueOwner,q==null?void 0:q.logic,bt),Wt=Be(di==null?void 0:di.valueOwner,q==null?void 0:q.logic,dt);return`"${It}" (\`${Wt}\`)`},z=n.find(di=>{var bt;return((bt=di.valueOwner.declaration)==null?void 0:bt.id)===G.operation[Q.GoogleSheetsAddBanding].inputs.connection.id}),Y=(s=z==null?void 0:z.value)==null?void 0:s.valueAsType;if(!Y||!Y.id||!Y.name||Y.type!==r.DefinitionEntity)throw new Error(`${W}The ${ie(z,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const ee=ui(Y);if(!ee)throw new Error(`${W}The ${ie(z,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const J=n.find(di=>{var bt;return((bt=di.valueOwner.declaration)==null?void 0:bt.id)===G.operation[Q.GoogleSheetsAddBanding].inputs.spreadsheetId.id}),te=(u=J==null?void 0:J.value)==null?void 0:u.value,re=ln(te,{errorPrefix:`${W}The ${ie(J,"Spreadsheet ID","spreadsheetId")} input `}),ae=n.find(di=>{var bt;return((bt=di.valueOwner.declaration)==null?void 0:bt.id)===G.operation[Q.GoogleSheetsAddBanding].inputs.bandedRange.id}),le=(e=ae==null?void 0:ae.value)==null?void 0:e.value;if(le==null)throw new Error(`${W}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[Q.GoogleSheetsAddBanding].inputs.bandingOrientation)==null?void 0:dt.id)}),ce=(f=oe==null?void 0:oe.value)==null?void 0:f.value,ge=typeof ce=="string"?ce:"Rows";if(!["Rows","Columns","Grid"].includes(ge))throw new Error(`${W}The ${ie(oe,"Banding Orientation","bandingOrientation")} input must be one of "Rows", "Columns", or "Grid". Received: "${ge}".`);const Ce=n.find(di=>{var bt,dt;return((bt=di.valueOwner.declaration)==null?void 0:bt.id)===((dt=G.operation[Q.GoogleSheetsAddBanding].inputs.headerColor)==null?void 0:dt.id)}),Ee=(y=Ce==null?void 0:Ce.value)==null?void 0:y.value,Oe=n.find(di=>{var bt,dt;return((bt=di.valueOwner.declaration)==null?void 0:bt.id)===((dt=G.operation[Q.GoogleSheetsAddBanding].inputs.firstBandColor)==null?void 0:dt.id)}),Le=(m=Oe==null?void 0:Oe.value)==null?void 0:m.value,Fe=n.find(di=>{var bt,dt;return((bt=di.valueOwner.declaration)==null?void 0:bt.id)===((dt=G.operation[Q.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[Q.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[Q.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[Q.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 q.getAccessToken()}`},Me=`${(I=q.env)==null?void 0:I.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${q.projectId}/${Zt["google-sheet"]}/${ee}`,Je=async di=>Ht.post(Me,di,{headers:pt});let ke=[],lt=[];try{lt=(await Je({method:"GET",endpoint:`/v4/spreadsheets/${re}?fields=sheets(properties(sheetId,title),bandedRanges)`})).data.sheets||[]}catch{}const Pt=await Ha(le,"Id",async()=>lt.map(di=>({id:di.properties.sheetId,name:di.properties.title}))),Gt=ps(Pt,{errorPrefix:`${W}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(`${W}Sheet "${Pt.sheet}" was not found in the spreadsheet.`);Gt.sheetId=si.properties.sheetId}else si=lt[0],Gt.sheetId=((A=si==null?void 0:si.properties)==null?void 0:A.sheetId)??0;Gt.startRowIndex===void 0&&Gt.endRowIndex===void 0&&Gt.startColumnIndex===void 0&&Gt.endColumnIndex===void 0&&(Gt.startRowIndex=0,Gt.endRowIndex=100,Gt.startColumnIndex=0,Gt.endColumnIndex=26),si!=null&&si.bandedRanges&&(ke=si.bandedRanges);const pi={range:Gt},kt=fo(Ee),Ct=fo(Le),xi=fo(tt),wn=fo(et),Yr=fo(ot),Jr={firstBandColor:Ct||{red:1,green:1,blue:1,alpha:1},secondBandColor:xi||{red:.95,green:.95,blue:.95,alpha:1}};kt&&(Jr.headerColor=kt),wn&&(Jr.footerColor=wn);const hi={firstBandColor:ge==="Grid"?Yr||Ct||{red:1,green:1,blue:1,alpha:1}:Ct||{red:1,green:1,blue:1,alpha:1},secondBandColor:ge==="Grid"?Yr||xi||{red:.95,green:.95,blue:.95,alpha:1}:xi||{red:.95,green:.95,blue:.95,alpha:1}};kt&&(hi.headerColor=kt),wn&&(hi.footerColor=wn),ge==="Grid"?(pi.rowProperties=Jr,pi.columnProperties=hi):ge==="Columns"?pi.columnProperties=hi:pi.rowProperties=Jr;const $t=[];if(ft)for(const di of ke)di.bandedRangeId!==void 0&&$t.push({deleteBanding:{bandedRangeId:di.bandedRangeId}});$t.push({addBanding:{bandedRange:pi}});const ci=(P=(O=(await Je({method:"POST",endpoint:`/v4/spreadsheets/${re}:batchUpdate`,data:{requests:$t}})).data)==null?void 0:O.replies)==null?void 0:P.find(di=>di.addBanding),oi=($=(x=ci==null?void 0:ci.addBanding)==null?void 0:x.bandedRange)==null?void 0:$.bandedRangeId;return{value:K.Success,result:{bandedRangeId:oi},error:null}}catch(q){const Z=((U=q.response)==null?void 0:U.data)||q.message||q;return pe.Logger.log("[Google Sheets] error:",Z),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:Z,result:null}}}})}}class ORn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsUpdateBanding,version:"1.0.0",description:"Update Banding Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.GoogleSheetsUpdateBanding);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A;try{const O=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!O||!O.env)throw new Error("Editor context or environment missing");const P=Be(t,t.project,"updateBanding"),$="["+Ve(t,t.project,"Update Banding")+": `"+P+"`] ",U=(ci,oi,di)=>{const bt=Ve(ci==null?void 0:ci.valueOwner,O==null?void 0:O.logic,oi),dt=Be(ci==null?void 0:ci.valueOwner,O==null?void 0:O.logic,di);return`"${bt}" (\`${dt}\`)`},q=n.find(ci=>{var oi;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===G.operation[Q.GoogleSheetsUpdateBanding].inputs.connection.id}),Z=(s=q==null?void 0:q.value)==null?void 0:s.valueAsType;if(!Z||!Z.id||!Z.name||Z.type!==r.DefinitionEntity)throw new Error(`${$}The ${U(q,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const H=ui(Z);if(!H)throw new Error(`${$}The ${U(q,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const W=n.find(ci=>{var oi;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===G.operation[Q.GoogleSheetsUpdateBanding].inputs.spreadsheetId.id}),ie=(u=W==null?void 0:W.value)==null?void 0:u.value,z=ln(ie,{errorPrefix:`${$}The ${U(W,"Spreadsheet ID","spreadsheetId")} input `}),Y=n.find(ci=>{var oi;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===G.operation[Q.GoogleSheetsUpdateBanding].inputs.bandedRangeId.id}),ee=(e=Y==null?void 0:Y.value)==null?void 0:e.value;if(ee==null||ee==="")throw new Error(`${$}The ${U(Y,"Banded Range ID","bandedRangeId")} input is missing.`);const J=Number(ee),te=n.find(ci=>{var oi,di;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===((di=G.operation[Q.GoogleSheetsUpdateBanding].inputs.bandedRange)==null?void 0:di.id)}),re=(f=te==null?void 0:te.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[Q.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[Q.GoogleSheetsUpdateBanding].inputs.headerColor)==null?void 0:di.id)}),ce=(m=oe==null?void 0:oe.value)==null?void 0:m.value,ge=n.find(ci=>{var oi,di;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===((di=G.operation[Q.GoogleSheetsUpdateBanding].inputs.firstBandColor)==null?void 0:di.id)}),Ce=(T=ge==null?void 0:ge.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[Q.GoogleSheetsUpdateBanding].inputs.secondBandColor)==null?void 0:di.id)}),Oe=(g=Ee==null?void 0:Ee.value)==null?void 0:g.value,Le=n.find(ci=>{var oi,di;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===((di=G.operation[Q.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[Q.GoogleSheetsUpdateBanding].inputs.gridBandColor)==null?void 0:di.id)}),We=(R=tt==null?void 0:tt.value)==null?void 0:R.value,qe={Authorization:`Bearer ${await O.getAccessToken()}`},ot=`${(I=O.env)==null?void 0:I.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${O.projectId}/${Zt["google-sheet"]}/${H}`,st=async ci=>Ht.post(ot,ci,{headers:qe});let ft=[];try{ft=(await st({method:"GET",endpoint:`/v4/spreadsheets/${z}?fields=sheets(properties(sheetId,title),bandedRanges)`})).data.sheets||[]}catch{}const Et=[];for(const ci of ft)if(ci.bandedRanges)for(const oi of ci.bandedRanges)Et.push({sheet:ci,band:oi});const pt=Et.find(ci=>Number(ci.band.bandedRangeId)===Number(J));if(Et.length>0&&!pt)throw new Error(`${$}No Banded Range with ID "${J}" was found in the sheet.`);const Me=pt==null?void 0:pt.band,Je={bandedRangeId:J};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(te,"bandedRange","bandedRange")} input `});(oi.sheetId===void 0||oi.sheetId===null)&&(oi.sheetId=0),Je.range=oi}else Me!=null&&Me.range&&(Je.range=Me.range);const ke=Me!=null&&Me.rowProperties&&(Me!=null&&Me.columnProperties)?"Grid":Me!=null&&Me.columnProperties?"Columns":"Rows",lt=le||ke,Pt=fo(ce),Gt=fo(Ce),si=fo(Oe),pi=fo(Fe),kt=fo(We),Ct=(Me==null?void 0:Me.rowProperties)||{},xi=(Me==null?void 0:Me.columnProperties)||{},wn={firstBandColor:Gt||Ct.firstBandColor||{red:1,green:1,blue:1,alpha:1},secondBandColor:si||Ct.secondBandColor||{red:.95,green:.95,blue:.95,alpha:1}},Yr=Pt||Ct.headerColor;Yr&&(wn.headerColor=Yr);const Jr=pi||Ct.footerColor;Jr&&(wn.footerColor=Jr);const hi={firstBandColor:lt==="Grid"?kt||Gt||xi.firstBandColor||{red:1,green:1,blue:1,alpha:1}:Gt||xi.firstBandColor||{red:1,green:1,blue:1,alpha:1},secondBandColor:lt==="Grid"?kt||si||xi.secondBandColor||{red:.95,green:.95,blue:.95,alpha:1}:si||xi.secondBandColor||{red:.95,green:.95,blue:.95,alpha:1}},$t=Pt||xi.headerColor;$t&&(hi.headerColor=$t);const Nt=pi||xi.footerColor;return Nt&&(hi.footerColor=Nt),lt==="Grid"?(Je.rowProperties=wn,Je.columnProperties=hi):lt==="Columns"?Je.columnProperties=hi:Je.rowProperties=wn,await st({method:"POST",endpoint:`/v4/spreadsheets/${z}:batchUpdate`,data:{requests:[{updateBanding:{bandedRange:Je,fields:"*"}}]}}),{value:K.Success,result:null,error:null}}catch(O){const P=((A=O.response)==null?void 0:A.data)||O.message||O;return pe.Logger.log("[Google Sheets] error:",P),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:P,result:null}}}})}}class xRn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsDeleteBanding,version:"1.0.0",description:"Delete Banding Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.GoogleSheetsDeleteBanding);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"deleteBanding"),b="["+Ve(t,t.project,"Delete Banding")+": `"+T+"`] ",R=(Y,ee,J)=>{const te=Ve(Y==null?void 0:Y.valueOwner,m==null?void 0:m.logic,ee),re=Be(Y==null?void 0:Y.valueOwner,m==null?void 0:m.logic,J);return`"${te}" (\`${re}\`)`},I=n.find(Y=>{var ee;return((ee=Y.valueOwner.declaration)==null?void 0:ee.id)===G.operation[Q.GoogleSheetsDeleteBanding].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(A);if(!O)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(Y=>{var ee;return((ee=Y.valueOwner.declaration)==null?void 0:ee.id)===G.operation[Q.GoogleSheetsDeleteBanding].inputs.spreadsheetId.id}),x=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(x,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(Y=>{var ee;return((ee=Y.valueOwner.declaration)==null?void 0:ee.id)===G.operation[Q.GoogleSheetsDeleteBanding].inputs.bandedRangeId.id}),q=(e=U==null?void 0:U.value)==null?void 0:e.value;if(q==null||q==="")throw new Error(`${b}The ${R(U,"Banded Range ID","bandedRangeId")} input is missing.`);const Z=Number(q),W={Authorization:`Bearer ${await m.getAccessToken()}`},ie=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${O}`;return await(async Y=>Ht.post(ie,Y,{headers:W}))({method:"POST",endpoint:`/v4/spreadsheets/${$}:batchUpdate`,data:{requests:[{deleteBanding:{bandedRangeId: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 g1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsAddChart,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.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,ge)=>{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,ge);return`"${Ce}" (\`${Ee}\`)`},O=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[Q.GoogleSheetsAddChart].inputs.connection.id}),P=(s=O==null?void 0:O.value)==null?void 0:s.valueAsType;if(!P||!P.id||!P.name||P.type!==r.DefinitionEntity)throw new Error(`${I}The ${A(O,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=ui(P);if(!x)throw new Error(`${I}The ${A(O,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const $=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[Q.GoogleSheetsAddChart].inputs.spreadsheetId.id}),U=(u=$==null?void 0:$.value)==null?void 0:u.value,q=ln(U,{errorPrefix:`${I}The ${A($,"Spreadsheet ID","spreadsheetId")} input `}),Z=n.find(oe=>{var ce;return((ce=oe.valueOwner.declaration)==null?void 0:ce.id)===G.operation[Q.GoogleSheetsAddChart].inputs.chart.id}),H=(e=Z==null?void 0:Z.value)==null?void 0:e.value;if(H==null||typeof H!="object")throw new Error(`${I}The ${A(Z,"Chart","chart")} input is missing or invalid. Expected a valid chart object.`);const ie={Authorization:`Bearer ${await g.getAccessToken()}`},z=`${(f=g.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${g.projectId}/${Zt["google-sheet"]}/${x}`,Y=async oe=>Ht.post(z,oe,{headers:ie});let ee={};ee.addChart={chart:H};const te=(await Y({method:"POST",endpoint:`/v4/spreadsheets/${q}:batchUpdate`,data:{requests:[ee]}})).data,re=(m=(y=te==null?void 0:te.replies)==null?void 0:y[0])==null?void 0:m.addChart,ae=(re==null?void 0:re.chart)??null,le=(ae==null?void 0:ae.chartId)??null;return{value:K.Success,result:{chartId:le,chart:ae},error:null}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return pe.Logger.log("[Google Sheets] error:",b),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:b,result:null}}}})}}function PRn(a){return{"Number greater than":"NUMBER_GREATER","Number greater than or equal":"NUMBER_GREATER_THAN_EQ","Number less than":"NUMBER_LESS","Number less than or equal":"NUMBER_LESS_THAN_EQ","Number equal to":"NUMBER_EQ","Number not equal to":"NUMBER_NOT_EQ","Number between":"NUMBER_BETWEEN","Number not between":"NUMBER_NOT_BETWEEN","Text contains":"TEXT_CONTAINS","Text does not contain":"TEXT_NOT_CONTAINS","Text starts with":"TEXT_STARTS_WITH","Text ends with":"TEXT_ENDS_WITH","Text equals":"TEXT_EQ","Date is":"DATE_EQ","Date is before":"DATE_BEFORE","Date is after":"DATE_AFTER","Date is on or before":"DATE_ON_OR_BEFORE","Date is on or after":"DATE_ON_OR_AFTER","Cell is empty":"BLANK","Cell is not empty":"NOT_BLANK","Custom formula":"CUSTOM_FORMULA"}[a]||a}class b1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsAddConditionalFormatRule,version:"1.0.0",description:"Add Conditional Format Rule Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.GoogleSheetsAddConditionalFormatRule);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=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[Q.GoogleSheetsAddConditionalFormatRule].inputs,A=pt=>{var Je;const Me=n.find(ke=>{var lt;return((lt=ke.valueOwner.declaration)==null?void 0:lt.id)===pt});return(Je=Me==null?void 0:Me.value)==null?void 0:Je.value},O=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===I.connection.id}),P=(s=O==null?void 0:O.value)==null?void 0:s.valueAsType;if(!P||!P.id||!P.name||P.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(O,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=ui(P);if(!x)throw new Error(`${b}The ${R(O,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const $=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===I.spreadsheetId.id}),U=(u=$==null?void 0:$.value)==null?void 0:u.value,q=ln(U,{errorPrefix:`${b}The ${R($,"Spreadsheet ID","spreadsheetId")} input `}),H={Authorization:`Bearer ${await m.getAccessToken()}`},W=`${(e=m.env)==null?void 0:e.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${x}`,ie=async pt=>Ht.post(W,pt,{headers:H}),z=n.find(pt=>{var Me;return((Me=pt.valueOwner.declaration)==null?void 0:Me.id)===I.range.id}),Y=A(I.range.id),ee=A(I.conditionType.id),J=A(I.conditionValues.id),te=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),ge=A(I.index.id),Ce=A(I.fontSize.id),Ee=A(I.fontFamily.id),Oe=A(I.horizontalAlignment.id),Le=A(I.verticalAlignment.id),Fe=A(I.wrapStrategy.id);if(!Y)throw new Error(`${b}The ${R(z,"Range","range")} input must be provided.`);let tt=ps(Y,{errorPrefix:`${b}The Range input `});if(tt.sheetId===void 0){let pt;if(typeof Y=="object"&&Y!==null&&"sheet"in Y?pt=String(Y.sheet):typeof Y=="string"&&Y.includes("!")&&(pt=Y.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/${q}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:f.sheets)||[]).find(lt=>{var Pt;return String((Pt=lt.properties)==null?void 0:Pt.title).trim().toLowerCase()===pt.trim().toLowerCase()});ke&&(tt.sheetId=ke.properties.sheetId)}}const We=PRn(String(ee||"BLANK"));let et=[];Array.isArray(J)?et=J.map(pt=>({userEnteredValue:String(pt)})):J!=null&&J!==""&&(et=[{userEnteredValue:String(J)}]);const qe={},ot=fo(te);ot&&(qe.backgroundColor=ot);const st=fo(re);if(st&&(qe.textFormat=qe.textFormat||{},qe.textFormat.foregroundColor=st),(ae===!0||ae==="true")&&(qe.textFormat=qe.textFormat||{},qe.textFormat.bold=!0),(le===!0||le==="true")&&(qe.textFormat=qe.textFormat||{},qe.textFormat.italic=!0),(oe===!0||oe==="true")&&(qe.textFormat=qe.textFormat||{},qe.textFormat.strikethrough=!0),(ce===!0||ce==="true")&&(qe.textFormat=qe.textFormat||{},qe.textFormat.underline=!0),Ce!=null&&Ce!==""){const pt=typeof Ce=="number"?Ce:parseInt(String(Ce),10);isNaN(pt)||(qe.textFormat=qe.textFormat||{},qe.textFormat.fontSize=pt)}if(typeof Ee=="string"&&Ee.trim()!==""&&(qe.textFormat=qe.textFormat||{},qe.textFormat.fontFamily=Ee.trim()),typeof Oe=="string"&&Oe!==""){const pt={Left:"LEFT",Center:"CENTER",Right:"RIGHT",Justify:"JUSTIFY"};qe.horizontalAlignment=pt[Oe]||Oe.toUpperCase()}if(typeof Le=="string"&&Le!==""){const pt={Top:"TOP",Middle:"MIDDLE",Bottom:"BOTTOM"};qe.verticalAlignment=pt[Le]||Le.toUpperCase()}if(typeof Fe=="string"&&Fe!==""){const pt={Overflow:"OVERFLOW_CELL",Wrap:"WRAP",Clip:"CLIP"};qe.wrapStrategy=pt[Fe]||Fe.toUpperCase()}const Et={rule:{ranges:[tt],booleanRule:{condition:{type:We,...et.length?{values:et}:{}},format:qe}}};if(ge!=null&&ge!==""){const pt=typeof ge=="number"?ge:parseInt(String(ge),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/${q}:batchUpdate`,data:{requests:[{addConditionalFormatRule:Et}]}}),{value:K.Success,result:null,error:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class E1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsAddProtectedRange,version:"1.0.0",description:"Add Protected Range Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.GoogleSheetsAddProtectedRange);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A,O,P,x,$;try{const U=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!U||!U.env)throw new Error("Editor context or environment missing");const q=Be(t,t.project,"addProtectedRange"),H="["+Ve(t,t.project,"Add Protected Range")+": `"+q+"`] ",W=(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[Q.GoogleSheetsAddProtectedRange].inputs.connection.id}),z=(s=ie==null?void 0:ie.value)==null?void 0:s.valueAsType;if(!z||!z.id||!z.name||z.type!==r.DefinitionEntity)throw new Error(`${H}The ${W(ie,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const Y=ui(z);if(!Y)throw new Error(`${H}The ${W(ie,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const ee=n.find(Pt=>{var Gt;return((Gt=Pt.valueOwner.declaration)==null?void 0:Gt.id)===G.operation[Q.GoogleSheetsAddProtectedRange].inputs.spreadsheetId.id}),J=(u=ee==null?void 0:ee.value)==null?void 0:u.value,te=ln(J,{errorPrefix:`${H}The ${W(ee,"Spreadsheet ID","spreadsheetId")} input `}),re=n.find(Pt=>{var Gt;return((Gt=Pt.valueOwner.declaration)==null?void 0:Gt.id)===G.operation[Q.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 ${W(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[Q.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[Q.GoogleSheetsAddProtectedRange].inputs.warningOnly.id}),ge=(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[Q.GoogleSheetsAddProtectedRange].inputs.editors.id}),Ee=(m=Ce==null?void 0:Ce.value)==null?void 0:m.value,Oe=n.find(Pt=>{var Gt;return((Gt=Pt.valueOwner.declaration)==null?void 0:Gt.id)===G.operation[Q.GoogleSheetsAddProtectedRange].inputs.domainUsersCanEdit.id}),Le=(T=Oe==null?void 0:Oe.value)==null?void 0:T.value,tt={Authorization:`Bearer ${await U.getAccessToken()}`},We=`${(g=U.env)==null?void 0:g.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${U.projectId}/${Zt["google-sheet"]}/${Y}`,et=async Pt=>Ht.post(We,Pt,{headers:tt});let qe=[];try{qe=((b=(await et({method:"GET",endpoint:`/v4/spreadsheets/${te}?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 ${W(re,"Protected Range","range")} input `})};oe!=null&&oe!==""&&(ft.description=oe);const Et=Array.isArray(Ee)&&Ee.length>0,pt=typeof Le=="boolean";if(ge===!0&&Et)throw new Error(`${H}When ${W(ce,"Warning Only","warningOnly")} is enabled (true), ${W(Ce,"Editors","editors")} cannot be specified.`);if(ge===!0&&pt)throw new Error(`${H}When ${W(ce,"Warning Only","warningOnly")} is enabled (true), ${W(Oe,"Domain Users Can Edit","domainUsersCanEdit")} cannot be specified.`);if(typeof ge=="boolean"&&(ft.warningOnly=ge),!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[Q.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 ${W(Me,"Exception ranges","unprotectedRanges")} input `})}));ft.unprotectedRanges=Pt}const lt=(x=(P=(O=(A=(I=(await et({method:"POST",endpoint:`/v4/spreadsheets/${te}:batchUpdate`,data:{requests:[{addProtectedRange:{protectedRange:ft}}]}})).data)==null?void 0:I.replies)==null?void 0:A[0])==null?void 0:O.addProtectedRange)==null?void 0:P.protectedRange)==null?void 0:x.protectedRangeId;return{value:K.Success,result:{protectedRangeId:lt},error:null}}catch(U){const q=(($=U.response)==null?void 0:$.data)||U.message||U;return pe.Logger.log("[Google Sheets] error:",q),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:q,result:null}}}})}}class I1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsUpdateChartSpec,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.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),ge=Be(ae==null?void 0:ae.valueOwner,T==null?void 0:T.logic,oe);return`"${ce}" (\`${ge}\`)`},A=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[Q.GoogleSheetsUpdateChartSpec].inputs.connection.id}),O=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${R}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const P=ui(O);if(!P)throw new Error(`${R}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[Q.GoogleSheetsUpdateChartSpec].inputs.spreadsheetId.id}),$=(u=x==null?void 0:x.value)==null?void 0:u.value,U=ln($,{errorPrefix:`${R}The ${I(x,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[Q.GoogleSheetsUpdateChartSpec].inputs.chartId.id}),Z=(e=q==null?void 0:q.value)==null?void 0:e.value;let H=typeof Z=="number"?Z:typeof Z=="string"?parseInt(Z,10):NaN;if(isNaN(H))throw new Error(`${R}The ${I(q,"Chart ID","chartId")} input is missing or invalid. Expected a numeric chart ID.`);const W=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[Q.GoogleSheetsUpdateChartSpec].inputs.chart.id}),ie=(f=W==null?void 0:W.value)==null?void 0:f.value;if(ie==null||typeof ie!="object")throw new Error(`${R}The ${I(W,"Chart Spec","chart")} input is missing or invalid. Expected a valid chart object.`);const Y={Authorization:`Bearer ${await T.getAccessToken()}`},ee=`${(y=T.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${T.projectId}/${Zt["google-sheet"]}/${P}`,J=async ae=>Ht.post(ee,ae,{headers:Y}),te=ie.spec?ie.spec:ie;let re={};return re.updateChartSpec={chartId:H,spec:te},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 R1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsCreatePivotTable,version:"1.0.0",description:"Create Pivot Table Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.Editor])[0];if(!I||!I.env)throw new Error("Editor context or environment missing");const A=Be(t,t.project,"createPivotTable"),P="["+Ve(t,t.project,"Create Pivot Table")+": `"+A+"`] ",x=(ke,lt,Pt)=>{const Gt=Ve(ke==null?void 0:ke.valueOwner,I==null?void 0:I.logic,lt),si=Be(ke==null?void 0:ke.valueOwner,I==null?void 0:I.logic,Pt);return`"${Gt}" (\`${si}\`)`},$=n.find(ke=>{var lt;return((lt=ke.valueOwner.declaration)==null?void 0:lt.id)===G.operation[Q.GoogleSheetsCreatePivotTable].inputs.connection.id}),U=(s=$==null?void 0:$.value)==null?void 0:s.valueAsType;if(!U||!U.id||!U.name||U.type!==r.DefinitionEntity)throw new Error(`${P}The ${x($,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const q=ui(U);if(!q)throw new Error(`${P}The ${x($,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const Z=n.find(ke=>{var lt;return((lt=ke.valueOwner.declaration)==null?void 0:lt.id)===G.operation[Q.GoogleSheetsCreatePivotTable].inputs.spreadsheetId.id}),H=(u=Z==null?void 0:Z.value)==null?void 0:u.value,W=ln(H,{errorPrefix:`${P}The ${x(Z,"Spreadsheet ID","spreadsheetId")} input `}),ie=n.find(ke=>{var lt;return((lt=ke.valueOwner.declaration)==null?void 0:lt.id)===G.operation[Q.GoogleSheetsCreatePivotTable].inputs.destination.id}),z=(e=ie==null?void 0:ie.value)==null?void 0:e.value;if(z==null)throw new Error(`${P}The ${x(ie,"Destination","destination")} input is missing.`);const Y=n.find(ke=>{var lt;return((lt=ke.valueOwner.declaration)==null?void 0:lt.id)===G.operation[Q.GoogleSheetsCreatePivotTable].inputs.source.id}),ee=(f=Y==null?void 0:Y.value)==null?void 0:f.value;if(ee==null)throw new Error(`${P}The ${x(Y,"Data range","source")} input is missing.`);const J=n.find(ke=>{var lt;return((lt=ke.valueOwner.declaration)==null?void 0:lt.id)===G.operation[Q.GoogleSheetsCreatePivotTable].inputs.rows.id}),te=((y=J==null?void 0:J.value)==null?void 0:y.value)||[],re=n.find(ke=>{var lt;return((lt=ke.valueOwner.declaration)==null?void 0:lt.id)===G.operation[Q.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[Q.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[Q.GoogleSheetsCreatePivotTable].inputs.valueLayout.id}),ge=((g=ce==null?void 0:ce.value)==null?void 0:g.value)||"HORIZONTAL",Ee={Authorization:`Bearer ${await I.getAccessToken()}`},Oe=`${(b=I.env)==null?void 0:b.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${I.projectId}/${Zt["google-sheet"]}/${q}`,Le=async ke=>Ht.post(Oe,ke,{headers:Ee});let Fe=[];try{Fe=(await Le({method:"GET",endpoint:`/v4/spreadsheets/${W}?fields=sheets(properties(sheetId,title))`})).data.sheets||[]}catch{}const tt=await Ha(z,"Id",async()=>Fe.map(ke=>({id:ke.properties.sheetId,name:ke.properties.title}))),We=ps(tt,{errorPrefix:`${P}The ${x(ie,"Destination","destination")} input `}),et={sheetId:We.sheetId??0,rowIndex:We.startRowIndex??0,columnIndex:We.startColumnIndex??0},qe=await Ha(ee,"Id",async()=>Fe.map(ke=>({id:ke.properties.sheetId,name:ke.properties.title}))),ot=ps(qe,{errorPrefix:`${P}The ${x(Y,"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(te),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:ge||"HORIZONTAL"};let Je={updateCells:{start:et,rows:[{values:[{pivotTable:Me}]}],fields:"pivotTable"}};return await Le({method:"POST",endpoint:`/v4/spreadsheets/${W}:batchUpdate`,data:{requests:[Je]}}),{value:K.Success,result:null,error:null}}catch(I){const A=((R=I.response)==null?void 0:R.data)||I.message||I;return pe.Logger.log("[Google Sheets] error:",A),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:A,result:null}}}})}}class A1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsInsertDimension,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.Editor])[0];if(!I||!I.env)throw new Error("Editor context or environment missing");const A=Be(t,t.project,"insertDimension"),P="["+Ve(t,t.project,"Insert Dimension")+": `"+A+"`] ",x=(qe,ot,st)=>{const ft=Ve(qe==null?void 0:qe.valueOwner,I==null?void 0:I.logic,ot),Et=Be(qe==null?void 0:qe.valueOwner,I==null?void 0:I.logic,st);return`"${ft}" (\`${Et}\`)`},$=n.find(qe=>{var ot;return((ot=qe.valueOwner.declaration)==null?void 0:ot.id)===G.operation[Q.GoogleSheetsInsertDimension].inputs.connection.id}),U=(s=$==null?void 0:$.value)==null?void 0:s.valueAsType;if(!U||!U.id||!U.name||U.type!==r.DefinitionEntity)throw new Error(`${P}The ${x($,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const q=ui(U);if(!q)throw new Error(`${P}The ${x($,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const Z=n.find(qe=>{var ot;return((ot=qe.valueOwner.declaration)==null?void 0:ot.id)===G.operation[Q.GoogleSheetsInsertDimension].inputs.spreadsheetId.id}),H=(u=Z==null?void 0:Z.value)==null?void 0:u.value,W=ln(H,{errorPrefix:`${P}The ${x(Z,"Spreadsheet ID","spreadsheetId")} input `}),ie=n.find(qe=>{var ot,st;return((ot=qe.valueOwner.declaration)==null?void 0:ot.id)===((st=G.operation[Q.GoogleSheetsInsertDimension].inputs.sheet)==null?void 0:st.id)}),z=(e=ie==null?void 0:ie.value)==null?void 0:e.value,Y=n.find(qe=>{var ot,st;return((ot=qe.valueOwner.declaration)==null?void 0:ot.id)===((st=G.operation[Q.GoogleSheetsInsertDimension].inputs.dimension)==null?void 0:st.id)}),ee=(f=Y==null?void 0:Y.value)==null?void 0:f.value,J=n.find(qe=>{var ot,st;return((ot=qe.valueOwner.declaration)==null?void 0:ot.id)===((st=G.operation[Q.GoogleSheetsInsertDimension].inputs.startIndex)==null?void 0:st.id)}),te=(y=J==null?void 0:J.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[Q.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[Q.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"]}/${q}`,Oe=async qe=>Ht.post(Ee,qe,{headers:Ce});if(z==null||z==="")throw new Error(`${P}The ${x(ie,"Sheet","sheet")} input is missing.`);if(ee==null||ee==="")throw new Error(`${P}The ${x(Y,"Dimension","dimension")} input is missing.`);const Le=String(ee).trim().toUpperCase();if(Le!=="ROWS"&&Le!=="COLUMNS")throw new Error(`${P}The ${x(Y,"Dimension","dimension")} input is invalid. Expected "Rows" or "Columns".`);const Fe=typeof te=="number"?te:parseInt(String(te),10);if(isNaN(Fe)||Fe<1)throw new Error(`${P}The ${x(J,"Start index","startIndex")} input is missing or invalid. Expected a positive integer starting at 1.`);let tt=Fe;if(ae!=null&&ae!==""&&(tt=typeof ae=="number"?ae:parseInt(String(ae),10),isNaN(tt)||tt<Fe))throw new Error(`${P}The ${x(re,"End index","endIndex")} input is invalid. Expected an integer greater than or equal to Start index.`);let We;if(typeof z=="number"||/^\d+$/.test(String(z).trim()))We=Number(z);else{const st=(((b=(await Oe({method:"GET",endpoint:`/v4/spreadsheets/${W}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:b.sheets)||[]).find(ft=>{var Et;return String((Et=ft.properties)==null?void 0:Et.title).trim().toLowerCase()===String(z).trim().toLowerCase()});if(!st)throw new Error(`${P}The ${x(ie,"Sheet","sheet")} input "${z}" was not found in spreadsheet.`);We=st.properties.sheetId}const et={range:{sheetId:We,dimension:Le,startIndex:Fe-1,endIndex:tt}};return typeof ce=="boolean"&&(et.inheritFromBefore=ce),await Oe({method:"POST",endpoint:`/v4/spreadsheets/${W}:batchUpdate`,data:{requests:[{insertDimension:et}]}}),{value:K.Success,result:null,error:null}}catch(I){const A=((R=I.response)==null?void 0:R.data)||I.message||I;return pe.Logger.log("[Google Sheets] error:",A),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:A,result:null}}}})}}class D1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsMoveDimension,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.Editor])[0];if(!I||!I.env)throw new Error("Editor context or environment missing");const A=Be(t,t.project,"moveDimension"),P="["+Ve(t,t.project,"Move Dimension")+": `"+A+"`] ",x=(et,qe,ot)=>{const st=Ve(et==null?void 0:et.valueOwner,I==null?void 0:I.logic,qe),ft=Be(et==null?void 0:et.valueOwner,I==null?void 0:I.logic,ot);return`"${st}" (\`${ft}\`)`},$=n.find(et=>{var qe;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===G.operation[Q.GoogleSheetsMoveDimension].inputs.connection.id}),U=(s=$==null?void 0:$.value)==null?void 0:s.valueAsType;if(!U||!U.id||!U.name||U.type!==r.DefinitionEntity)throw new Error(`${P}The ${x($,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const q=ui(U);if(!q)throw new Error(`${P}The ${x($,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const Z=n.find(et=>{var qe;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===G.operation[Q.GoogleSheetsMoveDimension].inputs.spreadsheetId.id}),H=(u=Z==null?void 0:Z.value)==null?void 0:u.value,W=ln(H,{errorPrefix:`${P}The ${x(Z,"Spreadsheet ID","spreadsheetId")} input `}),ie=n.find(et=>{var qe,ot;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===((ot=G.operation[Q.GoogleSheetsMoveDimension].inputs.sheet)==null?void 0:ot.id)}),z=(e=ie==null?void 0:ie.value)==null?void 0:e.value,Y=n.find(et=>{var qe,ot;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===((ot=G.operation[Q.GoogleSheetsMoveDimension].inputs.dimension)==null?void 0:ot.id)}),ee=(f=Y==null?void 0:Y.value)==null?void 0:f.value,J=n.find(et=>{var qe,ot;return((qe=et.valueOwner.declaration)==null?void 0:qe.id)===((ot=G.operation[Q.GoogleSheetsMoveDimension].inputs.startIndex)==null?void 0:ot.id)}),te=(y=J==null?void 0:J.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[Q.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[Q.GoogleSheetsMoveDimension].inputs.destinationIndex)==null?void 0:ot.id)}),oe=(T=le==null?void 0:le.value)==null?void 0:T.value,ge={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"]}/${q}`,Ee=async et=>Ht.post(Ce,et,{headers:ge});if(z==null||z==="")throw new Error(`${P}The ${x(ie,"Sheet","sheet")} input is missing.`);if(ee==null||ee==="")throw new Error(`${P}The ${x(Y,"Dimension","dimension")} input is missing.`);const Oe=String(ee).trim().toUpperCase();if(Oe!=="ROWS"&&Oe!=="COLUMNS")throw new Error(`${P}The ${x(Y,"Dimension","dimension")} input is invalid. Expected "Rows" or "Columns".`);const Le=typeof te=="number"?te:parseInt(String(te),10);if(isNaN(Le)||Le<1)throw new Error(`${P}The ${x(J,"Start index","startIndex")} input is missing or invalid. Expected a positive integer starting at 1.`);let Fe=Le;if(ae!=null&&ae!==""&&(Fe=typeof ae=="number"?ae:parseInt(String(ae),10),isNaN(Fe)||Fe<Le))throw new Error(`${P}The ${x(re,"End index","endIndex")} input is invalid. Expected an integer greater than or equal to Start index.`);const tt=typeof oe=="number"?oe:parseInt(String(oe),10);if(isNaN(tt)||tt<1)throw new Error(`${P}The ${x(le,"Destination index","destinationIndex")} input is missing or invalid. Expected a positive integer starting at 1.`);let We;if(typeof z=="number"||/^\d+$/.test(String(z).trim()))We=Number(z);else{const ot=(((b=(await Ee({method:"GET",endpoint:`/v4/spreadsheets/${W}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:b.sheets)||[]).find(st=>{var ft;return String((ft=st.properties)==null?void 0:ft.title).trim().toLowerCase()===String(z).trim().toLowerCase()});if(!ot)throw new Error(`${P}The ${x(ie,"Sheet","sheet")} input "${z}" was not found in spreadsheet.`);We=ot.properties.sheetId}return await Ee({method:"POST",endpoint:`/v4/spreadsheets/${W}:batchUpdate`,data:{requests:[{moveDimension:{source:{sheetId:We,dimension:Oe,startIndex:Le-1,endIndex:Fe},destinationIndex:tt-1}}]}}),{value:K.Success,result:null,error:null}}catch(I){const A=((R=I.response)==null?void 0:R.data)||I.message||I;return pe.Logger.log("[Google Sheets] error:",A),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:A,result:null}}}})}}function VRn(a){return{"Number greater than":"NUMBER_GREATER","Number greater than or equal":"NUMBER_GREATER_THAN_EQ","Number less than":"NUMBER_LESS","Number less than or equal":"NUMBER_LESS_THAN_EQ","Number equal to":"NUMBER_EQ","Number not equal to":"NUMBER_NOT_EQ","Number between":"NUMBER_BETWEEN","Number not between":"NUMBER_NOT_BETWEEN","Text contains":"TEXT_CONTAINS","Text does not contain":"TEXT_NOT_CONTAINS","Text starts with":"TEXT_STARTS_WITH","Text ends with":"TEXT_ENDS_WITH","Text equals":"TEXT_EQ","Date is":"DATE_EQ","Date is before":"DATE_BEFORE","Date is after":"DATE_AFTER","Date is on or before":"DATE_ON_OR_BEFORE","Date is on or after":"DATE_ON_OR_AFTER","Cell is empty":"BLANK","Cell is not empty":"NOT_BLANK","Custom formula":"CUSTOM_FORMULA"}[a]||a}class C1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsUpdateConditionalFormatRule,version:"1.0.0",description:"Update Conditional Format Rule Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.GoogleSheetsUpdateConditionalFormatRule);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A,O,P;try{const x=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!x||!x.env)throw new Error("Editor context or environment missing");const $=Be(t,t.project,"updateConditionalFormatRule"),q="["+Ve(t,t.project,"Update Conditional Format Rule")+": `"+$+"`] ",Z=(hi,$t,Nt)=>{const ci=Ve(hi==null?void 0:hi.valueOwner,x==null?void 0:x.logic,$t),oi=Be(hi==null?void 0:hi.valueOwner,x==null?void 0:x.logic,Nt);return`"${ci}" (\`${oi}\`)`},H=G.operation[Q.GoogleSheetsUpdateConditionalFormatRule].inputs,W=hi=>{var Nt;const $t=n.find(ci=>{var oi;return((oi=ci.valueOwner.declaration)==null?void 0:oi.id)===hi});return(Nt=$t==null?void 0:$t.value)==null?void 0:Nt.value},ie=n.find(hi=>{var $t;return(($t=hi.valueOwner.declaration)==null?void 0:$t.id)===H.connection.id}),z=(s=ie==null?void 0:ie.value)==null?void 0:s.valueAsType;if(!z||!z.id||!z.name||z.type!==r.DefinitionEntity)throw new Error(`${q}The ${Z(ie,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const Y=ui(z);if(!Y)throw new Error(`${q}The ${Z(ie,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const ee=n.find(hi=>{var $t;return(($t=hi.valueOwner.declaration)==null?void 0:$t.id)===H.spreadsheetId.id}),J=(u=ee==null?void 0:ee.value)==null?void 0:u.value,te=ln(J,{errorPrefix:`${q}The ${Z(ee,"Spreadsheet ID","spreadsheetId")} input `}),re=n.find(hi=>{var $t;return(($t=hi.valueOwner.declaration)==null?void 0:$t.id)===H.sheet.id}),ae=(e=re==null?void 0:re.value)==null?void 0:e.value;if(ae==null||ae==="")throw new Error(`${q}The ${Z(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(`${q}The ${Z(le,"Index","index")} input is missing.`);const ce=typeof oe=="number"?oe:parseInt(String(oe),10);if(isNaN(ce)||ce<1)throw new Error(`${q}The ${Z(le,"Index","index")} input must be a 1-based positive integer.`);const Ce={Authorization:`Bearer ${await x.getAccessToken()}`},Ee=`${(y=x.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${x.projectId}/${Zt["google-sheet"]}/${Y}`,Oe=async hi=>Ht.post(Ee,hi,{headers:Ce});let Le;if(typeof ae=="number"||/^\d+$/.test(String(ae).trim()))Le=Number(ae);else{const Nt=(((m=(await Oe({method:"GET",endpoint:`/v4/spreadsheets/${te}?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(`${q}The ${Z(re,"Sheet","sheet")} input "${ae}" was not found in spreadsheet.`);Le=Nt.properties.sheetId}const Fe=W(H.newIndex.id),tt=W(H.range.id),We=W(H.conditionType.id),et=W(H.conditionValues.id),qe=W(H.backgroundColor.id),ot=W(H.textColor.id),st=W(H.bold.id),ft=W(H.italic.id),Et=W(H.strikethrough.id),pt=W(H.underline.id),Me=W(H.fontSize.id),Je=W(H.fontFamily.id),ke=W(H.horizontalAlignment.id),lt=W(H.verticalAlignment.id),Pt=W(H.wrapStrategy.id);let Gt=null;try{const Nt=(((T=(await Oe({method:"GET",endpoint:`/v4/spreadsheets/${te}?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:`${q}The Range input `}),si.sheetId===void 0&&(si.sheetId=Le));const pi=si?[si]:Gt&&Gt.ranges||[{sheetId:Le}];let kt=null;if(We!=null&&String(We).trim()!==""){const hi=VRn(String(We));let $t=[];Array.isArray(et)?$t=et.map(Nt=>({userEnteredValue:String(Nt)})):et!=null&&et!==""?$t=[{userEnteredValue:String(et)}]:((b=(g=Gt==null?void 0:Gt.booleanRule)==null?void 0:g.condition)==null?void 0:b.type)===hi&&Array.isArray((I=(R=Gt==null?void 0:Gt.booleanRule)==null?void 0:R.condition)==null?void 0:I.values)&&($t=Gt.booleanRule.condition.values),kt={type:hi,...$t.length?{values:$t}:{}}}else if((A=Gt==null?void 0:Gt.booleanRule)!=null&&A.condition)kt=JSON.parse(JSON.stringify(Gt.booleanRule.condition));else{const hi="BLANK";let $t=[];Array.isArray(et)?$t=et.map(Nt=>({userEnteredValue:String(Nt)})):et!=null&&et!==""&&($t=[{userEnteredValue:String(et)}]),kt={type:hi,...$t.length?{values:$t}:{}}}const Ct=(O=Gt==null?void 0:Gt.booleanRule)!=null&&O.format?JSON.parse(JSON.stringify(Gt.booleanRule.format)):{},xi=fo(qe);xi&&(Ct.backgroundColor=xi);const wn=fo(ot);if(wn&&(Ct.textFormat=Ct.textFormat||{},Ct.textFormat.foregroundColor=wn),st===!0||st==="true"?(Ct.textFormat=Ct.textFormat||{},Ct.textFormat.bold=!0):(st===!1||st==="false")&&Ct.textFormat&&(Ct.textFormat.bold=!1),ft===!0||ft==="true"?(Ct.textFormat=Ct.textFormat||{},Ct.textFormat.italic=!0):(ft===!1||ft==="false")&&Ct.textFormat&&(Ct.textFormat.italic=!1),Et===!0||Et==="true"?(Ct.textFormat=Ct.textFormat||{},Ct.textFormat.strikethrough=!0):(Et===!1||Et==="false")&&Ct.textFormat&&(Ct.textFormat.strikethrough=!1),pt===!0||pt==="true"?(Ct.textFormat=Ct.textFormat||{},Ct.textFormat.underline=!0):(pt===!1||pt==="false")&&Ct.textFormat&&(Ct.textFormat.underline=!1),Me!=null&&Me!==""){const hi=typeof Me=="number"?Me:parseInt(String(Me),10);isNaN(hi)||(Ct.textFormat=Ct.textFormat||{},Ct.textFormat.fontSize=hi)}if(typeof Je=="string"&&Je.trim()!==""&&(Ct.textFormat=Ct.textFormat||{},Ct.textFormat.fontFamily=Je.trim()),typeof ke=="string"&&ke!==""){const hi={Left:"LEFT",Center:"CENTER",Right:"RIGHT",Justify:"JUSTIFY"};Ct.horizontalAlignment=hi[ke]||ke.toUpperCase()}if(typeof lt=="string"&&lt!==""){const hi={Top:"TOP",Middle:"MIDDLE",Bottom:"BOTTOM"};Ct.verticalAlignment=hi[lt]||lt.toUpperCase()}if(typeof Pt=="string"&&Pt!==""){const hi={Overflow:"OVERFLOW_CELL",Wrap:"WRAP",Clip:"CLIP"};Ct.wrapStrategy=hi[Pt]||Pt.toUpperCase()}const Yr={...Gt||{},ranges:pi,booleanRule:{...(Gt==null?void 0:Gt.booleanRule)||{},condition:kt,format:Ct}},Jr={sheetId:Le,index:ce-1,rule:Yr};if(Fe!=null&&Fe!==""){const hi=typeof Fe=="number"?Fe:parseInt(String(Fe),10);!isNaN(hi)&&hi>=1&&(Jr.newIndex=hi-1)}return await Oe({method:"POST",endpoint:`/v4/spreadsheets/${te}:batchUpdate`,data:{requests:[{updateConditionalFormatRule:Jr}]}}),{value:K.Success,result:null,error:null}}catch(x){const $=((P=x.response)==null?void 0:P.data)||x.message||x;return pe.Logger.log("[Google Sheets] error:",$),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:$,result:null}}}})}}class w1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsUpdateProtectedRange,version:"1.0.0",description:"Update Protected Range Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.GoogleSheetsUpdateProtectedRange);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A,O;try{const P=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!P||!P.env)throw new Error("Editor context or environment missing");const x=Be(t,t.project,"updateProtectedRange"),U="["+Ve(t,t.project,"Update Protected Range")+": `"+x+"`] ",q=(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}\`)`},Z=n.find(Me=>{var Je;return((Je=Me.valueOwner.declaration)==null?void 0:Je.id)===G.operation[Q.GoogleSheetsUpdateProtectedRange].inputs.connection.id}),H=(s=Z==null?void 0:Z.value)==null?void 0:s.valueAsType;if(!H||!H.id||!H.name||H.type!==r.DefinitionEntity)throw new Error(`${U}The ${q(Z,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const W=ui(H);if(!W)throw new Error(`${U}The ${q(Z,"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[Q.GoogleSheetsUpdateProtectedRange].inputs.spreadsheetId.id}),z=(u=ie==null?void 0:ie.value)==null?void 0:u.value,Y=ln(z,{errorPrefix:`${U}The ${q(ie,"Spreadsheet ID","spreadsheetId")} input `}),ee=n.find(Me=>{var Je;return((Je=Me.valueOwner.declaration)==null?void 0:Je.id)===G.operation[Q.GoogleSheetsUpdateProtectedRange].inputs.protectedRangeId.id}),J=(e=ee==null?void 0:ee.value)==null?void 0:e.value;if(J==null)throw new Error(`${U}The ${q(ee,"Protected Range ID","protectedRangeId")} input is missing.`);const te=n.find(Me=>{var Je;return((Je=Me.valueOwner.declaration)==null?void 0:Je.id)===G.operation[Q.GoogleSheetsUpdateProtectedRange].inputs.range.id}),re=(f=te==null?void 0:te.value)==null?void 0:f.value,ae=n.find(Me=>{var Je;return((Je=Me.valueOwner.declaration)==null?void 0:Je.id)===G.operation[Q.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[Q.GoogleSheetsUpdateProtectedRange].inputs.warningOnly.id}),ce=(m=oe==null?void 0:oe.value)==null?void 0:m.value,ge=n.find(Me=>{var Je;return((Je=Me.valueOwner.declaration)==null?void 0:Je.id)===G.operation[Q.GoogleSheetsUpdateProtectedRange].inputs.editors.id}),Ce=(T=ge==null?void 0:ge.value)==null?void 0:T.value,Ee=n.find(Me=>{var Je;return((Je=Me.valueOwner.declaration)==null?void 0:Je.id)===G.operation[Q.GoogleSheetsUpdateProtectedRange].inputs.domainUsersCanEdit.id}),Oe=(g=Ee==null?void 0:Ee.value)==null?void 0:g.value,Fe={Authorization:`Bearer ${await P.getAccessToken()}`},tt=`${(b=P.env)==null?void 0:b.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${P.projectId}/${Zt["google-sheet"]}/${W}`,We=async Me=>Ht.post(tt,Me,{headers:Fe}),et={protectedRangeId:typeof J=="number"?J:Number(J)},qe=[];if(re!=null){let Me=[];try{Me=((R=(await We({method:"GET",endpoint:`/v4/spreadsheets/${Y}?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 ${q(te,"Protected Range","range")} input `}),qe.push("range")}le!=null&&(et.description=le,qe.push("description"));const ot=Array.isArray(Ce)&&Ce.length>0,st=typeof Oe=="boolean";if(ce===!0&&ot)throw new Error(`${U}When ${q(oe,"Warning Only","warningOnly")} is enabled (true), ${q(ge,"Editors","editors")} cannot be specified.`);if(ce===!0&&st)throw new Error(`${U}When ${q(oe,"Warning Only","warningOnly")} is enabled (true), ${q(Ee,"Domain Users Can Edit","domainUsersCanEdit")} cannot be specified.`);if(typeof ce=="boolean"&&(et.warningOnly=ce,qe.push("warningOnly")),!et.warningOnly&&(ot||st)){const Me={};ot&&(Me.users=Ce),st&&(Me.domainUsersCanEdit=Oe),et.editors=Me,qe.push("editors")}const ft=n.find(Me=>{var Je;return((Je=Me.valueOwner.declaration)==null?void 0:Je.id)===G.operation[Q.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/${Y}?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 ${q(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/${Y}:batchUpdate`,data:{requests:[{updateProtectedRange:{protectedRange:et,fields:pt}}]}}),{value:K.Success,result:null,error:null}}catch(P){const x=((O=P.response)==null?void 0:O.data)||P.message||P;return pe.Logger.log("[Google Sheets] error:",x),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:x,result:null}}}})}}class O1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsAddNamedRange,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.Editor])[0];if(!b||!b.env)throw new Error("Editor context or environment missing");const R=Be(t,t.project,"addNamedRange"),A="["+Ve(t,t.project,"Add Named Range")+": `"+R+"`] ",O=(Ee,Oe,Le)=>{const Fe=Ve(Ee==null?void 0:Ee.valueOwner,b==null?void 0:b.logic,Oe),tt=Be(Ee==null?void 0:Ee.valueOwner,b==null?void 0:b.logic,Le);return`"${Fe}" (\`${tt}\`)`},P=n.find(Ee=>{var Oe;return((Oe=Ee.valueOwner.declaration)==null?void 0:Oe.id)===G.operation[Q.GoogleSheetsAddNamedRange].inputs.connection.id}),x=(s=P==null?void 0:P.value)==null?void 0:s.valueAsType;if(!x||!x.id||!x.name||x.type!==r.DefinitionEntity)throw new Error(`${A}The ${O(P,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const $=ui(x);if(!$)throw new Error(`${A}The ${O(P,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const U=n.find(Ee=>{var Oe;return((Oe=Ee.valueOwner.declaration)==null?void 0:Oe.id)===G.operation[Q.GoogleSheetsAddNamedRange].inputs.spreadsheetId.id}),q=(u=U==null?void 0:U.value)==null?void 0:u.value,Z=ln(q,{errorPrefix:`${A}The ${O(U,"Spreadsheet ID","spreadsheetId")} input `}),H=n.find(Ee=>{var Oe;return((Oe=Ee.valueOwner.declaration)==null?void 0:Oe.id)===G.operation[Q.GoogleSheetsAddNamedRange].inputs.name.id}),W=(e=H==null?void 0:H.value)==null?void 0:e.value;if(W==null)throw new Error(`${A}The ${O(H,"name","name")} input is missing.`);const ie=n.find(Ee=>{var Oe;return((Oe=Ee.valueOwner.declaration)==null?void 0:Oe.id)===G.operation[Q.GoogleSheetsAddNamedRange].inputs.range.id}),z=(f=ie==null?void 0:ie.value)==null?void 0:f.value;if(z==null)throw new Error(`${A}The ${O(ie,"range","range")} input is missing.`);const ee={Authorization:`Bearer ${await b.getAccessToken()}`},J=`${(y=b.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${b.projectId}/${Zt["google-sheet"]}/${$}`,te=async Ee=>Ht.post(J,Ee,{headers:ee}),re=await Ha(z,"Id",async()=>{var Oe;return(((Oe=(await te({method:"GET",endpoint:`/v4/spreadsheets/${Z}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:Oe.sheets)||[]).map(Le=>{var Fe,tt;return{id:(Fe=Le.properties)==null?void 0:Fe.sheetId,name:(tt=Le.properties)==null?void 0:tt.title}})});let ae={};ae.addNamedRange={namedRange:{name:typeof W=="string"&&W.trim().startsWith("{")?JSON.parse(W):W,range:ps(re,{errorPrefix:`${A}The ${O(ie,"Range","range")} input `})}};const oe=(await te({method:"POST",endpoint:`/v4/spreadsheets/${Z}:batchUpdate`,data:{requests:[ae]}})).data,ce=(T=(m=oe==null?void 0:oe.replies)==null?void 0:m[0])==null?void 0:T.addNamedRange,ge=(ce==null?void 0:ce.namedRange)??null,Ce=(ge==null?void 0:ge.namedRangeId)??null;return{value:K.Success,result:{namedRangeId:Ce},error:null}}catch(b){const R=((g=b.response)==null?void 0:g.data)||b.message||b;return pe.Logger.log("[Google Sheets] error:",R),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:R,result:null}}}})}}class x1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsSetCellNote,version:"1.0.0",description:"Rename or Update Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.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[Q.GoogleSheetsSetCellNote].inputs.connection.id}),O=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${R}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const P=ui(O);if(!P)throw new Error(`${R}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(re=>{var ae;return((ae=re.valueOwner.declaration)==null?void 0:ae.id)===G.operation[Q.GoogleSheetsSetCellNote].inputs.spreadsheetId.id}),$=(u=x==null?void 0:x.value)==null?void 0:u.value,U=ln($,{errorPrefix:`${R}The ${I(x,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(re=>{var ae;return((ae=re.valueOwner.declaration)==null?void 0:ae.id)===G.operation[Q.GoogleSheetsSetCellNote].inputs.range.id}),Z=(e=q==null?void 0:q.value)==null?void 0:e.value;if(Z==null)throw new Error(`${R}The ${I(q,"range","range")} input is missing.`);const H=n.find(re=>{var ae;return((ae=re.valueOwner.declaration)==null?void 0:ae.id)===G.operation[Q.GoogleSheetsSetCellNote].inputs.note.id}),W=(f=H==null?void 0:H.value)==null?void 0:f.value;if(W==null)throw new Error(`${R}The ${I(H,"note","note")} input is missing.`);const z={Authorization:`Bearer ${await T.getAccessToken()}`},Y=`${(y=T.env)==null?void 0:y.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${T.projectId}/${Zt["google-sheet"]}/${P}`,ee=async re=>Ht.post(Y,re,{headers:z}),J=await Ha(Z,"Id",async()=>(await ee({method:"GET",endpoint:`/v4/spreadsheets/${U}?fields=sheets.properties(sheetId,title)`})).data.sheets.map(ae=>({id:ae.properties.sheetId,name:ae.properties.title})));let te={repeatCell:{range:ps(J,{errorPrefix:`${R}The ${I(q,"Range","range")} input `}),cell:{note:typeof W=="string"&&W.trim().startsWith("{")?JSON.parse(W):W},fields:"note"}};return await ee({method:"POST",endpoint:`/v4/spreadsheets/${U}:batchUpdate`,data:{requests:[te]}}),{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+Q.GoogleSheetsDeleteConditionalFormatRule,version:"1.0.0",description:"Delete Conditional Format Rule Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.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 ge=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`"${ge}" (\`${Ce}\`)`},O=G.operation[Q.GoogleSheetsDeleteConditionalFormatRule].inputs,P=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===O.connection.id}),x=(s=P==null?void 0:P.value)==null?void 0:s.valueAsType;if(!x||!x.id||!x.name||x.type!==r.DefinitionEntity)throw new Error(`${I}The ${A(P,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const $=ui(x);if(!$)throw new Error(`${I}The ${A(P,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const U=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===O.spreadsheetId.id}),q=(u=U==null?void 0:U.value)==null?void 0:u.value,Z=ln(q,{errorPrefix:`${I}The ${A(U,"Spreadsheet ID","spreadsheetId")} input `}),H=n.find(le=>{var oe,ce;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===((ce=O.sheet)==null?void 0:ce.id)}),W=(e=H==null?void 0:H.value)==null?void 0:e.value;if(W==null||W==="")throw new Error(`${I}The ${A(H,"Sheet","sheet")} input is missing.`);const ie=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===O.index.id}),z=(f=ie==null?void 0:ie.value)==null?void 0:f.value;if(z==null||z==="")throw new Error(`${I}The ${A(ie,"Index","index")} input is missing.`);const Y=typeof z=="number"?z:parseInt(String(z),10);if(isNaN(Y)||Y<1)throw new Error(`${I}The ${A(ie,"Index","index")} input must be a 1-based positive integer.`);const J={Authorization:`Bearer ${await g.getAccessToken()}`},te=`${(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(te,le,{headers:J});let ae;if(typeof W=="number"||/^\d+$/.test(String(W).trim()))ae=Number(W);else{const ce=(((m=(await re({method:"GET",endpoint:`/v4/spreadsheets/${Z}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:m.sheets)||[]).find(ge=>{var Ce;return String((Ce=ge.properties)==null?void 0:Ce.title).trim().toLowerCase()===String(W).trim().toLowerCase()});if(!ce)throw new Error(`${I}The ${A(H,"Sheet","sheet")} input "${W}" was not found in spreadsheet.`);ae=ce.properties.sheetId}return await re({method:"POST",endpoint:`/v4/spreadsheets/${Z}:batchUpdate`,data:{requests:[{deleteConditionalFormatRule:{sheetId:ae,index:Y-1}}]}}),{value:K.Success,result:null,error:null}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return pe.Logger.log("[Google Sheets] error:",b),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:b,result:null}}}})}}function NRn(a){return{NUMBER_GREATER:"Number greater than",NUMBER_GREATER_THAN_EQ:"Number greater than or equal",NUMBER_LESS:"Number less than",NUMBER_LESS_THAN_EQ:"Number less than or equal",NUMBER_EQ:"Number equal to",NUMBER_NOT_EQ:"Number not equal to",NUMBER_BETWEEN:"Number between",NUMBER_NOT_BETWEEN:"Number not between",TEXT_CONTAINS:"Text contains",TEXT_NOT_CONTAINS:"Text does not contain",TEXT_STARTS_WITH:"Text starts with",TEXT_ENDS_WITH:"Text ends with",TEXT_EQ:"Text equals",DATE_EQ:"Date is",DATE_BEFORE:"Date is before",DATE_AFTER:"Date is after",DATE_ON_OR_BEFORE:"Date is on or before",DATE_ON_OR_AFTER:"Date is on or after",BLANK:"Cell is empty",NOT_BLANK:"Cell is not empty",CUSTOM_FORMULA:"Custom formula"}[a]||a}function b5(a){let p,t="",n=a+1;for(;n>0;)p=(n-1)%26,t=String.fromCharCode(65+p)+t,n=(n-p-1)/26;return t}function _Rn(a,p){if(!a)return"";let t=p?`'${p}'!`:"";const n=a.startColumnIndex!==void 0?b5(a.startColumnIndex):"",s=a.startRowIndex!==void 0?String(a.startRowIndex+1):"",u=a.endColumnIndex!==void 0?b5(a.endColumnIndex-1):"",e=a.endRowIndex!==void 0?String(a.endRowIndex):"";return n&&s&&u&&e?n===u&&s===e?`${t}${n}${s}`:`${t}${n}${s}:${u}${e}`:n&&u&&!s&&!e?`${t}${n}:${u}`:s&&e&&!n&&!u?`${t}${s}:${e}`:`${t}${n}${s}:${u}${e}`.replace(/:$/,"")}class V1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsGetConditionalFormatRules,version:"1.0.0",description:"Get Conditional Format Rules Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.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 ge=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`"${ge}" (\`${Ce}\`)`},O=G.operation[Q.GoogleSheetsGetConditionalFormatRules].inputs,P=le=>{var ce;const oe=n.find(ge=>{var Ce;return((Ce=ge.valueOwner.declaration)==null?void 0:Ce.id)===le});return(ce=oe==null?void 0:oe.value)==null?void 0:ce.value},x=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===O.connection.id}),$=(s=x==null?void 0:x.value)==null?void 0:s.valueAsType;if(!$||!$.id||!$.name||$.type!==r.DefinitionEntity)throw new Error(`${I}The ${A(x,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const U=ui($);if(!U)throw new Error(`${I}The ${A(x,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const q=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===O.spreadsheetId.id}),Z=(u=q==null?void 0:q.value)==null?void 0:u.value,H=ln(Z,{errorPrefix:`${I}The ${A(q,"Spreadsheet ID","spreadsheetId")} input `}),W=P(O.sheet.id),ie=typeof W=="string"&&W.trim()!==""?W.trim():null,Y={Authorization:`Bearer ${await g.getAccessToken()}`},ee=`${(e=g.env)==null?void 0:e.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${g.projectId}/${Zt["google-sheet"]}/${U}`,re=((f=(await(async le=>Ht.post(ee,le,{headers:Y}))({method:"GET",endpoint:`/v4/spreadsheets/${H}?fields=sheets(properties(sheetId,title),conditionalFormats)`})).data)==null?void 0:f.sheets)||[],ae=[];for(const le of re){const oe=((y=le.properties)==null?void 0:y.title)||"",ce=(m=le.properties)==null?void 0:m.sheetId;if(ie&&oe.toLowerCase()!==ie.toLowerCase())continue;(le.conditionalFormats||[]).forEach((Ce,Ee)=>{const Oe=Ee+1,Le=(Ce.ranges||[]).map(ot=>_Rn(ot,oe)),Fe=Ce.booleanRule||{},tt=Fe.condition||{},We=NRn(tt.type||""),et=(tt.values||[]).map(ot=>ot.userEnteredValue||""),qe=Fe.format||{};ae.push({index:Oe,sheet:oe,sheetId:ce,ranges:Le,conditionType:We,conditionValues:et,format:qe})})}return{value:K.Success,error:null,result:ae}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return pe.Logger.log("[Google Sheets] error:",b),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:b,result:null}}}})}}function E5(a){let p,t="",n=a+1;for(;n>0;)p=(n-1)%26,t=String.fromCharCode(65+p)+t,n=(n-p-1)/26;return t}function $Rn(a,p){if(!a)return"";let t=p?`'${p}'!`:"";const n=a.startColumnIndex!==void 0?E5(a.startColumnIndex):"",s=a.startRowIndex!==void 0?String(a.startRowIndex+1):"",u=a.endColumnIndex!==void 0?E5(a.endColumnIndex-1):"",e=a.endRowIndex!==void 0?String(a.endRowIndex):"";return n&&s&&u&&e?n===u&&s===e?`${t}${n}${s}`:`${t}${n}${s}:${u}${e}`:n&&u&&!s&&!e?`${t}${n}:${u}`:s&&e&&!n&&!u?`${t}${s}:${e}`:`${t}${n}${s}:${u}${e}`.replace(/:$/,"")}class N1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsGetProtectedRanges,version:"1.0.0",description:"Get Protected Ranges Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.Editor])[0];if(!b||!b.env)throw new Error("Editor context or environment missing");const R=Be(t,t.project,"getProtectedRanges"),A="["+Ve(t,t.project,"Get protected ranges")+": `"+R+"`] ",O=(ae,le,oe)=>{const ce=Ve(ae==null?void 0:ae.valueOwner,b==null?void 0:b.logic,le),ge=Be(ae==null?void 0:ae.valueOwner,b==null?void 0:b.logic,oe);return`"${ce}" (\`${ge}\`)`},P=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[Q.GoogleSheetsGetProtectedRanges].inputs.connection.id}),x=(s=P==null?void 0:P.value)==null?void 0:s.valueAsType;if(!x||!x.id||!x.name||x.type!==r.DefinitionEntity)throw new Error(`${A}The ${O(P,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const $=ui(x);if(!$)throw new Error(`${A}The ${O(P,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const U=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[Q.GoogleSheetsGetProtectedRanges].inputs.spreadsheetId.id}),q=(u=U==null?void 0:U.value)==null?void 0:u.value,Z=ln(q,{errorPrefix:`${A}The ${O(U,"Spreadsheet ID","spreadsheetId")} input `}),H=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[Q.GoogleSheetsGetProtectedRanges].inputs.sheet.id}),W=(e=H==null?void 0:H.value)!=null&&e.value?String(H.value.value).trim():null,z={Authorization:`Bearer ${await b.getAccessToken()}`},Y=`${(f=b.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${b.projectId}/${Zt["google-sheet"]}/${$}`,te=((y=(await(async ae=>Ht.post(Y,ae,{headers:z}))({method:"GET",endpoint:`/v4/spreadsheets/${Z}`})).data)==null?void 0:y.sheets)||[],re=[];for(const ae of te){const le=(m=ae.properties)==null?void 0:m.title,oe=(T=ae.properties)==null?void 0:T.sheetId;if(W&&le!==W)continue;const ce=ae.protectedRanges||[];for(const ge of ce){const Ce=$Rn(ge.range,le);re.push({protectedRangeId:ge.protectedRangeId,sheet:le,sheetId:oe,range:Ce,description:ge.description||"",warningOnly:ge.warningOnly??!1,requestingUserCanEdit:ge.requestingUserCanEdit??!0})}}return{value:K.Success,error:null,result:re}}catch(b){const R=((g=b.response)==null?void 0:g.data)||b.message||b;return pe.Logger.log("[Google Sheets] error:",R),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:R,result:null}}}})}}function bh(a){if(!a)return null;const p=Math.round((a.red||0)*255),t=Math.round((a.green||0)*255),n=Math.round((a.blue||0)*255),s=u=>u.toString(16).padStart(2,"0");return`#${s(p)}${s(t)}${s(n)}`}function I5(a){let p,t="",n=a+1;for(;n>0;)p=(n-1)%26,t=String.fromCharCode(65+p)+t,n=(n-p-1)/26;return t}function GRn(a,p){if(!a)return"";let t=p?`'${p}'!`:"";const n=a.startColumnIndex!==void 0?I5(a.startColumnIndex):"",s=a.startRowIndex!==void 0?String(a.startRowIndex+1):"",u=a.endColumnIndex!==void 0?I5(a.endColumnIndex-1):"",e=a.endRowIndex!==void 0?String(a.endRowIndex):"";return n&&s&&u&&e?n===u&&s===e?`${t}${n}${s}`:`${t}${n}${s}:${u}${e}`:n&&u&&!s&&!e?`${t}${n}:${u}`:s&&e&&!n&&!u?`${t}${s}:${e}`:`${t}${n}${s}:${u}${e}`.replace(/:$/,"")}class _1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsGetBandedRanges,version:"1.0.0",description:"Get Banded Ranges Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.GoogleSheetsGetBandedRanges);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y,m,T,g,b,R,I,A;try{const O=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!O||!O.env)throw new Error("Editor context or environment missing");const P=Be(t,t.project,"getBandedRanges"),$="["+Ve(t,t.project,"Get banded ranges")+": `"+P+"`] ",U=(ge,Ce,Ee)=>{const Oe=Ve(ge==null?void 0:ge.valueOwner,O==null?void 0:O.logic,Ce),Le=Be(ge==null?void 0:ge.valueOwner,O==null?void 0:O.logic,Ee);return`"${Oe}" (\`${Le}\`)`},q=n.find(ge=>{var Ce;return((Ce=ge.valueOwner.declaration)==null?void 0:Ce.id)===G.operation[Q.GoogleSheetsGetBandedRanges].inputs.connection.id}),Z=(s=q==null?void 0:q.value)==null?void 0:s.valueAsType;if(!Z||!Z.id||!Z.name||Z.type!==r.DefinitionEntity)throw new Error(`${$}The ${U(q,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const H=ui(Z);if(!H)throw new Error(`${$}The ${U(q,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const W=n.find(ge=>{var Ce;return((Ce=ge.valueOwner.declaration)==null?void 0:Ce.id)===G.operation[Q.GoogleSheetsGetBandedRanges].inputs.spreadsheetId.id}),ie=(u=W==null?void 0:W.value)==null?void 0:u.value,z=ln(ie,{errorPrefix:`${$}The ${U(W,"Spreadsheet ID","spreadsheetId")} input `}),Y=n.find(ge=>{var Ce;return((Ce=ge.valueOwner.declaration)==null?void 0:Ce.id)===G.operation[Q.GoogleSheetsGetBandedRanges].inputs.sheet.id}),ee=(e=Y==null?void 0:Y.value)!=null&&e.value?String(Y.value.value).trim():null,te={Authorization:`Bearer ${await O.getAccessToken()}`},re=`${(f=O.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${O.projectId}/${Zt["google-sheet"]}/${H}`,oe=((y=(await(async ge=>Ht.post(re,ge,{headers:te}))({method:"GET",endpoint:`/v4/spreadsheets/${z}`})).data)==null?void 0:y.sheets)||[],ce=[];for(const ge of oe){const Ce=(m=ge.properties)==null?void 0:m.title,Ee=(T=ge.properties)==null?void 0:T.sheetId;if(ee&&Ce!==ee)continue;const Oe=ge.bandedRanges||[];for(const Le of Oe){const Fe=GRn(Le.range,Ce),tt=Le.rowProperties||{};ce.push({bandedRangeId:Le.bandedRangeId,sheet:Ce,sheetId:Ee,range:Fe,headerRowColor:bh(tt.headerColor)||bh((g=tt.headerColorStyle)==null?void 0:g.rgbColor),firstRowColor:bh(tt.firstBandColor)||bh((b=tt.firstBandColorStyle)==null?void 0:b.rgbColor),secondRowColor:bh(tt.secondBandColor)||bh((R=tt.secondBandColorStyle)==null?void 0:R.rgbColor),footerRowColor:bh(tt.footerColor)||bh((I=tt.footerColorStyle)==null?void 0:I.rgbColor)})}}return{value:K.Success,error:null,result:ce}}catch(O){const P=((A=O.response)==null?void 0:A.data)||O.message||O;return pe.Logger.log("[Google Sheets] error:",P),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:P,result:null}}}})}}function R5(a){let p,t="",n=a+1;for(;n>0;)p=(n-1)%26,t=String.fromCharCode(65+p)+t,n=(n-p-1)/26;return t}function LRn(a,p){if(!a)return"";let t=p?`'${p}'!`:"";const n=a.startColumnIndex!==void 0?R5(a.startColumnIndex):"",s=a.startRowIndex!==void 0?String(a.startRowIndex+1):"",u=a.endColumnIndex!==void 0?R5(a.endColumnIndex-1):"",e=a.endRowIndex!==void 0?String(a.endRowIndex):"";return n&&s&&u&&e?n===u&&s===e?`${t}${n}${s}`:`${t}${n}${s}:${u}${e}`:n&&u&&!s&&!e?`${t}${n}:${u}`:s&&e&&!n&&!u?`${t}${s}:${e}`:`${t}${n}${s}:${u}${e}`.replace(/:$/,"")}class $1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsGetNamedRanges,version:"1.0.0",description:"Get Named Ranges Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.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=(J,te,re)=>{const ae=Ve(J==null?void 0:J.valueOwner,T==null?void 0:T.logic,te),le=Be(J==null?void 0:J.valueOwner,T==null?void 0:T.logic,re);return`"${ae}" (\`${le}\`)`},A=n.find(J=>{var te;return((te=J.valueOwner.declaration)==null?void 0:te.id)===G.operation[Q.GoogleSheetsGetNamedRanges].inputs.connection.id}),O=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${R}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const P=ui(O);if(!P)throw new Error(`${R}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(J=>{var te;return((te=J.valueOwner.declaration)==null?void 0:te.id)===G.operation[Q.GoogleSheetsGetNamedRanges].inputs.spreadsheetId.id}),$=(u=x==null?void 0:x.value)==null?void 0:u.value,U=ln($,{errorPrefix:`${R}The ${I(x,"Spreadsheet ID","spreadsheetId")} input `}),Z={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 J=>Ht.post(H,J,{headers:Z}))({method:"GET",endpoint:`/v4/spreadsheets/${U}`}),z={};(((f=ie.data)==null?void 0:f.sheets)||[]).forEach(J=>{var te;((te=J.properties)==null?void 0:te.sheetId)!==void 0&&(z[J.properties.sheetId]=J.properties.title||"")});const ee=(((y=ie.data)==null?void 0:y.namedRanges)||[]).map(J=>{var ae;const te=z[(ae=J.range)==null?void 0:ae.sheetId]||"",re=LRn(J.range,te);return{namedRangeId:J.namedRangeId,name:J.name,sheet:te,range:re}});return{value:K.Success,error:null,result:ee}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return pe.Logger.log("[Google Sheets] error:",g),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:g,result:null}}}})}}class G1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsGetSheets,version:"1.0.0",description:"Get Sheets Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.GoogleSheetsGetSheets);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"getSheets"),b="["+Ve(t,t.project,"Get sheets")+": `"+T+"`] ",R=(Y,ee,J)=>{const te=Ve(Y==null?void 0:Y.valueOwner,m==null?void 0:m.logic,ee),re=Be(Y==null?void 0:Y.valueOwner,m==null?void 0:m.logic,J);return`"${te}" (\`${re}\`)`},I=n.find(Y=>{var ee;return((ee=Y.valueOwner.declaration)==null?void 0:ee.id)===G.operation[Q.GoogleSheetsGetSheets].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(A);if(!O)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(Y=>{var ee;return((ee=Y.valueOwner.declaration)==null?void 0:ee.id)===G.operation[Q.GoogleSheetsGetSheets].inputs.spreadsheetId.id}),x=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(x,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),q={Authorization:`Bearer ${await m.getAccessToken()}`},Z=`${(e=m.env)==null?void 0:e.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${O}`,z=(((f=(await(async Y=>Ht.post(Z,Y,{headers:q}))({method:"GET",endpoint:`/v4/spreadsheets/${$}`})).data)==null?void 0:f.sheets)||[]).map(Y=>{var ee,J,te,re,ae,le,oe,ce,ge,Ce,Ee,Oe,Le;return{sheetId:(ee=Y.properties)==null?void 0:ee.sheetId,title:(J=Y.properties)==null?void 0:J.title,index:(te=Y.properties)==null?void 0:te.index,sheetType:(re=Y.properties)==null?void 0:re.sheetType,rowCount:(le=(ae=Y.properties)==null?void 0:ae.gridProperties)==null?void 0:le.rowCount,columnCount:(ce=(oe=Y.properties)==null?void 0:oe.gridProperties)==null?void 0:ce.columnCount,frozenRowCount:(Ce=(ge=Y.properties)==null?void 0:ge.gridProperties)==null?void 0:Ce.frozenRowCount,frozenColumnCount:(Oe=(Ee=Y.properties)==null?void 0:Ee.gridProperties)==null?void 0:Oe.frozenColumnCount,hidden:((Le=Y.properties)==null?void 0:Le.hidden)??!1}});return{value:K.Success,error:null,result:z}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class L1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsGetSheet,version:"1.0.0",description:"Get Sheet Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.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 ge=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`"${ge}" (\`${Ce}\`)`},A=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[Q.GoogleSheetsGetSheet].inputs.connection.id}),O=(s=A==null?void 0:A.value)==null?void 0:s.valueAsType;if(!O||!O.id||!O.name||O.type!==r.DefinitionEntity)throw new Error(`${R}The ${I(A,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const P=ui(O);if(!P)throw new Error(`${R}The ${I(A,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const x=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[Q.GoogleSheetsGetSheet].inputs.spreadsheetId.id}),$=(u=x==null?void 0:x.value)==null?void 0:u.value,U=ln($,{errorPrefix:`${R}The ${I(x,"Spreadsheet ID","spreadsheetId")} input `}),q=n.find(le=>{var oe;return((oe=le.valueOwner.declaration)==null?void 0:oe.id)===G.operation[Q.GoogleSheetsGetSheet].inputs.sheet.id}),Z=(e=q==null?void 0:q.value)==null?void 0:e.value;if(Z==null||Z==="")throw new Error(`${R}The ${I(q,"Sheet","sheet")} input is missing.`);const W={Authorization:`Bearer ${await T.getAccessToken()}`},ie=`${(f=T.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${T.projectId}/${Zt["google-sheet"]}/${P}`,ee=((y=(await(async le=>Ht.post(ie,le,{headers:W}))({method:"GET",endpoint:`/v4/spreadsheets/${U}`})).data)==null?void 0:y.sheets)||[];let J=null;if(typeof Z=="number")J=ee.find(le=>{var oe;return Number((oe=le.properties)==null?void 0:oe.sheetId)===Z});else if(typeof Z=="string"){const le=Z.trim();J=ee.find(oe=>{var ce,ge;return((ce=oe.properties)==null?void 0:ce.title)===le||String((ge=oe.properties)==null?void 0:ge.sheetId)===le})}if(!J)throw new Error(`${R}Sheet "${Z}" was not found in spreadsheet.`);const te=J.properties||{},re=te.gridProperties||{},ae={sheetId:te.sheetId,title:te.title,index:te.index,sheetType:te.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:te.hidden??!1,rightToLeft:te.rightToLeft??!1,tabColor:te.tabColor?{red:te.tabColor.red??0,green:te.tabColor.green??0,blue:te.tabColor.blue??0,alpha:te.tabColor.alpha??1}:null,basicFilter:J.basicFilter?{range:J.basicFilter.range}:null,protectedRanges:(J.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:(J.bandedRanges||[]).map(le=>({bandedRangeId:le.bandedRangeId,range:le.range})),charts:(J.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:(J.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:(J.merges||[]).map(le=>`${le.startRowIndex}:${le.endRowIndex}`)};return{value:K.Success,error:null,result:ae}}catch(T){const g=((m=T.response)==null?void 0:m.data)||T.message||T;return pe.Logger.log("[Google Sheets] error:",g),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:g,result:null}}}})}}function A5(a){let p,t="",n=a+1;for(;n>0;)p=(n-1)%26,t=String.fromCharCode(65+p)+t,n=(n-p-1)/26;return t}function BRn(a,p){if(!a)return"";let t=p?`'${p}'!`:"";const n=a.startColumnIndex!==void 0?A5(a.startColumnIndex):"",s=a.startRowIndex!==void 0?String(a.startRowIndex+1):"",u=a.endColumnIndex!==void 0?A5(a.endColumnIndex-1):"",e=a.endRowIndex!==void 0?String(a.endRowIndex):"";return n&&s&&u&&e?n===u&&s===e?`${t}${n}${s}`:`${t}${n}${s}:${u}${e}`:n&&u&&!s&&!e?`${t}${n}:${u}`:s&&e&&!n&&!u?`${t}${s}:${e}`:`${t}${n}${s}:${u}${e}`.replace(/:$/,"")}class B1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsGetCharts,version:"1.0.0",description:"Get Charts Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.Editor])[0];if(!A||!A.env)throw new Error("Editor context or environment missing");const O=Be(t,t.project,"getCharts"),x="["+Ve(t,t.project,"Get charts")+": `"+O+"`] ",$=(ce,ge,Ce)=>{const Ee=Ve(ce==null?void 0:ce.valueOwner,A==null?void 0:A.logic,ge),Oe=Be(ce==null?void 0:ce.valueOwner,A==null?void 0:A.logic,Ce);return`"${Ee}" (\`${Oe}\`)`},U=n.find(ce=>{var ge;return((ge=ce.valueOwner.declaration)==null?void 0:ge.id)===G.operation[Q.GoogleSheetsGetCharts].inputs.connection.id}),q=(s=U==null?void 0:U.value)==null?void 0:s.valueAsType;if(!q||!q.id||!q.name||q.type!==r.DefinitionEntity)throw new Error(`${x}The ${$(U,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const Z=ui(q);if(!Z)throw new Error(`${x}The ${$(U,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const H=n.find(ce=>{var ge;return((ge=ce.valueOwner.declaration)==null?void 0:ge.id)===G.operation[Q.GoogleSheetsGetCharts].inputs.spreadsheetId.id}),W=(u=H==null?void 0:H.value)==null?void 0:u.value,ie=ln(W,{errorPrefix:`${x}The ${$(H,"Spreadsheet ID","spreadsheetId")} input `}),z=n.find(ce=>{var ge;return((ge=ce.valueOwner.declaration)==null?void 0:ge.id)===G.operation[Q.GoogleSheetsGetCharts].inputs.sheet.id}),Y=(e=z==null?void 0:z.value)!=null&&e.value?String(z.value.value).trim():null,J={Authorization:`Bearer ${await A.getAccessToken()}`},te=`${(f=A.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${A.projectId}/${Zt["google-sheet"]}/${Z}`,le=((y=(await(async ce=>Ht.post(te,ce,{headers:J}))({method:"GET",endpoint:`/v4/spreadsheets/${ie}`})).data)==null?void 0:y.sheets)||[],oe=[];for(const ce of le){const ge=(m=ce.properties)==null?void 0:m.title,Ce=(T=ce.properties)==null?void 0:T.sheetId;if(Y&&ge!==Y)continue;const Ee=ce.charts||[];for(const Oe of Ee){const Le=Oe.spec||{},Fe=Le.title||"",tt=((g=Le.basicChart)==null?void 0:g.chartType)||(Le.pieChart?"PIE":"UNKNOWN"),We=BRn((R=(b=Oe.position)==null?void 0:b.overlayPosition)==null?void 0:R.anchorCell,ge);oe.push({chartId:Oe.chartId,sheet:ge,sheetId:Ce,title:Fe,chartType:tt,positionRange:We})}}return{value:K.Success,error:null,result:oe}}catch(A){const O=((I=A.response)==null?void 0:I.data)||A.message||A;return pe.Logger.log("[Google Sheets] error:",O),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:O,result:null}}}})}}function D5(a){let p,t="",n=a+1;for(;n>0;)p=(n-1)%26,t=String.fromCharCode(65+p)+t,n=(n-p-1)/26;return t}function C5(a,p){if(!a)return"";let t=p?`'${p}'!`:"";const n=a.startColumnIndex!==void 0?D5(a.startColumnIndex):"",s=a.startRowIndex!==void 0?String(a.startRowIndex+1):"",u=a.endColumnIndex!==void 0?D5(a.endColumnIndex-1):"",e=a.endRowIndex!==void 0?String(a.endRowIndex):"";return n&&s&&u&&e?n===u&&s===e?`${t}${n}${s}`:`${t}${n}${s}:${u}${e}`:n&&u&&!s&&!e?`${t}${n}:${u}`:s&&e&&!n&&!u?`${t}${s}:${e}`:`${t}${n}${s}:${u}${e}`.replace(/:$/,"")}class S1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsGetFilter,version:"1.0.0",description:"Get Filter Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.Editor])[0];if(!b||!b.env)throw new Error("Editor context or environment missing");const R=Be(t,t.project,"getFilter"),A="["+Ve(t,t.project,"Get filter")+": `"+R+"`] ",O=(Ce,Ee,Oe)=>{const Le=Ve(Ce==null?void 0:Ce.valueOwner,b==null?void 0:b.logic,Ee),Fe=Be(Ce==null?void 0:Ce.valueOwner,b==null?void 0:b.logic,Oe);return`"${Le}" (\`${Fe}\`)`},P=n.find(Ce=>{var Ee;return((Ee=Ce.valueOwner.declaration)==null?void 0:Ee.id)===G.operation[Q.GoogleSheetsGetFilter].inputs.connection.id}),x=(s=P==null?void 0:P.value)==null?void 0:s.valueAsType;if(!x||!x.id||!x.name||x.type!==r.DefinitionEntity)throw new Error(`${A}The ${O(P,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const $=ui(x);if(!$)throw new Error(`${A}The ${O(P,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const U=n.find(Ce=>{var Ee;return((Ee=Ce.valueOwner.declaration)==null?void 0:Ee.id)===G.operation[Q.GoogleSheetsGetFilter].inputs.spreadsheetId.id}),q=(u=U==null?void 0:U.value)==null?void 0:u.value,Z=ln(q,{errorPrefix:`${A}The ${O(U,"Spreadsheet ID","spreadsheetId")} input `}),H=n.find(Ce=>{var Ee;return((Ee=Ce.valueOwner.declaration)==null?void 0:Ee.id)===G.operation[Q.GoogleSheetsGetFilter].inputs.sheet.id}),W=(e=H==null?void 0:H.value)!=null&&e.value?String(H.value.value).trim():null,z={Authorization:`Bearer ${await b.getAccessToken()}`},Y=`${(f=b.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${b.projectId}/${Zt["google-sheet"]}/${$}`,te=((y=(await(async Ce=>Ht.post(Y,Ce,{headers:z}))({method:"GET",endpoint:`/v4/spreadsheets/${Z}`})).data)==null?void 0:y.sheets)||[];let re=te[0];W&&(re=te.find(Ce=>{var Ee;return((Ee=Ce.properties)==null?void 0:Ee.title)===W})||re);const ae=((m=re==null?void 0:re.properties)==null?void 0:m.title)||"",le=((T=re==null?void 0:re.properties)==null?void 0:T.sheetId)??0,oe=re==null?void 0:re.basicFilter,ce=oe?C5(oe.range,ae):null,ge=((re==null?void 0:re.filterViews)||[]).map(Ce=>({filterViewId:Ce.filterViewId,title:Ce.title,range:C5(Ce.range,ae)}));return{value:K.Success,error:null,result:{sheet:ae,sheetId:le,filterRange:ce,filterViews:ge}}}catch(b){const R=((g=b.response)==null?void 0:g.data)||b.message||b;return pe.Logger.log("[Google Sheets] error:",R),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:R,result:null}}}})}}function w5(a){let p,t="",n=a+1;for(;n>0;)p=(n-1)%26,t=String.fromCharCode(65+p)+t,n=(n-p-1)/26;return t}function SRn(a,p){if(!a)return"";let t=p?`'${p}'!`:"";const n=a.startColumnIndex!==void 0?w5(a.startColumnIndex):"",s=a.startRowIndex!==void 0?String(a.startRowIndex+1):"",u=a.endColumnIndex!==void 0?w5(a.endColumnIndex-1):"",e=a.endRowIndex!==void 0?String(a.endRowIndex):"";return n&&s&&u&&e?n===u&&s===e?`${t}${n}${s}`:`${t}${n}${s}:${u}${e}`:n&&u&&!s&&!e?`${t}${n}:${u}`:s&&e&&!n&&!u?`${t}${s}:${e}`:`${t}${n}${s}:${u}${e}`.replace(/:$/,"")}class M1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsGetMergedCells,version:"1.0.0",description:"Get Merged Cells Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.Editor])[0];if(!b||!b.env)throw new Error("Editor context or environment missing");const R=Be(t,t.project,"getMergedCells"),A="["+Ve(t,t.project,"Get merged cells")+": `"+R+"`] ",O=(ae,le,oe)=>{const ce=Ve(ae==null?void 0:ae.valueOwner,b==null?void 0:b.logic,le),ge=Be(ae==null?void 0:ae.valueOwner,b==null?void 0:b.logic,oe);return`"${ce}" (\`${ge}\`)`},P=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[Q.GoogleSheetsGetMergedCells].inputs.connection.id}),x=(s=P==null?void 0:P.value)==null?void 0:s.valueAsType;if(!x||!x.id||!x.name||x.type!==r.DefinitionEntity)throw new Error(`${A}The ${O(P,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const $=ui(x);if(!$)throw new Error(`${A}The ${O(P,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const U=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[Q.GoogleSheetsGetMergedCells].inputs.spreadsheetId.id}),q=(u=U==null?void 0:U.value)==null?void 0:u.value,Z=ln(q,{errorPrefix:`${A}The ${O(U,"Spreadsheet ID","spreadsheetId")} input `}),H=n.find(ae=>{var le;return((le=ae.valueOwner.declaration)==null?void 0:le.id)===G.operation[Q.GoogleSheetsGetMergedCells].inputs.sheet.id}),W=(e=H==null?void 0:H.value)!=null&&e.value?String(H.value.value).trim():null,z={Authorization:`Bearer ${await b.getAccessToken()}`},Y=`${(f=b.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${b.projectId}/${Zt["google-sheet"]}/${$}`,te=((y=(await(async ae=>Ht.post(Y,ae,{headers:z}))({method:"GET",endpoint:`/v4/spreadsheets/${Z}`})).data)==null?void 0:y.sheets)||[],re=[];for(const ae of te){const le=(m=ae.properties)==null?void 0:m.title,oe=(T=ae.properties)==null?void 0:T.sheetId;if(W&&le!==W)continue;const ce=ae.merges||[];for(const ge of ce){const Ce=SRn(ge,le);re.push({sheet:le,sheetId:oe,range:Ce})}}return{value:K.Success,error:null,result:re}}catch(b){const R=((g=b.response)==null?void 0:g.data)||b.message||b;return pe.Logger.log("[Google Sheets] error:",R),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:R,result:null}}}})}}class F1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsResizeDimension,version:"1.0.0",description:"Resize Dimension Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.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,[X.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,ge,Ce)=>{const Ee=Ve(ce==null?void 0:ce.valueOwner,g==null?void 0:g.logic,ge),Oe=Be(ce==null?void 0:ce.valueOwner,g==null?void 0:g.logic,Ce);return`"${Ee}" (\`${Oe}\`)`},O=n.find(ce=>{var ge;return((ge=ce.valueOwner.declaration)==null?void 0:ge.id)===G.operation[Q.GoogleSheetsResizeDimension].inputs.connection.id}),P=(s=O==null?void 0:O.value)==null?void 0:s.valueAsType;if(!P||!P.id||!P.name||P.type!==r.DefinitionEntity)throw new Error(`${I}The ${A(O,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const x=ui(P);if(!x)throw new Error(`${I}The ${A(O,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const $=n.find(ce=>{var ge;return((ge=ce.valueOwner.declaration)==null?void 0:ge.id)===G.operation[Q.GoogleSheetsResizeDimension].inputs.spreadsheetId.id}),U=(u=$==null?void 0:$.value)==null?void 0:u.value,q=ln(U,{errorPrefix:`${I}The ${A($,"Spreadsheet ID","spreadsheetId")} input `}),Z=n.find(ce=>{var ge;return((ge=ce.valueOwner.declaration)==null?void 0:ge.id)===G.operation[Q.GoogleSheetsResizeDimension].inputs.range.id}),H=(e=Z==null?void 0:Z.value)==null?void 0:e.value;if(H==null)throw new Error(`${I}The ${A(Z,"Range","range")} input is missing.`);const W=n.find(ce=>{var ge;return((ge=ce.valueOwner.declaration)==null?void 0:ge.id)===G.operation[Q.GoogleSheetsResizeDimension].inputs.dimension.id}),ie=((f=W==null?void 0:W.value)==null?void 0:f.value)||"Both",z=n.find(ce=>{var ge;return((ge=ce.valueOwner.declaration)==null?void 0:ge.id)===G.operation[Q.GoogleSheetsResizeDimension].inputs.pixelSize.id}),Y=(y=z==null?void 0:z.value)==null?void 0:y.value;if(Y==null||typeof Y!="number"||isNaN(Y)||Y<0)throw new Error(`${I}The ${A(z,"Pixel size","pixelSize")} input is missing or invalid. Expected a non-negative number in pixels.`);const J={Authorization:`Bearer ${await g.getAccessToken()}`},te=`${(m=g.env)==null?void 0:m.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${g.projectId}/${Zt["google-sheet"]}/${x}`,re=async ce=>Ht.post(te,ce,{headers:J}),ae=await Ha(H,"Id",async()=>{var ge;return(((ge=(await re({method:"GET",endpoint:`/v4/spreadsheets/${q}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:ge.sheets)||[]).map(Ce=>{var Ee,Oe;return{id:(Ee=Ce.properties)==null?void 0:Ee.sheetId,name:(Oe=Ce.properties)==null?void 0:Oe.title}})}),oe=S4(ae,typeof ie=="string"?ie:void 0,{errorPrefix:`${I}The ${A(Z,"Range","range")} input `}).map(ce=>({updateDimensionProperties:{range:ce,properties:{pixelSize:Y},fields:"pixelSize"}}));return await re({method:"POST",endpoint:`/v4/spreadsheets/${q}:batchUpdate`,data:{requests:oe}}),{value:K.Success,result:null,error:null}}catch(g){const b=((T=g.response)==null?void 0:T.data)||g.message||g;return pe.Logger.log("[Google Sheets] error:",b),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:b,result:null}}}})}}class k1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:vi+Q.GoogleSheetsClearFormatting,version:"1.0.0",description:"Clear Formatting Google Sheets operation implementation module",initPriority:_e.High,permissions:[$e.All],contexts:[X.Editor,X.Logic]});C(this,"module",{init:t=>{const n=t.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Q.GoogleSheetsClearFormatting);s&&(s.implementation=this.module.main)}},main:async(t,n)=>{var s,u,e,f,y;try{const m=this.extensionsRegistry.requestContexts(this,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"clearFormatting"),b="["+Ve(t,t.project,"Clear formatting")+": `"+T+"`] ",R=(ee,J,te)=>{const re=Ve(ee==null?void 0:ee.valueOwner,m==null?void 0:m.logic,J),ae=Be(ee==null?void 0:ee.valueOwner,m==null?void 0:m.logic,te);return`"${re}" (\`${ae}\`)`},I=n.find(ee=>{var J;return((J=ee.valueOwner.declaration)==null?void 0:J.id)===G.operation[Q.GoogleSheetsClearFormatting].inputs.connection.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${b}The ${R(I,"Connection","connection")} input is missing or invalid. Expected a valid connection entity.`);const O=ui(A);if(!O)throw new Error(`${b}The ${R(I,"Connection","connection")} input is invalid, it is missing the underlying Connection ID value.`);const P=n.find(ee=>{var J;return((J=ee.valueOwner.declaration)==null?void 0:J.id)===G.operation[Q.GoogleSheetsClearFormatting].inputs.spreadsheetId.id}),x=(u=P==null?void 0:P.value)==null?void 0:u.value,$=ln(x,{errorPrefix:`${b}The ${R(P,"Spreadsheet ID","spreadsheetId")} input `}),U=n.find(ee=>{var J;return((J=ee.valueOwner.declaration)==null?void 0:J.id)===G.operation[Q.GoogleSheetsClearFormatting].inputs.range.id}),q=(e=U==null?void 0:U.value)==null?void 0:e.value;if(!q||q==="")throw new Error(`${b}The ${R(U,"Range","range")} input is missing.`);const H={Authorization:`Bearer ${await m.getAccessToken()}`},W=`${(f=m.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v2/external-integrations/generic-proxy/${m.projectId}/${Zt["google-sheet"]}/${O}`,ie=async ee=>Ht.post(W,ee,{headers:H}),z=await Ha(q,"Id",async()=>{var J;return(((J=(await ie({method:"GET",endpoint:`/v4/spreadsheets/${$}?fields=sheets.properties(sheetId,title)`})).data)==null?void 0:J.sheets)||[]).map(te=>{var re,ae;return{id:(re=te.properties)==null?void 0:re.sheetId,name:(ae=te.properties)==null?void 0:ae.title}})}),Y=ps(z,{errorPrefix:`${b}The ${R(U,"Range","range")} input `});return await ie({method:"POST",endpoint:`/v4/spreadsheets/${$}:batchUpdate`,data:{requests:[{repeatCell:{range:Y,cell:{userEnteredFormat:{}},fields:"userEnteredFormat"}}]}}),{value:K.Success,error:null,result:null}}catch(m){const T=((y=m.response)==null?void 0:y.data)||m.message||m;return pe.Logger.log("[Google Sheets] error:",T),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class U1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_UPLOAD_FILE,version:"1.0.0",description:"Cloud File System: Upload File",initPriority:_e.High,permissions:[$e.All],contexts:[X.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===X.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,[X.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(J=>{var te,re;return((re=(te=J.valueOwner)==null?void 0:te.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(J=>J.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(J=>{var te,re;return((re=(te=J.valueOwner)==null?void 0:te.declaration)==null?void 0:re.id)===G.operation[Ye.UploadFile].inputs.key.id}),x=(e=P==null?void 0:P.value)==null?void 0:e.value;if(!x||x==="")throw new Error(`${b}The "${Ve(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"key")}\`) input is missing.`);if(typeof x!="string")throw new Error(`${b}The "${Ve(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const $=n.find(J=>{var te,re;return((re=(te=J.valueOwner)==null?void 0:te.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 q=U.uri,Z=U.mimeType||"application/octet-stream",H=x,ie=(y=(await Ht.post(`${m.env.API_BASE_URL}/cloud-files-service/v1/files?bucket=${A}&key=${encodeURIComponent(H)}&contentType=${encodeURIComponent(Z)}`,{},{headers:{Authorization:`Bearer ${await m.getAccessToken()}`}})).data)==null?void 0:y.uploadUrl;if(!ie)throw new Error(`${b}Failed to retrieve pre-signed upload URL.`);let z;try{z=await L4(q,()=>m.getAccessToken())}catch(J){throw new Error(`${b}Failed to fetch file content from '${q}': ${(J==null?void 0:J.message)||J}`)}await Ht.put(ie,z,{headers:{"Content-Type":Z}});const ee={uri:`${m.env.API_BASE_URL}/cloud-files-service/v1/files/download?bucket=${A}&key=${encodeURIComponent(H)}`,name:H.split("/").pop()||H,mimeType:Z,size:z.length};return{value:K.Success,error:null,result:ee}}catch(m){return{value:K.UnhandledError,error:m,result:null}}}})}}class K1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_GET_FILE,version:"1.0.0",description:"Cloud File System: Get File",initPriority:_e.High,permissions:[$e.All],contexts:[X.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===X.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,[X.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,q;return((q=(U=$.valueOwner)==null?void 0:U.declaration)==null?void 0:q.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,q;return((q=(U=$.valueOwner)==null?void 0:U.declaration)==null?void 0:q.id)===G.operation[Ye.GetFile].inputs.key.id}),O=(e=A==null?void 0:A.value)==null?void 0:e.value;if(!O||O==="")throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"key")}\`) input is missing.`);if(typeof O!="string")throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const x=(await Ht.get(`${f.env.API_BASE_URL}/cloud-files-service/v1/files/metadata?bucket=${R}&key=${encodeURIComponent(O)}`,{headers:{Authorization:`Bearer ${await f.getAccessToken()}`}})).data;return{value:K.Success,error:null,result:{uri:x.uri,name:x.name,key:x.key,size:x.size,mimeType:x.mimeType,access:x.access,lastModified:x.lastModified}}}catch(f){return{value:K.UnhandledError,error:f,result:null}}}})}}class j1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_LIST_FILES,version:"1.0.0",description:"Cloud File System: List Files",initPriority:_e.High,permissions:[$e.All],contexts:[X.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===X.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,[X.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Be(t,t.project,"listFiles"),b="["+Ve(t,t.project,"List files")+": `"+T+"`] ",R=n.find(ae=>{var le,oe;return((oe=(le=ae.valueOwner)==null?void 0:le.declaration)==null?void 0:oe.id)===G.operation[Ye.ListFiles].inputs.bucket.id}),I=(s=R==null?void 0:R.value)==null?void 0:s.valueAsType;if(!I||!I.id||!I.name||I.type!==r.DefinitionEntity)throw new Error(`${b}Invalid input "${Ve(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"Storage")}" (\`${Be(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const A=ul(I==null?void 0:I.id,((u=m.branchHead)==null?void 0:u.identifier)||"main");if(!((m==null?void 0:m.liveResources)||[]).find(ae=>ae.resourceId===A))throw new Error(`${b}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const P=n.find(ae=>{var le,oe;return((oe=(le=ae.valueOwner)==null?void 0:le.declaration)==null?void 0:oe.id)===G.operation[Ye.ListFiles].inputs.path.id}),x=(e=P==null?void 0:P.value)==null?void 0:e.value;if(x!==void 0&&typeof x!="string")throw new Error(`${b}The "${Ve(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"Path")}" (\`${Be(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"path")}\`) input value is invalid, if present, it must be a string.`);const $=n.find(ae=>{var le,oe;return((oe=(le=ae.valueOwner)==null?void 0:le.declaration)==null?void 0:oe.id)===G.operation[Ye.ListFiles].inputs.maxKeys.id}),U=(f=$==null?void 0:$.value)==null?void 0:f.value;if(U!==void 0&&(typeof U!="number"||U<=0))throw new Error(`${b}The "${Ve($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"Max results")}" (\`${Be($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"maxKeys")}\`) input value is invalid, if present, it must be a number greater than 0.`);const q=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}),Z=(y=q==null?void 0:q.value)==null?void 0:y.value;if(Z!==void 0&&(typeof Z!="string"||Z===""))throw new Error(`${b}The "${Ve(q==null?void 0:q.valueOwner,m==null?void 0:m.logic,"Start after")}" (\`${Be(q==null?void 0:q.valueOwner,m==null?void 0:m.logic,"startAfter")}\`) input value is invalid, if present, it must be a non-empty string.`);let H=`${m.env.API_BASE_URL}/cloud-files-service/v1/files?bucket=${A}`;x&&(H+=`&path=${encodeURIComponent(x)}`),U&&(H+=`&maxKeys=${U}`),Z&&(H+=`&startAfter=${encodeURIComponent(Z)}`);const W=await Ht.get(H,{headers:{Authorization:`Bearer ${await m.getAccessToken()}`}}),ie=ae=>{var ge;if(!ae)return"application/octet-stream";const le=ae.split(".");if(le.length<=1)return"application/octet-stream";const oe=(ge=le.pop())==null?void 0:ge.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"},Y=(W.data.items||W.data.files||[]).map(ae=>({uri:ae.uri||ae.url||`${m.env.API_BASE_URL}/cloud-files-service/v1/files/download?bucket=${A}&key=${encodeURIComponent(ae.key)}`,name:ae.name,key:ae.key,mimeType:ae.mimeType||ie(ae.key),size:ae.size||0,lastModified:ae.lastModified,access:ae.access})),ee=W.data.total!==void 0?W.data.total:Y.length,J=W.data.size!==void 0?W.data.size:Y.reduce((ae,le)=>ae+(le.size||0),0),te=W.data.nextStartAfter!==void 0?W.data.nextStartAfter:null,re=W.data.hasMore!==void 0?W.data.hasMore:!1;return{value:K.Success,error:null,result:{items:Y,total:ee,size:J,nextStartAfter:te,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:[X.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===X.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,[X.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 q,Z;return((Z=(q=U.valueOwner)==null?void 0:q.declaration)==null?void 0:Z.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 q,Z;return((Z=(q=U.valueOwner)==null?void 0:q.declaration)==null?void 0:Z.id)===G.operation[Ye.DeleteFiles].inputs.keys.id}),O=(e=A==null?void 0:A.value)==null?void 0:e.value,P=Array.isArray(O)?O:typeof O=="string"&&O!==""?[O]:[];if(!P||P.length===0)throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Keys")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"keys")}\`) input is missing.`);if(!Array.isArray(P)||P.some(U=>typeof U!="string"||U===""))throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Keys")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"keys")}\`) input value is invalid, if present, it must be a list of non-empty strings.`);const $=(await Ht.delete(`${f.env.API_BASE_URL}/cloud-files-service/v1/files`,{headers:{Authorization:`Bearer ${await f.getAccessToken()}`},data:{bucket:R,keys:P}})).data;return{value:K.Success,error:null,result:null}}catch(f){return{value:K.UnhandledError,error:f,result:null}}}})}}class Z1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_COPY_FILE,version:"1.0.0",description:"Cloud File System: Copy File",initPriority:_e.High,permissions:[$e.All],contexts:[X.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===X.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,[X.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(J=>{var te,re;return((re=(te=J.valueOwner)==null?void 0:te.declaration)==null?void 0:re.id)===G.operation[Ye.CopyFile].inputs.bucket.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${R}Invalid input "${Ve(I==null?void 0:I.valueOwner,T==null?void 0:T.logic,"Storage")}" (\`${Be(I==null?void 0:I.valueOwner,T==null?void 0:T.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const O=ul(A==null?void 0:A.id,((u=T.branchHead)==null?void 0:u.identifier)||"main");if(!((T==null?void 0:T.liveResources)||[]).find(J=>J.resourceId===O))throw new Error(`${R}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const x=n.find(J=>{var te,re;return((re=(te=J.valueOwner)==null?void 0:te.declaration)==null?void 0:re.id)===G.operation[Ye.CopyFile].inputs.sourceKey.id}),$=(e=x==null?void 0:x.value)==null?void 0:e.value;if(!$||$==="")throw new Error(`${R}The "${Ve(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"Source key")}" (\`${Be(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"sourceKey")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${R}The "${Ve(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"Source key")}" (\`${Be(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"sourceKey")}\`) input value is invalid, if present, it must be a non-empty string.`);const U=n.find(J=>{var te,re;return((re=(te=J.valueOwner)==null?void 0:te.declaration)==null?void 0:re.id)===G.operation[Ye.CopyFile].inputs.destinationKey.id}),q=(f=U==null?void 0:U.value)==null?void 0:f.value;if(!q||q==="")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 q!="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 Z=n.find(J=>{var te,re;return((re=(te=J.valueOwner)==null?void 0:te.declaration)==null?void 0:re.id)===G.operation[Ye.CopyFile].inputs.destinationBucket.id}),H=(y=Z==null?void 0:Z.value)==null?void 0:y.valueAsType;if(H&&(!H.id||!H.name||H.type!==r.DefinitionEntity))throw new Error(`${R}Invalid input "${Ve(Z==null?void 0:Z.valueOwner,T==null?void 0:T.logic,"Destination Storage")}" (\`${Be(Z==null?void 0:Z.valueOwner,T==null?void 0:T.logic,"destinationBucket")}\`), expected a valid "Cloud file system" node.`);const W=H!=null&&H.id?ul(H.id,((m=T.branchHead)==null?void 0:m.identifier)||"main"):O;if(!((T==null?void 0:T.liveResources)||[]).find(J=>J.resourceId===W))throw new Error(`${R}The destination "Cloud file system" is not live. Publish the project first, then try again to run the operation node.`);const z={headers:{Authorization:`Bearer ${await T.getAccessToken()}`}},ee=(await Ht.post(`${T.env.API_BASE_URL}/cloud-files-service/v1/files/copy`,{bucket:O,destinationBucket:W,sourceKey:$,destinationKey:q},z)).data;return{value:K.Success,error:null,result:null}}catch(T){return{value:K.UnhandledError,error:T,result:null}}}})}}class H1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_MOVE_FILE,version:"1.0.0",description:"Cloud File System: Move File",initPriority:_e.High,permissions:[$e.All],contexts:[X.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===X.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,[X.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(J=>{var te,re;return((re=(te=J.valueOwner)==null?void 0:te.declaration)==null?void 0:re.id)===G.operation[Ye.MoveFile].inputs.bucket.id}),A=(s=I==null?void 0:I.value)==null?void 0:s.valueAsType;if(!A||!A.id||!A.name||A.type!==r.DefinitionEntity)throw new Error(`${R}Invalid input "${Ve(I==null?void 0:I.valueOwner,T==null?void 0:T.logic,"Storage")}" (\`${Be(I==null?void 0:I.valueOwner,T==null?void 0:T.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const O=ul(A==null?void 0:A.id,((u=T.branchHead)==null?void 0:u.identifier)||"main");if(!((T==null?void 0:T.liveResources)||[]).find(J=>J.resourceId===O))throw new Error(`${R}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const x=n.find(J=>{var te,re;return((re=(te=J.valueOwner)==null?void 0:te.declaration)==null?void 0:re.id)===G.operation[Ye.MoveFile].inputs.sourceKey.id}),$=(e=x==null?void 0:x.value)==null?void 0:e.value;if(!$||$==="")throw new Error(`${R}The "${Ve(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"Source key")}" (\`${Be(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"sourceKey")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${R}The "${Ve(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"Source key")}" (\`${Be(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"sourceKey")}\`) input value is invalid, if present, it must be a non-empty string.`);const U=n.find(J=>{var te,re;return((re=(te=J.valueOwner)==null?void 0:te.declaration)==null?void 0:re.id)===G.operation[Ye.MoveFile].inputs.destinationKey.id}),q=(f=U==null?void 0:U.value)==null?void 0:f.value;if(!q||q==="")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 q!="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 Z=n.find(J=>{var te,re;return((re=(te=J.valueOwner)==null?void 0:te.declaration)==null?void 0:re.id)===G.operation[Ye.MoveFile].inputs.destinationBucket.id}),H=(y=Z==null?void 0:Z.value)==null?void 0:y.valueAsType;if(H&&(!H.id||!H.name||H.type!==r.DefinitionEntity))throw new Error(`${R}Invalid input "${Ve(Z==null?void 0:Z.valueOwner,T==null?void 0:T.logic,"Destination storage")}" (\`${Be(Z==null?void 0:Z.valueOwner,T==null?void 0:T.logic,"destinationBucket")}\`), expected a valid "Cloud file system" node.`);const W=H!=null&&H.id?ul(H.id,((m=T.branchHead)==null?void 0:m.identifier)||"main"):O;if(!((T==null?void 0:T.liveResources)||[]).find(J=>J.resourceId===W))throw new Error(`${R}The destination "Cloud file system" is not live. Publish the project first, then try again to run the operation node.`);const z={headers:{Authorization:`Bearer ${await T.getAccessToken()}`}},ee=(await Ht.post(`${T.env.API_BASE_URL}/cloud-files-service/v1/files/move`,{bucket:O,destinationBucket:W,sourceKey:$,destinationKey:q},z)).data;return{value:K.Success,error:null,result:null}}catch(T){return{value:K.UnhandledError,error:T,result:null}}}})}}class W1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_RENAME_FILE,version:"1.0.0",description:"Cloud File System: Rename File",initPriority:_e.High,permissions:[$e.All],contexts:[X.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===X.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,[X.Editor])[0];if(!y||!y.env)throw new Error("Editor context or environment missing");const m=Be(t,t.project,"renameFile"),g="["+Ve(t,t.project,"Rename file")+": `"+m+"`] ",b=n.find(ie=>{var z,Y;return((Y=(z=ie.valueOwner)==null?void 0:z.declaration)==null?void 0:Y.id)===G.operation[Ye.RenameFile].inputs.bucket.id}),R=(s=b==null?void 0:b.value)==null?void 0:s.valueAsType;if(!R||!R.id||!R.name||R.type!==r.DefinitionEntity)throw new Error(`${g}Invalid input "${Ve(b==null?void 0:b.valueOwner,y==null?void 0:y.logic,"Storage")}" (\`${Be(b==null?void 0:b.valueOwner,y==null?void 0:y.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const I=ul(R==null?void 0:R.id,((u=y.branchHead)==null?void 0:u.identifier)||"main");if(!((y==null?void 0:y.liveResources)||[]).find(ie=>ie.resourceId===I))throw new Error(`${g}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const O=n.find(ie=>{var z,Y;return((Y=(z=ie.valueOwner)==null?void 0:z.declaration)==null?void 0:Y.id)===G.operation[Ye.RenameFile].inputs.key.id}),P=(e=O==null?void 0:O.value)==null?void 0:e.value;if(!P||P==="")throw new Error(`${g}The "${Ve(O==null?void 0:O.valueOwner,y==null?void 0:y.logic,"Key")}" (\`${Be(O==null?void 0:O.valueOwner,y==null?void 0:y.logic,"key")}\`) input is missing.`);if(typeof P!="string")throw new Error(`${g}The "${Ve(O==null?void 0:O.valueOwner,y==null?void 0:y.logic,"Key")}" (\`${Be(O==null?void 0:O.valueOwner,y==null?void 0:y.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const x=n.find(ie=>{var z,Y;return((Y=(z=ie.valueOwner)==null?void 0:z.declaration)==null?void 0:Y.id)===G.operation[Ye.RenameFile].inputs.newName.id}),$=(f=x==null?void 0:x.value)==null?void 0:f.value;if(!$||$==="")throw new Error(`${g}The "${Ve(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"New name")}" (\`${Be(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"newName")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${g}The "${Ve(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"New name")}" (\`${Be(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"newName")}\`) input value is invalid, if present, it must be a non-empty string.`);const U=P.lastIndexOf("/"),Z=`${U!==-1?P.substring(0,U+1):""}${$}`,H={headers:{Authorization:`Bearer ${await y.getAccessToken()}`}},W=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:W.data||{key:P,newName:$,destinationKey:Z}}}catch(y){return{value:K.UnhandledError,error:y,result:null}}}})}}class z1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_GET_FILE_METADATA,version:"1.0.0",description:"Cloud File System: Get File Metadata",initPriority:_e.High,permissions:[$e.All],contexts:[X.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===X.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,[X.Editor])[0];if(!f||!f.env)throw new Error("Editor context or environment missing");const y=Be(t,t.project,"getFileMetadata"),T="["+Ve(t,t.project,"Get file metadata")+": `"+y+"`] ",g=n.find(x=>{var $,U;return((U=($=x.valueOwner)==null?void 0:$.declaration)==null?void 0:U.id)===G.operation[Ye.GetFileMetadata].inputs.bucket.id}),b=(s=g==null?void 0:g.value)==null?void 0:s.valueAsType;if(!b||!b.id||!b.name||b.type!==r.DefinitionEntity)throw new Error(`${T}Invalid input "${Ve(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"Storage")}" (\`${Be(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const R=ul(b==null?void 0:b.id,((u=f.branchHead)==null?void 0:u.identifier)||"main");if(!((f==null?void 0:f.liveResources)||[]).find(x=>x.resourceId===R))throw new Error(`${T}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const A=n.find(x=>{var $,U;return((U=($=x.valueOwner)==null?void 0:$.declaration)==null?void 0:U.id)===G.operation[Ye.GetFileMetadata].inputs.key.id}),O=(e=A==null?void 0:A.value)==null?void 0:e.value;if(!O||O==="")throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"key")}\`) input is missing.`);if(typeof O!="string")throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const P=await Ht.get(`${f.env.API_BASE_URL}/cloud-files-service/v1/files/metadata?bucket=${R}&key=${encodeURIComponent(O)}`,{headers:{Authorization:`Bearer ${await f.getAccessToken()}`}});return{value:K.Success,error:null,result:P.data}}catch(f){return{value:K.UnhandledError,error:f,result:null}}}})}}class Y1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_CHECK_FILE_EXISTS,version:"1.0.0",description:"Cloud File System: Check File Exists",initPriority:_e.High,permissions:[$e.All],contexts:[X.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===X.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,[X.Editor])[0];if(!f||!f.env)throw new Error("Editor context or environment missing");const y=Be(t,t.project,"checkFileExists"),T="["+Ve(t,t.project,"Check File Exists")+": `"+y+"`] ",g=n.find(x=>{var $,U;return((U=($=x.valueOwner)==null?void 0:$.declaration)==null?void 0:U.id)===G.operation[Ye.CheckFileExists].inputs.bucket.id}),b=(s=g==null?void 0:g.value)==null?void 0:s.valueAsType;if(!b||!b.id||!b.name||b.type!==r.DefinitionEntity)throw new Error(`${T}Invalid input "${Ve(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"Storage")}" (\`${Be(g==null?void 0:g.valueOwner,f==null?void 0:f.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const R=ul(b==null?void 0:b.id,((u=f.branchHead)==null?void 0:u.identifier)||"main");if(!((f==null?void 0:f.liveResources)||[]).find(x=>x.resourceId===R))throw new Error(`${T}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const A=n.find(x=>{var $,U;return((U=($=x.valueOwner)==null?void 0:$.declaration)==null?void 0:U.id)===G.operation[Ye.CheckFileExists].inputs.key.id}),O=(e=A==null?void 0:A.value)==null?void 0:e.value;if(!O||O==="")throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"key")}\`) input is missing.`);if(typeof O!="string")throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const P=await Ht.get(`${f.env.API_BASE_URL}/cloud-files-service/v1/files/exists?bucket=${R}&key=${encodeURIComponent(O)}`,{headers:{Authorization:`Bearer ${await f.getAccessToken()}`}});return{value:K.Success,error:null,result:P.data.exists}}catch(f){return{value:K.UnhandledError,error:f,result:!1}}}})}}class J1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_GET_PRESIGNED_URL,version:"1.0.0",description:"Cloud File System: Get Pre-signed URL",initPriority:_e.High,permissions:[$e.All],contexts:[X.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===X.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,[X.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(Y=>{var ee,J;return((J=(ee=Y.valueOwner)==null?void 0:ee.declaration)==null?void 0:J.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(Y=>Y.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(Y=>{var ee,J;return((J=(ee=Y.valueOwner)==null?void 0:ee.declaration)==null?void 0:J.id)===G.operation[Ye.GetPresignedUrl].inputs.key.id}),x=(e=P==null?void 0:P.value)==null?void 0:e.value;if(!x||x==="")throw new Error(`${b}The "${Ve(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"key")}\`) input is missing.`);if(typeof x!="string")throw new Error(`${b}The "${Ve(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(P==null?void 0:P.valueOwner,m==null?void 0:m.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const $=n.find(Y=>{var ee,J;return((J=(ee=Y.valueOwner)==null?void 0:ee.declaration)==null?void 0:J.id)===G.operation[Ye.GetPresignedUrl].inputs.action.id}),U=(f=$==null?void 0:$.value)==null?void 0:f.value,q=(U||"read").toLowerCase(),Z=["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(!Z.includes(q))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(Y=>{var ee,J;return((J=(ee=Y.valueOwner)==null?void 0:ee.declaration)==null?void 0:J.id)===G.operation[Ye.GetPresignedUrl].inputs.expiresInSeconds.id}),W=(y=H==null?void 0:H.value)==null?void 0:y.value,ie=W!=null?Number(W):3600;if(isNaN(ie)||ie<=0)throw new Error(`${b}Invalid "${Ve(H==null?void 0:H.valueOwner,m==null?void 0:m.logic,"Expires in seconds")}" (\`${Be(H==null?void 0:H.valueOwner,m==null?void 0:m.logic,"expiresInSeconds")}\`) input value, expected a positive number.`);const z=await Ht.get(`${m.env.API_BASE_URL}/cloud-files-service/v1/files/presigned-url?bucket=${A}&key=${encodeURIComponent(x)}&action=${q}&expiresInSeconds=${ie}`,{headers:{Authorization:`Bearer ${await m.getAccessToken()}`}});return{value:K.Success,error:null,result:z.data}}catch(m){return{value:K.UnhandledError,error:m,result:null}}}})}}class Q1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_SET_FILE_ACCESS,version:"1.0.0",description:"Cloud File System: Set File Access",initPriority:_e.High,permissions:[$e.All],contexts:[X.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===X.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,[X.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 q,Z;return((Z=(q=U.valueOwner)==null?void 0:q.declaration)==null?void 0:Z.id)===G.operation[Ye.SetFileAccess].inputs.bucket.id}),R=(s=b==null?void 0:b.value)==null?void 0:s.valueAsType;if(!R||!R.id||!R.name||R.type!==r.DefinitionEntity)throw new Error(`${g}Invalid input "${Ve(b==null?void 0:b.valueOwner,y==null?void 0:y.logic,"Storage")}" (\`${Be(b==null?void 0:b.valueOwner,y==null?void 0:y.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const I=ul(R==null?void 0:R.id,((u=y.branchHead)==null?void 0:u.identifier)||"main");if(!((y==null?void 0:y.liveResources)||[]).find(U=>U.resourceId===I))throw new Error(`${g}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const O=n.find(U=>{var q,Z;return((Z=(q=U.valueOwner)==null?void 0:q.declaration)==null?void 0:Z.id)===G.operation[Ye.SetFileAccess].inputs.key.id}),P=(e=O==null?void 0:O.value)==null?void 0:e.value;if(!P||P==="")throw new Error(`${g}The "${Ve(O==null?void 0:O.valueOwner,y==null?void 0:y.logic,"Key")}" (\`${Be(O==null?void 0:O.valueOwner,y==null?void 0:y.logic,"key")}\`) input is missing.`);if(typeof P!="string")throw new Error(`${g}The "${Ve(O==null?void 0:O.valueOwner,y==null?void 0:y.logic,"Key")}" (\`${Be(O==null?void 0:O.valueOwner,y==null?void 0:y.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const x=n.find(U=>{var q,Z;return((Z=(q=U.valueOwner)==null?void 0:q.declaration)==null?void 0:Z.id)===G.operation[Ye.SetFileAccess].inputs.access.id}),$=((f=x==null?void 0:x.value)==null?void 0:f.value)??"private";if(!$||$==="")throw new Error(`${g}The "${Ve(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"Access")}" (\`${Be(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"access")}\`) input is missing.`);if(typeof $!="string"||!["public","private"].includes($))throw new Error(`${g}The "${Ve(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"Access")}" (\`${Be(x==null?void 0:x.valueOwner,y==null?void 0:y.logic,"access")}\`) input value is invalid, if present, it must be exactly the "public" or "private" text values.`);return await Ht.post(`${y.env.API_BASE_URL}/cloud-files-service/v1/files/access`,{bucket:I,key:P,access:$},{headers:{Authorization:`Bearer ${await y.getAccessToken()}`}}),{value:K.Success,error:null,result:null}}catch(y){return{value:K.UnhandledError,error:y,result:null}}}})}}class X1t extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_CREATE_FOLDER,version:"1.0.0",description:"Cloud File System: Create Folder",initPriority:_e.High,permissions:[$e.All],contexts:[X.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===X.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,[X.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,q;return((q=(U=$.valueOwner)==null?void 0:U.declaration)==null?void 0:q.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,q;return((q=(U=$.valueOwner)==null?void 0:U.declaration)==null?void 0:q.id)===G.operation[Ye.CreateFolder].inputs.folderPath.id}),O=(e=A==null?void 0:A.value)==null?void 0:e.value;if(!O||O==="")throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Folder path")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"folderPath")}\`) input is missing.`);if(typeof O!="string")throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Folder path")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"folderPath")}\`) input value is invalid, if present, it must be a non-empty string.`);const x=(await Ht.post(`${f.env.API_BASE_URL}/cloud-files-service/v1/files/folders`,{bucket:R,folderPath:O},{headers:{Authorization:`Bearer ${await f.getAccessToken()}`}})).data;return{value:K.Success,error:null,result:null}}catch(f){return{value:K.UnhandledError,error:f,result:null}}}})}}class eDt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_DELETE_FOLDERS,version:"1.0.0",description:"Cloud File System: Delete Folders",initPriority:_e.High,permissions:[$e.All],contexts:[X.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===X.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,[X.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 q,Z;return((Z=(q=U.valueOwner)==null?void 0:q.declaration)==null?void 0:Z.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 q,Z;return((Z=(q=U.valueOwner)==null?void 0:q.declaration)==null?void 0:Z.id)===G.operation[Ye.DeleteFolders].inputs.folderPaths.id}),O=(e=A==null?void 0:A.value)==null?void 0:e.value,P=Array.isArray(O)?O:typeof O=="string"&&O!==""?[O]:[];if(!P||P.length===0)throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Folder paths")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"folderPaths")}\`) input is missing.`);if(!Array.isArray(P)||P.some(U=>typeof U!="string"||U===""))throw new Error(`${T}The "${Ve(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"Folder paths")}" (\`${Be(A==null?void 0:A.valueOwner,f==null?void 0:f.logic,"folderPaths")}\`) input value is invalid, if present, it must be a list of non-empty strings.`);const $=(await Ht.delete(`${f.env.API_BASE_URL}/cloud-files-service/v1/files/folders`,{headers:{Authorization:`Bearer ${await f.getAccessToken()}`},data:{bucket:R,folderPaths:P}})).data;return{value:K.Success,error:null,result:null}}catch(f){return{value:K.UnhandledError,error:f,result:null}}}})}}class tDt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_CREATE_MULTIPART_UPLOAD,version:"1.0.0",description:"Cloud File System: Create Multipart Upload",initPriority:_e.High,permissions:[$e.All],contexts:[X.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===X.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,[X.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(q=>{var Z,H;return((H=(Z=q.valueOwner)==null?void 0:Z.declaration)==null?void 0:H.id)===G.operation[Ye.CreateMultipartUpload].inputs.bucket.id}),I=(s=R==null?void 0:R.value)==null?void 0:s.valueAsType;if(!I||!I.id||!I.name||I.type!==r.DefinitionEntity)throw new Error(`${b}Invalid input "${Ve(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"Storage")}" (\`${Be(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const A=ul(I==null?void 0:I.id,((u=m.branchHead)==null?void 0:u.identifier)||"main"),O=n.find(q=>{var Z,H;return((H=(Z=q.valueOwner)==null?void 0:Z.declaration)==null?void 0:H.id)===G.operation[Ye.CreateMultipartUpload].inputs.key.id}),P=(e=O==null?void 0:O.value)==null?void 0:e.value;if(!P||P==="")throw new Error(`${b}The "${Ve(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"key")}\`) input is missing.`);if(typeof P!="string")throw new Error(`${b}The "${Ve(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const x=n.find(q=>{var Z,H;return((H=(Z=q.valueOwner)==null?void 0:Z.declaration)==null?void 0:H.id)===G.operation[Ye.CreateMultipartUpload].inputs.contentType.id}),$=((f=x==null?void 0:x.value)==null?void 0:f.value)||"application/octet-stream";if(!$||$==="")throw new Error(`${b}The "${Ve(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"Content Type")}" (\`${Be(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"contentType")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${b}The "${Ve(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"Content Type")}" (\`${Be(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"contentType")}\`) input value is invalid, if present, it must be a non-empty string.`);const U=await Ht.post(`${m.env.API_BASE_URL}/cloud-files-service/v1/files/multipart?bucket=${A}&key=${encodeURIComponent(P)}&contentType=${encodeURIComponent($)}`,{},{headers:{Authorization:`Bearer ${await m.getAccessToken()}`}});return{value:K.Success,error:null,result:{uploadId:typeof U.data=="object"&&((y=U.data)!=null&&y.uploadId)?U.data.uploadId:U.data}}}catch(m){return{value:K.UnhandledError,error:m,result:null}}}})}}class iDt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_GET_UPLOAD_PART_PRESIGNED_URL,version:"1.0.0",description:"Cloud File System: Get Upload Part Pre-signed URL",initPriority:_e.High,permissions:[$e.All],contexts:[X.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===X.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,[X.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 W,ie;return((ie=(W=H.valueOwner)==null?void 0:W.declaration)==null?void 0:ie.id)===G.operation[Ye.GetUploadPartPresignedUrl].inputs.bucket.id}),I=(s=R==null?void 0:R.value)==null?void 0:s.valueAsType;if(!I||!I.id||!I.name||I.type!==r.DefinitionEntity)throw new Error(`${b}${b}Invalid input "${Ve(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"Storage")}" (\`${Be(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const A=ul(I==null?void 0:I.id,((u=m.branchHead)==null?void 0:u.identifier)||"main"),O=n.find(H=>{var W,ie;return((ie=(W=H.valueOwner)==null?void 0:W.declaration)==null?void 0:ie.id)===G.operation[Ye.GetUploadPartPresignedUrl].inputs.key.id}),P=(e=O==null?void 0:O.value)==null?void 0:e.value;if(!P||P==="")throw new Error(`${b}The "${Ve(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"key")}\`) input is missing.`);if(typeof P!="string")throw new Error(`${b}The "${Ve(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const x=n.find(H=>{var W,ie;return((ie=(W=H.valueOwner)==null?void 0:W.declaration)==null?void 0:ie.id)===G.operation[Ye.GetUploadPartPresignedUrl].inputs.uploadId.id}),$=(f=x==null?void 0:x.value)==null?void 0:f.value;if(!$||$==="")throw new Error(`${b}The "${Ve(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"Upload ID")}" (\`${Be(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"uploadId")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${b}The "${Ve(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"Upload ID")}" (\`${Be(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"uploadId")}\`) input value is invalid, if present, it must be a non-empty string.`);const U=n.find(H=>{var W,ie;return((ie=(W=H.valueOwner)==null?void 0:W.declaration)==null?void 0:ie.id)===G.operation[Ye.GetUploadPartPresignedUrl].inputs.partNumber.id}),q=Number((y=U==null?void 0:U.value)==null?void 0:y.value);if(isNaN(q)||q<=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 Z=await Ht.get(`${m.env.API_BASE_URL}/cloud-files-service/v1/files/multipart/${$}?bucket=${A}&key=${encodeURIComponent(P)}&partNumber=${q}`,{headers:{Authorization:`Bearer ${await m.getAccessToken()}`}});return{value:K.Success,error:null,result:Z.data}}catch(m){return{value:K.UnhandledError,error:m,result:null}}}})}}class nDt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_COMPLETE_MULTIPART_UPLOAD,version:"1.0.0",description:"Cloud File System: Complete Multipart Upload",initPriority:_e.High,permissions:[$e.All],contexts:[X.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===X.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,[X.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(W=>{var ie,z;return((z=(ie=W.valueOwner)==null?void 0:ie.declaration)==null?void 0:z.id)===G.operation[Ye.CompleteMultipartUpload].inputs.bucket.id}),I=(s=R==null?void 0:R.value)==null?void 0:s.valueAsType;if(!I||!I.id||!I.name||I.type!==r.DefinitionEntity)throw new Error(`${b}Invalid input "${Ve(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"Storage")}" (\`${Be(R==null?void 0:R.valueOwner,m==null?void 0:m.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const A=ul(I==null?void 0:I.id,((u=m.branchHead)==null?void 0:u.identifier)||"main"),O=n.find(W=>{var ie,z;return((z=(ie=W.valueOwner)==null?void 0:ie.declaration)==null?void 0:z.id)===G.operation[Ye.CompleteMultipartUpload].inputs.key.id}),P=(e=O==null?void 0:O.value)==null?void 0:e.value;if(!P||P==="")throw new Error(`${b}The "${Ve(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"key")}\`) input is missing.`);if(typeof P!="string")throw new Error(`${b}The "${Ve(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Be(O==null?void 0:O.valueOwner,m==null?void 0:m.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const x=n.find(W=>{var ie,z;return((z=(ie=W.valueOwner)==null?void 0:ie.declaration)==null?void 0:z.id)===G.operation[Ye.CompleteMultipartUpload].inputs.uploadId.id}),$=(f=x==null?void 0:x.value)==null?void 0:f.value;if(!$||$==="")throw new Error(`${b}The "${Ve(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"Upload ID")}" (\`${Be(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"uploadId")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${b}The "${Ve(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"Upload ID")}" (\`${Be(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"uploadId")}\`) input value is invalid, if present, it must be a non-empty string.`);const U=n.find(W=>{var ie,z;return((z=(ie=W.valueOwner)==null?void 0:ie.declaration)==null?void 0:z.id)===G.operation[Ye.CompleteMultipartUpload].inputs.parts.id}),q=(y=U==null?void 0:U.value)==null?void 0:y.value;if(!Array.isArray(q)||q.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(q.some(W=>{let ie=!1,z=!1;return(W.partNumber&&Number(W.partNumber)>0||W.PartNumber&&Number(W.PartNumber)>0)&&(ie=!0),(W.etag&&typeof W.etag=="string"||W.ETag&&typeof W.ETag=="string")&&(z=!0),!ie||!z}))throw new Error(`${b}The "${Ve(U==null?void 0:U.valueOwner,m==null?void 0:m.logic,"Parts")}" (\`${Be(U==null?void 0:U.valueOwner,m==null?void 0:m.logic,"parts")}\`) input value is invalid, if present, it must be an array of objects with "partNumber" and "etag" properties.`);const H=(await Ht.post(`${m.env.API_BASE_URL}/cloud-files-service/v1/files/multipart/${$}/complete?bucket=${A}&key=${encodeURIComponent(P)}`,{parts:q},{headers:{Authorization:`Bearer ${await m.getAccessToken()}`}})).data||{};return{value:K.Success,error:null,result:{location:H.location||H.Location||P,key:H.key||H.Key||P,etag:H.etag||H.ETag||null}}}catch(m){return{value:K.UnhandledError,error:m,result:null}}}})}}class rDt extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_ABORT_MULTIPART_UPLOAD,version:"1.0.0",description:"Cloud File System: Abort Multipart Upload",initPriority:_e.High,permissions:[$e.All],contexts:[X.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===X.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,[X.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(q=>{var Z,H;return((H=(Z=q.valueOwner)==null?void 0:Z.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(q=>{var Z,H;return((H=(Z=q.valueOwner)==null?void 0:Z.declaration)==null?void 0:H.id)===G.operation[Ye.AbortMultipartUpload].inputs.key.id}),O=(e=A==null?void 0:A.value)==null?void 0:e.value;if(!O||O==="")throw new Error(`${g}The "${Ve(A==null?void 0:A.valueOwner,y==null?void 0:y.logic,"Key")}" (\`${Be(A==null?void 0:A.valueOwner,y==null?void 0:y.logic,"key")}\`) input is missing.`);if(typeof O!="string")throw new Error(`${g}The "${Ve(A==null?void 0:A.valueOwner,y==null?void 0:y.logic,"Key")}" (\`${Be(A==null?void 0:A.valueOwner,y==null?void 0:y.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const P=n.find(q=>{var Z,H;return((H=(Z=q.valueOwner)==null?void 0:Z.declaration)==null?void 0:H.id)===G.operation[Ye.AbortMultipartUpload].inputs.uploadId.id}),x=(f=P==null?void 0:P.value)==null?void 0:f.value;if(!x||x==="")throw new Error(`${g}The "${Ve(P==null?void 0:P.valueOwner,y==null?void 0:y.logic,"Upload ID")}" (\`${Be(P==null?void 0:P.valueOwner,y==null?void 0:y.logic,"uploadId")}\`) input is missing.`);if(typeof x!="string")throw new Error(`${g}The "${Ve(P==null?void 0:P.valueOwner,y==null?void 0:y.logic,"Upload ID")}" (\`${Be(P==null?void 0:P.valueOwner,y==null?void 0:y.logic,"uploadId")}\`) input value is invalid, if present, it must be a non-empty string.`);const U=(await Ht.delete(`${y.env.API_BASE_URL}/cloud-files-service/v1/files/multipart/${x}?bucket=${I}&key=${encodeURIComponent(O)}`,{headers:{Authorization:`Bearer ${await y.getAccessToken()}`}})).data;return{value:K.Success,error:null,result:null}}catch(y){return{value:K.UnhandledError,error:y,result:null}}}})}}class MRn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:je.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_UPLOAD_FILE_PART,version:"1.0.0",description:"Cloud File System: Upload File Part",initPriority:_e.High,permissions:[$e.All],contexts:[X.Logic]});C(this,"module",{init:t=>{const n=t.find(u=>u.contextType===X.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,[X.Editor])[0];if(!R||!R.env)throw new Error("Editor context or environment missing");const I=Be(t,t.project,"uploadFilePart"),O="["+Ve(t,t.project,"Upload file part")+": `"+I+"`] ",P=n.find(oe=>{var ce,ge;return((ge=(ce=oe.valueOwner)==null?void 0:ce.declaration)==null?void 0:ge.id)===G.operation[Ye.UploadFilePart].inputs.bucket.id}),x=(s=P==null?void 0:P.value)==null?void 0:s.valueAsType;if(!x||!x.id||!x.name||x.type!==r.DefinitionEntity)throw new Error(`${O}Invalid input "${Ve(P==null?void 0:P.valueOwner,R==null?void 0:R.logic,"Storage")}" (\`${Be(P==null?void 0:P.valueOwner,R==null?void 0:R.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const $=ul(x==null?void 0:x.id,((u=R.branchHead)==null?void 0:u.identifier)||"main");if(!((R==null?void 0:R.liveResources)||[]).find(oe=>oe.resourceId===$))throw new Error(`${O}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const q=n.find(oe=>{var ce,ge;return((ge=(ce=oe.valueOwner)==null?void 0:ce.declaration)==null?void 0:ge.id)===G.operation[Ye.UploadFilePart].inputs.key.id}),Z=(e=q==null?void 0:q.value)==null?void 0:e.value;if(!Z||Z==="")throw new Error(`${O}The "${Ve(q==null?void 0:q.valueOwner,R==null?void 0:R.logic,"Key")}" (\`${Be(q==null?void 0:q.valueOwner,R==null?void 0:R.logic,"key")}\`) input is missing.`);if(typeof Z!="string")throw new Error(`${O}The "${Ve(q==null?void 0:q.valueOwner,R==null?void 0:R.logic,"Key")}" (\`${Be(q==null?void 0:q.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,ge;return((ge=(ce=oe.valueOwner)==null?void 0:ce.declaration)==null?void 0:ge.id)===G.operation[Ye.UploadFilePart].inputs.uploadId.id}),W=(f=H==null?void 0:H.value)==null?void 0:f.value;if(!W||W==="")throw new Error(`${O}The "${Ve(H==null?void 0:H.valueOwner,R==null?void 0:R.logic,"Upload ID")}" (\`${Be(H==null?void 0:H.valueOwner,R==null?void 0:R.logic,"uploadId")}\`) input is missing.`);if(typeof W!="string")throw new Error(`${O}The "${Ve(H==null?void 0:H.valueOwner,R==null?void 0:R.logic,"Upload ID")}" (\`${Be(H==null?void 0:H.valueOwner,R==null?void 0:R.logic,"uploadId")}\`) input value is invalid, if present, it must be a non-empty string.`);const ie=n.find(oe=>{var ce,ge;return((ge=(ce=oe.valueOwner)==null?void 0:ce.declaration)==null?void 0:ge.id)===G.operation[Ye.UploadFilePart].inputs.partNumber.id}),z=Number((y=ie==null?void 0:ie.value)==null?void 0:y.value);if(((m=ie==null?void 0:ie.value)==null?void 0:m.value)===void 0||((T=ie==null?void 0:ie.value)==null?void 0:T.value)===null||isNaN(z)||z<=0)throw new Error(`${O}The "${Ve(ie==null?void 0:ie.valueOwner,R==null?void 0:R.logic,"Part number")}" (\`${Be(ie==null?void 0:ie.valueOwner,R==null?void 0:R.logic,"partNumber")}\`) input is missing or invalid.`);const Y=n.find(oe=>{var ce,ge;return((ge=(ce=oe.valueOwner)==null?void 0:ce.declaration)==null?void 0:ge.id)===G.operation[Ye.UploadFilePart].inputs.bytes.id}),ee=(g=Y==null?void 0:Y.value)==null?void 0:g.value;if(ee==null)throw new Error(`${O}The "${Ve(Y==null?void 0:Y.valueOwner,R==null?void 0:R.logic,"Bytes")}" (\`${Be(Y==null?void 0:Y.valueOwner,R==null?void 0:R.logic,"bytes")}\`) input is missing.`);const te=(b=(await Ht.get(`${R.env.API_BASE_URL}/cloud-files-service/v1/files/multipart/${W}?bucket=${$}&key=${encodeURIComponent(Z)}&partNumber=${z}`,{headers:{Authorization:`Bearer ${await R.getAccessToken()}`}})).data)==null?void 0:b.uploadUrl;if(!te)throw new Error(`${O}Failed to obtain presigned upload URL for part ${z}.`);const re=await Ht.put(te,ee,{headers:{"Content-Type":"application/octet-stream"}}),ae=re.headers.etag||re.headers.ETag||"",le=typeof ae=="string"?ae.replace(/"/g,""):"";return{value:K.Success,error:null,result:{partNumber:z,etag:le}}}catch(R){return{value:K.UnhandledError,error:R,result:null}}}})}}class QL extends cV{constructor(p,t,n=t.projectId){super(p,X.Editor),this._editor=t,this.id=n}get ready(){return this._editor.ready}get env(){return this._editor.env}get hasLoadedLogic(){return this._editor.hasLoadedLogic}get destroyed(){return this._editor.destroyed}get logicLoadingPromise(){return this._editor.logicLoadingPromise}get logic(){return this._editor.logic}get lastPublishedProjectState(){return this._editor.lastPublishedProjectState}get branchHead(){return this._editor.branchHead}get branchHeadPromise(){return this._editor.branchHeadPromise}get projectId(){return this._editor.projectId}get sessionId(){return this._editor.sessionId}get userAuthorId(){return this._editor.userAuthorId}get peerConnections(){return this._editor.peerConnections}get test(){return this._editor.test}get localTestValues(){return this._editor.localTestValues}get resolvedValues(){return this._editor.resolvedValues}get persistedExecutionResults(){return this._editor.persistedExecutionResults}get publication(){return this._editor.publication}get livePublishedVersions(){return this._editor.livePublishedVersions}get publications(){return this._editor.publications}get liveResources(){return this._editor.liveResources}get execution(){return this._editor.execution}get project(){return this._editor.logic}get lastExecutionResults(){return this._editor.lastExecutionResults}get undoableStackValueIndex(){return this._editor.undoableStackValueIndex}set undoableStackValueIndex(p){this._editor.undoableStackValueIndex=p}get activeWorkspace(){return this._editor.activeWorkspace}get branches(){return this._editor.branches}get roles(){return this._editor.roles}get READ_ONLY(){return this._editor.READ_ONLY}get isViewingNonHead(){return this._editor.isViewingNonHead}get canEdit(){return this._editor.canEdit}get PROJECT_NOTIFICATIONS_CHANNEL(){return this._editor.PROJECT_NOTIFICATIONS_CHANNEL}getAccessToken(){return this._editor.getAccessToken()}getRefreshToken(){return this._editor.getRefreshToken()}removeValueByOwnerId(p){return this._editor.removeValueByOwnerId(p)}removeValue(p){return this._editor.removeValue(p)}undo(){return this._editor.undo()}redo(){return this._editor.redo()}initTest(p,t){return this._editor.initTest(p,t)}removeTest(p){return this._editor.removeTest(p)}async copyEntities(p,t={}){return this._editor.copyEntities(p,t)}resolveInitialChildrenPositions(p,t,n){return this._editor.resolveInitialChildrenPositions(p,t,n)}publish(){return this._editor.publish()}loadGivenPublication(p){return this._editor.loadGivenPublication(p)}validateProjectState(p){return this._editor.validateProjectState(p)}requestActiveDynamicValue(p,t=!1){return this._editor.requestActiveDynamicValue(p,t)}getValueTypePreference(p){return this._editor.getValueTypePreference(p)}setValueTypePreference(p,t){return this._editor.setValueTypePreference(p,t)}implementFeature(p){return this._editor.implementFeature(p)}getProjectRoles(){return this._editor.getProjectRoles()}getLastPublishedVersionLogic(p){return this._editor.getLastPublishedVersionLogic(p)}initialLoads(p){return this._editor.initialLoads(p)}moveBranchHeadToVersion(p,t,n){return this._editor.moveBranchHeadToVersion(p,t,n)}loadInitialBranchHead(){return this._editor.loadInitialBranchHead()}}function FRn(a,p){return p instanceof QL?p:new QL(a,p)}class XL extends cV{constructor(p,t){super(p,X.PublicationRun),this._publicationRun=t}get id(){return this._publicationRun.id}get projectAutoIncrementPublicationCount(){return this._publicationRun.projectAutoIncrementPublicationCount}get projectPublishedSemanticVersion(){return this._publicationRun.projectPublishedSemanticVersion}get envIdentifier(){return this._publicationRun.envIdentifier}get projectVersion(){return this._publicationRun.projectVersion}get projectBranchId(){return this._publicationRun.projectBranchId}get projectId(){return this._publicationRun.projectId}get triggeredBy(){return this._publicationRun.triggeredBy}get createdAt(){return this._publicationRun.createdAt}get updatedAt(){return this._publicationRun.updatedAt}get status(){return this._publicationRun.status}get steps(){return this._publicationRun.steps}get cleanupSteps(){return this._publicationRun.cleanupSteps}get editor(){return this._publicationRun.editor}get explicitResources(){return this._publicationRun.explicitResources}get implicitGlobalResources(){return this._publicationRun.implicitGlobalResources}get finalGlobalEvent(){return this._publicationRun.finalGlobalEvent}get finalStatus(){return this._publicationRun.finalStatus}}function kRn(a,p){return p instanceof XL?p:new XL(a,p)}const zG={spec:{title:"Sales Overview",basicChart:{chartType:"COLUMN",legendPosition:"BOTTOM_LEGEND",axis:[{position:"BOTTOM_AXIS",title:"Categories"},{position:"LEFT_AXIS",title:"Values"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"LEFT_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}},URn={spec:{title:"Revenue Comparison",basicChart:{chartType:"BAR",legendPosition:"BOTTOM_LEGEND",axis:[{position:"LEFT_AXIS",title:"Products"},{position:"BOTTOM_AXIS",title:"Revenue ($)"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"BOTTOM_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}},KRn={spec:{title:"Monthly Performance Trend",basicChart:{chartType:"LINE",legendPosition:"RIGHT_LEGEND",interpolateNulls:!0,axis:[{position:"BOTTOM_AXIS",title:"Month"},{position:"LEFT_AXIS",title:"Active Users"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:12,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:12,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"LEFT_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}},jRn={spec:{title:"Traffic Channels Distribution",basicChart:{chartType:"AREA",legendPosition:"TOP_LEGEND",stackedType:"STACKED",axis:[{position:"BOTTOM_AXIS",title:"Quarter"},{position:"LEFT_AXIS",title:"Visits"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:4,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:4,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"LEFT_AXIS"},{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:4,startColumnIndex:2,endColumnIndex:3}]}},targetAxis:"LEFT_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}},qRn={spec:{title:"Market Share Breakdown",pieChart:{legendPosition:"RIGHT_LEGEND",threeDimensional:!1,pieHole:0,domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:0,endColumnIndex:1}]}},series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:1,endColumnIndex:2}]}}}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:500,heightPixels:350}}},ZRn={spec:{title:"Budget Allocation",pieChart:{legendPosition:"BOTTOM_LEGEND",threeDimensional:!1,pieHole:.4,domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:6,startColumnIndex:0,endColumnIndex:1}]}},series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:6,startColumnIndex:1,endColumnIndex:2}]}}}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:500,heightPixels:350}}},HRn={spec:{title:"Quarterly Revenue KPI",scorecardChart:{keyValueData:{sourceRange:{sources:[{sheetId:0,startRowIndex:1,endRowIndex:2,startColumnIndex:1,endColumnIndex:2}]}},baselineValueData:{sourceRange:{sources:[{sheetId:0,startRowIndex:2,endRowIndex:3,startColumnIndex:1,endColumnIndex:2}]}}}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:400,heightPixels:250}}},WRn={spec:{title:"Regional Sales (3D)",basicChart:{chartType:"BAR",legendPosition:"RIGHT_LEGEND",headerCount:1,threeDimensional:!0,axis:[{position:"LEFT_AXIS",title:"Region"},{position:"BOTTOM_AXIS",title:"Units Sold"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"BOTTOM_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}};class zRn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][Q.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:[X.Editor,X.Logic]});C(this,"module",{getOptions:async t=>[{key:"column-chart",label:"Column Chart",disabledReasons:[],hidden:!1},{key:"bar-chart",label:"Bar Chart",disabledReasons:[],hidden:!1},{key:"line-chart",label:"Line Chart",disabledReasons:[],hidden:!1},{key:"area-chart",label:"Stacked Area Chart",disabledReasons:[],hidden:!1},{key:"pie-chart",label:"Pie Chart",disabledReasons:[],hidden:!1},{key:"donut-chart",label:"Donut Chart",disabledReasons:[],hidden:!1},{key:"scorecard-chart",label:"Scorecard KPI Chart",disabledReasons:[],hidden:!1},{key:"3d-bar-chart",label:"3D Bar Chart",disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{const s=n==null?void 0:n.valueKey;if(!s)return{value:zG};switch(s){case"column-chart":case"basic-chart":return{value:zG};case"bar-chart":return{value:URn};case"line-chart":return{value:KRn};case"area-chart":return{value:jRn};case"pie-chart":return{value:qRn};case"donut-chart":return{value:ZRn};case"scorecard-chart":return{value:HRn};case"3d-bar-chart":case"3d-column-chart":return{value:WRn}}return{value:zG}}})}}const YG={spec:{title:"Sales Overview",basicChart:{chartType:"COLUMN",legendPosition:"BOTTOM_LEGEND",axis:[{position:"BOTTOM_AXIS",title:"Categories"},{position:"LEFT_AXIS",title:"Values"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"LEFT_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}},YRn={spec:{title:"Revenue Comparison",basicChart:{chartType:"BAR",legendPosition:"BOTTOM_LEGEND",axis:[{position:"LEFT_AXIS",title:"Products"},{position:"BOTTOM_AXIS",title:"Revenue ($)"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"BOTTOM_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}},JRn={spec:{title:"Monthly Performance Trend",basicChart:{chartType:"LINE",legendPosition:"RIGHT_LEGEND",interpolateNulls:!0,axis:[{position:"BOTTOM_AXIS",title:"Month"},{position:"LEFT_AXIS",title:"Active Users"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:12,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:12,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"LEFT_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}},QRn={spec:{title:"Traffic Channels Distribution",basicChart:{chartType:"AREA",legendPosition:"TOP_LEGEND",stackedType:"STACKED",axis:[{position:"BOTTOM_AXIS",title:"Quarter"},{position:"LEFT_AXIS",title:"Visits"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:4,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:4,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"LEFT_AXIS"},{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:4,startColumnIndex:2,endColumnIndex:3}]}},targetAxis:"LEFT_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}},XRn={spec:{title:"Market Share Breakdown",pieChart:{legendPosition:"RIGHT_LEGEND",threeDimensional:!1,pieHole:0,domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:0,endColumnIndex:1}]}},series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:1,endColumnIndex:2}]}}}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:500,heightPixels:350}}},eAn={spec:{title:"Budget Allocation",pieChart:{legendPosition:"BOTTOM_LEGEND",threeDimensional:!1,pieHole:.4,domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:6,startColumnIndex:0,endColumnIndex:1}]}},series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:6,startColumnIndex:1,endColumnIndex:2}]}}}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:500,heightPixels:350}}},tAn={spec:{title:"Quarterly Revenue KPI",scorecardChart:{keyValueData:{sourceRange:{sources:[{sheetId:0,startRowIndex:1,endRowIndex:2,startColumnIndex:1,endColumnIndex:2}]}},baselineValueData:{sourceRange:{sources:[{sheetId:0,startRowIndex:2,endRowIndex:3,startColumnIndex:1,endColumnIndex:2}]}}}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:400,heightPixels:250}}},iAn={spec:{title:"Regional Sales (3D)",basicChart:{chartType:"BAR",legendPosition:"RIGHT_LEGEND",headerCount:1,threeDimensional:!0,axis:[{position:"LEFT_AXIS",title:"Region"},{position:"BOTTOM_AXIS",title:"Units Sold"}],domains:[{domain:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:0,endColumnIndex:1}]}}}],series:[{series:{sourceRange:{sources:[{sheetId:0,startRowIndex:0,endRowIndex:5,startColumnIndex:1,endColumnIndex:2}]}},targetAxis:"BOTTOM_AXIS"}]}},position:{overlayPosition:{anchorCell:{sheetId:0,rowIndex:0,columnIndex:3},widthPixels:600,heightPixels:371}}};class nAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][Q.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:[X.Editor,X.Logic]});C(this,"module",{getOptions:async t=>[{key:"column-chart",label:"Column Chart",disabledReasons:[],hidden:!1},{key:"bar-chart",label:"Bar Chart",disabledReasons:[],hidden:!1},{key:"line-chart",label:"Line Chart",disabledReasons:[],hidden:!1},{key:"area-chart",label:"Stacked Area Chart",disabledReasons:[],hidden:!1},{key:"pie-chart",label:"Pie Chart",disabledReasons:[],hidden:!1},{key:"donut-chart",label:"Donut Chart",disabledReasons:[],hidden:!1},{key:"scorecard-chart",label:"Scorecard KPI Chart",disabledReasons:[],hidden:!1},{key:"3d-bar-chart",label:"3D Bar Chart",disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{const s=n==null?void 0:n.valueKey;if(!s)return{value:YG};switch(s){case"column-chart":case"basic-chart":return{value:YG};case"bar-chart":return{value:YRn};case"line-chart":return{value:JRn};case"area-chart":return{value:QRn};case"pie-chart":return{value:XRn};case"donut-chart":return{value:eAn};case"scorecard-chart":return{value:tAn};case"3d-bar-chart":case"3d-column-chart":return{value:iAn}}return{value:YG}}})}}const rAn="Sheet2!A1",aAn='"Copy of Blahhh"!A1';class sAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][Q.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:[X.Editor,X.Logic]});C(this,"module",{getOptions:async t=>[{key:"sheet2-a1",label:"Sheet2!A1",disabledReasons:[],hidden:!1},{key:"copy-of-blahhh-a1",label:'"Copy of Blahhh"!A1',disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{switch(n==null?void 0:n.valueKey){case"copy-of-blahhh-a1":return{value:aAn};case"sheet2-a1":default:return{value:rAn}}}})}}const lAn="Sheet1!A1:D100",oAn="Sheet1!A1:G500";class dAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][Q.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:[X.Editor,X.Logic]});C(this,"module",{getOptions:async t=>[{key:"sales-data",label:"Sales Data Range (Sheet1!A1:D100)",disabledReasons:[],hidden:!1},{key:"financial-data",label:"Financial Data Range (Sheet1!A1:G500)",disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{switch(n==null?void 0:n.valueKey){case"financial-data":return{value:oAn};case"sales-data":default:return{value:lAn}}}})}}const pAn=[{sourceColumnOffset:0,sortOrder:"ASCENDING",showTotals:!0}],uAn=[{sourceColumnOffset:0,sortOrder:"ASCENDING",showTotals:!0},{sourceColumnOffset:1,sortOrder:"ASCENDING",showTotals:!0}];class cAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][Q.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:[X.Editor,X.Logic]});C(this,"module",{getOptions:async t=>[{key:"single-row-group",label:"Group by First Column (Column 0)",disabledReasons:[],hidden:!1},{key:"multi-row-group",label:"Group by First & Second Columns (Columns 0 & 1)",disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{switch(n==null?void 0:n.valueKey){case"multi-row-group":return{value:uAn};case"single-row-group":default:return{value:pAn}}}})}}const fAn=[{sourceColumnOffset:1,sortOrder:"ASCENDING",showTotals:!0}],yAn=[{sourceColumnOffset:1,sortOrder:"ASCENDING",showTotals:!0},{sourceColumnOffset:2,sortOrder:"ASCENDING",showTotals:!0}];class hAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][Q.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:[X.Editor,X.Logic]});C(this,"module",{getOptions:async t=>[{key:"single-column-group",label:"Group by Second Column (Column 1)",disabledReasons:[],hidden:!1},{key:"multi-column-group",label:"Group by Second & Third Columns (Columns 1 & 2)",disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{switch(n==null?void 0:n.valueKey){case"multi-column-group":return{value:yAn};case"single-column-group":default:return{value:fAn}}}})}}const mAn=[{sourceColumnOffset:3,summarizeFunction:"SUM",name:"Total Revenue"}],TAn=[{sourceColumnOffset:2,summarizeFunction:"COUNTA",name:"Total Orders"},{sourceColumnOffset:3,summarizeFunction:"SUM",name:"Total Revenue"}],vAn=[{sourceColumnOffset:4,summarizeFunction:"AVERAGE",name:"Average Profit"}];class gAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][Q.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:[X.Editor,X.Logic]});C(this,"module",{getOptions:async t=>[{key:"sum-revenue",label:"SUM Revenue (Column 3)",disabledReasons:[],hidden:!1},{key:"sum-and-count",label:"COUNTA Orders (Col 2) & SUM Revenue (Col 3)",disabledReasons:[],hidden:!1},{key:"average-profit",label:"AVERAGE Profit (Column 4)",disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{switch(n==null?void 0:n.valueKey){case"sum-and-count":return{value:TAn};case"average-profit":return{value:vAn};case"sum-revenue":default:return{value:mAn}}}})}}const bAn="Sheet2!A1",EAn='"Copy of Blahhh"!A1';class IAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][Q.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:[X.Editor,X.Logic]});C(this,"module",{getOptions:async t=>[{key:"sheet2-a1",label:"Sheet2!A1",disabledReasons:[],hidden:!1},{key:"copy-of-blahhh-a1",label:'"Copy of Blahhh"!A1',disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{switch(n==null?void 0:n.valueKey){case"copy-of-blahhh-a1":return{value:EAn};case"sheet2-a1":default:return{value:bAn}}}})}}const O5={"Number greater than":"NUMBER_GREATER","Number greater than or equal":"NUMBER_GREATER_THAN_EQ","Number less than":"NUMBER_LESS","Number less than or equal":"NUMBER_LESS_THAN_EQ","Number equal to":"NUMBER_EQ","Number not equal to":"NUMBER_NOT_EQ","Number between":"NUMBER_BETWEEN","Number not between":"NUMBER_NOT_BETWEEN","Text contains":"TEXT_CONTAINS","Text does not contain":"TEXT_NOT_CONTAINS","Text starts with":"TEXT_STARTS_WITH","Text ends with":"TEXT_ENDS_WITH","Text equals":"TEXT_EQ","Date is":"DATE_EQ","Date is before":"DATE_BEFORE","Date is after":"DATE_AFTER","Date is on or before":"DATE_ON_OR_BEFORE","Date is on or after":"DATE_ON_OR_AFTER","Cell is empty":"BLANK","Cell is not empty":"NOT_BLANK","Custom formula":"CUSTOM_FORMULA"};function aDt(a){if(!a||typeof a!="string")return null;const p=a.trim();return p?O5[p]?O5[p]:p.toUpperCase().replace(/\s+/g,"_"):null}function sDt(a,p,t,n){if(p==null)return;let s=[];if(Array.isArray(p))s=p;else if(typeof p=="string"){const e=p.trim();if(!e)return;if(e.startsWith("["))try{const f=JSON.parse(e);Array.isArray(f)?s=f:s=[e]}catch{s=[e]}else s=[e]}const u=aDt(a);if(u==="BLANK"||u==="NOT_BLANK"){s.length>0&&n.push(new ht({id:`${t.id}--${uo.ConditionValuesNoValuesRequired}`,message:`Condition "${a}" does not require any condition values.`,severity:Ie.Error,code:uo.ConditionValuesNoValuesRequired,entity:t}));return}if(u==="CUSTOM_FORMULA"){if(s.length===0)n.push(new ht({id:`${t.id}--${uo.ConditionValuesInvalidFormula}`,message:'Custom formula condition requires a formula string starting with "=" (e.g. ["=A1>100"]).',severity:Ie.Error,code:uo.ConditionValuesInvalidFormula,entity:t}));else for(const e of s){const f=String(e).trim();f.startsWith("=")||n.push(new ht({id:`${t.id}--${uo.ConditionValuesInvalidFormula}`,message:`Custom formula "${f}" must start with "=".`,severity:Ie.Error,code:uo.ConditionValuesInvalidFormula,entity:t}))}return}if(u==="NUMBER_BETWEEN"||u==="NUMBER_NOT_BETWEEN"){s.length!==2&&n.push(new ht({id:`${t.id}--${uo.ConditionValuesTwoNumbersRequired}`,message:`Condition "${a}" requires exactly 2 values (min and max, e.g. ["1", "100"]).`,severity:Ie.Error,code:uo.ConditionValuesTwoNumbersRequired,entity:t}));return}if(u==="NUMBER_GREATER"||u==="NUMBER_GREATER_THAN_EQ"||u==="NUMBER_LESS"||u==="NUMBER_LESS_THAN_EQ"||u==="NUMBER_EQ"||u==="NUMBER_NOT_EQ"){s.length!==1&&n.push(new ht({id:`${t.id}--${uo.ConditionValuesSingleNumberRequired}`,message:`Condition "${a}" requires exactly 1 threshold value (e.g. ["100"]).`,severity:Ie.Error,code:uo.ConditionValuesSingleNumberRequired,entity:t}));return}if(u==="TEXT_CONTAINS"||u==="TEXT_NOT_CONTAINS"||u==="TEXT_STARTS_WITH"||u==="TEXT_ENDS_WITH"||u==="TEXT_EQ"){s.length!==1&&n.push(new ht({id:`${t.id}--${uo.ConditionValuesSingleTextRequired}`,message:`Condition "${a}" requires exactly 1 text string value (e.g. ["Approved"]).`,severity:Ie.Error,code:uo.ConditionValuesSingleTextRequired,entity:t}));return}}const yw={num_100:["100"],num_0:["0"],num_1000:["1000"],between_1_100:["1","100"],between_0_50:["0","50"],between_50_100:["50","100"],text_approved:["Approved"],text_pending:["Pending"],text_rejected:["Rejected"],text_urgent:["Urgent"],date_2026_01_01:["2026-01-01"],date_today:["2026-08-08"],formula_above_avg:["=A1>AVERAGE($A$1:$A$100)"],formula_even:["=ISEVEN(A1)"],formula_duplicates:["=COUNTIF($A$1:$A$100, A1)>1"],default_100:["100"],default_approved:["Approved"],default_formula:["=A1>0"]};function M4(a){const p=aDt(a),t=(n,s)=>({key:n,label:s,disabledReasons:[],hidden:!1});return p==="NUMBER_GREATER"||p==="NUMBER_GREATER_THAN_EQ"||p==="NUMBER_LESS"||p==="NUMBER_LESS_THAN_EQ"||p==="NUMBER_EQ"||p==="NUMBER_NOT_EQ"?[t("num_100","100 (Single threshold)"),t("num_0","0 (Zero threshold)"),t("num_1000","1000 (High threshold)")]:p==="NUMBER_BETWEEN"||p==="NUMBER_NOT_BETWEEN"?[t("between_1_100","Between 1 and 100"),t("between_0_50","Between 0 and 50"),t("between_50_100","Between 50 and 100")]:p==="TEXT_CONTAINS"||p==="TEXT_NOT_CONTAINS"||p==="TEXT_STARTS_WITH"||p==="TEXT_ENDS_WITH"||p==="TEXT_EQ"?[t("text_approved","Approved"),t("text_pending","Pending"),t("text_rejected","Rejected"),t("text_urgent","Urgent")]:p==="DATE_EQ"||p==="DATE_BEFORE"||p==="DATE_AFTER"||p==="DATE_ON_OR_BEFORE"||p==="DATE_ON_OR_AFTER"?[t("date_2026_01_01","Start of 2026 (2026-01-01)"),t("date_today","Current Date (2026-08-08)")]:p==="CUSTOM_FORMULA"?[t("formula_above_avg","Greater than average (=A1>AVERAGE($A$1:$A$100))"),t("formula_even","Even numbers (=ISEVEN(A1))"),t("formula_duplicates","Highlight duplicates (=COUNTIF($A$1:$A$100, A1)>1)")]:p==="BLANK"||p==="NOT_BLANK"?[]:[t("default_100","100"),t("default_approved","Approved"),t("default_formula","Formula (=A1>0)")]}function lDt(a,p){const t=p==null?void 0:p.valueKey;if(t&&yw[t])return{value:yw[t]};const n=M4(a);if(n.length>0){const s=n[0].key;if(yw[s])return{value:yw[s]}}return{value:["100"]}}function x5(a){var u,e;const p=(u=G[r.Operation])==null?void 0:u[Q.GoogleSheetsAddConditionalFormatRule];if(!p)return null;const t=a.parent;if(!t)return null;const s=(t.inputs||t.outputs||[]).find(f=>{var y;return((y=f.declaration)==null?void 0:y.id)===p.inputs.conditionType.id||f.id===p.inputs.conditionType.id});return((e=s==null?void 0:s.defaultValue)==null?void 0:e.value)??null}class RAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][Q.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:[X.Editor,X.Logic]});C(this,"module",{getOptions:async t=>{const n=x5(t);return M4(n)},getValue:async(t,n)=>{const s=x5(t);return lDt(s,n)}})}}function P5(a){var u,e;const p=(u=G[r.Operation])==null?void 0:u[Q.GoogleSheetsUpdateConditionalFormatRule];if(!p)return null;const t=a.parent;if(!t)return null;const s=(t.inputs||t.outputs||[]).find(f=>{var y;return((y=f.declaration)==null?void 0:y.id)===p.inputs.conditionType.id||f.id===p.inputs.conditionType.id});return((e=s==null?void 0:s.defaultValue)==null?void 0:e.value)??null}class AAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][Q.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:[X.Editor,X.Logic]});C(this,"module",{getOptions:async t=>{const n=P5(t);return M4(n)},getValue:async(t,n)=>{const s=P5(t);return lDt(s,n)}})}}const RV=[["Name","Age","Is Active","Notes"],["Alice",30,!0,"New user"],["Bob",25,!1,null],["Charlie",null,!0,"No age provided"]],Mp="1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms",CE={sheetId:0,startRowIndex:0,endRowIndex:10,startColumnIndex:0,endColumnIndex:5},DAn=["Sheet1!A1:B10","Sheet2!C1:D5"],CAn=["Option 1","Option 2","Option 3"],wAn=[{updateSpreadsheetProperties:{properties:{title:"My Renamed Spreadsheet",locale:"en_US",timeZone:"America/New_York"},fields:"title,locale,timeZone"}},{addSheet:{properties:{title:"New Custom Sheet",gridProperties:{rowCount:100,columnCount:20}}}},{mergeCells:{range:{sheetId:0,startRowIndex:0,endRowIndex:2,startColumnIndex:0,endColumnIndex:4},mergeType:"MERGE_ALL"}},{repeatCell:{range:{sheetId:0,startRowIndex:0,endRowIndex:1,startColumnIndex:0,endColumnIndex:5},cell:{userEnteredFormat:{backgroundColor:{red:.2,green:.4,blue:.8},textFormat:{bold:!0,foregroundColor:{red:1,green:1,blue:1}}}},fields:"userEnteredFormat(backgroundColor,textFormat)"}},{findReplace:{find:"Old Value",replacement:"New Value",allSheets:!0,matchCase:!1}}],OAn=[["Date","Product","Revenue ($)","Units Sold"],["2026-01-15","Pro Subscription",299,1],["2026-01-16","Enterprise Add-On",1250.5,2]],xAn=[["Alice Smith","alice@example.com","Engineer","Active"]],PAn=[[null]];class VAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][Q.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:[X.Editor,X.Logic]});C(this,"module",{getOptions:async t=>[{key:"sample-users",label:"Sample User Directory (3 Rows, 4 Columns)",disabledReasons:[],hidden:!1},{key:"sales-report",label:"Sales Report (2 Rows, 4 Columns)",disabledReasons:[],hidden:!1},{key:"single-row",label:"Single Row Entry (1 Row, 4 Columns)",disabledReasons:[],hidden:!1},{key:"empty-grid",label:"Empty Placeholder (1 Row, 1 Column)",disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{switch(n==null?void 0:n.valueKey){case"sales-report":return{value:OAn};case"single-row":return{value:xAn};case"empty-grid":return{value:PAn};case"sample-users":default:return{value:RV}}}})}}const NAn=[["Date","Product","Revenue ($)","Units Sold"],["2026-01-15","Pro Subscription",299,1],["2026-01-16","Enterprise Add-On",1250.5,2]],_An=[["Alice Smith","alice@example.com","Engineer","Active"]],$An=[[null]];class GAn extends Ge{constructor(){super(...arguments);C(this,"manifest",{id:Ga+G[r.Operation][Q.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:[X.Editor,X.Logic]});C(this,"module",{getOptions:async t=>[{key:"sample-users",label:"Sample User Directory (3 Rows, 4 Columns)",disabledReasons:[],hidden:!1},{key:"sales-report",label:"Sales Report (2 Rows, 4 Columns)",disabledReasons:[],hidden:!1},{key:"single-row",label:"Single Row Entry (1 Row, 4 Columns)",disabledReasons:[],hidden:!1},{key:"empty-grid",label:"Empty Placeholder (1 Row, 1 Column)",disabledReasons:[],hidden:!1}],getValue:async(t,n)=>{switch(n==null?void 0:n.valueKey){case"sales-report":return{value:NAn};case"single-row":return{value:_An};case"empty-grid":return{value:$An};case"sample-users":default:return{value:RV}}}})}}function LAn(a){a.register(new fTt(a)),a.register(new cTt(a)),a.register(new oTt(a)),a.register(new pTt(a)),a.register(new uTt(a)),a.register(new dTt(a)),a.register(new HEt(a)),a.register(new WEt(a)),a.register(new zEt(a)),a.register(new JEt(a)),a.register(new YEt(a)),a.register(new QEt(a)),a.register(new SRt(a)),a.register(new MRt(a)),a.register(new FRt(a)),a.register(new kRt(a)),a.register(new URt(a)),a.register(new KRt(a)),a.register(new jRt(a)),a.register(new qRt(a)),a.register(new ZRt(a)),a.register(new HRt(a)),a.register(new Zbt(a)),a.register(new Hbt(a)),a.register(new Wbt(a)),a.register(new zbt(a)),a.register(new Ybt(a)),a.register(new Jbt(a)),a.register(new Qbt(a)),a.register(new Xbt(a)),a.register(new eEt(a)),a.register(new tEt(a)),a.register(new iEt(a)),a.register(new nEt(a)),a.register(new rEt(a)),a.register(new aEt(a)),a.register(new sEt(a)),a.register(new lEt(a)),a.register(new oEt(a)),a.register(new dEt(a)),a.register(new pEt(a)),a.register(new fEt(a)),a.register(new yEt(a)),a.register(new hEt(a)),a.register(new cbt(a)),a.register(new fbt(a)),a.register(new ybt(a)),a.register(new hbt(a)),a.register(new mbt(a)),a.register(new Tbt(a)),a.register(new vbt(a)),a.register(new gbt(a)),a.register(new bbt(a)),a.register(new Ibt(a)),a.register(new Rbt(a)),a.register(new Abt(a)),a.register(new Dbt(a)),a.register(new Cbt(a)),a.register(new Vgt(a)),a.register(new iRt(a)),a.register(new eRt(a)),a.register(new tRt(a)),a.register(new Pvt(a)),a.register(new Vvt(a)),a.register(new Nvt(a)),a.register(new _vt(a)),a.register(new $vt(a)),a.register(new Gvt(a)),a.register(new Lvt(a)),a.register(new Bvt(a)),a.register(new Svt(a)),a.register(new Jvt(a)),a.register(new Ogt(a)),a.register(new xgt(a)),a.register(new Pgt(a)),a.register(new Mvt(a)),a.register(new Fvt(a)),a.register(new kvt(a)),a.register(new Uvt(a)),a.register(new Kvt(a)),a.register(new jvt(a)),a.register(new qvt(a)),a.register(new Zvt(a)),a.register(new Hvt(a)),a.register(new Wvt(a)),a.register(new zvt(a)),a.register(new Yvt(a)),a.register(new Qvt(a)),a.register(new Xvt(a)),a.register(new egt(a)),a.register(new tgt(a)),a.register(new igt(a)),a.register(new ngt(a)),a.register(new rgt(a)),a.register(new agt(a)),a.register(new sgt(a)),a.register(new lgt(a)),a.register(new ogt(a)),a.register(new dgt(a)),a.register(new vgt(a)),a.register(new ggt(a)),a.register(new bgt(a)),a.register(new pgt(a)),a.register(new ugt(a)),a.register(new cgt(a)),a.register(new fgt(a)),a.register(new ygt(a)),a.register(new hgt(a)),a.register(new mgt(a)),a.register(new Tgt(a)),a.register(new sRt(a)),a.register(new lRt(a)),a.register(new oRt(a)),a.register(new dRt(a)),a.register(new nRt(a)),a.register(new rRt(a)),a.register(new aRt(a)),a.register(new pRt(a)),a.register(new cRt(a)),a.register(new yRt(a)),a.register(new uRt(a)),a.register(new fRt(a)),a.register(new hRt(a)),a.register(new vRt(a)),a.register(new mRt(a)),a.register(new TRt(a)),a.register(new wbt(a)),a.register(new Vbt(a)),a.register(new Nbt(a)),a.register(new Gbt(a)),a.register(new Lbt(a)),a.register(new Bbt(a)),a.register(new Sbt(a)),a.register(new Mbt(a)),a.register(new Fbt(a)),a.register(new kbt(a)),a.register(new Ubt(a)),a.register(new _bt(a)),a.register(new $bt(a)),a.register(new U1t(a)),a.register(new K1t(a)),a.register(new j1t(a)),a.register(new q1t(a)),a.register(new Z1t(a)),a.register(new H1t(a)),a.register(new W1t(a)),a.register(new z1t(a)),a.register(new Y1t(a)),a.register(new J1t(a)),a.register(new Q1t(a)),a.register(new X1t(a)),a.register(new eDt(a)),a.register(new tDt(a)),a.register(new iDt(a)),a.register(new nDt(a)),a.register(new rDt(a)),a.register(new xbt(a)),a.register(new Pbt(a)),a.register(new Obt(a)),a.register(new Ebt(a)),a.register(new jbt(a)),a.register(new qbt(a)),a.register(new Kbt(a)),a.register(new eIt(a)),a.register(new AIt(a)),a.register(new RIt(a)),a.register(new DIt(a)),a.register(new CIt(a)),a.register(new nIt(a)),a.register(new rIt(a)),a.register(new pIt(a)),a.register(new oIt(a)),a.register(new EIt(a)),a.register(new hIt(a)),a.register(new TIt(a)),a.register(new gIt(a)),a.register(new vIt(a)),a.register(new dIt(a)),a.register(new cIt(a)),a.register(new fIt(a)),a.register(new uIt(a)),a.register(new XEt(a)),a.register(new aIt(a)),a.register(new mIt(a)),a.register(new xIt(a)),a.register(new KL(a)),a.register(new iIt(a)),a.register(new sIt(a)),a.register(new tIt(a)),a.register(new bIt(a)),a.register(new lIt(a)),a.register(new yIt(a)),a.register(new IIt(a)),a.register(new OIt(a)),a.register(new wIt(a)),a.register(new PIt(a)),a.register(new KL(a)),a.register(new NIt(a)),a.register(new VIt(a)),a.register(new _It(a)),a.register(new PEt(a)),a.register(new VEt(a)),a.register(new NEt(a)),a.register(new TEt(a)),a.register(new cEt(a)),a.register(new EEt(a)),a.register(new DEt(a)),a.register(new uEt(a)),a.register(new CEt(a)),a.register(new xEt(a)),a.register(new REt(a)),a.register(new IEt(a)),a.register(new Xw(a)),a.register(new _Et(a)),a.register(new $Et(a)),a.register(new AEt(a)),a.register(new OEt(a)),a.register(new wEt(a)),a.register(new bEt(a)),a.register(new gEt(a)),a.register(new vEt(a)),a.register(new mEt(a)),a.register(new BEt(a)),a.register(new LEt(a)),a.register(new SEt(a)),a.register(new GEt(a)),a.register(new Agt(a)),a.register(new Egt(a)),a.register(new Rgt(a)),a.register(new Dgt(a)),a.register(new Cgt(a)),a.register(new Igt(a)),a.register(new wgt(a)),a.register(new YRt(a)),a.register(new iAt(a)),a.register(new rAt(a)),a.register(new sAt(a)),a.register(new lAt(a)),a.register(new oAt(a)),a.register(new dAt(a)),a.register(new tAt(a)),a.register(new nAt(a)),a.register(new aAt(a)),a.register(new eAt(a)),a.register(new XRt(a)),a.register(new QRt(a)),a.register(new JRt(a)),a.register(new WRt(a)),a.register(new zRt(a)),a.register(new yAt(a)),a.register(new hAt(a)),a.register(new cAt(a)),a.register(new fAt(a)),a.register(new BRt(a)),a.register(new pAt(a)),a.register(new uAt(a)),a.register(new TAt(a)),a.register(new mAt(a)),a.register(new vAt(a)),a.register(new gAt(a)),a.register(new bAt(a)),a.register(new yTt(a)),a.register(new hTt(a)),a.register(new Jw(a)),a.register(new Qw(a)),a.register(new DAt(a)),a.register(new CAt(a)),a.register(new xAt(a)),a.register(new FAt(a)),a.register(new VAt(a)),a.register(new wAt(a)),a.register(new OAt(a)),a.register(new NAt(a)),a.register(new PAt(a)),a.register(new _At(a)),a.register(new $At(a)),a.register(new GAt(a)),a.register(new LAt(a)),a.register(new BAt(a)),a.register(new SAt(a)),a.register(new MAt(a)),a.register(new kAt(a)),a.register(new KAt(a)),a.register(new jAt(a)),a.register(new qAt(a)),a.register(new ZAt(a)),a.register(new HAt(a)),a.register(new WAt(a)),a.register(new zAt(a)),a.register(new k1t(a)),a.register(new YAt(a)),a.register(new JAt(a)),a.register(new c1t(a)),a.register(new QAt(a)),a.register(new XAt(a)),a.register(new e1t(a)),a.register(new t1t(a)),a.register(new i1t(a)),a.register(new n1t(a)),a.register(new r1t(a)),a.register(new a1t(a)),a.register(new s1t(a)),a.register(new o1t(a)),a.register(new d1t(a)),a.register(new p1t(a)),a.register(new u1t(a)),a.register(new f1t(a)),a.register(new F1t(a)),a.register(new h1t(a)),a.register(new A1t(a)),a.register(new b1t(a)),a.register(new E1t(a)),a.register(new g1t(a)),a.register(new w1t(a)),a.register(new y1t(a)),a.register(new m1t(a)),a.register(new O1t(a)),a.register(new C1t(a)),a.register(new P1t(a)),a.register(new V1t(a)),a.register(new N1t(a)),a.register(new _1t(a)),a.register(new $1t(a)),a.register(new G1t(a)),a.register(new L1t(a)),a.register(new B1t(a)),a.register(new S1t(a)),a.register(new M1t(a)),a.register(new v1t(a)),a.register(new T1t(a)),a.register(new I1t(a)),a.register(new x1t(a)),a.register(new D1t(a)),a.register(new R1t(a)),a.register(new EAt(a)),a.register(new IAt(a)),a.register(new zRn(a)),a.register(new nAn(a)),a.register(new sAn(a)),a.register(new dAn(a)),a.register(new cAn(a)),a.register(new hAn(a)),a.register(new gAn(a)),a.register(new IAn(a)),a.register(new RAn(a)),a.register(new AAn(a)),a.register(new VAn(a)),a.register(new GAn(a))}class F4{constructor(p=new pe.Events("extensions-registry-fallback-events")){C(this,"extensionsRegistry",new Map);C(this,"initialized",new Set);C(this,"initializedContexts",new Set);C(this,"onResolveEditorContextCallback",()=>null);C(this,"onResolveProjectLogicContextCallback",()=>null);C(this,"onResolveEditorGUIContextCallback",()=>null);C(this,"onResolveGUIContextCallback",()=>null);C(this,"onResolveCompileContextCallback",()=>null);C(this,"onResolvePublicationRunContextCallback",()=>null);this.events=p,this.off=this.events.off.bind(this.events),this.on=this.events.on.bind(this.events),this.emit=this.events.emit.bind(this.events),this.emitAsync=this.events.emitAsync.bind(this.events),this.emitAsyncAll=this.events.emitAsyncAll.bind(this.events),this.emitAsyncAllSettled=this.events.emitAsyncAllSettled.bind(this.events),this.emitAsyncSequentially=this.events.emitAsyncSequentially.bind(this.events),this.emitAsyncSequentiallyAll=this.events.emitAsyncSequentiallyAll.bind(this.events),this.emitAsyncSequentiallyAllSettled=this.events.emitAsyncSequentiallyAllSettled.bind(this.events)}onResolveEditorContext(p){this.onResolveEditorContextCallback=p}onResolveProjectLogicContext(p){this.onResolveProjectLogicContextCallback=p}onResolveGUIContext(p){this.onResolveGUIContextCallback=p}onResolveEditorGUIContext(p){this.onResolveEditorGUIContextCallback=p}onResolveCompileContext(p){this.onResolveCompileContextCallback=p}onResolvePublicationRunContext(p){this.onResolvePublicationRunContextCallback=p}get extensionInOrder(){return Array.from(this.extensionsRegistry.values()).sort((p,t)=>(p.manifest.initPriority||_e.Normal)-(t.manifest.initPriority||_e.Normal))}async setup(){LAn(this),pe.Logger.log("Initializing extensions without context..."),this.initForReady()}requestContext(p){switch(p){case X.Editor:return this.onResolveEditorContextCallback();case X.Logic:return this.onResolveProjectLogicContextCallback();case X.EditorGUI:return this.onResolveEditorGUIContextCallback();case X.Compile:return this.onResolveCompileContextCallback();case X.PublicationRun:return this.onResolvePublicationRunContextCallback();case X.GUI:return this.onResolveGUIContextCallback();case X.EditorGUI:return this.onResolveEditorGUIContextCallback();default:throw new Error(`Unknown context type: ${p}`)}}requestContexts(p,t=[]){const n=[];t.length===0&&(t=p.manifest.contexts);for(const s of t){const u=this.requestContext(s);u&&n.push(u)}return n}requestExtension(p){const t=this.extensionsRegistry.get(p);if(t)return t;throw new Error(`Unknown extension: ${p}`)}register(p){this.extensionsRegistry.set(p.manifest.id,p)}async initAll(){for(const p of this.extensionInOrder){if(this.initialized.has(p.manifest.id))continue;const t=this.requestContexts(p);p.manifest.contexts.every(s=>!!t.find(u=>u.contextType===s))&&(p.module.init&&await p.module.init(t),this.initialized.add(p.manifest.id))}}async initForReady(){pe.Logger.log("Initializing extensions for ready contexts...");for(const p of this.extensionInOrder){if(this.initialized.has(p.manifest.id))continue;const t=this.requestContexts(p);p.manifest.contexts.every(s=>!!t.find(u=>u.contextType===s))?(p.module.init?(pe.Logger.debug("Initializing "+p.manifest.id+" extension..."),await p.module.init(t)):pe.Logger.log("Set "+p.manifest.id+" extension as ready (no init method)..."),this.initialized.add(p.manifest.id)):pe.Logger.warn(`Skipping initialization of ${p.manifest.id} extension, not all contexts are ready.`,`Required contexts: ${p.manifest.contexts.join(", ")}`,`Available contexts: ${t.map(s=>s.contextType).join(", ")}`)}}async destroyAll(){for(const p of[...this.extensionInOrder].reverse())p.module.destroy&&await p.module.destroy();this.events.destroy()}on(p,t){this.events.on(p,t)}emit(p,...t){this.events.emit(p,...t)}off(p,t){this.events.off(p,t)}emitAsync(p,...t){return this.events.emitAsync(p,...t)}emitAsyncAll(p,...t){return this.events.emitAsyncAll(p,...t)}emitAsyncAllSettled(p,...t){return this.events.emitAsyncAllSettled(p,...t)}emitAsyncSequentially(p,...t){return this.events.emitAsyncSequentially(p,...t)}emitAsyncSequentiallyAll(p,...t){return this.events.emitAsyncSequentiallyAll(p,...t)}emitAsyncSequentiallyAllSettled(p,...t){return this.events.emitAsyncSequentiallyAllSettled(p,...t)}async contextAvailable(p){if(this.initializedContexts.has(p)){pe.Logger.warn(`Context ${p} is already initialized. Skipping re-initialization.`);return}switch(this.initializedContexts.add(p),p){case X.Editor:{if(!this.onResolveEditorContextCallback)throw new Error("No editor context resolver callback set. Call onResolveEditorContext first.");break}case X.Logic:{if(!this.onResolveProjectLogicContextCallback)throw new Error("No project logic context resolver callback set. Call onResolveProjectLogicContext first.");break}}pe.Logger.log(`Context ${p} is now available. Initializing extensions for this context...`),await this.initForReady()}getValueTypePreference(p){return window.localStorage.getItem("dynamic-value-type-preference--"+p)||null}setValueTypePreference(p,t){window.localStorage.setItem("dynamic-value-type-preference--"+p,(t==null?void 0:t.toString())||""),this.emit(p,{})}}let hw=null;const k4={requestExtension:a=>(hw||(hw=new F4,hw.setup()),hw.requestExtension(a))};function Eh(a){return!(a instanceof Error)&&typeof a=="object"&&a!==null?a:a instanceof Error?{name:a.name,message:a.message,stack:a.stack,...a}:a}function V5(a){var p,t,n;if(a&&typeof a=="object"&&"value"in a){const s=a;return{single:((p=s.value)==null?void 0:p.valueAsTypeSingle)??((t=s.value)==null?void 0:t.value),list:((n=s.value)==null?void 0:n.valueAsTypeList)??null}}return{single:a,list:Array.isArray(a)?a:null}}const Ih={onBeforeEntityExecution:async()=>{},onEntityExecuted:async()=>{}};class e2 extends Error{constructor(){super("Execution was stopped"),this.name="ExecutionStoppedError"}}var U4=(a=>(a.FinishedSuccess="finished-success",a.FinishedError="finished-error",a.Running="running",a.Paused="paused",a.Stopped="stopped",a.NotStarted="not-started",a))(U4||{});const oDt={...k4,getValueTypePreference:()=>null,setValueTypePreference:()=>{}};class vg extends pe.Events{constructor(t,n,s,u=null,e=oDt){super();C(this,"project");C(this,"entryPoint");C(this,"state","not-started");C(this,"events",new pe.Events("fe-exec-inst-events"));C(this,"entities",[]);C(this,"parentExecution",null);C(this,"executing",[]);C(this,"executed",[]);C(this,"skipped",[]);C(this,"scheduled",[]);C(this,"localTestValues");C(this,"resolvedValues");C(this,"persistedExecutionResults");C(this,"lastExecutionResults");C(this,"onAddToSkippedListCallback",null);C(this,"onRemoveFromSkippedListCallback",null);C(this,"onAddEntityCallback",null);C(this,"onRemoveEntityCallback",null);C(this,"onAbortExecutionCallback",null);this.parentContext=e,this.entities=n,this.entryPoint=s,this.project=t,this.parentExecution=u,this.localTestValues=new VR(M.UUID.uuid(),this.project),this.resolvedValues=new VR(M.UUID.uuid(),this.project),this.persistedExecutionResults=new VR(M.UUID.uuid(),this.project),this.lastExecutionResults=new VR(M.UUID.uuid(),this.project)}get valueResolutionContext(){return{execution:this,project:this.project,localTestValues:this.localTestValues,resolvedValues:this.resolvedValues,persistedExecutionResults:this.persistedExecutionResults,lastExecutionResults:this.lastExecutionResults,getValueTypePreference:this.parentContext.getValueTypePreference,setValueTypePreference:this.parentContext.setValueTypePreference}}get rootExecution(){let t=this;for(;t.parentExecution;)t=t.parentExecution;return t}get rootState(){return this.rootExecution.state}isStopped(){return this.state==="stopped"||this.rootExecution.state==="stopped"}isPaused(){return this.state==="paused"||this.rootExecution.state==="paused"}async checkStateAndPause(){if(this.isStopped())throw new e2;for(;this.isPaused();){if(this.isStopped())throw new e2;await new Promise(t=>setTimeout(t,100))}}skip(t){this.hasEntity(t)&&(this.removeFromScheduledList(t),!this.skipped.includes(t)&&(this.skipped.push(t),this.onAddToSkippedListCallback&&this.onAddToSkippedListCallback(t),Pr.includes(t.type)&&ri(t).forEach(n=>this.skip(n))))}async schedule(t,n,s){if(this.hasExecuted(t))return null;if(Xi.includes(t.type))return this.executeBranch(t,s,n);if(Vr.includes(t.type)){if(t.calledBy.every(e=>this.hasExecuted(e)||!this.hasEntity(e)))return this.executeBranch(t,s,n);this.scheduled.includes(t)||this.scheduled.push(t)}return null}mergeExernalValuesWithInternalInputs(t,n){const s=[];return Yi.includes(n.type)?s.push(...n.inputs.filter(e=>vT(e))):[...Li,...Xi].includes(n.type)?s.push(...n.inputs):Ni.includes(n.type)&&s.push(...n.outputs.filter(e=>vT(e))),s.map(e=>{var y;let f=t.find(m=>m.valueOwner.id===e.id);if(f)return f;if(!f&&Xi.includes(n.type)&&(f=t.find(m=>{var T;return((T=m.valueOwner.declaration)==null?void 0:T.id)===e.id})),f){const m=(y=f.value)==null?void 0:y.clone(null);return m==null||m.setStandaloneParent(e,null),{...f,valueOwner:e,value:m||null,inheritanceLink:{sources:[f],target:e}}}return ls.includes(e.type)?Xp(e,this.valueResolutionContext):Qu(e,this.valueResolutionContext)}).reduce((e,f)=>{const y=uf(f==null?void 0:f.valueOwner,this.project),m=f?[f]:[];return y.forEach(T=>{var R,I,A;if(T.id===(f==null?void 0:f.valueOwner.id))return;const g=Pn(T.getDataType(null),T,this.project);g==null||g.metaSync({value:(R=f==null?void 0:f.value)==null?void 0:R.value},null),g==null||g.setValueAsTypeList(((I=f==null?void 0:f.value)==null?void 0:I.valueAsTypeList)||null),g==null||g.setValueAsTypeSingle(((A=f==null?void 0:f.value)==null?void 0:A.valueAsTypeSingle)||null);const b={...f,valueOwner:T,value:g};m.push(b)}),[...e,...m]},[]).sort((e,f)=>e.valueOwner.index-f.valueOwner.index)}inheritValuesFromContext(t){this.localTestValues=t.localTestValues,this.resolvedValues=t.resolvedValues,this.persistedExecutionResults=t.persistedExecutionResults}async executeInternalCall(t,n,s,u={}){var f,y;this.logBeforeExecution("executeInternalCall",t,n);const e={...Ih,...u};try{let m={value:K.Success,error:null,result:null};if(n.sort((A,O)=>A.valueOwner.index-O.valueOwner.index),Object.values(ja).includes(t.declaration.id)){const A=this.parentContext.requestExtension(vi+t.declaration.id).module.main;A?m=await A(t,n,this):pe.Logger.warn(`No implementation found for built-in function: ${t.declaration.id}`)}else{const A=await this.executeDetachedFullFunctionDeclarationLogic(t.declaration,n,s,e);m={value:A.value,error:A.error,result:A.result}}let T=null;if(m.error&&t.error){pe.Logger.warn("Raw error executing entity: ",m.error);const{single:A,list:O}=V5(m.error),P=Eh(A),x=(f=t.error)==null?void 0:f.getDataType(null),$=Pn(x||null,t.error,s);x!=null&&x.asType?O!==null?$==null||$.setValueAsTypeList(O):$==null||$.setValueAsTypeSingle(A):$==null||$.metaSync({value:P},null),T={valueOwner:t.error,type:rt.ExecutionResult,inheritanceLink:null,value:$}}const g=t==null?void 0:t.getDataType(null),b=Pn(g,t,s),{single:R,list:I}=V5(m.result);return g!=null&&g.asType?I!==null?b==null||b.setValueAsTypeList(I):b==null||b.setValueAsTypeSingle(R):b==null||b.metaSync({value:R},null),{value:m.value,entity:t,error:T,result:{value:b||null,valueOwner:t,type:rt.ExecutionResult,inheritanceLink:null}}}catch(m){if(m&&(m.name==="ExecutionStoppedError"||m.message==="Execution was stopped"))throw m;pe.Logger.warn("Internal call execution error: ",m);let T=null;if(t.error){const g=Eh(m),b=(y=t.error)==null?void 0:y.getDataType(null),R=Pn(b,t.error,s);b!=null&&b.asType?R==null||R.setValueAsTypeSingle(m):R==null||R.metaSync({value:g},null),T={valueOwner:t.error,type:rt.ExecutionResult,inheritanceLink:null,value:R}}return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,entity:t,error:T,result:null}}}static async executeOperation(t,n,s,u){var e,f;u?u.logBeforeExecution("executeOperation",t,n):console.log(`executeOperation (${t.type}) -> [${De(t,s)}] Inputs:${n.length?`
62
62
  `:""}${n.map(y=>{var m,T,g;return`${(m=y.valueOwner)==null?void 0:m.type} (${(T=y.valueOwner)==null?void 0:T.id}) "${De(y.valueOwner,s)}": ${JSON.stringify((g=y.value)==null?void 0:g.value,null,2)}`}).join(`
63
63
  `)}
64
64
  `);try{let y={value:K.Success,error:null,result:null};n.sort((b,R)=>b.valueOwner.index-R.valueOwner.index),t.declaration.implementation&&(y=await t.declaration.implementation(t,n.sort((b,R)=>b.valueOwner.index-R.valueOwner.index)));let m=null;if(y.error&&t.error){const b=Eh(y.error),R=((e=t.error)==null?void 0:e.getDataType(null))||null,I=Pn(R,t.error,s);R!=null&&R.asType?I==null||I.setValueAsTypeSingle(y.error):I==null||I.metaSync({value:b},null),m={valueOwner:t.error,type:rt.ExecutionResult,inheritanceLink:null,value:I}}const T=t==null?void 0:t.getDataType(null),g=Pn(T,t,s);return T!=null&&T.asType?g==null||g.setValueAsTypeSingle(y.result):g==null||g.metaSync({value:y.result},null),{value:y.value,entity:t,error:m,result:{value:g||null,valueOwner:t,type:rt.ExecutionResult,inheritanceLink:null}}}catch(y){if(y&&(y.name==="ExecutionStoppedError"||y.message==="Execution was stopped"))throw y;console.warn("Operation execution error: ",y);let m=null;if(t.error){const T=Eh(y),g=(f=t.error)==null?void 0:f.getDataType(null),b=Pn(g,t.error,s);g!=null&&g.asType?b==null||b.setValueAsTypeSingle(y):b==null||b.metaSync({value:T},null),m={valueOwner:t.error,type:rt.ExecutionResult,inheritanceLink:null,value:b}}return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,entity:t,error:m,result:null}}}async executeSearch(t,n,s){var u;this.logBeforeExecution("executeSearch",t,n);try{let e={value:K.Success,error:null,result:null};const f=await(await this.parentContext.requestExtension(je.SEARCH_NODE_IMPLEMENTATION)).module.main(t,n),y=t==null?void 0:t.getDataType(null),m=Pn(y,t,s);return m==null||m.metaSync({value:f},null),f.error?{value:K.UnhandledError,entity:t,error:{valueOwner:t,type:rt.ExecutionResult,inheritanceLink:null,value:m},result:null}:{value:e.value,entity:t,error:null,result:{value:m,valueOwner:t,type:rt.ExecutionResult,inheritanceLink:null}}}catch(e){if(e&&(e.name==="ExecutionStoppedError"||e.message==="Execution was stopped"))throw e;if(pe.Logger.warn(`Search node execution error: ${e}`),!t.error)return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,entity:t,error:null,result:null};const f=Eh(e),y=(u=t.error)==null?void 0:u.getDataType(null),m=Pn(y,t.error,s);return m==null||m.metaSync({value:f},null),{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,entity:t,error:{valueOwner:t.error,type:rt.ExecutionResult,inheritanceLink:null,value:m},result:null}}}async executeLoop(t,n,s,u={}){var f,y,m,T,g,b,R,I,A,O,P,x,$,U,q,Z,H;this.logBeforeExecution("executeLoop",t,n);const e={...Ih,...u};try{let W={value:K.Success,error:null,result:null};const ie=n.map(ae=>{var le,oe;return((le=ae==null?void 0:ae.value)==null?void 0:le.valueAsType)||((oe=ae==null?void 0:ae.value)==null?void 0:oe.value)});let z={};const Y=t.body.inputs.find(ae=>ae!==t.currentIterationNumberArgumentDeclaration&&ae!==t.currentValueArgumentDeclaration);if(Y){const ae=Y,le=Pn(ae.getDataType(null),ae,s);le==null||le.metaSync({value:((f=ae.defaultValue)==null?void 0:f.value)||null},null),z[ae.id]={value:le||null,valueOwner:ae,type:rt.ExecutionResult,inheritanceLink:null}}let ee={value:K.Success,entity:t.body,error:null,result:null};switch(t.declaration.id){case G.loop["counted-loop"].id:{const ae=ie[0];let le=1;for(;le<=ae&&le<=1e3;){await this.checkStateAndPause();const oe=t.body.inputs.map(ce=>{if(ce===t.currentIterationNumberArgumentDeclaration){const ge=t.currentIterationNumberArgumentDeclaration.getDataType(null),Ce=ly(ge),Ee=this.lastExecutionResults.readValue(ce.id);if(Ee){Ee.metaSync({value:le},null);const tt=Xr(Ee,ce);this.lastExecutionResults.writeValue(ce,tt);const We={value:tt,valueOwner:t.currentIterationNumberArgumentDeclaration,type:rt.ExecutionResult,inheritanceLink:null};return z[ce.id]=We,We}const Oe={id:M.UUID.uuid(),deletable:!0,editable:!0,type:r.LiteralValue,autogeneration:null,version:M.UUID.uuid(),createdAt:new Date().toISOString(),author:M.sessionAuthor,deleted:!1,previousVersion:null,value:le,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:Ce,standaloneParent:ce.toReference()},Le=Zr(Oe,s);this.lastExecutionResults.writeValue(ce,Le);const Fe={value:Le,valueOwner:t.currentIterationNumberArgumentDeclaration,type:rt.ExecutionResult,inheritanceLink:null};return z[ce.id]=Fe,Fe}else return z[ce.id]}).filter(ce=>!!ce);if(ee=await this.executeFullFunctionDeclarationLogic(t.body,oe,e),ee!=null&&ee.result&&ee.value!==K.Return){const ce=t.body.inputs.find(ge=>ge!==t.currentIterationNumberArgumentDeclaration&&ge!==t.currentValueArgumentDeclaration);if(ce){let ge=(y=ee.result.value)==null?void 0:y.value;ge===void 0&&(ge=null),(m=z[ce.id].value)==null||m.metaSync({value:ge},null);const Ce=Xr(z[ce.id].value,ce);this.lastExecutionResults.writeValue(ce,Ce)}}if([K.CaughtError,K.UnhandledError,K.Break,K.Return].includes(ee.value))break;le++}break}case G.loop["manual-flow-loop"].id:{let ae=1;for(;ae<=50;){await this.checkStateAndPause();const le=t.body.inputs.map(oe=>{if(oe===t.currentIterationNumberArgumentDeclaration){const ce=this.lastExecutionResults.readValue(oe.id);if(ce){ce.metaSync({value:ae},null);const Oe=Xr(ce,oe);this.lastExecutionResults.writeValue(oe,Oe);const Le={value:Oe,valueOwner:oe,type:rt.ExecutionResult,inheritanceLink:null};return z[oe.id]=Le,Le}const ge=t.currentIterationNumberArgumentDeclaration.getDataType(null),Ce=Pn(ge,oe,s);return Ce==null||Ce.metaSync({value:ae},null),this.lastExecutionResults.writeValue(oe,Ce),{value:Ce,valueOwner:oe,type:rt.ExecutionResult,inheritanceLink:null}}else return z[oe.id]}).filter(oe=>!!oe);if(ee=await this.executeFullFunctionDeclarationLogic(t.body,le,e),ee!=null&&ee.result&&ee.value!==K.Return){const oe=t.body.inputs.find(ce=>ce!==t.currentIterationNumberArgumentDeclaration&&ce!==t.currentValueArgumentDeclaration);if(oe){let ce=(T=ee.result.value)==null?void 0:T.value;ce===void 0&&(ce=null),(g=z[oe.id].value)==null||g.metaSync({value:ce},null);const ge=Xr(z[oe.id].value,oe);this.lastExecutionResults.writeValue(oe,ge)}}if([K.CaughtError,K.UnhandledError,K.Break,K.Return].includes(ee.value))break;ae++}break}case G.loop["list-loop"].id:{const ae=ie[0];let le=1;const oe=ae;for(let ce=0;ce<oe.length;ce++){await this.checkStateAndPause();const ge=oe[ce],Ce=t.body.inputs.map(Ee=>{if(Ee===t.currentIterationNumberArgumentDeclaration){const Oe=this.lastExecutionResults.readValue(Ee.id);if(Oe){Oe.metaSync({value:le},null);const We=Xr(Oe,Ee);return this.lastExecutionResults.writeValue(Ee,We),{value:We,valueOwner:Ee,type:rt.ExecutionResult,inheritanceLink:null}}const Le=t.currentIterationNumberArgumentDeclaration.getDataType(null),Fe=Pn(Le,Ee,s);return Fe==null||Fe.metaSync({value:le},null),this.lastExecutionResults.writeValue(Ee,Fe),{value:Fe,valueOwner:t.currentIterationNumberArgumentDeclaration,type:rt.ExecutionResult,inheritanceLink:null}}else if(Ee===t.currentValueArgumentDeclaration){const Oe=t.currentValueArgumentDeclaration.getDataType(null),Le=ly(Oe),Fe=this.lastExecutionResults.readValue(Ee.id);if(Fe){Fe.metaSync({value:ge},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:ge,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:Le,standaloneParent:Ee.toReference()},We=Zr(tt,s);return this.lastExecutionResults.writeValue(Ee,We),{value:We,valueOwner:t.currentValueArgumentDeclaration,type:rt.ExecutionResult,inheritanceLink:null}}else return z[Ee.id]}).filter(Ee=>!!Ee);if(ee=await this.executeFullFunctionDeclarationLogic(t.body,Ce,e),ee!=null&&ee.result&&ee.value!==K.Return){const Ee=t.body.inputs.find(Oe=>Oe!==t.currentIterationNumberArgumentDeclaration&&Oe!==t.currentValueArgumentDeclaration);if(Ee){let Oe=(b=ee.result.value)==null?void 0:b.value;Oe===void 0&&(Oe=null),(R=z[Ee.id].value)==null||R.metaSync({value:Oe},null);const Le=Xr(z[Ee.id].value,Ee);this.lastExecutionResults.writeValue(Ee,Le)}}if([K.CaughtError,K.UnhandledError,K.Break,K.Return].includes(ee.value))break;le++}break}case G.loop["object-keys-loop"].id:{const ae=ie[0];let le=1;const oe=ae?Object.keys(ae):[];for(let ce=0;ce<oe.length;ce++){await this.checkStateAndPause();const ge=oe[ce],Ce=t.body.inputs.map(Ee=>{if(Ee===t.currentIterationNumberArgumentDeclaration){const Oe=this.lastExecutionResults.readValue(Ee.id);if(Oe){Oe.metaSync({value:le},null);const We=Xr(Oe,Ee);return this.lastExecutionResults.writeValue(Ee,We),{value:We,valueOwner:Ee,type:rt.ExecutionResult,inheritanceLink:null}}const Le=t.currentIterationNumberArgumentDeclaration.getDataType(null),Fe=Pn(Le,Ee,s);return Fe==null||Fe.metaSync({value:le},null),this.lastExecutionResults.writeValue(Ee,Fe),{value:Fe,valueOwner:t.currentIterationNumberArgumentDeclaration,type:rt.ExecutionResult,inheritanceLink:null}}else if(Ee===t.currentValueArgumentDeclaration){const Oe=t.currentValueArgumentDeclaration.getDataType(null),Le=ly(Oe),Fe=this.lastExecutionResults.readValue(Ee.id);if(Fe){Fe.metaSync({value:ge},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:ge,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:Le,standaloneParent:Ee.toReference()},We=Zr(tt,s);return this.lastExecutionResults.writeValue(Ee,We),{value:We,valueOwner:t.currentValueArgumentDeclaration,type:rt.ExecutionResult,inheritanceLink:null}}else return z[Ee.id]}).filter(Ee=>!!Ee);if(ee=await this.executeFullFunctionDeclarationLogic(t.body,Ce,e),ee!=null&&ee.result&&ee.value!==K.Return){const Ee=t.body.inputs.find(Oe=>Oe!==t.currentIterationNumberArgumentDeclaration&&Oe!==t.currentValueArgumentDeclaration);if(Ee){let Oe=(I=ee.result.value)==null?void 0:I.value;Oe===void 0&&(Oe=null),(A=z[Ee.id].value)==null||A.metaSync({value:Oe},null);const Le=Xr(z[Ee.id].value,Ee);this.lastExecutionResults.writeValue(Ee,Le)}}if([K.CaughtError,K.UnhandledError,K.Break,K.Return].includes(ee.value))break;le++}break}case G.loop["object-values-loop"].id:{const ae=ie[0];let le=1;const oe=ae?Object.values(ae):[];for(let ce=0;ce<oe.length;ce++){await this.checkStateAndPause();const ge=oe[ce],Ce=t.body.inputs.map(Ee=>{if(Ee===t.currentIterationNumberArgumentDeclaration){const Oe=this.lastExecutionResults.readValue(Ee.id);if(Oe){Oe.metaSync({value:le},null);const We=Xr(Oe,Ee);return this.lastExecutionResults.writeValue(Ee,We),{value:We,valueOwner:Ee,type:rt.ExecutionResult,inheritanceLink:null}}const Le=t.currentIterationNumberArgumentDeclaration.getDataType(null),Fe=Pn(Le,Ee,s);return Fe==null||Fe.metaSync({value:le},null),this.lastExecutionResults.writeValue(Ee,Fe),{value:Fe,valueOwner:t.currentIterationNumberArgumentDeclaration,type:rt.ExecutionResult,inheritanceLink:null}}else if(Ee===t.currentValueArgumentDeclaration){const Oe=t.currentValueArgumentDeclaration.getDataType(null),Le=ly(Oe),Fe=this.lastExecutionResults.readValue(Ee.id);if(Fe){Fe.metaSync({value:ge},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:ge,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:Le,standaloneParent:Ee.toReference()},We=Zr(tt,s);return this.lastExecutionResults.writeValue(Ee,We),{value:We,valueOwner:t.currentValueArgumentDeclaration,type:rt.ExecutionResult,inheritanceLink:null}}else return z[Ee.id]}).filter(Ee=>!!Ee);if(ee=await this.executeFullFunctionDeclarationLogic(t.body,Ce,e),ee!=null&&ee.result&&ee.value!==K.Return){const Ee=t.body.inputs.find(Oe=>Oe!==t.currentIterationNumberArgumentDeclaration&&Oe!==t.currentValueArgumentDeclaration);if(Ee){let Oe=(O=ee.result.value)==null?void 0:O.value;Oe===void 0&&(Oe=null),(P=z[Ee.id].value)==null||P.metaSync({value:Oe},null);const Le=Xr(z[Ee.id].value,Ee);this.lastExecutionResults.writeValue(Ee,Le)}}if([K.CaughtError,K.UnhandledError,K.Break,K.Return].includes(ee.value))break;le++}break}case G.loop["string-loop"].id:{const ae=ie[0];let le=1;const oe=ae.split("");for(let ce=0;ce<oe.length;ce++){await this.checkStateAndPause();const ge=oe[ce],Ce=t.body.inputs.map(Ee=>{if(Ee===t.currentIterationNumberArgumentDeclaration){const Oe=this.lastExecutionResults.readValue(Ee.id);if(Oe){Oe.metaSync({value:le},null);const We=Xr(Oe,Ee);return this.lastExecutionResults.writeValue(Ee,We),{value:We,valueOwner:Ee,type:rt.ExecutionResult,inheritanceLink:null}}const Le=t.currentIterationNumberArgumentDeclaration.getDataType(null),Fe=Pn(Le,Ee,s);return Fe==null||Fe.metaSync({value:le},null),this.lastExecutionResults.writeValue(Ee,Fe),{value:Fe,valueOwner:t.currentIterationNumberArgumentDeclaration,type:rt.ExecutionResult,inheritanceLink:null}}else if(Ee===t.currentValueArgumentDeclaration){const Oe=t.currentValueArgumentDeclaration.getDataType(null),Le=ly(Oe),Fe=this.lastExecutionResults.readValue(Ee.id);if(Fe){Fe.metaSync({value:ge},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:ge,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:Le,standaloneParent:Ee.toReference()},We=Zr(tt,s);return this.lastExecutionResults.writeValue(Ee,We),{value:We,valueOwner:t.currentValueArgumentDeclaration,type:rt.ExecutionResult,inheritanceLink:null}}else return z[Ee.id]}).filter(Ee=>!!Ee);if(ee=await this.executeFullFunctionDeclarationLogic(t.body,Ce,e),(ee.results||[]).forEach(Ee=>{var We,et,qe;if(Ee.valueOwner.type!==r.InputMap||Ni.includes(Ee.valueOwner.parent.type))return;const Oe=t.body.inputs.find(ot=>De(ot,s)===De(Ee.valueOwner,s)),Fe=[...(We=z[Oe.id].value)==null?void 0:We.value,((et=Ee.value)==null?void 0:et.value)||null];(qe=z[Oe.id].value)==null||qe.metaSync({value:Fe},null);const tt=Xr(z[Oe.id].value,Oe);this.lastExecutionResults.writeValue(Oe,tt)}),[K.CaughtError,K.UnhandledError,K.Break,K.Return].includes(ee.value))break;le++}break}}let J=K.Success;if(ee.value===K.UnhandledError?t.catchesError||t.errorCalls.length?J=K.CaughtError:J=K.UnhandledError:[K.CaughtError,K.Return].includes(ee.value)&&(J=ee.value),W={value:J,error:(($=(x=ee.error)==null?void 0:x.value)==null?void 0:$.value)||null,result:((q=(U=ee==null?void 0:ee.result)==null?void 0:U.value)==null?void 0:q.value)||null},W.value===K.UnhandledError||W.value===K.CaughtError){let ae=null;if(t.error){const le=Eh(W.error),oe=(Z=t.error)==null?void 0:Z.getDataType(null),ce=Pn(oe||null,t.error,s);oe!=null&&oe.asType?ce==null||ce.setValueAsTypeSingle(W.error):ce==null||ce.metaSync({value:le},null),ae={valueOwner:t.error,type:rt.ExecutionResult,inheritanceLink:null,value:ce}}return{value:W.value,entity:t,error:ae,result:null}}const te=t==null?void 0:t.getDataType(null),re=Pn(te,t,s);return te!=null&&te.asType?re==null||re.setValueAsTypeSingle(W.result):re==null||re.metaSync({value:W.result},null),{value:W.value,entity:t,error:null,result:{value:re||null,valueOwner:t,type:rt.ExecutionResult,inheritanceLink:null}}}catch(W){if(W&&(W.name==="ExecutionStoppedError"||W.message==="Execution was stopped"))throw W;if(pe.Logger.warn("Error executing loop: ",W),t.error){const ie=Eh(W),z=(H=t.error)==null?void 0:H.getDataType(null),Y=Pn(z,t.error,s);return z!=null&&z.asType?Y==null||Y.setValueAsTypeSingle(W):Y==null||Y.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:Y},result:null}}else return{value:t.catchesError||t.errorCalls.length?K.CaughtError:K.UnhandledError,entity:t,error:null,result:null}}}async executeFunctionCall(t,n,s,u={}){var f,y,m,T,g,b,R,I,A,O,P,x,$,U,q,Z,H,W,ie,z,Y,ee,J,te,re,ae;const e={...Ih,...u};try{this.logBeforeExecution("executeFunctionCall",t,n);const le=await this.executeDetachedFullFunctionDeclarationLogic(t.declaration,n,s,e);let oe=null;if(le.error&&t.error){pe.Logger.warn("Raw error executing entity: ",le.error);const Ee=(f=t.error)==null?void 0:f.getDataType(null),Oe=Pn(Ee||null,t.error,s);Ee!=null&&Ee.asType?(m=(y=le.error)==null?void 0:y.value)!=null&&m.valueAsTypeSingle?Oe==null||Oe.setValueAsTypeSingle((g=(T=le.error)==null?void 0:T.value)==null?void 0:g.valueAsTypeSingle):(R=(b=le.error)==null?void 0:b.value)!=null&&R.valueAsTypeList&&Array.isArray((A=(I=le.error)==null?void 0:I.value)==null?void 0:A.valueAsTypeList)&&(Oe==null||Oe.setValueAsTypeList((P=(O=le.error)==null?void 0:O.value)==null?void 0:P.valueAsTypeList)):Oe==null||Oe.metaSync({value:($=(x=le.error)==null?void 0:x.value)==null?void 0:$.value},null),oe={valueOwner:t.error,type:rt.ExecutionResult,inheritanceLink:null,value:Oe}}let ce=K.Success;le.value===K.UnhandledError&&(t.catchesError||t.errorCalls.length?ce=K.CaughtError:ce=K.UnhandledError);const ge=t==null?void 0:t.getDataType(null),Ce=Pn(ge,t,s);return ge!=null&&ge.asType?(q=(U=le.result)==null?void 0:U.value)!=null&&q.valueAsTypeSingle?Ce==null||Ce.setValueAsTypeSingle((H=(Z=le.result)==null?void 0:Z.value)==null?void 0:H.valueAsTypeSingle):(ie=(W=le.result)==null?void 0:W.value)!=null&&ie.valueAsTypeList&&Array.isArray((Y=(z=le.result)==null?void 0:z.value)==null?void 0:Y.valueAsTypeList)&&(Ce==null||Ce.setValueAsTypeList((J=(ee=le.result)==null?void 0:ee.value)==null?void 0:J.valueAsTypeList)):Ce==null||Ce.metaSync({value:((re=(te=le.result)==null?void 0:te.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),ge=Pn(ce,t.error,s);return ce!=null&&ce.asType?ge==null||ge.setValueAsTypeSingle(le):ge==null||ge.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:ge},result:null}}}async executeCondition(t,n){var u,e,f,y;this.logBeforeExecution("executeCondition",t,n);let s=!1;switch(t.declaration.id){case qs.BooleanIsTrue:{const m=(e=(u=n[0])==null?void 0:u.value)==null?void 0:e.value;if(typeof m!="boolean")throw new TypeError("BooleanIsTrue expects a boolean input.");s=m===!0;break}case qs.BooleanIsFalse:{const m=(y=(f=n[0])==null?void 0:f.value)==null?void 0:y.value;if(typeof m!="boolean")throw new TypeError("BooleanIsFalse expects a boolean input.");s=m===!1;break}case $a.And:{s=(await Promise.all(t.andChildrenGroup.map(async T=>{const g=this.mergeExernalValuesWithInternalInputs(n,T);return(await this.executeCondition(T,g)).value===K.Success}))).every(T=>T);break}case $a.Or:{s=(await Promise.all(t.orChildrenGroup.map(async T=>{const g=this.mergeExernalValuesWithInternalInputs(n,T);return(await this.executeCondition(T,g)).value===K.Success}))).some(T=>T);break}default:throw new Error(`Condition declaration ${t.declaration.name} does not have an implementation.`)}return{value:s?K.Success:K.ConditionNotMet,entity:t,error:null,result:null}}async executeDetachedFullFunctionDeclarationLogic(t,n,s,u={}){this.logBeforeExecution("executeDetachedFullFunctionDeclarationLogic",t,n);const e={...Ih,...u,onBeforeEntityExecution:(m,T,g)=>{var b;return((b=u==null?void 0:u.onBeforeEntityExecution)==null?void 0:b.call(u,m,T,{...g,detached:!0}))||Promise.resolve()},onEntityExecuted:(m,T,g)=>{var b;return((b=u==null?void 0:u.onEntityExecuted)==null?void 0:b.call(u,m,T,{...g,detached:!0}))||Promise.resolve()}},f=new vg(s,[t,...bO(t)],t,this,this.parentContext);return f.inheritValuesFromContext(this),await f.execute(e,n)}async executeFullFunctionDeclarationLogic(t,n,s={}){this.logBeforeExecution("executeFullFunctionDeclarationLogic",t,n);const u={...Ih,...s},e=bO(t),f=[];e.forEach(T=>{if(T.type===r.VariableDeclaration||T.type===r.VariableInstance){const g=T;g.internalCalls&&f.push(...g.internalCalls)}}),e.push(...f),console.log(`[executeFullFunctionDeclarationLogic] Reseting children for: ${De(t,this.project)}