@activepieces/piece-google-drive 0.12.0 → 0.12.1
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/package.json +1 -1
- package/src/index.js +1 -1
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -107,7 +107,7 @@ content-type: ${l["content-type"]}\r
|
|
|
107
107
|
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let u=s[1];if(t===s[0]){i(s);continue}if(e.external){let g=e.external.registry.get(s[0])?.id;if(t!==s[0]&&g){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(u.cycle){i(s);continue}if(u.count>1&&e.reused==="ref"){i(s);continue}}}a(Po,"extractDefs");function wo(e,t){let n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");let o=a(s=>{let u=e.seen.get(s);if(u.ref===null)return;let h=u.def??u.schema,g={...h},y=u.ref;if(u.ref=null,y){o(y);let b=e.seen.get(y),P=b.schema;if(P.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(h.allOf=h.allOf??[],h.allOf.push(P)):Object.assign(h,P),Object.assign(h,g),s._zod.parent===y)for(let R in h)R==="$ref"||R==="allOf"||R in g||delete h[R];if(P.$ref&&b.def)for(let R in h)R==="$ref"||R==="allOf"||R in b.def&&JSON.stringify(h[R])===JSON.stringify(b.def[R])&&delete h[R]}let T=s._zod.parent;if(T&&T!==y){o(T);let b=e.seen.get(T);if(b?.schema.$ref&&(h.$ref=b.schema.$ref,b.def))for(let P in h)P==="$ref"||P==="allOf"||P in b.def&&JSON.stringify(h[P])===JSON.stringify(b.def[P])&&delete h[P]}e.override({zodSchema:s,jsonSchema:h,path:u.path??[]})},"flattenRef");for(let s of[...e.seen.entries()].reverse())o(s[0]);let r={};if(e.target==="draft-2020-12"?r.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?r.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?r.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let s=e.external.registry.get(t)?.id;if(!s)throw new Error("Schema is missing an `id` property");r.$id=e.external.uri(s)}Object.assign(r,n.def??n.schema);let i=e.external?.defs??{};for(let s of e.seen.entries()){let u=s[1];u.def&&u.defId&&(i[u.defId]=u.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?r.$defs=i:r.definitions=i);try{let s=JSON.parse(JSON.stringify(r));return Object.defineProperty(s,"~standard",{value:{...t["~standard"],jsonSchema:{input:pa(t,"input",e.processors),output:pa(t,"output",e.processors)}},enumerable:!1,writable:!1}),s}catch{throw new Error("Error converting schema to JSON.")}}a(wo,"finalize");function Jt(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return Jt(o.element,n);if(o.type==="set")return Jt(o.valueType,n);if(o.type==="lazy")return Jt(o.getter(),n);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault")return Jt(o.innerType,n);if(o.type==="intersection")return Jt(o.left,n)||Jt(o.right,n);if(o.type==="record"||o.type==="map")return Jt(o.keyType,n)||Jt(o.valueType,n);if(o.type==="pipe")return Jt(o.in,n)||Jt(o.out,n);if(o.type==="object"){for(let r in o.shape)if(Jt(o.shape[r],n))return!0;return!1}if(o.type==="union"){for(let r of o.options)if(Jt(r,n))return!0;return!1}if(o.type==="tuple"){for(let r of o.items)if(Jt(r,n))return!0;return!!(o.rest&&Jt(o.rest,n))}return!1}a(Jt,"isTransforming");var Hy=a((e,t={})=>n=>{let o=_o({...n,processors:t});return rt(e,o),Po(o,e),wo(o,e)},"createToJSONSchemaMethod"),pa=a((e,t,n={})=>o=>{let{libraryOptions:r,target:i}=o??{},s=_o({...r??{},target:i,io:t,processors:n});return rt(e,s),Po(s,e),wo(s,e)},"createStandardJSONSchemaMethod");var Xj={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Zy=a((e,t,n,o)=>{let r=n;r.type="string";let{minimum:i,maximum:s,format:u,patterns:h,contentEncoding:g}=e._zod.bag;if(typeof i=="number"&&(r.minLength=i),typeof s=="number"&&(r.maxLength=s),u&&(r.format=Xj[u]??u,r.format===""&&delete r.format,u==="time"&&delete r.format),g&&(r.contentEncoding=g),h&&h.size>0){let y=[...h];y.length===1?r.pattern=y[0].source:y.length>1&&(r.allOf=[...y.map(T=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:T.source}))])}},"stringProcessor"),Wy=a((e,t,n,o)=>{let r=n,{minimum:i,maximum:s,format:u,multipleOf:h,exclusiveMaximum:g,exclusiveMinimum:y}=e._zod.bag;typeof u=="string"&&u.includes("int")?r.type="integer":r.type="number",typeof y=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(r.minimum=y,r.exclusiveMinimum=!0):r.exclusiveMinimum=y),typeof i=="number"&&(r.minimum=i,typeof y=="number"&&t.target!=="draft-04"&&(y>=i?delete r.minimum:delete r.exclusiveMinimum)),typeof g=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(r.maximum=g,r.exclusiveMaximum=!0):r.exclusiveMaximum=g),typeof s=="number"&&(r.maximum=s,typeof g=="number"&&t.target!=="draft-04"&&(g<=s?delete r.maximum:delete r.exclusiveMaximum)),typeof h=="number"&&(r.multipleOf=h)},"numberProcessor"),Ky=a((e,t,n,o)=>{n.type="boolean"},"booleanProcessor"),Jy=a((e,t,n,o)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},"bigintProcessor"),Xy=a((e,t,n,o)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},"symbolProcessor"),Yy=a((e,t,n,o)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},"nullProcessor"),Qy=a((e,t,n,o)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},"undefinedProcessor"),ev=a((e,t,n,o)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},"voidProcessor"),tv=a((e,t,n,o)=>{n.not={}},"neverProcessor"),rv=a((e,t,n,o)=>{},"anyProcessor"),nv=a((e,t,n,o)=>{},"unknownProcessor"),ov=a((e,t,n,o)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},"dateProcessor"),iv=a((e,t,n,o)=>{let r=e._zod.def,i=bs(r.entries);i.every(s=>typeof s=="number")&&(n.type="number"),i.every(s=>typeof s=="string")&&(n.type="string"),n.enum=i},"enumProcessor"),av=a((e,t,n,o)=>{let r=e._zod.def,i=[];for(let s of r.values)if(s===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof s=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(s))}else i.push(s);if(i.length!==0)if(i.length===1){let s=i[0];n.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[s]:n.const=s}else i.every(s=>typeof s=="number")&&(n.type="number"),i.every(s=>typeof s=="string")&&(n.type="string"),i.every(s=>typeof s=="boolean")&&(n.type="boolean"),i.every(s=>s===null)&&(n.type="null"),n.enum=i},"literalProcessor"),sv=a((e,t,n,o)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},"nanProcessor"),cv=a((e,t,n,o)=>{let r=n,i=e._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");r.type="string",r.pattern=i.source},"templateLiteralProcessor"),uv=a((e,t,n,o)=>{let r=n,i={type:"string",format:"binary",contentEncoding:"binary"},{minimum:s,maximum:u,mime:h}=e._zod.bag;s!==void 0&&(i.minLength=s),u!==void 0&&(i.maxLength=u),h?h.length===1?(i.contentMediaType=h[0],Object.assign(r,i)):(Object.assign(r,i),r.anyOf=h.map(g=>({contentMediaType:g}))):Object.assign(r,i)},"fileProcessor"),lv=a((e,t,n,o)=>{n.type="boolean"},"successProcessor"),dv=a((e,t,n,o)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},"customProcessor"),pv=a((e,t,n,o)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},"functionProcessor"),fv=a((e,t,n,o)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},"transformProcessor"),mv=a((e,t,n,o)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},"mapProcessor"),hv=a((e,t,n,o)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},"setProcessor"),gv=a((e,t,n,o)=>{let r=n,i=e._zod.def,{minimum:s,maximum:u}=e._zod.bag;typeof s=="number"&&(r.minItems=s),typeof u=="number"&&(r.maxItems=u),r.type="array",r.items=rt(i.element,t,{...o,path:[...o.path,"items"]})},"arrayProcessor"),yv=a((e,t,n,o)=>{let r=n,i=e._zod.def;r.type="object",r.properties={};let s=i.shape;for(let g in s)r.properties[g]=rt(s[g],t,{...o,path:[...o.path,"properties",g]});let u=new Set(Object.keys(s)),h=new Set([...u].filter(g=>{let y=i.shape[g]._zod;return t.io==="input"?y.optin===void 0:y.optout===void 0}));h.size>0&&(r.required=Array.from(h)),i.catchall?._zod.def.type==="never"?r.additionalProperties=!1:i.catchall?i.catchall&&(r.additionalProperties=rt(i.catchall,t,{...o,path:[...o.path,"additionalProperties"]})):t.io==="output"&&(r.additionalProperties=!1)},"objectProcessor"),Sp=a((e,t,n,o)=>{let r=e._zod.def,i=r.inclusive===!1,s=r.options.map((u,h)=>rt(u,t,{...o,path:[...o.path,i?"oneOf":"anyOf",h]}));i?n.oneOf=s:n.anyOf=s},"unionProcessor"),vv=a((e,t,n,o)=>{let r=e._zod.def,i=rt(r.left,t,{...o,path:[...o.path,"allOf",0]}),s=rt(r.right,t,{...o,path:[...o.path,"allOf",1]}),u=a(g=>"allOf"in g&&Object.keys(g).length===1,"isSimpleIntersection"),h=[...u(i)?i.allOf:[i],...u(s)?s.allOf:[s]];n.allOf=h},"intersectionProcessor"),_v=a((e,t,n,o)=>{let r=n,i=e._zod.def;r.type="array";let s=t.target==="draft-2020-12"?"prefixItems":"items",u=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",h=i.items.map((b,P)=>rt(b,t,{...o,path:[...o.path,s,P]})),g=i.rest?rt(i.rest,t,{...o,path:[...o.path,u,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null;t.target==="draft-2020-12"?(r.prefixItems=h,g&&(r.items=g)):t.target==="openapi-3.0"?(r.items={anyOf:h},g&&r.items.anyOf.push(g),r.minItems=h.length,g||(r.maxItems=h.length)):(r.items=h,g&&(r.additionalItems=g));let{minimum:y,maximum:T}=e._zod.bag;typeof y=="number"&&(r.minItems=y),typeof T=="number"&&(r.maxItems=T)},"tupleProcessor"),Pv=a((e,t,n,o)=>{let r=n,i=e._zod.def;r.type="object";let s=i.keyType,h=s._zod.bag?.patterns;if(i.mode==="loose"&&h&&h.size>0){let y=rt(i.valueType,t,{...o,path:[...o.path,"patternProperties","*"]});r.patternProperties={};for(let T of h)r.patternProperties[T.source]=y}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(r.propertyNames=rt(i.keyType,t,{...o,path:[...o.path,"propertyNames"]})),r.additionalProperties=rt(i.valueType,t,{...o,path:[...o.path,"additionalProperties"]});let g=s._zod.values;if(g){let y=[...g].filter(T=>typeof T=="string"||typeof T=="number");y.length>0&&(r.required=y)}},"recordProcessor"),wv=a((e,t,n,o)=>{let r=e._zod.def,i=rt(r.innerType,t,o),s=t.seen.get(e);t.target==="openapi-3.0"?(s.ref=r.innerType,n.nullable=!0):n.anyOf=[i,{type:"null"}]},"nullableProcessor"),bv=a((e,t,n,o)=>{let r=e._zod.def;rt(r.innerType,t,o);let i=t.seen.get(e);i.ref=r.innerType},"nonoptionalProcessor"),Tv=a((e,t,n,o)=>{let r=e._zod.def;rt(r.innerType,t,o);let i=t.seen.get(e);i.ref=r.innerType,n.default=JSON.parse(JSON.stringify(r.defaultValue))},"defaultProcessor"),Ev=a((e,t,n,o)=>{let r=e._zod.def;rt(r.innerType,t,o);let i=t.seen.get(e);i.ref=r.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(r.defaultValue)))},"prefaultProcessor"),Sv=a((e,t,n,o)=>{let r=e._zod.def;rt(r.innerType,t,o);let i=t.seen.get(e);i.ref=r.innerType;let s;try{s=r.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=s},"catchProcessor"),xv=a((e,t,n,o)=>{let r=e._zod.def,i=t.io==="input"?r.in._zod.def.type==="transform"?r.out:r.in:r.out;rt(i,t,o);let s=t.seen.get(e);s.ref=i},"pipeProcessor"),Iv=a((e,t,n,o)=>{let r=e._zod.def;rt(r.innerType,t,o);let i=t.seen.get(e);i.ref=r.innerType,n.readOnly=!0},"readonlyProcessor"),Av=a((e,t,n,o)=>{let r=e._zod.def;rt(r.innerType,t,o);let i=t.seen.get(e);i.ref=r.innerType},"promiseProcessor"),xp=a((e,t,n,o)=>{let r=e._zod.def;rt(r.innerType,t,o);let i=t.seen.get(e);i.ref=r.innerType},"optionalProcessor"),Rv=a((e,t,n,o)=>{let r=e._zod.innerType;rt(r,t,o);let i=t.seen.get(e);i.ref=r},"lazyProcessor"),Ep={string:Zy,number:Wy,boolean:Ky,bigint:Jy,symbol:Xy,null:Yy,undefined:Qy,void:ev,never:tv,any:rv,unknown:nv,date:ov,enum:iv,literal:av,nan:sv,template_literal:cv,file:uv,success:lv,custom:dv,function:pv,transform:fv,map:mv,set:hv,array:gv,object:yv,union:Sp,intersection:vv,tuple:_v,record:Pv,nullable:wv,nonoptional:bv,default:Tv,prefault:Ev,catch:Sv,pipe:xv,readonly:Iv,promise:Av,optional:xp,lazy:Rv};function Gc(e,t){if("_idmap"in e){let o=e,r=_o({...t,processors:Ep}),i={};for(let h of o._idmap.entries()){let[g,y]=h;rt(y,r)}let s={},u={registry:o,uri:t?.uri,defs:i};r.external=u;for(let h of o._idmap.entries()){let[g,y]=h;Po(r,y),s[g]=wo(r,y)}if(Object.keys(i).length>0){let h=r.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[h]:i}}return{schemas:s}}let n=_o({...t,processors:Ep});return rt(e,n),Po(n,e),wo(n,e)}a(Gc,"toJSONSchema");var Ip=class{static{a(this,"JSONSchemaGenerator")}get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(t){this.ctx.counter=t}get seen(){return this.ctx.seen}constructor(t){let n=t?.target??"draft-2020-12";n==="draft-4"&&(n="draft-04"),n==="draft-7"&&(n="draft-07"),this.ctx=_o({processors:Ep,target:n,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,n={path:[],schemaPath:[]}){return rt(t,this.ctx,n)}emit(t,n){n&&(n.cycles&&(this.ctx.cycles=n.cycles),n.reused&&(this.ctx.reused=n.reused),n.external&&(this.ctx.external=n.external)),Po(this.ctx,t);let o=wo(this.ctx,t),{"~standard":r,...i}=o;return i}};var WS={};var xt=N("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");Re.init(e,t),e.def=t,e.type=t.type,e.parse=(n,o)=>Ko(e,n,o,{callee:e.parse}),e.safeParse=(n,o)=>ea(e,n,o),e.parseAsync=async(n,o)=>Jo(e,n,o,{callee:e.parseAsync}),e.safeParseAsync=async(n,o)=>ra(e,n,o),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]},{parent:!0}),e.with=e.check,e.clone=(n,o)=>Nt(e,n,o),e.brand=()=>e,e.register=((n,o)=>(n.add(e,o),e)),e.apply=n=>n(e)}),Ap=N("ZodMiniString",(e,t)=>{Mn.init(e,t),xt.init(e,t)});function x(e){return rc(Ap,e)}a(x,"string");var fa=N("ZodMiniStringFormat",(e,t)=>{tt.init(e,t),Ap.init(e,t)});var eq=N("ZodMiniURL",(e,t)=>{Os.init(e,t),fa.init(e,t)});function KS(e){return ei(eq,e)}a(KS,"url");var Rp=N("ZodMiniNumber",(e,t)=>{oa.init(e,t),xt.init(e,t)});function zt(e){return Ac(Rp,e)}a(zt,"number");var tq=N("ZodMiniNumberFormat",(e,t)=>{zs.init(e,t),Rp.init(e,t)});function JS(e){return Dc(tq,e)}a(JS,"int");var Dv=N("ZodMiniBoolean",(e,t)=>{Yo.init(e,t),xt.init(e,t)});function Je(e){return Oc(Dv,e)}a(Je,"boolean");var XS=N("ZodMiniBigInt",(e,t)=>{ia.init(e,t),xt.init(e,t)});var rq=N("ZodMiniAny",(e,t)=>{Us.init(e,t),xt.init(e,t)});function Hc(){return Nc(rq)}a(Hc,"any");var nq=N("ZodMiniUnknown",(e,t)=>{Ms.init(e,t),xt.init(e,t)});function $e(){return kc(nq)}a($e,"unknown");var oq=N("ZodMiniVoid",(e,t)=>{Fs.init(e,t),xt.init(e,t)});function YS(e){return zc(oq,e)}a(YS,"_void");var QS=N("ZodMiniDate",(e,t)=>{Ls.init(e,t),xt.init(e,t)});var iq=N("ZodMiniArray",(e,t)=>{js.init(e,t),xt.init(e,t)});function Ae(e,t){return new iq({type:"array",element:e,...ie(t)})}a(Ae,"array");var aq=N("ZodMiniObject",(e,t)=>{Ud.init(e,t),xt.init(e,t),Le(e,"shape",()=>t.shape)});function M(e,t){let n={type:"object",shape:e??{},...ie(t)};return new aq(n)}a(M,"object");var sq=N("ZodMiniUnion",(e,t)=>{Qo.init(e,t),xt.init(e,t)});function je(e,t){return new sq({type:"union",options:e,...ie(t)})}a(je,"union");var cq=N("ZodMiniDiscriminatedUnion",(e,t)=>{qs.init(e,t),xt.init(e,t)});function bo(e,t,n){return new cq({type:"union",options:t,discriminator:e,...ie(n)})}a(bo,"discriminatedUnion");var uq=N("ZodMiniRecord",(e,t)=>{Vs.init(e,t),xt.init(e,t)});function Ce(e,t,n){return new uq({type:"record",keyType:e,valueType:t,...ie(n)})}a(Ce,"record");var lq=N("ZodMiniEnum",(e,t)=>{Gs.init(e,t),xt.init(e,t),e.options=Object.values(t.entries)});function xe(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new lq({type:"enum",entries:n,...ie(t)})}a(xe,"_enum");var dq=N("ZodMiniLiteral",(e,t)=>{Hs.init(e,t),xt.init(e,t)});function Ee(e,t){return new dq({type:"literal",values:Array.isArray(e)?e:[e],...ie(t)})}a(Ee,"literal");var pq=N("ZodMiniTransform",(e,t)=>{Zs.init(e,t),xt.init(e,t)});function To(e){return new pq({type:"transform",transform:e})}a(To,"transform");var fq=N("ZodMiniOptional",(e,t)=>{aa.init(e,t),xt.init(e,t)});function W(e){return new fq({type:"optional",innerType:e})}a(W,"optional");var mq=N("ZodMiniNullable",(e,t)=>{Ws.init(e,t),xt.init(e,t)});function Zc(e){return new mq({type:"nullable",innerType:e})}a(Zc,"nullable");var hq=N("ZodMiniPipe",(e,t)=>{Ks.init(e,t),xt.init(e,t)});function Eo(e,t){return new hq({type:"pipe",in:e,out:t})}a(Eo,"pipe");var ex=N("ZodMiniCustom",(e,t)=>{Js.init(e,t),xt.init(e,t)});function Dp(e,t){return Bc(ex,e??(()=>!0),t)}a(Dp,"custom");function Ov(e,t={}){return Vc(ex,e,t)}a(Ov,"refine");var Op={};nr(Op,{ZodMiniISODate:()=>Cv,ZodMiniISODateTime:()=>$v,ZodMiniISODuration:()=>kv,ZodMiniISOTime:()=>Nv,date:()=>yq,datetime:()=>gq,duration:()=>_q,time:()=>vq});var $v=N("ZodMiniISODateTime",(e,t)=>{$s.init(e,t),fa.init(e,t)});function gq(e){return Ec($v,e)}a(gq,"datetime");var Cv=N("ZodMiniISODate",(e,t)=>{Cs.init(e,t),fa.init(e,t)});function yq(e){return Sc(Cv,e)}a(yq,"date");var Nv=N("ZodMiniISOTime",(e,t)=>{Ns.init(e,t),fa.init(e,t)});function vq(e){return xc(Nv,e)}a(vq,"time");var kv=N("ZodMiniISODuration",(e,t)=>{ks.init(e,t),fa.init(e,t)});function _q(e){return Ic(kv,e)}a(_q,"duration");var Wc={};nr(Wc,{bigint:()=>Tq,boolean:()=>bq,date:()=>Eq,number:()=>wq,string:()=>Pq});function Pq(e){return nc(Ap,e)}a(Pq,"string");function wq(e){return Rc(Rp,e)}a(wq,"number");function bq(e){return $c(Dv,e)}a(bq,"boolean");function Tq(e){return Cc(XS,e)}a(Tq,"bigint");function Eq(e){return Uc(QS,e)}a(Eq,"date");var Uv=M({retryOnFailure:M({defaultValue:W(Je()),hide:W(Je())}),continueOnFailure:M({defaultValue:W(Je()),hide:W(Je())})}),zv=class{constructor(t,n,o,r,i,s,u,h,g,y,T,b,P){this.name=t;this.displayName=n;this.description=o;this.props=r;this.propertyGroups=i;this.run=s;this.test=u;this.requireAuth=h;this.errorHandlingOptions=g;this.outputSchema=y;this.audience=T;this.aiMetadata=b;this.classification=P}static{a(this,"IAction")}},re=a(e=>new zv(e.name,e.displayName,e.description,e.props,e.propertyGroups,e.run,e.test??e.run,e.requireAuth??!0,e.errorHandlingOptions??{continueOnFailure:{defaultValue:!1},retryOnFailure:{defaultValue:!1}},e.outputSchema,e.audience,e.aiMetadata,e.classification),"createAction");var We=M({displayName:x(),description:W(x()),advanced:W(Je()),width:W(xe(["half","full"])),icon:W(x()),placeholder:W(x())}),ke=a((e,t)=>M({type:Ee(t),required:Je(),defaultValue:W(Hc())}),"TPropertyValue");var _r=M({...We.shape,...ke(x(),"SHORT_TEXT").shape}),jn=M({...We.shape,...ke(x(),"LONG_TEXT").shape});var rx=M({label:x(),value:$e(),description:W(x()),icon:W(x())}),$p=M({disabled:W(Je()),placeholder:W(x()),options:Ae(rx)});var xq=xe(["cards"]),Pr=M({...We.shape,options:$p,display:W(xq),...ke($e(),"STATIC_DROPDOWN").shape}),qn=M({...We.shape,options:$p,...ke(Ae($e()),"STATIC_MULTI_SELECT_DROPDOWN").shape});var Mv=M({...We.shape,...ke($e(),"DROPDOWN").shape,refreshers:Ae(x())}),Kc=M({...We.shape,...ke(Ae($e()),"MULTI_SELECT_DROPDOWN").shape,refreshers:Ae(x())});var Bn=M({...We.shape,reveals:W(Ae(x())),...ke(Je(),"CHECKBOX").shape});var Vn=M({...We.shape,display:W(xe(["stepper"])),min:W(zt()),max:W(zt()),step:W(zt()),...ke(zt(),"NUMBER").shape});var Jc=M({...We.shape,streaming:W(Je()),...ke($e(),"FILE").shape});var Xc=M({...We.shape,...ke(x(),"DATE_TIME").shape});var nx=Ce(x(),je([_r,jn,Pr,Kc,qn,Bn,Vn,Jc,Xc])),Yc=M({...We.shape,properties:nx,...ke(Ae($e()),"ARRAY").shape});var ox=xe(["any_time","last_24_hours","last_7_days","last_30_days","last_90_days","this_month","custom"]),ix=M({preset:W(ox),after:W(x()),before:W(x())}),Fv=M({...We.shape,display:W(xe(["dropdown"])),...ke(ix,"DATE_RANGE").shape});var Qc=M({...We.shape,...ke(je([Ce(x(),$e())]),"JSON").shape});var ax=je([_r,Pr,Qc,Yc,qn]),Iq=Ce(x(),ax),Lv=M({refreshers:Ae(x()),...We.shape,...ke($e(),"DYNAMIC").shape});var Cp=M({...We.shape,...ke(YS(),"MARKDOWN").shape});var eu=(n=>(n.ARCHIVE="ARCHIVE",n.REGISTRY="REGISTRY",n))(eu||{}),ma=(n=>(n.CUSTOM="CUSTOM",n.OFFICIAL="OFFICIAL",n))(ma||{}),ha=(l=>(l.ARTIFICIAL_INTELLIGENCE="ARTIFICIAL_INTELLIGENCE",l.COMMUNICATION="COMMUNICATION",l.COMMERCE="COMMERCE",l.CORE="CORE",l.UNIVERSAL_AI="UNIVERSAL_AI",l.FLOW_CONTROL="FLOW_CONTROL",l.BUSINESS_INTELLIGENCE="BUSINESS_INTELLIGENCE",l.ACCOUNTING="ACCOUNTING",l.PRODUCTIVITY="PRODUCTIVITY",l.CONTENT_AND_FILES="CONTENT_AND_FILES",l.DEVELOPER_TOOLS="DEVELOPER_TOOLS",l.CUSTOMER_SUPPORT="CUSTOMER_SUPPORT",l.FORMS_AND_SURVEYS="FORMS_AND_SURVEYS",l.HUMAN_RESOURCES="HUMAN_RESOURCES",l.PAYMENT_PROCESSING="PAYMENT_PROCESSING",l.MARKETING="MARKETING",l.SALES_AND_CRM="SALES_AND_CRM",l))(ha||{});var tu=(n=>(n.AUTHORIZATION_CODE="authorization_code",n.CLIENT_CREDENTIALS="client_credentials",n))(tu||{}),jv="both_client_credentials_and_authorization_code";var pn=(r=>(r.POLLING="POLLING",r.WEBHOOK="WEBHOOK",r.APP_WEBHOOK="APP_WEBHOOK",r.MANUAL="MANUAL",r))(pn||{}),ru=(i=>(i.NONE="NONE",i.HEADER_PRESENT="HEADER_PRESENT",i.QUERY_PRESENT="QUERY_PRESENT",i.BODY_PARAM_PRESENT="BODY_PARAM_PRESENT",i.HEAD_REQUEST="HEAD_REQUEST",i))(ru||{}),Aq=M({strategy:xe(ru),paramName:W(x())}),nu=(n=>(n.SIMULATION="SIMULATION",n.TEST_FUNCTION="TEST_FUNCTION",n))(nu||{});var Np=(n=>(n.WEBSOCKET="WEBSOCKET",n.NONE="NONE",n))(Np||{}),sx=M({status:W(zt()),body:W($e()),headers:W(Ce(x(),x()))}),cx=M({type:Ee("DELAY"),resumeDateTime:x(),requestIdToReply:W(x()),handlerId:W(x()),streamStepProgress:W(xe(Np))}),ux=M({type:Ee("WEBHOOK"),requestId:x(),requestIdToReply:W(x()),response:sx,handlerId:W(x()),streamStepProgress:W(xe(Np))}),Rq=je([cx,ux]);var Dq=M({body:$e(),rawBody:W($e()),headers:Ce(x(),x()),queryParams:Ce(x(),x())});function yt(e){return e==null}a(yt,"isNil");function ou(e){return e==null?!0:typeof e=="string"||Array.isArray(e)?e.length===0:typeof e=="object"?Object.keys(e).length===0:!1}a(ou,"isEmpty");function qv(e,t){let n=[];for(let o=0;o<e.length;o+=t)n.push(e.slice(o,o+t));return n}a(qv,"chunk");function kp(e,t){if(e==null)throw new Error(`${t} is null or undefined`)}a(kp,"assertNotNullOrUndefined");async function Vv(e){try{return{data:await e(),error:null}}catch(t){return{data:null,error:t}}}a(Vv,"tryCatch");function Gv(e){try{return{data:e(),error:null}}catch(t){return{data:null,error:t}}}a(Gv,"tryCatchSync");var Hv=he(require("crypto"),1);var Oq=128,So,ga,$q=a(e=>{if(e<0)throw new RangeError("Wrong ID size");try{!So||So.length<e?(So=Buffer.allocUnsafe(e*Oq),Hv.default.randomFillSync(So),ga=0):ga+e>So.length&&(Hv.default.randomFillSync(So),ga=0)}catch(t){throw So=void 0,t}ga+=e},"fillPool"),Cq=a(e=>($q(e|=0),So.subarray(ga-e,ga)),"random"),Nq=a((e,t,n)=>{let o=(2<<31-Math.clz32(e.length-1|1))-1,r=Math.ceil(1.6*o*t/e.length);return(i=t)=>{if(i<=0)return"";let s="";for(;;){let u=n(r),h=r;for(;h--;)if(s+=e[u[h]&o]||"",s.length===i)return s}}},"customRandom"),lx=a((e,t=21)=>Nq(e,t,Cq),"customAlphabet");var kq="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",dx=21,n7=x().check(jt(new RegExp(`^[0-9a-zA-Z]{${dx}}$`))),zq=lx(kq,dx);var xo=Eo(To(e=>e instanceof Date?e.toISOString():e),x()),Ur={id:x(),created:xo,updated:xo},vt=a(e=>W(Zc(e)),"Nullable");function Zv(e){return W(Zc(xe(e)))}a(Zv,"NullableEnum");var a7=Eo(To(e=>e==="true"||e===!0?!0:e==="false"||e===!1?!1:void 0),W(Je())),s7=W(Op.datetime({offset:!0}).check(Ov(e=>e.slice(0,4)!=="0000"))),zp=a(e=>Eo(To(t=>Array.isArray(t)?t:t!==void 0?[t]:void 0),W(Ae(e))),"OptionalArrayFromQuery");var l7=Ce(x(),$e());var Io=(l=>(l.OPENAI="openai",l.OPENROUTER="openrouter",l.ANTHROPIC="anthropic",l.AZURE="azure",l.GOOGLE="google",l.ACTIVEPIECES="activepieces",l.CLOUDFLARE_GATEWAY="cloudflare-gateway",l.CUSTOM="custom",l.BEDROCK="bedrock",l.VERTEX="vertex",l.MISTRAL="mistral",l.XAI="xai",l.DEEPSEEK="deepseek",l.ZAI="zai",l.QWEN="qwen",l.MINIMAX="minimax",l.MOONSHOT="moonshot",l))(Io||{});var fe={};nr(fe,{$brand:()=>Ps,$input:()=>np,$output:()=>rp,NEVER:()=>Bl,TimePrecision:()=>ip,ZodAny:()=>y_,ZodArray:()=>w_,ZodBase64:()=>nf,ZodBase64URL:()=>of,ZodBigInt:()=>Ta,ZodBigIntFormat:()=>cf,ZodBoolean:()=>ba,ZodCIDRv4:()=>tf,ZodCIDRv6:()=>rf,ZodCUID:()=>Wp,ZodCUID2:()=>Kp,ZodCatch:()=>B_,ZodCodec:()=>gf,ZodCustom:()=>gu,ZodCustomStringFormat:()=>Pa,ZodDate:()=>du,ZodDefault:()=>U_,ZodDiscriminatedUnion:()=>T_,ZodE164:()=>af,ZodEmail:()=>Gp,ZodEmoji:()=>Hp,ZodEnum:()=>va,ZodError:()=>Uq,ZodExactOptional:()=>N_,ZodFile:()=>$_,ZodFirstPartyTypeKind:()=>tP,ZodFunction:()=>Y_,ZodGUID:()=>au,ZodIPv4:()=>Qp,ZodIPv6:()=>ef,ZodISODate:()=>Fp,ZodISODateTime:()=>Mp,ZodISODuration:()=>jp,ZodISOTime:()=>Lp,ZodIntersection:()=>E_,ZodIssueCode:()=>Fq,ZodJWT:()=>sf,ZodKSUID:()=>Yp,ZodLazy:()=>K_,ZodLiteral:()=>O_,ZodMAC:()=>l_,ZodMap:()=>R_,ZodNaN:()=>G_,ZodNanoID:()=>Zp,ZodNever:()=>__,ZodNonOptional:()=>mf,ZodNull:()=>h_,ZodNullable:()=>z_,ZodNumber:()=>wa,ZodNumberFormat:()=>fi,ZodObject:()=>fu,ZodOptional:()=>ff,ZodPipe:()=>hf,ZodPrefault:()=>F_,ZodPromise:()=>X_,ZodReadonly:()=>H_,ZodRealError:()=>sr,ZodRecord:()=>hu,ZodSet:()=>D_,ZodString:()=>_a,ZodStringFormat:()=>st,ZodSuccess:()=>q_,ZodSymbol:()=>f_,ZodTemplateLiteral:()=>W_,ZodTransform:()=>C_,ZodTuple:()=>x_,ZodType:()=>qe,ZodULID:()=>Jp,ZodURL:()=>lu,ZodUUID:()=>fn,ZodUndefined:()=>m_,ZodUnion:()=>mu,ZodUnknown:()=>v_,ZodVoid:()=>P_,ZodXID:()=>Xp,ZodXor:()=>b_,_ZodString:()=>Vp,_default:()=>M_,_function:()=>vI,any:()=>Jx,array:()=>pu,base64:()=>Cx,base64url:()=>Nx,bigint:()=>Gx,boolean:()=>p_,catch:()=>V_,check:()=>_I,cidrv4:()=>Ox,cidrv6:()=>$x,clone:()=>Nt,codec:()=>hI,coerce:()=>rP,config:()=>gt,core:()=>vr,cuid:()=>Tx,cuid2:()=>Ex,custom:()=>PI,date:()=>Yx,decode:()=>n_,decodeAsync:()=>i_,describe:()=>wI,discriminatedUnion:()=>oI,e164:()=>kx,email:()=>fx,emoji:()=>wx,encode:()=>r_,encodeAsync:()=>o_,endsWith:()=>ii,enum:()=>df,exactOptional:()=>k_,file:()=>dI,flattenError:()=>Ki,float32:()=>jx,float64:()=>qx,formatError:()=>Ji,fromJSONSchema:()=>AI,function:()=>vI,getErrorMap:()=>jq,globalRegistry:()=>kt,gt:()=>Xr,gte:()=>Dt,guid:()=>mx,hash:()=>Lx,hex:()=>Fx,hostname:()=>Mx,httpUrl:()=>Px,includes:()=>ni,instanceof:()=>TI,int:()=>Bp,int32:()=>Bx,int64:()=>Hx,intersection:()=>S_,ipv4:()=>Ax,ipv6:()=>Dx,iso:()=>ya,json:()=>SI,jwt:()=>zx,keyof:()=>Qx,ksuid:()=>Ix,lazy:()=>J_,length:()=>vo,literal:()=>lI,locales:()=>ua,looseObject:()=>rI,looseRecord:()=>aI,lowercase:()=>ti,lt:()=>Jr,lte:()=>Kt,mac:()=>Rx,map:()=>sI,maxLength:()=>yo,maxSize:()=>Ln,meta:()=>bI,mime:()=>ai,minLength:()=>Et,minSize:()=>Yr,multipleOf:()=>Fn,nan:()=>mI,nanoid:()=>bx,nativeEnum:()=>uI,negative:()=>Fc,never:()=>uf,nonnegative:()=>jc,nonoptional:()=>j_,nonpositive:()=>Lc,normalize:()=>si,null:()=>g_,nullable:()=>cu,nullish:()=>pI,number:()=>d_,object:()=>eI,optional:()=>su,overwrite:()=>zr,parse:()=>Yv,parseAsync:()=>Qv,partialRecord:()=>iI,pipe:()=>uu,positive:()=>Mc,prefault:()=>L_,preprocess:()=>xI,prettifyError:()=>Wl,promise:()=>yI,property:()=>qc,readonly:()=>Z_,record:()=>A_,refine:()=>Q_,regex:()=>jt,regexes:()=>ar,registry:()=>tc,safeDecode:()=>s_,safeDecodeAsync:()=>u_,safeEncode:()=>a_,safeEncodeAsync:()=>c_,safeParse:()=>e_,safeParseAsync:()=>t_,set:()=>cI,setErrorMap:()=>Lq,size:()=>go,slugify:()=>da,startsWith:()=>oi,strictObject:()=>tI,string:()=>qp,stringFormat:()=>Ux,stringbool:()=>EI,success:()=>fI,superRefine:()=>eP,symbol:()=>Wx,templateLiteral:()=>gI,toJSONSchema:()=>Gc,toLowerCase:()=>ui,toUpperCase:()=>li,transform:()=>pf,treeifyError:()=>Zl,trim:()=>ci,tuple:()=>I_,uint32:()=>Vx,uint64:()=>Zx,ulid:()=>Sx,undefined:()=>Kx,union:()=>lf,unknown:()=>pi,uppercase:()=>ri,url:()=>_x,util:()=>ce,uuid:()=>hx,uuidv4:()=>gx,uuidv6:()=>yx,uuidv7:()=>vx,void:()=>Xx,xid:()=>xx,xor:()=>nI});var iu={};nr(iu,{ZodAny:()=>y_,ZodArray:()=>w_,ZodBase64:()=>nf,ZodBase64URL:()=>of,ZodBigInt:()=>Ta,ZodBigIntFormat:()=>cf,ZodBoolean:()=>ba,ZodCIDRv4:()=>tf,ZodCIDRv6:()=>rf,ZodCUID:()=>Wp,ZodCUID2:()=>Kp,ZodCatch:()=>B_,ZodCodec:()=>gf,ZodCustom:()=>gu,ZodCustomStringFormat:()=>Pa,ZodDate:()=>du,ZodDefault:()=>U_,ZodDiscriminatedUnion:()=>T_,ZodE164:()=>af,ZodEmail:()=>Gp,ZodEmoji:()=>Hp,ZodEnum:()=>va,ZodExactOptional:()=>N_,ZodFile:()=>$_,ZodFunction:()=>Y_,ZodGUID:()=>au,ZodIPv4:()=>Qp,ZodIPv6:()=>ef,ZodIntersection:()=>E_,ZodJWT:()=>sf,ZodKSUID:()=>Yp,ZodLazy:()=>K_,ZodLiteral:()=>O_,ZodMAC:()=>l_,ZodMap:()=>R_,ZodNaN:()=>G_,ZodNanoID:()=>Zp,ZodNever:()=>__,ZodNonOptional:()=>mf,ZodNull:()=>h_,ZodNullable:()=>z_,ZodNumber:()=>wa,ZodNumberFormat:()=>fi,ZodObject:()=>fu,ZodOptional:()=>ff,ZodPipe:()=>hf,ZodPrefault:()=>F_,ZodPromise:()=>X_,ZodReadonly:()=>H_,ZodRecord:()=>hu,ZodSet:()=>D_,ZodString:()=>_a,ZodStringFormat:()=>st,ZodSuccess:()=>q_,ZodSymbol:()=>f_,ZodTemplateLiteral:()=>W_,ZodTransform:()=>C_,ZodTuple:()=>x_,ZodType:()=>qe,ZodULID:()=>Jp,ZodURL:()=>lu,ZodUUID:()=>fn,ZodUndefined:()=>m_,ZodUnion:()=>mu,ZodUnknown:()=>v_,ZodVoid:()=>P_,ZodXID:()=>Xp,ZodXor:()=>b_,_ZodString:()=>Vp,_default:()=>M_,_function:()=>vI,any:()=>Jx,array:()=>pu,base64:()=>Cx,base64url:()=>Nx,bigint:()=>Gx,boolean:()=>p_,catch:()=>V_,check:()=>_I,cidrv4:()=>Ox,cidrv6:()=>$x,codec:()=>hI,cuid:()=>Tx,cuid2:()=>Ex,custom:()=>PI,date:()=>Yx,describe:()=>wI,discriminatedUnion:()=>oI,e164:()=>kx,email:()=>fx,emoji:()=>wx,enum:()=>df,exactOptional:()=>k_,file:()=>dI,float32:()=>jx,float64:()=>qx,function:()=>vI,guid:()=>mx,hash:()=>Lx,hex:()=>Fx,hostname:()=>Mx,httpUrl:()=>Px,instanceof:()=>TI,int:()=>Bp,int32:()=>Bx,int64:()=>Hx,intersection:()=>S_,ipv4:()=>Ax,ipv6:()=>Dx,json:()=>SI,jwt:()=>zx,keyof:()=>Qx,ksuid:()=>Ix,lazy:()=>J_,literal:()=>lI,looseObject:()=>rI,looseRecord:()=>aI,mac:()=>Rx,map:()=>sI,meta:()=>bI,nan:()=>mI,nanoid:()=>bx,nativeEnum:()=>uI,never:()=>uf,nonoptional:()=>j_,null:()=>g_,nullable:()=>cu,nullish:()=>pI,number:()=>d_,object:()=>eI,optional:()=>su,partialRecord:()=>iI,pipe:()=>uu,prefault:()=>L_,preprocess:()=>xI,promise:()=>yI,readonly:()=>Z_,record:()=>A_,refine:()=>Q_,set:()=>cI,strictObject:()=>tI,string:()=>qp,stringFormat:()=>Ux,stringbool:()=>EI,success:()=>fI,superRefine:()=>eP,symbol:()=>Wx,templateLiteral:()=>gI,transform:()=>pf,tuple:()=>I_,uint32:()=>Vx,uint64:()=>Zx,ulid:()=>Sx,undefined:()=>Kx,union:()=>lf,unknown:()=>pi,url:()=>_x,uuid:()=>hx,uuidv4:()=>gx,uuidv6:()=>yx,uuidv7:()=>vx,void:()=>Xx,xid:()=>xx,xor:()=>nI});var Up={};nr(Up,{endsWith:()=>ii,gt:()=>Xr,gte:()=>Dt,includes:()=>ni,length:()=>vo,lowercase:()=>ti,lt:()=>Jr,lte:()=>Kt,maxLength:()=>yo,maxSize:()=>Ln,mime:()=>ai,minLength:()=>Et,minSize:()=>Yr,multipleOf:()=>Fn,negative:()=>Fc,nonnegative:()=>jc,nonpositive:()=>Lc,normalize:()=>si,overwrite:()=>zr,positive:()=>Mc,property:()=>qc,regex:()=>jt,size:()=>go,slugify:()=>da,startsWith:()=>oi,toLowerCase:()=>ui,toUpperCase:()=>li,trim:()=>ci,uppercase:()=>ri});var ya={};nr(ya,{ZodISODate:()=>Fp,ZodISODateTime:()=>Mp,ZodISODuration:()=>jp,ZodISOTime:()=>Lp,date:()=>Kv,datetime:()=>Wv,duration:()=>Xv,time:()=>Jv});var Mp=N("ZodISODateTime",(e,t)=>{$s.init(e,t),st.init(e,t)});function Wv(e){return Ec(Mp,e)}a(Wv,"datetime");var Fp=N("ZodISODate",(e,t)=>{Cs.init(e,t),st.init(e,t)});function Kv(e){return Sc(Fp,e)}a(Kv,"date");var Lp=N("ZodISOTime",(e,t)=>{Ns.init(e,t),st.init(e,t)});function Jv(e){return xc(Lp,e)}a(Jv,"time");var jp=N("ZodISODuration",(e,t)=>{ks.init(e,t),st.init(e,t)});function Xv(e){return Ic(jp,e)}a(Xv,"duration");var px=a((e,t)=>{Is.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:a(n=>Ji(e,n),"value")},flatten:{value:a(n=>Ki(e,n),"value")},addIssue:{value:a(n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,Hi,2)},"value")},addIssues:{value:a(n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,Hi,2)},"value")},isEmpty:{get(){return e.issues.length===0}}})},"initializer"),Uq=N("ZodError",px),sr=N("ZodError",px,{Parent:Error});var Yv=Xi(sr),Qv=Yi(sr),e_=Qi(sr),t_=ta(sr),r_=Kl(sr),n_=Jl(sr),o_=Xl(sr),i_=Yl(sr),a_=Ql(sr),s_=ed(sr),c_=td(sr),u_=rd(sr);var qe=N("ZodType",(e,t)=>(Re.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:pa(e,"input"),output:pa(e,"output")}}),e.toJSONSchema=Hy(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(ce.mergeDefs(t,{checks:[...t.checks??[],...n.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0}),e.with=e.check,e.clone=(n,o)=>Nt(e,n,o),e.brand=()=>e,e.register=((n,o)=>(n.add(e,o),e)),e.parse=(n,o)=>Yv(e,n,o,{callee:e.parse}),e.safeParse=(n,o)=>e_(e,n,o),e.parseAsync=async(n,o)=>Qv(e,n,o,{callee:e.parseAsync}),e.safeParseAsync=async(n,o)=>t_(e,n,o),e.spa=e.safeParseAsync,e.encode=(n,o)=>r_(e,n,o),e.decode=(n,o)=>n_(e,n,o),e.encodeAsync=async(n,o)=>o_(e,n,o),e.decodeAsync=async(n,o)=>i_(e,n,o),e.safeEncode=(n,o)=>a_(e,n,o),e.safeDecode=(n,o)=>s_(e,n,o),e.safeEncodeAsync=async(n,o)=>c_(e,n,o),e.safeDecodeAsync=async(n,o)=>u_(e,n,o),e.refine=(n,o)=>e.check(Q_(n,o)),e.superRefine=n=>e.check(eP(n)),e.overwrite=n=>e.check(zr(n)),e.optional=()=>su(e),e.exactOptional=()=>k_(e),e.nullable=()=>cu(e),e.nullish=()=>su(cu(e)),e.nonoptional=n=>j_(e,n),e.array=()=>pu(e),e.or=n=>lf([e,n]),e.and=n=>S_(e,n),e.transform=n=>uu(e,pf(n)),e.default=n=>M_(e,n),e.prefault=n=>L_(e,n),e.catch=n=>V_(e,n),e.pipe=n=>uu(e,n),e.readonly=()=>Z_(e),e.describe=n=>{let o=e.clone();return kt.add(o,{description:n}),o},Object.defineProperty(e,"description",{get(){return kt.get(e)?.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return kt.get(e);let o=e.clone();return kt.add(o,n[0]),o},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),Vp=N("_ZodString",(e,t)=>{Mn.init(e,t),qe.init(e,t),e._zod.processJSONSchema=(o,r,i)=>Zy(e,o,r,i);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...o)=>e.check(jt(...o)),e.includes=(...o)=>e.check(ni(...o)),e.startsWith=(...o)=>e.check(oi(...o)),e.endsWith=(...o)=>e.check(ii(...o)),e.min=(...o)=>e.check(Et(...o)),e.max=(...o)=>e.check(yo(...o)),e.length=(...o)=>e.check(vo(...o)),e.nonempty=(...o)=>e.check(Et(1,...o)),e.lowercase=o=>e.check(ti(o)),e.uppercase=o=>e.check(ri(o)),e.trim=()=>e.check(ci()),e.normalize=(...o)=>e.check(si(...o)),e.toLowerCase=()=>e.check(ui()),e.toUpperCase=()=>e.check(li()),e.slugify=()=>e.check(da())}),_a=N("ZodString",(e,t)=>{Mn.init(e,t),Vp.init(e,t),e.email=n=>e.check(oc(Gp,n)),e.url=n=>e.check(ei(lu,n)),e.jwt=n=>e.check(Tc(sf,n)),e.emoji=n=>e.check(uc(Hp,n)),e.guid=n=>e.check(la(au,n)),e.uuid=n=>e.check(ic(fn,n)),e.uuidv4=n=>e.check(ac(fn,n)),e.uuidv6=n=>e.check(sc(fn,n)),e.uuidv7=n=>e.check(cc(fn,n)),e.nanoid=n=>e.check(lc(Zp,n)),e.guid=n=>e.check(la(au,n)),e.cuid=n=>e.check(dc(Wp,n)),e.cuid2=n=>e.check(pc(Kp,n)),e.ulid=n=>e.check(fc(Jp,n)),e.base64=n=>e.check(Pc(nf,n)),e.base64url=n=>e.check(wc(of,n)),e.xid=n=>e.check(mc(Xp,n)),e.ksuid=n=>e.check(hc(Yp,n)),e.ipv4=n=>e.check(gc(Qp,n)),e.ipv6=n=>e.check(yc(ef,n)),e.cidrv4=n=>e.check(vc(tf,n)),e.cidrv6=n=>e.check(_c(rf,n)),e.e164=n=>e.check(bc(af,n)),e.datetime=n=>e.check(Wv(n)),e.date=n=>e.check(Kv(n)),e.time=n=>e.check(Jv(n)),e.duration=n=>e.check(Xv(n))});function qp(e){return rc(_a,e)}a(qp,"string");var st=N("ZodStringFormat",(e,t)=>{tt.init(e,t),Vp.init(e,t)}),Gp=N("ZodEmail",(e,t)=>{md.init(e,t),st.init(e,t)});function fx(e){return oc(Gp,e)}a(fx,"email");var au=N("ZodGUID",(e,t)=>{pd.init(e,t),st.init(e,t)});function mx(e){return la(au,e)}a(mx,"guid");var fn=N("ZodUUID",(e,t)=>{fd.init(e,t),st.init(e,t)});function hx(e){return ic(fn,e)}a(hx,"uuid");function gx(e){return ac(fn,e)}a(gx,"uuidv4");function yx(e){return sc(fn,e)}a(yx,"uuidv6");function vx(e){return cc(fn,e)}a(vx,"uuidv7");var lu=N("ZodURL",(e,t)=>{Os.init(e,t),st.init(e,t)});function _x(e){return ei(lu,e)}a(_x,"url");function Px(e){return ei(lu,{protocol:/^https?$/,hostname:ar.domain,...ce.normalizeParams(e)})}a(Px,"httpUrl");var Hp=N("ZodEmoji",(e,t)=>{hd.init(e,t),st.init(e,t)});function wx(e){return uc(Hp,e)}a(wx,"emoji");var Zp=N("ZodNanoID",(e,t)=>{gd.init(e,t),st.init(e,t)});function bx(e){return lc(Zp,e)}a(bx,"nanoid");var Wp=N("ZodCUID",(e,t)=>{yd.init(e,t),st.init(e,t)});function Tx(e){return dc(Wp,e)}a(Tx,"cuid");var Kp=N("ZodCUID2",(e,t)=>{vd.init(e,t),st.init(e,t)});function Ex(e){return pc(Kp,e)}a(Ex,"cuid2");var Jp=N("ZodULID",(e,t)=>{_d.init(e,t),st.init(e,t)});function Sx(e){return fc(Jp,e)}a(Sx,"ulid");var Xp=N("ZodXID",(e,t)=>{Pd.init(e,t),st.init(e,t)});function xx(e){return mc(Xp,e)}a(xx,"xid");var Yp=N("ZodKSUID",(e,t)=>{wd.init(e,t),st.init(e,t)});function Ix(e){return hc(Yp,e)}a(Ix,"ksuid");var Qp=N("ZodIPv4",(e,t)=>{bd.init(e,t),st.init(e,t)});function Ax(e){return gc(Qp,e)}a(Ax,"ipv4");var l_=N("ZodMAC",(e,t)=>{Ed.init(e,t),st.init(e,t)});function Rx(e){return op(l_,e)}a(Rx,"mac");var ef=N("ZodIPv6",(e,t)=>{Td.init(e,t),st.init(e,t)});function Dx(e){return yc(ef,e)}a(Dx,"ipv6");var tf=N("ZodCIDRv4",(e,t)=>{Sd.init(e,t),st.init(e,t)});function Ox(e){return vc(tf,e)}a(Ox,"cidrv4");var rf=N("ZodCIDRv6",(e,t)=>{xd.init(e,t),st.init(e,t)});function $x(e){return _c(rf,e)}a($x,"cidrv6");var nf=N("ZodBase64",(e,t)=>{Id.init(e,t),st.init(e,t)});function Cx(e){return Pc(nf,e)}a(Cx,"base64");var of=N("ZodBase64URL",(e,t)=>{Ad.init(e,t),st.init(e,t)});function Nx(e){return wc(of,e)}a(Nx,"base64url");var af=N("ZodE164",(e,t)=>{Rd.init(e,t),st.init(e,t)});function kx(e){return bc(af,e)}a(kx,"e164");var sf=N("ZodJWT",(e,t)=>{Dd.init(e,t),st.init(e,t)});function zx(e){return Tc(sf,e)}a(zx,"jwt");var Pa=N("ZodCustomStringFormat",(e,t)=>{Od.init(e,t),st.init(e,t)});function Ux(e,t,n={}){return di(Pa,e,t,n)}a(Ux,"stringFormat");function Mx(e){return di(Pa,"hostname",ar.hostname,e)}a(Mx,"hostname");function Fx(e){return di(Pa,"hex",ar.hex,e)}a(Fx,"hex");function Lx(e,t){let n=t?.enc??"hex",o=`${e}_${n}`,r=ar[o];if(!r)throw new Error(`Unrecognized hash format: ${o}`);return di(Pa,o,r,t)}a(Lx,"hash");var wa=N("ZodNumber",(e,t)=>{oa.init(e,t),qe.init(e,t),e._zod.processJSONSchema=(o,r,i)=>Wy(e,o,r,i),e.gt=(o,r)=>e.check(Xr(o,r)),e.gte=(o,r)=>e.check(Dt(o,r)),e.min=(o,r)=>e.check(Dt(o,r)),e.lt=(o,r)=>e.check(Jr(o,r)),e.lte=(o,r)=>e.check(Kt(o,r)),e.max=(o,r)=>e.check(Kt(o,r)),e.int=o=>e.check(Bp(o)),e.safe=o=>e.check(Bp(o)),e.positive=o=>e.check(Xr(0,o)),e.nonnegative=o=>e.check(Dt(0,o)),e.negative=o=>e.check(Jr(0,o)),e.nonpositive=o=>e.check(Kt(0,o)),e.multipleOf=(o,r)=>e.check(Fn(o,r)),e.step=(o,r)=>e.check(Fn(o,r)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function d_(e){return Ac(wa,e)}a(d_,"number");var fi=N("ZodNumberFormat",(e,t)=>{zs.init(e,t),wa.init(e,t)});function Bp(e){return Dc(fi,e)}a(Bp,"int");function jx(e){return ap(fi,e)}a(jx,"float32");function qx(e){return sp(fi,e)}a(qx,"float64");function Bx(e){return cp(fi,e)}a(Bx,"int32");function Vx(e){return up(fi,e)}a(Vx,"uint32");var ba=N("ZodBoolean",(e,t)=>{Yo.init(e,t),qe.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Ky(e,n,o,r)});function p_(e){return Oc(ba,e)}a(p_,"boolean");var Ta=N("ZodBigInt",(e,t)=>{ia.init(e,t),qe.init(e,t),e._zod.processJSONSchema=(o,r,i)=>Jy(e,o,r,i),e.gte=(o,r)=>e.check(Dt(o,r)),e.min=(o,r)=>e.check(Dt(o,r)),e.gt=(o,r)=>e.check(Xr(o,r)),e.gte=(o,r)=>e.check(Dt(o,r)),e.min=(o,r)=>e.check(Dt(o,r)),e.lt=(o,r)=>e.check(Jr(o,r)),e.lte=(o,r)=>e.check(Kt(o,r)),e.max=(o,r)=>e.check(Kt(o,r)),e.positive=o=>e.check(Xr(BigInt(0),o)),e.negative=o=>e.check(Jr(BigInt(0),o)),e.nonpositive=o=>e.check(Kt(BigInt(0),o)),e.nonnegative=o=>e.check(Dt(BigInt(0),o)),e.multipleOf=(o,r)=>e.check(Fn(o,r));let n=e._zod.bag;e.minValue=n.minimum??null,e.maxValue=n.maximum??null,e.format=n.format??null});function Gx(e){return lp(Ta,e)}a(Gx,"bigint");var cf=N("ZodBigIntFormat",(e,t)=>{$d.init(e,t),Ta.init(e,t)});function Hx(e){return dp(cf,e)}a(Hx,"int64");function Zx(e){return pp(cf,e)}a(Zx,"uint64");var f_=N("ZodSymbol",(e,t)=>{Cd.init(e,t),qe.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Xy(e,n,o,r)});function Wx(e){return fp(f_,e)}a(Wx,"symbol");var m_=N("ZodUndefined",(e,t)=>{Nd.init(e,t),qe.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Qy(e,n,o,r)});function Kx(e){return mp(m_,e)}a(Kx,"_undefined");var h_=N("ZodNull",(e,t)=>{kd.init(e,t),qe.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Yy(e,n,o,r)});function g_(e){return hp(h_,e)}a(g_,"_null");var y_=N("ZodAny",(e,t)=>{Us.init(e,t),qe.init(e,t),e._zod.processJSONSchema=(n,o,r)=>rv(e,n,o,r)});function Jx(){return Nc(y_)}a(Jx,"any");var v_=N("ZodUnknown",(e,t)=>{Ms.init(e,t),qe.init(e,t),e._zod.processJSONSchema=(n,o,r)=>nv(e,n,o,r)});function pi(){return kc(v_)}a(pi,"unknown");var __=N("ZodNever",(e,t)=>{zd.init(e,t),qe.init(e,t),e._zod.processJSONSchema=(n,o,r)=>tv(e,n,o,r)});function uf(e){return gp(__,e)}a(uf,"never");var P_=N("ZodVoid",(e,t)=>{Fs.init(e,t),qe.init(e,t),e._zod.processJSONSchema=(n,o,r)=>ev(e,n,o,r)});function Xx(e){return zc(P_,e)}a(Xx,"_void");var du=N("ZodDate",(e,t)=>{Ls.init(e,t),qe.init(e,t),e._zod.processJSONSchema=(o,r,i)=>ov(e,o,r,i),e.min=(o,r)=>e.check(Dt(o,r)),e.max=(o,r)=>e.check(Kt(o,r));let n=e._zod.bag;e.minDate=n.minimum?new Date(n.minimum):null,e.maxDate=n.maximum?new Date(n.maximum):null});function Yx(e){return yp(du,e)}a(Yx,"date");var w_=N("ZodArray",(e,t)=>{js.init(e,t),qe.init(e,t),e._zod.processJSONSchema=(n,o,r)=>gv(e,n,o,r),e.element=t.element,e.min=(n,o)=>e.check(Et(n,o)),e.nonempty=n=>e.check(Et(1,n)),e.max=(n,o)=>e.check(yo(n,o)),e.length=(n,o)=>e.check(vo(n,o)),e.unwrap=()=>e.element});function pu(e,t){return Gy(w_,e,t)}a(pu,"array");function Qx(e){let t=e._zod.def.shape;return df(Object.keys(t))}a(Qx,"keyof");var fu=N("ZodObject",(e,t)=>{Yg.init(e,t),qe.init(e,t),e._zod.processJSONSchema=(n,o,r)=>yv(e,n,o,r),ce.defineLazy(e,"shape",()=>t.shape),e.keyof=()=>df(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:pi()}),e.loose=()=>e.clone({...e._zod.def,catchall:pi()}),e.strict=()=>e.clone({...e._zod.def,catchall:uf()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>ce.extend(e,n),e.safeExtend=n=>ce.safeExtend(e,n),e.merge=n=>ce.merge(e,n),e.pick=n=>ce.pick(e,n),e.omit=n=>ce.omit(e,n),e.partial=(...n)=>ce.partial(ff,e,n[0]),e.required=(...n)=>ce.required(mf,e,n[0])});function eI(e,t){let n={type:"object",shape:e??{},...ce.normalizeParams(t)};return new fu(n)}a(eI,"object");function tI(e,t){return new fu({type:"object",shape:e,catchall:uf(),...ce.normalizeParams(t)})}a(tI,"strictObject");function rI(e,t){return new fu({type:"object",shape:e,catchall:pi(),...ce.normalizeParams(t)})}a(rI,"looseObject");var mu=N("ZodUnion",(e,t)=>{Qo.init(e,t),qe.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Sp(e,n,o,r),e.options=t.options});function lf(e,t){return new mu({type:"union",options:e,...ce.normalizeParams(t)})}a(lf,"union");var b_=N("ZodXor",(e,t)=>{mu.init(e,t),Md.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Sp(e,n,o,r),e.options=t.options});function nI(e,t){return new b_({type:"union",options:e,inclusive:!1,...ce.normalizeParams(t)})}a(nI,"xor");var T_=N("ZodDiscriminatedUnion",(e,t)=>{mu.init(e,t),qs.init(e,t)});function oI(e,t,n){return new T_({type:"union",options:t,discriminator:e,...ce.normalizeParams(n)})}a(oI,"discriminatedUnion");var E_=N("ZodIntersection",(e,t)=>{Fd.init(e,t),qe.init(e,t),e._zod.processJSONSchema=(n,o,r)=>vv(e,n,o,r)});function S_(e,t){return new E_({type:"intersection",left:e,right:t})}a(S_,"intersection");var x_=N("ZodTuple",(e,t)=>{Bs.init(e,t),qe.init(e,t),e._zod.processJSONSchema=(n,o,r)=>_v(e,n,o,r),e.rest=n=>e.clone({...e._zod.def,rest:n})});function I_(e,t,n){let o=t instanceof Re,r=o?n:t,i=o?t:null;return new x_({type:"tuple",items:e,rest:i,...ce.normalizeParams(r)})}a(I_,"tuple");var hu=N("ZodRecord",(e,t)=>{Vs.init(e,t),qe.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Pv(e,n,o,r),e.keyType=t.keyType,e.valueType=t.valueType});function A_(e,t,n){return new hu({type:"record",keyType:e,valueType:t,...ce.normalizeParams(n)})}a(A_,"record");function iI(e,t,n){let o=Nt(e);return o._zod.values=void 0,new hu({type:"record",keyType:o,valueType:t,...ce.normalizeParams(n)})}a(iI,"partialRecord");function aI(e,t,n){return new hu({type:"record",keyType:e,valueType:t,mode:"loose",...ce.normalizeParams(n)})}a(aI,"looseRecord");var R_=N("ZodMap",(e,t)=>{Ld.init(e,t),qe.init(e,t),e._zod.processJSONSchema=(n,o,r)=>mv(e,n,o,r),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...n)=>e.check(Yr(...n)),e.nonempty=n=>e.check(Yr(1,n)),e.max=(...n)=>e.check(Ln(...n)),e.size=(...n)=>e.check(go(...n))});function sI(e,t,n){return new R_({type:"map",keyType:e,valueType:t,...ce.normalizeParams(n)})}a(sI,"map");var D_=N("ZodSet",(e,t)=>{jd.init(e,t),qe.init(e,t),e._zod.processJSONSchema=(n,o,r)=>hv(e,n,o,r),e.min=(...n)=>e.check(Yr(...n)),e.nonempty=n=>e.check(Yr(1,n)),e.max=(...n)=>e.check(Ln(...n)),e.size=(...n)=>e.check(go(...n))});function cI(e,t){return new D_({type:"set",valueType:e,...ce.normalizeParams(t)})}a(cI,"set");var va=N("ZodEnum",(e,t)=>{Gs.init(e,t),qe.init(e,t),e._zod.processJSONSchema=(o,r,i)=>iv(e,o,r,i),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(o,r)=>{let i={};for(let s of o)if(n.has(s))i[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new va({...t,checks:[],...ce.normalizeParams(r),entries:i})},e.exclude=(o,r)=>{let i={...t.entries};for(let s of o)if(n.has(s))delete i[s];else throw new Error(`Key ${s} not found in enum`);return new va({...t,checks:[],...ce.normalizeParams(r),entries:i})}});function df(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new va({type:"enum",entries:n,...ce.normalizeParams(t)})}a(df,"_enum");function uI(e,t){return new va({type:"enum",entries:e,...ce.normalizeParams(t)})}a(uI,"nativeEnum");var O_=N("ZodLiteral",(e,t)=>{Hs.init(e,t),qe.init(e,t),e._zod.processJSONSchema=(n,o,r)=>av(e,n,o,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function lI(e,t){return new O_({type:"literal",values:Array.isArray(e)?e:[e],...ce.normalizeParams(t)})}a(lI,"literal");var $_=N("ZodFile",(e,t)=>{qd.init(e,t),qe.init(e,t),e._zod.processJSONSchema=(n,o,r)=>uv(e,n,o,r),e.min=(n,o)=>e.check(Yr(n,o)),e.max=(n,o)=>e.check(Ln(n,o)),e.mime=(n,o)=>e.check(ai(Array.isArray(n)?n:[n],o))});function dI(e){return _p($_,e)}a(dI,"file");var C_=N("ZodTransform",(e,t)=>{Zs.init(e,t),qe.init(e,t),e._zod.processJSONSchema=(n,o,r)=>fv(e,n,o,r),e._zod.parse=(n,o)=>{if(o.direction==="backward")throw new lo(e.constructor.name);n.addIssue=i=>{if(typeof i=="string")n.issues.push(ce.issue(i,n.value,t));else{let s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=e),n.issues.push(ce.issue(s))}};let r=t.transform(n.value,n);return r instanceof Promise?r.then(i=>(n.value=i,n)):(n.value=r,n)}});function pf(e){return new C_({type:"transform",transform:e})}a(pf,"transform");var ff=N("ZodOptional",(e,t)=>{aa.init(e,t),qe.init(e,t),e._zod.processJSONSchema=(n,o,r)=>xp(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function su(e){return new ff({type:"optional",innerType:e})}a(su,"optional");var N_=N("ZodExactOptional",(e,t)=>{Bd.init(e,t),qe.init(e,t),e._zod.processJSONSchema=(n,o,r)=>xp(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function k_(e){return new N_({type:"optional",innerType:e})}a(k_,"exactOptional");var z_=N("ZodNullable",(e,t)=>{Ws.init(e,t),qe.init(e,t),e._zod.processJSONSchema=(n,o,r)=>wv(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function cu(e){return new z_({type:"nullable",innerType:e})}a(cu,"nullable");function pI(e){return su(cu(e))}a(pI,"nullish");var U_=N("ZodDefault",(e,t)=>{Vd.init(e,t),qe.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Tv(e,n,o,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function M_(e,t){return new U_({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():ce.shallowClone(t)}})}a(M_,"_default");var F_=N("ZodPrefault",(e,t)=>{Gd.init(e,t),qe.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Ev(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function L_(e,t){return new F_({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():ce.shallowClone(t)}})}a(L_,"prefault");var mf=N("ZodNonOptional",(e,t)=>{Hd.init(e,t),qe.init(e,t),e._zod.processJSONSchema=(n,o,r)=>bv(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function j_(e,t){return new mf({type:"nonoptional",innerType:e,...ce.normalizeParams(t)})}a(j_,"nonoptional");var q_=N("ZodSuccess",(e,t)=>{Zd.init(e,t),qe.init(e,t),e._zod.processJSONSchema=(n,o,r)=>lv(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function fI(e){return new q_({type:"success",innerType:e})}a(fI,"success");var B_=N("ZodCatch",(e,t)=>{Wd.init(e,t),qe.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Sv(e,n,o,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function V_(e,t){return new B_({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}a(V_,"_catch");var G_=N("ZodNaN",(e,t)=>{Kd.init(e,t),qe.init(e,t),e._zod.processJSONSchema=(n,o,r)=>sv(e,n,o,r)});function mI(e){return vp(G_,e)}a(mI,"nan");var hf=N("ZodPipe",(e,t)=>{Ks.init(e,t),qe.init(e,t),e._zod.processJSONSchema=(n,o,r)=>xv(e,n,o,r),e.in=t.in,e.out=t.out});function uu(e,t){return new hf({type:"pipe",in:e,out:t})}a(uu,"pipe");var gf=N("ZodCodec",(e,t)=>{hf.init(e,t),sa.init(e,t)});function hI(e,t,n){return new gf({type:"pipe",in:e,out:t,transform:n.decode,reverseTransform:n.encode})}a(hI,"codec");var H_=N("ZodReadonly",(e,t)=>{Jd.init(e,t),qe.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Iv(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function Z_(e){return new H_({type:"readonly",innerType:e})}a(Z_,"readonly");var W_=N("ZodTemplateLiteral",(e,t)=>{Xd.init(e,t),qe.init(e,t),e._zod.processJSONSchema=(n,o,r)=>cv(e,n,o,r)});function gI(e,t){return new W_({type:"template_literal",parts:e,...ce.normalizeParams(t)})}a(gI,"templateLiteral");var K_=N("ZodLazy",(e,t)=>{ep.init(e,t),qe.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Rv(e,n,o,r),e.unwrap=()=>e._zod.def.getter()});function J_(e){return new K_({type:"lazy",getter:e})}a(J_,"lazy");var X_=N("ZodPromise",(e,t)=>{Qd.init(e,t),qe.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Av(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function yI(e){return new X_({type:"promise",innerType:e})}a(yI,"promise");var Y_=N("ZodFunction",(e,t)=>{Yd.init(e,t),qe.init(e,t),e._zod.processJSONSchema=(n,o,r)=>pv(e,n,o,r)});function vI(e){return new Y_({type:"function",input:Array.isArray(e?.input)?I_(e?.input):e?.input??pu(pi()),output:e?.output??pi()})}a(vI,"_function");var gu=N("ZodCustom",(e,t)=>{Js.init(e,t),qe.init(e,t),e._zod.processJSONSchema=(n,o,r)=>dv(e,n,o,r)});function _I(e){let t=new at({check:"custom"});return t._zod.check=e,t}a(_I,"check");function PI(e,t){return Bc(gu,e??(()=>!0),t)}a(PI,"custom");function Q_(e,t={}){return Vc(gu,e,t)}a(Q_,"refine");function eP(e){return Pp(e)}a(eP,"superRefine");var wI=wp,bI=bp;function TI(e,t={}){let n=new gu({type:"custom",check:"custom",fn:a(o=>o instanceof e,"fn"),abort:!0,...ce.normalizeParams(t)});return n._zod.bag.Class=e,n._zod.check=o=>{o.value instanceof e||o.issues.push({code:"invalid_type",expected:e.name,input:o.value,inst:n,path:[...n._zod.def.path??[]]})},n}a(TI,"_instanceof");var EI=a((...e)=>Tp({Codec:gf,Boolean:ba,String:_a},...e),"stringbool");function SI(e){let t=J_(()=>lf([qp(e),d_(),p_(),g_(),pu(t),A_(qp(),t)]));return t}a(SI,"json");function xI(e,t){return uu(pf(e),t)}a(xI,"preprocess");var Fq={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function Lq(e){gt({customError:e})}a(Lq,"setErrorMap");function jq(){return gt().customError}a(jq,"getErrorMap");var tP;tP||(tP={});var ye={...iu,...Up,iso:ya},qq=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function Bq(e,t){let n=e.$schema;return n==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":n==="http://json-schema.org/draft-07/schema#"?"draft-7":n==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}a(Bq,"detectVersion");function Vq(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let n=e.slice(1).split("/").filter(Boolean);if(n.length===0)return t.rootSchema;let o=t.version==="draft-2020-12"?"$defs":"definitions";if(n[0]===o){let r=n[1];if(!r||!t.defs[r])throw new Error(`Reference not found: ${e}`);return t.defs[r]}throw new Error(`Reference not found: ${e}`)}a(Vq,"resolveRef");function II(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return ye.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){let r=e.$ref;if(t.refs.has(r))return t.refs.get(r);if(t.processing.has(r))return ye.lazy(()=>{if(!t.refs.has(r))throw new Error(`Circular reference not resolved: ${r}`);return t.refs.get(r)});t.processing.add(r);let i=Vq(r,t),s=Gt(i,t);return t.refs.set(r,s),t.processing.delete(r),s}if(e.enum!==void 0){let r=e.enum;if(t.version==="openapi-3.0"&&e.nullable===!0&&r.length===1&&r[0]===null)return ye.null();if(r.length===0)return ye.never();if(r.length===1)return ye.literal(r[0]);if(r.every(s=>typeof s=="string"))return ye.enum(r);let i=r.map(s=>ye.literal(s));return i.length<2?i[0]:ye.union([i[0],i[1],...i.slice(2)])}if(e.const!==void 0)return ye.literal(e.const);let n=e.type;if(Array.isArray(n)){let r=n.map(i=>{let s={...e,type:i};return II(s,t)});return r.length===0?ye.never():r.length===1?r[0]:ye.union(r)}if(!n)return ye.any();let o;switch(n){case"string":{let r=ye.string();if(e.format){let i=e.format;i==="email"?r=r.check(ye.email()):i==="uri"||i==="uri-reference"?r=r.check(ye.url()):i==="uuid"||i==="guid"?r=r.check(ye.uuid()):i==="date-time"?r=r.check(ye.iso.datetime()):i==="date"?r=r.check(ye.iso.date()):i==="time"?r=r.check(ye.iso.time()):i==="duration"?r=r.check(ye.iso.duration()):i==="ipv4"?r=r.check(ye.ipv4()):i==="ipv6"?r=r.check(ye.ipv6()):i==="mac"?r=r.check(ye.mac()):i==="cidr"?r=r.check(ye.cidrv4()):i==="cidr-v6"?r=r.check(ye.cidrv6()):i==="base64"?r=r.check(ye.base64()):i==="base64url"?r=r.check(ye.base64url()):i==="e164"?r=r.check(ye.e164()):i==="jwt"?r=r.check(ye.jwt()):i==="emoji"?r=r.check(ye.emoji()):i==="nanoid"?r=r.check(ye.nanoid()):i==="cuid"?r=r.check(ye.cuid()):i==="cuid2"?r=r.check(ye.cuid2()):i==="ulid"?r=r.check(ye.ulid()):i==="xid"?r=r.check(ye.xid()):i==="ksuid"&&(r=r.check(ye.ksuid()))}typeof e.minLength=="number"&&(r=r.min(e.minLength)),typeof e.maxLength=="number"&&(r=r.max(e.maxLength)),e.pattern&&(r=r.regex(new RegExp(e.pattern))),o=r;break}case"number":case"integer":{let r=n==="integer"?ye.number().int():ye.number();typeof e.minimum=="number"&&(r=r.min(e.minimum)),typeof e.maximum=="number"&&(r=r.max(e.maximum)),typeof e.exclusiveMinimum=="number"?r=r.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(r=r.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?r=r.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(r=r.lt(e.maximum)),typeof e.multipleOf=="number"&&(r=r.multipleOf(e.multipleOf)),o=r;break}case"boolean":{o=ye.boolean();break}case"null":{o=ye.null();break}case"object":{let r={},i=e.properties||{},s=new Set(e.required||[]);for(let[h,g]of Object.entries(i)){let y=Gt(g,t);r[h]=s.has(h)?y:y.optional()}if(e.propertyNames){let h=Gt(e.propertyNames,t),g=e.additionalProperties&&typeof e.additionalProperties=="object"?Gt(e.additionalProperties,t):ye.any();if(Object.keys(r).length===0){o=ye.record(h,g);break}let y=ye.object(r).passthrough(),T=ye.looseRecord(h,g);o=ye.intersection(y,T);break}if(e.patternProperties){let h=e.patternProperties,g=Object.keys(h),y=[];for(let b of g){let P=Gt(h[b],t),S=ye.string().regex(new RegExp(b));y.push(ye.looseRecord(S,P))}let T=[];if(Object.keys(r).length>0&&T.push(ye.object(r).passthrough()),T.push(...y),T.length===0)o=ye.object({}).passthrough();else if(T.length===1)o=T[0];else{let b=ye.intersection(T[0],T[1]);for(let P=2;P<T.length;P++)b=ye.intersection(b,T[P]);o=b}break}let u=ye.object(r);e.additionalProperties===!1?o=u.strict():typeof e.additionalProperties=="object"?o=u.catchall(Gt(e.additionalProperties,t)):o=u.passthrough();break}case"array":{let r=e.prefixItems,i=e.items;if(r&&Array.isArray(r)){let s=r.map(h=>Gt(h,t)),u=i&&typeof i=="object"&&!Array.isArray(i)?Gt(i,t):void 0;u?o=ye.tuple(s).rest(u):o=ye.tuple(s),typeof e.minItems=="number"&&(o=o.check(ye.minLength(e.minItems))),typeof e.maxItems=="number"&&(o=o.check(ye.maxLength(e.maxItems)))}else if(Array.isArray(i)){let s=i.map(h=>Gt(h,t)),u=e.additionalItems&&typeof e.additionalItems=="object"?Gt(e.additionalItems,t):void 0;u?o=ye.tuple(s).rest(u):o=ye.tuple(s),typeof e.minItems=="number"&&(o=o.check(ye.minLength(e.minItems))),typeof e.maxItems=="number"&&(o=o.check(ye.maxLength(e.maxItems)))}else if(i!==void 0){let s=Gt(i,t),u=ye.array(s);typeof e.minItems=="number"&&(u=u.min(e.minItems)),typeof e.maxItems=="number"&&(u=u.max(e.maxItems)),o=u}else o=ye.array(ye.any());break}default:throw new Error(`Unsupported type: ${n}`)}return e.description&&(o=o.describe(e.description)),e.default!==void 0&&(o=o.default(e.default)),o}a(II,"convertBaseSchema");function Gt(e,t){if(typeof e=="boolean")return e?ye.any():ye.never();let n=II(e,t),o=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let u=e.anyOf.map(g=>Gt(g,t)),h=ye.union(u);n=o?ye.intersection(n,h):h}if(e.oneOf&&Array.isArray(e.oneOf)){let u=e.oneOf.map(g=>Gt(g,t)),h=ye.xor(u);n=o?ye.intersection(n,h):h}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)n=o?n:ye.any();else{let u=o?n:Gt(e.allOf[0],t),h=o?0:1;for(let g=h;g<e.allOf.length;g++)u=ye.intersection(u,Gt(e.allOf[g],t));n=u}e.nullable===!0&&t.version==="openapi-3.0"&&(n=ye.nullable(n)),e.readOnly===!0&&(n=ye.readonly(n));let r={},i=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let u of i)u in e&&(r[u]=e[u]);let s=["contentEncoding","contentMediaType","contentSchema"];for(let u of s)u in e&&(r[u]=e[u]);for(let u of Object.keys(e))qq.has(u)||(r[u]=e[u]);return Object.keys(r).length>0&&t.registry.add(n,r),n}a(Gt,"convertSchema");function AI(e,t){if(typeof e=="boolean")return e?ye.any():ye.never();let n=Bq(e,t?.defaultTarget),o=e.$defs||e.definitions||{},r={version:n,defs:o,refs:new Map,processing:new Set,rootSchema:e,registry:t?.registry??kt};return Gt(e,r)}a(AI,"fromJSONSchema");var rP={};nr(rP,{bigint:()=>Wq,boolean:()=>Zq,date:()=>Kq,number:()=>Hq,string:()=>Gq});function Gq(e){return nc(_a,e)}a(Gq,"string");function Hq(e){return Rc(wa,e)}a(Hq,"number");function Zq(e){return $c(ba,e)}a(Zq,"boolean");function Wq(e){return Cc(Ta,e)}a(Wq,"bigint");function Kq(e){return Uc(du,e)}a(Kq,"date");gt(Xs());var nP={required:"required",invalidGitRepoSlug:"invalidGitRepoSlug",invalidGitRepoBranch:"invalidGitRepoBranch",invalidGitRepoRemoteUrl:"invalidGitRepoRemoteUrl",invalidExternalId:"invalidExternalId",invalidFileName:"invalidFileName",messageRequiresContentOrFiles:"messageRequiresContentOrFiles",agentConfigTooLarge:"agentConfigTooLarge",invalidGcpResourceId:"invalidGcpResourceId",duplicateRouteName:"duplicateRouteName",atLeastOne:"atLeastOne",wholeNumber:"wholeNumber",atMostTenThousand:"atMostTenThousand",tierNameTooLong:"tierNameTooLong",tierDescriptionTooLong:"tierDescriptionTooLong",invalidEmoji:"invalidEmoji",tierTooManyModels:"tierTooManyModels",tierDuplicateModel:"tierDuplicateModel",tierThinkingBudgetInvalid:"tierThinkingBudgetInvalid",invalidHeaderName:"invalidHeaderName",reservedHeaderName:"reservedHeaderName",duplicateHeaderName:"duplicateHeaderName",invalidHeaderValue:"invalidHeaderValue"};var RI=(n=>(n.IMAGE="image",n.TEXT="text",n))(RI||{}),Xt=fe.object({apiKey:fe.string()}),DI=fe.object({serviceAccountJson:fe.string().min(1)}),OI=Xt,$I=Xt.extend({apiKeyHash:fe.string()}),CI=Xt,NI=Xt,kI=Xt,zI=Xt,UI=Xt,MI=Xt,FI=fe.object({accessKeyId:fe.string().min(1),secretAccessKey:fe.string().min(1),sessionToken:fe.string().optional()}),LI=Xt,jI=fe.object({}),qI=fe.object({}),oP=fe.object({modelId:fe.string(),modelName:fe.string(),modelType:fe.enum(RI)}),BI=fe.object({apiKeyHeader:fe.string(),baseUrl:fe.string(),models:fe.array(oP),defaultHeaders:fe.record(fe.string(),fe.string()).optional(),apiStyle:fe.enum(["chat","responses"]).optional()}),VI=fe.object({accountId:fe.string(),gatewayId:fe.string(),models:fe.array(oP),vertexProject:fe.string().optional(),vertexRegion:fe.string().optional()}),GI=fe.object({resourceName:fe.string(),apiVersion:fe.preprocess(e=>typeof e=="string"&&e.trim().length===0?void 0:e,fe.string().optional())}),HI=fe.object({}),ZI=fe.object({}),WI=fe.object({}),KI=fe.object({region:fe.string().min(1)}),JI=fe.object({project:fe.string().regex(/^[a-z0-9][a-z0-9-]{0,62}$/,nP.invalidGcpResourceId),region:fe.string().regex(/^[a-z0-9][a-z0-9-]{0,62}$/,nP.invalidGcpResourceId),models:fe.array(oP)}),XI=fe.object({}),mi=fe.object({}),tQ=fe.union([OI,kI,zI,UI,MI,NI,CI,$I,FI,DI,LI]),rQ=fe.union([BI,VI,GI,JI,KI,jI,HI,ZI,WI,qI,XI,mi]),nQ=fe.discriminatedUnion("provider",[fe.object({provider:fe.literal("openai"),config:ZI.partial(),auth:UI.partial()}),fe.object({provider:fe.literal("openrouter"),config:WI.partial(),auth:MI.partial()}),fe.object({provider:fe.literal("anthropic"),config:jI.partial(),auth:OI.partial()}),fe.object({provider:fe.literal("azure"),config:GI.partial(),auth:kI.partial()}),fe.object({provider:fe.literal("google"),config:HI.partial(),auth:zI.partial()}),fe.object({provider:fe.literal("cloudflare-gateway"),config:VI.partial(),auth:NI.partial()}),fe.object({provider:fe.literal("custom"),config:BI.partial(),auth:CI.partial()}),fe.object({provider:fe.literal("activepieces"),config:qI.partial(),auth:$I.partial()}),fe.object({provider:fe.literal("bedrock"),config:KI.partial(),auth:FI.partial()}),fe.object({provider:fe.literal("vertex"),config:JI.partial(),auth:DI.partial()}),fe.object({provider:fe.literal("mistral"),config:XI.partial(),auth:LI.partial()}),fe.object({provider:fe.literal("xai"),config:mi.partial(),auth:Xt.partial()}),fe.object({provider:fe.literal("deepseek"),config:mi.partial(),auth:Xt.partial()}),fe.object({provider:fe.literal("zai"),config:mi.partial(),auth:Xt.partial()}),fe.object({provider:fe.literal("qwen"),config:mi.partial(),auth:Xt.partial()}),fe.object({provider:fe.literal("minimax"),config:mi.partial(),auth:Xt.partial()}),fe.object({provider:fe.literal("moonshot"),config:mi.partial(),auth:Xt.partial()})]);var fQ=x().check(jt(/^#[0-9A-Fa-f]{6}$/));var hQ=M({filename:x(),data:$e(),type:Ee("file"),mimetype:W(x())});var Jq=he(QI());var bQ=M({...Ur,name:x(),permissions:Ae(x()),platformId:vt(x()),type:x(),userCount:W(zt())});var $Q=fe.enum(["active","out_of_credits","rejected","unreachable"]);var eA=(o=>(o.AGENT_DECIDE="agent-decide",o.CHOOSE_YOURSELF="choose-yourself",o.LEAVE_EMPTY="leave-empty",o))(eA||{}),iP=(n=>(n.FILE="FILE",n.TABLE="TABLE",n))(iP||{}),aP=(o=>(o.SSE="sse",o.STREAMABLE_HTTP="streamable-http",o.SIMPLE_HTTP="http",o))(aP||{});var sP=(o=>(o.TEXT="text",o.NUMBER="number",o.BOOLEAN="boolean",o))(sP||{});var cP=(n=>(n.IN_PROGRESS="in-progress",n.COMPLETED="completed",n))(cP||{});var Xq=M({mode:xe(eA),value:$e()}),Yq=M({auth:W(x()),fields:Ce(x(),Xq)}),Qq=M({pieceName:x(),pieceVersion:x(),actionName:x(),predefinedInput:W(Yq)}),eB=M({type:Ee("PIECE"),toolName:x().check(Et(1)),pieceMetadata:Qq}),tB=M({type:Ee("none")}),rB=M({type:Ee("access_token"),accessToken:x()}),nB=M({type:Ee("api_key"),apiKey:x(),apiKeyHeader:x()}),oB=M({type:Ee("headers"),headers:Ce(x(),x())}),iB=bo("type",[tB,rB,nB,oB]),tA=M({type:Ee("FLOW"),toolName:x().check(Et(1)),externalFlowId:x(),flowDisplayName:W(x())}),rA=M({type:Ee("MCP"),toolName:x().check(Et(1)),serverUrl:KS(),protocol:xe(aP),auth:iB}),nA=M({type:Ee("KNOWLEDGE_BASE"),toolName:x().check(Et(1)),sourceType:xe(iP),sourceId:x(),sourceName:x()}),aB=bo("type",[eB,tA,rA,nA]),sB=M({displayName:x(),description:W(x()),type:xe(sP)}),oA=M({type:Ee("MARKDOWN"),markdown:x()}),Ea={type:Ee("TOOL_CALL"),input:vt(Ce(x(),$e())),output:W($e()),toolName:x(),status:xe(cP),toolCallId:x(),startTime:x(),endTime:W(x())},_ee=M(Ea),iA=bo("toolCallType",[M({...Ea,toolCallType:Ee("PIECE"),pieceName:x(),pieceVersion:x(),actionName:x()}),M({...Ea,toolCallType:Ee("FLOW"),displayName:x(),externalFlowId:x()}),M({...Ea,toolCallType:Ee("MCP"),displayName:x(),serverUrl:x()}),M({...Ea,toolCallType:Ee("KNOWLEDGE_BASE"),displayName:x(),sourceType:x()}),M({...Ea,toolCallType:Ee("UNKNOWN"),displayName:x()})]),cB=je([oA,iA]);var uB=10800*1e3,lB=900*1e3;var dP=(n=>(n.IMAGE="image",n.TEXT="text",n))(dP||{}),Gn=M({apiKey:x()}),pB=Gn,fB=M({apiKey:x(),apiKeyHash:x()}),mB=Gn,hB=Gn,gB=Gn,yB=Gn,vB=Gn,_B=Gn,PB=Gn,uA=M({serviceAccountJson:x().check(Et(1))}),lA=M({accessKeyId:x().check(Et(1)),secretAccessKey:x().check(Et(1)),sessionToken:W(x())}),wB=M({}),bB=M({}),TB=M({}),EB=M({}),SB=M({}),xB=M({}),pP=M({modelId:x(),modelName:x(),modelType:xe(dP)}),dA=M({apiKeyHeader:x(),baseUrl:x(),models:Ae(pP),defaultHeaders:W(Ce(x(),x())),apiStyle:W(xe(["chat","responses"]))}),pA=M({accountId:x(),gatewayId:x(),models:Ae(pP),vertexProject:W(x()),vertexRegion:W(x())}),fA=M({resourceName:x(),apiVersion:Eo(To(e=>typeof e=="string"&&e.trim().length===0?void 0:e),W(x()))}),mA=M({region:x().check(Et(1))}),hA=M({project:x().check(jt(/^[a-z0-9][a-z0-9-]{0,62}$/)),region:x().check(jt(/^[a-z0-9][a-z0-9-]{0,62}$/)),models:Ae(pP)}),gA=M({}),IB=je([pB,gB,yB,vB,_B,hB,mB,fB,lA,uA,PB]),yA=je([dA,pA,fA,hA,mA,wB,TB,EB,SB,bB,xB,gA]),AB=M({id:x(),name:x(),type:xe(dP)}),RB=M({id:x(),name:x(),provider:xe(Io),config:yA,enabledForChat:Je()}),DB=M({provider:xe(Io),name:x(),enabledForChat:Je(),keys:Ae(M({id:x(),name:x()}))}),OB=M({provider:xe(Io),configId:x(),config:yA,auth:IB,platformId:x()});var Tee={openai:"openai",anthropic:"anthropic","google-ai-studio":"google","google-vertex-ai":"google"},aA=["gpt-5.5","gpt-5.6-sol","gpt-5.6-terra","gpt-5.6-luna","gpt-5.4-mini","gpt-5.4-nano","gpt-4.1","gpt-4.1-mini"],$B=["claude-sonnet-4-6","claude-opus-4-7","claude-haiku-4-5"],vA=["claude-sonnet-4.6","claude-opus-4.7","claude-opus-4.8","claude-haiku-4.5"],uP=["gemini-3.7-flash","gemini-3.1-pro-preview","gemini-3-flash-preview"],lP=["gemini-2.5-pro","gemini-2.5-flash"],CB=["grok-4.20"],Eee={google:lP,vertex:lP},See=vA.map(e=>`anthropic/${e}`),NB={openai:aA,anthropic:$B,google:uP,vertex:uP,activepieces:[...vA.map(e=>`anthropic/${e}`),...aA.map(e=>`openai/${e}`),...[...uP,...lP].map(e=>`google/${e}`),...CB.map(e=>`x-ai/${e}`)]};var sA=128e3,kB={openai:128e3,anthropic:2e5,google:1048576,bedrock:2e5,vertex:1048576,azure:128e3,openrouter:128e3,activepieces:2e5,mistral:128e3};function zB({provider:e}){return e?kB[e]??sA:sA}a(zB,"getMaxContextTokens");var cA={openai:"text-embedding-3-small",google:"text-embedding-004",azure:"text-embedding-3-small",activepieces:"text-embedding-3-small",openrouter:"openai/text-embedding-3-small"},UB={anthropic:"native",google:"native",openrouter:"plugin",activepieces:"plugin"},MB=new Set(["anthropic","mistral","xai","deepseek","zai","qwen","minimax","moonshot"]),FB={xai:"https://api.x.ai/v1",deepseek:"https://api.deepseek.com/v1",zai:"https://api.z.ai/api/paas/v4",qwen:"https://dashscope-intl.aliyuncs.com/compatible-mode/v1",minimax:"https://api.minimax.io/v1",moonshot:"https://api.moonshot.ai/v1"};function qt(e){return{chatModels:NB[e],maxContextTokens:zB({provider:e}),defaultEmbeddingModel:cA[e],supportsEmbedding:cA[e]!==void 0,supportsImageGeneration:!MB.has(e),defaultImageModel:LB[e],webSearch:UB[e]}}a(qt,"buildProviderCapabilities");var _A=[{id:"fast",label:"Fast",modelId:"google/gemini-3.1-flash-lite-image"},{id:"smart",label:"Expert",modelId:"google/gemini-3.1-flash-image"},{id:"premium",label:"Heavy",modelId:"google/gemini-3-pro-image"}],LB={activepieces:_A[0].modelId,openrouter:"google/gemini-3.1-flash-lite-image",openai:"gpt-image-1.5",google:"gemini-3.1-flash-image"},jB={openai:qt("openai"),anthropic:qt("anthropic"),openrouter:qt("openrouter"),azure:qt("azure"),google:qt("google"),"cloudflare-gateway":qt("cloudflare-gateway"),custom:qt("custom"),bedrock:qt("bedrock"),vertex:qt("vertex"),mistral:qt("mistral"),activepieces:qt("activepieces"),xai:qt("xai"),deepseek:qt("deepseek"),zai:qt("zai"),qwen:qt("qwen"),minimax:qt("minimax"),moonshot:qt("moonshot")};var qB=M({base64Url:x(),fileName:x(),extension:W(x())}),BB=M({mimeType:x(),url:x(),fileName:W(x())}),fP=je([qB,BB]);var VB=je([M({type:Ee("file"),value:fP}),M({type:Ee("markdown"),value:x(),files:W(Ae(fP))})]),GB=M({sessionId:x(),message:x(),files:W(Ae(x()))});var wA=(n=>(n.ON_NEW_RECORD="ON_NEW_RECORD",n.ON_UPDATE_RECORD="ON_UPDATE_RECORD",n))(wA||{}),bA=(n=>(n.ENABLED="ENABLED",n.DISABLED="DISABLED",n))(bA||{}),mP=(o=>(o.RECORD_CREATED="RECORD_CREATED",o.RECORD_UPDATED="RECORD_UPDATED",o.RECORD_DELETED="RECORD_DELETED",o))(mP||{});var HB=je([M({...Ur,name:x(),externalId:x(),type:Ee("STATIC_DROPDOWN"),tableId:x(),projectId:x(),data:M({options:Ae(M({value:x()}))})}),M({...Ur,name:x(),externalId:x(),type:je([Ee("TEXT"),Ee("NUMBER"),Ee("DATE"),Ee("DATETIME")]),tableId:x(),projectId:x()})]),ZB=M({...Ur,name:x(),folderId:vt(x()),projectId:x(),externalId:x(),status:Zv(bA),trigger:Zv(wA)}),WB=M({...Ur,tableId:x(),projectId:x(),cells:Ce(x(),M({updated:x(),created:x(),value:$e(),fieldName:x()}))}),KB=M({events:Ae(xe(mP)),webhookUrl:x(),flowId:x()}),JB=M({fields:Ae(M({id:x(),name:x()})),rows:Ae(Ce(x(),x())),name:x()}),XB=M({projectId:x(),limit:W(Wc.number()),cursor:W(x()),name:W(x()),externalIds:zp(x()),folderId:W(x()),folderIds:zp(x())}),YB=M({records:Ae(Ae(M({fieldId:x(),value:EA()}))),tableId:x()}),QB=M({cells:W(Ae(M({fieldId:x(),value:EA()}))),tableId:x(),agentUpdate:W(Je())}),TA=bo("operator",[hi("eq"),hi("neq"),hi("gt"),hi("gte"),hi("lt"),hi("lte"),hi("co"),PA("exists"),PA("not_exists")]),eV=M({tableId:x(),limit:W(Wc.number()),cursor:W(x()),filters:zp(TA)});function EA(){return Eo(To(e=>e==null?e:String(e)),Zc(x()))}a(EA,"coerceToString");function hi(e){return M({fieldId:x(),operator:Ee(e),value:x()})}a(hi,"valueFilter");function PA(e){return M({fieldId:x(),operator:Ee(e)})}a(PA,"existenceFilter");var tV=M({status:W(zt()),body:W($e()),headers:W(Ce(x(),x()))}),rV=M({...Ur,deleted:vt(xo),ownerId:x(),displayName:x(),platformId:x(),externalId:vt(x())});var SA=M({name:x(),description:W(x()),type:x(),required:Je()}),nV=M({pieceName:x(),triggerName:x(),input:M({toolName:x(),toolDescription:x(),inputSchema:Ae(SA),returnsResponse:Je()})});var xA="^[0-9]+\\.[0-9]+\\.[0-9]+$",Vee=new RegExp(xA),iV="^([~^])?[0-9]+\\.[0-9]+\\.[0-9]+$",Gee=x().check(jt(new RegExp(xA))),Hee=x().check(jt(new RegExp(iV))),aV=M({packageType:Ee("ARCHIVE"),pieceType:xe(ma),pieceName:x(),pieceVersion:x(),archiveId:x(),platformId:x()}),IA=M({packageType:Ee("REGISTRY"),pieceType:Ee("OFFICIAL"),pieceName:x(),pieceVersion:x()}),AA=M({packageType:Ee("REGISTRY"),pieceType:Ee("CUSTOM"),pieceName:x(),pieceVersion:x(),platformId:x()}),Zee=je([IA,AA]),Wee=je([aV,IA,AA]);var sV=bo("type",[M({type:Ee("CRON_EXPRESSION"),cronExpression:x(),timezone:x()}),M({type:Ee("INTERVAL"),intervalMs:JS().check(Dt(6e4))})]),Kee=M({...Ur,type:xe(pn),projectId:x(),flowId:x(),triggerName:x(),schedule:vt(sV),flowVersionId:x(),pieceName:x(),pieceVersion:x(),deleted:vt(x()),simulate:Je()}),RA=(m=>(m.UNKNOWN="UNKNOWN",m.FLOW_RUN_LOG="FLOW_RUN_LOG",m.FLOW_RUN_LOG_SLICE="FLOW_RUN_LOG_SLICE",m.PACKAGE_ARCHIVE="PACKAGE_ARCHIVE",m.FLOW_STEP_FILE="FLOW_STEP_FILE",m.SAMPLE_DATA="SAMPLE_DATA",m.TRIGGER_PAYLOAD="TRIGGER_PAYLOAD",m.SAMPLE_DATA_INPUT="SAMPLE_DATA_INPUT",m.TRIGGER_EVENT_FILE="TRIGGER_EVENT_FILE",m.PROJECT_RELEASE="PROJECT_RELEASE",m.FLOW_VERSION_BACKUP="FLOW_VERSION_BACKUP",m.PLATFORM_ASSET="PLATFORM_ASSET",m.USER_PROFILE_PICTURE="USER_PROFILE_PICTURE",m.WEBHOOK_PAYLOAD="WEBHOOK_PAYLOAD",m.MCP_CALL_PAYLOAD="MCP_CALL_PAYLOAD",m.KNOWLEDGE_BASE="KNOWLEDGE_BASE",m.FLOW_BUNDLE="FLOW_BUNDLE",m.PREWARM_SCOPE="PREWARM_SCOPE",m))(RA||{}),DA=(n=>(n.NONE="NONE",n.ZSTD="ZSTD",n))(DA||{}),OA=(n=>(n.S3="S3",n.DB="DB",n))(OA||{}),Jee=M({...Ur,projectId:vt(x()),platformId:vt(x()),type:xe(RA),compression:xe(DA),data:W($e()),location:xe(OA),size:vt(zt()),fileName:vt(x()),s3Key:vt(x()),metadata:vt(Ce(x(),x()))}),$A=(o=>(o.ADMIN="ADMIN",o.MEMBER="MEMBER",o.OPERATOR="OPERATOR",o))($A||{}),CA=(n=>(n.ACTIVE="ACTIVE",n.INACTIVE="INACTIVE",n))(CA||{}),Xee=M({id:x(),email:x(),firstName:x(),status:xe(CA),externalId:vt(x()),platformId:vt(x()),platformRole:xe($A),lastName:x(),created:xo,updated:xo,lastActiveDate:vt(xo),imageUrl:vt(x())});var gP=M({...We.shape,...ke(Ce(x(),$e()),"OBJECT").shape});var yP=M({...We.shape,formatProperty:W(x()),...ke(x(),"RICH_TEXT").shape});var kA=M({...We.shape,...ke(x(),"COLOR").shape});var vP=je([_r,jn,yP,Cp,Bn,Pr,qn,Mv,Kc,Lv,Vn,Yc,gP,Qc,Xc,Fv,Jc,kA]),$={ShortText(e){return{...e,valueSchema:void 0,type:"SHORT_TEXT"}},Checkbox(e){return{...e,valueSchema:void 0,type:"CHECKBOX"}},LongText(e){return{...e,valueSchema:void 0,type:"LONG_TEXT"}},RichText(e){return{...e,valueSchema:void 0,type:"RICH_TEXT"}},MarkDown(e){return{displayName:"Markdown",required:!1,description:e.value,type:"MARKDOWN",valueSchema:void 0,variant:e.variant??"INFO"}},Number(e){return{...e,valueSchema:void 0,type:"NUMBER"}},Json(e){return{...e,valueSchema:void 0,type:"JSON"}},Array(e){return{...e,valueSchema:void 0,type:"ARRAY"}},Object(e){return{...e,valueSchema:void 0,type:"OBJECT"}},Dropdown(e){return{...e,valueSchema:void 0,type:"DROPDOWN"}},StaticDropdown(e){return{...e,valueSchema:void 0,type:"STATIC_DROPDOWN"}},MultiSelectDropdown(e){return{...e,valueSchema:void 0,type:"MULTI_SELECT_DROPDOWN"}},DynamicProperties(e){return{...e,valueSchema:void 0,type:"DYNAMIC"}},StaticMultiSelectDropdown(e){return{...e,valueSchema:void 0,type:"STATIC_MULTI_SELECT_DROPDOWN"}},DateTime(e){return{...e,valueSchema:void 0,type:"DATE_TIME"}},DateRange(e){return{...e,valueSchema:void 0,type:"DATE_RANGE"}},File(e){return{...e,valueSchema:void 0,type:"FILE"}},Custom(e){let t=e.code.toString();return{...e,code:t,valueSchema:void 0,type:"CUSTOM"}},Color(e){return{...e,valueSchema:void 0,type:"COLOR"}}};var mn=M({displayName:x(),description:W(x()),hasConnectionIdentifier:W(Je())});var zA=M({username:x(),password:x()}),_P=M({...mn.shape,username:M({displayName:x(),description:W(x())}),password:M({displayName:x(),description:W(x())}),...ke(zA,"BASIC_AUTH").shape});var dV=Ce(x(),je([_r,jn,Vn,Bn,Pr])),PP=M({...mn.shape,props:dV,...ke($e(),"CUSTOM_AUTH").shape});var gi=M({...mn.shape,...ke(M({auth:x()}),"SECRET_TEXT").shape});var pV=Ce(x(),je([_r,jn,gi,Vn,Bn,Pr,qn,Cp])),UA=M({...mn.shape,props:pV,...ke($e(),"OIDC").shape});var wP=(n=>(n.HEADER="HEADER",n.BODY="BODY",n))(wP||{}),MA=je([_r,gi,Pr]),FA=Ce(x(),MA),fV=M({props:W(Ce(x(),MA)),authUrl:x(),tokenUrl:x(),scope:Ae(x()),prompt:W(je([Ee("none"),Ee("consent"),Ee("login"),Ee("omit")])),pkce:W(Je()),pkceMethod:W(je([Ee("plain"),Ee("S256")])),authorizationMethod:W(xe(wP)),grantType:W(je([xe(tu),Ee(jv)])),extra:W(Ce(x(),x()))}),LA=M({access_token:x(),props:W(FA),data:Ce(x(),Hc())}),bP=M({...mn.shape,...fV.shape,...ke(LA,"OAUTH2").shape});var Sa=je([_P,PP,UA,bP,gi]),yu="Connection",xa={SecretText(e){return{...e,valueSchema:void 0,type:"SECRET_TEXT"}},OAuth2(e){return{...e,valueSchema:void 0,type:"OAUTH2",displayName:e.displayName||yu}},BasicAuth(e){return{...e,valueSchema:void 0,type:"BASIC_AUTH",displayName:e.displayName||yu,required:!0}},CustomAuth(e){return{...e,valueSchema:void 0,type:"CUSTOM_AUTH",displayName:e.displayName||yu}},OIDC(e){return{...e,valueSchema:void 0,type:"OIDC",displayName:e.displayName||yu}},None(){}};var Nre={OAUTH2:"OAUTH2",CLOUD_OAUTH2:"OAUTH2",PLATFORM_OAUTH2:"OAUTH2",BASIC_AUTH:"BASIC_AUTH",CUSTOM_AUTH:"CUSTOM_AUTH",OIDC:"OIDC",SECRET_TEXT:"SECRET_TEXT",NO_AUTH:void 0};var mV=M({...We.shape,...ke($e(),"CUSTOM").shape,code:x()});var hV=je([vP,Sa]),TP=Ce(x(),hV),ene=Ce(x(),vP);var jA=je([M({strategy:Ee("CRON"),cronExpression:x()}),M({strategy:Ee("NONE")})]),Ia=class{constructor(t,n,o,r,i,s,u,h,g,y,T,b,P,S,R,I,l,m,d,v,p){this.name=t;this.displayName=n;this.description=o;this.requireAuth=r;this.props=i;this.type=s;this.handshakeConfiguration=u;this.onHandshake=h;this.renewConfiguration=g;this.onRenew=y;this.onEnable=T;this.onDisable=b;this.onStart=P;this.run=S;this.test=R;this.sampleData=I;this.testStrategy=l;this.outputSchema=m;this.aiMetadata=d;this.classification=v;this.propertyGroups=p}static{a(this,"ITrigger")}},Aa=a(e=>{switch(e.type){case"WEBHOOK":return new Ia(e.name,e.displayName,e.description,e.requireAuth??!0,e.props,e.type,e.handshakeConfiguration??{strategy:"NONE"},e.onHandshake??(async()=>({status:200})),e.renewConfiguration??{strategy:"NONE"},e.onRenew??(async()=>Promise.resolve()),e.onEnable,e.onDisable,e.onStart??(async()=>Promise.resolve()),e.run,e.test??(()=>Promise.resolve([e.sampleData])),e.sampleData,e.test?"TEST_FUNCTION":"SIMULATION",e.outputSchema,e.aiMetadata,e.classification,e.propertyGroups);case"POLLING":return new Ia(e.name,e.displayName,e.description,e.requireAuth??!0,e.props,e.type,{strategy:"NONE"},async()=>({status:200}),{strategy:"NONE"},(async()=>Promise.resolve()),e.onEnable,e.onDisable,e.onStart??(async()=>Promise.resolve()),e.run,e.test??(()=>Promise.resolve([e.sampleData])),e.sampleData,"TEST_FUNCTION",e.outputSchema,e.aiMetadata,e.classification,e.propertyGroups);case"MANUAL":return new Ia(e.name,e.displayName,e.description,e.requireAuth??!0,e.props,e.type,{strategy:"NONE"},async()=>({status:200}),{strategy:"NONE"},(async()=>Promise.resolve()),e.onEnable,e.onDisable,e.onStart??(async()=>Promise.resolve()),e.run,e.test??(()=>Promise.resolve([e.sampleData])),e.sampleData,"TEST_FUNCTION",e.outputSchema,e.aiMetadata,e.classification,e.propertyGroups);case"APP_WEBHOOK":return new Ia(e.name,e.displayName,e.description,e.requireAuth??!0,e.props,e.type,{strategy:"NONE"},async()=>({status:200}),{strategy:"NONE"},(async()=>Promise.resolve()),e.onEnable,e.onDisable,e.onStart??(async()=>Promise.resolve()),e.run,e.test??(()=>Promise.resolve([e.sampleData])),e.sampleData,yt(e.sampleData)&&yt(e.test)?"SIMULATION":"TEST_FUNCTION",e.outputSchema,e.aiMetadata,e.classification,e.propertyGroups)}},"createTrigger");var qA="2",_f="0.82.0";var EP=class{constructor(t,n,o,r,i,s,u,h,g=_f,y,T="",b){this.displayName=t;this.logoUrl=n;this.authors=o;this.events=r;this.categories=u;this.auth=h;this.minimumSupportedRelease=g;this.maximumSupportedRelease=y;this.description=T;this.deprecated=b;this._actions={};this._triggers={};this.getContextInfo=a(()=>({version:qA}),"getContextInfo");(!yV(g)||vV(g,_f))&&(this.minimumSupportedRelease=_f),i.forEach(P=>this._actions[P.name]=P),s.forEach(P=>this._triggers[P.name]=P)}static{a(this,"Piece")}metadata(){return{displayName:this.displayName,logoUrl:this.logoUrl,actions:this._actions,triggers:this._triggers,categories:this.categories,description:this.description,authors:this.authors,auth:gV(this.auth),minimumSupportedRelease:this.minimumSupportedRelease,maximumSupportedRelease:this.maximumSupportedRelease,deprecated:this.deprecated,contextInfo:this.getContextInfo?.()}}getAction(t){return this._actions[t]}getTrigger(t){return this._triggers[t]}actions(){return this._actions}triggers(){return this._triggers}},VA=a(e=>{if(e.auth&&Array.isArray(e.auth)&&!e.auth.every((n,o,r)=>o===r.findIndex(i=>i.type===n.type)))throw new Error("Auth properties must be unique by type");return new EP(e.displayName,e.logoUrl,e.authors??[],e.events,e.actions,e.triggers,e.categories??[],e.auth,e.minimumSupportedRelease,e.maximumSupportedRelease,e.description,e.deprecated)},"createPiece");function gV(e){if(e!==void 0)return Array.isArray(e)?e.map(BA):BA(e)}a(gV,"withConnectionIdentifierFlag");function BA(e){return{...e,hasConnectionIdentifier:e.getConnectionIdentifier!==void 0}}a(BA,"flagConnectionIdentifier");function yV(e){return/^\d+\.\d+\.\d+$/.test(e)}a(yV,"isValidSimpleSemver");function vV(e,t){let[n,o,r]=e.split(".").map(Number),[i,s,u]=t.split(".").map(Number);return n!==i?n<i:o!==s?o<s:r<u}a(vV,"isSemverLessThan");var _V=W(Ce(x(),Ce(x(),x()))),GA=M({id:W(x()),name:x(),displayName:x(),logoUrl:x(),description:x(),authors:Ae(x()),platformId:W(x()),directoryPath:W(x()),auth:W(je([Sa,Ae(Sa)])),version:x(),categories:W(Ae(xe(ha))),minimumSupportedRelease:W(x()),maximumSupportedRelease:W(x()),deprecated:W(Je()),i18n:_V}),PV=xe(["human","ai","both"]),HA=M({description:W(x()),idempotent:W(Je())}),ZA=xe(["READ","SEARCH","WRITE","DESTRUCTIVE"]);var wV=xe(["tabs","section","summary","builder","footer"]),WA=M({key:x(),display:wV,label:W(x()),description:W(x()),icon:W(x()),props:Ae(x())}),KA=M({name:x(),displayName:x(),description:x(),props:TP,propertyGroups:W(Ae(WA)),requireAuth:Je(),errorHandlingOptions:W(Uv),outputSchema:W(Dp()),audience:W(PV),aiMetadata:W(HA),classification:W(ZA)}),JA=M({name:x(),displayName:x(),description:x(),props:TP,propertyGroups:W(Ae(WA)),errorHandlingOptions:W(Uv),type:xe(pn),sampleData:$e(),handshakeConfiguration:W(Dp()),renewConfiguration:W(jA),testStrategy:xe(nu),outputSchema:W(Dp()),aiMetadata:W(HA),classification:W(ZA)}),bV=M({...GA.shape,actions:Ce(x(),KA),triggers:Ce(x(),JA)}),TV=M({...GA.shape,actions:zt(),triggers:zt(),suggestedActions:W(Ae(KA)),suggestedTriggers:W(Ae(JA))}),XA=M({projectUsage:zt(),pieceType:xe(ma),packageType:xe(eu),platformId:W(x()),archiveId:W(x())}),noe=M({...bV.shape,...XA.shape}),ooe=M({...TV.shape,...XA.shape}),ioe=M({name:x(),version:x()});var EV=he(require("path")),SV=he(require("fs/promises"));var Ra=require("node:stream");var Pf=class{constructor(t,n){this.baseUrl=t;this.authenticationConverter=n}static{a(this,"BaseHttpClient")}getUrl(t){let n=new URL(`${this.baseUrl}${t.url}`),o=`${n.origin}${n.pathname}`,r=new URLSearchParams;return n.searchParams.forEach((i,s)=>{r.append(s,i)}),{urlWithoutQueryParams:o,queryParams:r}}getHeaders(t){let n={Accept:"application/json"};return t.authentication&&this.populateAuthentication(t.authentication,n),t.body&&(t.headers?.["Content-Type"]==="text/csv"?n["Content-Type"]="text/csv":n["Content-Type"]="application/json"),t.headers&&(n={...n,...t.headers}),n}populateAuthentication(t,n){this.authenticationConverter.convert(t,n)}};var wf=class{static{a(this,"DelegatingAuthenticationConverter")}constructor(t=new SP,n=new xP){this.converters={BEARER_TOKEN:t,BASIC:n}}convert(t,n){return this.converters[t.type].convert(t,n)}},SP=class{static{a(this,"BearerTokenAuthenticationConverter")}convert(t,n){return n.Authorization=`Bearer ${t.token}`,n}},xP=class{static{a(this,"BasicTokenAuthenticationConverter")}convert(t,n){let o=`${t.username}:${t.password}`,r=Buffer.from(o).toString("base64");return n.Authorization=`Basic ${r}`,n}};var vu=class extends Error{constructor(n,o){let r=o.status||500,i=Buffer.isBuffer(o.responseBody)?o.responseBody.toString():o.responseBody;super(JSON.stringify({response:{status:r,body:i},request:{body:n}}));this.requestBody=n;this.status=r,this.responseBody=i}static{a(this,"HttpError")}errorMessage(){return{response:{status:this.status,body:this.responseBody},request:{body:this.requestBody}}}get response(){return{status:this.status,body:this.responseBody}}get request(){return{body:this.requestBody}}};function YA({error:e,requestBody:t}){return e instanceof vu?e.errorMessage():{response:{status:0,body:e instanceof Error?e.message:String(e)},request:{body:t}}}a(YA,"toFailsafeOutput");var Hn=(s=>(s.GET="GET",s.POST="POST",s.PATCH="PATCH",s.PUT="PUT",s.DELETE="DELETE",s.HEAD="HEAD",s))(Hn||{});var bf=class extends Pf{static{a(this,"FetchHttpClient")}constructor(t="",n=new wf){super(t,n)}async sendRequest(t,n){process.env.NODE_TLS_REJECT_UNAUTHORIZED="0";let{urlWithoutQueryParams:o,queryParams:r}=this.getUrl(t),i=this.getHeaders(t),s=t.queryParams??{};for(let[d,v]of Object.entries(s))r.append(d,v);let u=r.toString(),h=u?`${o}?${u}`:o,g=t.responseType??"json",y=t.followRedirects??!0,T=t.retries??0,{body:b,extraHeaders:P,isStream:S}=Tf(t.method)?IV(t.body,i):{body:void 0,extraHeaders:{},isStream:!1},R=RV({...i,...P}),I=await AV(async()=>{let d=new AbortController,v=t.timeout&&t.timeout>0?setTimeout(()=>d.abort(),t.timeout):void 0;try{let p={method:t.method.toString(),headers:R,body:b,redirect:y?"follow":"manual",signal:d.signal};return S&&(p.duplex="half"),n?.dispatcher!==void 0&&(p.dispatcher=n.dispatcher),await fetch(h,p)}finally{v!==void 0&&clearTimeout(v)}},S?0:T),l=y?300:400;if(I.status<200||I.status>=l){let d=await QA(I,g==="stream"?"text":g),v=new vu(t.redactBodyInErrors===!0?xV:t.body,{status:I.status,responseBody:d});throw console.error("[HttpClient#(sanitized error message)] Request failed:",v),v}let m=await QA(I,g);return{status:I.status,headers:DV(I.headers),body:m}}},xV="[redacted]";function Tf(e){return e!=="GET"&&e!=="HEAD"}a(Tf,"acceptsRequestBody");function IV(e,t){if(tR(e))return{body:void 0,extraHeaders:{},isStream:!1};if($V(e)){let o=OV(e);if(o!==null)return{body:o,extraHeaders:e.getHeaders(),isStream:!1};let r=new Ra.PassThrough;return e.on("error",i=>r.destroy(i)),e.pipe(r),{body:r,extraHeaders:e.getHeaders(),isStream:!0}}return e instanceof Ra.Readable?{body:e,extraHeaders:{},isStream:!0}:typeof e=="string"||Buffer.isBuffer(e)||e instanceof URLSearchParams||e instanceof ArrayBuffer||typeof FormData<"u"&&e instanceof FormData||typeof Blob<"u"&&e instanceof Blob?{body:e,extraHeaders:{},isStream:!1}:(t["Content-Type"]??t["content-type"]??"").includes("application/x-www-form-urlencoded")?{body:new URLSearchParams(e).toString(),extraHeaders:{},isStream:!1}:{body:JSON.stringify(e),extraHeaders:{},isStream:!1}}a(IV,"serializeBody");async function QA(e,t){switch(t){case"arraybuffer":return Buffer.from(await e.arrayBuffer());case"stream":return tR(e.body)?Ra.Readable.from([]):Ra.Readable.fromWeb(e.body);case"blob":return await e.blob();case"text":return await e.text();default:{let n=await e.text();if(n.length===0)return;try{return JSON.parse(n)}catch{return n}}}}a(QA,"parseResponseBody");async function AV(e,t){let n;for(let o=0;o<=t;o++)try{let r=await e();if(r.status>=500&&o<t){await eR(o);continue}return r}catch(r){if(n=r,o<t){await eR(o);continue}throw r}throw n}a(AV,"sendWithRetries");function eR(e){let t=Math.min(1e3*2**e,3e4);return new Promise(n=>setTimeout(n,t))}a(eR,"backoff");function RV(e){let t=new Map;for(let[n,o]of Object.entries(e))o!==void 0&&t.set(n.toLowerCase(),[n,Array.isArray(o)?o.join(", "):o]);return Object.fromEntries(t.values())}a(RV,"normalizeHeaders");function DV(e){let t={};return e.forEach((n,o)=>{t[o]=n}),t}a(DV,"toHttpHeaders");function OV(e){if(!e.hasKnownLength()||e.getLengthSync()>CV)return null;let{data:t}=Gv(()=>e.getBuffer());return t}a(OV,"bufferFormDataIfSafe");function $V(e){return typeof e=="object"&&e!==null&&typeof e.getHeaders=="function"&&typeof e.pipe=="function"&&typeof e.on=="function"}a($V,"isNodeFormData");function tR(e){return e==null}a(tR,"isNil");var CV=100*1024*1024;var Yt=new bf;var P6=he(require("fs"));var w6={"application/json":"json","application/pdf":"pdf","application/xml":"xml","text/xml":"xml","application/zip":"zip","application/gzip":"gz","application/x-tar":"tar","application/octet-stream":"bin","application/msword":"doc","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"docx","application/vnd.ms-excel":"xls","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"xlsx","application/vnd.ms-powerpoint":"ppt","application/vnd.openxmlformats-officedocument.presentationml.presentation":"pptx","application/rtf":"rtf","application/javascript":"js","application/x-www-form-urlencoded":"bin","text/plain":"txt","text/html":"html","text/css":"css","text/csv":"csv","text/calendar":"ics","text/markdown":"md","image/png":"png","image/jpeg":"jpeg","image/jpg":"jpg","image/gif":"gif","image/webp":"webp","image/svg+xml":"svg","image/bmp":"bmp","image/tiff":"tiff","image/x-icon":"ico","image/vnd.microsoft.icon":"ico","image/heic":"heic","audio/mpeg":"mp3","audio/mp4":"m4a","audio/wav":"wav","audio/x-wav":"wav","audio/ogg":"ogg","audio/webm":"weba","video/mp4":"mp4","video/mpeg":"mpeg","video/webm":"webm","video/quicktime":"mov","video/x-msvideo":"avi","font/woff":"woff","font/woff2":"woff2","font/ttf":"ttf","font/otf":"otf"};function b6(e){let t=e.split(";")[0].trim().toLowerCase();return w6[t]??""}a(b6,"contentTypeToExtension");var T6=a(({baseUrl:e,relativePath:t})=>{let n=e.endsWith("/")?e:`${e}/`,o=t.startsWith("/")?t.slice(1):t;return`${n}${o}`},"joinBaseUrlWithRelativePath"),E6=a((e,t)=>{let n="https://api.example.com";try{let o=t?e(t):void 0;return(o?.endsWith("/")?o.slice(0,-1):o)??n}catch{return n}},"getBaseUrlForDescription");function n0({auth:e,baseUrl:t,authMapping:n,description:o,displayName:r,name:i,props:s,extraProps:u,authLocation:h="headers",classification:g="WRITE"}){return re({audience:"human",name:i||"custom_api_call",classification:g,displayName:r||"Custom API Call",description:o||"Make a custom API call to a specific endpoint",auth:e,requireAuth:!!e,props:{url:$.DynamicProperties({auth:e,displayName:"",required:!0,refreshers:[],props:a(async({auth:y})=>({url:$.ShortText({displayName:"URL",description:`Full URL, or a path relative to ${E6(t,y)}`,required:!0,placeholder:"/resource",defaultValue:y?t(y):"",...s?.url??{}})}),"props")}),method:$.StaticDropdown({displayName:"Method",required:!0,defaultValue:"GET",options:{options:Object.values(Hn).map(y=>({label:y,value:y}))},...s?.method??{}}),headers:$.Object({displayName:"Headers",description:"Authorization headers are injected automatically from your connection.",required:!1,...s?.headers??{}}),queryParams:$.Object({displayName:"Query Parameters",description:"Appended to the URL as ?key=value.",required:!1,...s?.queryParams??{}}),body_type:$.Dropdown({auth:e,displayName:"Body Type",required:!1,defaultValue:"none",refreshers:["method"],options:a(async({method:y})=>Tf(y)?{disabled:!1,options:[{label:"None",value:"none"},{label:"JSON",value:"json"},{label:"Form Data",value:"form_data"},{label:"Raw",value:"raw"}]}:{disabled:!0,placeholder:"Not available for GET or HEAD requests",options:[]},"options")}),body:$.DynamicProperties({auth:e,displayName:"Body",refreshers:["body_type","method"],required:!1,props:a(async({body_type:y,method:T})=>{if(!y||!Tf(T))return{};let b=y,P={};switch(b){case"none":break;case"json":P.data=$.Json({displayName:"JSON Body",required:!0,...s?.body??{}});break;case"raw":P.data=$.LongText({displayName:"Raw Body",required:!0});break;case"form_data":P.data=$.Array({displayName:"Form Data",required:!0,properties:{fieldName:$.ShortText({displayName:"Field Name",required:!0}),fieldType:$.StaticDropdown({displayName:"Field Type",required:!0,options:{disabled:!1,options:[{label:"Text",value:"text"},{label:"File",value:"file"}]}}),textFieldValue:$.LongText({displayName:"Text Field Value",required:!1}),fileFieldValue:$.File({displayName:"File Field Value",required:!1})}});break}return P},"props")}),response_is_binary:$.Checkbox({displayName:"Response is Binary",description:"Enable for files like PDFs, images, etc.",required:!1,defaultValue:!1,advanced:!0,...s?.response_is_binary??{}}),failsafe:$.Checkbox({displayName:"Return Error as Output",description:"On a failed request, output the error instead of failing the step.",required:!1,advanced:!0,...s?.failsafe??{}}),timeout:$.Number({displayName:"Timeout",description:"Seconds to wait for a response. Empty: up to the flow limit (10 min).",required:!1,advanced:!0,...s?.timeout??{}}),followRedirects:$.Checkbox({displayName:"Follow redirects",description:"Follow 3xx redirects instead of returning them as the response.",required:!1,defaultValue:!1,advanced:!0,...s?.followRedirects??{}}),...u},propertyGroups:[{key:"request",display:"section",label:"Request",icon:"send",props:["method","url","headers","queryParams"]},{key:"payload",display:"section",label:"Data to send",icon:"code",props:["body_type","body"]}],run:a(async y=>{let{method:T,url:b,headers:P,queryParams:S,body:R,body_type:I,failsafe:l,timeout:m,response_is_binary:d,followRedirects:v}=y.propsValue;kp(T,"Method"),kp(b,"URL");let p=yt(n)?{}:await n(y.auth,y.propsValue),E=b.url,_=E.startsWith("http://")||E.startsWith("https://")?E:T6({baseUrl:t(y.auth),relativePath:E}),pe={method:T,url:_,headers:{...P??{},...h==="headers"||!yt(h)?p:{}},queryParams:{...h==="queryParams"?p:{},...S??{}},timeout:m?m*1e3:0,followRedirects:v};if(d&&(pe.responseType="arraybuffer"),R)if(I&&I!=="none"){let oe=R.data;if(I==="form_data"){let Be=oe,{default:me}=await Promise.resolve().then(()=>he(Tu())),ee=new me;for(let{fieldName:Q,fieldType:se,textFieldValue:ne,fileFieldValue:ge}of Be)se==="text"&&!ou(ne)?ee.append(Q,ne):se==="file"&&!ou(ge)&&ee.append(Q,ge.data,{filename:ge?.filename});pe.body=ee,pe.headers={...pe.headers,...ee.getHeaders()}}else pe.body=oe}else I||(pe.body=R);try{let oe=await Yt.sendRequest(pe);return await S6(y.files,oe.body,oe.status,oe.headers,d)}catch(oe){if(l)return YA({error:oe,requestBody:pe.body});throw oe}},"run")})}a(n0,"createCustomApiCallAction");var S6=a(async(e,t,n,o,r)=>{let i;if(r&&x6(t)){let s=Array.isArray(o?.["content-type"])?o["content-type"][0]:o?.["content-type"],u=b6(s??"")||"txt",h;t instanceof ArrayBuffer?h=Buffer.from(new Uint8Array(t)):Buffer.isBuffer(t)?h=t:h=Buffer.from(t),i=await e.write({fileName:`output.${u}`,data:h})}else i=t;return{status:n,headers:o,body:i}},"handleBinaryResponse"),x6=a(e=>e instanceof ArrayBuffer||Buffer.isBuffer(e),"isBinaryBody");var Qt={async poll(e,{store:t,auth:n,propsValue:o,maxItemsToPoll:r,files:i,server:s}){switch(e.strategy){case 0:{let u=await t.get("lastPoll");if(yt(u))throw new Error("lastPoll doesn't exist in the store.");let h=await e.items({store:t,auth:n,propsValue:o,lastFetchEpochMS:u,server:s}),g=h.reduce((y,T)=>Math.max(y,T.epochMilliSeconds),u);return await t.put("lastPoll",g),h.filter(y=>y.epochMilliSeconds>u).map(y=>y.data)}case 1:{let u=await t.get("lastItem"),h=await e.items({store:t,auth:n,propsValue:o,lastItemId:u,files:i,server:s}),g=h.findIndex(b=>b.id===u),y=[];yt(u)||g==-1?y=h??[]:y=h?.slice(0,g)??[],yt(r)||(y=y.slice(-r));let T=y?.[0]?.id;return yt(T)||await t.put("lastItem",T),y.map(b=>b.data)}}},async onEnable(e,{store:t,auth:n,propsValue:o,server:r,isRepublish:i}){switch(e.strategy){case 0:{if(i&&!yt(await t.get("lastPoll")))break;await t.put("lastPoll",Date.now());break}case 1:{if(i&&!yt(await t.get("lastItem")))break;let u=(await e.items({store:t,auth:n,propsValue:o,lastItemId:null,server:r}))?.[0]?.id;yt(u)?await t.delete("lastItem"):await t.put("lastItem",u);break}}},async onDisable(e,t){switch(e.strategy){case 0:case 1:return}},async test(e,{auth:t,propsValue:n,store:o,files:r,server:i}){let s=[];switch(e.strategy){case 0:{s=await e.items({store:o,auth:t,propsValue:n,lastFetchEpochMS:0,server:i});break}case 1:{s=await e.items({store:o,auth:t,propsValue:n,lastItemId:null,files:r,server:i});break}}return I6(s.map(u=>u.data))}};function I6(e){return e.length<=5?e:e.slice(0,5)}a(I6,"getFirstFiveOrAll");var o0=require("node:stream");function A6(e){return"body"in e?{body:e.body,size:e.size}:{body:o0.Readable.from(e.data),size:e.data.length}}a(A6,"toStreamingBody");async function*R6({readable:e,chunkSize:t}){let n=[],o=0;for await(let r of e)for(n.push(Buffer.isBuffer(r)?r:Buffer.from(r)),o+=n[n.length-1].length;o>=t;){let i=n.length===1?n[0]:Buffer.concat(n);yield i.subarray(0,t);let s=i.subarray(t);n=s.length>0?[s]:[],o=s.length}o>0&&(yield n.length===1?n[0]:Buffer.concat(n))}a(R6,"readChunks");var i0={readChunks:R6,toStreamingBody:A6};var Wm=he(tl());var dN=["https://www.googleapis.com/auth/drive","email"],Y=[xa.OAuth2({description:"",authUrl:"https://accounts.google.com/o/oauth2/auth",tokenUrl:"https://oauth2.googleapis.com/token",required:!0,scope:dN}),xa.CustomAuth({displayName:"Service Account (Advanced)",description:"Authenticate via service account from https://console.cloud.google.com/ > IAM & Admin > Service Accounts > Create Service Account > Keys > Add key. <br> <br> You can optionally use domain-wide delegation (https://support.google.com/a/answer/162106?hl=en#zippy=%2Cset-up-domain-wide-delegation-for-a-client) to access files without adding the service account to each one. <br> <br> **Note:** Without a user email, the service account only has access to files/folders you explicitly share with it.",required:!0,props:{serviceAccount:$.LongText({displayName:"Service Account JSON Key",required:!0}),userEmail:$.ShortText({displayName:"User Email",required:!1,description:"Email address of the user to impersonate for domain-wide delegation."})},validate:a(async({auth:e})=>{try{await bt({type:"CUSTOM_AUTH",props:{...e}})}catch(t){return{valid:!1,error:t.message}}return{valid:!0}},"validate")})];async function de(e){if(e.type==="CUSTOM_AUTH"){let n;try{n=JSON.parse(e.props.serviceAccount)}catch{throw new Error("Invalid Service Account JSON Key. Please provide a valid JSON string.")}return new Wm.JWT({email:n.client_email,key:n.private_key,scopes:dN,subject:e.props.userEmail})}let t=new Wm.OAuth2Client;return t.setCredentials({access_token:e.access_token}),t}a(de,"createGoogleClient");var bt=a(async e=>{if(e.type==="CUSTOM_AUTH"){let n=await(await de(e)).getAccessToken();if(n.token)return n.token;throw new Error("Could not retrieve access token from service account json")}return e.access_token},"getAccessToken");var Dz=he(ze());var fh=he(fl()),JT=he(ze());var _J=1e3,ml=a(e=>e.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),"escapeDriveQueryLiteral");async function Ok({auth:e,searchValue:t,includeTeamDrives:n}){if(!e)return{disabled:!0,options:[],placeholder:"Connect your Google account first"};let o=await bt(e),r=t?.trim()??"",i=["mimeType='application/vnd.google-apps.folder'","trashed = false"];r.length>0&&i.push(`name contains '${ml(r)}'`);let s={method:"GET",url:"https://www.googleapis.com/drive/v3/files",queryParams:{q:i.join(" and "),includeItemsFromAllDrives:n?"true":"false",supportsAllDrives:"true",corpora:n?"allDrives":"user",pageSize:String(_J),fields:"nextPageToken, files(id, name)"},authentication:{type:"BEARER_TOKEN",token:o}},u=[],h=!1;try{let g=await Yt.sendRequest(s);u=g.body.files??[],h=!!g.body.nextPageToken}catch(g){throw new Error(`Failed to get folders
|
|
108
108
|
Error:${g}`)}return{disabled:!1,placeholder:h?`Showing the first ${u.length} matches. Type to narrow the list, or paste an ID with Dynamic value.`:void 0,options:u.map(g=>({label:g.name,value:g.id}))}}a(Ok,"fetchFolderDropdownOptions");function Dk({displayName:e,description:t}){return $.Dropdown({displayName:e,description:t,required:!1,auth:Y,refreshers:["include_team_drives"],refreshOnSearch:!0,options:a(async({auth:n,include_team_drives:o},r)=>Ok({auth:n,searchValue:r?.searchValue,includeTeamDrives:o}),"options")})}a(Dk,"parentFolderDropdown");var Ne={properties:{parentFolder:Dk({displayName:"Parent Folder",description:"Leave empty for the root of My Drive. Type to search by folder name."}),include_team_drives:$.Checkbox({displayName:"Include Team Drives",description:"Also include shared drives, not only My Drive.",defaultValue:!1,required:!1})},parentFolderDropdown:Dk,escapeDriveQueryLiteral:ml,fetchFolderDropdownOptions:Ok,async getFiles(e,t,n){let o=await de(e),r=(0,JT.drive)({version:"v3",auth:o}),i=[];if(t?.parent&&i.push(`'${ml(t.parent)}' in parents`),t?.createdTime&&i.push(`createdTime ${t.createdTimeOp??">"} '${(0,fh.default)(t.createdTime).format()}'`),t?.changedSince){let g=(0,fh.default)(t.changedSince).format();i.push(`(modifiedTime > '${g}' or createdTime > '${g}')`)}t?.mimeTypes?.length&&i.push(`(${t.mimeTypes.map(g=>`mimeType='${ml(g)}'`).join(" or ")})`),t?.excludeShortcuts&&i.push("mimeType!='application/vnd.google-apps.shortcut'"),i.push("trashed = false");let s=[],u,h=0;do{let g={q:i.concat("mimeType!='application/vnd.google-apps.folder'").join(" and "),fields:"nextPageToken, files(id, name, mimeType, webViewLink, kind, createdTime, modifiedTime)",orderBy:n??"createdTime desc",supportsAllDrives:!0,includeItemsFromAllDrives:t?.includeTeamDrive,corpora:t?.includeTeamDrive?"allDrives":"user"};u&&(g.pageToken=u);let y=await r.files.list(g);if(s.push(...y.data.files??[]),u=y.data.nextPageToken??void 0,h+=1,t?.maxPages&&h>=t.maxPages)break}while(u);return s},async getFolders(e,t,n){let o=await de(e),r=(0,JT.drive)({version:"v3",auth:o}),i=["mimeType='application/vnd.google-apps.folder'"];t?.parent&&i.push(`'${ml(t.parent)}' in parents`),t?.createdTime&&i.push(`createdTime ${t.createdTimeOp??">"} '${(0,fh.default)(t.createdTime).format()}'`),i.push("trashed = false");let s=[],u;do{let h={q:i.join(" and "),fields:"nextPageToken, files(id, name, createdTime)",orderBy:n??"createdTime desc",supportsAllDrives:!0,includeItemsFromAllDrives:t?.includeTeamDrive,corpora:t?.includeTeamDrive?"allDrives":"user"};u&&(h.pageToken=u);let g=await r.files.list(h);s.push(...g.data.files??[]),u=g.data.nextPageToken??void 0}while(u);return s}};var $k={fields:[{key:"name",label:"Folder Name"},{key:"id",label:"Folder ID"},{key:"mimeType",label:"MIME Type"},{key:"kind",label:"Kind"}]},Ck={fields:[{key:"name",label:"File Name"},{key:"id",label:"File ID"},{key:"mimeType",label:"MIME Type"},{key:"kind",label:"Kind"}]},Nk={fields:[{key:"name",label:"File Name"},{key:"id",label:"File ID"},{key:"mimeType",label:"MIME Type"},{key:"kind",label:"Kind"}]},kk={fields:[{key:"file",label:"File URL",value:"",format:"url"}]},zk={fields:[{key:"name",label:"Name"},{key:"id",label:"File ID"},{key:"mimeType",label:"MIME Type"},{key:"kind",label:"Kind"}]},Uk={fields:[{key:"files",label:"Files",labelKey:"name",listItems:[{key:"name",label:"Name",value:"name"},{key:"id",label:"File ID",value:"id"},{key:"mimeType",label:"MIME Type",value:"mimeType"},{key:"trashed",label:"Trashed",value:"trashed",format:"boolean"},{key:"parents",label:"Parent Folder ID",value:"parents[0]"},{key:"downloadedFile",label:"Downloaded File URL",value:"downloadedFile",format:"url"}]},{key:"incompleteSearch",label:"Incomplete Search",value:"incompleteSearch",format:"boolean"}]},Mk={fields:[{key:"results",label:"Results",value:"",labelKey:"name",listItems:[{key:"name",label:"Name",value:"name"},{key:"mimeType",label:"MIME Type",value:"mimeType"},{key:"id",label:"File ID",value:"id"},{key:"createdTime",label:"Created Time",value:"createdTime",format:"datetime"},{key:"modifiedTime",label:"Modified Time",value:"modifiedTime",format:"datetime"}]}]},Fk={fields:[{key:"name",label:"File Name"},{key:"id",label:"File ID"},{key:"mimeType",label:"MIME Type"},{key:"kind",label:"Kind"}]},Lk={fields:[{key:"name",label:"File Name"},{key:"id",label:"File ID"},{key:"mimeType",label:"MIME Type"},{key:"kind",label:"Kind"}]},jk={fields:[{key:"name",label:"File Name"},{key:"id",label:"File ID"},{key:"mimeType",label:"MIME Type"},{key:"webViewLink",label:"View Link",format:"url"},{key:"webContentLink",label:"Download Link",format:"url"},{key:"iconLink",label:"Icon",format:"image"},{key:"size",label:"Size",format:"filesize"},{key:"fileExtension",label:"File Extension"},{key:"starred",label:"Starred",format:"boolean"},{key:"trashed",label:"Trashed",format:"boolean"},{key:"shared",label:"Shared",format:"boolean"},{key:"createdTime",label:"Created Time",format:"datetime"},{key:"modifiedTime",label:"Modified Time",format:"datetime"},{key:"parents",label:"Parent Folder IDs"},{key:"owners",label:"Owners",labelKey:"displayName",listItems:[{key:"displayName",label:"Name"},{key:"emailAddress",label:"Email",format:"email"},{key:"photoLink",label:"Photo",format:"image"},{key:"me",label:"Is Me",format:"boolean"}]},{key:"lastModifyingUser",label:"Last Modifying User",children:[{key:"displayName",label:"Name"},{key:"emailAddress",label:"Email",format:"email"},{key:"photoLink",label:"Photo",format:"image"}]},{key:"permissions",label:"Permissions",labelKey:"displayName",listItems:[{key:"displayName",label:"Name"},{key:"emailAddress",label:"Email",format:"email"},{key:"role",label:"Role"},{key:"type",label:"Type"},{key:"id",label:"Permission ID"}]}]},qk={fields:[{key:"type",label:"Type"},{key:"role",label:"Role"},{key:"id",label:"Permission ID"},{key:"allowFileDiscovery",label:"Allow File Discovery",format:"boolean"},{key:"downloadUrl",label:"Download URL",format:"url"},{key:"kind",label:"Kind"}]},Bk={fields:[{key:"role",label:"Role"},{key:"type",label:"Type"},{key:"id",label:"Permission ID"}]},Vk={fields:[{key:"removed",label:"Removed",value:"removed",format:"boolean"},{key:"message",label:"Message",value:"message"}]},Gk={fields:[{key:"name",label:"File Name"},{key:"id",label:"File ID"},{key:"mimeType",label:"MIME Type"},{key:"kind",label:"Kind"}]},Hk={fields:[{key:"name",label:"File Name"},{key:"modifiedTime",label:"Modified Time",format:"datetime"},{key:"webViewLink",label:"View Link",format:"url"},{key:"mimeType",label:"MIME Type"},{key:"createdTime",label:"Created Time",format:"datetime"},{key:"id",label:"File ID"}]},Zk={fields:[{key:"changeType",label:"Change Type"},{key:"content",label:"File Content"},{key:"contentError",label:"File Content Error"},{key:"name",label:"File Name"},{key:"webViewLink",label:"View Link",format:"url"},{key:"mimeType",label:"MIME Type"},{key:"createdTime",label:"Created Time",format:"datetime"},{key:"modifiedTime",label:"Modified Time",format:"datetime"},{key:"id",label:"File ID"}]},Wk={fields:[{key:"name",label:"Folder Name"},{key:"id",label:"Folder ID"},{key:"createdTime",label:"Created Time",format:"datetime"}]},PJ=[{key:"id",label:"File ID"},{key:"name",label:"File Name"},{key:"mimeType",label:"MIME Type"},{key:"size",label:"Size",format:"filesize"},{key:"createdTime",label:"Created Time",format:"datetime"},{key:"modifiedTime",label:"Modified Time",format:"datetime"},{key:"webViewLink",label:"View Link",format:"url"},{key:"webContentLink",label:"Download Link",format:"url"},{key:"iconLink",label:"Icon",format:"image"},{key:"fileExtension",label:"File Extension"},{key:"starred",label:"Starred",format:"boolean"},{key:"trashed",label:"Trashed",format:"boolean"},{key:"shared",label:"Shared",format:"boolean"},{key:"parents",label:"Parent Folder IDs"},{key:"owners",label:"Owners",labelKey:"displayName",listItems:[{key:"displayName",label:"Name"},{key:"emailAddress",label:"Email",format:"email"},{key:"photoLink",label:"Photo",format:"image"},{key:"me",label:"Is Me",format:"boolean"}]},{key:"lastModifyingUser",label:"Last Modifying User",children:[{key:"displayName",label:"Name"},{key:"emailAddress",label:"Email",format:"email"},{key:"photoLink",label:"Photo",format:"image"}]}],Kk={fields:PJ},Jk={fields:[{key:"files",label:"Files",labelKey:"name",listItems:[{key:"id",label:"File ID"},{key:"name",label:"File Name"},{key:"mimeType",label:"MIME Type"},{key:"size",label:"Size",format:"filesize"},{key:"createdTime",label:"Created Time",format:"datetime"},{key:"modifiedTime",label:"Modified Time",format:"datetime"},{key:"webViewLink",label:"View Link",format:"url"},{key:"webContentLink",label:"Download Link",format:"url"},{key:"fileExtension",label:"File Extension"},{key:"starred",label:"Starred",format:"boolean"},{key:"trashed",label:"Trashed",format:"boolean"},{key:"shared",label:"Shared",format:"boolean"},{key:"downloadedFile",label:"Downloaded File URL",format:"url"}]},{key:"incompleteSearch",label:"Incomplete Search",format:"boolean"}]},Xk={fields:[{key:"files",label:"Search Results",labelKey:"name",listItems:[{key:"id",label:"File ID"},{key:"name",label:"File Name"},{key:"mimeType",label:"MIME Type"},{key:"size",label:"Size",format:"filesize"},{key:"createdTime",label:"Created Time",format:"datetime"},{key:"modifiedTime",label:"Modified Time",format:"datetime"},{key:"webViewLink",label:"View Link",format:"url"},{key:"webContentLink",label:"Download Link",format:"url"},{key:"fileExtension",label:"File Extension"}]}]},Yk={fields:[{key:"id",label:"File ID"},{key:"name",label:"File Name"},{key:"mimeType",label:"MIME Type"},{key:"createdTime",label:"Created Time",format:"datetime"},{key:"modifiedTime",label:"Modified Time",format:"datetime"},{key:"webViewLink",label:"View Link",format:"url"},{key:"webContentLink",label:"Download Link",format:"url"},{key:"fileExtension",label:"File Extension"},{key:"size",label:"Size",format:"filesize"},{key:"parents",label:"Parent Folder IDs"},{key:"owners",label:"Owners",labelKey:"displayName",listItems:[{key:"displayName",label:"Name"},{key:"emailAddress",label:"Email",format:"email"},{key:"photoLink",label:"Photo",format:"image"},{key:"me",label:"Is Me",format:"boolean"}]},{key:"lastModifyingUser",label:"Last Modifying User",children:[{key:"displayName",label:"Name"},{key:"emailAddress",label:"Email",format:"email"},{key:"photoLink",label:"Photo",format:"image"}]},{key:"shared",label:"Shared",format:"boolean"}]},Qk={fields:[{key:"id",label:"File ID"},{key:"name",label:"File Name"},{key:"mimeType",label:"MIME Type"},{key:"size",label:"Size",format:"filesize"},{key:"createdTime",label:"Created Time",format:"datetime"},{key:"modifiedTime",label:"Modified Time",format:"datetime"},{key:"webViewLink",label:"View Link",format:"url"},{key:"webContentLink",label:"Download Link",format:"url"},{key:"iconLink",label:"Icon",format:"image"},{key:"fileExtension",label:"File Extension"},{key:"parents",label:"Parent Folder IDs"},{key:"owners",label:"Owners",labelKey:"displayName",listItems:[{key:"displayName",label:"Name"},{key:"emailAddress",label:"Email",format:"email"},{key:"me",label:"Is Me",format:"boolean"}]}]},ez={fields:[{key:"id",label:"File ID"},{key:"name",label:"File Name"},{key:"mimeType",label:"MIME Type"},{key:"size",label:"Size",format:"filesize"},{key:"createdTime",label:"Created Time",format:"datetime"},{key:"modifiedTime",label:"Modified Time",format:"datetime"},{key:"webViewLink",label:"View Link",format:"url"},{key:"webContentLink",label:"Download Link",format:"url"},{key:"fileExtension",label:"File Extension"},{key:"parents",label:"Parent Folder IDs"},{key:"owners",label:"Owners",labelKey:"displayName",listItems:[{key:"displayName",label:"Name"},{key:"emailAddress",label:"Email",format:"email"},{key:"me",label:"Is Me",format:"boolean"}]}]},tz={fields:[{key:"id",label:"File ID"},{key:"name",label:"File Name"},{key:"mimeType",label:"MIME Type"},{key:"size",label:"Size",format:"filesize"},{key:"createdTime",label:"Created Time",format:"datetime"},{key:"modifiedTime",label:"Modified Time",format:"datetime"},{key:"webViewLink",label:"View Link",format:"url"},{key:"webContentLink",label:"Download Link",format:"url"},{key:"fileExtension",label:"File Extension"},{key:"parents",label:"Parent Folder IDs"},{key:"shared",label:"Shared",format:"boolean"},{key:"owners",label:"Owners",labelKey:"displayName",listItems:[{key:"displayName",label:"Name"},{key:"emailAddress",label:"Email",format:"email"},{key:"me",label:"Is Me",format:"boolean"}]}]},rz={fields:[{key:"id",label:"File ID"},{key:"name",label:"File Name"},{key:"description",label:"Description"},{key:"mimeType",label:"MIME Type"},{key:"createdTime",label:"Created Time",format:"datetime"},{key:"modifiedTime",label:"Modified Time",format:"datetime"},{key:"starred",label:"Starred",format:"boolean"},{key:"trashed",label:"Trashed",format:"boolean"},{key:"webViewLink",label:"View Link",format:"url"},{key:"size",label:"Size",format:"filesize"}]},nz={fields:[{key:"id",label:"Permission ID"},{key:"type",label:"Type"},{key:"role",label:"Role"},{key:"emailAddress",label:"Email Address",format:"email"},{key:"displayName",label:"Display Name"},{key:"photoLink",label:"Photo",format:"image"},{key:"pendingOwner",label:"Pending Owner",format:"boolean"},{key:"deleted",label:"Deleted",format:"boolean"},{key:"permissionDetails",label:"Permission Details",labelKey:"role",listItems:[{key:"role",label:"Role"},{key:"permissionType",label:"Permission Type"},{key:"inherited",label:"Inherited",format:"boolean"}]}]},oz={fields:[{key:"permissions",label:"Permissions",labelKey:"displayName",listItems:[{key:"id",label:"Permission ID"},{key:"type",label:"Type"},{key:"role",label:"Role"},{key:"emailAddress",label:"Email Address",format:"email"},{key:"displayName",label:"Display Name"},{key:"photoLink",label:"Photo",format:"image"},{key:"deleted",label:"Deleted",format:"boolean"},{key:"pendingOwner",label:"Pending Owner",format:"boolean"}]}]},iz={fields:[{key:"id",label:"Permission ID"},{key:"type",label:"Type"},{key:"role",label:"Role"},{key:"allowFileDiscovery",label:"Allow File Discovery",format:"boolean"},{key:"permissionDetails",label:"Permission Details",labelKey:"role",listItems:[{key:"role",label:"Role"},{key:"permissionType",label:"Permission Type"},{key:"inherited",label:"Inherited",format:"boolean"}]}]},az={fields:[{key:"id",label:"Permission ID"},{key:"type",label:"Type"},{key:"role",label:"Role"},{key:"emailAddress",label:"Email Address",format:"email"},{key:"displayName",label:"Display Name"},{key:"photoLink",label:"Photo",format:"image"}]},sz={fields:[{key:"id",label:"File ID"},{key:"name",label:"File Name"},{key:"trashed",label:"Trashed",format:"boolean"},{key:"modifiedTime",label:"Modified Time",format:"datetime"},{key:"webViewLink",label:"View Link",format:"url"}]},cz={fields:[{key:"id",label:"File ID"},{key:"name",label:"File Name"},{key:"trashed",label:"Trashed",format:"boolean"},{key:"createdTime",label:"Created Time",format:"datetime"},{key:"modifiedTime",label:"Modified Time",format:"datetime"},{key:"webViewLink",label:"View Link",format:"url"}]},uz={fields:[{key:"id",label:"File ID"},{key:"name",label:"File Name"},{key:"mimeType",label:"MIME Type"},{key:"size",label:"Size",format:"filesize"},{key:"modifiedTime",label:"Modified Time",format:"datetime"},{key:"webViewLink",label:"View Link",format:"url"}]},lz={fields:[{key:"user",label:"Current User",children:[{key:"displayName",label:"Display Name"},{key:"emailAddress",label:"Email Address",format:"email"},{key:"photoLink",label:"Photo",format:"image"},{key:"me",label:"Is Me",format:"boolean"},{key:"permissionId",label:"Permission ID"}]},{key:"storageQuota",label:"Storage Quota",children:[{key:"limit",label:"Total Limit",format:"filesize"},{key:"usage",label:"Used Space",format:"filesize"},{key:"usageInDrive",label:"Used in Drive",format:"filesize"},{key:"usageInDriveTrash",label:"Used in Trash",format:"filesize"}]},{key:"maxUploadSize",label:"Max Upload Size",format:"filesize"}]},dz={fields:[{key:"drives",label:"Shared Drives",labelKey:"name",listItems:[{key:"id",label:"Drive ID"},{key:"name",label:"Drive Name"},{key:"kind",label:"Kind"},{key:"colorRgb",label:"Color"},{key:"createdTime",label:"Created Time",format:"datetime"}]}]},pz={fields:[{key:"id",label:"Drive ID"},{key:"name",label:"Drive Name"},{key:"kind",label:"Kind"},{key:"colorRgb",label:"Color"},{key:"createdTime",label:"Created Time",format:"datetime"},{key:"restrictions",label:"Restrictions",children:[{key:"adminManagedRestrictions",label:"Admin Managed",format:"boolean"},{key:"copyRequiresWriterPermission",label:"Copy Requires Writer Permission",format:"boolean"},{key:"domainUsersOnly",label:"Domain Users Only",format:"boolean"},{key:"driveMembersOnly",label:"Drive Members Only",format:"boolean"}]}]},fz={fields:[{key:"comments",label:"Comments",labelKey:"content",listItems:[{key:"id",label:"Comment ID"},{key:"content",label:"Content"},{key:"createdTime",label:"Created Time",format:"datetime"},{key:"modifiedTime",label:"Modified Time",format:"datetime"},{key:"author",label:"Author",children:[{key:"displayName",label:"Name"},{key:"emailAddress",label:"Email",format:"email"},{key:"photoLink",label:"Photo",format:"image"}]}]}]},mz={fields:[{key:"id",label:"Reply ID"},{key:"content",label:"Content"},{key:"createdTime",label:"Created Time",format:"datetime"},{key:"modifiedTime",label:"Modified Time",format:"datetime"},{key:"author",label:"Author",children:[{key:"displayName",label:"Name"},{key:"emailAddress",label:"Email",format:"email"},{key:"photoLink",label:"Photo",format:"image"},{key:"me",label:"Is Me",format:"boolean"}]}]},hz={fields:[{key:"id",label:"Comment ID"},{key:"content",label:"Content"},{key:"createdTime",label:"Created Time",format:"datetime"},{key:"modifiedTime",label:"Modified Time",format:"datetime"},{key:"author",label:"Author",children:[{key:"displayName",label:"Name"},{key:"emailAddress",label:"Email",format:"email"},{key:"photoLink",label:"Photo",format:"image"},{key:"me",label:"Is Me",format:"boolean"}]}]},gz={fields:[{key:"id",label:"Reply ID"},{key:"content",label:"Content"},{key:"htmlContent",label:"HTML Content",format:"html"},{key:"createdTime",label:"Created Time",format:"datetime"},{key:"modifiedTime",label:"Modified Time",format:"datetime"},{key:"deleted",label:"Deleted",format:"boolean"},{key:"author",label:"Author",children:[{key:"displayName",label:"Name"},{key:"emailAddress",label:"Email",format:"email"},{key:"photoLink",label:"Photo",format:"image"},{key:"me",label:"Is Me",format:"boolean"}]}]},yz={fields:[{key:"replies",label:"Replies",labelKey:"content",listItems:[{key:"id",label:"Reply ID"},{key:"content",label:"Content"},{key:"createdTime",label:"Created Time",format:"datetime"},{key:"modifiedTime",label:"Modified Time",format:"datetime"},{key:"deleted",label:"Deleted",format:"boolean"},{key:"author",label:"Author",children:[{key:"displayName",label:"Name"},{key:"emailAddress",label:"Email",format:"email"},{key:"photoLink",label:"Photo",format:"image"}]}]}]},vz={fields:[{key:"id",label:"Reply ID"},{key:"content",label:"Content"},{key:"modifiedTime",label:"Modified Time",format:"datetime"},{key:"deleted",label:"Deleted",format:"boolean"},{key:"author",label:"Author",children:[{key:"displayName",label:"Name"},{key:"emailAddress",label:"Email",format:"email"},{key:"photoLink",label:"Photo",format:"image"},{key:"me",label:"Is Me",format:"boolean"}]}]},_z={fields:[{key:"id",label:"File ID"},{key:"name",label:"File Name"},{key:"mimeType",label:"MIME Type"},{key:"size",label:"Size",format:"filesize"},{key:"createdTime",label:"Created Time",format:"datetime"},{key:"modifiedTime",label:"Modified Time",format:"datetime"},{key:"webViewLink",label:"View Link",format:"url"}]},Pz={fields:[{key:"id",label:"Folder ID"},{key:"name",label:"Folder Name"},{key:"mimeType",label:"MIME Type"},{key:"kind",label:"Kind"},{key:"createdTime",label:"Created Time",format:"datetime"},{key:"parents",label:"Parent Folder IDs"},{key:"webViewLink",label:"View Link",format:"url"}]},wz={fields:[{key:"id",label:"Drive ID"},{key:"name",label:"Drive Name"},{key:"kind",label:"Kind"},{key:"colorRgb",label:"Color"},{key:"createdTime",label:"Created Time",format:"datetime"}]},bz={fields:[{key:"id",label:"Drive ID"},{key:"name",label:"Drive Name"},{key:"kind",label:"Kind"},{key:"colorRgb",label:"Color"},{key:"createdTime",label:"Created Time",format:"datetime"}]},Tz={fields:[{key:"id",label:"File ID"},{key:"name",label:"File Name"},{key:"mimeType",label:"MIME Type"},{key:"kind",label:"Kind"}]},Ez={fields:[{key:"file",label:"File URL",value:"",format:"url"}]},Sz={fields:[{key:"file",label:"File URL",value:"",format:"url"}]},xz={fields:[{key:"success",label:"Success",format:"boolean"},{key:"reply_id",label:"Reply ID"}]},Iz={fields:[{key:"deleted",label:"Deleted",format:"boolean"},{key:"driveId",label:"Drive ID"}]},Az={fields:[{key:"success",label:"Success",format:"boolean"},{key:"driveId",label:"Drive ID"}]},Rz={fields:[{key:"removed",label:"Removed",format:"boolean"},{key:"message",label:"Message"}]};var Oz=re({auth:Y,name:"update_permissions",classification:"WRITE",description:"Give a person a role on a file or folder by email.",audience:"human",aiMetadata:{description:"Grants a specified role (reader, commenter, writer, fileOrganizer, or organizer) on a Drive file or folder to a user identified by email, optionally sending a notification email. Use to share a resource with a person. Requires the file/folder ID and target email. Not idempotent: each call creates a new permission grant.",idempotent:!1},displayName:"Share File or Folder",propertyGroups:[{key:"item",display:"section",label:"What to share",icon:"file",props:["fileId","include_team_drives"]},{key:"access",display:"section",label:"Who gets access",icon:"user",props:["user_email","permission_name","send_invitation_email"]}],props:{fileId:$.ShortText({displayName:"File or Folder ID",description:"The ID from the item's Drive URL or an earlier step.",required:!0,placeholder:"1dpv4-sKJfKRwI9qx1vWqQhEGEn3EpbI5"}),user_email:$.ShortText({displayName:"User Email",description:"The person who receives the access.",required:!0,placeholder:"name@example.com"}),permission_name:$.StaticDropdown({displayName:"Role",description:"What the person can do. Manager roles apply to shared drives only.",required:!0,options:{options:[{label:"Manager",value:"organizer"},{label:"Content Manager",value:"fileOrganizer"},{label:"Editor",value:"writer"},{label:"Commenter",value:"commenter"},{label:"Viewer",value:"reader"}]}}),send_invitation_email:$.Checkbox({displayName:"Send Invitation Email",description:"Email the person that they now have access.",required:!0}),include_team_drives:Ne.properties.include_team_drives},outputSchema:Bk,async run(e){let{fileId:t,user_email:n,permission_name:o,send_invitation_email:r,include_team_drives:i}=e.propsValue,s=await de(e.auth),u=(0,Dz.drive)({version:"v3",auth:s}),h={type:"user",role:o,emailAddress:n};return(await u.permissions.create({requestBody:h,fileId:t,sendNotificationEmail:r,supportsAllDrives:i})).data}});var $z=he(ze());var Cz=re({auth:Y,name:"create_new_gdrive_folder",classification:"WRITE",description:"Create an empty folder in Google Drive.",audience:"human",aiMetadata:{description:"Creates a new empty folder in Google Drive, optionally nested under a parent folder. Use to set up a destination before uploading or moving files. Not idempotent: each call creates a distinct folder even with the same name (Drive permits duplicate folder names).",idempotent:!1},displayName:"Create Folder",props:{folderName:$.ShortText({displayName:"Folder Name",required:!0,placeholder:"Invoices 2026"}),parentFolder:Ne.properties.parentFolder,include_team_drives:Ne.properties.include_team_drives},outputSchema:$k,async run(e){let t=await de(e.auth);return(await(0,$z.drive)({version:"v3",auth:t}).files.create({requestBody:{mimeType:"application/vnd.google-apps.folder",name:e.propsValue.folderName,...e.propsValue.parentFolder?{parents:[e.propsValue.parentFolder]}:{}},supportsAllDrives:e.propsValue.include_team_drives})).data}});var Nz=he(ze());var kz=re({auth:Y,name:"create_new_gdrive_file",classification:"WRITE",description:"Create a text, CSV or XML file from text you enter.",audience:"human",aiMetadata:{description:"Creates a new file in Google Drive from inline text content as plain text, CSV, or XML, optionally inside a parent folder. Use when an agent has generated text it needs to persist as a Drive file. Not idempotent: each call creates a new file.",idempotent:!1},displayName:"Create File from Text",propertyGroups:[{key:"file",display:"section",label:"New file",icon:"file",props:["fileName","text","fileType"]},{key:"destination",display:"section",label:"Save to",icon:"location",props:["parentFolder","include_team_drives"]}],props:{fileName:$.ShortText({displayName:"File Name",description:"Include the extension, for example report.csv.",required:!0,placeholder:"report.txt"}),text:$.LongText({displayName:"Content",description:"The text written into the file.",required:!0}),fileType:$.StaticDropdown({displayName:"File Type",description:"Plain text, CSV or XML. Match the extension in the file name.",required:!0,defaultValue:"text/plain",options:{options:[{label:"Plain Text (TXT)",value:"text/plain"},{label:"CSV",value:"text/csv"},{label:"XML",value:"text/xml"}]}}),parentFolder:Ne.properties.parentFolder,include_team_drives:Ne.properties.include_team_drives},outputSchema:Ck,async run(e){let t=await de(e.auth),n=(0,Nz.drive)({version:"v3",auth:t}),o=e.propsValue.fileType==="plain/text"?"text/plain":e.propsValue.fileType;return(await n.files.create({requestBody:{name:e.propsValue.fileName,mimeType:o,...e.propsValue.parentFolder?{parents:[e.propsValue.parentFolder]}:{}},media:{mimeType:o,body:e.propsValue.text},supportsAllDrives:e.propsValue.include_team_drives??!1,fields:"id, name, mimeType, kind"})).data}});var zz=he(ze());var Uz=re({auth:Y,name:"delete_permissions",classification:"DESTRUCTIVE",description:"Remove a person's role from a file or folder.",audience:"human",aiMetadata:{description:"Revokes a specific role from a user (matched by email and role) on a Drive file or folder. Use to unshare or downgrade access for someone. Requires the file/folder ID, the user email, and the role to remove. Idempotent: if no matching permission exists, the call is a no-op.",idempotent:!0},displayName:"Remove Access",props:{fileId:$.ShortText({displayName:"File or Folder ID",description:"The ID from the item's Drive URL or an earlier step.",required:!0,placeholder:"1dpv4-sKJfKRwI9qx1vWqQhEGEn3EpbI5"}),user_email:$.ShortText({displayName:"User Email",description:"The person whose access is removed.",required:!0,placeholder:"name@example.com"}),permission_name:$.StaticDropdown({displayName:"Role",description:"The role to remove. Other roles the person has stay.",required:!0,options:{options:[{label:"Manager",value:"organizer"},{label:"Content Manager",value:"fileOrganizer"},{label:"Editor",value:"writer"},{label:"Commenter",value:"commenter"},{label:"Viewer",value:"reader"}]}})},outputSchema:Vk,async run(e){let[t,n]=[e.propsValue.fileId,e.propsValue.user_email],o=await de(e.auth),r=(0,zz.drive)({version:"v3",auth:o}),i=await r.permissions.list({fileId:t,fields:"permissions(id, emailAddress, role)",supportsAllDrives:!0});if(i.data.permissions){for(let s of i.data.permissions)if(s.emailAddress===n&&s.role===e.propsValue.permission_name)return await r.permissions.delete({fileId:t,permissionId:s.id?s.id:"",supportsAllDrives:!0}),{removed:!0,message:"Permission removed"}}return{removed:!1,message:"Permission not found"}}});var Mz=he(ze());var Fz=re({displayName:"Duplicate File",auth:Y,name:"duplicate_file",classification:"WRITE",description:"Copy a file into a folder, optionally as a Google Doc or Sheet.",audience:"human",aiMetadata:{description:"Copies an existing Drive file into a target folder under a new name, optionally converting it to a Google Sheet or Google Doc. Use to clone a file or create an editable Google-format copy. Requires the source file ID and destination folder ID. Not idempotent: each call creates a new copy.",idempotent:!1},props:{fileId:$.ShortText({displayName:"File ID",description:"The ID of the file to copy.",required:!0,placeholder:"1dpv4-sKJfKRwI9qx1vWqQhEGEn3EpbI5"}),name:$.ShortText({displayName:"New File Name",description:"Name of the copy.",required:!0,placeholder:"Report (copy)"}),folderId:$.ShortText({displayName:"Destination Folder ID",description:"The ID of the folder that receives the copy.",required:!0}),mimeType:$.StaticDropdown({displayName:"Convert To",description:"Empty keeps the original format.",required:!1,advanced:!0,options:{options:[{label:"Google Sheets",value:"application/vnd.google-apps.spreadsheet"},{label:"Google Docs",value:"application/vnd.google-apps.document"}]}}),include_team_drives:Ne.properties.include_team_drives},outputSchema:Fk,async run(e){let t=await de(e.auth),n=e.propsValue.fileId,o=e.propsValue.name,r=e.propsValue.folderId,i=e.propsValue.mimeType,s=(0,Mz.drive)({version:"v3",auth:t}),u={name:o,parents:[r]};i&&(u.mimeType=i);let h=await s.files.copy({fileId:n,auth:t,requestBody:u,supportsAllDrives:e.propsValue.include_team_drives});if(h.status!==200)throw new Error("Error duplicating file");return h.data}});var Lz=he(ze());var jz=re({auth:Y,name:"get-file-or-folder-by-id",classification:"READ",displayName:"Get File Information",description:"Get the details of a file or folder by its ID.",audience:"human",aiMetadata:{description:"Fetches metadata for a single file or folder in Google Drive by its exact ID (name, MIME type, parents, etc.). Use when an agent already has a file/folder ID and needs its details. Read-only and idempotent. Requires the resource ID, not a name or path.",idempotent:!0},props:{id:$.ShortText({displayName:"File or Folder ID",description:"The ID from the item's Drive URL or an earlier step.",required:!0,placeholder:"1dpv4-sKJfKRwI9qx1vWqQhEGEn3EpbI5"}),include_team_drives:Ne.properties.include_team_drives},outputSchema:zk,async run(e){let t=await de(e.auth),o=await(0,Lz.drive)({version:"v3",auth:t}).files.get({fileId:e.propsValue.id,supportsAllDrives:e.propsValue.include_team_drives});return o.data?o.data:null}});var gh=he(en());var qz=he(require("querystring"));async function XT({auth:e,params:t}){let n=await bt(e),o=[],r;do{let i=r?{...t,pageToken:r}:t,s=await Yt.sendRequest({method:"GET",url:`https://www.googleapis.com/drive/v3/files?${qz.default.stringify(i)}`,headers:{Authorization:`Bearer ${n}`}});o.push(...s.body.files??[]),r=s.body.nextPageToken}while(r);return o}a(XT,"listDriveFiles");var wJ=50;async function hh({auth:e,rootFolderId:t,maxLevel:n,includeTrashed:o,includeTeamDrives:r}){let i=[],s=[t];for(let u=0;u<n&&s.length>0;u++){let h=[];for(let g of qv(s,wJ)){let y=g.map(P=>`'${P}' in parents`).join(" or "),T=g.length>1?`(${y})`:y,b=await XT({auth:e,params:{q:o?T:`${T} and trashed=false`,fields:"nextPageToken,files(id,kind,mimeType,name,trashed,parents)",supportsAllDrives:"true",includeItemsFromAllDrives:r?"true":"false",corpora:r?"allDrives":"user",pageSize:"1000"}});for(let P of b)i.push(P),P.mimeType==="application/vnd.google-apps.folder"&&h.push(P.id)}s=h}return i}a(hh,"listDriveFilesRecursive");var Vz=require("node:stream"),Gz=he(en());async function Hz(e,t){let n=await bt(e);return(await fetch(`https://www.googleapis.com/drive/v3/files/${t}?fields=mimeType&supportsAllDrives=true`,{headers:{Authorization:`Bearer ${n}`}}).then(r=>r.json())).mimeType}a(Hz,"getMimeType");var Bz=a(async(e,t,n,o,r)=>{let i=await Hz(t,n),s=await bt(t),u=await fetch(e,{headers:{Authorization:`Bearer ${s}`}}).catch(T=>Promise.reject(new Error(`Error when download file:
|
|
109
109
|
Download file response: ${T.message??T}`)));if(!u.ok||!u.body)throw new Error(`Error when download file:
|
|
110
|
-
Download file response: ${u.status} ${u.statusText}`);let h=(0,Gz.extension)(i),g=h?"."+h:"",y=r??n+g;return o.write({fileName:y,data:Vz.Readable.fromWeb(u.body)})},"googledlCall");async function Zt(e,t,n,o){let r=await Hz(e,n);if(["application/vnd.google-apps.document","application/vnd.google-apps.spreadsheet","application/vnd.google-apps.presentation"].includes(r)){switch(r){case"application/vnd.google-apps.document":r="application/vnd.openxmlformats-officedocument.wordprocessingml.document";break;case"application/vnd.google-apps.spreadsheet":r="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";break;case"application/vnd.google-apps.presentation":r="application/vnd.openxmlformats-officedocument.presentationml.presentation";break}return await Bz(`https://www.googleapis.com/drive/v3/files/${n}/export?mimeType=${r}&supportsAllDrives=true`,e,n,t,o)}else return await Bz(`https://www.googleapis.com/drive/v3/files/${n}?alt=media&supportsAllDrives=true`,e,n,t,o)}a(Zt,"downloadFileFromDrive");var Zz=re({auth:Y,name:"list-files",classification:"SEARCH",displayName:"List Files",description:"List the files and folders inside a folder.",audience:"human",aiMetadata:{description:"Lists files and subfolders inside a given Drive folder, with optional recursion to a chosen depth and optional download of each file's content. Use to enumerate the contents of a known folder ID. Read-only and idempotent. Requires the folder ID, not a name.",idempotent:!0},props:{folderId:$.ShortText({displayName:"Folder ID",description:"The ID after /folders/ in the folder URL, or from an earlier step.",required:!0,placeholder:"1aMEtTqIYn5651wdK7WLxaK_SDim4mvXW"}),depthLevel:$.Number({displayName:"Folder Depth",description:"1 lists only this folder; 2 adds its subfolders, and so on.",required:!1,defaultValue:1,display:"stepper",min:1,max:100,step:1}),downloadFiles:$.Checkbox({displayName:"Download Files",description:"Also download every file. Slow for large folders.",required:!1,defaultValue:!1}),include_team_drives:Ne.properties.include_team_drives,includeTrashed:$.Checkbox({displayName:"Include Trashed",description:"Also list files that are in the bin.",required:!1,defaultValue:!1,advanced:!0})},outputSchema:Uk,async run(e){let t={type:"drive#fileList",incompleteSearch:!1,files:[]},n=e.propsValue.depthLevel||1,o=await hh({auth:e.auth,rootFolderId:e.propsValue.folderId,maxLevel:n,includeTrashed:e.propsValue.includeTrashed??!1,includeTeamDrives:e.propsValue.include_team_drives??!1});if(e.propsValue.downloadFiles){let r=[];for(let i of o){if(i.mimeType==="application/vnd.google-apps.folder"){r.push(i);continue}let s=i.name,u=(0,gh.extension)(i.mimeType),g=(gh.extensions[i.mimeType]??(u?[u]:[])).some(y=>s.toLowerCase().endsWith(`.${y}`));u&&!g&&(s=`${s}.${u}`);try{let y=await Zt(e.auth,e.files,i.id,s);r.push({...i,downloadedFile:y})}catch(y){console.warn(`Failed to download file ${i.name}: ${y instanceof Error?y.message:"Download failed"}`),r.push(i)}}t.files=r,t.downloadedFiles=r.map(i=>i.downloadedFile).filter(i=>i!==void 0)}else t.files=o;return t}});var Wz=re({auth:Y,name:"read-file",classification:"READ",displayName:"Download File",description:"Download a file. Google Docs, Sheets and Slides become Office files.",audience:"human",aiMetadata:{description:"Downloads the content of a Drive file by its file ID and returns it as a usable file reference. Use to retrieve a file an agent already knows the ID of (e.g. from a trigger or search). Read-only and idempotent. Requires the exact file ID, not a name.",idempotent:!0},props:{fileId:$.ShortText({displayName:"File ID",description:"Use the ID from a trigger or the Find File or Folder action.",required:!0,placeholder:"1dpv4-sKJfKRwI9qx1vWqQhEGEn3EpbI5"}),fileName:$.ShortText({displayName:"File Name",description:"Name for the saved file. Empty uses the file ID plus its extension.",required:!1,placeholder:"report.pdf"})},outputSchema:kk,run:a(async({auth:e,propsValue:t,files:n})=>Zt(e,n,t.fileId,t.fileName),"run")});var Kz=he(ze()),Jz=require("stream");var Xz=re({displayName:"Save Document as PDF",auth:Y,name:"save_file_as_pdf",classification:"WRITE",description:"Export a Google Doc, Sheet or Slides as a PDF into a folder.",audience:"human",aiMetadata:{description:"Exports a Google document to PDF and saves it as a new file in a target Drive folder. Use to produce a PDF rendition of a Google Doc/Sheet/Slides for sharing or archival. Requires the source document ID and destination folder ID. Not idempotent: each call creates a new PDF file.",idempotent:!1},props:{documentId:$.ShortText({displayName:"Document ID",description:"The ID of the Google Doc, Sheet or Slides to export.",required:!0,placeholder:"1dpv4-sKJfKRwI9qx1vWqQhEGEn3EpbI5"}),folderId:$.ShortText({displayName:"Destination Folder ID",description:"The ID of the folder that receives the PDF.",required:!0}),name:$.ShortText({displayName:"File Name",description:"Without the extension; .pdf is added.",required:!0,placeholder:"Quarterly report"}),include_team_drives:Ne.properties.include_team_drives},outputSchema:Lk,async run(e){let t=await de(e.auth),n=e.propsValue.documentId,o=e.propsValue.folderId,r=e.propsValue.name,i=(0,Kz.drive)({version:"v3",auth:t}),s=await i.files.export({fileId:n,mimeType:"application/pdf"},{responseType:"arraybuffer"}),u={name:r+".pdf",parents:[o]},h=Buffer.from(s.data,"base64"),y={mimeType:"application/pdf",body:new Jz.Stream.PassThrough().end(h)};return(await i.files.create({requestBody:u,media:y,supportsAllDrives:e.propsValue.include_team_drives})).data}});var eU=he(ze());var Yz="application/vnd.google-apps.folder";function Qz({queryTerm:e,operator:t,query:n,parentFolder:o,type:r}){let i=[`${e} ${t} '${Ne.escapeDriveQueryLiteral(n)}'`];return o&&i.push(`'${Ne.escapeDriveQueryLiteral(o)}' in parents`),r==="file"&&i.push(`mimeType!='${Yz}'`),r==="folder"&&i.push(`mimeType='${Yz}'`),i.join(" and ")}a(Qz,"buildDriveSearchQuery");var tU=re({auth:Y,name:"search-folder",classification:"SEARCH",displayName:"Find File or Folder",description:"Find files or folders by name, content or type.",audience:"human",aiMetadata:{description:"Searches Google Drive for files or folders matching a name, full-text, or MIME-type query, optionally scoped to a parent folder and filtered to files or folders only. Use to resolve a file/folder ID from a human-readable name before acting on it. Read-only and idempotent.",idempotent:!0},propertyGroups:[{key:"search",display:"section",label:"Search for",icon:"type",props:["queryTerm","operator","query"]},{key:"scope",display:"section",label:"Limit results",icon:"sliders",props:["type","parentFolder","include_team_drives"]}],props:{queryTerm:$.StaticDropdown({displayName:"Search By",description:"Match the file name, the text inside it, or its type.",defaultValue:"name",options:{options:[{label:"File Name",value:"name"},{label:"Text Inside the File",value:"fullText"},{label:"File Type",value:"mimeType"}]},required:!0}),operator:$.StaticDropdown({displayName:"Match",description:"Contains finds partial matches; Equals needs the exact value.",required:!0,display:"cards",options:{options:[{label:"Contains",value:"contains",description:"Partial match",icon:"filter"},{label:"Equals",value:"=",description:"Exact match",icon:"tag"}]},defaultValue:"contains"}),query:$.ShortText({displayName:"Search Text",description:"The name, text or type to look for.",required:!0,placeholder:"Quarterly report"}),type:$.StaticDropdown({displayName:"Show",description:"Return everything, only files or only folders.",required:!1,options:{options:[{label:"Files and Folders",value:"all"},{label:"Files Only",value:"file"},{label:"Folders Only",value:"folder"}]},defaultValue:"all"}),parentFolder:Ne.parentFolderDropdown({displayName:"Search in Folder",description:"Leave empty to search all of Drive. Type to search by folder name."}),include_team_drives:Ne.properties.include_team_drives},outputSchema:Mk,async run(e){let t=await de(e.auth),n=(0,eU.drive)({version:"v3",auth:t}),o=Qz({queryTerm:e.propsValue.queryTerm??"name",operator:e.propsValue.operator??"contains",query:e.propsValue.query,parentFolder:e.propsValue.parentFolder,type:e.propsValue.type??"all"}),r=[],i;do{let s={q:o,fields:"nextPageToken, files(id, name, mimeType, createdTime, modifiedTime)",includeItemsFromAllDrives:e.propsValue.include_team_drives,supportsAllDrives:!0,corpora:e.propsValue.include_team_drives?"allDrives":"user",pageSize:1e3};i&&(s.pageToken=i);let u=await n.files.list(s);if(u.status!==200)throw console.error(u),new Error("Error searching for the file/folder");r.push(...u.data.files??[]),i=u.data.nextPageToken??void 0}while(i);return r.length>0?r:[]}});var rU=he(en()),nU=he(ze());var oU=re({auth:Y,name:"upload_gdrive_file",classification:"WRITE",description:"Upload a file to Google Drive.",audience:"human",aiMetadata:{description:"Uploads a binary file (from a URL or base64 input) into Google Drive, optionally inside a parent folder. Use to store an existing file or attachment in Drive; the MIME type is inferred from the file extension. Not idempotent: each call creates a new file.",idempotent:!1},displayName:"Upload File",props:{fileName:$.ShortText({displayName:"File Name",description:"Name shown in Drive, including the extension.",required:!0,placeholder:"photo.png"}),file:$.File({displayName:"File",description:"The file to upload, from an earlier step or a URL.",required:!0,streaming:!0}),parentFolder:Ne.properties.parentFolder,include_team_drives:Ne.properties.include_team_drives},outputSchema:Nk,async run(e){let t=e.propsValue.file,{body:n}=i0.toStreamingBody(t),o=rU.default.lookup(t.extension??"")||"application/octet-stream",r=await de(e.auth);return(await(0,nU.drive)({version:"v3",auth:r}).files.create({requestBody:{name:e.propsValue.fileName,...e.propsValue.parentFolder?{parents:[e.propsValue.parentFolder]}:{}},media:{mimeType:o,body:n},supportsAllDrives:e.propsValue.include_team_drives??!1,fields:"id, name, mimeType, kind"})).data}});var sU=he(fl());var yh={strategy:0,items:a(async({auth:e,propsValue:t,lastFetchEpochMS:n})=>(await Ne.getFiles(e,{parent:t.parentFolder,createdTime:n,includeTeamDrive:t.include_team_drives})??[]).map(i=>({epochMilliSeconds:(0,sU.default)(i.createdTime).valueOf(),data:i})),"items")},cU=Aa({auth:Y,name:"new_file",classification:"READ",displayName:"New File",description:"Triggers when a new file is added to Drive or the chosen folder.",aiMetadata:{description:"Fires when a new file appears in Google Drive, optionally scoped to a specific parent folder. Each event represents one newly created file and its metadata, with optional inclusion of the file content."},props:{parentFolder:Ne.parentFolderDropdown({displayName:"Folder",description:"Leave empty to watch all of My Drive. Type to search by folder name."}),include_team_drives:Ne.properties.include_team_drives,include_file_content:$.Checkbox({displayName:"Include File Content",description:"Also download each file. Slower, and very large files may fail.",required:!1,defaultValue:!1})},outputSchema:Hk,type:"POLLING",onEnable:a(async e=>{await Qt.onEnable(yh,{auth:e.auth,store:e.store,propsValue:e.propsValue})},"onEnable"),onDisable:a(async e=>{await Qt.onDisable(yh,{auth:e.auth,store:e.store,propsValue:e.propsValue})},"onDisable"),run:a(async e=>{let t=await Qt.poll(yh,{auth:e.auth,store:e.store,propsValue:e.propsValue,files:e.files});return await iU(t,e)},"run"),test:a(async e=>{let t=await Qt.test(yh,{auth:e.auth,store:e.store,propsValue:e.propsValue,files:e.files});return await iU(t,e)},"test"),sampleData:{kind:"drive#file",mimeType:"image/png",id:"1dpv4-sKJfKRwI9qx1vWqQhEGEn3EpbI5",name:"google-drive.png",webViewLink:"https://drive.google.com/file/d/1dpv4-sKJfKRwI9qx1vWqQhEGEn3EpbI5/view?usp=drivesdk",createdTime:"2026-08-20T09:12:44.000Z",modifiedTime:"2026-08-20T09:12:44.000Z"}});async function iU(e,t){let n=JSON.parse(JSON.stringify(e));if(t.propsValue.include_file_content){let o=[];for(let i of n)o.push(Zt(t.auth,t.files,i.id,i.name));let r=await Promise.all(o);for(let i=0;i<n.length;i++)n[i].content=r[i]}return n}a(iU,"handleFileContent");var uU=he(fl());var vh={strategy:0,items:a(async({auth:e,propsValue:t,lastFetchEpochMS:n})=>(await Ne.getFolders(e,{parent:t.parentFolder,createdTime:n,includeTeamDrive:t.include_team_drives})??[]).map(i=>({epochMilliSeconds:(0,uU.default)(i.createdTime).valueOf(),data:i})),"items")},lU=Aa({auth:Y,name:"new_folder",classification:"READ",displayName:"New Folder",description:"Triggers when a new folder is created in Drive or the chosen folder.",aiMetadata:{description:"Fires when a new folder is created in Google Drive, optionally scoped to a specific parent folder. Each event represents one newly created folder and its metadata."},props:{parentFolder:Ne.parentFolderDropdown({displayName:"Folder",description:"Leave empty to watch all of My Drive. Type to search by folder name."}),include_team_drives:Ne.properties.include_team_drives},outputSchema:Wk,type:"POLLING",onEnable:a(async e=>{await Qt.onEnable(vh,{auth:e.auth,store:e.store,propsValue:e.propsValue})},"onEnable"),onDisable:a(async e=>{await Qt.onDisable(vh,{auth:e.auth,store:e.store,propsValue:e.propsValue})},"onDisable"),run:a(async e=>await Qt.poll(vh,e),"run"),test:a(async e=>await Qt.test(vh,e),"test"),sampleData:{kind:"drive#file",mimeType:"application/vnd.google-apps.folder",id:"1aMEtTqIYn5651wdK7WLxaK_SDim4mvXW",name:"Invoices 2026",createdTime:"2026-08-20T09:12:44.000Z"}});var YT=he(fl());var _h={strategy:0,items:a(async({auth:e,propsValue:t,lastFetchEpochMS:n})=>{let o=n===0,r=await Ne.getFiles(e,{parent:t.parentFolder,changedSince:o?void 0:n,mimeTypes:t.file_types,excludeShortcuts:!0,includeTeamDrive:t.include_team_drives,maxPages:o?1:void 0},"modifiedTime desc")??[],i=Date.now();return r.filter(yU).filter(s=>bJ({file:s,now:i})).map(s=>({epochMilliSeconds:gU(s),data:{...s,changeType:TJ({file:s,lastFetchEpochMS:n})}}))},"items")},hU=Aa({auth:Y,name:"new_or_updated_file",classification:"READ",displayName:"New or Updated File",description:"Triggers when a file is created or edited. A rename counts; trashing or moving does not.",aiMetadata:{description:"Fires when a file is created or modified in Google Drive, based on its creation and last-modified times (polling), optionally scoped to a parent folder and to specific file types. Each event represents one file and its metadata, carries a changeType of created or updated, and can include the file content, falling back to a contentError field when a download fails. Choose this over New File when edits to files that already exist should also trigger the flow."},props:{behaviourNote:$.MarkDown({value:"Each event carries a Change Type of created or updated. Several edits between two checks arrive as one event. A chosen folder is watched one level deep, not its subfolders.",variant:"INFO"}),parentFolder:Ne.parentFolderDropdown({displayName:"Folder",description:"Leave empty to watch all of My Drive. Type to search by folder name."}),include_team_drives:Ne.properties.include_team_drives,file_types:$.StaticMultiSelectDropdown({displayName:"File Types",description:"Empty watches every type. Use Dynamic value to add other MIME types.",required:!1,options:{options:[{label:"Google Sheets",value:"application/vnd.google-apps.spreadsheet"},{label:"Google Docs",value:"application/vnd.google-apps.document"},{label:"Google Slides",value:"application/vnd.google-apps.presentation"},{label:"Excel (XLSX)",value:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"},{label:"Excel 97-2003 (XLS)",value:"application/vnd.ms-excel"},{label:"CSV",value:"text/csv"},{label:"Word (DOCX)",value:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"},{label:"PowerPoint (PPTX)",value:"application/vnd.openxmlformats-officedocument.presentationml.presentation"},{label:"PDF",value:"application/pdf"},{label:"Plain Text (TXT)",value:"text/plain"},{label:"PNG",value:"image/png"},{label:"JPEG",value:"image/jpeg"},{label:"ZIP",value:"application/zip"}]}}),include_file_content:$.Checkbox({displayName:"Include File Content",description:"Also download each file. A failed download adds an error instead.",required:!1,defaultValue:!1})},outputSchema:Zk,type:"POLLING",onEnable:a(async e=>{await Qt.onEnable(_h,e)},"onEnable"),onDisable:a(async e=>{await Qt.onDisable(_h,e)},"onDisable"),run:a(async e=>{let t=Date.now()+mU,n=await Qt.poll(_h,e);return await dU({auth:e.auth,files:e.files,items:n,includeFileContent:e.propsValue.include_file_content,deadline:t})},"run"),test:a(async e=>{let t=Date.now()+mU,n=await Qt.test(_h,e);return await dU({auth:e.auth,files:e.files,items:n,includeFileContent:e.propsValue.include_file_content,deadline:t})},"test"),sampleData:{changeType:"updated",kind:"drive#file",id:"1dpv4-sKJfKRwI9qx1vWqQhEGEn3EpbI5",name:"quarterly-report.xlsx",mimeType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",webViewLink:"https://docs.google.com/spreadsheets/d/1dpv4-sKJfKRwI9qx1vWqQhEGEn3EpbI5/edit?usp=drivesdk",createdTime:"2026-08-20T09:12:44.000Z",modifiedTime:"2026-08-25T14:34:07.000Z"}});function hl(e){return typeof e=="string"&&(0,YT.default)(e).isValid()?(0,YT.default)(e).valueOf():0}a(hl,"epochOf");function gU(e){return Math.max(hl(e.modifiedTime),hl(e.createdTime))}a(gU,"changedAtEpoch");function bJ({file:e,now:t}){let n=gU(e);return n>0&&n<=t}a(bJ,"isDeliverable");function TJ({file:e,lastFetchEpochMS:t}){return t>0?hl(e.createdTime)>t?"created":"updated":hl(e.modifiedTime)>hl(e.createdTime)?"updated":"created"}a(TJ,"resolveChangeType");function yU(e){return typeof e=="object"&&e!==null&&"id"in e&&typeof e.id=="string"&&"name"in e&&typeof e.name=="string"}a(yU,"isDriveFile");function EJ(e){return new Promise(t=>setTimeout(t,e))}a(EJ,"delay");function SJ(){return Math.floor(Math.random()*AJ)}a(SJ,"jitterMs");async function xJ({auth:e,files:t,file:n,deadline:o}){let r=RJ;for(let i=1;i<=fU;i++){if(Date.now()>=o)return{error:r};let{data:s,error:u}=await Vv(()=>Zt(e,t,n.id,n.name));if(u===null&&s!==null)return{content:s};r=u===null?"Download returned no content":u.message;let h=i*IJ+SJ();i<fU&&Date.now()+h<o&&await EJ(h)}return{error:r}}a(xJ,"downloadContent");async function dU({auth:e,files:t,items:n,includeFileContent:o,deadline:r}){if(!o)return n;let i=[];for(let s=0;s<n.length;s+=pU){let u=n.slice(s,s+pU),h=await Promise.all(u.map(async g=>{if(!yU(g))return g;let y=await xJ({auth:e,files:t,file:g,deadline:r});return"content"in y?{...g,content:y.content}:{...g,contentError:y.error}}));i.push(...h)}return i}a(dU,"withFileContent");var pU=5,fU=3,IJ=500,AJ=250,mU=4e4,RJ="Timed out before the file content could be downloaded";var vU=he(ze());var _U=re({auth:Y,name:"set_public_access",classification:"WRITE",description:"Let anyone with the link open a file or folder.",audience:"human",aiMetadata:{description:"Makes a Drive file or folder accessible to anyone with the link at the chosen role (reader, commenter, or writer) and returns its shareable view/download URL. Use to publish a resource publicly. Requires the file/folder ID. Not idempotent: each call adds a new anyone-with-link permission.",idempotent:!1},displayName:"Set Public Access",props:{fileId:$.ShortText({displayName:"File or Folder ID",description:"The ID from the item's Drive URL or an earlier step.",required:!0,placeholder:"1dpv4-sKJfKRwI9qx1vWqQhEGEn3EpbI5"}),role:$.StaticDropdown({displayName:"Role",description:"What anyone with the link can do.",display:"cards",options:{options:[{label:"Viewer",value:"reader",description:"Read only",icon:"file"},{label:"Commenter",value:"commenter",description:"Read and comment",icon:"reply"},{label:"Editor",value:"writer",description:"Read and edit",icon:"type"}]},defaultValue:"reader",required:!0})},outputSchema:qk,async run(e){let t=await de(e.auth),n=e.propsValue.fileId,o=e.propsValue.role,r=(0,vU.drive)({version:"v3",auth:t}),i={role:o,type:"anyone"},s=await r.permissions.create({fileId:n,requestBody:i,supportsAllDrives:!0}),u=await r.files.get({fileId:n,fields:"name,mimeType,webContentLink,webViewLink",supportsAllDrives:!0});if(u.data.mimeType==="application/vnd.google-apps.folder")return{...s.data,webViewLink:u.data.webViewLink,downloadUrl:null};let h=await Zt(e.auth,e.files,n,u.data.name);return{...s.data,downloadUrl:h}}});var PU=he(ze());var wU=re({auth:Y,name:"google-drive-move-file",classification:"WRITE",displayName:"Move File",description:"Move a file into another folder.",audience:"human",aiMetadata:{description:"Relocates a Drive file to a target folder, detaching it from its current parents and attaching it to the new one. Use to reorganize a file once you know its ID and the destination folder ID. Idempotent: repeating with the same destination leaves the file in the same folder.",idempotent:!0},props:{fileId:$.ShortText({displayName:"File ID",description:"Use the ID from a trigger or the Find File or Folder action.",required:!0,placeholder:"1dpv4-sKJfKRwI9qx1vWqQhEGEn3EpbI5"}),folderId:Ne.parentFolderDropdown({displayName:"Destination Folder",description:"The folder to move the file into. Type to search by folder name."}),include_team_drives:Ne.properties.include_team_drives},outputSchema:jk,async run(e){let t=e.propsValue.fileId,n=e.propsValue.folderId,o=await de(e.auth),r=(0,PU.drive)({version:"v3",auth:o}),i=await r.files.get({fileId:t,supportsAllDrives:e.propsValue.include_team_drives,fields:"id,parents"});return(await r.files.update({fileId:t,fields:"*",removeParents:i.data.parents?.join(","),addParents:n,supportsAllDrives:e.propsValue.include_team_drives})).data}});var bU=he(ze()),TU=re({auth:Y,name:"delete_gdrive_file",classification:"DESTRUCTIVE",description:"Permanently delete a file, skipping the bin.",audience:"human",aiMetadata:{description:"Permanently deletes a file from Google Drive by its ID, bypassing the trash and making it unrecoverable. Use only when permanent removal is intended; prefer Trash file for reversible deletion. Requires the file ID. Not idempotent: a repeat call fails because the file no longer exists.",idempotent:!1},displayName:"Delete File",props:{fileId:$.ShortText({displayName:"File ID",description:"The ID of the file to delete. This cannot be undone.",required:!0,placeholder:"1dpv4-sKJfKRwI9qx1vWqQhEGEn3EpbI5"}),include_team_drives:Ne.properties.include_team_drives},async run(e){let t=await de(e.auth);return(await(0,bU.drive)({version:"v3",auth:t}).files.delete({fileId:e.propsValue.fileId,supportsAllDrives:e.propsValue.include_team_drives})).data}});var EU=he(ze());var SU=re({auth:Y,name:"trash_gdrive_file",classification:"DESTRUCTIVE",description:"Move a file to the bin, where it can be restored.",audience:"human",aiMetadata:{description:"Moves a Drive file to the trash by its ID, a reversible deletion that can be restored from Drive. Use for safe removal instead of permanent deletion. Requires the file ID. Idempotent: re-trashing an already-trashed file leaves it in the same state.",idempotent:!0},displayName:"Move File to Trash",props:{fileId:$.ShortText({displayName:"File ID",description:"The ID of the file to trash.",required:!0,placeholder:"1dpv4-sKJfKRwI9qx1vWqQhEGEn3EpbI5"}),include_team_drives:Ne.properties.include_team_drives},outputSchema:Gk,async run(e){let t=await de(e.auth),n=(0,EU.drive)({version:"v3",auth:t}),o={trashed:!0};return(await n.files.update({fileId:e.propsValue.fileId,supportsAllDrives:e.propsValue.include_team_drives,requestBody:o})).data}});var xU=require("node:stream"),IU=require("@zip.js/zip.js"),AU=he(en());var DJ=4,OJ=16*1024*1024,$J=8*1024*1024,CJ=20,RU="application/vnd.google-apps.folder",NJ={"application/vnd.google-apps.document":{key:"docs",exportMimeTypes:{pdf:"application/pdf",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"}},"application/vnd.google-apps.spreadsheet":{key:"sheets",exportMimeTypes:{pdf:"application/pdf",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}},"application/vnd.google-apps.presentation":{key:"slides",exportMimeTypes:{pdf:"application/pdf",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation"}}};async function kJ({auth:e,folderId:t,includeTeamDrives:n}){return XT({auth:e,params:{q:`'${t}' in parents and trashed=false`,fields:"nextPageToken,files(id,name,mimeType,size)",supportsAllDrives:"true",includeItemsFromAllDrives:n?"true":"false",corpora:n?"allDrives":"user",pageSize:"1000"}})}a(kJ,"listFolderChildren");function zJ(e,t){let n=t.length>0?t:"/",o=`"${e}"`;if(e.includes("/"))return{name:o,location:n,message:'contains "/"'};if(e.includes("\\"))return{name:o,location:n,message:'contains "\\"'};if(e==="..")return{name:o,location:n,message:"escapes the archive root on extraction"};if(e===".")return{name:o,location:n,message:"collides with other paths once normalized on extraction"}}a(zJ,"checkSafeItemName");function UJ(e,t){if(e.mimeType===RU)return{item:e,name:e.name};let n=NJ[e.mimeType];if(n){let o=t[n.key];if(o==="skip")return;let r=n.exportMimeTypes[o],i=(0,AU.extension)(r);return{item:e,name:i?`${e.name}.${i}`:e.name,downloadUrl:`https://www.googleapis.com/drive/v3/files/${e.id}/export?mimeType=${encodeURIComponent(r)}&supportsAllDrives=true`}}if(!e.mimeType.startsWith("application/vnd.google-apps."))return{item:e,name:e.name,downloadUrl:`https://www.googleapis.com/drive/v3/files/${e.id}?alt=media&supportsAllDrives=true`}}a(UJ,"resolveItem");function MJ(e,t){let n=new Map;for(let{name:i}of e){let s=i.toLowerCase(),u=n.get(s);u?u.push(i):n.set(s,[i])}let o=t.length>0?t:"/",r=[];for(let i of n.values()){if(i.length<=1)continue;let s=[...new Set(i)];r.push({name:s.map(u=>`"${u}"`).join(", "),location:o,message:s.length>1?`${i.length} items would map to the same zip path (names differing only by case collide on Windows and macOS)`:`${i.length} items would map to the same zip path`})}return r}a(MJ,"checkUniqueNames");async function DU({auth:e,folderId:t,relativePrefix:n,nativeFormats:o,includeTeamDrives:r,out:i,errors:s}){let u=await kJ({auth:e,folderId:t,includeTeamDrives:r});if(u.length===0){n.length>0&&i.push({relativePath:n,fileId:t,isEmptyFolder:!0,sizeBytes:0});return}let h=u.map(g=>UJ(g,o)).filter(g=>g!==void 0);for(let{item:g}of h){let y=zJ(g.name,n);y&&s.push(y)}s.push(...MJ(h,n));for(let g of h){let y=n.length>0?`${n}/${g.name}`:g.name;if(g.item.mimeType===RU){await DU({auth:e,folderId:g.item.id,relativePrefix:y,nativeFormats:o,includeTeamDrives:r,out:i,errors:s});continue}let T=Number(g.item.size);i.push({relativePath:y,fileId:g.item.id,isEmptyFolder:!1,downloadUrl:g.downloadUrl,sizeBytes:Number.isFinite(T)?T:$J})}}a(DU,"walk");async function FJ({auth:e,rootFolderId:t,nativeFormats:n,includeTeamDrives:o}){let r=[],i=[];if(await DU({auth:e,folderId:t,relativePrefix:"",nativeFormats:n,includeTeamDrives:o,out:r,errors:i}),i.length>0){let s=[...i].sort((g,y)=>g.location.localeCompare(y.location)||g.name.localeCompare(y.name)),u=s.slice(0,CJ),h=u.map(g=>`- [${g.location}] ${g.name} ${g.message}`);throw s.length>u.length&&h.push(`- ...and ${s.length-u.length} more`),new Error(`Cannot export (${i.length} problem${i.length>1?"s":""}) - Rename the conflicting or unsafe items in Drive and try again.
|
|
110
|
+
Download file response: ${u.status} ${u.statusText}`);let h=(0,Gz.extension)(i),g=h?"."+h:"",y=r??n+g;return o.write({fileName:y,data:Vz.Readable.fromWeb(u.body)})},"googledlCall");async function Zt(e,t,n,o){let r=await Hz(e,n);if(["application/vnd.google-apps.document","application/vnd.google-apps.spreadsheet","application/vnd.google-apps.presentation"].includes(r)){switch(r){case"application/vnd.google-apps.document":r="application/vnd.openxmlformats-officedocument.wordprocessingml.document";break;case"application/vnd.google-apps.spreadsheet":r="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";break;case"application/vnd.google-apps.presentation":r="application/vnd.openxmlformats-officedocument.presentationml.presentation";break}return await Bz(`https://www.googleapis.com/drive/v3/files/${n}/export?mimeType=${r}&supportsAllDrives=true`,e,n,t,o)}else return await Bz(`https://www.googleapis.com/drive/v3/files/${n}?alt=media&supportsAllDrives=true`,e,n,t,o)}a(Zt,"downloadFileFromDrive");var Zz=re({auth:Y,name:"list-files",classification:"SEARCH",displayName:"List Files",description:"List the files and folders inside a folder.",audience:"human",aiMetadata:{description:"Lists files and subfolders inside a given Drive folder, with optional recursion to a chosen depth and optional download of each file's content. Use to enumerate the contents of a known folder ID. Read-only and idempotent. Requires the folder ID, not a name.",idempotent:!0},props:{folderId:$.ShortText({displayName:"Folder ID",description:"The ID after /folders/ in the folder URL, or from an earlier step.",required:!0,placeholder:"1aMEtTqIYn5651wdK7WLxaK_SDim4mvXW"}),depthLevel:$.Number({displayName:"Folder Depth",description:"1 lists only this folder; 2 adds its subfolders, and so on.",required:!1,defaultValue:1,display:"stepper",min:1,max:100,step:1}),downloadFiles:$.Checkbox({displayName:"Download Files",description:"Also download every file. Slow for large folders.",required:!1,defaultValue:!1}),include_team_drives:Ne.properties.include_team_drives,includeTrashed:$.Checkbox({displayName:"Include Trashed",description:"Also list files that are in the bin.",required:!1,defaultValue:!1,advanced:!0})},outputSchema:Uk,async run(e){let t={type:"drive#fileList",incompleteSearch:!1,files:[]},n=e.propsValue.depthLevel||1,o=await hh({auth:e.auth,rootFolderId:e.propsValue.folderId,maxLevel:n,includeTrashed:e.propsValue.includeTrashed??!1,includeTeamDrives:e.propsValue.include_team_drives??!1});if(e.propsValue.downloadFiles){let r=[];for(let i of o){if(i.mimeType==="application/vnd.google-apps.folder"){r.push(i);continue}let s=i.name,u=(0,gh.extension)(i.mimeType),g=(gh.extensions[i.mimeType]??(u?[u]:[])).some(y=>s.toLowerCase().endsWith(`.${y}`));u&&!g&&(s=`${s}.${u}`);try{let y=await Zt(e.auth,e.files,i.id,s);r.push({...i,downloadedFile:y})}catch(y){console.warn(`Failed to download file ${i.name}: ${y instanceof Error?y.message:"Download failed"}`),r.push(i)}}t.files=r,t.downloadedFiles=r.map(i=>i.downloadedFile).filter(i=>i!==void 0)}else t.files=o;return t}});var Wz=re({auth:Y,name:"read-file",classification:"READ",displayName:"Download File",description:"Download a file. Google Docs, Sheets and Slides become Office files.",audience:"human",aiMetadata:{description:"Downloads the content of a Drive file by its file ID and returns it as a usable file reference. Use to retrieve a file an agent already knows the ID of (e.g. from a trigger or search). Read-only and idempotent. Requires the exact file ID, not a name.",idempotent:!0},props:{fileId:$.ShortText({displayName:"File ID",description:"Use the ID from a trigger or the Find File or Folder action.",required:!0,placeholder:"1dpv4-sKJfKRwI9qx1vWqQhEGEn3EpbI5"}),fileName:$.ShortText({displayName:"File Name",description:"Name for the saved file. Empty uses the file ID plus its extension.",required:!1,placeholder:"report.pdf"})},outputSchema:kk,run:a(async({auth:e,propsValue:t,files:n})=>Zt(e,n,t.fileId,t.fileName),"run")});var Kz=he(ze()),Jz=require("stream");var Xz=re({displayName:"Save Document as PDF",auth:Y,name:"save_file_as_pdf",classification:"WRITE",description:"Export a Google Doc, Sheet or Slides as a PDF into a folder.",audience:"human",aiMetadata:{description:"Exports a Google document to PDF and saves it as a new file in a target Drive folder. Use to produce a PDF rendition of a Google Doc/Sheet/Slides for sharing or archival. Requires the source document ID and destination folder ID. Not idempotent: each call creates a new PDF file.",idempotent:!1},props:{documentId:$.ShortText({displayName:"Document ID",description:"The ID of the Google Doc, Sheet or Slides to export.",required:!0,placeholder:"1dpv4-sKJfKRwI9qx1vWqQhEGEn3EpbI5"}),folderId:$.ShortText({displayName:"Destination Folder ID",description:"The ID of the folder that receives the PDF.",required:!0}),name:$.ShortText({displayName:"File Name",description:"Without the extension; .pdf is added.",required:!0,placeholder:"Quarterly report"}),include_team_drives:Ne.properties.include_team_drives},outputSchema:Lk,async run(e){let t=await de(e.auth),n=e.propsValue.documentId,o=e.propsValue.folderId,r=e.propsValue.name,i=(0,Kz.drive)({version:"v3",auth:t}),s=await i.files.export({fileId:n,mimeType:"application/pdf"},{responseType:"arraybuffer"}),u={name:r+".pdf",parents:[o]},h=Buffer.from(s.data,"base64"),y={mimeType:"application/pdf",body:new Jz.Stream.PassThrough().end(h)};return(await i.files.create({requestBody:u,media:y,supportsAllDrives:e.propsValue.include_team_drives})).data}});var eU=he(ze());var Yz="application/vnd.google-apps.folder";function Qz({queryTerm:e,operator:t,query:n,parentFolder:o,type:r}){let i=[`${e} ${t} '${Ne.escapeDriveQueryLiteral(n)}'`];return o&&i.push(`'${Ne.escapeDriveQueryLiteral(o)}' in parents`),r==="file"&&i.push(`mimeType!='${Yz}'`),r==="folder"&&i.push(`mimeType='${Yz}'`),i.join(" and ")}a(Qz,"buildDriveSearchQuery");var tU=re({auth:Y,name:"search-folder",classification:"SEARCH",displayName:"Find File or Folder",description:"Find files or folders by name, content or type.",audience:"human",aiMetadata:{description:"Searches Google Drive for files or folders matching a name, full-text, or MIME-type query, optionally scoped to a parent folder and filtered to files or folders only. Use to resolve a file/folder ID from a human-readable name before acting on it. Read-only and idempotent.",idempotent:!0},propertyGroups:[{key:"search",display:"section",label:"Search for",icon:"type",props:["queryTerm","operator","query"]},{key:"scope",display:"section",label:"Limit results",icon:"sliders",props:["type","parentFolder","include_team_drives"]}],props:{queryTerm:$.StaticDropdown({displayName:"Search By",description:"Match the file name, the text inside it, or its type.",defaultValue:"name",options:{options:[{label:"File Name",value:"name"},{label:"Text Inside the File",value:"fullText"},{label:"File Type",value:"mimeType"}]},required:!0}),operator:$.StaticDropdown({displayName:"Match",description:"Contains finds partial matches; Equals needs the exact value.",required:!0,display:"cards",options:{options:[{label:"Contains",value:"contains",description:"Partial match",icon:"filter"},{label:"Equals",value:"=",description:"Exact match",icon:"tag"}]},defaultValue:"contains"}),query:$.ShortText({displayName:"Search Text",description:"The name, text or type to look for.",required:!0,placeholder:"Quarterly report"}),type:$.StaticDropdown({displayName:"Show",description:"Return everything, only files or only folders.",required:!1,options:{options:[{label:"Files and Folders",value:"all"},{label:"Files Only",value:"file"},{label:"Folders Only",value:"folder"}]},defaultValue:"all"}),parentFolder:Ne.parentFolderDropdown({displayName:"Search in Folder",description:"Leave empty to search all of Drive. Type to search by folder name."}),include_team_drives:Ne.properties.include_team_drives},outputSchema:Mk,async run(e){let t=await de(e.auth),n=(0,eU.drive)({version:"v3",auth:t}),o=Qz({queryTerm:e.propsValue.queryTerm??"name",operator:e.propsValue.operator??"contains",query:e.propsValue.query,parentFolder:e.propsValue.parentFolder,type:e.propsValue.type??"all"}),r=[],i;do{let s={q:o,fields:"nextPageToken, files(id, name, mimeType, createdTime, modifiedTime)",includeItemsFromAllDrives:e.propsValue.include_team_drives,supportsAllDrives:!0,corpora:e.propsValue.include_team_drives?"allDrives":"user",pageSize:1e3};i&&(s.pageToken=i);let u=await n.files.list(s);if(u.status!==200)throw console.error(u),new Error("Error searching for the file/folder");r.push(...u.data.files??[]),i=u.data.nextPageToken??void 0}while(i);return r.length>0?r:[]}});var rU=he(en()),nU=he(ze());var oU=re({auth:Y,name:"upload_gdrive_file",classification:"WRITE",description:"Upload a file to Google Drive.",audience:"human",aiMetadata:{description:"Uploads a binary file (from a URL or base64 input) into Google Drive, optionally inside a parent folder. Use to store an existing file or attachment in Drive; the MIME type is inferred from the file extension. Not idempotent: each call creates a new file.",idempotent:!1},displayName:"Upload File",props:{fileName:$.ShortText({displayName:"File Name",description:"Name shown in Drive, including the extension.",required:!0,placeholder:"photo.png"}),file:$.File({displayName:"File",description:"The file to upload, from an earlier step or a URL.",required:!0,streaming:!0}),parentFolder:Ne.properties.parentFolder,include_team_drives:Ne.properties.include_team_drives},outputSchema:Nk,async run(e){let t=e.propsValue.file,{body:n}=i0.toStreamingBody(t),o=rU.default.lookup(t.extension??"")||"application/octet-stream",r=await de(e.auth);return(await(0,nU.drive)({version:"v3",auth:r}).files.create({requestBody:{name:e.propsValue.fileName,...e.propsValue.parentFolder?{parents:[e.propsValue.parentFolder]}:{}},media:{mimeType:o,body:n},supportsAllDrives:e.propsValue.include_team_drives??!1,fields:"id, name, mimeType, kind"})).data}});var sU=he(fl());var yh={strategy:0,items:a(async({auth:e,propsValue:t,lastFetchEpochMS:n})=>(await Ne.getFiles(e,{parent:t.parentFolder,createdTime:n,includeTeamDrive:t.include_team_drives})??[]).map(i=>({epochMilliSeconds:(0,sU.default)(i.createdTime).valueOf(),data:i})),"items")},cU=Aa({auth:Y,name:"new_file",classification:"READ",displayName:"New File",description:"Triggers when a new file is added to Drive or the chosen folder.",aiMetadata:{description:"Fires when a new file appears in Google Drive, optionally scoped to a specific parent folder. Each event represents one newly created file and its metadata, with optional inclusion of the file content."},props:{parentFolder:Ne.parentFolderDropdown({displayName:"Folder",description:"Leave empty to watch all of My Drive. Type to search by folder name."}),include_team_drives:Ne.properties.include_team_drives,include_file_content:$.Checkbox({displayName:"Include File Content",description:"Also download each file. Slower, and very large files may fail.",required:!1,defaultValue:!1})},outputSchema:Hk,type:"POLLING",onEnable:a(async e=>{await Qt.onEnable(yh,e)},"onEnable"),onDisable:a(async e=>{await Qt.onDisable(yh,e)},"onDisable"),run:a(async e=>{let t=await Qt.poll(yh,{auth:e.auth,store:e.store,propsValue:e.propsValue,files:e.files});return await iU(t,e)},"run"),test:a(async e=>{let t=await Qt.test(yh,{auth:e.auth,store:e.store,propsValue:e.propsValue,files:e.files});return await iU(t,e)},"test"),sampleData:{kind:"drive#file",mimeType:"image/png",id:"1dpv4-sKJfKRwI9qx1vWqQhEGEn3EpbI5",name:"google-drive.png",webViewLink:"https://drive.google.com/file/d/1dpv4-sKJfKRwI9qx1vWqQhEGEn3EpbI5/view?usp=drivesdk",createdTime:"2026-08-20T09:12:44.000Z",modifiedTime:"2026-08-20T09:12:44.000Z"}});async function iU(e,t){let n=JSON.parse(JSON.stringify(e));if(t.propsValue.include_file_content){let o=[];for(let i of n)o.push(Zt(t.auth,t.files,i.id,i.name));let r=await Promise.all(o);for(let i=0;i<n.length;i++)n[i].content=r[i]}return n}a(iU,"handleFileContent");var uU=he(fl());var vh={strategy:0,items:a(async({auth:e,propsValue:t,lastFetchEpochMS:n})=>(await Ne.getFolders(e,{parent:t.parentFolder,createdTime:n,includeTeamDrive:t.include_team_drives})??[]).map(i=>({epochMilliSeconds:(0,uU.default)(i.createdTime).valueOf(),data:i})),"items")},lU=Aa({auth:Y,name:"new_folder",classification:"READ",displayName:"New Folder",description:"Triggers when a new folder is created in Drive or the chosen folder.",aiMetadata:{description:"Fires when a new folder is created in Google Drive, optionally scoped to a specific parent folder. Each event represents one newly created folder and its metadata."},props:{parentFolder:Ne.parentFolderDropdown({displayName:"Folder",description:"Leave empty to watch all of My Drive. Type to search by folder name."}),include_team_drives:Ne.properties.include_team_drives},outputSchema:Wk,type:"POLLING",onEnable:a(async e=>{await Qt.onEnable(vh,e)},"onEnable"),onDisable:a(async e=>{await Qt.onDisable(vh,e)},"onDisable"),run:a(async e=>await Qt.poll(vh,e),"run"),test:a(async e=>await Qt.test(vh,e),"test"),sampleData:{kind:"drive#file",mimeType:"application/vnd.google-apps.folder",id:"1aMEtTqIYn5651wdK7WLxaK_SDim4mvXW",name:"Invoices 2026",createdTime:"2026-08-20T09:12:44.000Z"}});var YT=he(fl());var _h={strategy:0,items:a(async({auth:e,propsValue:t,lastFetchEpochMS:n})=>{let o=n===0,r=await Ne.getFiles(e,{parent:t.parentFolder,changedSince:o?void 0:n,mimeTypes:t.file_types,excludeShortcuts:!0,includeTeamDrive:t.include_team_drives,maxPages:o?1:void 0},"modifiedTime desc")??[],i=Date.now();return r.filter(yU).filter(s=>bJ({file:s,now:i})).map(s=>({epochMilliSeconds:gU(s),data:{...s,changeType:TJ({file:s,lastFetchEpochMS:n})}}))},"items")},hU=Aa({auth:Y,name:"new_or_updated_file",classification:"READ",displayName:"New or Updated File",description:"Triggers when a file is created or edited. A rename counts; trashing or moving does not.",aiMetadata:{description:"Fires when a file is created or modified in Google Drive, based on its creation and last-modified times (polling), optionally scoped to a parent folder and to specific file types. Each event represents one file and its metadata, carries a changeType of created or updated, and can include the file content, falling back to a contentError field when a download fails. Choose this over New File when edits to files that already exist should also trigger the flow."},props:{behaviourNote:$.MarkDown({value:"Each event carries a Change Type of created or updated. Several edits between two checks arrive as one event. A chosen folder is watched one level deep, not its subfolders.",variant:"INFO"}),parentFolder:Ne.parentFolderDropdown({displayName:"Folder",description:"Leave empty to watch all of My Drive. Type to search by folder name."}),include_team_drives:Ne.properties.include_team_drives,file_types:$.StaticMultiSelectDropdown({displayName:"File Types",description:"Empty watches every type. Use Dynamic value to add other MIME types.",required:!1,options:{options:[{label:"Google Sheets",value:"application/vnd.google-apps.spreadsheet"},{label:"Google Docs",value:"application/vnd.google-apps.document"},{label:"Google Slides",value:"application/vnd.google-apps.presentation"},{label:"Excel (XLSX)",value:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"},{label:"Excel 97-2003 (XLS)",value:"application/vnd.ms-excel"},{label:"CSV",value:"text/csv"},{label:"Word (DOCX)",value:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"},{label:"PowerPoint (PPTX)",value:"application/vnd.openxmlformats-officedocument.presentationml.presentation"},{label:"PDF",value:"application/pdf"},{label:"Plain Text (TXT)",value:"text/plain"},{label:"PNG",value:"image/png"},{label:"JPEG",value:"image/jpeg"},{label:"ZIP",value:"application/zip"}]}}),include_file_content:$.Checkbox({displayName:"Include File Content",description:"Also download each file. A failed download adds an error instead.",required:!1,defaultValue:!1})},outputSchema:Zk,type:"POLLING",onEnable:a(async e=>{await Qt.onEnable(_h,e)},"onEnable"),onDisable:a(async e=>{await Qt.onDisable(_h,e)},"onDisable"),run:a(async e=>{let t=Date.now()+mU,n=await Qt.poll(_h,e);return await dU({auth:e.auth,files:e.files,items:n,includeFileContent:e.propsValue.include_file_content,deadline:t})},"run"),test:a(async e=>{let t=Date.now()+mU,n=await Qt.test(_h,e);return await dU({auth:e.auth,files:e.files,items:n,includeFileContent:e.propsValue.include_file_content,deadline:t})},"test"),sampleData:{changeType:"updated",kind:"drive#file",id:"1dpv4-sKJfKRwI9qx1vWqQhEGEn3EpbI5",name:"quarterly-report.xlsx",mimeType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",webViewLink:"https://docs.google.com/spreadsheets/d/1dpv4-sKJfKRwI9qx1vWqQhEGEn3EpbI5/edit?usp=drivesdk",createdTime:"2026-08-20T09:12:44.000Z",modifiedTime:"2026-08-25T14:34:07.000Z"}});function hl(e){return typeof e=="string"&&(0,YT.default)(e).isValid()?(0,YT.default)(e).valueOf():0}a(hl,"epochOf");function gU(e){return Math.max(hl(e.modifiedTime),hl(e.createdTime))}a(gU,"changedAtEpoch");function bJ({file:e,now:t}){let n=gU(e);return n>0&&n<=t}a(bJ,"isDeliverable");function TJ({file:e,lastFetchEpochMS:t}){return t>0?hl(e.createdTime)>t?"created":"updated":hl(e.modifiedTime)>hl(e.createdTime)?"updated":"created"}a(TJ,"resolveChangeType");function yU(e){return typeof e=="object"&&e!==null&&"id"in e&&typeof e.id=="string"&&"name"in e&&typeof e.name=="string"}a(yU,"isDriveFile");function EJ(e){return new Promise(t=>setTimeout(t,e))}a(EJ,"delay");function SJ(){return Math.floor(Math.random()*AJ)}a(SJ,"jitterMs");async function xJ({auth:e,files:t,file:n,deadline:o}){let r=RJ;for(let i=1;i<=fU;i++){if(Date.now()>=o)return{error:r};let{data:s,error:u}=await Vv(()=>Zt(e,t,n.id,n.name));if(u===null&&s!==null)return{content:s};r=u===null?"Download returned no content":u.message;let h=i*IJ+SJ();i<fU&&Date.now()+h<o&&await EJ(h)}return{error:r}}a(xJ,"downloadContent");async function dU({auth:e,files:t,items:n,includeFileContent:o,deadline:r}){if(!o)return n;let i=[];for(let s=0;s<n.length;s+=pU){let u=n.slice(s,s+pU),h=await Promise.all(u.map(async g=>{if(!yU(g))return g;let y=await xJ({auth:e,files:t,file:g,deadline:r});return"content"in y?{...g,content:y.content}:{...g,contentError:y.error}}));i.push(...h)}return i}a(dU,"withFileContent");var pU=5,fU=3,IJ=500,AJ=250,mU=4e4,RJ="Timed out before the file content could be downloaded";var vU=he(ze());var _U=re({auth:Y,name:"set_public_access",classification:"WRITE",description:"Let anyone with the link open a file or folder.",audience:"human",aiMetadata:{description:"Makes a Drive file or folder accessible to anyone with the link at the chosen role (reader, commenter, or writer) and returns its shareable view/download URL. Use to publish a resource publicly. Requires the file/folder ID. Not idempotent: each call adds a new anyone-with-link permission.",idempotent:!1},displayName:"Set Public Access",props:{fileId:$.ShortText({displayName:"File or Folder ID",description:"The ID from the item's Drive URL or an earlier step.",required:!0,placeholder:"1dpv4-sKJfKRwI9qx1vWqQhEGEn3EpbI5"}),role:$.StaticDropdown({displayName:"Role",description:"What anyone with the link can do.",display:"cards",options:{options:[{label:"Viewer",value:"reader",description:"Read only",icon:"file"},{label:"Commenter",value:"commenter",description:"Read and comment",icon:"reply"},{label:"Editor",value:"writer",description:"Read and edit",icon:"type"}]},defaultValue:"reader",required:!0})},outputSchema:qk,async run(e){let t=await de(e.auth),n=e.propsValue.fileId,o=e.propsValue.role,r=(0,vU.drive)({version:"v3",auth:t}),i={role:o,type:"anyone"},s=await r.permissions.create({fileId:n,requestBody:i,supportsAllDrives:!0}),u=await r.files.get({fileId:n,fields:"name,mimeType,webContentLink,webViewLink",supportsAllDrives:!0});if(u.data.mimeType==="application/vnd.google-apps.folder")return{...s.data,webViewLink:u.data.webViewLink,downloadUrl:null};let h=await Zt(e.auth,e.files,n,u.data.name);return{...s.data,downloadUrl:h}}});var PU=he(ze());var wU=re({auth:Y,name:"google-drive-move-file",classification:"WRITE",displayName:"Move File",description:"Move a file into another folder.",audience:"human",aiMetadata:{description:"Relocates a Drive file to a target folder, detaching it from its current parents and attaching it to the new one. Use to reorganize a file once you know its ID and the destination folder ID. Idempotent: repeating with the same destination leaves the file in the same folder.",idempotent:!0},props:{fileId:$.ShortText({displayName:"File ID",description:"Use the ID from a trigger or the Find File or Folder action.",required:!0,placeholder:"1dpv4-sKJfKRwI9qx1vWqQhEGEn3EpbI5"}),folderId:Ne.parentFolderDropdown({displayName:"Destination Folder",description:"The folder to move the file into. Type to search by folder name."}),include_team_drives:Ne.properties.include_team_drives},outputSchema:jk,async run(e){let t=e.propsValue.fileId,n=e.propsValue.folderId,o=await de(e.auth),r=(0,PU.drive)({version:"v3",auth:o}),i=await r.files.get({fileId:t,supportsAllDrives:e.propsValue.include_team_drives,fields:"id,parents"});return(await r.files.update({fileId:t,fields:"*",removeParents:i.data.parents?.join(","),addParents:n,supportsAllDrives:e.propsValue.include_team_drives})).data}});var bU=he(ze()),TU=re({auth:Y,name:"delete_gdrive_file",classification:"DESTRUCTIVE",description:"Permanently delete a file, skipping the bin.",audience:"human",aiMetadata:{description:"Permanently deletes a file from Google Drive by its ID, bypassing the trash and making it unrecoverable. Use only when permanent removal is intended; prefer Trash file for reversible deletion. Requires the file ID. Not idempotent: a repeat call fails because the file no longer exists.",idempotent:!1},displayName:"Delete File",props:{fileId:$.ShortText({displayName:"File ID",description:"The ID of the file to delete. This cannot be undone.",required:!0,placeholder:"1dpv4-sKJfKRwI9qx1vWqQhEGEn3EpbI5"}),include_team_drives:Ne.properties.include_team_drives},async run(e){let t=await de(e.auth);return(await(0,bU.drive)({version:"v3",auth:t}).files.delete({fileId:e.propsValue.fileId,supportsAllDrives:e.propsValue.include_team_drives})).data}});var EU=he(ze());var SU=re({auth:Y,name:"trash_gdrive_file",classification:"DESTRUCTIVE",description:"Move a file to the bin, where it can be restored.",audience:"human",aiMetadata:{description:"Moves a Drive file to the trash by its ID, a reversible deletion that can be restored from Drive. Use for safe removal instead of permanent deletion. Requires the file ID. Idempotent: re-trashing an already-trashed file leaves it in the same state.",idempotent:!0},displayName:"Move File to Trash",props:{fileId:$.ShortText({displayName:"File ID",description:"The ID of the file to trash.",required:!0,placeholder:"1dpv4-sKJfKRwI9qx1vWqQhEGEn3EpbI5"}),include_team_drives:Ne.properties.include_team_drives},outputSchema:Gk,async run(e){let t=await de(e.auth),n=(0,EU.drive)({version:"v3",auth:t}),o={trashed:!0};return(await n.files.update({fileId:e.propsValue.fileId,supportsAllDrives:e.propsValue.include_team_drives,requestBody:o})).data}});var xU=require("node:stream"),IU=require("@zip.js/zip.js"),AU=he(en());var DJ=4,OJ=16*1024*1024,$J=8*1024*1024,CJ=20,RU="application/vnd.google-apps.folder",NJ={"application/vnd.google-apps.document":{key:"docs",exportMimeTypes:{pdf:"application/pdf",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"}},"application/vnd.google-apps.spreadsheet":{key:"sheets",exportMimeTypes:{pdf:"application/pdf",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}},"application/vnd.google-apps.presentation":{key:"slides",exportMimeTypes:{pdf:"application/pdf",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation"}}};async function kJ({auth:e,folderId:t,includeTeamDrives:n}){return XT({auth:e,params:{q:`'${t}' in parents and trashed=false`,fields:"nextPageToken,files(id,name,mimeType,size)",supportsAllDrives:"true",includeItemsFromAllDrives:n?"true":"false",corpora:n?"allDrives":"user",pageSize:"1000"}})}a(kJ,"listFolderChildren");function zJ(e,t){let n=t.length>0?t:"/",o=`"${e}"`;if(e.includes("/"))return{name:o,location:n,message:'contains "/"'};if(e.includes("\\"))return{name:o,location:n,message:'contains "\\"'};if(e==="..")return{name:o,location:n,message:"escapes the archive root on extraction"};if(e===".")return{name:o,location:n,message:"collides with other paths once normalized on extraction"}}a(zJ,"checkSafeItemName");function UJ(e,t){if(e.mimeType===RU)return{item:e,name:e.name};let n=NJ[e.mimeType];if(n){let o=t[n.key];if(o==="skip")return;let r=n.exportMimeTypes[o],i=(0,AU.extension)(r);return{item:e,name:i?`${e.name}.${i}`:e.name,downloadUrl:`https://www.googleapis.com/drive/v3/files/${e.id}/export?mimeType=${encodeURIComponent(r)}&supportsAllDrives=true`}}if(!e.mimeType.startsWith("application/vnd.google-apps."))return{item:e,name:e.name,downloadUrl:`https://www.googleapis.com/drive/v3/files/${e.id}?alt=media&supportsAllDrives=true`}}a(UJ,"resolveItem");function MJ(e,t){let n=new Map;for(let{name:i}of e){let s=i.toLowerCase(),u=n.get(s);u?u.push(i):n.set(s,[i])}let o=t.length>0?t:"/",r=[];for(let i of n.values()){if(i.length<=1)continue;let s=[...new Set(i)];r.push({name:s.map(u=>`"${u}"`).join(", "),location:o,message:s.length>1?`${i.length} items would map to the same zip path (names differing only by case collide on Windows and macOS)`:`${i.length} items would map to the same zip path`})}return r}a(MJ,"checkUniqueNames");async function DU({auth:e,folderId:t,relativePrefix:n,nativeFormats:o,includeTeamDrives:r,out:i,errors:s}){let u=await kJ({auth:e,folderId:t,includeTeamDrives:r});if(u.length===0){n.length>0&&i.push({relativePath:n,fileId:t,isEmptyFolder:!0,sizeBytes:0});return}let h=u.map(g=>UJ(g,o)).filter(g=>g!==void 0);for(let{item:g}of h){let y=zJ(g.name,n);y&&s.push(y)}s.push(...MJ(h,n));for(let g of h){let y=n.length>0?`${n}/${g.name}`:g.name;if(g.item.mimeType===RU){await DU({auth:e,folderId:g.item.id,relativePrefix:y,nativeFormats:o,includeTeamDrives:r,out:i,errors:s});continue}let T=Number(g.item.size);i.push({relativePath:y,fileId:g.item.id,isEmptyFolder:!1,downloadUrl:g.downloadUrl,sizeBytes:Number.isFinite(T)?T:$J})}}a(DU,"walk");async function FJ({auth:e,rootFolderId:t,nativeFormats:n,includeTeamDrives:o}){let r=[],i=[];if(await DU({auth:e,folderId:t,relativePrefix:"",nativeFormats:n,includeTeamDrives:o,out:r,errors:i}),i.length>0){let s=[...i].sort((g,y)=>g.location.localeCompare(y.location)||g.name.localeCompare(y.name)),u=s.slice(0,CJ),h=u.map(g=>`- [${g.location}] ${g.name} ${g.message}`);throw s.length>u.length&&h.push(`- ...and ${s.length-u.length} more`),new Error(`Cannot export (${i.length} problem${i.length>1?"s":""}) - Rename the conflicting or unsafe items in Drive and try again.
|
|
111
111
|
${h.join(`
|
|
112
112
|
`)}`)}return r}a(FJ,"collectZipEntries");function LJ(e){let t=[],n=[],o=0;for(let r of e){let i=o+r.sizeBytes>OJ,s=n.length>=DJ;n.length>0&&(i||s)&&(t.push(n),n=[],o=0),n.push(r),o+=r.sizeBytes}return n.length>0&&t.push(n),t}a(LJ,"batchByBytes");async function jJ({auth:e,entry:t,zipWriter:n,fileAddOptions:o}){if(!t.downloadUrl)throw new Error(`No download URL for entry "${t.relativePath}"`);let r=await bt(e),i=await fetch(t.downloadUrl,{headers:{Authorization:`Bearer ${r}`}});if(!i.ok||!i.body){let s=await i.text().catch(()=>"");throw i.status===403&&s.includes("exportSizeLimitExceeded")?new Error(`Export failed for "${t.relativePath}": exceeds Drive's ~10MB export size limit.`):new Error(`Failed to download "${t.relativePath}" (HTTP ${i.status}): ${s}`)}await n.add(t.relativePath,i.body,o)}a(jJ,"downloadAndAddZipEntry");var OU=re({auth:Y,name:"drive_export_folder_as_zip",classification:"READ",displayName:"Export Folder as Zip",description:"Download a folder and all its subfolders as one zip file.",audience:"human",aiMetadata:{description:"Recursively downloads every file in a Drive folder (including subfolders) and packages them into a single zip whose internal paths mirror the folder hierarchy. Native Google Docs/Sheets/Slides are converted per user-chosen format (PDF/Office format) or skipped. Fails the whole action if any single file cannot be downloaded/exported. Optionally password-protects the zip.",idempotent:!0},propertyGroups:[{key:"source",display:"section",label:"Folder to export",icon:"location",props:["folderId","includeTeamDrives"]},{key:"conversion",display:"section",label:"Convert Google files",icon:"file",props:["googleDocsFormat","googleSheetsFormat","googleSlidesFormat"]},{key:"output",display:"section",label:"Output",icon:"paperclip",props:["duplicatePathWarning","outputFileName"]}],props:{folderId:$.Dropdown({displayName:"Folder",description:"Everything inside it, including subfolders, goes into the zip.",required:!0,auth:Y,refreshers:["includeTeamDrives"],refreshOnSearch:!0,options:a(async({auth:e,includeTeamDrives:t},n)=>Ne.fetchFolderDropdownOptions({auth:e,searchValue:n?.searchValue,includeTeamDrives:t}),"options")}),includeTeamDrives:$.Checkbox({displayName:"Include Team Drives",description:"Also include shared drives, not only My Drive.",required:!1,defaultValue:!1}),googleDocsFormat:$.StaticDropdown({displayName:"Google Docs As",description:"Convert Docs to Word or PDF, or leave them out.",required:!0,defaultValue:"docx",options:{options:[{label:"Word (DOCX)",value:"docx"},{label:"PDF",value:"pdf"},{label:"Leave Out",value:"skip"}]}}),googleSheetsFormat:$.StaticDropdown({displayName:"Google Sheets As",description:"Convert Sheets to Excel or PDF, or leave them out.",required:!0,defaultValue:"xlsx",options:{options:[{label:"Excel (XLSX)",value:"xlsx"},{label:"PDF",value:"pdf"},{label:"Leave Out",value:"skip"}]}}),googleSlidesFormat:$.StaticDropdown({displayName:"Google Slides As",description:"Convert Slides to PowerPoint or PDF, or leave them out.",required:!0,defaultValue:"pptx",options:{options:[{label:"PowerPoint (PPTX)",value:"pptx"},{label:"PDF",value:"pdf"},{label:"Leave Out",value:"skip"}]}}),duplicatePathWarning:$.MarkDown({value:'Zip paths copy the Drive names. The export stops before downloading anything if two items in one folder would share a path, for example a Sheet named "Report" exported as PDF next to an existing Report.pdf, or if a name contains / or \\ or is "." or "..". Rename the item in Drive and run again.',variant:"WARNING"}),outputFileName:$.ShortText({displayName:"Zip File Name",description:"Include the .zip extension.",required:!0,defaultValue:"export.zip",placeholder:"export.zip"}),usePassword:$.Checkbox({displayName:"Use Password",description:"Encrypt the zip so a password is needed to open it.",required:!1,defaultValue:!1,advanced:!0}),passwordOptions:$.DynamicProperties({displayName:"Password Options",required:!1,advanced:!0,auth:xa.None(),refreshers:["usePassword"],props:a(async({usePassword:e})=>e?{password:$.ShortText({displayName:"Password",description:"Needed to open the zip.",required:!0}),encryptionMethod:$.StaticDropdown({displayName:"Encryption Method",description:"ZipCrypto opens everywhere; AES-256 is stronger but needs a modern unzip app.",required:!0,defaultValue:"zipcrypto",options:{disabled:!1,options:[{label:"ZipCrypto",value:"zipcrypto"},{label:"AES-256",value:"aes-256"}]}})}:{},"props")})},async run(e){let t={docs:e.propsValue.googleDocsFormat,sheets:e.propsValue.googleSheetsFormat,slides:e.propsValue.googleSlidesFormat},n=await FJ({auth:e.auth,rootFolderId:e.propsValue.folderId,nativeFormats:t,includeTeamDrives:e.propsValue.includeTeamDrives??!1}),o={};if(e.propsValue.usePassword){let y=e.propsValue.passwordOptions?.password,T=e.propsValue.passwordOptions?.encryptionMethod;if(!y)throw new Error('Cannot export: "Use password" is enabled but no password was provided. Enter a password or turn the option off.');o.password=y,T==="aes-256"?o.encryptionStrength=3:o.zipCrypto=!0}let r=new TransformStream,i=new IU.ZipWriter(r.writable),s=xU.Readable.fromWeb(r.readable),u=e.files.write({data:s,fileName:e.propsValue.outputFileName});u.catch(()=>{});let h=[],g=[];for(let y of n)(y.isEmptyFolder?g:h).push(y);try{for(let y of LJ(h))await Promise.all(y.map(T=>jJ({auth:e.auth,entry:T,zipWriter:i,fileAddOptions:o})));for(let y of g)await i.add(`${y.relativePath}/`,void 0,{directory:!0});await i.close()}catch(y){throw s.destroy(y instanceof Error?y:new Error(String(y))),y}return u}});var $U=he(ze());var CU=re({auth:Y,name:"drive_create_folder",classification:"WRITE",displayName:"Create Folder",description:"Create a new empty folder in your Google Drive",audience:"ai",aiMetadata:{description:"Creates a new empty folder in Google Drive, optionally nested under a parent folder (resolve the parent ID via `drive_search_files`). Use to set up a destination before uploading or moving files. Each call creates a distinct folder even with the same name, so retries duplicate.",idempotent:!1},outputSchema:Pz,props:{folder_name:$.ShortText({displayName:"Folder name",description:"The name of the new folder",required:!0}),parent_folder_id:$.ShortText({displayName:"Parent Folder ID",description:"The ID of the folder to create the new folder inside. Leave empty to create it in the root of My Drive. Resolve a folder ID with `drive_search_files`.",required:!1})},async run(e){let t=await de(e.auth);return(await(0,$U.drive)({version:"v3",auth:t}).files.create({requestBody:{mimeType:"application/vnd.google-apps.folder",name:e.propsValue.folder_name,...e.propsValue.parent_folder_id?{parents:[e.propsValue.parent_folder_id]}:{}},supportsAllDrives:!0})).data}});var NU=he(Tu());var kU=re({auth:Y,name:"drive_create_file_from_text",classification:"WRITE",displayName:"Create File from Text",description:"Create a new text file in your Google Drive from text",audience:"ai",aiMetadata:{description:"Creates a new Drive file from inline text content as plain text, CSV, or XML. Use when an agent has generated text it needs to persist as a Drive file; for binary or existing files use `drive_upload_file` instead. Each call creates a new file.",idempotent:!1},outputSchema:Yk,props:{file_name:$.ShortText({displayName:"File name",description:"The name of the new text file",required:!0}),text:$.LongText({displayName:"Text",description:"The text content to add to file",required:!0}),content_type:$.StaticDropdown({displayName:"Content type",description:"Select file type",required:!0,defaultValue:"plain/text",options:{options:[{label:"Text",value:"plain/text"},{label:"CSV",value:"text/csv"},{label:"XML",value:"text/xml"}]}}),parent_folder_id:$.ShortText({displayName:"Parent Folder ID",description:"The ID of the folder to create the file inside. Leave empty to create it in the root of My Drive. Resolve a folder ID with `drive_search_files`.",required:!1})},async run(e){let t={mimeType:e.propsValue.content_type,name:e.propsValue.file_name,...e.propsValue.parent_folder_id?{parents:[e.propsValue.parent_folder_id]}:{}},n=Buffer.from(JSON.stringify(t),"utf-8"),o=Buffer.from(e.propsValue.text,"utf-8"),r=new NU.default;return r.append("Metadata",n,{contentType:"application/json"}),r.append("Media",o,{contentType:e.propsValue.content_type}),(await Yt.sendRequest({method:"POST",url:"https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart",body:r,headers:{...r.getHeaders()},queryParams:{supportsAllDrives:"true"},authentication:{type:"BEARER_TOKEN",token:await bt(e.auth)}})).body}});var zU=he(Tu());var UU=he(en());var MU=re({auth:Y,name:"drive_upload_file",classification:"WRITE",displayName:"Upload File",description:"Upload a file in your Google Drive",audience:"ai",aiMetadata:{description:"Uploads a binary file (from a URL or base64 input) into Drive; MIME type is inferred from the extension. Use to store an existing file or attachment; for plain generated text use `drive_create_file_from_text`, and to fetch a remote URL server-side use `drive_upload_from_url`. Each call creates a new file.",idempotent:!1},outputSchema:Qk,props:{file_name:$.ShortText({displayName:"File name",description:"The name of the file",required:!0}),file:$.File({displayName:"File",description:"The file URL or base64 to upload",required:!0}),parent_folder_id:$.ShortText({displayName:"Parent Folder ID",description:"The ID of the folder to upload the file into. Leave empty to upload to the root of My Drive. Resolve a folder ID with `drive_search_files`.",required:!1})},async run(e){let t=e.propsValue.file,o={mimeType:UU.default.lookup(t.extension?t.extension:""),name:e.propsValue.file_name,...e.propsValue.parent_folder_id?{parents:[e.propsValue.parent_folder_id]}:{}},r=Buffer.from(JSON.stringify(o),"utf-8"),i=Buffer.from(t.base64,"base64"),s=new zU.default;return s.append("Metadata",r,{contentType:"application/json"}),s.append("Media",i),(await Yt.sendRequest({method:"POST",url:"https://www.googleapis.com/upload/drive/v3/files",queryParams:{uploadType:"multipart",supportsAllDrives:"true"},body:s,headers:{...s.getHeaders()},authentication:{type:"BEARER_TOKEN",token:await bt(e.auth)}})).body}});var FU=he(Tu());var LU=he(en());var jU=re({auth:Y,name:"drive_upload_from_url",classification:"WRITE",displayName:"Upload File from URL",description:"Fetch a file from a public URL and upload it into Google Drive.",audience:"ai",aiMetadata:{description:"Fetches a file from a public URL and uploads it into Drive in one step (server-side fetch, no base64 round-trip). Use when the agent has a downloadable link rather than file bytes; for bytes already in hand use `drive_upload_file`, and for plain generated text use `drive_create_file_from_text`. Each call creates a new file.",idempotent:!1},outputSchema:Tz,props:{source_url:$.ShortText({displayName:"Source URL",description:"The publicly accessible URL to fetch the file from. Only public URLs are supported (no authentication headers are sent).",required:!0}),file_name:$.ShortText({displayName:"File name",description:"The name to give the uploaded file in Drive.",required:!0}),mime_type:$.ShortText({displayName:"MIME Type",description:"Optional MIME type for the uploaded file (e.g. application/pdf). Provide this when the URL has no file extension; otherwise the type is inferred from the URL.",required:!1}),parent_folder_id:$.ShortText({displayName:"Parent Folder ID",description:"The ID of the folder to upload the file into. Leave empty to upload to the root of My Drive. Resolve a folder ID with `drive_search_files`.",required:!1})},async run(e){let{source_url:t,file_name:n,mime_type:o,parent_folder_id:r}=e.propsValue,i;try{i=await Yt.sendRequest({method:"GET",url:t,responseType:"arraybuffer"})}catch(b){throw new Error(`Failed to fetch the file from the source URL (${t}). Ensure it is a publicly accessible link. Underlying error: ${b?.message??b}`)}let s=o||LU.default.lookup(t)||"application/octet-stream",u={mimeType:s,name:n,...r?{parents:[r]}:{}},h=Buffer.from(JSON.stringify(u),"utf-8"),g=Buffer.from(i.body),y=new FU.default;return y.append("Metadata",h,{contentType:"application/json"}),y.append("Media",g,{contentType:s}),(await Yt.sendRequest({method:"POST",url:"https://www.googleapis.com/upload/drive/v3/files",queryParams:{uploadType:"multipart",supportsAllDrives:"true"},body:y,headers:{...y.getHeaders()},authentication:{type:"BEARER_TOKEN",token:await bt(e.auth)}})).body}});var qU=he(en());var BU=re({auth:Y,name:"drive_replace_file_content",classification:"WRITE",displayName:"Replace File Content",description:"Replace an existing Drive file's bytes, keeping its ID and name.",audience:"ai",aiMetadata:{description:"Replaces the contents of an existing Drive file with new bytes, keeping the same file ID, name, and location. Use to update a file in place (e.g. overwrite a report); to create a brand-new file use `drive_upload_file`, and to rename without changing content use `drive_update_file_metadata`. Each call overwrites the previous content.",idempotent:!1},outputSchema:uz,props:{file_id:$.ShortText({displayName:"File ID",description:"The ID of the existing file whose content to replace. Resolve it via `drive_search_files` or `drive_get_file`.",required:!0}),file:$.File({displayName:"New File Content",description:"The file URL or base64 whose bytes will replace the existing content.",required:!0}),mime_type:$.ShortText({displayName:"MIME Type",description:"Optional MIME type for the new content (e.g. application/pdf). Provide this when the source has no file extension; otherwise the type is inferred from the extension.",required:!1})},async run(e){let{file_id:t,file:n,mime_type:o}=e.propsValue,r=o||qU.default.lookup(n.extension?n.extension:"")||"application/octet-stream",i=Buffer.from(n.base64,"base64");return(await Yt.sendRequest({method:"PATCH",url:`https://www.googleapis.com/upload/drive/v3/files/${t}`,queryParams:{uploadType:"media",supportsAllDrives:"true"},body:i,headers:{"Content-Type":r},authentication:{type:"BEARER_TOKEN",token:await bt(e.auth)}})).body}});var VU=re({auth:Y,name:"drive_download_file",classification:"READ",displayName:"Download File Content",description:"Read a selected file from google drive file",audience:"ai",aiMetadata:{description:"Downloads a Drive file's bytes by ID and returns a file reference; native Google files (Docs/Sheets/Slides) are auto-exported to their default Office format. Use to retrieve content of a file you have the ID for (obtain it from `drive_search_files` or `drive_get_file`). Read-only.",idempotent:!0},outputSchema:Ez,props:{file_id:$.ShortText({displayName:"File ID",description:"The ID of the file to download. Resolve it via `drive_search_files` or `drive_get_file`.",required:!0}),destination_file_name:$.ShortText({displayName:"Destination File name",required:!1})},run:a(async({auth:e,propsValue:t,files:n})=>Zt(e,n,t.file_id,t.destination_file_name),"run")});var GU=he(ze()),HU=he(en());var ZU=re({auth:Y,name:"drive_export_workspace_file",classification:"READ",displayName:"Export Google Doc/Sheet/Slides",description:"Export a native Google Workspace file (Doc/Sheet/Slides) to a chosen format.",audience:"ai",aiMetadata:{description:"Exports a native Google Workspace file (Doc/Sheet/Slides) to a caller-chosen format and returns the bytes. Use when you need a specific format such as PDF, HTML, CSV, or Markdown; for the default rendition or for ordinary binary files use `drive_download_file`. The chosen format must match the source type (Doc formats for a Doc, Sheet formats for a Sheet, etc.). Read-only. Export size is capped at ~10 MB by Drive.",idempotent:!0},outputSchema:Sz,props:{file_id:$.ShortText({displayName:"File ID",description:"The ID of the native Google Workspace file to export. Resolve it via `drive_search_files` or `drive_get_file`.",required:!0}),mime_type:$.StaticDropdown({displayName:"Export Format",description:"The target format. It must match the source type: Doc formats for a Google Doc, Sheet formats for a Google Sheet, Slides formats for Google Slides. An incompatible pairing returns an error.",required:!0,options:{options:[{label:"Word (DOCX) \u2014 Docs",value:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"},{label:"PDF \u2014 Docs/Sheets/Slides",value:"application/pdf"},{label:"HTML \u2014 Docs",value:"text/html"},{label:"Plain Text (TXT) \u2014 Docs",value:"text/plain"},{label:"Rich Text (RTF) \u2014 Docs",value:"application/rtf"},{label:"OpenDocument Text (ODT) \u2014 Docs",value:"application/vnd.oasis.opendocument.text"},{label:"EPUB \u2014 Docs",value:"application/epub+zip"},{label:"Markdown (MD) \u2014 Docs",value:"text/markdown"},{label:"Excel (XLSX) \u2014 Sheets",value:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"},{label:"CSV \u2014 Sheets",value:"text/csv"},{label:"TSV \u2014 Sheets",value:"text/tab-separated-values"},{label:"OpenDocument Spreadsheet (ODS) \u2014 Sheets",value:"application/vnd.oasis.opendocument.spreadsheet"},{label:"PowerPoint (PPTX) \u2014 Slides",value:"application/vnd.openxmlformats-officedocument.presentationml.presentation"},{label:"OpenDocument Presentation (ODP) \u2014 Slides",value:"application/vnd.oasis.opendocument.presentation"},{label:"PNG \u2014 Slides",value:"image/png"},{label:"SVG \u2014 Slides",value:"image/svg+xml"}]}})},async run(e){let{file_id:t,mime_type:n}=e.propsValue,o=await de(e.auth),r=(0,GU.drive)({version:"v3",auth:o});try{let i=await r.files.export({fileId:t,mimeType:n},{responseType:"arraybuffer"}),s=(0,HU.extension)(n),u=s?"."+s:"";return e.files.write({fileName:t+u,data:Buffer.from(i.data)})}catch(i){throw(i?.errors?.[0]?.reason??i?.response?.data?.error?.errors?.[0]?.reason)==="exportSizeLimitExceeded"?new Error(`Export failed: the file exceeds Drive's ~10 MB export size limit (file ID: ${t}). Use drive_download_file to fetch the source directly instead.`):i.code===403?new Error(`Permission denied exporting file ${t}. You may lack access to this file.`):i.code===400?new Error(`Invalid export for file ${t}: the chosen format does not match the source type, or this is not a native Google Workspace file. Use drive_download_file for ordinary binary files.`):i.code===404?new Error(`File not found (ID: ${t}). Resolve a valid ID via drive_search_files or drive_get_file.`):i}}});var WU=he(ze());var KU=re({auth:Y,name:"drive_get_file",classification:"READ",displayName:"Get File or Folder",description:"Get a file folder for files/sub-folders",audience:"ai",aiMetadata:{description:"Fetches metadata for a single file or folder by its exact ID (name, MIME type, parents, owners, links). Use when you already have an ID (e.g. from a trigger or `drive_search_files`) and need its details, including its parent folder IDs. Read-only and safe to retry.",idempotent:!0},outputSchema:Kk,props:{file_id:$.ShortText({displayName:"File / Folder ID",description:"The ID of the file/folder to fetch. Resolve it via `drive_search_files` or `drive_list_files`.",required:!0})},async run(e){let t=await de(e.auth),o=await(0,WU.drive)({version:"v3",auth:t}).files.get({fileId:e.propsValue.file_id,supportsAllDrives:!0});return o.data?o.data:null}});var Ph=he(en());var JU=re({auth:Y,name:"drive_list_files",classification:"SEARCH",displayName:"List Folder Contents",description:"List files from a Google Drive folder",audience:"ai",aiMetadata:{description:"Lists files and subfolders inside a given folder ID, optionally recursing to a chosen depth and downloading each file's content. Use to enumerate the contents of a known folder; to find a file by name across Drive use `drive_search_files`. Read-only. Requires the folder ID, not a name.",idempotent:!0},outputSchema:Jk,props:{folder_id:$.ShortText({displayName:"Folder ID",description:"The ID of the folder to list. Resolve it via `drive_search_files` (or any other source).",required:!0}),include_trashed:$.Checkbox({displayName:"Include Trashed",description:"Include new files that have been trashed.",required:!1,defaultValue:!1}),depth_level:$.Number({displayName:"Depth Level",description:"How many levels deep to search for files. 1 = current folder only, 2 = current + next level, etc.",required:!1,defaultValue:1}),download_files:$.Checkbox({displayName:"Download Files",description:"Download all file contents in a list",required:!1,defaultValue:!1}),include_team_drives:$.Checkbox({displayName:"Include Team Drives",description:"Determines if folders from Team Drives should be included in the results.",defaultValue:!1,required:!1})},async run(e){let t={type:"drive#fileList",incompleteSearch:!1,files:[]},n=e.propsValue.depth_level||1,o=await hh({auth:e.auth,rootFolderId:e.propsValue.folder_id,maxLevel:n,includeTrashed:e.propsValue.include_trashed??!1,includeTeamDrives:e.propsValue.include_team_drives??!1});if(e.propsValue.download_files){let r=[];for(let i of o){if(i.mimeType==="application/vnd.google-apps.folder"){r.push(i);continue}let s=i.name,u=(0,Ph.extension)(i.mimeType),g=(Ph.extensions[i.mimeType]??(u?[u]:[])).some(y=>s.toLowerCase().endsWith(`.${y}`));u&&!g&&(s=`${s}.${u}`);try{let y=await Zt(e.auth,e.files,i.id,s);r.push({...i,downloadedFile:y})}catch(y){console.warn(`Failed to download file ${i.name}: ${y instanceof Error?y.message:"Download failed"}`),r.push(i)}}t.files=r,t.downloadedFiles=r.map(i=>i.downloadedFile).filter(i=>i!==void 0)}else t.files=o;return t}});var XU=he(ze());var YU=re({auth:Y,name:"drive_search_files",classification:"SEARCH",displayName:"Search Files and Folders",description:"Search a Google Drive folder for files/sub-folders",audience:"ai",aiMetadata:{description:"Searches Drive for files or folders matching a name, full-text, or MIME-type query, optionally scoped to a parent folder. Use this to resolve a human-readable name into a file/folder ID before acting on it; to list a known folder's children use `drive_list_files` instead. Read-only.",idempotent:!0},outputSchema:Xk,props:{query_term:$.StaticDropdown({displayName:"Query Term",description:"The Query term or field of file/folder to search upon.",defaultValue:"name",options:{options:[{label:"File name",value:"name"},{label:"Full text search",value:"fullText"},{label:"Content type",value:"mimeType"}]},required:!0}),operator:$.StaticDropdown({displayName:"Operator",description:"The operator to create criteria.",required:!0,options:{options:[{label:"Contains",value:"contains"},{label:"Equals",value:"="}]},defaultValue:"contains"}),value:$.ShortText({displayName:"Value",description:"Value of the field of file/folder to search for.",required:!0}),type:$.StaticDropdown({displayName:"File Type",description:"(Optional) Choose between files and folders.",required:!1,options:{options:[{label:"All",value:"all"},{label:"Files",value:"file"},{label:"Folders",value:"folder"}]},defaultValue:"all"}),parent_folder_id:$.ShortText({displayName:"Parent Folder ID",description:"(Optional) Restrict the search to files/folders inside this folder ID.",required:!1}),include_team_drives:$.Checkbox({displayName:"Include Team Drives",description:"Determines if folders from Team Drives should be included in the results.",defaultValue:!1,required:!1})},async run(e){let t=await de(e.auth),n=(0,XU.drive)({version:"v3",auth:t}),o=e.propsValue.operator??"contains",i=`${e.propsValue.query_term??"name"} ${o} '${e.propsValue.value}'`;switch(e.propsValue.parent_folder_id&&(i=`${i} and '${e.propsValue.parent_folder_id}' in parents`),e.propsValue.type??"all"){case"file":i=`${i} and mimeType!='application/vnd.google-apps.folder'`;break;case"folder":i=`${i} and mimeType='application/vnd.google-apps.folder'`;break;default:break}let u=[],h;do{let g={q:i,fields:"nextPageToken, files(id, name, mimeType, createdTime, modifiedTime)",includeItemsFromAllDrives:e.propsValue.include_team_drives,supportsAllDrives:!0,corpora:e.propsValue.include_team_drives?"allDrives":"user",pageSize:1e3};h&&(g.pageToken=h);let y=await n.files.list(g);if(y.status!==200)throw console.error(y),new Error("Error searching for the file/folder");u.push(...y.data.files??[]),h=y.data.nextPageToken??void 0}while(h);return u.length>0?u:[]}});var QU=he(ze());var eM=re({auth:Y,name:"drive_copy_file",classification:"WRITE",displayName:"Copy File",description:"Duplicate a file from Google Drive. Returns the new file ID.",audience:"ai",aiMetadata:{description:"Copies an existing Drive file into a target folder under a new name, optionally converting it to a Google Sheet or Doc. Use to clone a file or make an editable Google-format copy; to relocate the original instead of copying use `drive_move_file`. Requires source file ID and destination folder ID. Each call creates a new copy.",idempotent:!1},outputSchema:ez,props:{file_id:$.ShortText({displayName:"File ID",description:"The ID of the file to duplicate. Resolve it via `drive_search_files`.",required:!0}),name:$.ShortText({displayName:"Name",description:"The name of the new file",required:!0}),folder_id:$.ShortText({displayName:"Folder ID",description:"The ID of the folder where the file will be duplicated. Resolve it via `drive_search_files`.",required:!0}),convert_to:$.StaticDropdown({displayName:"Duplicate as",description:"If left unselected the file will be duplicated as it is",required:!1,options:{options:[{label:"Google Sheets",value:"application/vnd.google-apps.spreadsheet"},{label:"Google Docs",value:"application/vnd.google-apps.document"}]}})},async run(e){let t=await de(e.auth),n=e.propsValue.file_id,o=e.propsValue.name,r=e.propsValue.folder_id,i=e.propsValue.convert_to,s=(0,QU.drive)({version:"v3",auth:t}),u={name:o,parents:[r]};i&&(u.mimeType=i);let h=await s.files.copy({fileId:n,auth:t,requestBody:u,supportsAllDrives:!0});if(h.status!==200)throw new Error("Error duplicating file");return h.data}});var tM=he(ze());var rM=re({auth:Y,name:"drive_move_file",classification:"WRITE",displayName:"Move File",description:"Move a Drive file from its current folder(s) to a target folder.",audience:"ai",aiMetadata:{description:"Relocates a file to a target folder, detaching it from its current parents and attaching the new one. Use to reorganize a file by ID; to copy instead of move use drive_copy_file, and to rename without moving use drive_update_file_metadata. Safe to retry \u2014 repeating leaves the file in the same destination.",idempotent:!0},outputSchema:tz,props:{file_id:$.ShortText({displayName:"File ID",description:"The ID of the file to move. Resolve it via drive_search_files or drive_get_file.",required:!0}),folder_id:$.ShortText({displayName:"Destination Folder ID",description:"The ID of the folder to move the file into. Resolve it via drive_search_files; leave empty for the root of My Drive.",required:!0})},async run(e){let t=e.propsValue.file_id,n=e.propsValue.folder_id,o=await de(e.auth),r=(0,tM.drive)({version:"v3",auth:o}),i=await r.files.get({fileId:t,supportsAllDrives:!0,fields:"id,parents"});return(await r.files.update({fileId:t,fields:"*",removeParents:i.data.parents?.join(","),addParents:n,supportsAllDrives:!0})).data}});var nM=he(ze());var oM=re({auth:Y,name:"drive_update_file_metadata",classification:"WRITE",displayName:"Update File Metadata (Rename)",description:"Rename a Drive file/folder or update its description or starred flag (metadata only).",audience:"ai",aiMetadata:{description:"Renames a file/folder or updates its description or starred flag via a metadata-only PATCH. Use to rename or annotate a resource; this never changes the file's location \u2014 to re-parent use `drive_move_file`, and to replace the file's bytes use `drive_replace_file_content`. Safe to retry \u2014 re-applying the same values is a no-op.",idempotent:!0},outputSchema:rz,props:{file_id:$.ShortText({displayName:"File or Folder ID",description:"The ID of the file or folder to update. Resolve it via `drive_search_files` or `drive_get_file`.",required:!0}),name:$.ShortText({displayName:"New Name",description:"A new name for the file or folder. Leave empty to keep the current name.",required:!1}),description:$.ShortText({displayName:"Description",description:"A new description for the file or folder. Leave empty to keep the current description.",required:!1}),starred:$.Checkbox({displayName:"Starred",description:"Whether to mark the file or folder as starred.",required:!1})},async run(e){let{file_id:t,name:n,description:o,starred:r}=e.propsValue,i={};n!=null&&n!==""&&(i.name=n),o!=null&&(i.description=o),r!=null&&(i.starred=r);let s=await de(e.auth),u=(0,nM.drive)({version:"v3",auth:s});try{return(await u.files.update({fileId:t,supportsAllDrives:!0,requestBody:i})).data}catch(h){throw h.code===404?new Error(`File or folder not found (ID: ${t}). Resolve a valid ID via drive_search_files or drive_get_file.`):h.code===403?new Error(`Permission denied updating file ${t}. You may lack edit permission on this resource.`):h}}});var iM=he(ze()),aM=require("stream");var sM=re({auth:Y,name:"drive_save_file_as_pdf",classification:"WRITE",displayName:"Save File as PDF",description:"Save a document as PDF in a Google Drive folder",audience:"ai",aiMetadata:{description:"Exports a native Google document to PDF and saves it as a new file in a target Drive folder. Use to produce a PDF rendition of a Google Doc/Sheet/Slides for sharing or archival (resolve the source and folder IDs via `drive_search_files`). Each call creates a new PDF file.",idempotent:!1},outputSchema:_z,props:{document_id:$.ShortText({displayName:"Document ID",description:"The ID of the document to export. Resolve it via `drive_search_files`.",required:!0}),folder_id:$.ShortText({displayName:"Folder ID",description:"The ID of the folder where the file will be exported. Resolve it via `drive_search_files`.",required:!0}),name:$.ShortText({displayName:"Name",description:"The name of the new file (do not include the extension)",required:!0})},async run(e){let t=await de(e.auth),n=e.propsValue.document_id,o=e.propsValue.folder_id,r=e.propsValue.name,i=(0,iM.drive)({version:"v3",auth:t}),s=await i.files.export({fileId:n,mimeType:"application/pdf"},{responseType:"arraybuffer"}),u={name:r+".pdf",parents:[o]},h=Buffer.from(s.data,"base64"),y={mimeType:"application/pdf",body:new aM.Stream.PassThrough().end(h)};return(await i.files.create({requestBody:u,media:y,supportsAllDrives:!0})).data}});var cM=he(ze());var uM=re({auth:Y,name:"drive_trash_file",classification:"DESTRUCTIVE",displayName:"Trash File",description:"Move a Drive file to the trash by ID (reversible deletion).",audience:"ai",aiMetadata:{description:"Moves a file to the trash by ID \u2014 a reversible deletion restorable from Drive. Use for safe removal; for irreversible removal use drive_delete_file, and to restore use drive_untrash_file. Safe to retry \u2014 re-trashing leaves it trashed.",idempotent:!0},outputSchema:sz,props:{file_id:$.ShortText({displayName:"File ID",description:"The ID of the file to trash. Resolve it via drive_search_files or drive_get_file.",required:!0})},async run(e){let t=await de(e.auth),n=(0,cM.drive)({version:"v3",auth:t}),o={trashed:!0};return(await n.files.update({fileId:e.propsValue.file_id,supportsAllDrives:!0,requestBody:o})).data}});var lM=he(ze());var dM=re({auth:Y,name:"drive_untrash_file",classification:"WRITE",displayName:"Restore File from Trash",description:"Restore a trashed Drive file by ID back to its original location.",audience:"ai",aiMetadata:{description:"Restores a trashed file by ID back to its original location. Use to undo a `drive_trash_file`; to permanently purge instead use `drive_empty_trash` or `drive_delete_file`. Safe to retry \u2014 re-restoring an active file is a no-op.",idempotent:!0},outputSchema:cz,props:{file_id:$.ShortText({displayName:"File ID",description:"The ID of the trashed file to restore. Resolve it via drive_search_files or drive_get_file.",required:!0})},async run(e){let{file_id:t}=e.propsValue,n=await de(e.auth),o=(0,lM.drive)({version:"v3",auth:n});try{return(await o.files.update({fileId:t,supportsAllDrives:!0,requestBody:{trashed:!1}})).data}catch(r){throw r.code===404?new Error(`File not found (ID: ${t}). Resolve a valid ID via drive_search_files or drive_get_file.`):r.code===403?new Error(`Permission denied restoring file ${t}. You may lack permission to restore this resource.`):r}}});var pM=he(ze()),fM=re({auth:Y,name:"drive_delete_file",classification:"DESTRUCTIVE",displayName:"Delete File Permanently",description:"Permanently delete a Drive file by ID, bypassing the trash.",audience:"ai",aiMetadata:{description:"Permanently deletes a file by ID, bypassing the trash \u2014 unrecoverable. Use only when permanent removal is intended; for reversible deletion prefer drive_trash_file. A repeat call fails because the file no longer exists.",idempotent:!1},props:{file_id:$.ShortText({displayName:"File ID",description:"The ID of the file to permanently delete. Resolve it via drive_search_files or drive_get_file.",required:!0})},async run(e){let t=await de(e.auth);return(await(0,pM.drive)({version:"v3",auth:t}).files.delete({fileId:e.propsValue.file_id,supportsAllDrives:!0})).data}});var mM=he(ze());var hM=re({auth:Y,name:"drive_empty_trash",classification:"DESTRUCTIVE",displayName:"Empty Trash",description:"Permanently delete ALL files in the trash (irreversible, account-wide).",audience:"ai",aiMetadata:{description:"DESTRUCTIVE: permanently deletes EVERY file currently in the trash \u2014 this is an irreversible, account-wide purge (not a single file), or scoped to one shared drive if `drive_id` is given. The entire trash is emptied, so any file the user trashed is gone for good. Use only as a deliberate cleanup step; to remove a single file reversibly use `drive_trash_file`, and to permanently remove one specific file use `drive_delete_file`. Not safe to retry casually \u2014 it purges whatever is in the trash at call time.",idempotent:!1},outputSchema:Az,props:{drive_id:$.ShortText({displayName:"Shared Drive ID",description:"Optional. Restrict the purge to a single shared drive's trash (resolve via drive_list_shared_drives). Leave empty to empty the entire My Drive trash for the connected account.",required:!1})},async run(e){let{drive_id:t}=e.propsValue,n=await de(e.auth),o=(0,mM.drive)({version:"v3",auth:n});try{return await o.files.emptyTrash({...t?{driveId:t}:{}}),{success:!0,driveId:t??null}}catch(r){throw r.code===403?new Error("Permission denied emptying the trash. You may lack permission to empty this trash."):r}}});var gM=he(ze());var yM=re({auth:Y,name:"drive_share_file",classification:"WRITE",displayName:"Share File with User",description:"Grant a role on a Drive file or folder to a user by email.",audience:"ai",aiMetadata:{description:"Grants a role to a user (by email) on a file or folder, optionally emailing them. Use to share with a specific person; to share with anyone-with-the-link use drive_set_public_access, and to change an existing collaborator's role use drive_update_permission. Each call creates a new permission grant.",idempotent:!1},outputSchema:nz,props:{file_id:$.ShortText({displayName:"File or Folder ID",description:"The ID of the file or folder to share. Resolve it via drive_search_files or drive_get_file.",required:!0}),user_email:$.ShortText({displayName:"User Email",description:"The email address of the user to grant access to.",required:!0}),role:$.StaticDropdown({displayName:"Role",description:"The role to grant to the user. See https://developers.google.com/drive/api/guides/ref-roles",required:!0,options:{options:[{label:"Organizer",value:"organizer"},{label:"File Organizer",value:"fileOrganizer"},{label:"Writer",value:"writer"},{label:"Commenter",value:"commenter"},{label:"Reader",value:"reader"}]}}),send_invitation_email:$.Checkbox({displayName:"Send Invitation Email",description:"Send an email to the user to notify them of the new permission.",required:!0})},async run(e){let{file_id:t,user_email:n,role:o,send_invitation_email:r}=e.propsValue,i=await de(e.auth),s=(0,gM.drive)({version:"v3",auth:i}),u={type:"user",role:o,emailAddress:n};return(await s.permissions.create({requestBody:u,fileId:t,sendNotificationEmail:r,supportsAllDrives:!0})).data}});var vM=he(ze());var _M=re({auth:Y,name:"drive_set_public_access",classification:"WRITE",displayName:"Set Public Access",description:"Make a Drive file or folder accessible to anyone with the link.",audience:"ai",aiMetadata:{description:"Makes a file or folder accessible to anyone with the link at the chosen role and returns its shareable view/download URL. Use to publish a resource publicly; to share with a named person instead use drive_share_file. Each call adds a new anyone-with-link permission.",idempotent:!1},outputSchema:iz,props:{file_id:$.ShortText({displayName:"File or Folder ID",description:"The ID of the file or folder to make public. Resolve it via drive_search_files or drive_get_file.",required:!0}),role:$.StaticDropdown({displayName:"Role",description:"The role to assign for public access.",options:{options:[{label:"Reader",value:"reader"},{label:"Commenter",value:"commenter"},{label:"Editor",value:"writer"}]},defaultValue:"reader",required:!0})},async run(e){let t=await de(e.auth),n=e.propsValue.file_id,o=e.propsValue.role,r=(0,vM.drive)({version:"v3",auth:t}),i={role:o,type:"anyone"},s=await r.permissions.create({fileId:n,requestBody:i,supportsAllDrives:!0}),u=await r.files.get({fileId:n,fields:"name,mimeType,webContentLink,webViewLink",supportsAllDrives:!0});if(u.data.mimeType==="application/vnd.google-apps.folder")return{...s.data,webViewLink:u.data.webViewLink,downloadUrl:null};let h=await Zt(e.auth,e.files,n,u.data.name);return{...s.data,downloadUrl:h}}});var PM=he(ze());var wM=re({auth:Y,name:"drive_list_permissions",classification:"SEARCH",displayName:"List Permissions",description:"List every permission on a Drive file or folder.",audience:"ai",aiMetadata:{description:"Lists every permission (who has access and at what role) on a file or folder, with each permission's id, type, role, and email/domain. Use to audit sharing before granting or revoking; it is the resolver for the permissionId other sharing atomics need. Read-only.",idempotent:!0},outputSchema:oz,props:{file_id:$.ShortText({displayName:"File or Folder ID",description:"The ID of the file or folder whose permissions to list. Resolve it via drive_search_files or drive_get_file.",required:!0})},async run(e){let{file_id:t}=e.propsValue,n=await de(e.auth),o=(0,PM.drive)({version:"v3",auth:n});try{let i=(await o.permissions.list({fileId:t,fields:"permissions(id,type,role,emailAddress,domain)",supportsAllDrives:!0})).data.permissions??[];return{permissions:i,count:i.length}}catch(r){throw r.code===404?new Error(`File or folder not found (ID: ${t}). Resolve a valid ID via drive_search_files or drive_get_file.`):r.code===403?new Error(`Permission denied listing permissions for file ${t}. You may lack access to this resource.`):r}}});var bM=he(ze());var TM=re({auth:Y,name:"drive_update_permission",classification:"WRITE",displayName:"Update Permission Role",description:"Change an existing collaborator's role on a Drive file or folder.",audience:"ai",aiMetadata:{description:"Changes an existing collaborator's role in place (e.g. reader to writer), resolving the permission by their email internally. Use to upgrade or downgrade access without unsharing; to grant net-new access use drive_share_file. If the user has no existing grant it is a no-op (it never silently creates one). Safe to retry.",idempotent:!0},outputSchema:az,props:{file_id:$.ShortText({displayName:"File or Folder ID",description:"The ID of the file or folder whose permission to update. Resolve it via drive_search_files or drive_get_file.",required:!0}),user_email:$.ShortText({displayName:"User Email",description:"The email address of the collaborator whose role to change. The existing permission is matched by this email; list current grants via drive_list_permissions.",required:!0}),new_role:$.StaticDropdown({displayName:"New Role",description:"The role to set for the user. See https://developers.google.com/drive/api/guides/ref-roles",required:!0,options:{options:[{label:"Organizer",value:"organizer"},{label:"File Organizer",value:"fileOrganizer"},{label:"Writer",value:"writer"},{label:"Commenter",value:"commenter"},{label:"Reader",value:"reader"}]}})},async run(e){let{file_id:t,user_email:n,new_role:o}=e.propsValue,r=await de(e.auth),i=(0,bM.drive)({version:"v3",auth:r});try{let h=((await i.permissions.list({fileId:t,fields:"permissions(id,emailAddress,role)",supportsAllDrives:!0})).data.permissions??[]).find(y=>y.emailAddress===n);return!h||!h.id?{updated:!1,message:`No existing permission found for ${n}. Use drive_share_file to grant new access.`}:{updated:!0,permission:(await i.permissions.update({fileId:t,permissionId:h.id,requestBody:{role:o},supportsAllDrives:!0})).data}}catch(s){throw s.code===404?new Error(`File or folder not found (ID: ${t}). Resolve a valid ID via drive_search_files or drive_get_file.`):s.code===403?new Error(`Permission denied updating the role on file ${t}. You may lack permission to manage sharing on this resource.`):s}}});var EM=he(ze());var SM=re({auth:Y,name:"drive_remove_permission",classification:"DESTRUCTIVE",displayName:"Remove Permission",description:"Revoke a role from a user on a Drive file or folder.",audience:"ai",aiMetadata:{description:"Revokes a specific role from a user (matched by email and role) on a file or folder, resolving the permission ID internally. Use to unshare or remove access; to lower a role instead of removing it use drive_update_permission. Safe to retry \u2014 if no matching permission exists it is a no-op.",idempotent:!0},outputSchema:Rz,props:{file_id:$.ShortText({displayName:"File or Folder ID",description:"The ID of the file or folder to remove the permission from. Resolve it via drive_search_files or drive_get_file.",required:!0}),user_email:$.ShortText({displayName:"User Email",description:"The email address of the user whose access to revoke.",required:!0}),role:$.StaticDropdown({displayName:"Role",description:"The role to remove from the user. The grant is matched by email and role.",required:!0,options:{options:[{label:"Organizer",value:"organizer"},{label:"File Organizer",value:"fileOrganizer"},{label:"Writer",value:"writer"},{label:"Commenter",value:"commenter"},{label:"Reader",value:"reader"}]}})},async run(e){let[t,n]=[e.propsValue.file_id,e.propsValue.user_email],o=await de(e.auth),r=(0,EM.drive)({version:"v3",auth:o}),i=await r.permissions.list({fileId:t,fields:"permissions(id, emailAddress, role)",supportsAllDrives:!0});if(i.data.permissions){for(let s of i.data.permissions)if(s.emailAddress===n&&s.role===e.propsValue.role)return await r.permissions.delete({fileId:t,permissionId:s.id?s.id:"",supportsAllDrives:!0}),{removed:!0,message:"Permission removed"}}return{removed:!1,message:"Permission not found"}}});var xM=he(ze());var IM=re({auth:Y,name:"drive_list_shared_drives",classification:"SEARCH",displayName:"List Shared Drives",description:"List the shared drives the account can access.",audience:"ai",aiMetadata:{description:"Lists the shared drives the account can access, with each drive's id and name. Use to discover a driveId before creating or listing content in a shared drive or before drive_get_shared_drive, drive_update_shared_drive, or drive_delete_shared_drive. Read-only.",idempotent:!0},outputSchema:dz,props:{query:$.ShortText({displayName:"Query",description:"Optional search query to filter shared drives, e.g. name contains 'marketing'. See https://developers.google.com/drive/api/guides/search-shareddrives",required:!1}),page_size:$.Number({displayName:"Page Size",description:"Maximum number of shared drives to return (1-100). Defaults to 100.",required:!1})},async run(e){let{query:t,page_size:n}=e.propsValue,o=await de(e.auth),r=(0,xM.drive)({version:"v3",auth:o});try{let s=(await r.drives.list({q:t||void 0,pageSize:n||void 0})).data.drives??[];return{drives:s,count:s.length}}catch(i){throw i.code===403?new Error("Permission denied listing shared drives. Your account may not have shared-drive access."):i}}});var AM=he(ze());var RM=re({auth:Y,name:"drive_get_shared_drive",classification:"READ",displayName:"Get Shared Drive",description:"Fetch metadata for one shared drive by ID.",audience:"ai",aiMetadata:{description:"Fetches metadata and capabilities for one shared drive by ID (resolve the ID via drive_list_shared_drives). Use to inspect a shared drive's settings before modifying it. Read-only.",idempotent:!0},outputSchema:pz,props:{drive_id:$.ShortText({displayName:"Shared Drive ID",description:"The ID of the shared drive. Resolve it via drive_list_shared_drives.",required:!0})},async run(e){let{drive_id:t}=e.propsValue,n=await de(e.auth),o=(0,AM.drive)({version:"v3",auth:n});try{return(await o.drives.get({driveId:t})).data}catch(r){throw r.code===404?new Error(`Shared drive not found (ID: ${t}). Resolve a valid ID via drive_list_shared_drives.`):r.code===403?new Error(`Permission denied accessing shared drive ${t}. You may not be a member of this drive.`):r}}});var DM=require("crypto");var OM=he(ze());var $M=re({auth:Y,name:"drive_create_shared_drive",classification:"WRITE",displayName:"Create Shared Drive",description:"Create a new shared drive (Team Drive).",audience:"ai",aiMetadata:{description:"Creates a new shared drive (Team Drive) with the given name; the action supplies the required idempotency requestId internally. Use to set up a shared workspace. Each call creates a distinct shared drive. Your Workspace admin must have shared-drive creation enabled (a 403 here is an admin-policy issue, not a scope issue).",idempotent:!1},outputSchema:wz,props:{name:$.ShortText({displayName:"Name",description:"The name of the new shared drive.",required:!0})},async run(e){let{name:t}=e.propsValue,n=await de(e.auth),o=(0,OM.drive)({version:"v3",auth:n}),r=(0,DM.randomUUID)();try{return(await o.drives.create({requestId:r,requestBody:{name:t}})).data}catch(i){throw i.code===403?new Error("Permission denied creating a shared drive. Your Google Workspace admin may have disabled shared-drive creation for your account."):i}}});var CM=he(ze());var NM=re({auth:Y,name:"drive_update_shared_drive",classification:"WRITE",displayName:"Update Shared Drive",description:"Rename or update a shared drive by ID.",audience:"ai",aiMetadata:{description:"Renames or updates a shared drive's settings by ID (resolve via drive_list_shared_drives). Use to rename a shared drive; to remove it entirely use drive_delete_shared_drive. Safe to retry \u2014 re-applying the same values is a no-op.",idempotent:!0},outputSchema:bz,props:{drive_id:$.ShortText({displayName:"Shared Drive ID",description:"The ID of the shared drive to update. Resolve it via drive_list_shared_drives.",required:!0}),name:$.ShortText({displayName:"Name",description:"The new name for the shared drive. Leave empty to keep the current name.",required:!1})},async run(e){let{drive_id:t,name:n}=e.propsValue,o=await de(e.auth),r=(0,CM.drive)({version:"v3",auth:o}),i={};n&&(i.name=n);try{return(await r.drives.update({driveId:t,requestBody:i})).data}catch(s){throw s.code===404?new Error(`Shared drive not found (ID: ${t}). Resolve a valid ID via drive_list_shared_drives.`):s.code===403?new Error(`Permission denied updating shared drive ${t}. You must be an organizer of this drive.`):s}}});var kM=he(ze());var zM=re({auth:Y,name:"drive_delete_shared_drive",classification:"DESTRUCTIVE",displayName:"Delete Shared Drive",description:"Permanently delete a shared drive by ID.",audience:"ai",aiMetadata:{description:"Permanently deletes a shared drive by ID (it must already be empty). Irreversible. Use only to remove a no-longer-needed shared drive. A repeat call fails because the drive no longer exists.",idempotent:!1},outputSchema:Iz,props:{drive_id:$.ShortText({displayName:"Shared Drive ID",description:"The ID of the shared drive to delete. Resolve it via drive_list_shared_drives.",required:!0})},async run(e){let{drive_id:t}=e.propsValue,n=await de(e.auth),o=(0,kM.drive)({version:"v3",auth:n});try{return await o.drives.delete({driveId:t}),{deleted:!0,driveId:t}}catch(r){throw r.code===404?new Error(`Shared drive not found (ID: ${t}). It may have already been deleted. Resolve a valid ID via drive_list_shared_drives.`):r.code===400?new Error(`Cannot delete shared drive ${t}: it must be empty before deletion. Remove or trash all of its files first.`):r.code===403?new Error(`Permission denied deleting shared drive ${t}. You must be an organizer of this drive.`):r}}});var UM=he(ze());var MM=re({auth:Y,name:"drive_create_comment",classification:"WRITE",displayName:"Create Comment",description:"Add a new comment to a Drive file.",audience:"ai",aiMetadata:{description:"Adds a new top-level comment to a file. Use to leave feedback or a note on a file (resolve the file ID via drive_search_files); to respond to an existing comment use drive_create_reply instead. Each call creates a new comment, so retries duplicate.",idempotent:!1},outputSchema:hz,props:{file_id:$.ShortText({displayName:"File ID",description:"The ID of the file to comment on. Resolve it via drive_search_files or drive_get_file.",required:!0}),content:$.LongText({displayName:"Content",description:"The plain-text content of the comment.",required:!0})},async run(e){let{file_id:t,content:n}=e.propsValue,o=await de(e.auth),r=(0,UM.drive)({version:"v3",auth:o});try{return(await r.comments.create({fileId:t,fields:"*",requestBody:{content:n}})).data}catch(i){throw i.code===404?new Error(`File not found (ID: ${t}). Resolve a valid ID via drive_search_files or drive_get_file.`):i.code===403?new Error(`Permission denied commenting on file ${t}. You may lack comment access to this file.`):i}}});var FM=he(ze());var LM=re({auth:Y,name:"drive_list_comments",classification:"SEARCH",displayName:"List Comments",description:"List the comments on a Drive file.",audience:"ai",aiMetadata:{description:"Lists the comments on a file with each comment's id, author, content, and resolved state. Use to read discussion on a file or to resolve a commentId before replying (drive_create_reply) or listing its replies (drive_list_replies). Read-only.",idempotent:!0},outputSchema:fz,props:{file_id:$.ShortText({displayName:"File ID",description:"The ID of the file whose comments to list. Resolve it via drive_search_files or drive_get_file.",required:!0})},async run(e){let{file_id:t}=e.propsValue,n=await de(e.auth),o=(0,FM.drive)({version:"v3",auth:n});try{let i=(await o.comments.list({fileId:t,fields:"*",includeDeleted:!1})).data.comments??[];return{comments:i,count:i.length}}catch(r){throw r.code===404?new Error(`File not found (ID: ${t}). Resolve a valid ID via drive_search_files or drive_get_file.`):r.code===403?new Error(`Permission denied listing comments for file ${t}. You may lack access to this file.`):r}}});var jM=he(ze());var qM=re({auth:Y,name:"drive_create_reply",classification:"WRITE",displayName:"Reply to Comment",description:"Add a reply to an existing comment on a Drive file.",audience:"ai",aiMetadata:{description:"Adds a reply to an existing comment, optionally resolving or reopening the comment via the action field. Use to respond to a comment (resolve the commentId via drive_list_comments); to start a new top-level comment use drive_create_comment instead. Each call creates a new reply, so retries duplicate.",idempotent:!1},outputSchema:mz,props:{file_id:$.ShortText({displayName:"File ID",description:"The ID of the file the comment belongs to. Resolve it via drive_search_files or drive_get_file.",required:!0}),comment_id:$.ShortText({displayName:"Comment ID",description:"The ID of the comment to reply to. Resolve it via drive_list_comments.",required:!0}),content:$.LongText({displayName:"Content",description:"The plain-text content of the reply.",required:!0}),action:$.StaticDropdown({displayName:"Action",description:"Optionally change the parent comment's state: resolve (mark resolved) or reopen.",required:!1,options:{options:[{label:"Resolve",value:"resolve"},{label:"Reopen",value:"reopen"}]}})},async run(e){let{file_id:t,comment_id:n,content:o,action:r}=e.propsValue,i=await de(e.auth),s=(0,jM.drive)({version:"v3",auth:i}),u={content:o};r&&(u.action=r);try{return(await s.replies.create({fileId:t,commentId:n,fields:"*",requestBody:u})).data}catch(h){throw h.code===404?new Error(`File or comment not found (file ID: ${t}, comment ID: ${n}). Resolve the comment ID via drive_list_comments.`):h.code===403?new Error(`Permission denied replying to comment ${n} on file ${t}. You may lack comment access to this file.`):h}}});var BM=he(ze());var VM=re({auth:Y,name:"drive_get_reply",classification:"READ",displayName:"Get Reply",description:"Fetch a single reply on a Drive comment by ID.",audience:"ai",aiMetadata:{description:"Fetches a single reply by ID, including its author, content, and action. Use when you already have a replyId (resolve it via drive_list_replies) and need that one reply's details. Read-only.",idempotent:!0},outputSchema:gz,props:{file_id:$.ShortText({displayName:"File ID",description:"The ID of the file the comment belongs to. Resolve it via drive_search_files or drive_get_file.",required:!0}),comment_id:$.ShortText({displayName:"Comment ID",description:"The ID of the parent comment. Resolve it via drive_list_comments.",required:!0}),reply_id:$.ShortText({displayName:"Reply ID",description:"The ID of the reply to fetch. Resolve it via drive_list_replies.",required:!0})},async run(e){let{file_id:t,comment_id:n,reply_id:o}=e.propsValue,r=await de(e.auth),i=(0,BM.drive)({version:"v3",auth:r});try{return(await i.replies.get({fileId:t,commentId:n,replyId:o,fields:"*"})).data}catch(s){throw s.code===404?new Error(`File, comment, or reply not found (file ID: ${t}, comment ID: ${n}, reply ID: ${o}). Resolve the reply ID via drive_list_replies.`):s.code===403?new Error(`Permission denied fetching reply ${o} on file ${t}. You may lack access to this file.`):s}}});var GM=he(ze());var HM=re({auth:Y,name:"drive_list_replies",classification:"SEARCH",displayName:"List Replies",description:"List the replies under a Drive comment.",audience:"ai",aiMetadata:{description:"Lists the replies under a given comment with each reply's id, author, content, and action. Use to read a comment thread or to resolve a replyId before fetching (drive_get_reply), editing (drive_update_reply), or deleting (drive_delete_reply) a reply. Read-only.",idempotent:!0},outputSchema:yz,props:{file_id:$.ShortText({displayName:"File ID",description:"The ID of the file the comment belongs to. Resolve it via drive_search_files or drive_get_file.",required:!0}),comment_id:$.ShortText({displayName:"Comment ID",description:"The ID of the comment whose replies to list. Resolve it via drive_list_comments.",required:!0})},async run(e){let{file_id:t,comment_id:n}=e.propsValue,o=await de(e.auth),r=(0,GM.drive)({version:"v3",auth:o});try{let s=(await r.replies.list({fileId:t,commentId:n,fields:"*"})).data.replies??[];return{replies:s,count:s.length}}catch(i){throw i.code===404?new Error(`File or comment not found (file ID: ${t}, comment ID: ${n}). Resolve the comment ID via drive_list_comments.`):i.code===403?new Error(`Permission denied listing replies for comment ${n} on file ${t}. You may lack access to this file.`):i}}});var ZM=he(ze());var WM=re({auth:Y,name:"drive_update_reply",classification:"WRITE",displayName:"Update Reply",description:"Edit the text of an existing reply on a Drive comment.",audience:"ai",aiMetadata:{description:"Edits the text of an existing reply by ID (resolve via drive_list_replies). Use to correct or revise a reply you control; to add a new reply instead use drive_create_reply. Safe to retry \u2014 re-applying the same content is a no-op.",idempotent:!0},outputSchema:vz,props:{file_id:$.ShortText({displayName:"File ID",description:"The ID of the file the comment belongs to. Resolve it via drive_search_files or drive_get_file.",required:!0}),comment_id:$.ShortText({displayName:"Comment ID",description:"The ID of the parent comment. Resolve it via drive_list_comments.",required:!0}),reply_id:$.ShortText({displayName:"Reply ID",description:"The ID of the reply to update. Resolve it via drive_list_replies.",required:!0}),content:$.LongText({displayName:"Content",description:"The new plain-text content for the reply.",required:!0})},async run(e){let{file_id:t,comment_id:n,reply_id:o,content:r}=e.propsValue,i=await de(e.auth),s=(0,ZM.drive)({version:"v3",auth:i});try{return(await s.replies.update({fileId:t,commentId:n,replyId:o,fields:"*",requestBody:{content:r}})).data}catch(u){throw u.code===404?new Error(`File, comment, or reply not found (file ID: ${t}, comment ID: ${n}, reply ID: ${o}). Resolve the reply ID via drive_list_replies.`):u.code===403?new Error(`Permission denied updating reply ${o} on file ${t}. You can only edit your own replies.`):u}}});var KM=he(ze());var JM=re({auth:Y,name:"drive_delete_reply",classification:"DESTRUCTIVE",displayName:"Delete Reply",description:"Permanently delete a reply on a Drive comment by ID.",audience:"ai",aiMetadata:{description:"Permanently deletes a reply by ID (resolve via drive_list_replies). Use to remove a reply you control; to edit it instead use drive_update_reply. A repeat call fails because the reply is already gone, so it is not safe to retry blindly.",idempotent:!1},outputSchema:xz,props:{file_id:$.ShortText({displayName:"File ID",description:"The ID of the file the comment belongs to. Resolve it via drive_search_files or drive_get_file.",required:!0}),comment_id:$.ShortText({displayName:"Comment ID",description:"The ID of the parent comment. Resolve it via drive_list_comments.",required:!0}),reply_id:$.ShortText({displayName:"Reply ID",description:"The ID of the reply to delete. Resolve it via drive_list_replies.",required:!0})},async run(e){let{file_id:t,comment_id:n,reply_id:o}=e.propsValue,r=await de(e.auth),i=(0,KM.drive)({version:"v3",auth:r});try{return await i.replies.delete({fileId:t,commentId:n,replyId:o}),{success:!0,reply_id:o}}catch(s){throw s.code===404?new Error(`File, comment, or reply not found (file ID: ${t}, comment ID: ${n}, reply ID: ${o}). It may already be deleted. Resolve the reply ID via drive_list_replies.`):s.code===403?new Error(`Permission denied deleting reply ${o} on file ${t}. You can only delete your own replies.`):s}}});var XM=he(ze());var YM=re({auth:Y,name:"drive_get_about",classification:"READ",displayName:"Get Account & Storage Info",description:"Get the authenticated Drive account, storage quota, and supported formats.",audience:"ai",aiMetadata:{description:"Returns the authenticated user's Drive info: account identity, storage quota and usage, and supported import/export formats. Use to check available space before a large upload, confirm which account is connected, or look up valid export MIME types. Read-only.",idempotent:!0},outputSchema:lz,props:{},async run(e){let t=await de(e.auth),n=(0,XM.drive)({version:"v3",auth:t});try{return(await n.about.get({fields:"user,storageQuota,maxImportSizes,exportFormats"})).data}catch(o){throw o.code===403?new Error("Permission denied fetching Drive account info. The connection may lack the required Drive scope."):o}}});var qJ=VA({minimumSupportedRelease:"0.88.2",logoUrl:"https://cdn.activepieces.com/pieces/google-drive.png",categories:["CONTENT_AND_FILES"],displayName:"Google Drive",description:"Cloud storage and file backup",authors:["BastienMe","ArmanGiau3","Vitalini","pfernandez98","kanarelo","Salem-Alaa","kishanprmr","MoShizzle","AbdulTheActivePiecer","khaledmashaly","abuaboud","geekyme"],triggers:[cU,lU,hU],actions:[Cz,kz,oU,Wz,jz,Zz,tU,Fz,Xz,Oz,Uz,_U,wU,TU,SU,OU,CU,kU,MU,jU,BU,VU,ZU,KU,JU,YU,eM,rM,oM,sM,uM,dM,fM,hM,yM,_M,wM,TM,SM,IM,RM,$M,NM,zM,MM,LM,qM,VM,HM,WM,JM,YM,n0({baseUrl:a(()=>"https://www.googleapis.com/drive/v3","baseUrl"),auth:Y,authMapping:a(async e=>({Authorization:`Bearer ${await bt(e)}`}),"authMapping")})],auth:Y});0&&(module.exports={createGoogleClient,getAccessToken,googleDrive,googleDriveAuth});
|
|
113
113
|
/*! Bundled license information:
|