@activepieces/piece-smtp 0.4.3 → 0.4.4

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@activepieces/piece-smtp",
3
- "version": "0.4.3",
3
+ "version": "0.4.4",
4
4
  "main": "./src/index.js",
5
5
  "dependencies": {},
6
6
  "files": [
package/src/index.js CHANGED
@@ -49,7 +49,7 @@
49
49
  To: <invalid@invalid>\r
50
50
  Subject: Invalid\r
51
51
  \r
52
- Invalid`)}},FromEmailAddress:"invalid@invalid",Destination:{ToAddresses:["invalid@invalid"]}};return this.getRegion((o,a)=>{(o||!a)&&(a="us-east-1");let s=new this.ses.SendEmailCommand(i);this.ses.sesClient.send(s).then(p=>n(null,p)).catch(p=>n(p))}),t}};ks.exports=Pn});var Ds=R((yz,Vt)=>{"use strict";var Ed=Xa(),Rs=K(),Pd=vs(),Td=Ps(),Sd=Ss(),Id=ws(),wd=zs(),Ad=Os(),zd=ne(),$d=pt(),Cs=re(),kd=(process.env.ETHEREAL_API||"https://api.nodemailer.com").replace(/\/+$/,""),Od=(process.env.ETHEREAL_WEB||"https://ethereal.email").replace(/\/+$/,""),Ns=(process.env.ETHEREAL_API_KEY||"").replace(/\s*/g,"")||null,Cd=["true","yes","y","1"].includes((process.env.ETHEREAL_CACHE||"yes").toString().trim().toLowerCase()),gt=!1;Vt.exports.createTransport=function(r,e){let t;if(typeof r=="object"&&typeof r.send!="function"||typeof r=="string"&&/^(smtps?|direct):/i.test(r)){let n=typeof r=="string"?r:r.url;if(n?t=Rs.parseConnectionUrl(n):t=r,t.pool)r=new Pd(t);else if(t.sendmail)r=new Sd(t);else if(t.streamTransport)r=new Id(t);else if(t.jsonTransport)r=new wd(t);else if(t.SES){if(t.SES.ses&&t.SES.aws){let i=new Error("Using legacy SES configuration, expecting @aws-sdk/client-sesv2, see https://nodemailer.com/transports/ses/");throw i.code=zd.ECONFIG,i}r=new Ad(t)}else r=new Td(t)}return new Ed(r,t,e)};Vt.exports.createTestAccount=function(r,e){let t;if(!e&&typeof r=="function"&&(e=r,r=!1),e||(t=new Promise((c,p)=>{e=Rs.callbackPromise(c,p)})),Cd&&gt)return setImmediate(()=>e(null,gt)),t;r=r||kd;let n=[],i=0,o={},a={requestor:Cs.name,version:Cs.version};Ns&&(o.Authorization="Bearer "+Ns);let s=$d(r+"/user",{contentType:"application/json",method:"POST",headers:o,body:Buffer.from(JSON.stringify(a))});return s.on("readable",()=>{let c;for(;(c=s.read())!==null;)n.push(c),i+=c.length}),s.once("error",c=>e(c)),s.once("end",()=>{let c=Buffer.concat(n,i),p;try{p=JSON.parse(c.toString())}catch(f){return e(f)}if(p.status!=="success"||p.error)return e(new Error(p.error||"Request failed"));delete p.status,gt=p,e(null,gt)}),t};Vt.exports.getTestMessageUrl=function(r){if(!r||!r.response)return!1;let e=new Map;return r.response.replace(/\[([^\]]+)\]$/,(t,n)=>{n.replace(/\b([A-Z0-9]+)=([^\s]+)/g,(i,o,a)=>{e.set(o,a)})}),e.has("STATUS")&&e.has("MSGID")?(gt.web||Od)+"/message/"+e.get("MSGID"):!1}});var js=R((bz,Ms)=>{"use strict";Ms.exports={"application/json":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["json","map"]},"application/xml":{source:"iana",compressible:!0,extensions:["xml"]},"application/javascript":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["js","mjs"]},"application/pdf":{source:"iana",compressible:!1,extensions:["pdf"]},"application/zip":{source:"iana",compressible:!1,extensions:["zip"]},"application/gzip":{source:"iana",compressible:!1,extensions:["gz"]},"application/octet-stream":{source:"iana",compressible:!1,extensions:["bin","dat"]},"application/msword":{source:"iana",extensions:["doc"]},"application/vnd.openxmlformats-officedocument.wordprocessingml.document":{source:"iana",extensions:["docx"]},"application/vnd.ms-excel":{source:"iana",extensions:["xls"]},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{source:"iana",extensions:["xlsx"]},"application/vnd.ms-powerpoint":{source:"iana",extensions:["ppt"]},"application/vnd.openxmlformats-officedocument.presentationml.presentation":{source:"iana",extensions:["pptx"]},"application/csv":{compressible:!0,extensions:["csv"]},"application/rtf":{source:"iana",compressible:!0,extensions:["rtf"]},"application/x-tar":{source:"apache",compressible:!0,extensions:["tar"]},"application/x-7z-compressed":{source:"apache",compressible:!1,extensions:["7z"]},"application/wasm":{source:"iana",compressible:!0,extensions:["wasm"]},"text/plain":{source:"iana",compressible:!0,charset:"UTF-8",extensions:["txt","text","log"]},"text/html":{source:"iana",compressible:!0,charset:"UTF-8",extensions:["html","htm"]},"text/css":{source:"iana",compressible:!0,charset:"UTF-8",extensions:["css"]},"text/csv":{source:"iana",compressible:!0,charset:"UTF-8",extensions:["csv"]},"text/markdown":{source:"iana",compressible:!0,charset:"UTF-8",extensions:["md","markdown"]},"text/xml":{source:"iana",compressible:!0,extensions:["xml"]},"text/yaml":{compressible:!0,extensions:["yaml","yml"]},"image/png":{source:"iana",compressible:!1,extensions:["png"]},"image/jpeg":{source:"iana",compressible:!1,extensions:["jpeg","jpg","jpe"]},"image/gif":{source:"iana",compressible:!1,extensions:["gif"]},"image/webp":{source:"apache",compressible:!1,extensions:["webp"]},"image/svg+xml":{source:"iana",compressible:!0,extensions:["svg","svgz"]},"image/bmp":{source:"iana",compressible:!0,extensions:["bmp"]},"image/tiff":{source:"iana",compressible:!1,extensions:["tiff","tif"]},"image/x-icon":{source:"apache",compressible:!0,extensions:["ico"]},"image/heic":{source:"iana",compressible:!1,extensions:["heic"]},"image/avif":{source:"iana",compressible:!1,extensions:["avif"]},"audio/mpeg":{source:"iana",compressible:!1,extensions:["mp3","mpga"]},"audio/wav":{compressible:!1,extensions:["wav"]},"audio/ogg":{source:"iana",compressible:!1,extensions:["ogg","oga"]},"audio/webm":{source:"apache",compressible:!1,extensions:["weba"]},"audio/mp4":{source:"iana",compressible:!1,extensions:["m4a"]},"video/mp4":{source:"iana",compressible:!1,extensions:["mp4","m4v"]},"video/mpeg":{source:"iana",compressible:!1,extensions:["mpeg","mpg"]},"video/webm":{source:"iana",compressible:!1,extensions:["webm"]},"video/quicktime":{source:"iana",compressible:!1,extensions:["mov","qt"]},"video/x-msvideo":{source:"iana",compressible:!1,extensions:["avi"]},"font/woff":{source:"iana",compressible:!1,extensions:["woff"]},"font/woff2":{source:"iana",compressible:!1,extensions:["woff2"]},"font/ttf":{source:"iana",compressible:!0,extensions:["ttf"]},"font/otf":{source:"iana",compressible:!0,extensions:["otf"]},"application/ld+json":{source:"iana",compressible:!0,extensions:["jsonld"]},"application/x-www-form-urlencoded":{source:"iana",compressible:!0},"multipart/form-data":{source:"iana"},"application/vnd.api+json":{source:"iana",compressible:!0},"application/manifest+json":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["webmanifest"]},"application/ics":{compressible:!0,extensions:["ics"]},"text/calendar":{source:"iana",compressible:!0,extensions:["ics","ifb"]},"application/x-ndjson":{compressible:!0,extensions:["ndjson"]}}});var Bs=R(J=>{"use strict";var qt=js(),Nd=require("path").extname,Ls=/^\s*([^;\s]*)(?:;|\s|$)/,Rd=/^text\//i;J.charset=Fs;J.charsets={lookup:Fs};J.contentType=Dd;J.extension=Ud;J.extensions=Object.create(null);J.lookup=Md;J.types=Object.create(null);jd(J.extensions,J.types);function Fs(r){if(!r||typeof r!="string")return!1;var e=Ls.exec(r),t=e&&qt[e[1].toLowerCase()];return t&&t.charset?t.charset:e&&Rd.test(e[1])?"UTF-8":!1}l(Fs,"charset");function Dd(r){if(!r||typeof r!="string")return!1;var e=r.indexOf("/")===-1?J.lookup(r):r;if(!e)return!1;if(e.indexOf("charset")===-1){var t=J.charset(e);t&&(e+="; charset="+t.toLowerCase())}return e}l(Dd,"contentType");function Ud(r){if(!r||typeof r!="string")return!1;var e=Ls.exec(r),t=e&&J.extensions[e[1].toLowerCase()];return!t||!t.length?!1:t[0]}l(Ud,"extension");function Md(r){if(!r||typeof r!="string")return!1;var e=Nd("x."+r).toLowerCase().substr(1);return e&&J.types[e]||!1}l(Md,"lookup");function jd(r,e){var t=["nginx","apache",void 0,"iana"];Object.keys(qt).forEach(l(function(i){var o=qt[i],a=o.extensions;if(!(!a||!a.length)){r[i]=a;for(var s=0;s<a.length;s++){var c=a[s];if(e[c]){var p=t.indexOf(qt[e[c]].source),f=t.indexOf(o.source);if(e[c]!=="application/octet-stream"&&(p>f||p===f&&e[c].substr(0,12)==="application/"))continue}e[c]=i}}},"forEachMimeType"))}l(jd,"populateMaps")});var Hd={};In(Hd,{smtp:()=>Zd,smtpAuth:()=>Gt});module.exports=Js(Hd);var Xs=Object.freeze({status:"aborted"});function P(r,e,t){function n(s,c){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:c,constr:a,traits:new Set},enumerable:!1}),s._zod.traits.has(r))return;s._zod.traits.add(r),e(s,c);let p=a.prototype,f=Object.keys(p);for(let x=0;x<f.length;x++){let m=f[x];m in s||(s[m]=p[m].bind(s))}}l(n,"init");let i=t?.Parent??Object;class o extends i{static{l(this,"Definition")}}Object.defineProperty(o,"name",{value:r});function a(s){var c;let p=t?.Parent?new o:this;n(p,s),(c=p._zod).deferred??(c.deferred=[]);for(let f of p._zod.deferred)f();return p}return l(a,"_"),Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:l(s=>t?.Parent&&s instanceof t.Parent?!0:s?._zod?.traits?.has(r),"value")}),Object.defineProperty(a,"name",{value:r}),a}l(P,"$constructor");var oe=class extends Error{static{l(this,"$ZodAsyncError")}constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},vt=class extends Error{static{l(this,"$ZodEncodeError")}constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}},Kt={};function le(r){return r&&Object.assign(Kt,r),Kt}l(le,"config");function Xt(r){let e=Object.values(r).filter(n=>typeof n=="number");return Object.entries(r).filter(([n,i])=>e.indexOf(+n)===-1).map(([n,i])=>i)}l(Xt,"getEnumValues");function zn(r,e){return typeof e=="bigint"?e.toString():e}l(zn,"jsonStringifyReplacer");function _t(r){return{get value(){{let t=r();return Object.defineProperty(this,"value",{value:t}),t}throw new Error("cached value already set")}}}l(_t,"cached");function $n(r){return r==null}l($n,"nullish");function bt(r){let e=r.startsWith("^")?1:0,t=r.endsWith("$")?r.length-1:r.length;return r.slice(e,t)}l(bt,"cleanRegex");var An=Symbol("evaluating");function H(r,e,t){let n;Object.defineProperty(r,e,{get(){if(n!==An)return n===void 0&&(n=An,n=t()),n},set(i){Object.defineProperty(r,e,{value:i})},configurable:!0})}l(H,"defineLazy");var Yt="captureStackTrace"in Error?Error.captureStackTrace:(...r)=>{};function Ze(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}l(Ze,"isObject");var Ys=_t(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let r=Function;return new r(""),!0}catch{return!1}});function kn(r){if(Ze(r)===!1)return!1;let e=r.constructor;if(e===void 0||typeof e!="function")return!0;let t=e.prototype;return!(Ze(t)===!1||Object.prototype.hasOwnProperty.call(t,"isPrototypeOf")===!1)}l(kn,"isPlainObject");var On=new Set(["string","number","symbol"]);function Ce(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}l(Ce,"escapeRegex");function Et(r,e,t){let n=new r._zod.constr(e??r._zod.def);return(!e||t?.parent)&&(n._zod.parent=r),n}l(Et,"clone");function L(r){let e=r;if(!e)return{};if(typeof e=="string")return{error:l(()=>e,"error")};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:l(()=>e.error,"error")}:e}l(L,"normalizeParams");function Cn(r){return Object.keys(r).filter(e=>r[e]._zod.optin==="optional"&&r[e]._zod.optout==="optional")}l(Cn,"optionalKeys");var Nn={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Ne(r,e=0){if(r.aborted===!0)return!0;for(let t=e;t<r.issues.length;t++)if(r.issues[t]?.continue!==!0)return!0;return!1}l(Ne,"aborted");function ge(r,e){return e.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(r),t})}l(ge,"prefixIssues");function yt(r){return typeof r=="string"?r:r?.message}l(yt,"unwrapMessage");function xe(r,e,t){let n={...r,path:r.path??[]};if(!r.message){let i=yt(r.inst?._zod.def?.error?.(r))??yt(e?.error?.(r))??yt(t.customError?.(r))??yt(t.localeError?.(r))??"Invalid input";n.message=i}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}l(xe,"finalizeIssue");function Rn(r){return Array.isArray(r)?"array":typeof r=="string"?"string":"unknown"}l(Rn,"getLengthableOrigin");function Qt(...r){let[e,t,n]=r;return typeof e=="string"?{message:e,code:"custom",input:t,inst:n}:{...e}}l(Qt,"issue");var Dn=l((r,e)=>{r.name="$ZodError",Object.defineProperty(r,"_zod",{value:r._zod,enumerable:!1}),Object.defineProperty(r,"issues",{value:e,enumerable:!1}),r.message=JSON.stringify(e,zn,2),Object.defineProperty(r,"toString",{value:l(()=>r.message,"value"),enumerable:!1})},"initializer"),Un=P("$ZodError",Dn),He=P("$ZodError",Dn,{Parent:Error});var ec=l(r=>(e,t,n,i)=>{let o=n?Object.assign(n,{async:!1}):{async:!1},a=e._zod.run({value:t,issues:[]},o);if(a instanceof Promise)throw new oe;if(a.issues.length){let s=new(i?.Err??r)(a.issues.map(c=>xe(c,o,le())));throw Yt(s,i?.callee),s}return a.value},"_parse"),Pt=ec(He),tc=l(r=>async(e,t,n,i)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},a=e._zod.run({value:t,issues:[]},o);if(a instanceof Promise&&(a=await a),a.issues.length){let s=new(i?.Err??r)(a.issues.map(c=>xe(c,o,le())));throw Yt(s,i?.callee),s}return a.value},"_parseAsync"),Tt=tc(He),rc=l(r=>(e,t,n)=>{let i=n?{...n,async:!1}:{async:!1},o=e._zod.run({value:t,issues:[]},i);if(o instanceof Promise)throw new oe;return o.issues.length?{success:!1,error:new(r??Un)(o.issues.map(a=>xe(a,i,le())))}:{success:!0,data:o.value}},"_safeParse"),Ve=rc(He),nc=l(r=>async(e,t,n)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},o=e._zod.run({value:t,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new r(o.issues.map(a=>xe(a,i,le())))}:{success:!0,data:o.value}},"_safeParseAsync"),qe=nc(He);var ic="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",oc=new RegExp(`^${ic}$`);var Mn=l(r=>{let e=r?`[\\s\\S]{${r?.minimum??0},${r?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},"string"),jn=/^-?\d+n?$/,Ln=/^-?\d+$/,er=/^-?\d+(?:\.\d+)?$/,Fn=/^(?:true|false)$/i;var ve=P("$ZodCheck",(r,e)=>{var t;r._zod??(r._zod={}),r._zod.def=e,(t=r._zod).onattach??(t.onattach=[])}),ac={number:"number",bigint:"bigint",object:"date"};var Bn=P("$ZodCheckGreaterThan",(r,e)=>{ve.init(r,e);let t=ac[typeof e.value];r._zod.onattach.push(n=>{let i=n._zod.bag,o=(e.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>o&&(e.inclusive?i.minimum=e.value:i.exclusiveMinimum=e.value)}),r._zod.check=n=>{(e.inclusive?n.value>=e.value:n.value>e.value)||n.issues.push({origin:t,code:"too_small",minimum:typeof e.value=="object"?e.value.getTime():e.value,input:n.value,inclusive:e.inclusive,inst:r,continue:!e.abort})}});var Zn=P("$ZodCheckNumberFormat",(r,e)=>{ve.init(r,e),e.format=e.format||"float64";let t=e.format?.includes("int"),n=t?"int":"number",[i,o]=Nn[e.format];r._zod.onattach.push(a=>{let s=a._zod.bag;s.format=e.format,s.minimum=i,s.maximum=o,t&&(s.pattern=Ln)}),r._zod.check=a=>{let s=a.value;if(t){if(!Number.isInteger(s)){a.issues.push({expected:n,format:e.format,code:"invalid_type",continue:!1,input:s,inst:r});return}if(!Number.isSafeInteger(s)){s>0?a.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:r,origin:n,inclusive:!0,continue:!e.abort}):a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:r,origin:n,inclusive:!0,continue:!e.abort});return}}s<i&&a.issues.push({origin:"number",input:s,code:"too_small",minimum:i,inclusive:!0,inst:r,continue:!e.abort}),s>o&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:o,inclusive:!0,inst:r,continue:!e.abort})}});var Hn=P("$ZodCheckMinLength",(r,e)=>{var t;ve.init(r,e),(t=r._zod.def).when??(t.when=n=>{let i=n.value;return!$n(i)&&i.length!==void 0}),r._zod.onattach.push(n=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>i&&(n._zod.bag.minimum=e.minimum)}),r._zod.check=n=>{let i=n.value;if(i.length>=e.minimum)return;let a=Rn(i);n.issues.push({origin:a,code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:r,continue:!e.abort})}});var tr=P("$ZodCheckStringFormat",(r,e)=>{var t,n;ve.init(r,e),r._zod.onattach.push(i=>{let o=i._zod.bag;o.format=e.format,e.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(e.pattern))}),e.pattern?(t=r._zod).check??(t.check=i=>{e.pattern.lastIndex=0,!e.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:e.format,input:i.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:r,continue:!e.abort})}):(n=r._zod).check??(n.check=()=>{})}),Vn=P("$ZodCheckRegex",(r,e)=>{tr.init(r,e),r._zod.check=t=>{e.pattern.lastIndex=0,!e.pattern.test(t.value)&&t.issues.push({origin:"string",code:"invalid_format",format:"regex",input:t.value,pattern:e.pattern.toString(),inst:r,continue:!e.abort})}});var Gn={major:4,minor:3,patch:6};var B=P("$ZodType",(r,e)=>{var t;r??(r={}),r._zod.def=e,r._zod.bag=r._zod.bag||{},r._zod.version=Gn;let n=[...r._zod.def.checks??[]];r._zod.traits.has("$ZodCheck")&&n.unshift(r);for(let i of n)for(let o of i._zod.onattach)o(r);if(n.length===0)(t=r._zod).deferred??(t.deferred=[]),r._zod.deferred?.push(()=>{r._zod.run=r._zod.parse});else{let i=l((a,s,c)=>{let p=Ne(a),f;for(let x of s){if(x._zod.def.when){if(!x._zod.def.when(a))continue}else if(p)continue;let m=a.issues.length,d=x._zod.check(a);if(d instanceof Promise&&c?.async===!1)throw new oe;if(f||d instanceof Promise)f=(f??Promise.resolve()).then(async()=>{await d,a.issues.length!==m&&(p||(p=Ne(a,m)))});else{if(a.issues.length===m)continue;p||(p=Ne(a,m))}}return f?f.then(()=>a):a},"runChecks"),o=l((a,s,c)=>{if(Ne(a))return a.aborted=!0,a;let p=i(s,n,c);if(p instanceof Promise){if(c.async===!1)throw new oe;return p.then(f=>r._zod.parse(f,c))}return r._zod.parse(p,c)},"handleCanaryResult");r._zod.run=(a,s)=>{if(s.skipChecks)return r._zod.parse(a,s);if(s.direction==="backward"){let p=r._zod.parse({value:a.value,issues:[]},{...s,skipChecks:!0});return p instanceof Promise?p.then(f=>o(f,a,s)):o(p,a,s)}let c=r._zod.parse(a,s);if(c instanceof Promise){if(s.async===!1)throw new oe;return c.then(p=>i(p,n,s))}return i(c,n,s)}}H(r,"~standard",()=>({validate:l(i=>{try{let o=Ve(r,i);return o.success?{value:o.data}:{issues:o.error?.issues}}catch{return qe(r,i).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},"validate"),vendor:"zod",version:1}))}),wt=P("$ZodString",(r,e)=>{B.init(r,e),r._zod.pattern=[...r?._zod.bag?.patterns??[]].pop()??Mn(r._zod.bag),r._zod.parse=(t,n)=>{if(e.coerce)try{t.value=String(t.value)}catch{}return typeof t.value=="string"||t.issues.push({expected:"string",code:"invalid_type",input:t.value,inst:r}),t}}),rr=P("$ZodStringFormat",(r,e)=>{tr.init(r,e),wt.init(r,e)});var Yn=P("$ZodURL",(r,e)=>{rr.init(r,e),r._zod.check=t=>{try{let n=t.value.trim(),i=new URL(n);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(i.hostname)||t.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:t.value,inst:r,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||t.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:t.value,inst:r,continue:!e.abort})),e.normalize?t.value=i.href:t.value=n;return}catch{t.issues.push({code:"invalid_format",format:"url",input:t.value,inst:r,continue:!e.abort})}}});var nr=P("$ZodNumber",(r,e)=>{B.init(r,e),r._zod.pattern=r._zod.bag.pattern??er,r._zod.parse=(t,n)=>{if(e.coerce)try{t.value=Number(t.value)}catch{}let i=t.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return t;let o=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return t.issues.push({expected:"number",code:"invalid_type",input:i,inst:r,...o?{received:o}:{}}),t}}),Qn=P("$ZodNumberFormat",(r,e)=>{Zn.init(r,e),nr.init(r,e)}),ir=P("$ZodBoolean",(r,e)=>{B.init(r,e),r._zod.pattern=Fn,r._zod.parse=(t,n)=>{if(e.coerce)try{t.value=!!t.value}catch{}let i=t.value;return typeof i=="boolean"||t.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:r}),t}}),ei=P("$ZodBigInt",(r,e)=>{B.init(r,e),r._zod.pattern=jn,r._zod.parse=(t,n)=>{if(e.coerce)try{t.value=BigInt(t.value)}catch{}return typeof t.value=="bigint"||t.issues.push({expected:"bigint",code:"invalid_type",input:t.value,inst:r}),t}});var ti=P("$ZodAny",(r,e)=>{B.init(r,e),r._zod.parse=t=>t}),ri=P("$ZodUnknown",(r,e)=>{B.init(r,e),r._zod.parse=t=>t});var ni=P("$ZodVoid",(r,e)=>{B.init(r,e),r._zod.parse=(t,n)=>{let i=t.value;return typeof i>"u"||t.issues.push({expected:"void",code:"invalid_type",input:i,inst:r}),t}}),ii=P("$ZodDate",(r,e)=>{B.init(r,e),r._zod.parse=(t,n)=>{if(e.coerce)try{t.value=new Date(t.value)}catch{}let i=t.value,o=i instanceof Date;return o&&!Number.isNaN(i.getTime())||t.issues.push({expected:"date",code:"invalid_type",input:i,...o?{received:"Invalid Date"}:{},inst:r}),t}});function Wn(r,e,t){r.issues.length&&e.issues.push(...ge(t,r.issues)),e.value[t]=r.value}l(Wn,"handleArrayResult");var oi=P("$ZodArray",(r,e)=>{B.init(r,e),r._zod.parse=(t,n)=>{let i=t.value;if(!Array.isArray(i))return t.issues.push({expected:"array",code:"invalid_type",input:i,inst:r}),t;t.value=Array(i.length);let o=[];for(let a=0;a<i.length;a++){let s=i[a],c=e.element._zod.run({value:s,issues:[]},n);c instanceof Promise?o.push(c.then(p=>Wn(p,t,a))):Wn(c,t,a)}return o.length?Promise.all(o).then(()=>t):t}});function It(r,e,t,n,i){if(r.issues.length){if(i&&!(t in n))return;e.issues.push(...ge(t,r.issues))}r.value===void 0?t in n&&(e.value[t]=void 0):e.value[t]=r.value}l(It,"handlePropertyResult");function sc(r){let e=Object.keys(r.shape);for(let n of e)if(!r.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let t=Cn(r.shape);return{...r,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(t)}}l(sc,"normalizeDef");function cc(r,e,t,n,i,o){let a=[],s=i.keySet,c=i.catchall._zod,p=c.def.type,f=c.optout==="optional";for(let x in e){if(s.has(x))continue;if(p==="never"){a.push(x);continue}let m=c.run({value:e[x],issues:[]},n);m instanceof Promise?r.push(m.then(d=>It(d,t,x,e,f))):It(m,t,x,e,f)}return a.length&&t.issues.push({code:"unrecognized_keys",keys:a,input:e,inst:o}),r.length?Promise.all(r).then(()=>t):t}l(cc,"handleCatchall");var ai=P("$ZodObject",(r,e)=>{if(B.init(r,e),!Object.getOwnPropertyDescriptor(e,"shape")?.get){let s=e.shape;Object.defineProperty(e,"shape",{get:l(()=>{let c={...s};return Object.defineProperty(e,"shape",{value:c}),c},"get")})}let n=_t(()=>sc(e));H(r._zod,"propValues",()=>{let s=e.shape,c={};for(let p in s){let f=s[p]._zod;if(f.values){c[p]??(c[p]=new Set);for(let x of f.values)c[p].add(x)}}return c});let i=Ze,o=e.catchall,a;r._zod.parse=(s,c)=>{a??(a=n.value);let p=s.value;if(!i(p))return s.issues.push({expected:"object",code:"invalid_type",input:p,inst:r}),s;s.value={};let f=[],x=a.shape;for(let m of a.keys){let d=x[m],h=d._zod.optout==="optional",y=d._zod.run({value:p[m],issues:[]},c);y instanceof Promise?f.push(y.then(v=>It(v,s,m,p,h))):It(y,s,m,p,h)}return o?cc(f,p,s,c,n.value,r):f.length?Promise.all(f).then(()=>s):s}});function Kn(r,e,t,n){for(let o of r)if(o.issues.length===0)return e.value=o.value,e;let i=r.filter(o=>!Ne(o));return i.length===1?(e.value=i[0].value,i[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:t,errors:r.map(o=>o.issues.map(a=>xe(a,n,le())))}),e)}l(Kn,"handleUnionResults");var or=P("$ZodUnion",(r,e)=>{B.init(r,e),H(r._zod,"optin",()=>e.options.some(i=>i._zod.optin==="optional")?"optional":void 0),H(r._zod,"optout",()=>e.options.some(i=>i._zod.optout==="optional")?"optional":void 0),H(r._zod,"values",()=>{if(e.options.every(i=>i._zod.values))return new Set(e.options.flatMap(i=>Array.from(i._zod.values)))}),H(r._zod,"pattern",()=>{if(e.options.every(i=>i._zod.pattern)){let i=e.options.map(o=>o._zod.pattern);return new RegExp(`^(${i.map(o=>bt(o.source)).join("|")})$`)}});let t=e.options.length===1,n=e.options[0]._zod.run;r._zod.parse=(i,o)=>{if(t)return n(i,o);let a=!1,s=[];for(let c of e.options){let p=c._zod.run({value:i.value,issues:[]},o);if(p instanceof Promise)s.push(p),a=!0;else{if(p.issues.length===0)return p;s.push(p)}}return a?Promise.all(s).then(c=>Kn(c,i,r,o)):Kn(s,i,r,o)}});var si=P("$ZodDiscriminatedUnion",(r,e)=>{e.inclusive=!1,or.init(r,e);let t=r._zod.parse;H(r._zod,"propValues",()=>{let i={};for(let o of e.options){let a=o._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(o)}"`);for(let[s,c]of Object.entries(a)){i[s]||(i[s]=new Set);for(let p of c)i[s].add(p)}}return i});let n=_t(()=>{let i=e.options,o=new Map;for(let a of i){let s=a._zod.propValues?.[e.discriminator];if(!s||s.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(a)}"`);for(let c of s){if(o.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);o.set(c,a)}}return o});r._zod.parse=(i,o)=>{let a=i.value;if(!Ze(a))return i.issues.push({code:"invalid_type",expected:"object",input:a,inst:r}),i;let s=n.value.get(a?.[e.discriminator]);return s?s._zod.run(i,o):e.unionFallback?t(i,o):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:e.discriminator,input:a,path:[e.discriminator],inst:r}),i)}});var ci=P("$ZodRecord",(r,e)=>{B.init(r,e),r._zod.parse=(t,n)=>{let i=t.value;if(!kn(i))return t.issues.push({expected:"record",code:"invalid_type",input:i,inst:r}),t;let o=[],a=e.keyType._zod.values;if(a){t.value={};let s=new Set;for(let p of a)if(typeof p=="string"||typeof p=="number"||typeof p=="symbol"){s.add(typeof p=="number"?p.toString():p);let f=e.valueType._zod.run({value:i[p],issues:[]},n);f instanceof Promise?o.push(f.then(x=>{x.issues.length&&t.issues.push(...ge(p,x.issues)),t.value[p]=x.value})):(f.issues.length&&t.issues.push(...ge(p,f.issues)),t.value[p]=f.value)}let c;for(let p in i)s.has(p)||(c=c??[],c.push(p));c&&c.length>0&&t.issues.push({code:"unrecognized_keys",input:i,inst:r,keys:c})}else{t.value={};for(let s of Reflect.ownKeys(i)){if(s==="__proto__")continue;let c=e.keyType._zod.run({value:s,issues:[]},n);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof s=="string"&&er.test(s)&&c.issues.length){let x=e.keyType._zod.run({value:Number(s),issues:[]},n);if(x instanceof Promise)throw new Error("Async schemas not supported in object keys currently");x.issues.length===0&&(c=x)}if(c.issues.length){e.mode==="loose"?t.value[s]=i[s]:t.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(x=>xe(x,n,le())),input:s,path:[s],inst:r});continue}let f=e.valueType._zod.run({value:i[s],issues:[]},n);f instanceof Promise?o.push(f.then(x=>{x.issues.length&&t.issues.push(...ge(s,x.issues)),t.value[c.value]=x.value})):(f.issues.length&&t.issues.push(...ge(s,f.issues)),t.value[c.value]=f.value)}}return o.length?Promise.all(o).then(()=>t):t}});var pi=P("$ZodEnum",(r,e)=>{B.init(r,e);let t=Xt(e.entries),n=new Set(t);r._zod.values=n,r._zod.pattern=new RegExp(`^(${t.filter(i=>On.has(typeof i)).map(i=>typeof i=="string"?Ce(i):i.toString()).join("|")})$`),r._zod.parse=(i,o)=>{let a=i.value;return n.has(a)||i.issues.push({code:"invalid_value",values:t,input:a,inst:r}),i}}),li=P("$ZodLiteral",(r,e)=>{if(B.init(r,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");let t=new Set(e.values);r._zod.values=t,r._zod.pattern=new RegExp(`^(${e.values.map(n=>typeof n=="string"?Ce(n):n?Ce(n.toString()):String(n)).join("|")})$`),r._zod.parse=(n,i)=>{let o=n.value;return t.has(o)||n.issues.push({code:"invalid_value",values:e.values,input:o,inst:r}),n}});var ui=P("$ZodTransform",(r,e)=>{B.init(r,e),r._zod.parse=(t,n)=>{if(n.direction==="backward")throw new vt(r.constructor.name);let i=e.transform(t.value,t);if(n.async)return(i instanceof Promise?i:Promise.resolve(i)).then(a=>(t.value=a,t));if(i instanceof Promise)throw new oe;return t.value=i,t}});function Jn(r,e){return r.issues.length&&e===void 0?{issues:[],value:void 0}:r}l(Jn,"handleOptionalResult");var di=P("$ZodOptional",(r,e)=>{B.init(r,e),r._zod.optin="optional",r._zod.optout="optional",H(r._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),H(r._zod,"pattern",()=>{let t=e.innerType._zod.pattern;return t?new RegExp(`^(${bt(t.source)})?$`):void 0}),r._zod.parse=(t,n)=>{if(e.innerType._zod.optin==="optional"){let i=e.innerType._zod.run(t,n);return i instanceof Promise?i.then(o=>Jn(o,t.value)):Jn(i,t.value)}return t.value===void 0?t:e.innerType._zod.run(t,n)}});var mi=P("$ZodNullable",(r,e)=>{B.init(r,e),H(r._zod,"optin",()=>e.innerType._zod.optin),H(r._zod,"optout",()=>e.innerType._zod.optout),H(r._zod,"pattern",()=>{let t=e.innerType._zod.pattern;return t?new RegExp(`^(${bt(t.source)}|null)$`):void 0}),H(r._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),r._zod.parse=(t,n)=>t.value===null?t:e.innerType._zod.run(t,n)});var fi=P("$ZodPipe",(r,e)=>{B.init(r,e),H(r._zod,"values",()=>e.in._zod.values),H(r._zod,"optin",()=>e.in._zod.optin),H(r._zod,"optout",()=>e.out._zod.optout),H(r._zod,"propValues",()=>e.in._zod.propValues),r._zod.parse=(t,n)=>{if(n.direction==="backward"){let o=e.out._zod.run(t,n);return o instanceof Promise?o.then(a=>St(a,e.in,n)):St(o,e.in,n)}let i=e.in._zod.run(t,n);return i instanceof Promise?i.then(o=>St(o,e.out,n)):St(i,e.out,n)}});function St(r,e,t){return r.issues.length?(r.aborted=!0,r):e._zod.run({value:r.value,issues:r.issues},t)}l(St,"handlePipeResult");var hi=P("$ZodCustom",(r,e)=>{ve.init(r,e),B.init(r,e),r._zod.parse=(t,n)=>t,r._zod.check=t=>{let n=t.value,i=e.fn(n);if(i instanceof Promise)return i.then(o=>Xn(o,t,n,r));Xn(i,t,n,r)}});function Xn(r,e,t,n){if(!r){let i={code:"custom",input:t,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(i.params=n._zod.def.params),e.issues.push(Qt(i))}}l(Xn,"handleRefineResult");var xi;var ar=class{static{l(this,"$ZodRegistry")}constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t=="object"&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let i={...n,...this._map.get(e)};return Object.keys(i).length?i:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function vi(){return new ar}l(vi,"registry");(xi=globalThis).__zod_globalRegistry??(xi.__zod_globalRegistry=vi());var sr=globalThis.__zod_globalRegistry;function yi(r,e){return new r({type:"string",...L(e)})}l(yi,"_string");function _i(r,e){return new r({type:"string",coerce:!0,...L(e)})}l(_i,"_coercedString");function bi(r,e){return new r({type:"string",format:"url",check:"string_format",abort:!1,...L(e)})}l(bi,"_url");function Ei(r,e){return new r({type:"number",checks:[],...L(e)})}l(Ei,"_number");function Pi(r,e){return new r({type:"number",coerce:!0,checks:[],...L(e)})}l(Pi,"_coercedNumber");function Ti(r,e){return new r({type:"number",check:"number_format",abort:!1,format:"safeint",...L(e)})}l(Ti,"_int");function Si(r,e){return new r({type:"boolean",...L(e)})}l(Si,"_boolean");function Ii(r,e){return new r({type:"boolean",coerce:!0,...L(e)})}l(Ii,"_coercedBoolean");function wi(r,e){return new r({type:"bigint",coerce:!0,...L(e)})}l(wi,"_coercedBigint");function Ai(r){return new r({type:"any"})}l(Ai,"_any");function zi(r){return new r({type:"unknown"})}l(zi,"_unknown");function $i(r,e){return new r({type:"void",...L(e)})}l($i,"_void");function ki(r,e){return new r({type:"date",coerce:!0,...L(e)})}l(ki,"_coercedDate");function At(r,e){return new Bn({check:"greater_than",...L(e),value:r,inclusive:!0})}l(At,"_gte");function te(r,e){return new Hn({check:"min_length",...L(e),minimum:r})}l(te,"_minLength");function ye(r,e){return new Vn({check:"string_format",format:"regex",...L(e),pattern:r})}l(ye,"_regex");function Oi(r,e,t){let n=L(t);return n.abort??(n.abort=!0),new r({type:"custom",check:"custom",fn:e,...n})}l(Oi,"_custom");var V=P("ZodMiniType",(r,e)=>{if(!r._zod)throw new Error("Uninitialized schema in ZodMiniType.");B.init(r,e),r.def=e,r.type=e.type,r.parse=(t,n)=>Pt(r,t,n,{callee:r.parse}),r.safeParse=(t,n)=>Ve(r,t,n),r.parseAsync=async(t,n)=>Tt(r,t,n,{callee:r.parseAsync}),r.safeParseAsync=async(t,n)=>qe(r,t,n),r.check=(...t)=>r.clone({...e,checks:[...e.checks??[],...t.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]},{parent:!0}),r.with=r.check,r.clone=(t,n)=>Et(r,t,n),r.brand=()=>r,r.register=((t,n)=>(t.add(r,n),r)),r.apply=t=>t(r)}),$t=P("ZodMiniString",(r,e)=>{wt.init(r,e),V.init(r,e)});function u(r){return yi($t,r)}l(u,"string");var Ci=P("ZodMiniStringFormat",(r,e)=>{rr.init(r,e),$t.init(r,e)});var bc=P("ZodMiniURL",(r,e)=>{Yn.init(r,e),Ci.init(r,e)});function Ni(r){return bi(bc,r)}l(Ni,"url");var kt=P("ZodMiniNumber",(r,e)=>{nr.init(r,e),V.init(r,e)});function W(r){return Ei(kt,r)}l(W,"number");var Ec=P("ZodMiniNumberFormat",(r,e)=>{Qn.init(r,e),kt.init(r,e)});function Ri(r){return Ti(Ec,r)}l(Ri,"int");var cr=P("ZodMiniBoolean",(r,e)=>{ir.init(r,e),V.init(r,e)});function M(r){return Si(cr,r)}l(M,"boolean");var Di=P("ZodMiniBigInt",(r,e)=>{ei.init(r,e),V.init(r,e)});var Pc=P("ZodMiniAny",(r,e)=>{ti.init(r,e),V.init(r,e)});function We(){return Ai(Pc)}l(We,"any");var Tc=P("ZodMiniUnknown",(r,e)=>{ri.init(r,e),V.init(r,e)});function z(){return zi(Tc)}l(z,"unknown");var Sc=P("ZodMiniVoid",(r,e)=>{ni.init(r,e),V.init(r,e)});function Ui(r){return $i(Sc,r)}l(Ui,"_void");var Mi=P("ZodMiniDate",(r,e)=>{ii.init(r,e),V.init(r,e)});var Ic=P("ZodMiniArray",(r,e)=>{oi.init(r,e),V.init(r,e)});function O(r,e){return new Ic({type:"array",element:r,...L(e)})}l(O,"array");var wc=P("ZodMiniObject",(r,e)=>{ai.init(r,e),V.init(r,e),H(r,"shape",()=>e.shape)});function g(r,e){let t={type:"object",shape:r??{},...L(e)};return new wc(t)}l(g,"object");var Ac=P("ZodMiniUnion",(r,e)=>{or.init(r,e),V.init(r,e)});function C(r,e){return new Ac({type:"union",options:r,...L(e)})}l(C,"union");var zc=P("ZodMiniDiscriminatedUnion",(r,e)=>{si.init(r,e),V.init(r,e)});function _e(r,e,t){return new zc({type:"union",options:e,discriminator:r,...L(t)})}l(_e,"discriminatedUnion");var $c=P("ZodMiniRecord",(r,e)=>{ci.init(r,e),V.init(r,e)});function $(r,e,t){return new $c({type:"record",keyType:r,valueType:e,...L(t)})}l($,"record");var kc=P("ZodMiniEnum",(r,e)=>{pi.init(r,e),V.init(r,e),r.options=Object.values(e.entries)});function D(r,e){let t=Array.isArray(r)?Object.fromEntries(r.map(n=>[n,n])):r;return new kc({type:"enum",entries:t,...L(e)})}l(D,"_enum");var Oc=P("ZodMiniLiteral",(r,e)=>{li.init(r,e),V.init(r,e)});function S(r,e){return new Oc({type:"literal",values:Array.isArray(r)?r:[r],...L(e)})}l(S,"literal");var Cc=P("ZodMiniTransform",(r,e)=>{ui.init(r,e),V.init(r,e)});function be(r){return new Cc({type:"transform",transform:r})}l(be,"transform");var Nc=P("ZodMiniOptional",(r,e)=>{di.init(r,e),V.init(r,e)});function _(r){return new Nc({type:"optional",innerType:r})}l(_,"optional");var Rc=P("ZodMiniNullable",(r,e)=>{mi.init(r,e),V.init(r,e)});function Ke(r){return new Rc({type:"nullable",innerType:r})}l(Ke,"nullable");var Dc=P("ZodMiniPipe",(r,e)=>{fi.init(r,e),V.init(r,e)});function Ee(r,e){return new Dc({type:"pipe",in:r,out:e})}l(Ee,"pipe");var Uc=P("ZodMiniCustom",(r,e)=>{hi.init(r,e),V.init(r,e)});function Ot(r,e){return Oi(Uc,r??(()=>!0),e)}l(Ot,"custom");var Je={};In(Je,{bigint:()=>Zc,boolean:()=>Bc,date:()=>Hc,number:()=>Fc,string:()=>Lc});function Lc(r){return _i($t,r)}l(Lc,"string");function Fc(r){return Pi(kt,r)}l(Fc,"number");function Bc(r){return Ii(cr,r)}l(Bc,"boolean");function Zc(r){return wi(Di,r)}l(Zc,"bigint");function Hc(r){return ki(Mi,r)}l(Hc,"date");var lr=g({retryOnFailure:g({defaultValue:_(M()),hide:_(M())}),continueOnFailure:g({defaultValue:_(M()),hide:_(M())})}),pr=class{constructor(e,t,n,i,o,a,s,c,p,f,x){this.name=e;this.displayName=t;this.description=n;this.props=i;this.run=o;this.test=a;this.requireAuth=s;this.errorHandlingOptions=c;this.outputSchema=p;this.audience=f;this.aiMetadata=x}static{l(this,"IAction")}},Li=l(r=>new pr(r.name,r.displayName,r.description,r.props,r.run,r.test??r.run,r.requireAuth??!0,r.errorHandlingOptions??{continueOnFailure:{defaultValue:!1},retryOnFailure:{defaultValue:!1}},r.outputSchema,r.audience,r.aiMetadata),"createAction");var U=g({displayName:u(),description:_(u())}),N=l((r,e)=>g({type:S(e),required:M(),defaultValue:_(We())}),"TPropertyValue");var X=g({...U.shape,...N(u(),"SHORT_TEXT").shape}),ue=g({...U.shape,...N(u(),"LONG_TEXT").shape});var Fi=g({label:u(),value:z()}),Ct=g({disabled:_(M()),placeholder:_(u()),options:O(Fi)});var Y=g({...U.shape,options:Ct,...N(z(),"STATIC_DROPDOWN").shape}),de=g({...U.shape,options:Ct,...N(O(z()),"STATIC_MULTI_SELECT_DROPDOWN").shape});var ur=g({...U.shape,...N(z(),"DROPDOWN").shape,refreshers:O(u())}),Xe=g({...U.shape,...N(O(z()),"MULTI_SELECT_DROPDOWN").shape,refreshers:O(u())});var me=g({...U.shape,...N(M(),"CHECKBOX").shape});var fe=g({...U.shape,...N(W(),"NUMBER").shape});var Ye=g({...U.shape,...N(z(),"FILE").shape});var Qe=g({...U.shape,...N(u(),"DATE_TIME").shape});var Bi=$(u(),C([X,ue,Y,Xe,de,me,fe,Ye,Qe])),et=g({...U.shape,properties:Bi,...N(O(z()),"ARRAY").shape});var tt=g({...U.shape,...N(C([$(u(),z())]),"JSON").shape});var Zi=C([X,Y,tt,et,de]),qc=$(u(),Zi),dr=g({refreshers:O(u()),...U.shape,...N(z(),"DYNAMIC").shape});var Nt=g({...U.shape,...N(Ui(),"MARKDOWN").shape});var rt=(t=>(t.ARCHIVE="ARCHIVE",t.REGISTRY="REGISTRY",t))(rt||{}),Re=(t=>(t.CUSTOM="CUSTOM",t.OFFICIAL="OFFICIAL",t))(Re||{}),De=(b=>(b.ARTIFICIAL_INTELLIGENCE="ARTIFICIAL_INTELLIGENCE",b.COMMUNICATION="COMMUNICATION",b.COMMERCE="COMMERCE",b.CORE="CORE",b.UNIVERSAL_AI="UNIVERSAL_AI",b.FLOW_CONTROL="FLOW_CONTROL",b.BUSINESS_INTELLIGENCE="BUSINESS_INTELLIGENCE",b.ACCOUNTING="ACCOUNTING",b.PRODUCTIVITY="PRODUCTIVITY",b.CONTENT_AND_FILES="CONTENT_AND_FILES",b.DEVELOPER_TOOLS="DEVELOPER_TOOLS",b.CUSTOMER_SUPPORT="CUSTOMER_SUPPORT",b.FORMS_AND_SURVEYS="FORMS_AND_SURVEYS",b.HUMAN_RESOURCES="HUMAN_RESOURCES",b.PAYMENT_PROCESSING="PAYMENT_PROCESSING",b.MARKETING="MARKETING",b.SALES_AND_CRM="SALES_AND_CRM",b))(De||{});var nt=(t=>(t.AUTHORIZATION_CODE="authorization_code",t.CLIENT_CREDENTIALS="client_credentials",t))(nt||{}),mr="both_client_credentials_and_authorization_code";var Ie=(i=>(i.POLLING="POLLING",i.WEBHOOK="WEBHOOK",i.APP_WEBHOOK="APP_WEBHOOK",i.MANUAL="MANUAL",i))(Ie||{}),it=(o=>(o.NONE="NONE",o.HEADER_PRESENT="HEADER_PRESENT",o.QUERY_PRESENT="QUERY_PRESENT",o.BODY_PARAM_PRESENT="BODY_PARAM_PRESENT",o.HEAD_REQUEST="HEAD_REQUEST",o))(it||{}),Gc=g({strategy:D(it),paramName:_(u())}),ot=(t=>(t.SIMULATION="SIMULATION",t.TEST_FUNCTION="TEST_FUNCTION",t))(ot||{});var Rt=(t=>(t.WEBSOCKET="WEBSOCKET",t.NONE="NONE",t))(Rt||{}),Hi=g({status:_(W()),body:_(z()),headers:_($(u(),u()))}),Vi=g({type:S("DELAY"),resumeDateTime:u(),requestIdToReply:_(u()),handlerId:_(u()),streamStepProgress:_(D(Rt))}),qi=g({type:S("WEBHOOK"),requestId:u(),requestIdToReply:_(u()),response:Hi,handlerId:_(u()),streamStepProgress:_(D(Rt))}),Wc=C([Vi,qi]);var Kc=g({body:z(),rawBody:_(z()),headers:$(u(),u()),queryParams:$(u(),u())});var fr=Oe(require("crypto"),1);var Jc=128,we,Ue,Xc=l(r=>{!we||we.length<r?(we=Buffer.allocUnsafe(r*Jc),fr.default.randomFillSync(we),Ue=0):Ue+r>we.length&&(fr.default.randomFillSync(we),Ue=0),Ue+=r},"fillPool"),Yc=l(r=>(Xc(r|=0),we.subarray(Ue-r,Ue)),"random"),Qc=l((r,e,t)=>{let n=(2<<31-Math.clz32(r.length-1|1))-1,i=Math.ceil(1.6*n*e/r.length);return(o=e)=>{let a="";for(;;){let s=t(i),c=i;for(;c--;)if(a+=r[s[c]&n]||"",a.length===o)return a}}},"customRandom"),Wi=l((r,e=21)=>Qc(r,e,Yc),"customAlphabet");var ep="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",Ki=21,SE=u().check(ye(new RegExp(`^[0-9a-zA-Z]{${Ki}}$`))),tp=Wi(ep,Ki);var Pe=Ee(be(r=>r instanceof Date?r.toISOString():r),u()),Q={id:u(),created:Pe,updated:Pe},F=l(r=>_(Ke(r)),"Nullable");function hr(r){return _(Ke(D(r)))}l(hr,"NullableEnum");var AE=Ee(be(r=>r==="true"||r===!0?!0:r==="false"||r===!1?!1:void 0),_(M())),Dt=l(r=>Ee(be(e=>Array.isArray(e)?e:e!==void 0?[e]:void 0),_(O(r))),"OptionalArrayFromQuery");var kE=$(u(),z());var st=(f=>(f.OPENAI="openai",f.OPENROUTER="openrouter",f.ANTHROPIC="anthropic",f.AZURE="azure",f.GOOGLE="google",f.ACTIVEPIECES="activepieces",f.CLOUDFLARE_GATEWAY="cloudflare-gateway",f.CUSTOM="custom",f.BEDROCK="bedrock",f.MISTRAL="mistral",f))(st||{});var ZE=u().check(ye(/^#[0-9A-Fa-f]{6}$/));var VE=g({filename:u(),data:z(),type:S("file"),mimetype:_(u())});var rp=Oe(Xi());var YE=g({...Q,name:u(),permissions:O(u()),platformId:F(u()),type:u(),userCount:_(W())});var Yi=(n=>(n.AGENT_DECIDE="agent-decide",n.CHOOSE_YOURSELF="choose-yourself",n.LEAVE_EMPTY="leave-empty",n))(Yi||{}),gr=(t=>(t.FILE="FILE",t.TABLE="TABLE",t))(gr||{}),xr=(n=>(n.SSE="sse",n.STREAMABLE_HTTP="streamable-http",n.SIMPLE_HTTP="http",n))(xr||{});var vr=(n=>(n.TEXT="text",n.NUMBER="number",n.BOOLEAN="boolean",n))(vr||{});var yr=(t=>(t.IN_PROGRESS="in-progress",t.COMPLETED="completed",t))(yr||{});var np=g({mode:D(Yi),value:z()}),ip=g({auth:_(u()),fields:$(u(),np)}),op=g({pieceName:u(),pieceVersion:u(),actionName:u(),predefinedInput:_(ip)}),ap=g({type:S("PIECE"),toolName:u().check(te(1)),pieceMetadata:op}),sp=g({type:S("none")}),cp=g({type:S("access_token"),accessToken:u()}),pp=g({type:S("api_key"),apiKey:u(),apiKeyHeader:u()}),lp=g({type:S("headers"),headers:$(u(),u())}),up=_e("type",[sp,cp,pp,lp]),Qi=g({type:S("FLOW"),toolName:u().check(te(1)),externalFlowId:u(),flowDisplayName:_(u())}),eo=g({type:S("MCP"),toolName:u().check(te(1)),serverUrl:Ni(),protocol:D(xr),auth:up}),to=g({type:S("KNOWLEDGE_BASE"),toolName:u().check(te(1)),sourceType:D(gr),sourceId:u(),sourceName:u()}),dp=_e("type",[ap,Qi,eo,to]),mp=g({displayName:u(),description:_(u()),type:D(vr)}),ro=g({type:S("MARKDOWN"),markdown:u()}),Me={type:S("TOOL_CALL"),input:F($(u(),z())),output:_(z()),toolName:u(),status:D(yr),toolCallId:u(),startTime:u(),endTime:_(u())},SP=g(Me),no=_e("toolCallType",[g({...Me,toolCallType:S("PIECE"),pieceName:u(),pieceVersion:u(),actionName:u()}),g({...Me,toolCallType:S("FLOW"),displayName:u(),externalFlowId:u()}),g({...Me,toolCallType:S("MCP"),displayName:u(),serverUrl:u()}),g({...Me,toolCallType:S("KNOWLEDGE_BASE"),displayName:u(),sourceType:u()}),g({...Me,toolCallType:S("UNKNOWN"),displayName:u()})]),fp=C([ro,no]);var _r=(t=>(t.IMAGE="image",t.TEXT="text",t))(_r||{}),he=g({apiKey:u()}),hp=he,gp=g({apiKey:u(),apiKeyHash:u()}),xp=he,vp=he,yp=he,_p=he,bp=he,Ep=he,Pp=he,io=g({accessKeyId:u().check(te(1)),secretAccessKey:u().check(te(1))}),Tp=g({}),Sp=g({}),Ip=g({}),wp=g({}),Ap=g({}),zp=g({}),oo=g({modelId:u(),modelName:u(),modelType:D(_r)}),ao=g({apiKeyHeader:u(),baseUrl:u(),models:O(oo),defaultHeaders:_($(u(),u()))}),so=g({accountId:u(),gatewayId:u(),models:O(oo),vertexProject:_(u()),vertexRegion:_(u())}),co=g({resourceName:u(),apiVersion:Ee(be(r=>typeof r=="string"&&r.trim().length===0?void 0:r),_(u()))}),po=g({region:u().check(te(1))}),$p=C([hp,yp,_p,bp,Ep,vp,xp,gp,io,Pp]),lo=C([ao,so,co,po,Tp,Ip,wp,Ap,Sp,zp]),kp=g({id:u(),name:u(),type:D(_r)}),Op=g({id:u(),name:u(),provider:D(st),config:lo,enabledForChat:M()}),Cp=g({provider:D(st),config:lo,auth:$p,platformId:u()});var zP={openai:"openai",anthropic:"anthropic","google-ai-studio":"google","google-vertex-ai":"google"};var Np=g({base64Url:u(),fileName:u(),extension:_(u())}),Rp=g({mimeType:u(),url:u(),fileName:_(u())}),br=C([Np,Rp]);var Dp=C([g({type:S("file"),value:br}),g({type:S("markdown"),value:u(),files:_(O(br))})]),Up=g({sessionId:u(),message:u(),files:_(O(u()))});var mo=(t=>(t.ON_NEW_RECORD="ON_NEW_RECORD",t.ON_UPDATE_RECORD="ON_UPDATE_RECORD",t))(mo||{}),fo=(t=>(t.ENABLED="ENABLED",t.DISABLED="DISABLED",t))(fo||{}),Er=(n=>(n.RECORD_CREATED="RECORD_CREATED",n.RECORD_UPDATED="RECORD_UPDATED",n.RECORD_DELETED="RECORD_DELETED",n))(Er||{});var Mp=C([g({...Q,name:u(),externalId:u(),type:S("STATIC_DROPDOWN"),tableId:u(),projectId:u(),data:g({options:O(g({value:u()}))})}),g({...Q,name:u(),externalId:u(),type:C([S("TEXT"),S("NUMBER"),S("DATE")]),tableId:u(),projectId:u()})]),jp=g({...Q,name:u(),folderId:F(u()),projectId:u(),externalId:u(),status:hr(fo),trigger:hr(mo)}),Lp=g({...Q,tableId:u(),projectId:u(),cells:$(u(),g({updated:u(),created:u(),value:z(),fieldName:u()}))}),Fp=g({events:O(D(Er)),webhookUrl:u(),flowId:u()}),Bp=g({fields:O(g({id:u(),name:u()})),rows:O($(u(),u())),name:u()}),Zp=g({projectId:u(),limit:_(Je.number()),cursor:_(u()),name:_(u()),externalIds:Dt(u()),folderId:_(u()),folderIds:Dt(u())}),Hp=g({records:O(O(g({fieldId:u(),value:go()}))),tableId:u()}),Vp=g({cells:_(O(g({fieldId:u(),value:go()}))),tableId:u(),agentUpdate:_(M())}),ho=_e("operator",[Ae("eq"),Ae("neq"),Ae("gt"),Ae("gte"),Ae("lt"),Ae("lte"),Ae("co"),uo("exists"),uo("not_exists")]),qp=g({tableId:u(),limit:_(Je.number()),cursor:_(u()),filters:Dt(ho)});function go(){return Ee(be(r=>r==null?r:String(r)),Ke(u()))}l(go,"coerceToString");function Ae(r){return g({fieldId:u(),operator:S(r),value:u()})}l(Ae,"valueFilter");function uo(r){return g({fieldId:u(),operator:S(r)})}l(uo,"existenceFilter");var Gp=g({status:_(W()),body:_(z()),headers:_($(u(),u()))}),Wp=g({...Q,deleted:F(Pe),ownerId:u(),displayName:u(),platformId:u(),externalId:F(u())});var xo=g({name:u(),description:_(u()),type:u(),required:M()}),Kp=g({pieceName:u(),triggerName:u(),input:g({toolName:u(),toolDescription:u(),inputSchema:O(xo),returnsResponse:M()})});var vo="^[0-9]+\\.[0-9]+\\.[0-9]+$",WP=new RegExp(vo),Xp="^([~^])?[0-9]+\\.[0-9]+\\.[0-9]+$",KP=u().check(ye(new RegExp(vo))),JP=u().check(ye(new RegExp(Xp))),Yp=g({packageType:S("ARCHIVE"),pieceType:D(Re),pieceName:u(),pieceVersion:u(),archiveId:u(),platformId:u()}),yo=g({packageType:S("REGISTRY"),pieceType:S("OFFICIAL"),pieceName:u(),pieceVersion:u()}),_o=g({packageType:S("REGISTRY"),pieceType:S("CUSTOM"),pieceName:u(),pieceVersion:u(),platformId:u()}),XP=C([yo,_o]),YP=C([Yp,yo,_o]);var Qp=_e("type",[g({type:S("CRON_EXPRESSION"),cronExpression:u(),timezone:u()}),g({type:S("INTERVAL"),intervalMs:Ri().check(At(6e4))})]),QP=g({...Q,type:D(Ie),projectId:u(),flowId:u(),triggerName:u(),schedule:F(Qp),flowVersionId:u(),pieceName:u(),pieceVersion:u(),deleted:F(u()),simulate:M()}),bo=(v=>(v.UNKNOWN="UNKNOWN",v.FLOW_RUN_LOG="FLOW_RUN_LOG",v.FLOW_RUN_LOG_SLICE="FLOW_RUN_LOG_SLICE",v.PACKAGE_ARCHIVE="PACKAGE_ARCHIVE",v.FLOW_STEP_FILE="FLOW_STEP_FILE",v.SAMPLE_DATA="SAMPLE_DATA",v.TRIGGER_PAYLOAD="TRIGGER_PAYLOAD",v.SAMPLE_DATA_INPUT="SAMPLE_DATA_INPUT",v.TRIGGER_EVENT_FILE="TRIGGER_EVENT_FILE",v.PROJECT_RELEASE="PROJECT_RELEASE",v.FLOW_VERSION_BACKUP="FLOW_VERSION_BACKUP",v.PLATFORM_ASSET="PLATFORM_ASSET",v.USER_PROFILE_PICTURE="USER_PROFILE_PICTURE",v.WEBHOOK_PAYLOAD="WEBHOOK_PAYLOAD",v.KNOWLEDGE_BASE="KNOWLEDGE_BASE",v.FLOW_BUNDLE="FLOW_BUNDLE",v))(bo||{}),Eo=(t=>(t.NONE="NONE",t.ZSTD="ZSTD",t))(Eo||{}),Po=(t=>(t.S3="S3",t.DB="DB",t))(Po||{}),eT=g({...Q,projectId:F(u()),platformId:F(u()),type:D(bo),compression:D(Eo),data:_(z()),location:D(Po),size:F(W()),fileName:F(u()),s3Key:F(u()),metadata:F($(u(),u()))}),To=(n=>(n.ADMIN="ADMIN",n.MEMBER="MEMBER",n.OPERATOR="OPERATOR",n))(To||{}),So=(t=>(t.ACTIVE="ACTIVE",t.INACTIVE="INACTIVE",t))(So||{}),tT=g({id:u(),email:u(),firstName:u(),status:D(So),externalId:F(u()),platformId:F(u()),platformRole:D(To),lastName:u(),created:Pe,updated:Pe,lastActiveDate:F(Pe),imageUrl:F(u())});var Pr=g({...U.shape,...N($(u(),z()),"OBJECT").shape});var zo=g({...U.shape,...N(u(),"COLOR").shape});var Tr=C([X,ue,Nt,me,Y,de,ur,Xe,dr,fe,et,Pr,tt,Qe,Ye,zo]),q={ShortText(r){return{...r,valueSchema:void 0,type:"SHORT_TEXT"}},Checkbox(r){return{...r,valueSchema:void 0,type:"CHECKBOX"}},LongText(r){return{...r,valueSchema:void 0,type:"LONG_TEXT"}},MarkDown(r){return{displayName:"Markdown",required:!1,description:r.value,type:"MARKDOWN",valueSchema:void 0,variant:r.variant??"INFO"}},Number(r){return{...r,valueSchema:void 0,type:"NUMBER"}},Json(r){return{...r,valueSchema:void 0,type:"JSON"}},Array(r){return{...r,valueSchema:void 0,type:"ARRAY"}},Object(r){return{...r,valueSchema:void 0,type:"OBJECT"}},Dropdown(r){return{...r,valueSchema:void 0,type:"DROPDOWN"}},StaticDropdown(r){return{...r,valueSchema:void 0,type:"STATIC_DROPDOWN"}},MultiSelectDropdown(r){return{...r,valueSchema:void 0,type:"MULTI_SELECT_DROPDOWN"}},DynamicProperties(r){return{...r,valueSchema:void 0,type:"DYNAMIC"}},StaticMultiSelectDropdown(r){return{...r,valueSchema:void 0,type:"STATIC_MULTI_SELECT_DROPDOWN"}},DateTime(r){return{...r,valueSchema:void 0,type:"DATE_TIME"}},File(r){return{...r,valueSchema:void 0,type:"FILE"}},Custom(r){let e=r.code.toString();return{...r,code:e,valueSchema:void 0,type:"CUSTOM"}},Color(r){return{...r,valueSchema:void 0,type:"COLOR"}}};var ae=g({displayName:u(),description:_(u())});var $o=g({username:u(),password:u()}),Sr=g({...ae.shape,username:g({displayName:u(),description:_(u())}),password:g({displayName:u(),description:_(u())}),...N($o,"BASIC_AUTH").shape});var nl=$(u(),C([X,ue,fe,me,Y])),Ir=g({...ae.shape,props:nl,...N(z(),"CUSTOM_AUTH").shape});var ze=g({...ae.shape,...N(g({auth:u()}),"SECRET_TEXT").shape});var il=$(u(),C([X,ue,ze,fe,me,Y,de,Nt])),ko=g({...ae.shape,props:il,...N(z(),"OIDC").shape});var wr=(t=>(t.HEADER="HEADER",t.BODY="BODY",t))(wr||{}),Oo=C([X,ze,Y]),Co=$(u(),Oo),ol=g({props:_($(u(),Oo)),authUrl:u(),tokenUrl:u(),scope:O(u()),prompt:_(C([S("none"),S("consent"),S("login"),S("omit")])),pkce:_(M()),pkceMethod:_(C([S("plain"),S("S256")])),authorizationMethod:_(D(wr)),grantType:_(C([D(nt),S(mr)])),extra:_($(u(),u()))}),No=g({access_token:u(),props:_(Co),data:$(u(),We())}),Ar=g({...ae.shape,...ol.shape,...N(No,"OAUTH2").shape});var je=C([Sr,Ir,ko,Ar,ze]),ct="Connection",Mt={SecretText(r){return{...r,valueSchema:void 0,type:"SECRET_TEXT"}},OAuth2(r){return{...r,valueSchema:void 0,type:"OAUTH2",displayName:r.displayName||ct}},BasicAuth(r){return{...r,valueSchema:void 0,type:"BASIC_AUTH",displayName:r.displayName||ct,required:!0}},CustomAuth(r){return{...r,valueSchema:void 0,type:"CUSTOM_AUTH",displayName:r.displayName||ct}},OIDC(r){return{...r,valueSchema:void 0,type:"OIDC",displayName:r.displayName||ct}},None(){}};var CS={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 al=g({...U.shape,...N(z(),"CUSTOM").shape,code:u()});var cl=C([Tr,je]),zr=$(u(),cl),QS=$(u(),Tr);var Ro=C([g({strategy:S("CRON"),cronExpression:u()}),g({strategy:S("NONE")})]);var Do="2",jt="0.82.0";var $r=class{constructor(e,t,n,i,o,a,s,c,p=jt,f,x="",m){this.displayName=e;this.logoUrl=t;this.authors=n;this.events=i;this.categories=s;this.auth=c;this.minimumSupportedRelease=p;this.maximumSupportedRelease=f;this.description=x;this.deprecated=m;this._actions={};this._triggers={};this.getContextInfo=l(()=>({version:Do}),"getContextInfo");(!pl(p)||ll(p,jt))&&(this.minimumSupportedRelease=jt),o.forEach(d=>this._actions[d.name]=d),a.forEach(d=>this._triggers[d.name]=d)}static{l(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:this.auth,minimumSupportedRelease:this.minimumSupportedRelease,maximumSupportedRelease:this.maximumSupportedRelease,deprecated:this.deprecated,contextInfo:this.getContextInfo?.()}}getAction(e){return this._actions[e]}getTrigger(e){return this._triggers[e]}actions(){return this._actions}triggers(){return this._triggers}},Uo=l(r=>{if(r.auth&&Array.isArray(r.auth)&&!r.auth.every((t,n,i)=>n===i.findIndex(o=>o.type===t.type)))throw new Error("Auth properties must be unique by type");return new $r(r.displayName,r.logoUrl,r.authors??[],r.events,r.actions,r.triggers,r.categories??[],r.auth,r.minimumSupportedRelease,r.maximumSupportedRelease,r.description,r.deprecated)},"createPiece");function pl(r){return/^\d+\.\d+\.\d+$/.test(r)}l(pl,"isValidSimpleSemver");function ll(r,e){let[t,n,i]=r.split(".").map(Number),[o,a,s]=e.split(".").map(Number);return t!==o?t<o:n!==a?n<a:i<s}l(ll,"isSemverLessThan");var ul=_($(u(),$(u(),u()))),Mo=g({id:_(u()),name:u(),displayName:u(),logoUrl:u(),description:u(),authors:O(u()),platformId:_(u()),directoryPath:_(u()),auth:_(C([je,O(je)])),version:u(),categories:_(O(D(De))),minimumSupportedRelease:_(u()),maximumSupportedRelease:_(u()),deprecated:_(M()),i18n:ul}),dl=D(["human","ai","both"]),jo=g({description:_(u()),idempotent:_(M())}),Lo=g({name:u(),displayName:u(),description:u(),props:zr,requireAuth:M(),errorHandlingOptions:_(lr),outputSchema:_(Ot()),audience:_(dl),aiMetadata:_(jo)}),Fo=g({name:u(),displayName:u(),description:u(),props:zr,errorHandlingOptions:_(lr),type:D(Ie),sampleData:z(),handshakeConfiguration:_(Ot()),renewConfiguration:_(Ro),testStrategy:D(ot),outputSchema:_(Ot()),aiMetadata:_(jo)}),ml=g({...Mo.shape,actions:$(u(),Lo),triggers:$(u(),Fo)}),fl=g({...Mo.shape,actions:W(),triggers:W(),suggestedActions:_(O(Lo)),suggestedTriggers:_(O(Fo))}),Bo=g({projectUsage:W(),pieceType:D(Re),packageType:D(rt),platformId:_(u()),archiveId:_(u())}),QI=g({...ml.shape,...Bo.shape}),ew=g({...fl.shape,...Bo.shape}),tw=g({name:u(),version:u()});var hl=Oe(require("path")),gl=Oe(require("fs/promises"));var Us=Oe(Ds()),xt={constructConfig(r){let e=r.email&&r.password;return{host:r.host,port:r.port,requireTLS:r.TLS,...e?{auth:{user:r.email,pass:r.password}}:{},connectionTimeout:6e4,secure:r.port===465}},createSMTPTransport(r){let e=xt.constructConfig(r);return Us.default.createTransport(e)}};var Zs=Oe(Bs());var Hs=Li({audience:"both",auth:Gt,name:"send-email",displayName:"Send Email",description:"Send an email using a custom SMTP server.",props:{from:q.ShortText({displayName:"From Email",required:!0}),senderName:q.ShortText({displayName:"Sender Name",required:!1}),to:q.Array({displayName:"To",required:!0}),cc:q.Array({displayName:"CC",required:!1}),replyTo:q.ShortText({displayName:"Reply To",required:!1}),bcc:q.Array({displayName:"BCC",required:!1}),subject:q.ShortText({displayName:"Subject",required:!0}),body_type:q.StaticDropdown({displayName:"Body Type",required:!0,defaultValue:"plain_text",options:{disabled:!1,options:[{label:"plain text",value:"plain_text"},{label:"html",value:"html"}]}}),body:q.LongText({displayName:"Body",required:!0}),customHeaders:q.Object({displayName:"Custom Headers",required:!1}),attachments:q.Array({displayName:"Attachments",required:!1,properties:{file:q.File({displayName:"File",description:"File to attach to the email you want to send",required:!0}),name:q.ShortText({displayName:"Attachment Name",description:"In case you want to change the name of the attachment",required:!1})}})},run:l(async({auth:r,propsValue:e})=>{let t=xt.createSMTPTransport(r.props),i=e.attachments.map(({file:a,name:s})=>{let c=Zs.default.lookup(a.extension?a.extension:"");return{filename:s??a.filename,content:a?.base64,contentType:c||void 0,encoding:"base64"}}),o={from:Fd(e.senderName,e.from),to:e.to.join(","),cc:e.cc?.join(","),inReplyTo:e.replyTo,bcc:e.bcc?.join(","),subject:e.subject,text:e.body_type==="plain_text"?e.body:void 0,html:e.body_type==="html"?e.body:void 0,attachments:i||void 0,headers:e.customHeaders};return await Ld(t,o)},"run")});async function Ld(r,e){let n=0;for(;n<3;)try{return await r.sendMail(e)}catch(i){if("code"in i&&i.code==="ECONNRESET"&&n<2){n++,await new Promise(o=>setTimeout(o,3e3));continue}throw i}}l(Ld,"sendWithRetry");function Fd(r,e){return r?`"${r}" <${e}>`:e}l(Fd,"getFrom");var Bd=[25,465,587,2525],Gt=Mt.CustomAuth({required:!0,props:{host:q.ShortText({displayName:"Host",required:!0}),email:q.ShortText({displayName:"Email",description:"Leave blank if your mail relay does not require authentication.",required:!1}),password:Mt.SecretText({displayName:"Password",description:"Leave blank if your mail relay does not require authentication.",required:!1}),port:q.StaticDropdown({displayName:"Port",required:!0,options:{disabled:!1,options:Bd.map(r=>({label:r.toString(),value:r}))}}),TLS:q.Checkbox({displayName:"Require TLS?",defaultValue:!1,required:!0})},validate:l(async({auth:r})=>{try{let e=xt.createSMTPTransport(r);return new Promise((t,n)=>{e.verify(function(i,o){t(i?{valid:!1,error:JSON.stringify(i)}:{valid:!0})})})}catch(e){switch(e?.code){case"EDNS":return{valid:!1,error:"SMTP server not found or unreachable with error code: EDNS"};case"CONN":return{valid:!1,error:"SMTP server connection failed with error code: CONN"};default:break}return{valid:!1,error:JSON.stringify(e)}}},"validate")}),Zd=Uo({displayName:"SMTP",description:"Send emails using Simple Mail Transfer Protocol",minimumSupportedRelease:"0.30.0",logoUrl:"https://cdn.activepieces.com/pieces/new-core/smtp.svg",categories:["CORE"],authors:["tahboubali","abaza738","kishanprmr","MoShizzle","khaledmashaly","abuaboud","pfernandez98"],auth:Gt,actions:[Hs],triggers:[]});0&&(module.exports={smtp,smtpAuth});
52
+ Invalid`)}},FromEmailAddress:"invalid@invalid",Destination:{ToAddresses:["invalid@invalid"]}};return this.getRegion((o,a)=>{(o||!a)&&(a="us-east-1");let s=new this.ses.SendEmailCommand(i);this.ses.sesClient.send(s).then(p=>n(null,p)).catch(p=>n(p))}),t}};ks.exports=Pn});var Ds=R((yz,Vt)=>{"use strict";var Ed=Xa(),Rs=K(),Pd=vs(),Td=Ps(),Sd=Ss(),Id=ws(),wd=zs(),Ad=Os(),zd=ne(),$d=pt(),Cs=re(),kd=(process.env.ETHEREAL_API||"https://api.nodemailer.com").replace(/\/+$/,""),Od=(process.env.ETHEREAL_WEB||"https://ethereal.email").replace(/\/+$/,""),Ns=(process.env.ETHEREAL_API_KEY||"").replace(/\s*/g,"")||null,Cd=["true","yes","y","1"].includes((process.env.ETHEREAL_CACHE||"yes").toString().trim().toLowerCase()),gt=!1;Vt.exports.createTransport=function(r,e){let t;if(typeof r=="object"&&typeof r.send!="function"||typeof r=="string"&&/^(smtps?|direct):/i.test(r)){let n=typeof r=="string"?r:r.url;if(n?t=Rs.parseConnectionUrl(n):t=r,t.pool)r=new Pd(t);else if(t.sendmail)r=new Sd(t);else if(t.streamTransport)r=new Id(t);else if(t.jsonTransport)r=new wd(t);else if(t.SES){if(t.SES.ses&&t.SES.aws){let i=new Error("Using legacy SES configuration, expecting @aws-sdk/client-sesv2, see https://nodemailer.com/transports/ses/");throw i.code=zd.ECONFIG,i}r=new Ad(t)}else r=new Td(t)}return new Ed(r,t,e)};Vt.exports.createTestAccount=function(r,e){let t;if(!e&&typeof r=="function"&&(e=r,r=!1),e||(t=new Promise((c,p)=>{e=Rs.callbackPromise(c,p)})),Cd&&gt)return setImmediate(()=>e(null,gt)),t;r=r||kd;let n=[],i=0,o={},a={requestor:Cs.name,version:Cs.version};Ns&&(o.Authorization="Bearer "+Ns);let s=$d(r+"/user",{contentType:"application/json",method:"POST",headers:o,body:Buffer.from(JSON.stringify(a))});return s.on("readable",()=>{let c;for(;(c=s.read())!==null;)n.push(c),i+=c.length}),s.once("error",c=>e(c)),s.once("end",()=>{let c=Buffer.concat(n,i),p;try{p=JSON.parse(c.toString())}catch(f){return e(f)}if(p.status!=="success"||p.error)return e(new Error(p.error||"Request failed"));delete p.status,gt=p,e(null,gt)}),t};Vt.exports.getTestMessageUrl=function(r){if(!r||!r.response)return!1;let e=new Map;return r.response.replace(/\[([^\]]+)\]$/,(t,n)=>{n.replace(/\b([A-Z0-9]+)=([^\s]+)/g,(i,o,a)=>{e.set(o,a)})}),e.has("STATUS")&&e.has("MSGID")?(gt.web||Od)+"/message/"+e.get("MSGID"):!1}});var js=R((bz,Ms)=>{"use strict";Ms.exports={"application/json":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["json","map"]},"application/xml":{source:"iana",compressible:!0,extensions:["xml"]},"application/javascript":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["js","mjs"]},"application/pdf":{source:"iana",compressible:!1,extensions:["pdf"]},"application/zip":{source:"iana",compressible:!1,extensions:["zip"]},"application/gzip":{source:"iana",compressible:!1,extensions:["gz"]},"application/octet-stream":{source:"iana",compressible:!1,extensions:["bin","dat"]},"application/msword":{source:"iana",extensions:["doc"]},"application/vnd.openxmlformats-officedocument.wordprocessingml.document":{source:"iana",extensions:["docx"]},"application/vnd.ms-excel":{source:"iana",extensions:["xls"]},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{source:"iana",extensions:["xlsx"]},"application/vnd.ms-powerpoint":{source:"iana",extensions:["ppt"]},"application/vnd.openxmlformats-officedocument.presentationml.presentation":{source:"iana",extensions:["pptx"]},"application/csv":{compressible:!0,extensions:["csv"]},"application/rtf":{source:"iana",compressible:!0,extensions:["rtf"]},"application/x-tar":{source:"apache",compressible:!0,extensions:["tar"]},"application/x-7z-compressed":{source:"apache",compressible:!1,extensions:["7z"]},"application/wasm":{source:"iana",compressible:!0,extensions:["wasm"]},"text/plain":{source:"iana",compressible:!0,charset:"UTF-8",extensions:["txt","text","log"]},"text/html":{source:"iana",compressible:!0,charset:"UTF-8",extensions:["html","htm"]},"text/css":{source:"iana",compressible:!0,charset:"UTF-8",extensions:["css"]},"text/csv":{source:"iana",compressible:!0,charset:"UTF-8",extensions:["csv"]},"text/markdown":{source:"iana",compressible:!0,charset:"UTF-8",extensions:["md","markdown"]},"text/xml":{source:"iana",compressible:!0,extensions:["xml"]},"text/yaml":{compressible:!0,extensions:["yaml","yml"]},"image/png":{source:"iana",compressible:!1,extensions:["png"]},"image/jpeg":{source:"iana",compressible:!1,extensions:["jpeg","jpg","jpe"]},"image/gif":{source:"iana",compressible:!1,extensions:["gif"]},"image/webp":{source:"apache",compressible:!1,extensions:["webp"]},"image/svg+xml":{source:"iana",compressible:!0,extensions:["svg","svgz"]},"image/bmp":{source:"iana",compressible:!0,extensions:["bmp"]},"image/tiff":{source:"iana",compressible:!1,extensions:["tiff","tif"]},"image/x-icon":{source:"apache",compressible:!0,extensions:["ico"]},"image/heic":{source:"iana",compressible:!1,extensions:["heic"]},"image/avif":{source:"iana",compressible:!1,extensions:["avif"]},"audio/mpeg":{source:"iana",compressible:!1,extensions:["mp3","mpga"]},"audio/wav":{compressible:!1,extensions:["wav"]},"audio/ogg":{source:"iana",compressible:!1,extensions:["ogg","oga"]},"audio/webm":{source:"apache",compressible:!1,extensions:["weba"]},"audio/mp4":{source:"iana",compressible:!1,extensions:["m4a"]},"video/mp4":{source:"iana",compressible:!1,extensions:["mp4","m4v"]},"video/mpeg":{source:"iana",compressible:!1,extensions:["mpeg","mpg"]},"video/webm":{source:"iana",compressible:!1,extensions:["webm"]},"video/quicktime":{source:"iana",compressible:!1,extensions:["mov","qt"]},"video/x-msvideo":{source:"iana",compressible:!1,extensions:["avi"]},"font/woff":{source:"iana",compressible:!1,extensions:["woff"]},"font/woff2":{source:"iana",compressible:!1,extensions:["woff2"]},"font/ttf":{source:"iana",compressible:!0,extensions:["ttf"]},"font/otf":{source:"iana",compressible:!0,extensions:["otf"]},"application/ld+json":{source:"iana",compressible:!0,extensions:["jsonld"]},"application/x-www-form-urlencoded":{source:"iana",compressible:!0},"multipart/form-data":{source:"iana"},"application/vnd.api+json":{source:"iana",compressible:!0},"application/manifest+json":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["webmanifest"]},"application/ics":{compressible:!0,extensions:["ics"]},"text/calendar":{source:"iana",compressible:!0,extensions:["ics","ifb"]},"application/x-ndjson":{compressible:!0,extensions:["ndjson"]}}});var Bs=R(J=>{"use strict";var qt=js(),Nd=require("path").extname,Ls=/^\s*([^;\s]*)(?:;|\s|$)/,Rd=/^text\//i;J.charset=Fs;J.charsets={lookup:Fs};J.contentType=Dd;J.extension=Ud;J.extensions=Object.create(null);J.lookup=Md;J.types=Object.create(null);jd(J.extensions,J.types);function Fs(r){if(!r||typeof r!="string")return!1;var e=Ls.exec(r),t=e&&qt[e[1].toLowerCase()];return t&&t.charset?t.charset:e&&Rd.test(e[1])?"UTF-8":!1}l(Fs,"charset");function Dd(r){if(!r||typeof r!="string")return!1;var e=r.indexOf("/")===-1?J.lookup(r):r;if(!e)return!1;if(e.indexOf("charset")===-1){var t=J.charset(e);t&&(e+="; charset="+t.toLowerCase())}return e}l(Dd,"contentType");function Ud(r){if(!r||typeof r!="string")return!1;var e=Ls.exec(r),t=e&&J.extensions[e[1].toLowerCase()];return!t||!t.length?!1:t[0]}l(Ud,"extension");function Md(r){if(!r||typeof r!="string")return!1;var e=Nd("x."+r).toLowerCase().substr(1);return e&&J.types[e]||!1}l(Md,"lookup");function jd(r,e){var t=["nginx","apache",void 0,"iana"];Object.keys(qt).forEach(l(function(i){var o=qt[i],a=o.extensions;if(!(!a||!a.length)){r[i]=a;for(var s=0;s<a.length;s++){var c=a[s];if(e[c]){var p=t.indexOf(qt[e[c]].source),f=t.indexOf(o.source);if(e[c]!=="application/octet-stream"&&(p>f||p===f&&e[c].substr(0,12)==="application/"))continue}e[c]=i}}},"forEachMimeType"))}l(jd,"populateMaps")});var Hd={};In(Hd,{smtp:()=>Zd,smtpAuth:()=>Gt});module.exports=Js(Hd);var Xs=Object.freeze({status:"aborted"});function P(r,e,t){function n(s,c){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:c,constr:a,traits:new Set},enumerable:!1}),s._zod.traits.has(r))return;s._zod.traits.add(r),e(s,c);let p=a.prototype,f=Object.keys(p);for(let x=0;x<f.length;x++){let m=f[x];m in s||(s[m]=p[m].bind(s))}}l(n,"init");let i=t?.Parent??Object;class o extends i{static{l(this,"Definition")}}Object.defineProperty(o,"name",{value:r});function a(s){var c;let p=t?.Parent?new o:this;n(p,s),(c=p._zod).deferred??(c.deferred=[]);for(let f of p._zod.deferred)f();return p}return l(a,"_"),Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:l(s=>t?.Parent&&s instanceof t.Parent?!0:s?._zod?.traits?.has(r),"value")}),Object.defineProperty(a,"name",{value:r}),a}l(P,"$constructor");var oe=class extends Error{static{l(this,"$ZodAsyncError")}constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},vt=class extends Error{static{l(this,"$ZodEncodeError")}constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}},Kt={};function le(r){return r&&Object.assign(Kt,r),Kt}l(le,"config");function Xt(r){let e=Object.values(r).filter(n=>typeof n=="number");return Object.entries(r).filter(([n,i])=>e.indexOf(+n)===-1).map(([n,i])=>i)}l(Xt,"getEnumValues");function zn(r,e){return typeof e=="bigint"?e.toString():e}l(zn,"jsonStringifyReplacer");function _t(r){return{get value(){{let t=r();return Object.defineProperty(this,"value",{value:t}),t}throw new Error("cached value already set")}}}l(_t,"cached");function $n(r){return r==null}l($n,"nullish");function bt(r){let e=r.startsWith("^")?1:0,t=r.endsWith("$")?r.length-1:r.length;return r.slice(e,t)}l(bt,"cleanRegex");var An=Symbol("evaluating");function H(r,e,t){let n;Object.defineProperty(r,e,{get(){if(n!==An)return n===void 0&&(n=An,n=t()),n},set(i){Object.defineProperty(r,e,{value:i})},configurable:!0})}l(H,"defineLazy");var Yt="captureStackTrace"in Error?Error.captureStackTrace:(...r)=>{};function Ze(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}l(Ze,"isObject");var Ys=_t(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let r=Function;return new r(""),!0}catch{return!1}});function kn(r){if(Ze(r)===!1)return!1;let e=r.constructor;if(e===void 0||typeof e!="function")return!0;let t=e.prototype;return!(Ze(t)===!1||Object.prototype.hasOwnProperty.call(t,"isPrototypeOf")===!1)}l(kn,"isPlainObject");var On=new Set(["string","number","symbol"]);function Ce(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}l(Ce,"escapeRegex");function Et(r,e,t){let n=new r._zod.constr(e??r._zod.def);return(!e||t?.parent)&&(n._zod.parent=r),n}l(Et,"clone");function L(r){let e=r;if(!e)return{};if(typeof e=="string")return{error:l(()=>e,"error")};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:l(()=>e.error,"error")}:e}l(L,"normalizeParams");function Cn(r){return Object.keys(r).filter(e=>r[e]._zod.optin==="optional"&&r[e]._zod.optout==="optional")}l(Cn,"optionalKeys");var Nn={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Ne(r,e=0){if(r.aborted===!0)return!0;for(let t=e;t<r.issues.length;t++)if(r.issues[t]?.continue!==!0)return!0;return!1}l(Ne,"aborted");function ge(r,e){return e.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(r),t})}l(ge,"prefixIssues");function yt(r){return typeof r=="string"?r:r?.message}l(yt,"unwrapMessage");function xe(r,e,t){let n={...r,path:r.path??[]};if(!r.message){let i=yt(r.inst?._zod.def?.error?.(r))??yt(e?.error?.(r))??yt(t.customError?.(r))??yt(t.localeError?.(r))??"Invalid input";n.message=i}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}l(xe,"finalizeIssue");function Rn(r){return Array.isArray(r)?"array":typeof r=="string"?"string":"unknown"}l(Rn,"getLengthableOrigin");function Qt(...r){let[e,t,n]=r;return typeof e=="string"?{message:e,code:"custom",input:t,inst:n}:{...e}}l(Qt,"issue");var Dn=l((r,e)=>{r.name="$ZodError",Object.defineProperty(r,"_zod",{value:r._zod,enumerable:!1}),Object.defineProperty(r,"issues",{value:e,enumerable:!1}),r.message=JSON.stringify(e,zn,2),Object.defineProperty(r,"toString",{value:l(()=>r.message,"value"),enumerable:!1})},"initializer"),Un=P("$ZodError",Dn),He=P("$ZodError",Dn,{Parent:Error});var ec=l(r=>(e,t,n,i)=>{let o=n?Object.assign(n,{async:!1}):{async:!1},a=e._zod.run({value:t,issues:[]},o);if(a instanceof Promise)throw new oe;if(a.issues.length){let s=new(i?.Err??r)(a.issues.map(c=>xe(c,o,le())));throw Yt(s,i?.callee),s}return a.value},"_parse"),Pt=ec(He),tc=l(r=>async(e,t,n,i)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},a=e._zod.run({value:t,issues:[]},o);if(a instanceof Promise&&(a=await a),a.issues.length){let s=new(i?.Err??r)(a.issues.map(c=>xe(c,o,le())));throw Yt(s,i?.callee),s}return a.value},"_parseAsync"),Tt=tc(He),rc=l(r=>(e,t,n)=>{let i=n?{...n,async:!1}:{async:!1},o=e._zod.run({value:t,issues:[]},i);if(o instanceof Promise)throw new oe;return o.issues.length?{success:!1,error:new(r??Un)(o.issues.map(a=>xe(a,i,le())))}:{success:!0,data:o.value}},"_safeParse"),Ve=rc(He),nc=l(r=>async(e,t,n)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},o=e._zod.run({value:t,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new r(o.issues.map(a=>xe(a,i,le())))}:{success:!0,data:o.value}},"_safeParseAsync"),qe=nc(He);var ic="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",oc=new RegExp(`^${ic}$`);var Mn=l(r=>{let e=r?`[\\s\\S]{${r?.minimum??0},${r?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},"string"),jn=/^-?\d+n?$/,Ln=/^-?\d+$/,er=/^-?\d+(?:\.\d+)?$/,Fn=/^(?:true|false)$/i;var ve=P("$ZodCheck",(r,e)=>{var t;r._zod??(r._zod={}),r._zod.def=e,(t=r._zod).onattach??(t.onattach=[])}),ac={number:"number",bigint:"bigint",object:"date"};var Bn=P("$ZodCheckGreaterThan",(r,e)=>{ve.init(r,e);let t=ac[typeof e.value];r._zod.onattach.push(n=>{let i=n._zod.bag,o=(e.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>o&&(e.inclusive?i.minimum=e.value:i.exclusiveMinimum=e.value)}),r._zod.check=n=>{(e.inclusive?n.value>=e.value:n.value>e.value)||n.issues.push({origin:t,code:"too_small",minimum:typeof e.value=="object"?e.value.getTime():e.value,input:n.value,inclusive:e.inclusive,inst:r,continue:!e.abort})}});var Zn=P("$ZodCheckNumberFormat",(r,e)=>{ve.init(r,e),e.format=e.format||"float64";let t=e.format?.includes("int"),n=t?"int":"number",[i,o]=Nn[e.format];r._zod.onattach.push(a=>{let s=a._zod.bag;s.format=e.format,s.minimum=i,s.maximum=o,t&&(s.pattern=Ln)}),r._zod.check=a=>{let s=a.value;if(t){if(!Number.isInteger(s)){a.issues.push({expected:n,format:e.format,code:"invalid_type",continue:!1,input:s,inst:r});return}if(!Number.isSafeInteger(s)){s>0?a.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:r,origin:n,inclusive:!0,continue:!e.abort}):a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:r,origin:n,inclusive:!0,continue:!e.abort});return}}s<i&&a.issues.push({origin:"number",input:s,code:"too_small",minimum:i,inclusive:!0,inst:r,continue:!e.abort}),s>o&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:o,inclusive:!0,inst:r,continue:!e.abort})}});var Hn=P("$ZodCheckMinLength",(r,e)=>{var t;ve.init(r,e),(t=r._zod.def).when??(t.when=n=>{let i=n.value;return!$n(i)&&i.length!==void 0}),r._zod.onattach.push(n=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>i&&(n._zod.bag.minimum=e.minimum)}),r._zod.check=n=>{let i=n.value;if(i.length>=e.minimum)return;let a=Rn(i);n.issues.push({origin:a,code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:r,continue:!e.abort})}});var tr=P("$ZodCheckStringFormat",(r,e)=>{var t,n;ve.init(r,e),r._zod.onattach.push(i=>{let o=i._zod.bag;o.format=e.format,e.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(e.pattern))}),e.pattern?(t=r._zod).check??(t.check=i=>{e.pattern.lastIndex=0,!e.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:e.format,input:i.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:r,continue:!e.abort})}):(n=r._zod).check??(n.check=()=>{})}),Vn=P("$ZodCheckRegex",(r,e)=>{tr.init(r,e),r._zod.check=t=>{e.pattern.lastIndex=0,!e.pattern.test(t.value)&&t.issues.push({origin:"string",code:"invalid_format",format:"regex",input:t.value,pattern:e.pattern.toString(),inst:r,continue:!e.abort})}});var Gn={major:4,minor:3,patch:6};var B=P("$ZodType",(r,e)=>{var t;r??(r={}),r._zod.def=e,r._zod.bag=r._zod.bag||{},r._zod.version=Gn;let n=[...r._zod.def.checks??[]];r._zod.traits.has("$ZodCheck")&&n.unshift(r);for(let i of n)for(let o of i._zod.onattach)o(r);if(n.length===0)(t=r._zod).deferred??(t.deferred=[]),r._zod.deferred?.push(()=>{r._zod.run=r._zod.parse});else{let i=l((a,s,c)=>{let p=Ne(a),f;for(let x of s){if(x._zod.def.when){if(!x._zod.def.when(a))continue}else if(p)continue;let m=a.issues.length,d=x._zod.check(a);if(d instanceof Promise&&c?.async===!1)throw new oe;if(f||d instanceof Promise)f=(f??Promise.resolve()).then(async()=>{await d,a.issues.length!==m&&(p||(p=Ne(a,m)))});else{if(a.issues.length===m)continue;p||(p=Ne(a,m))}}return f?f.then(()=>a):a},"runChecks"),o=l((a,s,c)=>{if(Ne(a))return a.aborted=!0,a;let p=i(s,n,c);if(p instanceof Promise){if(c.async===!1)throw new oe;return p.then(f=>r._zod.parse(f,c))}return r._zod.parse(p,c)},"handleCanaryResult");r._zod.run=(a,s)=>{if(s.skipChecks)return r._zod.parse(a,s);if(s.direction==="backward"){let p=r._zod.parse({value:a.value,issues:[]},{...s,skipChecks:!0});return p instanceof Promise?p.then(f=>o(f,a,s)):o(p,a,s)}let c=r._zod.parse(a,s);if(c instanceof Promise){if(s.async===!1)throw new oe;return c.then(p=>i(p,n,s))}return i(c,n,s)}}H(r,"~standard",()=>({validate:l(i=>{try{let o=Ve(r,i);return o.success?{value:o.data}:{issues:o.error?.issues}}catch{return qe(r,i).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},"validate"),vendor:"zod",version:1}))}),wt=P("$ZodString",(r,e)=>{B.init(r,e),r._zod.pattern=[...r?._zod.bag?.patterns??[]].pop()??Mn(r._zod.bag),r._zod.parse=(t,n)=>{if(e.coerce)try{t.value=String(t.value)}catch{}return typeof t.value=="string"||t.issues.push({expected:"string",code:"invalid_type",input:t.value,inst:r}),t}}),rr=P("$ZodStringFormat",(r,e)=>{tr.init(r,e),wt.init(r,e)});var Yn=P("$ZodURL",(r,e)=>{rr.init(r,e),r._zod.check=t=>{try{let n=t.value.trim(),i=new URL(n);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(i.hostname)||t.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:t.value,inst:r,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||t.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:t.value,inst:r,continue:!e.abort})),e.normalize?t.value=i.href:t.value=n;return}catch{t.issues.push({code:"invalid_format",format:"url",input:t.value,inst:r,continue:!e.abort})}}});var nr=P("$ZodNumber",(r,e)=>{B.init(r,e),r._zod.pattern=r._zod.bag.pattern??er,r._zod.parse=(t,n)=>{if(e.coerce)try{t.value=Number(t.value)}catch{}let i=t.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return t;let o=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return t.issues.push({expected:"number",code:"invalid_type",input:i,inst:r,...o?{received:o}:{}}),t}}),Qn=P("$ZodNumberFormat",(r,e)=>{Zn.init(r,e),nr.init(r,e)}),ir=P("$ZodBoolean",(r,e)=>{B.init(r,e),r._zod.pattern=Fn,r._zod.parse=(t,n)=>{if(e.coerce)try{t.value=!!t.value}catch{}let i=t.value;return typeof i=="boolean"||t.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:r}),t}}),ei=P("$ZodBigInt",(r,e)=>{B.init(r,e),r._zod.pattern=jn,r._zod.parse=(t,n)=>{if(e.coerce)try{t.value=BigInt(t.value)}catch{}return typeof t.value=="bigint"||t.issues.push({expected:"bigint",code:"invalid_type",input:t.value,inst:r}),t}});var ti=P("$ZodAny",(r,e)=>{B.init(r,e),r._zod.parse=t=>t}),ri=P("$ZodUnknown",(r,e)=>{B.init(r,e),r._zod.parse=t=>t});var ni=P("$ZodVoid",(r,e)=>{B.init(r,e),r._zod.parse=(t,n)=>{let i=t.value;return typeof i>"u"||t.issues.push({expected:"void",code:"invalid_type",input:i,inst:r}),t}}),ii=P("$ZodDate",(r,e)=>{B.init(r,e),r._zod.parse=(t,n)=>{if(e.coerce)try{t.value=new Date(t.value)}catch{}let i=t.value,o=i instanceof Date;return o&&!Number.isNaN(i.getTime())||t.issues.push({expected:"date",code:"invalid_type",input:i,...o?{received:"Invalid Date"}:{},inst:r}),t}});function Wn(r,e,t){r.issues.length&&e.issues.push(...ge(t,r.issues)),e.value[t]=r.value}l(Wn,"handleArrayResult");var oi=P("$ZodArray",(r,e)=>{B.init(r,e),r._zod.parse=(t,n)=>{let i=t.value;if(!Array.isArray(i))return t.issues.push({expected:"array",code:"invalid_type",input:i,inst:r}),t;t.value=Array(i.length);let o=[];for(let a=0;a<i.length;a++){let s=i[a],c=e.element._zod.run({value:s,issues:[]},n);c instanceof Promise?o.push(c.then(p=>Wn(p,t,a))):Wn(c,t,a)}return o.length?Promise.all(o).then(()=>t):t}});function It(r,e,t,n,i){if(r.issues.length){if(i&&!(t in n))return;e.issues.push(...ge(t,r.issues))}r.value===void 0?t in n&&(e.value[t]=void 0):e.value[t]=r.value}l(It,"handlePropertyResult");function sc(r){let e=Object.keys(r.shape);for(let n of e)if(!r.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let t=Cn(r.shape);return{...r,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(t)}}l(sc,"normalizeDef");function cc(r,e,t,n,i,o){let a=[],s=i.keySet,c=i.catchall._zod,p=c.def.type,f=c.optout==="optional";for(let x in e){if(s.has(x))continue;if(p==="never"){a.push(x);continue}let m=c.run({value:e[x],issues:[]},n);m instanceof Promise?r.push(m.then(d=>It(d,t,x,e,f))):It(m,t,x,e,f)}return a.length&&t.issues.push({code:"unrecognized_keys",keys:a,input:e,inst:o}),r.length?Promise.all(r).then(()=>t):t}l(cc,"handleCatchall");var ai=P("$ZodObject",(r,e)=>{if(B.init(r,e),!Object.getOwnPropertyDescriptor(e,"shape")?.get){let s=e.shape;Object.defineProperty(e,"shape",{get:l(()=>{let c={...s};return Object.defineProperty(e,"shape",{value:c}),c},"get")})}let n=_t(()=>sc(e));H(r._zod,"propValues",()=>{let s=e.shape,c={};for(let p in s){let f=s[p]._zod;if(f.values){c[p]??(c[p]=new Set);for(let x of f.values)c[p].add(x)}}return c});let i=Ze,o=e.catchall,a;r._zod.parse=(s,c)=>{a??(a=n.value);let p=s.value;if(!i(p))return s.issues.push({expected:"object",code:"invalid_type",input:p,inst:r}),s;s.value={};let f=[],x=a.shape;for(let m of a.keys){let d=x[m],h=d._zod.optout==="optional",y=d._zod.run({value:p[m],issues:[]},c);y instanceof Promise?f.push(y.then(v=>It(v,s,m,p,h))):It(y,s,m,p,h)}return o?cc(f,p,s,c,n.value,r):f.length?Promise.all(f).then(()=>s):s}});function Kn(r,e,t,n){for(let o of r)if(o.issues.length===0)return e.value=o.value,e;let i=r.filter(o=>!Ne(o));return i.length===1?(e.value=i[0].value,i[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:t,errors:r.map(o=>o.issues.map(a=>xe(a,n,le())))}),e)}l(Kn,"handleUnionResults");var or=P("$ZodUnion",(r,e)=>{B.init(r,e),H(r._zod,"optin",()=>e.options.some(i=>i._zod.optin==="optional")?"optional":void 0),H(r._zod,"optout",()=>e.options.some(i=>i._zod.optout==="optional")?"optional":void 0),H(r._zod,"values",()=>{if(e.options.every(i=>i._zod.values))return new Set(e.options.flatMap(i=>Array.from(i._zod.values)))}),H(r._zod,"pattern",()=>{if(e.options.every(i=>i._zod.pattern)){let i=e.options.map(o=>o._zod.pattern);return new RegExp(`^(${i.map(o=>bt(o.source)).join("|")})$`)}});let t=e.options.length===1,n=e.options[0]._zod.run;r._zod.parse=(i,o)=>{if(t)return n(i,o);let a=!1,s=[];for(let c of e.options){let p=c._zod.run({value:i.value,issues:[]},o);if(p instanceof Promise)s.push(p),a=!0;else{if(p.issues.length===0)return p;s.push(p)}}return a?Promise.all(s).then(c=>Kn(c,i,r,o)):Kn(s,i,r,o)}});var si=P("$ZodDiscriminatedUnion",(r,e)=>{e.inclusive=!1,or.init(r,e);let t=r._zod.parse;H(r._zod,"propValues",()=>{let i={};for(let o of e.options){let a=o._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(o)}"`);for(let[s,c]of Object.entries(a)){i[s]||(i[s]=new Set);for(let p of c)i[s].add(p)}}return i});let n=_t(()=>{let i=e.options,o=new Map;for(let a of i){let s=a._zod.propValues?.[e.discriminator];if(!s||s.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(a)}"`);for(let c of s){if(o.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);o.set(c,a)}}return o});r._zod.parse=(i,o)=>{let a=i.value;if(!Ze(a))return i.issues.push({code:"invalid_type",expected:"object",input:a,inst:r}),i;let s=n.value.get(a?.[e.discriminator]);return s?s._zod.run(i,o):e.unionFallback?t(i,o):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:e.discriminator,input:a,path:[e.discriminator],inst:r}),i)}});var ci=P("$ZodRecord",(r,e)=>{B.init(r,e),r._zod.parse=(t,n)=>{let i=t.value;if(!kn(i))return t.issues.push({expected:"record",code:"invalid_type",input:i,inst:r}),t;let o=[],a=e.keyType._zod.values;if(a){t.value={};let s=new Set;for(let p of a)if(typeof p=="string"||typeof p=="number"||typeof p=="symbol"){s.add(typeof p=="number"?p.toString():p);let f=e.valueType._zod.run({value:i[p],issues:[]},n);f instanceof Promise?o.push(f.then(x=>{x.issues.length&&t.issues.push(...ge(p,x.issues)),t.value[p]=x.value})):(f.issues.length&&t.issues.push(...ge(p,f.issues)),t.value[p]=f.value)}let c;for(let p in i)s.has(p)||(c=c??[],c.push(p));c&&c.length>0&&t.issues.push({code:"unrecognized_keys",input:i,inst:r,keys:c})}else{t.value={};for(let s of Reflect.ownKeys(i)){if(s==="__proto__")continue;let c=e.keyType._zod.run({value:s,issues:[]},n);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof s=="string"&&er.test(s)&&c.issues.length){let x=e.keyType._zod.run({value:Number(s),issues:[]},n);if(x instanceof Promise)throw new Error("Async schemas not supported in object keys currently");x.issues.length===0&&(c=x)}if(c.issues.length){e.mode==="loose"?t.value[s]=i[s]:t.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(x=>xe(x,n,le())),input:s,path:[s],inst:r});continue}let f=e.valueType._zod.run({value:i[s],issues:[]},n);f instanceof Promise?o.push(f.then(x=>{x.issues.length&&t.issues.push(...ge(s,x.issues)),t.value[c.value]=x.value})):(f.issues.length&&t.issues.push(...ge(s,f.issues)),t.value[c.value]=f.value)}}return o.length?Promise.all(o).then(()=>t):t}});var pi=P("$ZodEnum",(r,e)=>{B.init(r,e);let t=Xt(e.entries),n=new Set(t);r._zod.values=n,r._zod.pattern=new RegExp(`^(${t.filter(i=>On.has(typeof i)).map(i=>typeof i=="string"?Ce(i):i.toString()).join("|")})$`),r._zod.parse=(i,o)=>{let a=i.value;return n.has(a)||i.issues.push({code:"invalid_value",values:t,input:a,inst:r}),i}}),li=P("$ZodLiteral",(r,e)=>{if(B.init(r,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");let t=new Set(e.values);r._zod.values=t,r._zod.pattern=new RegExp(`^(${e.values.map(n=>typeof n=="string"?Ce(n):n?Ce(n.toString()):String(n)).join("|")})$`),r._zod.parse=(n,i)=>{let o=n.value;return t.has(o)||n.issues.push({code:"invalid_value",values:e.values,input:o,inst:r}),n}});var ui=P("$ZodTransform",(r,e)=>{B.init(r,e),r._zod.parse=(t,n)=>{if(n.direction==="backward")throw new vt(r.constructor.name);let i=e.transform(t.value,t);if(n.async)return(i instanceof Promise?i:Promise.resolve(i)).then(a=>(t.value=a,t));if(i instanceof Promise)throw new oe;return t.value=i,t}});function Jn(r,e){return r.issues.length&&e===void 0?{issues:[],value:void 0}:r}l(Jn,"handleOptionalResult");var di=P("$ZodOptional",(r,e)=>{B.init(r,e),r._zod.optin="optional",r._zod.optout="optional",H(r._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),H(r._zod,"pattern",()=>{let t=e.innerType._zod.pattern;return t?new RegExp(`^(${bt(t.source)})?$`):void 0}),r._zod.parse=(t,n)=>{if(e.innerType._zod.optin==="optional"){let i=e.innerType._zod.run(t,n);return i instanceof Promise?i.then(o=>Jn(o,t.value)):Jn(i,t.value)}return t.value===void 0?t:e.innerType._zod.run(t,n)}});var mi=P("$ZodNullable",(r,e)=>{B.init(r,e),H(r._zod,"optin",()=>e.innerType._zod.optin),H(r._zod,"optout",()=>e.innerType._zod.optout),H(r._zod,"pattern",()=>{let t=e.innerType._zod.pattern;return t?new RegExp(`^(${bt(t.source)}|null)$`):void 0}),H(r._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),r._zod.parse=(t,n)=>t.value===null?t:e.innerType._zod.run(t,n)});var fi=P("$ZodPipe",(r,e)=>{B.init(r,e),H(r._zod,"values",()=>e.in._zod.values),H(r._zod,"optin",()=>e.in._zod.optin),H(r._zod,"optout",()=>e.out._zod.optout),H(r._zod,"propValues",()=>e.in._zod.propValues),r._zod.parse=(t,n)=>{if(n.direction==="backward"){let o=e.out._zod.run(t,n);return o instanceof Promise?o.then(a=>St(a,e.in,n)):St(o,e.in,n)}let i=e.in._zod.run(t,n);return i instanceof Promise?i.then(o=>St(o,e.out,n)):St(i,e.out,n)}});function St(r,e,t){return r.issues.length?(r.aborted=!0,r):e._zod.run({value:r.value,issues:r.issues},t)}l(St,"handlePipeResult");var hi=P("$ZodCustom",(r,e)=>{ve.init(r,e),B.init(r,e),r._zod.parse=(t,n)=>t,r._zod.check=t=>{let n=t.value,i=e.fn(n);if(i instanceof Promise)return i.then(o=>Xn(o,t,n,r));Xn(i,t,n,r)}});function Xn(r,e,t,n){if(!r){let i={code:"custom",input:t,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(i.params=n._zod.def.params),e.issues.push(Qt(i))}}l(Xn,"handleRefineResult");var xi;var ar=class{static{l(this,"$ZodRegistry")}constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t=="object"&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let i={...n,...this._map.get(e)};return Object.keys(i).length?i:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function vi(){return new ar}l(vi,"registry");(xi=globalThis).__zod_globalRegistry??(xi.__zod_globalRegistry=vi());var sr=globalThis.__zod_globalRegistry;function yi(r,e){return new r({type:"string",...L(e)})}l(yi,"_string");function _i(r,e){return new r({type:"string",coerce:!0,...L(e)})}l(_i,"_coercedString");function bi(r,e){return new r({type:"string",format:"url",check:"string_format",abort:!1,...L(e)})}l(bi,"_url");function Ei(r,e){return new r({type:"number",checks:[],...L(e)})}l(Ei,"_number");function Pi(r,e){return new r({type:"number",coerce:!0,checks:[],...L(e)})}l(Pi,"_coercedNumber");function Ti(r,e){return new r({type:"number",check:"number_format",abort:!1,format:"safeint",...L(e)})}l(Ti,"_int");function Si(r,e){return new r({type:"boolean",...L(e)})}l(Si,"_boolean");function Ii(r,e){return new r({type:"boolean",coerce:!0,...L(e)})}l(Ii,"_coercedBoolean");function wi(r,e){return new r({type:"bigint",coerce:!0,...L(e)})}l(wi,"_coercedBigint");function Ai(r){return new r({type:"any"})}l(Ai,"_any");function zi(r){return new r({type:"unknown"})}l(zi,"_unknown");function $i(r,e){return new r({type:"void",...L(e)})}l($i,"_void");function ki(r,e){return new r({type:"date",coerce:!0,...L(e)})}l(ki,"_coercedDate");function At(r,e){return new Bn({check:"greater_than",...L(e),value:r,inclusive:!0})}l(At,"_gte");function te(r,e){return new Hn({check:"min_length",...L(e),minimum:r})}l(te,"_minLength");function ye(r,e){return new Vn({check:"string_format",format:"regex",...L(e),pattern:r})}l(ye,"_regex");function Oi(r,e,t){let n=L(t);return n.abort??(n.abort=!0),new r({type:"custom",check:"custom",fn:e,...n})}l(Oi,"_custom");var V=P("ZodMiniType",(r,e)=>{if(!r._zod)throw new Error("Uninitialized schema in ZodMiniType.");B.init(r,e),r.def=e,r.type=e.type,r.parse=(t,n)=>Pt(r,t,n,{callee:r.parse}),r.safeParse=(t,n)=>Ve(r,t,n),r.parseAsync=async(t,n)=>Tt(r,t,n,{callee:r.parseAsync}),r.safeParseAsync=async(t,n)=>qe(r,t,n),r.check=(...t)=>r.clone({...e,checks:[...e.checks??[],...t.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]},{parent:!0}),r.with=r.check,r.clone=(t,n)=>Et(r,t,n),r.brand=()=>r,r.register=((t,n)=>(t.add(r,n),r)),r.apply=t=>t(r)}),$t=P("ZodMiniString",(r,e)=>{wt.init(r,e),V.init(r,e)});function u(r){return yi($t,r)}l(u,"string");var Ci=P("ZodMiniStringFormat",(r,e)=>{rr.init(r,e),$t.init(r,e)});var bc=P("ZodMiniURL",(r,e)=>{Yn.init(r,e),Ci.init(r,e)});function Ni(r){return bi(bc,r)}l(Ni,"url");var kt=P("ZodMiniNumber",(r,e)=>{nr.init(r,e),V.init(r,e)});function W(r){return Ei(kt,r)}l(W,"number");var Ec=P("ZodMiniNumberFormat",(r,e)=>{Qn.init(r,e),kt.init(r,e)});function Ri(r){return Ti(Ec,r)}l(Ri,"int");var cr=P("ZodMiniBoolean",(r,e)=>{ir.init(r,e),V.init(r,e)});function M(r){return Si(cr,r)}l(M,"boolean");var Di=P("ZodMiniBigInt",(r,e)=>{ei.init(r,e),V.init(r,e)});var Pc=P("ZodMiniAny",(r,e)=>{ti.init(r,e),V.init(r,e)});function We(){return Ai(Pc)}l(We,"any");var Tc=P("ZodMiniUnknown",(r,e)=>{ri.init(r,e),V.init(r,e)});function z(){return zi(Tc)}l(z,"unknown");var Sc=P("ZodMiniVoid",(r,e)=>{ni.init(r,e),V.init(r,e)});function Ui(r){return $i(Sc,r)}l(Ui,"_void");var Mi=P("ZodMiniDate",(r,e)=>{ii.init(r,e),V.init(r,e)});var Ic=P("ZodMiniArray",(r,e)=>{oi.init(r,e),V.init(r,e)});function O(r,e){return new Ic({type:"array",element:r,...L(e)})}l(O,"array");var wc=P("ZodMiniObject",(r,e)=>{ai.init(r,e),V.init(r,e),H(r,"shape",()=>e.shape)});function g(r,e){let t={type:"object",shape:r??{},...L(e)};return new wc(t)}l(g,"object");var Ac=P("ZodMiniUnion",(r,e)=>{or.init(r,e),V.init(r,e)});function C(r,e){return new Ac({type:"union",options:r,...L(e)})}l(C,"union");var zc=P("ZodMiniDiscriminatedUnion",(r,e)=>{si.init(r,e),V.init(r,e)});function _e(r,e,t){return new zc({type:"union",options:e,discriminator:r,...L(t)})}l(_e,"discriminatedUnion");var $c=P("ZodMiniRecord",(r,e)=>{ci.init(r,e),V.init(r,e)});function $(r,e,t){return new $c({type:"record",keyType:r,valueType:e,...L(t)})}l($,"record");var kc=P("ZodMiniEnum",(r,e)=>{pi.init(r,e),V.init(r,e),r.options=Object.values(e.entries)});function D(r,e){let t=Array.isArray(r)?Object.fromEntries(r.map(n=>[n,n])):r;return new kc({type:"enum",entries:t,...L(e)})}l(D,"_enum");var Oc=P("ZodMiniLiteral",(r,e)=>{li.init(r,e),V.init(r,e)});function S(r,e){return new Oc({type:"literal",values:Array.isArray(r)?r:[r],...L(e)})}l(S,"literal");var Cc=P("ZodMiniTransform",(r,e)=>{ui.init(r,e),V.init(r,e)});function be(r){return new Cc({type:"transform",transform:r})}l(be,"transform");var Nc=P("ZodMiniOptional",(r,e)=>{di.init(r,e),V.init(r,e)});function _(r){return new Nc({type:"optional",innerType:r})}l(_,"optional");var Rc=P("ZodMiniNullable",(r,e)=>{mi.init(r,e),V.init(r,e)});function Ke(r){return new Rc({type:"nullable",innerType:r})}l(Ke,"nullable");var Dc=P("ZodMiniPipe",(r,e)=>{fi.init(r,e),V.init(r,e)});function Ee(r,e){return new Dc({type:"pipe",in:r,out:e})}l(Ee,"pipe");var Uc=P("ZodMiniCustom",(r,e)=>{hi.init(r,e),V.init(r,e)});function Ot(r,e){return Oi(Uc,r??(()=>!0),e)}l(Ot,"custom");var Je={};In(Je,{bigint:()=>Zc,boolean:()=>Bc,date:()=>Hc,number:()=>Fc,string:()=>Lc});function Lc(r){return _i($t,r)}l(Lc,"string");function Fc(r){return Pi(kt,r)}l(Fc,"number");function Bc(r){return Ii(cr,r)}l(Bc,"boolean");function Zc(r){return wi(Di,r)}l(Zc,"bigint");function Hc(r){return ki(Mi,r)}l(Hc,"date");var lr=g({retryOnFailure:g({defaultValue:_(M()),hide:_(M())}),continueOnFailure:g({defaultValue:_(M()),hide:_(M())})}),pr=class{constructor(e,t,n,i,o,a,s,c,p,f,x){this.name=e;this.displayName=t;this.description=n;this.props=i;this.run=o;this.test=a;this.requireAuth=s;this.errorHandlingOptions=c;this.outputSchema=p;this.audience=f;this.aiMetadata=x}static{l(this,"IAction")}},Li=l(r=>new pr(r.name,r.displayName,r.description,r.props,r.run,r.test??r.run,r.requireAuth??!0,r.errorHandlingOptions??{continueOnFailure:{defaultValue:!1},retryOnFailure:{defaultValue:!1}},r.outputSchema,r.audience,r.aiMetadata),"createAction");var U=g({displayName:u(),description:_(u())}),N=l((r,e)=>g({type:S(e),required:M(),defaultValue:_(We())}),"TPropertyValue");var X=g({...U.shape,...N(u(),"SHORT_TEXT").shape}),ue=g({...U.shape,...N(u(),"LONG_TEXT").shape});var Fi=g({label:u(),value:z()}),Ct=g({disabled:_(M()),placeholder:_(u()),options:O(Fi)});var Y=g({...U.shape,options:Ct,...N(z(),"STATIC_DROPDOWN").shape}),de=g({...U.shape,options:Ct,...N(O(z()),"STATIC_MULTI_SELECT_DROPDOWN").shape});var ur=g({...U.shape,...N(z(),"DROPDOWN").shape,refreshers:O(u())}),Xe=g({...U.shape,...N(O(z()),"MULTI_SELECT_DROPDOWN").shape,refreshers:O(u())});var me=g({...U.shape,...N(M(),"CHECKBOX").shape});var fe=g({...U.shape,...N(W(),"NUMBER").shape});var Ye=g({...U.shape,...N(z(),"FILE").shape});var Qe=g({...U.shape,...N(u(),"DATE_TIME").shape});var Bi=$(u(),C([X,ue,Y,Xe,de,me,fe,Ye,Qe])),et=g({...U.shape,properties:Bi,...N(O(z()),"ARRAY").shape});var tt=g({...U.shape,...N(C([$(u(),z())]),"JSON").shape});var Zi=C([X,Y,tt,et,de]),qc=$(u(),Zi),dr=g({refreshers:O(u()),...U.shape,...N(z(),"DYNAMIC").shape});var Nt=g({...U.shape,...N(Ui(),"MARKDOWN").shape});var rt=(t=>(t.ARCHIVE="ARCHIVE",t.REGISTRY="REGISTRY",t))(rt||{}),Re=(t=>(t.CUSTOM="CUSTOM",t.OFFICIAL="OFFICIAL",t))(Re||{}),De=(b=>(b.ARTIFICIAL_INTELLIGENCE="ARTIFICIAL_INTELLIGENCE",b.COMMUNICATION="COMMUNICATION",b.COMMERCE="COMMERCE",b.CORE="CORE",b.UNIVERSAL_AI="UNIVERSAL_AI",b.FLOW_CONTROL="FLOW_CONTROL",b.BUSINESS_INTELLIGENCE="BUSINESS_INTELLIGENCE",b.ACCOUNTING="ACCOUNTING",b.PRODUCTIVITY="PRODUCTIVITY",b.CONTENT_AND_FILES="CONTENT_AND_FILES",b.DEVELOPER_TOOLS="DEVELOPER_TOOLS",b.CUSTOMER_SUPPORT="CUSTOMER_SUPPORT",b.FORMS_AND_SURVEYS="FORMS_AND_SURVEYS",b.HUMAN_RESOURCES="HUMAN_RESOURCES",b.PAYMENT_PROCESSING="PAYMENT_PROCESSING",b.MARKETING="MARKETING",b.SALES_AND_CRM="SALES_AND_CRM",b))(De||{});var nt=(t=>(t.AUTHORIZATION_CODE="authorization_code",t.CLIENT_CREDENTIALS="client_credentials",t))(nt||{}),mr="both_client_credentials_and_authorization_code";var Ie=(i=>(i.POLLING="POLLING",i.WEBHOOK="WEBHOOK",i.APP_WEBHOOK="APP_WEBHOOK",i.MANUAL="MANUAL",i))(Ie||{}),it=(o=>(o.NONE="NONE",o.HEADER_PRESENT="HEADER_PRESENT",o.QUERY_PRESENT="QUERY_PRESENT",o.BODY_PARAM_PRESENT="BODY_PARAM_PRESENT",o.HEAD_REQUEST="HEAD_REQUEST",o))(it||{}),Gc=g({strategy:D(it),paramName:_(u())}),ot=(t=>(t.SIMULATION="SIMULATION",t.TEST_FUNCTION="TEST_FUNCTION",t))(ot||{});var Rt=(t=>(t.WEBSOCKET="WEBSOCKET",t.NONE="NONE",t))(Rt||{}),Hi=g({status:_(W()),body:_(z()),headers:_($(u(),u()))}),Vi=g({type:S("DELAY"),resumeDateTime:u(),requestIdToReply:_(u()),handlerId:_(u()),streamStepProgress:_(D(Rt))}),qi=g({type:S("WEBHOOK"),requestId:u(),requestIdToReply:_(u()),response:Hi,handlerId:_(u()),streamStepProgress:_(D(Rt))}),Wc=C([Vi,qi]);var Kc=g({body:z(),rawBody:_(z()),headers:$(u(),u()),queryParams:$(u(),u())});var fr=Oe(require("crypto"),1);var Jc=128,we,Ue,Xc=l(r=>{!we||we.length<r?(we=Buffer.allocUnsafe(r*Jc),fr.default.randomFillSync(we),Ue=0):Ue+r>we.length&&(fr.default.randomFillSync(we),Ue=0),Ue+=r},"fillPool"),Yc=l(r=>(Xc(r|=0),we.subarray(Ue-r,Ue)),"random"),Qc=l((r,e,t)=>{let n=(2<<31-Math.clz32(r.length-1|1))-1,i=Math.ceil(1.6*n*e/r.length);return(o=e)=>{let a="";for(;;){let s=t(i),c=i;for(;c--;)if(a+=r[s[c]&n]||"",a.length===o)return a}}},"customRandom"),Wi=l((r,e=21)=>Qc(r,e,Yc),"customAlphabet");var ep="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",Ki=21,SE=u().check(ye(new RegExp(`^[0-9a-zA-Z]{${Ki}}$`))),tp=Wi(ep,Ki);var Pe=Ee(be(r=>r instanceof Date?r.toISOString():r),u()),Q={id:u(),created:Pe,updated:Pe},F=l(r=>_(Ke(r)),"Nullable");function hr(r){return _(Ke(D(r)))}l(hr,"NullableEnum");var AE=Ee(be(r=>r==="true"||r===!0?!0:r==="false"||r===!1?!1:void 0),_(M())),Dt=l(r=>Ee(be(e=>Array.isArray(e)?e:e!==void 0?[e]:void 0),_(O(r))),"OptionalArrayFromQuery");var kE=$(u(),z());var st=(f=>(f.OPENAI="openai",f.OPENROUTER="openrouter",f.ANTHROPIC="anthropic",f.AZURE="azure",f.GOOGLE="google",f.ACTIVEPIECES="activepieces",f.CLOUDFLARE_GATEWAY="cloudflare-gateway",f.CUSTOM="custom",f.BEDROCK="bedrock",f.MISTRAL="mistral",f))(st||{});var ZE=u().check(ye(/^#[0-9A-Fa-f]{6}$/));var VE=g({filename:u(),data:z(),type:S("file"),mimetype:_(u())});var rp=Oe(Xi());var YE=g({...Q,name:u(),permissions:O(u()),platformId:F(u()),type:u(),userCount:_(W())});var Yi=(n=>(n.AGENT_DECIDE="agent-decide",n.CHOOSE_YOURSELF="choose-yourself",n.LEAVE_EMPTY="leave-empty",n))(Yi||{}),gr=(t=>(t.FILE="FILE",t.TABLE="TABLE",t))(gr||{}),xr=(n=>(n.SSE="sse",n.STREAMABLE_HTTP="streamable-http",n.SIMPLE_HTTP="http",n))(xr||{});var vr=(n=>(n.TEXT="text",n.NUMBER="number",n.BOOLEAN="boolean",n))(vr||{});var yr=(t=>(t.IN_PROGRESS="in-progress",t.COMPLETED="completed",t))(yr||{});var np=g({mode:D(Yi),value:z()}),ip=g({auth:_(u()),fields:$(u(),np)}),op=g({pieceName:u(),pieceVersion:u(),actionName:u(),predefinedInput:_(ip)}),ap=g({type:S("PIECE"),toolName:u().check(te(1)),pieceMetadata:op}),sp=g({type:S("none")}),cp=g({type:S("access_token"),accessToken:u()}),pp=g({type:S("api_key"),apiKey:u(),apiKeyHeader:u()}),lp=g({type:S("headers"),headers:$(u(),u())}),up=_e("type",[sp,cp,pp,lp]),Qi=g({type:S("FLOW"),toolName:u().check(te(1)),externalFlowId:u(),flowDisplayName:_(u())}),eo=g({type:S("MCP"),toolName:u().check(te(1)),serverUrl:Ni(),protocol:D(xr),auth:up}),to=g({type:S("KNOWLEDGE_BASE"),toolName:u().check(te(1)),sourceType:D(gr),sourceId:u(),sourceName:u()}),dp=_e("type",[ap,Qi,eo,to]),mp=g({displayName:u(),description:_(u()),type:D(vr)}),ro=g({type:S("MARKDOWN"),markdown:u()}),Me={type:S("TOOL_CALL"),input:F($(u(),z())),output:_(z()),toolName:u(),status:D(yr),toolCallId:u(),startTime:u(),endTime:_(u())},SP=g(Me),no=_e("toolCallType",[g({...Me,toolCallType:S("PIECE"),pieceName:u(),pieceVersion:u(),actionName:u()}),g({...Me,toolCallType:S("FLOW"),displayName:u(),externalFlowId:u()}),g({...Me,toolCallType:S("MCP"),displayName:u(),serverUrl:u()}),g({...Me,toolCallType:S("KNOWLEDGE_BASE"),displayName:u(),sourceType:u()}),g({...Me,toolCallType:S("UNKNOWN"),displayName:u()})]),fp=C([ro,no]);var _r=(t=>(t.IMAGE="image",t.TEXT="text",t))(_r||{}),he=g({apiKey:u()}),hp=he,gp=g({apiKey:u(),apiKeyHash:u()}),xp=he,vp=he,yp=he,_p=he,bp=he,Ep=he,Pp=he,io=g({accessKeyId:u().check(te(1)),secretAccessKey:u().check(te(1))}),Tp=g({}),Sp=g({}),Ip=g({}),wp=g({}),Ap=g({}),zp=g({}),oo=g({modelId:u(),modelName:u(),modelType:D(_r)}),ao=g({apiKeyHeader:u(),baseUrl:u(),models:O(oo),defaultHeaders:_($(u(),u()))}),so=g({accountId:u(),gatewayId:u(),models:O(oo),vertexProject:_(u()),vertexRegion:_(u())}),co=g({resourceName:u(),apiVersion:Ee(be(r=>typeof r=="string"&&r.trim().length===0?void 0:r),_(u()))}),po=g({region:u().check(te(1))}),$p=C([hp,yp,_p,bp,Ep,vp,xp,gp,io,Pp]),lo=C([ao,so,co,po,Tp,Ip,wp,Ap,Sp,zp]),kp=g({id:u(),name:u(),type:D(_r)}),Op=g({id:u(),name:u(),provider:D(st),config:lo,enabledForChat:M()}),Cp=g({provider:D(st),config:lo,auth:$p,platformId:u()});var zP={openai:"openai",anthropic:"anthropic","google-ai-studio":"google","google-vertex-ai":"google"};var Np=g({base64Url:u(),fileName:u(),extension:_(u())}),Rp=g({mimeType:u(),url:u(),fileName:_(u())}),br=C([Np,Rp]);var Dp=C([g({type:S("file"),value:br}),g({type:S("markdown"),value:u(),files:_(O(br))})]),Up=g({sessionId:u(),message:u(),files:_(O(u()))});var mo=(t=>(t.ON_NEW_RECORD="ON_NEW_RECORD",t.ON_UPDATE_RECORD="ON_UPDATE_RECORD",t))(mo||{}),fo=(t=>(t.ENABLED="ENABLED",t.DISABLED="DISABLED",t))(fo||{}),Er=(n=>(n.RECORD_CREATED="RECORD_CREATED",n.RECORD_UPDATED="RECORD_UPDATED",n.RECORD_DELETED="RECORD_DELETED",n))(Er||{});var Mp=C([g({...Q,name:u(),externalId:u(),type:S("STATIC_DROPDOWN"),tableId:u(),projectId:u(),data:g({options:O(g({value:u()}))})}),g({...Q,name:u(),externalId:u(),type:C([S("TEXT"),S("NUMBER"),S("DATE")]),tableId:u(),projectId:u()})]),jp=g({...Q,name:u(),folderId:F(u()),projectId:u(),externalId:u(),status:hr(fo),trigger:hr(mo)}),Lp=g({...Q,tableId:u(),projectId:u(),cells:$(u(),g({updated:u(),created:u(),value:z(),fieldName:u()}))}),Fp=g({events:O(D(Er)),webhookUrl:u(),flowId:u()}),Bp=g({fields:O(g({id:u(),name:u()})),rows:O($(u(),u())),name:u()}),Zp=g({projectId:u(),limit:_(Je.number()),cursor:_(u()),name:_(u()),externalIds:Dt(u()),folderId:_(u()),folderIds:Dt(u())}),Hp=g({records:O(O(g({fieldId:u(),value:go()}))),tableId:u()}),Vp=g({cells:_(O(g({fieldId:u(),value:go()}))),tableId:u(),agentUpdate:_(M())}),ho=_e("operator",[Ae("eq"),Ae("neq"),Ae("gt"),Ae("gte"),Ae("lt"),Ae("lte"),Ae("co"),uo("exists"),uo("not_exists")]),qp=g({tableId:u(),limit:_(Je.number()),cursor:_(u()),filters:Dt(ho)});function go(){return Ee(be(r=>r==null?r:String(r)),Ke(u()))}l(go,"coerceToString");function Ae(r){return g({fieldId:u(),operator:S(r),value:u()})}l(Ae,"valueFilter");function uo(r){return g({fieldId:u(),operator:S(r)})}l(uo,"existenceFilter");var Gp=g({status:_(W()),body:_(z()),headers:_($(u(),u()))}),Wp=g({...Q,deleted:F(Pe),ownerId:u(),displayName:u(),platformId:u(),externalId:F(u())});var xo=g({name:u(),description:_(u()),type:u(),required:M()}),Kp=g({pieceName:u(),triggerName:u(),input:g({toolName:u(),toolDescription:u(),inputSchema:O(xo),returnsResponse:M()})});var vo="^[0-9]+\\.[0-9]+\\.[0-9]+$",WP=new RegExp(vo),Xp="^([~^])?[0-9]+\\.[0-9]+\\.[0-9]+$",KP=u().check(ye(new RegExp(vo))),JP=u().check(ye(new RegExp(Xp))),Yp=g({packageType:S("ARCHIVE"),pieceType:D(Re),pieceName:u(),pieceVersion:u(),archiveId:u(),platformId:u()}),yo=g({packageType:S("REGISTRY"),pieceType:S("OFFICIAL"),pieceName:u(),pieceVersion:u()}),_o=g({packageType:S("REGISTRY"),pieceType:S("CUSTOM"),pieceName:u(),pieceVersion:u(),platformId:u()}),XP=C([yo,_o]),YP=C([Yp,yo,_o]);var Qp=_e("type",[g({type:S("CRON_EXPRESSION"),cronExpression:u(),timezone:u()}),g({type:S("INTERVAL"),intervalMs:Ri().check(At(6e4))})]),QP=g({...Q,type:D(Ie),projectId:u(),flowId:u(),triggerName:u(),schedule:F(Qp),flowVersionId:u(),pieceName:u(),pieceVersion:u(),deleted:F(u()),simulate:M()}),bo=(v=>(v.UNKNOWN="UNKNOWN",v.FLOW_RUN_LOG="FLOW_RUN_LOG",v.FLOW_RUN_LOG_SLICE="FLOW_RUN_LOG_SLICE",v.PACKAGE_ARCHIVE="PACKAGE_ARCHIVE",v.FLOW_STEP_FILE="FLOW_STEP_FILE",v.SAMPLE_DATA="SAMPLE_DATA",v.TRIGGER_PAYLOAD="TRIGGER_PAYLOAD",v.SAMPLE_DATA_INPUT="SAMPLE_DATA_INPUT",v.TRIGGER_EVENT_FILE="TRIGGER_EVENT_FILE",v.PROJECT_RELEASE="PROJECT_RELEASE",v.FLOW_VERSION_BACKUP="FLOW_VERSION_BACKUP",v.PLATFORM_ASSET="PLATFORM_ASSET",v.USER_PROFILE_PICTURE="USER_PROFILE_PICTURE",v.WEBHOOK_PAYLOAD="WEBHOOK_PAYLOAD",v.KNOWLEDGE_BASE="KNOWLEDGE_BASE",v.FLOW_BUNDLE="FLOW_BUNDLE",v))(bo||{}),Eo=(t=>(t.NONE="NONE",t.ZSTD="ZSTD",t))(Eo||{}),Po=(t=>(t.S3="S3",t.DB="DB",t))(Po||{}),eT=g({...Q,projectId:F(u()),platformId:F(u()),type:D(bo),compression:D(Eo),data:_(z()),location:D(Po),size:F(W()),fileName:F(u()),s3Key:F(u()),metadata:F($(u(),u()))}),To=(n=>(n.ADMIN="ADMIN",n.MEMBER="MEMBER",n.OPERATOR="OPERATOR",n))(To||{}),So=(t=>(t.ACTIVE="ACTIVE",t.INACTIVE="INACTIVE",t))(So||{}),tT=g({id:u(),email:u(),firstName:u(),status:D(So),externalId:F(u()),platformId:F(u()),platformRole:D(To),lastName:u(),created:Pe,updated:Pe,lastActiveDate:F(Pe),imageUrl:F(u())});var Pr=g({...U.shape,...N($(u(),z()),"OBJECT").shape});var zo=g({...U.shape,...N(u(),"COLOR").shape});var Tr=C([X,ue,Nt,me,Y,de,ur,Xe,dr,fe,et,Pr,tt,Qe,Ye,zo]),q={ShortText(r){return{...r,valueSchema:void 0,type:"SHORT_TEXT"}},Checkbox(r){return{...r,valueSchema:void 0,type:"CHECKBOX"}},LongText(r){return{...r,valueSchema:void 0,type:"LONG_TEXT"}},MarkDown(r){return{displayName:"Markdown",required:!1,description:r.value,type:"MARKDOWN",valueSchema:void 0,variant:r.variant??"INFO"}},Number(r){return{...r,valueSchema:void 0,type:"NUMBER"}},Json(r){return{...r,valueSchema:void 0,type:"JSON"}},Array(r){return{...r,valueSchema:void 0,type:"ARRAY"}},Object(r){return{...r,valueSchema:void 0,type:"OBJECT"}},Dropdown(r){return{...r,valueSchema:void 0,type:"DROPDOWN"}},StaticDropdown(r){return{...r,valueSchema:void 0,type:"STATIC_DROPDOWN"}},MultiSelectDropdown(r){return{...r,valueSchema:void 0,type:"MULTI_SELECT_DROPDOWN"}},DynamicProperties(r){return{...r,valueSchema:void 0,type:"DYNAMIC"}},StaticMultiSelectDropdown(r){return{...r,valueSchema:void 0,type:"STATIC_MULTI_SELECT_DROPDOWN"}},DateTime(r){return{...r,valueSchema:void 0,type:"DATE_TIME"}},File(r){return{...r,valueSchema:void 0,type:"FILE"}},Custom(r){let e=r.code.toString();return{...r,code:e,valueSchema:void 0,type:"CUSTOM"}},Color(r){return{...r,valueSchema:void 0,type:"COLOR"}}};var ae=g({displayName:u(),description:_(u())});var $o=g({username:u(),password:u()}),Sr=g({...ae.shape,username:g({displayName:u(),description:_(u())}),password:g({displayName:u(),description:_(u())}),...N($o,"BASIC_AUTH").shape});var nl=$(u(),C([X,ue,fe,me,Y])),Ir=g({...ae.shape,props:nl,...N(z(),"CUSTOM_AUTH").shape});var ze=g({...ae.shape,...N(g({auth:u()}),"SECRET_TEXT").shape});var il=$(u(),C([X,ue,ze,fe,me,Y,de,Nt])),ko=g({...ae.shape,props:il,...N(z(),"OIDC").shape});var wr=(t=>(t.HEADER="HEADER",t.BODY="BODY",t))(wr||{}),Oo=C([X,ze,Y]),Co=$(u(),Oo),ol=g({props:_($(u(),Oo)),authUrl:u(),tokenUrl:u(),scope:O(u()),prompt:_(C([S("none"),S("consent"),S("login"),S("omit")])),pkce:_(M()),pkceMethod:_(C([S("plain"),S("S256")])),authorizationMethod:_(D(wr)),grantType:_(C([D(nt),S(mr)])),extra:_($(u(),u()))}),No=g({access_token:u(),props:_(Co),data:$(u(),We())}),Ar=g({...ae.shape,...ol.shape,...N(No,"OAUTH2").shape});var je=C([Sr,Ir,ko,Ar,ze]),ct="Connection",Mt={SecretText(r){return{...r,valueSchema:void 0,type:"SECRET_TEXT"}},OAuth2(r){return{...r,valueSchema:void 0,type:"OAUTH2",displayName:r.displayName||ct}},BasicAuth(r){return{...r,valueSchema:void 0,type:"BASIC_AUTH",displayName:r.displayName||ct,required:!0}},CustomAuth(r){return{...r,valueSchema:void 0,type:"CUSTOM_AUTH",displayName:r.displayName||ct}},OIDC(r){return{...r,valueSchema:void 0,type:"OIDC",displayName:r.displayName||ct}},None(){}};var CS={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 al=g({...U.shape,...N(z(),"CUSTOM").shape,code:u()});var cl=C([Tr,je]),zr=$(u(),cl),QS=$(u(),Tr);var Ro=C([g({strategy:S("CRON"),cronExpression:u()}),g({strategy:S("NONE")})]);var Do="2",jt="0.82.0";var $r=class{constructor(e,t,n,i,o,a,s,c,p=jt,f,x="",m){this.displayName=e;this.logoUrl=t;this.authors=n;this.events=i;this.categories=s;this.auth=c;this.minimumSupportedRelease=p;this.maximumSupportedRelease=f;this.description=x;this.deprecated=m;this._actions={};this._triggers={};this.getContextInfo=l(()=>({version:Do}),"getContextInfo");(!pl(p)||ll(p,jt))&&(this.minimumSupportedRelease=jt),o.forEach(d=>this._actions[d.name]=d),a.forEach(d=>this._triggers[d.name]=d)}static{l(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:this.auth,minimumSupportedRelease:this.minimumSupportedRelease,maximumSupportedRelease:this.maximumSupportedRelease,deprecated:this.deprecated,contextInfo:this.getContextInfo?.()}}getAction(e){return this._actions[e]}getTrigger(e){return this._triggers[e]}actions(){return this._actions}triggers(){return this._triggers}},Uo=l(r=>{if(r.auth&&Array.isArray(r.auth)&&!r.auth.every((t,n,i)=>n===i.findIndex(o=>o.type===t.type)))throw new Error("Auth properties must be unique by type");return new $r(r.displayName,r.logoUrl,r.authors??[],r.events,r.actions,r.triggers,r.categories??[],r.auth,r.minimumSupportedRelease,r.maximumSupportedRelease,r.description,r.deprecated)},"createPiece");function pl(r){return/^\d+\.\d+\.\d+$/.test(r)}l(pl,"isValidSimpleSemver");function ll(r,e){let[t,n,i]=r.split(".").map(Number),[o,a,s]=e.split(".").map(Number);return t!==o?t<o:n!==a?n<a:i<s}l(ll,"isSemverLessThan");var ul=_($(u(),$(u(),u()))),Mo=g({id:_(u()),name:u(),displayName:u(),logoUrl:u(),description:u(),authors:O(u()),platformId:_(u()),directoryPath:_(u()),auth:_(C([je,O(je)])),version:u(),categories:_(O(D(De))),minimumSupportedRelease:_(u()),maximumSupportedRelease:_(u()),deprecated:_(M()),i18n:ul}),dl=D(["human","ai","both"]),jo=g({description:_(u()),idempotent:_(M())}),Lo=g({name:u(),displayName:u(),description:u(),props:zr,requireAuth:M(),errorHandlingOptions:_(lr),outputSchema:_(Ot()),audience:_(dl),aiMetadata:_(jo)}),Fo=g({name:u(),displayName:u(),description:u(),props:zr,errorHandlingOptions:_(lr),type:D(Ie),sampleData:z(),handshakeConfiguration:_(Ot()),renewConfiguration:_(Ro),testStrategy:D(ot),outputSchema:_(Ot()),aiMetadata:_(jo)}),ml=g({...Mo.shape,actions:$(u(),Lo),triggers:$(u(),Fo)}),fl=g({...Mo.shape,actions:W(),triggers:W(),suggestedActions:_(O(Lo)),suggestedTriggers:_(O(Fo))}),Bo=g({projectUsage:W(),pieceType:D(Re),packageType:D(rt),platformId:_(u()),archiveId:_(u())}),QI=g({...ml.shape,...Bo.shape}),ew=g({...fl.shape,...Bo.shape}),tw=g({name:u(),version:u()});var hl=Oe(require("path")),gl=Oe(require("fs/promises"));var Us=Oe(Ds()),xt={constructConfig(r){let e=r.email&&r.password;return{host:r.host,port:r.port,requireTLS:r.TLS,...e?{auth:{user:r.email,pass:r.password}}:{},connectionTimeout:6e4,secure:r.port===465}},createSMTPTransport(r){let e=xt.constructConfig(r);return Us.default.createTransport(e)}};var Zs=Oe(Bs());var Hs=Li({audience:"human",auth:Gt,name:"send-email",displayName:"Send Email",description:"Send an email using a custom SMTP server.",props:{from:q.ShortText({displayName:"From Email",required:!0}),senderName:q.ShortText({displayName:"Sender Name",required:!1}),to:q.Array({displayName:"To",required:!0}),cc:q.Array({displayName:"CC",required:!1}),replyTo:q.ShortText({displayName:"Reply To",required:!1}),bcc:q.Array({displayName:"BCC",required:!1}),subject:q.ShortText({displayName:"Subject",required:!0}),body_type:q.StaticDropdown({displayName:"Body Type",required:!0,defaultValue:"plain_text",options:{disabled:!1,options:[{label:"plain text",value:"plain_text"},{label:"html",value:"html"}]}}),body:q.LongText({displayName:"Body",required:!0}),customHeaders:q.Object({displayName:"Custom Headers",required:!1}),attachments:q.Array({displayName:"Attachments",required:!1,properties:{file:q.File({displayName:"File",description:"File to attach to the email you want to send",required:!0}),name:q.ShortText({displayName:"Attachment Name",description:"In case you want to change the name of the attachment",required:!1})}})},run:l(async({auth:r,propsValue:e})=>{let t=xt.createSMTPTransport(r.props),i=e.attachments.map(({file:a,name:s})=>{let c=Zs.default.lookup(a.extension?a.extension:"");return{filename:s??a.filename,content:a?.base64,contentType:c||void 0,encoding:"base64"}}),o={from:Fd(e.senderName,e.from),to:e.to.join(","),cc:e.cc?.join(","),inReplyTo:e.replyTo,bcc:e.bcc?.join(","),subject:e.subject,text:e.body_type==="plain_text"?e.body:void 0,html:e.body_type==="html"?e.body:void 0,attachments:i||void 0,headers:e.customHeaders};return await Ld(t,o)},"run")});async function Ld(r,e){let n=0;for(;n<3;)try{return await r.sendMail(e)}catch(i){if("code"in i&&i.code==="ECONNRESET"&&n<2){n++,await new Promise(o=>setTimeout(o,3e3));continue}throw i}}l(Ld,"sendWithRetry");function Fd(r,e){return r?`"${r}" <${e}>`:e}l(Fd,"getFrom");var Bd=[25,465,587,2525],Gt=Mt.CustomAuth({required:!0,props:{host:q.ShortText({displayName:"Host",required:!0}),email:q.ShortText({displayName:"Email",description:"Leave blank if your mail relay does not require authentication.",required:!1}),password:Mt.SecretText({displayName:"Password",description:"Leave blank if your mail relay does not require authentication.",required:!1}),port:q.StaticDropdown({displayName:"Port",required:!0,options:{disabled:!1,options:Bd.map(r=>({label:r.toString(),value:r}))}}),TLS:q.Checkbox({displayName:"Require TLS?",defaultValue:!1,required:!0})},validate:l(async({auth:r})=>{try{let e=xt.createSMTPTransport(r);return new Promise((t,n)=>{e.verify(function(i,o){t(i?{valid:!1,error:JSON.stringify(i)}:{valid:!0})})})}catch(e){switch(e?.code){case"EDNS":return{valid:!1,error:"SMTP server not found or unreachable with error code: EDNS"};case"CONN":return{valid:!1,error:"SMTP server connection failed with error code: CONN"};default:break}return{valid:!1,error:JSON.stringify(e)}}},"validate")}),Zd=Uo({displayName:"SMTP",description:"Send emails using Simple Mail Transfer Protocol",minimumSupportedRelease:"0.30.0",logoUrl:"https://cdn.activepieces.com/pieces/new-core/smtp.svg",categories:["CORE"],authors:["tahboubali","abaza738","kishanprmr","MoShizzle","khaledmashaly","abuaboud","pfernandez98"],auth:Gt,actions:[Hs],triggers:[]});0&&(module.exports={smtp,smtpAuth});
53
53
  /*! Bundled license information:
54
54
 
55
55
  mime-types/index.js: