@activepieces/piece-duckdb 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/index.js +4 -4
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
"use strict";var po=Object.create;var Te=Object.defineProperty;var mo=Object.getOwnPropertyDescriptor;var fo=Object.getOwnPropertyNames;var go=Object.getPrototypeOf,yo=Object.prototype.hasOwnProperty;var o=(e,t)=>Te(e,"name",{value:t,configurable:!0});var ho=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),qt=(e,t)=>{for(var r in t)Te(e,r,{get:t[r],enumerable:!0})},Yt=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of fo(t))!yo.call(e,s)&&s!==r&&Te(e,s,{get:()=>t[s],enumerable:!(i=mo(t,s))||i.enumerable});return e};var We=(e,t,r)=>(r=e!=null?po(go(e)):{},Yt(t||!e||!e.__esModule?Te(r,"default",{value:e,enumerable:!0}):r,e)),vo=e=>Yt(Te({},"__esModule",{value:!0}),e);var hn=ho((yn,ct)=>{(function(e){"use strict";let t="(0?\\d+|0x[a-f0-9]+)",r={fourOctet:new RegExp(`^${t}\\.${t}\\.${t}\\.${t}$`,"i"),threeOctet:new RegExp(`^${t}\\.${t}\\.${t}$`,"i"),twoOctet:new RegExp(`^${t}\\.${t}$`,"i"),longValue:new RegExp(`^${t}$`,"i")},i=new RegExp("^0[0-7]+$","i"),s=new RegExp("^0x[a-f0-9]+$","i"),p="%[0-9a-z]{1,}",d="(?:[0-9a-f]+::?)+",f={zoneIndex:new RegExp(p,"i"),native:new RegExp(`^(::)?(${d})?([0-9a-f]+)?(::)?(${p})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${t}\\.${t}\\.${t}\\.${t}(${p})?)$`,"i"),transitional:new RegExp(`^((?:${d})|(?:::)(?:${d})?)${t}\\.${t}\\.${t}\\.${t}(${p})?$`,"i")};function h(a,c){if(a.indexOf("::")!==a.lastIndexOf("::"))return null;let g=0,l=-1,y=(a.match(f.zoneIndex)||[])[0],_,M;for(y&&(y=y.substring(1),a=a.replace(/%.+$/,""));(l=a.indexOf(":",l+1))>=0;)g++;if(a.substr(0,2)==="::"&&g--,a.substr(-2,2)==="::"&&g--,g>c)return null;for(M=c-g,_=":";M--;)_+="0:";return a=a.replace("::",_),a[0]===":"&&(a=a.slice(1)),a[a.length-1]===":"&&(a=a.slice(0,-1)),c=function(){let Jt=a.split(":"),Xt=[];for(let pt=0;pt<Jt.length;pt++)Xt.push(parseInt(Jt[pt],16));return Xt}(),{parts:c,zoneId:y}}o(h,"expandIPv6");function v(a,c,g,l){if(a.length!==c.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let y=0,_;for(;l>0;){if(_=g-l,_<0&&(_=0),a[y]>>_!==c[y]>>_)return!1;l-=g,y+=1}return!0}o(v,"matchCIDR");function P(a){if(s.test(a))return parseInt(a,16);if(a[0]==="0"&&!isNaN(parseInt(a[1],10))){if(i.test(a))return parseInt(a,8);throw new Error(`ipaddr: cannot parse ${a} as octal`)}return parseInt(a,10)}o(P,"parseIntAuto");function N(a,c){for(;a.length<c;)a=`0${a}`;return a}o(N,"padPart");let x={};x.IPv4=function(){function a(c){if(c.length!==4)throw new Error("ipaddr: ipv4 octet count should be 4");let g,l;for(g=0;g<c.length;g++)if(l=c[g],!(0<=l&&l<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=c}return o(a,"IPv4"),a.prototype.SpecialRanges={unspecified:[[new a([0,0,0,0]),8]],broadcast:[[new a([255,255,255,255]),32]],multicast:[[new a([224,0,0,0]),4]],linkLocal:[[new a([169,254,0,0]),16]],loopback:[[new a([127,0,0,0]),8]],carrierGradeNat:[[new a([100,64,0,0]),10]],private:[[new a([10,0,0,0]),8],[new a([172,16,0,0]),12],[new a([192,168,0,0]),16]],reserved:[[new a([192,0,0,0]),24],[new a([192,0,2,0]),24],[new a([192,88,99,0]),24],[new a([198,18,0,0]),15],[new a([198,51,100,0]),24],[new a([203,0,113,0]),24],[new a([240,0,0,0]),4]],as112:[[new a([192,175,48,0]),24],[new a([192,31,196,0]),24]],amt:[[new a([192,52,193,0]),24]]},a.prototype.kind=function(){return"ipv4"},a.prototype.match=function(c,g){let l;if(g===void 0&&(l=c,c=l[0],g=l[1]),c.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return v(this.octets,c.octets,8,g)},a.prototype.prefixLengthFromSubnetMask=function(){let c=0,g=!1,l={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0},y,_,M;for(y=3;y>=0;y-=1)if(_=this.octets[y],_ in l){if(M=l[_],g&&M!==0)return null;M!==8&&(g=!0),c+=M}else return null;return 32-c},a.prototype.range=function(){return x.subnetMatch(this,this.SpecialRanges)},a.prototype.toByteArray=function(){return this.octets.slice(0)},a.prototype.toIPv4MappedAddress=function(){return x.IPv6.parse(`::ffff:${this.toString()}`)},a.prototype.toNormalizedString=function(){return this.toString()},a.prototype.toString=function(){return this.octets.join(".")},a}(),x.IPv4.broadcastAddressFromCIDR=function(a){try{let c=this.parseCIDR(a),g=c[0].toByteArray(),l=this.subnetMaskFromPrefixLength(c[1]).toByteArray(),y=[],_=0;for(;_<4;)y.push(parseInt(g[_],10)|parseInt(l[_],10)^255),_++;return new this(y)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},x.IPv4.isIPv4=function(a){return this.parser(a)!==null},x.IPv4.isValid=function(a){try{return new this(this.parser(a)),!0}catch{return!1}},x.IPv4.isValidCIDR=function(a){try{return this.parseCIDR(a),!0}catch{return!1}},x.IPv4.isValidFourPartDecimal=function(a){return!!(x.IPv4.isValid(a)&&a.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},x.IPv4.isValidCIDRFourPartDecimal=function(a){let c=a.match(/^(.+)\/(\d+)$/);return!x.IPv4.isValidCIDR(a)||!c?!1:x.IPv4.isValidFourPartDecimal(c[1])},x.IPv4.networkAddressFromCIDR=function(a){let c,g,l,y,_;try{for(c=this.parseCIDR(a),l=c[0].toByteArray(),_=this.subnetMaskFromPrefixLength(c[1]).toByteArray(),y=[],g=0;g<4;)y.push(parseInt(l[g],10)&parseInt(_[g],10)),g++;return new this(y)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},x.IPv4.parse=function(a){let c=this.parser(a);if(c===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(c)},x.IPv4.parseCIDR=function(a){let c;if(c=a.match(/^(.+)\/(\d+)$/)){let g=parseInt(c[2]);if(g>=0&&g<=32){let l=[this.parse(c[1]),g];return Object.defineProperty(l,"toString",{value:o(function(){return this.join("/")},"value")}),l}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},x.IPv4.parser=function(a){let c,g,l;if(c=a.match(r.fourOctet))return function(){let y=c.slice(1,6),_=[];for(let M=0;M<y.length;M++)g=y[M],_.push(P(g));return _}();if(c=a.match(r.longValue)){if(l=P(c[1]),l>4294967295||l<0)throw new Error("ipaddr: address outside defined range");return function(){let y=[],_;for(_=0;_<=24;_+=8)y.push(l>>_&255);return y}().reverse()}else return(c=a.match(r.twoOctet))?function(){let y=c.slice(1,4),_=[];if(l=P(y[1]),l>16777215||l<0)throw new Error("ipaddr: address outside defined range");return _.push(P(y[0])),_.push(l>>16&255),_.push(l>>8&255),_.push(l&255),_}():(c=a.match(r.threeOctet))?function(){let y=c.slice(1,5),_=[];if(l=P(y[2]),l>65535||l<0)throw new Error("ipaddr: address outside defined range");return _.push(P(y[0])),_.push(P(y[1])),_.push(l>>8&255),_.push(l&255),_}():null},x.IPv4.subnetMaskFromPrefixLength=function(a){if(a=parseInt(a),a<0||a>32)throw new Error("ipaddr: invalid IPv4 prefix length");let c=[0,0,0,0],g=0,l=Math.floor(a/8);for(;g<l;)c[g]=255,g++;return l<4&&(c[l]=Math.pow(2,a%8)-1<<8-a%8),new this(c)},x.IPv6=function(){function a(c,g){let l,y;if(c.length===16)for(this.parts=[],l=0;l<=14;l+=2)this.parts.push(c[l]<<8|c[l+1]);else if(c.length===8)this.parts=c;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(l=0;l<this.parts.length;l++)if(y=this.parts[l],!(0<=y&&y<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");g&&(this.zoneId=g)}return o(a,"IPv6"),a.prototype.SpecialRanges={unspecified:[new a([0,0,0,0,0,0,0,0]),128],linkLocal:[new a([65152,0,0,0,0,0,0,0]),10],multicast:[new a([65280,0,0,0,0,0,0,0]),8],loopback:[new a([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new a([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new a([0,0,0,0,0,65535,0,0]),96],discard:[new a([256,0,0,0,0,0,0,0]),64],rfc6145:[new a([0,0,0,0,65535,0,0,0]),96],rfc6052:[new a([100,65435,0,0,0,0,0,0]),96],"6to4":[new a([8194,0,0,0,0,0,0,0]),16],teredo:[new a([8193,0,0,0,0,0,0,0]),32],benchmarking:[new a([8193,2,0,0,0,0,0,0]),48],amt:[new a([8193,3,0,0,0,0,0,0]),32],as112v6:[[new a([8193,4,274,0,0,0,0,0]),48],[new a([9760,79,32768,0,0,0,0,0]),48]],deprecated:[new a([8193,16,0,0,0,0,0,0]),28],orchid2:[new a([8193,32,0,0,0,0,0,0]),28],droneRemoteIdProtocolEntityTags:[new a([8193,48,0,0,0,0,0,0]),28],reserved:[[new a([8193,0,0,0,0,0,0,0]),23],[new a([8193,3512,0,0,0,0,0,0]),32]]},a.prototype.isIPv4MappedAddress=function(){return this.range()==="ipv4Mapped"},a.prototype.kind=function(){return"ipv6"},a.prototype.match=function(c,g){let l;if(g===void 0&&(l=c,c=l[0],g=l[1]),c.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return v(this.parts,c.parts,16,g)},a.prototype.prefixLengthFromSubnetMask=function(){let c=0,g=!1,l={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0},y,_;for(let M=7;M>=0;M-=1)if(y=this.parts[M],y in l){if(_=l[y],g&&_!==0)return null;_!==16&&(g=!0),c+=_}else return null;return 128-c},a.prototype.range=function(){return x.subnetMatch(this,this.SpecialRanges)},a.prototype.toByteArray=function(){let c,g=[],l=this.parts;for(let y=0;y<l.length;y++)c=l[y],g.push(c>>8),g.push(c&255);return g},a.prototype.toFixedLengthString=function(){let c=function(){let l=[];for(let y=0;y<this.parts.length;y++)l.push(N(this.parts[y].toString(16),4));return l}.call(this).join(":"),g="";return this.zoneId&&(g=`%${this.zoneId}`),c+g},a.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");let c=this.parts.slice(-2),g=c[0],l=c[1];return new x.IPv4([g>>8,g&255,l>>8,l&255])},a.prototype.toNormalizedString=function(){let c=function(){let l=[];for(let y=0;y<this.parts.length;y++)l.push(this.parts[y].toString(16));return l}.call(this).join(":"),g="";return this.zoneId&&(g=`%${this.zoneId}`),c+g},a.prototype.toRFC5952String=function(){let c=/((^|:)(0(:|$)){2,})/g,g=this.toNormalizedString(),l=0,y=-1,_;for(;_=c.exec(g);)_[0].length>y&&(l=_.index,y=_[0].length);return y<0?g:`${g.substring(0,l)}::${g.substring(l+y)}`},a.prototype.toString=function(){return this.toRFC5952String()},a}(),x.IPv6.broadcastAddressFromCIDR=function(a){try{let c=this.parseCIDR(a),g=c[0].toByteArray(),l=this.subnetMaskFromPrefixLength(c[1]).toByteArray(),y=[],_=0;for(;_<16;)y.push(parseInt(g[_],10)|parseInt(l[_],10)^255),_++;return new this(y)}catch(c){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${c})`)}},x.IPv6.isIPv6=function(a){return this.parser(a)!==null},x.IPv6.isValid=function(a){if(typeof a=="string"&&a.indexOf(":")===-1)return!1;try{let c=this.parser(a);return new this(c.parts,c.zoneId),!0}catch{return!1}},x.IPv6.isValidCIDR=function(a){if(typeof a=="string"&&a.indexOf(":")===-1)return!1;try{return this.parseCIDR(a),!0}catch{return!1}},x.IPv6.networkAddressFromCIDR=function(a){let c,g,l,y,_;try{for(c=this.parseCIDR(a),l=c[0].toByteArray(),_=this.subnetMaskFromPrefixLength(c[1]).toByteArray(),y=[],g=0;g<16;)y.push(parseInt(l[g],10)&parseInt(_[g],10)),g++;return new this(y)}catch(M){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${M})`)}},x.IPv6.parse=function(a){let c=this.parser(a);if(c.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(c.parts,c.zoneId)},x.IPv6.parseCIDR=function(a){let c,g,l;if((g=a.match(/^(.+)\/(\d+)$/))&&(c=parseInt(g[2]),c>=0&&c<=128))return l=[this.parse(g[1]),c],Object.defineProperty(l,"toString",{value:o(function(){return this.join("/")},"value")}),l;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},x.IPv6.parser=function(a){let c,g,l,y,_,M;if(l=a.match(f.deprecatedTransitional))return this.parser(`::ffff:${l[1]}`);if(f.native.test(a))return h(a,8);if((l=a.match(f.transitional))&&(M=l[6]||"",c=l[1],l[1].endsWith("::")||(c=c.slice(0,-1)),c=h(c+M,6),c.parts)){for(_=[parseInt(l[2]),parseInt(l[3]),parseInt(l[4]),parseInt(l[5])],g=0;g<_.length;g++)if(y=_[g],!(0<=y&&y<=255))return null;return c.parts.push(_[0]<<8|_[1]),c.parts.push(_[2]<<8|_[3]),{parts:c.parts,zoneId:c.zoneId}}return null},x.IPv6.subnetMaskFromPrefixLength=function(a){if(a=parseInt(a),a<0||a>128)throw new Error("ipaddr: invalid IPv6 prefix length");let c=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],g=0,l=Math.floor(a/8);for(;g<l;)c[g]=255,g++;return l<16&&(c[l]=Math.pow(2,a%8)-1<<8-a%8),new this(c)},x.fromByteArray=function(a){let c=a.length;if(c===4)return new x.IPv4(a);if(c===16)return new x.IPv6(a);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},x.isValid=function(a){return x.IPv6.isValid(a)||x.IPv4.isValid(a)},x.isValidCIDR=function(a){return x.IPv6.isValidCIDR(a)||x.IPv4.isValidCIDR(a)},x.parse=function(a){if(x.IPv6.isValid(a))return x.IPv6.parse(a);if(x.IPv4.isValid(a))return x.IPv4.parse(a);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},x.parseCIDR=function(a){try{return x.IPv6.parseCIDR(a)}catch{try{return x.IPv4.parseCIDR(a)}catch{throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},x.process=function(a){let c=this.parse(a);return c.kind()==="ipv6"&&c.isIPv4MappedAddress()?c.toIPv4Address():c},x.subnetMatch=function(a,c,g){let l,y,_,M;g==null&&(g="unicast");for(y in c)if(Object.prototype.hasOwnProperty.call(c,y)){for(_=c[y],_[0]&&!(_[0]instanceof Array)&&(_=[_]),l=0;l<_.length;l++)if(M=_[l],a.kind()===M[0].kind()&&a.match.apply(a,M))return y}return g},typeof ct<"u"&&ct.exports?ct.exports=x:e.ipaddr=x})(yn)});var Va={};qt(Va,{duckdb:()=>Fa});module.exports=vo(Va);var xo=Object.freeze({status:"aborted"});function I(e,t,r){function i(f,h){if(f._zod||Object.defineProperty(f,"_zod",{value:{def:h,constr:d,traits:new Set},enumerable:!1}),f._zod.traits.has(e))return;f._zod.traits.add(e),t(f,h);let v=d.prototype,P=Object.keys(v);for(let N=0;N<P.length;N++){let x=P[N];x in f||(f[x]=v[x].bind(f))}}o(i,"init");let s=r?.Parent??Object;class p extends s{static{o(this,"Definition")}}Object.defineProperty(p,"name",{value:e});function d(f){var h;let v=r?.Parent?new p:this;i(v,f),(h=v._zod).deferred??(h.deferred=[]);for(let P of v._zod.deferred)P();return v}return o(d,"_"),Object.defineProperty(d,"init",{value:i}),Object.defineProperty(d,Symbol.hasInstance,{value:o(f=>r?.Parent&&f instanceof r.Parent?!0:f?._zod?.traits?.has(e),"value")}),Object.defineProperty(d,"name",{value:e}),d}o(I,"$constructor");var _o=Symbol("zod_brand"),X=class extends Error{static{o(this,"$ZodAsyncError")}constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Ge=class extends Error{static{o(this,"$ZodEncodeError")}constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}},dt={};function Y(e){return e&&Object.assign(dt,e),dt}o(Y,"config");function ft(e){let t=Object.values(e).filter(i=>typeof i=="number");return Object.entries(e).filter(([i,s])=>t.indexOf(+i)===-1).map(([i,s])=>s)}o(ft,"getEnumValues");function er(e,t){return typeof t=="bigint"?t.toString():t}o(er,"jsonStringifyReplacer");function Ke(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}o(Ke,"cached");function tr(e){return e==null}o(tr,"nullish");function Je(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}o(Je,"cleanRegex");var Qt=Symbol("evaluating");function V(e,t,r){let i;Object.defineProperty(e,t,{get(){if(i!==Qt)return i===void 0&&(i=Qt,i=r()),i},set(s){Object.defineProperty(e,t,{value:s})},configurable:!0})}o(V,"defineLazy");var gt="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function be(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}o(be,"isObject");var Po=Ke(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function rr(e){if(be(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(be(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}o(rr,"isPlainObject");var nr=new Set(["string","number","symbol"]);function ge(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}o(ge,"escapeRegex");function Xe(e,t,r){let i=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(i._zod.parent=e),i}o(Xe,"clone");function L(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:o(()=>t,"error")};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:o(()=>t.error,"error")}:t}o(L,"normalizeParams");function or(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}o(or,"optionalKeys");var Io={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 ye(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}o(ye,"aborted");function ie(e,t){return t.map(r=>{var i;return(i=r).path??(i.path=[]),r.path.unshift(e),r})}o(ie,"prefixIssues");function He(e){return typeof e=="string"?e:e?.message}o(He,"unwrapMessage");function ae(e,t,r){let i={...e,path:e.path??[]};if(!e.message){let s=He(e.inst?._zod.def?.error?.(e))??He(t?.error?.(e))??He(r.customError?.(e))??He(r.localeError?.(e))??"Invalid input";i.message=s}return delete i.inst,delete i.continue,t?.reportInput||delete i.input,i}o(ae,"finalizeIssue");function ir(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}o(ir,"getLengthableOrigin");function yt(...e){let[t,r,i]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:i}:{...t}}o(yt,"issue");var ar=o((e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,er,2),Object.defineProperty(e,"toString",{value:o(()=>e.message,"value"),enumerable:!1})},"initializer"),sr=I("$ZodError",ar),Ee=I("$ZodError",ar,{Parent:Error});var To=o(e=>(t,r,i,s)=>{let p=i?Object.assign(i,{async:!1}):{async:!1},d=t._zod.run({value:r,issues:[]},p);if(d instanceof Promise)throw new X;if(d.issues.length){let f=new(s?.Err??e)(d.issues.map(h=>ae(h,p,Y())));throw gt(f,s?.callee),f}return d.value},"_parse"),qe=To(Ee),bo=o(e=>async(t,r,i,s)=>{let p=i?Object.assign(i,{async:!0}):{async:!0},d=t._zod.run({value:r,issues:[]},p);if(d instanceof Promise&&(d=await d),d.issues.length){let f=new(s?.Err??e)(d.issues.map(h=>ae(h,p,Y())));throw gt(f,s?.callee),f}return d.value},"_parseAsync"),Ye=bo(Ee),Eo=o(e=>(t,r,i)=>{let s=i?{...i,async:!1}:{async:!1},p=t._zod.run({value:r,issues:[]},s);if(p instanceof Promise)throw new X;return p.issues.length?{success:!1,error:new(e??sr)(p.issues.map(d=>ae(d,s,Y())))}:{success:!0,data:p.value}},"_safeParse"),ze=Eo(Ee),zo=o(e=>async(t,r,i)=>{let s=i?Object.assign(i,{async:!0}):{async:!0},p=t._zod.run({value:r,issues:[]},s);return p instanceof Promise&&(p=await p),p.issues.length?{success:!1,error:new e(p.issues.map(d=>ae(d,s,Y())))}:{success:!0,data:p.value}},"_safeParseAsync"),Se=zo(Ee);var So="(?:(?:\\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])))",Ao=new RegExp(`^${So}$`);var ur=o(e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},"string"),cr=/^-?\d+n?$/;var ht=/^-?\d+(?:\.\d+)?$/,lr=/^(?:true|false)$/i;var he=I("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var pr=I("$ZodCheckMinLength",(e,t)=>{var r;he.init(e,t),(r=e._zod.def).when??(r.when=i=>{let s=i.value;return!tr(s)&&s.length!==void 0}),e._zod.onattach.push(i=>{let s=i._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>s&&(i._zod.bag.minimum=t.minimum)}),e._zod.check=i=>{let s=i.value;if(s.length>=t.minimum)return;let d=ir(s);i.issues.push({origin:d,code:"too_small",minimum:t.minimum,inclusive:!0,input:s,inst:e,continue:!t.abort})}});var vt=I("$ZodCheckStringFormat",(e,t)=>{var r,i;he.init(e,t),e._zod.onattach.push(s=>{let p=s._zod.bag;p.format=t.format,t.pattern&&(p.patterns??(p.patterns=new Set),p.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=s=>{t.pattern.lastIndex=0,!t.pattern.test(s.value)&&s.issues.push({origin:"string",code:"invalid_format",format:t.format,input:s.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(i=e._zod).check??(i.check=()=>{})}),dr=I("$ZodCheckRegex",(e,t)=>{vt.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}});var fr={major:4,minor:3,patch:6};var Z=I("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=fr;let i=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&i.unshift(e);for(let s of i)for(let p of s._zod.onattach)p(e);if(i.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let s=o((d,f,h)=>{let v=ye(d),P;for(let N of f){if(N._zod.def.when){if(!N._zod.def.when(d))continue}else if(v)continue;let x=d.issues.length,a=N._zod.check(d);if(a instanceof Promise&&h?.async===!1)throw new X;if(P||a instanceof Promise)P=(P??Promise.resolve()).then(async()=>{await a,d.issues.length!==x&&(v||(v=ye(d,x)))});else{if(d.issues.length===x)continue;v||(v=ye(d,x))}}return P?P.then(()=>d):d},"runChecks"),p=o((d,f,h)=>{if(ye(d))return d.aborted=!0,d;let v=s(f,i,h);if(v instanceof Promise){if(h.async===!1)throw new X;return v.then(P=>e._zod.parse(P,h))}return e._zod.parse(v,h)},"handleCanaryResult");e._zod.run=(d,f)=>{if(f.skipChecks)return e._zod.parse(d,f);if(f.direction==="backward"){let v=e._zod.parse({value:d.value,issues:[]},{...f,skipChecks:!0});return v instanceof Promise?v.then(P=>p(P,d,f)):p(v,d,f)}let h=e._zod.parse(d,f);if(h instanceof Promise){if(f.async===!1)throw new X;return h.then(v=>s(v,i,f))}return s(h,i,f)}}V(e,"~standard",()=>({validate:o(s=>{try{let p=ze(e,s);return p.success?{value:p.data}:{issues:p.error?.issues}}catch{return Se(e,s).then(d=>d.success?{value:d.data}:{issues:d.error?.issues})}},"validate"),vendor:"zod",version:1}))}),tt=I("$ZodString",(e,t)=>{Z.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??ur(e._zod.bag),e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),xt=I("$ZodStringFormat",(e,t)=>{vt.init(e,t),tt.init(e,t)});var xr=I("$ZodURL",(e,t)=>{xt.init(e,t),e._zod.check=r=>{try{let i=r.value.trim(),s=new URL(i);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(s.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(s.protocol.endsWith(":")?s.protocol.slice(0,-1):s.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=s.href:r.value=i;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}});var _r=I("$ZodNumber",(e,t)=>{Z.init(e,t),e._zod.pattern=e._zod.bag.pattern??ht,e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let s=r.value;if(typeof s=="number"&&!Number.isNaN(s)&&Number.isFinite(s))return r;let p=typeof s=="number"?Number.isNaN(s)?"NaN":Number.isFinite(s)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:s,inst:e,...p?{received:p}:{}}),r}});var _t=I("$ZodBoolean",(e,t)=>{Z.init(e,t),e._zod.pattern=lr,e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=!!r.value}catch{}let s=r.value;return typeof s=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:s,inst:e}),r}}),Pr=I("$ZodBigInt",(e,t)=>{Z.init(e,t),e._zod.pattern=cr,e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}});var Ir=I("$ZodAny",(e,t)=>{Z.init(e,t),e._zod.parse=r=>r}),$r=I("$ZodUnknown",(e,t)=>{Z.init(e,t),e._zod.parse=r=>r});var Tr=I("$ZodVoid",(e,t)=>{Z.init(e,t),e._zod.parse=(r,i)=>{let s=r.value;return typeof s>"u"||r.issues.push({expected:"void",code:"invalid_type",input:s,inst:e}),r}}),br=I("$ZodDate",(e,t)=>{Z.init(e,t),e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let s=r.value,p=s instanceof Date;return p&&!Number.isNaN(s.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:s,...p?{received:"Invalid Date"}:{},inst:e}),r}});function gr(e,t,r){e.issues.length&&t.issues.push(...ie(r,e.issues)),t.value[r]=e.value}o(gr,"handleArrayResult");var Er=I("$ZodArray",(e,t)=>{Z.init(e,t),e._zod.parse=(r,i)=>{let s=r.value;if(!Array.isArray(s))return r.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),r;r.value=Array(s.length);let p=[];for(let d=0;d<s.length;d++){let f=s[d],h=t.element._zod.run({value:f,issues:[]},i);h instanceof Promise?p.push(h.then(v=>gr(v,r,d))):gr(h,r,d)}return p.length?Promise.all(p).then(()=>r):r}});function et(e,t,r,i,s){if(e.issues.length){if(s&&!(r in i))return;t.issues.push(...ie(r,e.issues))}e.value===void 0?r in i&&(t.value[r]=void 0):t.value[r]=e.value}o(et,"handlePropertyResult");function ko(e){let t=Object.keys(e.shape);for(let i of t)if(!e.shape?.[i]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${i}": expected a Zod schema`);let r=or(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}o(ko,"normalizeDef");function Oo(e,t,r,i,s,p){let d=[],f=s.keySet,h=s.catchall._zod,v=h.def.type,P=h.optout==="optional";for(let N in t){if(f.has(N))continue;if(v==="never"){d.push(N);continue}let x=h.run({value:t[N],issues:[]},i);x instanceof Promise?e.push(x.then(a=>et(a,r,N,t,P))):et(x,r,N,t,P)}return d.length&&r.issues.push({code:"unrecognized_keys",keys:d,input:t,inst:p}),e.length?Promise.all(e).then(()=>r):r}o(Oo,"handleCatchall");var zr=I("$ZodObject",(e,t)=>{if(Z.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let f=t.shape;Object.defineProperty(t,"shape",{get:o(()=>{let h={...f};return Object.defineProperty(t,"shape",{value:h}),h},"get")})}let i=Ke(()=>ko(t));V(e._zod,"propValues",()=>{let f=t.shape,h={};for(let v in f){let P=f[v]._zod;if(P.values){h[v]??(h[v]=new Set);for(let N of P.values)h[v].add(N)}}return h});let s=be,p=t.catchall,d;e._zod.parse=(f,h)=>{d??(d=i.value);let v=f.value;if(!s(v))return f.issues.push({expected:"object",code:"invalid_type",input:v,inst:e}),f;f.value={};let P=[],N=d.shape;for(let x of d.keys){let a=N[x],c=a._zod.optout==="optional",g=a._zod.run({value:v[x],issues:[]},h);g instanceof Promise?P.push(g.then(l=>et(l,f,x,v,c))):et(g,f,x,v,c)}return p?Oo(P,v,f,h,i.value,e):P.length?Promise.all(P).then(()=>f):f}});function yr(e,t,r,i){for(let p of e)if(p.issues.length===0)return t.value=p.value,t;let s=e.filter(p=>!ye(p));return s.length===1?(t.value=s[0].value,s[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(p=>p.issues.map(d=>ae(d,i,Y())))}),t)}o(yr,"handleUnionResults");var Pt=I("$ZodUnion",(e,t)=>{Z.init(e,t),V(e._zod,"optin",()=>t.options.some(s=>s._zod.optin==="optional")?"optional":void 0),V(e._zod,"optout",()=>t.options.some(s=>s._zod.optout==="optional")?"optional":void 0),V(e._zod,"values",()=>{if(t.options.every(s=>s._zod.values))return new Set(t.options.flatMap(s=>Array.from(s._zod.values)))}),V(e._zod,"pattern",()=>{if(t.options.every(s=>s._zod.pattern)){let s=t.options.map(p=>p._zod.pattern);return new RegExp(`^(${s.map(p=>Je(p.source)).join("|")})$`)}});let r=t.options.length===1,i=t.options[0]._zod.run;e._zod.parse=(s,p)=>{if(r)return i(s,p);let d=!1,f=[];for(let h of t.options){let v=h._zod.run({value:s.value,issues:[]},p);if(v instanceof Promise)f.push(v),d=!0;else{if(v.issues.length===0)return v;f.push(v)}}return d?Promise.all(f).then(h=>yr(h,s,e,p)):yr(f,s,e,p)}});var Sr=I("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Pt.init(e,t);let r=e._zod.parse;V(e._zod,"propValues",()=>{let s={};for(let p of t.options){let d=p._zod.propValues;if(!d||Object.keys(d).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(p)}"`);for(let[f,h]of Object.entries(d)){s[f]||(s[f]=new Set);for(let v of h)s[f].add(v)}}return s});let i=Ke(()=>{let s=t.options,p=new Map;for(let d of s){let f=d._zod.propValues?.[t.discriminator];if(!f||f.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(d)}"`);for(let h of f){if(p.has(h))throw new Error(`Duplicate discriminator value "${String(h)}"`);p.set(h,d)}}return p});e._zod.parse=(s,p)=>{let d=s.value;if(!be(d))return s.issues.push({code:"invalid_type",expected:"object",input:d,inst:e}),s;let f=i.value.get(d?.[t.discriminator]);return f?f._zod.run(s,p):t.unionFallback?r(s,p):(s.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:d,path:[t.discriminator],inst:e}),s)}});var Ar=I("$ZodRecord",(e,t)=>{Z.init(e,t),e._zod.parse=(r,i)=>{let s=r.value;if(!rr(s))return r.issues.push({expected:"record",code:"invalid_type",input:s,inst:e}),r;let p=[],d=t.keyType._zod.values;if(d){r.value={};let f=new Set;for(let v of d)if(typeof v=="string"||typeof v=="number"||typeof v=="symbol"){f.add(typeof v=="number"?v.toString():v);let P=t.valueType._zod.run({value:s[v],issues:[]},i);P instanceof Promise?p.push(P.then(N=>{N.issues.length&&r.issues.push(...ie(v,N.issues)),r.value[v]=N.value})):(P.issues.length&&r.issues.push(...ie(v,P.issues)),r.value[v]=P.value)}let h;for(let v in s)f.has(v)||(h=h??[],h.push(v));h&&h.length>0&&r.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:h})}else{r.value={};for(let f of Reflect.ownKeys(s)){if(f==="__proto__")continue;let h=t.keyType._zod.run({value:f,issues:[]},i);if(h instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof f=="string"&&ht.test(f)&&h.issues.length){let N=t.keyType._zod.run({value:Number(f),issues:[]},i);if(N instanceof Promise)throw new Error("Async schemas not supported in object keys currently");N.issues.length===0&&(h=N)}if(h.issues.length){t.mode==="loose"?r.value[f]=s[f]:r.issues.push({code:"invalid_key",origin:"record",issues:h.issues.map(N=>ae(N,i,Y())),input:f,path:[f],inst:e});continue}let P=t.valueType._zod.run({value:s[f],issues:[]},i);P instanceof Promise?p.push(P.then(N=>{N.issues.length&&r.issues.push(...ie(f,N.issues)),r.value[h.value]=N.value})):(P.issues.length&&r.issues.push(...ie(f,P.issues)),r.value[h.value]=P.value)}}return p.length?Promise.all(p).then(()=>r):r}});var kr=I("$ZodEnum",(e,t)=>{Z.init(e,t);let r=ft(t.entries),i=new Set(r);e._zod.values=i,e._zod.pattern=new RegExp(`^(${r.filter(s=>nr.has(typeof s)).map(s=>typeof s=="string"?ge(s):s.toString()).join("|")})$`),e._zod.parse=(s,p)=>{let d=s.value;return i.has(d)||s.issues.push({code:"invalid_value",values:r,input:d,inst:e}),s}}),Or=I("$ZodLiteral",(e,t)=>{if(Z.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map(i=>typeof i=="string"?ge(i):i?ge(i.toString()):String(i)).join("|")})$`),e._zod.parse=(i,s)=>{let p=i.value;return r.has(p)||i.issues.push({code:"invalid_value",values:t.values,input:p,inst:e}),i}});var wr=I("$ZodTransform",(e,t)=>{Z.init(e,t),e._zod.parse=(r,i)=>{if(i.direction==="backward")throw new Ge(e.constructor.name);let s=t.transform(r.value,r);if(i.async)return(s instanceof Promise?s:Promise.resolve(s)).then(d=>(r.value=d,r));if(s instanceof Promise)throw new X;return r.value=s,r}});function hr(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}o(hr,"handleOptionalResult");var Rr=I("$ZodOptional",(e,t)=>{Z.init(e,t),e._zod.optin="optional",e._zod.optout="optional",V(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),V(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Je(r.source)})?$`):void 0}),e._zod.parse=(r,i)=>{if(t.innerType._zod.optin==="optional"){let s=t.innerType._zod.run(r,i);return s instanceof Promise?s.then(p=>hr(p,r.value)):hr(s,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,i)}});var Dr=I("$ZodNullable",(e,t)=>{Z.init(e,t),V(e._zod,"optin",()=>t.innerType._zod.optin),V(e._zod,"optout",()=>t.innerType._zod.optout),V(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Je(r.source)}|null)$`):void 0}),V(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,i)=>r.value===null?r:t.innerType._zod.run(r,i)});var Nr=I("$ZodPipe",(e,t)=>{Z.init(e,t),V(e._zod,"values",()=>t.in._zod.values),V(e._zod,"optin",()=>t.in._zod.optin),V(e._zod,"optout",()=>t.out._zod.optout),V(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,i)=>{if(i.direction==="backward"){let p=t.out._zod.run(r,i);return p instanceof Promise?p.then(d=>Qe(d,t.in,i)):Qe(p,t.in,i)}let s=t.in._zod.run(r,i);return s instanceof Promise?s.then(p=>Qe(p,t.out,i)):Qe(s,t.out,i)}});function Qe(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}o(Qe,"handlePipeResult");var Cr=I("$ZodCustom",(e,t)=>{he.init(e,t),Z.init(e,t),e._zod.parse=(r,i)=>r,e._zod.check=r=>{let i=r.value,s=t.fn(i);if(s instanceof Promise)return s.then(p=>vr(p,r,i,e));vr(s,r,i,e)}});function vr(e,t,r,i){if(!e){let s={code:"custom",input:r,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(s.params=i._zod.def.params),t.issues.push(yt(s))}}o(vr,"handleRefineResult");var Mr,No=Symbol("ZodOutput"),Co=Symbol("ZodInput"),It=class{static{o(this,"$ZodRegistry")}constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let i=r[0];return this._map.set(t,i),i&&typeof i=="object"&&"id"in i&&this._idmap.set(i.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let i={...this.get(r)??{}};delete i.id;let s={...i,...this._map.get(t)};return Object.keys(s).length?s:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function jr(){return new It}o(jr,"registry");(Mr=globalThis).__zod_globalRegistry??(Mr.__zod_globalRegistry=jr());var $t=globalThis.__zod_globalRegistry;function Lr(e,t){return new e({type:"string",...L(t)})}o(Lr,"_string");function Zr(e,t){return new e({type:"string",coerce:!0,...L(t)})}o(Zr,"_coercedString");function Fr(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...L(t)})}o(Fr,"_url");function Vr(e,t){return new e({type:"number",checks:[],...L(t)})}o(Vr,"_number");function Br(e,t){return new e({type:"number",coerce:!0,checks:[],...L(t)})}o(Br,"_coercedNumber");function Wr(e,t){return new e({type:"boolean",...L(t)})}o(Wr,"_boolean");function Gr(e,t){return new e({type:"boolean",coerce:!0,...L(t)})}o(Gr,"_coercedBoolean");function Hr(e,t){return new e({type:"bigint",coerce:!0,...L(t)})}o(Hr,"_coercedBigint");function Kr(e){return new e({type:"any"})}o(Kr,"_any");function Jr(e){return new e({type:"unknown"})}o(Jr,"_unknown");function Xr(e,t){return new e({type:"void",...L(t)})}o(Xr,"_void");function qr(e,t){return new e({type:"date",coerce:!0,...L(t)})}o(qr,"_coercedDate");function J(e,t){return new pr({check:"min_length",...L(t),minimum:e})}o(J,"_minLength");function se(e,t){return new dr({check:"string_format",format:"regex",...L(t),pattern:e})}o(se,"_regex");function Yr(e,t,r){let i=L(r);return i.abort??(i.abort=!0),new e({type:"custom",check:"custom",fn:t,...i})}o(Yr,"_custom");var B=I("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");Z.init(e,t),e.def=t,e.type=t.type,e.parse=(r,i)=>qe(e,r,i,{callee:e.parse}),e.safeParse=(r,i)=>ze(e,r,i),e.parseAsync=async(r,i)=>Ye(e,r,i,{callee:e.parseAsync}),e.safeParseAsync=async(r,i)=>Se(e,r,i),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]},{parent:!0}),e.with=e.check,e.clone=(r,i)=>Xe(e,r,i),e.brand=()=>e,e.register=(r,i)=>(r.add(e,i),e),e.apply=r=>r(e)}),nt=I("ZodMiniString",(e,t)=>{tt.init(e,t),B.init(e,t)});function n(e){return Lr(nt,e)}o(n,"string");var Qr=I("ZodMiniStringFormat",(e,t)=>{xt.init(e,t),nt.init(e,t)});var Go=I("ZodMiniURL",(e,t)=>{xr.init(e,t),Qr.init(e,t)});function en(e){return Fr(Go,e)}o(en,"url");var Tt=I("ZodMiniNumber",(e,t)=>{_r.init(e,t),B.init(e,t)});function W(e){return Vr(Tt,e)}o(W,"number");var bt=I("ZodMiniBoolean",(e,t)=>{_t.init(e,t),B.init(e,t)});function U(e){return Wr(bt,e)}o(U,"boolean");var tn=I("ZodMiniBigInt",(e,t)=>{Pr.init(e,t),B.init(e,t)});var Ho=I("ZodMiniAny",(e,t)=>{Ir.init(e,t),B.init(e,t)});function ke(){return Kr(Ho)}o(ke,"any");var Ko=I("ZodMiniUnknown",(e,t)=>{$r.init(e,t),B.init(e,t)});function S(){return Jr(Ko)}o(S,"unknown");var Jo=I("ZodMiniVoid",(e,t)=>{Tr.init(e,t),B.init(e,t)});function rn(e){return Xr(Jo,e)}o(rn,"_void");var nn=I("ZodMiniDate",(e,t)=>{br.init(e,t),B.init(e,t)});var Xo=I("ZodMiniArray",(e,t)=>{Er.init(e,t),B.init(e,t)});function O(e,t){return new Xo({type:"array",element:e,...L(t)})}o(O,"array");var qo=I("ZodMiniObject",(e,t)=>{zr.init(e,t),B.init(e,t),V(e,"shape",()=>t.shape)});function u(e,t){let r={type:"object",shape:e??{},...L(t)};return new qo(r)}o(u,"object");var Yo=I("ZodMiniUnion",(e,t)=>{Pt.init(e,t),B.init(e,t)});function w(e,t){return new Yo({type:"union",options:e,...L(t)})}o(w,"union");var Qo=I("ZodMiniDiscriminatedUnion",(e,t)=>{Sr.init(e,t),B.init(e,t)});function ve(e,t,r){return new Qo({type:"union",options:t,discriminator:e,...L(r)})}o(ve,"discriminatedUnion");var ei=I("ZodMiniRecord",(e,t)=>{Ar.init(e,t),B.init(e,t)});function A(e,t,r){return new ei({type:"record",keyType:e,valueType:t,...L(r)})}o(A,"record");var ti=I("ZodMiniEnum",(e,t)=>{kr.init(e,t),B.init(e,t),e.options=Object.values(t.entries)});function D(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(i=>[i,i])):e;return new ti({type:"enum",entries:r,...L(t)})}o(D,"_enum");var ri=I("ZodMiniLiteral",(e,t)=>{Or.init(e,t),B.init(e,t)});function T(e,t){return new ri({type:"literal",values:Array.isArray(e)?e:[e],...L(t)})}o(T,"literal");var ni=I("ZodMiniTransform",(e,t)=>{wr.init(e,t),B.init(e,t)});function ue(e){return new ni({type:"transform",transform:e})}o(ue,"transform");var oi=I("ZodMiniOptional",(e,t)=>{Rr.init(e,t),B.init(e,t)});function m(e){return new oi({type:"optional",innerType:e})}o(m,"optional");var ii=I("ZodMiniNullable",(e,t)=>{Dr.init(e,t),B.init(e,t)});function Oe(e){return new ii({type:"nullable",innerType:e})}o(Oe,"nullable");var ai=I("ZodMiniPipe",(e,t)=>{Nr.init(e,t),B.init(e,t)});function ce(e,t){return new ai({type:"pipe",in:e,out:t})}o(ce,"pipe");var si=I("ZodMiniCustom",(e,t)=>{Cr.init(e,t),B.init(e,t)});function ot(e,t){return Yr(si,e??(()=>!0),t)}o(ot,"custom");var we={};qt(we,{bigint:()=>fi,boolean:()=>mi,date:()=>gi,number:()=>di,string:()=>pi});function pi(e){return Zr(nt,e)}o(pi,"string");function di(e){return Br(Tt,e)}o(di,"number");function mi(e){return Gr(bt,e)}o(mi,"boolean");function fi(e){return Hr(tn,e)}o(fi,"bigint");function gi(e){return qr(nn,e)}o(gi,"date");var zt=u({retryOnFailure:u({defaultValue:m(U()),hide:m(U())}),continueOnFailure:u({defaultValue:m(U()),hide:m(U())})}),Et=class{constructor(t,r,i,s,p,d,f,h,v,P,N){this.name=t;this.displayName=r;this.description=i;this.props=s;this.run=p;this.test=d;this.requireAuth=f;this.errorHandlingOptions=h;this.outputSchema=v;this.audience=P;this.aiMetadata=N}static{o(this,"IAction")}},an=o(e=>new Et(e.name,e.displayName,e.description,e.props,e.run,e.test??e.run,e.requireAuth??!0,e.errorHandlingOptions??{continueOnFailure:{defaultValue:!1},retryOnFailure:{defaultValue:!1}},e.outputSchema,e.audience,e.aiMetadata),"createAction");var C=u({displayName:n(),description:m(n())}),R=o((e,t)=>u({type:T(t),required:U(),defaultValue:m(ke())}),"TPropertyValue");var G=u({...C.shape,...R(n(),"SHORT_TEXT").shape}),Q=u({...C.shape,...R(n(),"LONG_TEXT").shape});var sn=u({label:n(),value:S()}),it=u({disabled:m(U()),placeholder:m(n()),options:O(sn)});var H=u({...C.shape,options:it,...R(S(),"STATIC_DROPDOWN").shape}),ee=u({...C.shape,options:it,...R(O(S()),"STATIC_MULTI_SELECT_DROPDOWN").shape});var St=u({...C.shape,...R(S(),"DROPDOWN").shape,refreshers:O(n())}),Re=u({...C.shape,...R(O(S()),"MULTI_SELECT_DROPDOWN").shape,refreshers:O(n())});var te=u({...C.shape,...R(U(),"CHECKBOX").shape});var re=u({...C.shape,...R(W(),"NUMBER").shape});var De=u({...C.shape,...R(S(),"FILE").shape});var Ne=u({...C.shape,...R(n(),"DATE_TIME").shape});var un=A(n(),w([G,Q,H,Re,ee,te,re,De,Ne])),Ce=u({...C.shape,properties:un,...R(O(S()),"ARRAY").shape});var Ue=u({...C.shape,...R(w([A(n(),S())]),"JSON").shape});var cn=w([G,H,Ue,Ce,ee]),hi=A(n(),cn),At=u({refreshers:O(n()),...C.shape,...R(S(),"DYNAMIC").shape});var at=u({...C.shape,...R(rn(),"MARKDOWN").shape});var Me=(r=>(r.ARCHIVE="ARCHIVE",r.REGISTRY="REGISTRY",r))(Me||{}),xe=(r=>(r.CUSTOM="CUSTOM",r.OFFICIAL="OFFICIAL",r))(xe||{}),_e=(y=>(y.ARTIFICIAL_INTELLIGENCE="ARTIFICIAL_INTELLIGENCE",y.COMMUNICATION="COMMUNICATION",y.COMMERCE="COMMERCE",y.CORE="CORE",y.UNIVERSAL_AI="UNIVERSAL_AI",y.FLOW_CONTROL="FLOW_CONTROL",y.BUSINESS_INTELLIGENCE="BUSINESS_INTELLIGENCE",y.ACCOUNTING="ACCOUNTING",y.PRODUCTIVITY="PRODUCTIVITY",y.CONTENT_AND_FILES="CONTENT_AND_FILES",y.DEVELOPER_TOOLS="DEVELOPER_TOOLS",y.CUSTOMER_SUPPORT="CUSTOMER_SUPPORT",y.FORMS_AND_SURVEYS="FORMS_AND_SURVEYS",y.HUMAN_RESOURCES="HUMAN_RESOURCES",y.PAYMENT_PROCESSING="PAYMENT_PROCESSING",y.MARKETING="MARKETING",y.SALES_AND_CRM="SALES_AND_CRM",y))(_e||{});var je=(r=>(r.AUTHORIZATION_CODE="authorization_code",r.CLIENT_CREDENTIALS="client_credentials",r))(je||{}),kt="both_client_credentials_and_authorization_code";var pe=(s=>(s.POLLING="POLLING",s.WEBHOOK="WEBHOOK",s.APP_WEBHOOK="APP_WEBHOOK",s.MANUAL="MANUAL",s))(pe||{}),Le=(p=>(p.NONE="NONE",p.HEADER_PRESENT="HEADER_PRESENT",p.QUERY_PRESENT="QUERY_PRESENT",p.BODY_PARAM_PRESENT="BODY_PARAM_PRESENT",p.HEAD_REQUEST="HEAD_REQUEST",p))(Le||{}),vi=u({strategy:D(Le),paramName:m(n())}),Ze=(r=>(r.SIMULATION="SIMULATION",r.TEST_FUNCTION="TEST_FUNCTION",r))(Ze||{});var st=(r=>(r.WEBSOCKET="WEBSOCKET",r.NONE="NONE",r))(st||{}),ln=u({status:m(W()),body:m(S()),headers:m(A(n(),n()))}),pn=u({type:T("DELAY"),resumeDateTime:n(),requestIdToReply:m(n()),handlerId:m(n()),streamStepProgress:m(D(st))}),dn=u({type:T("WEBHOOK"),requestId:n(),requestIdToReply:m(n()),response:ln,handlerId:m(n()),streamStepProgress:m(D(st))}),xi=w([pn,dn]);var _i=u({body:S(),rawBody:m(S()),headers:A(n(),n()),queryParams:A(n(),n())});var Ot=We(require("crypto"),1);var Pi=128,de,Pe,Ii=o(e=>{!de||de.length<e?(de=Buffer.allocUnsafe(e*Pi),Ot.default.randomFillSync(de),Pe=0):Pe+e>de.length&&(Ot.default.randomFillSync(de),Pe=0),Pe+=e},"fillPool"),$i=o(e=>(Ii(e|=0),de.subarray(Pe-e,Pe)),"random"),Ti=o((e,t,r)=>{let i=(2<<31-Math.clz32(e.length-1|1))-1,s=Math.ceil(1.6*i*t/e.length);return(p=t)=>{let d="";for(;;){let f=r(s),h=s;for(;h--;)if(d+=e[f[h]&i]||"",d.length===p)return d}}},"customRandom"),fn=o((e,t=21)=>Ti(e,t,$i),"customAlphabet");var bi="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",gn=21,Ey=n().check(se(new RegExp(`^[0-9a-zA-Z]{${gn}}$`))),Ei=fn(bi,gn);var le=ce(ue(e=>e instanceof Date?e.toISOString():e),n()),K={id:n(),created:le,updated:le},j=o(e=>m(Oe(e)),"Nullable");function wt(e){return m(Oe(D(e)))}o(wt,"NullableEnum");var Ay=ce(ue(e=>e==="true"||e===!0?!0:e==="false"||e===!1?!1:void 0),m(U())),ut=o(e=>ce(ue(t=>Array.isArray(t)?t:t!==void 0?[t]:void 0),m(O(e))),"OptionalArrayFromQuery");var wy=A(n(),S());var Ve=(P=>(P.OPENAI="openai",P.OPENROUTER="openrouter",P.ANTHROPIC="anthropic",P.AZURE="azure",P.GOOGLE="google",P.ACTIVEPIECES="activepieces",P.CLOUDFLARE_GATEWAY="cloudflare-gateway",P.CUSTOM="custom",P.BEDROCK="bedrock",P.MISTRAL="mistral",P))(Ve||{});var By=n().check(se(/^#[0-9A-Fa-f]{6}$/));var Gy=u({filename:n(),data:S(),type:T("file"),mimetype:m(n())});var zi=We(hn());var Qy=u({...K,name:n(),permissions:O(n()),platformId:j(n()),type:n(),userCount:m(W())});var vn=(i=>(i.AGENT_DECIDE="agent-decide",i.CHOOSE_YOURSELF="choose-yourself",i.LEAVE_EMPTY="leave-empty",i))(vn||{}),Rt=(r=>(r.FILE="FILE",r.TABLE="TABLE",r))(Rt||{}),Dt=(i=>(i.SSE="sse",i.STREAMABLE_HTTP="streamable-http",i.SIMPLE_HTTP="http",i))(Dt||{});var Nt=(i=>(i.TEXT="text",i.NUMBER="number",i.BOOLEAN="boolean",i))(Nt||{});var Ct=(r=>(r.IN_PROGRESS="in-progress",r.COMPLETED="completed",r))(Ct||{});var Si=u({mode:D(vn),value:S()}),Ai=u({auth:m(n()),fields:A(n(),Si)}),ki=u({pieceName:n(),pieceVersion:n(),actionName:n(),predefinedInput:m(Ai)}),Oi=u({type:T("PIECE"),toolName:n().check(J(1)),pieceMetadata:ki}),wi=u({type:T("none")}),Ri=u({type:T("access_token"),accessToken:n()}),Di=u({type:T("api_key"),apiKey:n(),apiKeyHeader:n()}),Ni=u({type:T("headers"),headers:A(n(),n())}),Ci=ve("type",[wi,Ri,Di,Ni]),xn=u({type:T("FLOW"),toolName:n().check(J(1)),externalFlowId:n(),flowDisplayName:m(n())}),_n=u({type:T("MCP"),toolName:n().check(J(1)),serverUrl:en(),protocol:D(Dt),auth:Ci}),Pn=u({type:T("KNOWLEDGE_BASE"),toolName:n().check(J(1)),sourceType:D(Rt),sourceId:n(),sourceName:n()}),Ui=ve("type",[Oi,xn,_n,Pn]),Mi=u({displayName:n(),description:m(n()),type:D(Nt)}),In=u({type:T("MARKDOWN"),markdown:n()}),Ie={type:T("TOOL_CALL"),input:j(A(n(),S())),output:m(S()),toolName:n(),status:D(Ct),toolCallId:n(),startTime:n(),endTime:m(n())},Eh=u(Ie),$n=ve("toolCallType",[u({...Ie,toolCallType:T("PIECE"),pieceName:n(),pieceVersion:n(),actionName:n()}),u({...Ie,toolCallType:T("FLOW"),displayName:n(),externalFlowId:n()}),u({...Ie,toolCallType:T("MCP"),displayName:n(),serverUrl:n()}),u({...Ie,toolCallType:T("KNOWLEDGE_BASE"),displayName:n(),sourceType:n()}),u({...Ie,toolCallType:T("UNKNOWN"),displayName:n()})]),ji=w([In,$n]);var Ut=(r=>(r.IMAGE="image",r.TEXT="text",r))(Ut||{}),ne=u({apiKey:n()}),Li=ne,Zi=u({apiKey:n(),apiKeyHash:n()}),Fi=ne,Vi=ne,Bi=ne,Wi=ne,Gi=ne,Hi=ne,Ki=ne,Tn=u({accessKeyId:n().check(J(1)),secretAccessKey:n().check(J(1))}),Ji=u({}),Xi=u({}),qi=u({}),Yi=u({}),Qi=u({}),ea=u({}),bn=u({modelId:n(),modelName:n(),modelType:D(Ut)}),En=u({apiKeyHeader:n(),baseUrl:n(),models:O(bn),defaultHeaders:m(A(n(),n()))}),zn=u({accountId:n(),gatewayId:n(),models:O(bn),vertexProject:m(n()),vertexRegion:m(n())}),Sn=u({resourceName:n(),apiVersion:ce(ue(e=>typeof e=="string"&&e.trim().length===0?void 0:e),m(n()))}),An=u({region:n().check(J(1))}),ta=w([Li,Bi,Wi,Gi,Hi,Vi,Fi,Zi,Tn,Ki]),kn=w([En,zn,Sn,An,Ji,qi,Yi,Qi,Xi,ea]),ra=u({id:n(),name:n(),type:D(Ut)}),na=u({id:n(),name:n(),provider:D(Ve),config:kn,enabledForChat:U()}),oa=u({provider:D(Ve),config:kn,auth:ta,platformId:n()});var kh={openai:"openai",anthropic:"anthropic","google-ai-studio":"google","google-vertex-ai":"google"};var ia=u({base64Url:n(),fileName:n(),extension:m(n())}),aa=u({mimeType:n(),url:n(),fileName:m(n())}),Mt=w([ia,aa]);var sa=w([u({type:T("file"),value:Mt}),u({type:T("markdown"),value:n(),files:m(O(Mt))})]),ua=u({sessionId:n(),message:n(),files:m(O(n()))});var wn=(r=>(r.ON_NEW_RECORD="ON_NEW_RECORD",r.ON_UPDATE_RECORD="ON_UPDATE_RECORD",r))(wn||{}),Rn=(r=>(r.ENABLED="ENABLED",r.DISABLED="DISABLED",r))(Rn||{}),jt=(i=>(i.RECORD_CREATED="RECORD_CREATED",i.RECORD_UPDATED="RECORD_UPDATED",i.RECORD_DELETED="RECORD_DELETED",i))(jt||{});var ca=w([u({...K,name:n(),externalId:n(),type:T("STATIC_DROPDOWN"),tableId:n(),projectId:n(),data:u({options:O(u({value:n()}))})}),u({...K,name:n(),externalId:n(),type:w([T("TEXT"),T("NUMBER"),T("DATE")]),tableId:n(),projectId:n()})]),la=u({...K,name:n(),folderId:j(n()),projectId:n(),externalId:n(),status:wt(Rn),trigger:wt(wn)}),pa=u({...K,tableId:n(),projectId:n(),cells:A(n(),u({updated:n(),created:n(),value:S(),fieldName:n()}))}),da=u({events:O(D(jt)),webhookUrl:n(),flowId:n()}),ma=u({fields:O(u({id:n(),name:n()})),rows:O(A(n(),n())),name:n()}),fa=u({projectId:n(),limit:m(we.number()),cursor:m(n()),name:m(n()),externalIds:ut(n()),folderId:m(n()),folderIds:ut(n())}),ga=u({records:O(O(u({fieldId:n(),value:Nn()}))),tableId:n()}),ya=u({cells:m(O(u({fieldId:n(),value:Nn()}))),tableId:n(),agentUpdate:m(U())}),Dn=ve("operator",[me("eq"),me("neq"),me("gt"),me("gte"),me("lt"),me("lte"),me("co"),On("exists"),On("not_exists")]),ha=u({tableId:n(),limit:m(we.number()),cursor:m(n()),filters:ut(Dn)});function Nn(){return ce(ue(e=>e==null?e:String(e)),Oe(n()))}o(Nn,"coerceToString");function me(e){return u({fieldId:n(),operator:T(e),value:n()})}o(me,"valueFilter");function On(e){return u({fieldId:n(),operator:T(e)})}o(On,"existenceFilter");var va=u({status:m(W()),body:m(S()),headers:m(A(n(),n()))}),xa=u({...K,deleted:j(le),ownerId:n(),displayName:n(),platformId:n(),externalId:j(n())});var Cn=u({name:n(),description:m(n()),type:n(),required:U()}),_a=u({pieceName:n(),triggerName:n(),input:u({toolName:n(),toolDescription:n(),inputSchema:O(Cn),returnsResponse:U()})});var Un="^[0-9]+\\.[0-9]+\\.[0-9]+$",Jh=new RegExp(Un),Ia="^([~^])?[0-9]+\\.[0-9]+\\.[0-9]+$",Xh=n().check(se(new RegExp(Un))),qh=n().check(se(new RegExp(Ia))),$a=u({packageType:T("ARCHIVE"),pieceType:D(xe),pieceName:n(),pieceVersion:n(),archiveId:n(),platformId:n()}),Mn=u({packageType:T("REGISTRY"),pieceType:T("OFFICIAL"),pieceName:n(),pieceVersion:n()}),jn=u({packageType:T("REGISTRY"),pieceType:T("CUSTOM"),pieceName:n(),pieceVersion:n(),platformId:n()}),Yh=w([Mn,jn]),Qh=w([$a,Mn,jn]),Ln=(t=>(t.CRON_EXPRESSION="CRON_EXPRESSION",t))(Ln||{}),Ta=u({type:D(Ln),cronExpression:n(),timezone:n()}),ev=u({...K,type:D(pe),projectId:n(),flowId:n(),triggerName:n(),schedule:j(Ta),flowVersionId:n(),pieceName:n(),pieceVersion:n(),deleted:j(n()),simulate:U()}),Zn=(l=>(l.UNKNOWN="UNKNOWN",l.FLOW_RUN_LOG="FLOW_RUN_LOG",l.FLOW_RUN_LOG_SLICE="FLOW_RUN_LOG_SLICE",l.PACKAGE_ARCHIVE="PACKAGE_ARCHIVE",l.FLOW_STEP_FILE="FLOW_STEP_FILE",l.SAMPLE_DATA="SAMPLE_DATA",l.TRIGGER_PAYLOAD="TRIGGER_PAYLOAD",l.SAMPLE_DATA_INPUT="SAMPLE_DATA_INPUT",l.TRIGGER_EVENT_FILE="TRIGGER_EVENT_FILE",l.PROJECT_RELEASE="PROJECT_RELEASE",l.FLOW_VERSION_BACKUP="FLOW_VERSION_BACKUP",l.PLATFORM_ASSET="PLATFORM_ASSET",l.USER_PROFILE_PICTURE="USER_PROFILE_PICTURE",l.WEBHOOK_PAYLOAD="WEBHOOK_PAYLOAD",l.KNOWLEDGE_BASE="KNOWLEDGE_BASE",l.FLOW_BUNDLE="FLOW_BUNDLE",l))(Zn||{}),Fn=(r=>(r.NONE="NONE",r.ZSTD="ZSTD",r))(Fn||{}),Vn=(r=>(r.S3="S3",r.DB="DB",r))(Vn||{}),tv=u({...K,projectId:j(n()),platformId:j(n()),type:D(Zn),compression:D(Fn),data:m(S()),location:D(Vn),size:j(W()),fileName:j(n()),s3Key:j(n()),metadata:j(A(n(),n()))}),Bn=(i=>(i.ADMIN="ADMIN",i.MEMBER="MEMBER",i.OPERATOR="OPERATOR",i))(Bn||{}),Wn=(r=>(r.ACTIVE="ACTIVE",r.INACTIVE="INACTIVE",r))(Wn||{}),rv=u({id:n(),email:n(),firstName:n(),status:D(Wn),externalId:j(n()),platformId:j(n()),platformRole:D(Bn),lastName:n(),created:le,updated:le,lastActiveDate:j(le),imageUrl:j(n())});var Lt=u({...C.shape,...R(A(n(),S()),"OBJECT").shape});var Jn=u({...C.shape,...R(n(),"COLOR").shape});var Zt=w([G,Q,at,te,H,ee,St,Re,At,re,Ce,Lt,Ue,Ne,De,Jn]),oe={ShortText(e){return{...e,valueSchema:void 0,type:"SHORT_TEXT"}},Checkbox(e){return{...e,valueSchema:void 0,type:"CHECKBOX"}},LongText(e){return{...e,valueSchema:void 0,type:"LONG_TEXT"}},MarkDown(e){return{displayName:"Markdown",required:!1,description:e.value,type:"MARKDOWN",valueSchema:void 0,variant:e.variant??"INFO"}},Number(e){return{...e,valueSchema:void 0,type:"NUMBER"}},Json(e){return{...e,valueSchema:void 0,type:"JSON"}},Array(e){return{...e,valueSchema:void 0,type:"ARRAY"}},Object(e){return{...e,valueSchema:void 0,type:"OBJECT"}},Dropdown(e){return{...e,valueSchema:void 0,type:"DROPDOWN"}},StaticDropdown(e){return{...e,valueSchema:void 0,type:"STATIC_DROPDOWN"}},MultiSelectDropdown(e){return{...e,valueSchema:void 0,type:"MULTI_SELECT_DROPDOWN"}},DynamicProperties(e){return{...e,valueSchema:void 0,type:"DYNAMIC"}},StaticMultiSelectDropdown(e){return{...e,valueSchema:void 0,type:"STATIC_MULTI_SELECT_DROPDOWN"}},DateTime(e){return{...e,valueSchema:void 0,type:"DATE_TIME"}},File(e){return{...e,valueSchema:void 0,type:"FILE"}},Custom(e){let t=e.code.toString();return{...e,code:t,valueSchema:void 0,type:"CUSTOM"}},Color(e){return{...e,valueSchema:void 0,type:"COLOR"}}};var q=u({displayName:n(),description:m(n())});var Xn=u({username:n(),password:n()}),Ft=u({...q.shape,username:u({displayName:n(),description:m(n())}),password:u({displayName:n(),description:m(n())}),...R(Xn,"BASIC_AUTH").shape});var Sa=A(n(),w([G,Q,re,te,H])),Vt=u({...q.shape,props:Sa,...R(S(),"CUSTOM_AUTH").shape});var fe=u({...q.shape,...R(u({auth:n()}),"SECRET_TEXT").shape});var Aa=A(n(),w([G,Q,fe,re,te,H,ee,at])),qn=u({...q.shape,props:Aa,...R(S(),"OIDC").shape});var Bt=(r=>(r.HEADER="HEADER",r.BODY="BODY",r))(Bt||{}),Yn=w([G,fe,H]),Qn=A(n(),Yn),ka=u({props:m(A(n(),Yn)),authUrl:n(),tokenUrl:n(),scope:O(n()),prompt:m(w([T("none"),T("consent"),T("login"),T("omit")])),pkce:m(U()),pkceMethod:m(w([T("plain"),T("S256")])),authorizationMethod:m(D(Bt)),grantType:m(w([D(je),T(kt)])),extra:m(A(n(),n()))}),eo=u({access_token:n(),props:m(Qn),data:A(n(),ke())}),Wt=u({...q.shape,...ka.shape,...R(eo,"OAUTH2").shape});var $e=w([Ft,Vt,qn,Wt,fe]),Be="Connection",Gt={SecretText(e){return{...e,valueSchema:void 0,type:"SECRET_TEXT"}},OAuth2(e){return{...e,valueSchema:void 0,type:"OAUTH2",displayName:e.displayName||Be}},BasicAuth(e){return{...e,valueSchema:void 0,type:"BASIC_AUTH",displayName:e.displayName||Be,required:!0}},CustomAuth(e){return{...e,valueSchema:void 0,type:"CUSTOM_AUTH",displayName:e.displayName||Be}},OIDC(e){return{...e,valueSchema:void 0,type:"OIDC",displayName:e.displayName||Be}},None(){}};var Dx={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 Oa=u({...C.shape,...R(S(),"CUSTOM").shape,code:n()});var Ra=w([Zt,$e]),Ht=A(n(),Ra),e_=A(n(),Zt);var to=w([u({strategy:T("CRON"),cronExpression:n()}),u({strategy:T("NONE")})]);var ro="2",lt="0.82.0";var Kt=class{constructor(t,r,i,s,p,d,f,h,v=lt,P,N=""){this.displayName=t;this.logoUrl=r;this.authors=i;this.events=s;this.categories=f;this.auth=h;this.minimumSupportedRelease=v;this.maximumSupportedRelease=P;this.description=N;this._actions={};this._triggers={};this.getContextInfo=o(()=>({version:ro}),"getContextInfo");(!Da(v)||Na(v,lt))&&(this.minimumSupportedRelease=lt),p.forEach(x=>this._actions[x.name]=x),d.forEach(x=>this._triggers[x.name]=x)}static{o(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,contextInfo:this.getContextInfo?.()}}getAction(t){return this._actions[t]}getTrigger(t){return this._triggers[t]}actions(){return this._actions}triggers(){return this._triggers}},no=o(e=>{if(e.auth&&Array.isArray(e.auth)&&!e.auth.every((r,i,s)=>i===s.findIndex(p=>p.type===r.type)))throw new Error("Auth properties must be unique by type");return new Kt(e.displayName,e.logoUrl,e.authors??[],e.events,e.actions,e.triggers,e.categories??[],e.auth,e.minimumSupportedRelease,e.maximumSupportedRelease,e.description)},"createPiece");function Da(e){return/^\d+\.\d+\.\d+$/.test(e)}o(Da,"isValidSimpleSemver");function Na(e,t){let[r,i,s]=e.split(".").map(Number),[p,d,f]=t.split(".").map(Number);return r!==p?r<p:i!==d?i<d:s<f}o(Na,"isSemverLessThan");var Ca=m(A(n(),A(n(),n()))),oo=u({id:m(n()),name:n(),displayName:n(),logoUrl:n(),description:n(),authors:O(n()),platformId:m(n()),directoryPath:m(n()),auth:m(w([$e,O($e)])),version:n(),categories:m(O(D(_e))),minimumSupportedRelease:m(n()),maximumSupportedRelease:m(n()),i18n:Ca}),Ua=D(["human","ai","both"]),io=u({description:m(n()),idempotent:m(U())}),ao=u({name:n(),displayName:n(),description:n(),props:Ht,requireAuth:U(),errorHandlingOptions:m(zt),outputSchema:m(ot()),audience:m(Ua),aiMetadata:m(io)}),so=u({name:n(),displayName:n(),description:n(),props:Ht,errorHandlingOptions:m(zt),type:D(pe),sampleData:S(),handshakeConfiguration:m(ot()),renewConfiguration:m(to),testStrategy:D(Ze),outputSchema:m(ot()),aiMetadata:m(io)}),Ma=u({...oo.shape,actions:A(n(),ao),triggers:A(n(),so)}),ja=u({...oo.shape,actions:W(),triggers:W(),suggestedActions:m(O(so)),suggestedTriggers:m(O(ao))}),uo=u({projectUsage:W(),tags:m(O(n())),pieceType:D(xe),packageType:D(Me),platformId:m(n()),archiveId:m(n())}),eP=u({...Ma.shape,...uo.shape}),tP=u({...ja.shape,...uo.shape}),rP=u({name:n(),version:n()});var La=We(require("path")),Za=We(require("fs/promises"));var co=require("@duckdb/node-api"),lo=an({name:"createAndQueryDB",displayName:"Create and Query DB",description:"Create DB from data and run query",audience:"both",aiMetadata:{description:"Spins up a throwaway in-memory DuckDB, loads one or more tables from supplied JSON arrays (column names taken from object keys; schema can be given explicitly or autodetected), then runs a SQL query against them and returns the rows. Use to run SQL joins, aggregations, or transforms over JSON data you already have in the flow, without any external database. Use parameterized placeholders ($1, $2, ...) with the args list rather than interpolating values into the query string. Read-only with respect to external systems: the database exists only for this call, so repeating with the same input yields the same result.",idempotent:!0},props:{markdown:oe.MarkDown({value:`
|
|
2
|
-
**DO NOT** insert dynamic input directly into the query string. Instead, use $1, $2, $3 and add them in args for parameterized queries to prevent **SQL injection.**`}),tables:
|
|
1
|
+
"use strict";var $o=Object.create;var be=Object.defineProperty;var Eo=Object.getOwnPropertyDescriptor;var bo=Object.getOwnPropertyNames;var So=Object.getPrototypeOf,zo=Object.prototype.hasOwnProperty;var o=(e,t)=>be(e,"name",{value:t,configurable:!0});var Ao=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},er=(e,t)=>{for(var r in t)be(e,r,{get:t[r],enumerable:!0})},tr=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of bo(t))!zo.call(e,s)&&s!==r&&be(e,s,{get:()=>t[s],enumerable:!(i=Eo(t,s))||i.enumerable});return e};var We=(e,t,r)=>(r=e!=null?$o(So(e)):{},tr(t||!e||!e.__esModule?be(r,"default",{value:e,enumerable:!0}):r,e)),Oo=e=>tr(be({},"__esModule",{value:!0}),e);var bn=Ao((En,dt)=>{(function(e){"use strict";let t="(0?\\d+|0x[a-f0-9]+)",r={fourOctet:new RegExp(`^${t}\\.${t}\\.${t}\\.${t}$`,"i"),threeOctet:new RegExp(`^${t}\\.${t}\\.${t}$`,"i"),twoOctet:new RegExp(`^${t}\\.${t}$`,"i"),longValue:new RegExp(`^${t}$`,"i")},i=new RegExp("^0[0-7]+$","i"),s=new RegExp("^0x[a-f0-9]+$","i"),l="%[0-9a-z]{1,}",d="(?:[0-9a-f]+::?)+",m={zoneIndex:new RegExp(l,"i"),native:new RegExp(`^(::)?(${d})?([0-9a-f]+)?(::)?(${l})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${t}\\.${t}\\.${t}\\.${t}(${l})?)$`,"i"),transitional:new RegExp(`^((?:${d})|(?:::)(?:${d})?)${t}\\.${t}\\.${t}\\.${t}(${l})?$`,"i")};function h(a,c){if(a.indexOf("::")!==a.lastIndexOf("::"))return null;let g=0,p=-1,y=(a.match(m.zoneIndex)||[])[0],x,M;for(y&&(y=y.substring(1),a=a.replace(/%.+$/,""));(p=a.indexOf(":",p+1))>=0;)g++;if(a.substr(0,2)==="::"&&g--,a.substr(-2,2)==="::"&&g--,g>c)return null;for(M=c-g,x=":";M--;)x+="0:";return a=a.replace("::",x),a[0]===":"&&(a=a.slice(1)),a[a.length-1]===":"&&(a=a.slice(0,-1)),c=(function(){let Yt=a.split(":"),Qt=[];for(let ft=0;ft<Yt.length;ft++)Qt.push(parseInt(Yt[ft],16));return Qt})(),{parts:c,zoneId:y}}o(h,"expandIPv6");function v(a,c,g,p){if(a.length!==c.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let y=0,x;for(;p>0;){if(x=g-p,x<0&&(x=0),a[y]>>x!==c[y]>>x)return!1;p-=g,y+=1}return!0}o(v,"matchCIDR");function P(a){if(s.test(a))return parseInt(a,16);if(a[0]==="0"&&!isNaN(parseInt(a[1],10))){if(i.test(a))return parseInt(a,8);throw new Error(`ipaddr: cannot parse ${a} as octal`)}return parseInt(a,10)}o(P,"parseIntAuto");function N(a,c){for(;a.length<c;)a=`0${a}`;return a}o(N,"padPart");let _={};_.IPv4=(function(){function a(c){if(c.length!==4)throw new Error("ipaddr: ipv4 octet count should be 4");let g,p;for(g=0;g<c.length;g++)if(p=c[g],!(0<=p&&p<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=c}return o(a,"IPv4"),a.prototype.SpecialRanges={unspecified:[[new a([0,0,0,0]),8]],broadcast:[[new a([255,255,255,255]),32]],multicast:[[new a([224,0,0,0]),4]],linkLocal:[[new a([169,254,0,0]),16]],loopback:[[new a([127,0,0,0]),8]],carrierGradeNat:[[new a([100,64,0,0]),10]],private:[[new a([10,0,0,0]),8],[new a([172,16,0,0]),12],[new a([192,168,0,0]),16]],reserved:[[new a([192,0,0,0]),24],[new a([192,0,2,0]),24],[new a([192,88,99,0]),24],[new a([198,18,0,0]),15],[new a([198,51,100,0]),24],[new a([203,0,113,0]),24],[new a([240,0,0,0]),4]],as112:[[new a([192,175,48,0]),24],[new a([192,31,196,0]),24]],amt:[[new a([192,52,193,0]),24]]},a.prototype.kind=function(){return"ipv4"},a.prototype.match=function(c,g){let p;if(g===void 0&&(p=c,c=p[0],g=p[1]),c.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return v(this.octets,c.octets,8,g)},a.prototype.prefixLengthFromSubnetMask=function(){let c=0,g=!1,p={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0},y,x,M;for(y=3;y>=0;y-=1)if(x=this.octets[y],x in p){if(M=p[x],g&&M!==0)return null;M!==8&&(g=!0),c+=M}else return null;return 32-c},a.prototype.range=function(){return _.subnetMatch(this,this.SpecialRanges)},a.prototype.toByteArray=function(){return this.octets.slice(0)},a.prototype.toIPv4MappedAddress=function(){return _.IPv6.parse(`::ffff:${this.toString()}`)},a.prototype.toNormalizedString=function(){return this.toString()},a.prototype.toString=function(){return this.octets.join(".")},a})(),_.IPv4.broadcastAddressFromCIDR=function(a){try{let c=this.parseCIDR(a),g=c[0].toByteArray(),p=this.subnetMaskFromPrefixLength(c[1]).toByteArray(),y=[],x=0;for(;x<4;)y.push(parseInt(g[x],10)|parseInt(p[x],10)^255),x++;return new this(y)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},_.IPv4.isIPv4=function(a){return this.parser(a)!==null},_.IPv4.isValid=function(a){try{return new this(this.parser(a)),!0}catch{return!1}},_.IPv4.isValidCIDR=function(a){try{return this.parseCIDR(a),!0}catch{return!1}},_.IPv4.isValidFourPartDecimal=function(a){return!!(_.IPv4.isValid(a)&&a.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},_.IPv4.isValidCIDRFourPartDecimal=function(a){let c=a.match(/^(.+)\/(\d+)$/);return!_.IPv4.isValidCIDR(a)||!c?!1:_.IPv4.isValidFourPartDecimal(c[1])},_.IPv4.networkAddressFromCIDR=function(a){let c,g,p,y,x;try{for(c=this.parseCIDR(a),p=c[0].toByteArray(),x=this.subnetMaskFromPrefixLength(c[1]).toByteArray(),y=[],g=0;g<4;)y.push(parseInt(p[g],10)&parseInt(x[g],10)),g++;return new this(y)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},_.IPv4.parse=function(a){let c=this.parser(a);if(c===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(c)},_.IPv4.parseCIDR=function(a){let c;if(c=a.match(/^(.+)\/(\d+)$/)){let g=parseInt(c[2]);if(g>=0&&g<=32){let p=[this.parse(c[1]),g];return Object.defineProperty(p,"toString",{value:o(function(){return this.join("/")},"value")}),p}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},_.IPv4.parser=function(a){let c,g,p;if(c=a.match(r.fourOctet))return(function(){let y=c.slice(1,6),x=[];for(let M=0;M<y.length;M++)g=y[M],x.push(P(g));return x})();if(c=a.match(r.longValue)){if(p=P(c[1]),p>4294967295||p<0)throw new Error("ipaddr: address outside defined range");return(function(){let y=[],x;for(x=0;x<=24;x+=8)y.push(p>>x&255);return y})().reverse()}else return(c=a.match(r.twoOctet))?(function(){let y=c.slice(1,4),x=[];if(p=P(y[1]),p>16777215||p<0)throw new Error("ipaddr: address outside defined range");return x.push(P(y[0])),x.push(p>>16&255),x.push(p>>8&255),x.push(p&255),x})():(c=a.match(r.threeOctet))?(function(){let y=c.slice(1,5),x=[];if(p=P(y[2]),p>65535||p<0)throw new Error("ipaddr: address outside defined range");return x.push(P(y[0])),x.push(P(y[1])),x.push(p>>8&255),x.push(p&255),x})():null},_.IPv4.subnetMaskFromPrefixLength=function(a){if(a=parseInt(a),a<0||a>32)throw new Error("ipaddr: invalid IPv4 prefix length");let c=[0,0,0,0],g=0,p=Math.floor(a/8);for(;g<p;)c[g]=255,g++;return p<4&&(c[p]=Math.pow(2,a%8)-1<<8-a%8),new this(c)},_.IPv6=(function(){function a(c,g){let p,y;if(c.length===16)for(this.parts=[],p=0;p<=14;p+=2)this.parts.push(c[p]<<8|c[p+1]);else if(c.length===8)this.parts=c;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(p=0;p<this.parts.length;p++)if(y=this.parts[p],!(0<=y&&y<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");g&&(this.zoneId=g)}return o(a,"IPv6"),a.prototype.SpecialRanges={unspecified:[new a([0,0,0,0,0,0,0,0]),128],linkLocal:[new a([65152,0,0,0,0,0,0,0]),10],multicast:[new a([65280,0,0,0,0,0,0,0]),8],loopback:[new a([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new a([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new a([0,0,0,0,0,65535,0,0]),96],discard:[new a([256,0,0,0,0,0,0,0]),64],rfc6145:[new a([0,0,0,0,65535,0,0,0]),96],rfc6052:[new a([100,65435,0,0,0,0,0,0]),96],"6to4":[new a([8194,0,0,0,0,0,0,0]),16],teredo:[new a([8193,0,0,0,0,0,0,0]),32],benchmarking:[new a([8193,2,0,0,0,0,0,0]),48],amt:[new a([8193,3,0,0,0,0,0,0]),32],as112v6:[[new a([8193,4,274,0,0,0,0,0]),48],[new a([9760,79,32768,0,0,0,0,0]),48]],deprecated:[new a([8193,16,0,0,0,0,0,0]),28],orchid2:[new a([8193,32,0,0,0,0,0,0]),28],droneRemoteIdProtocolEntityTags:[new a([8193,48,0,0,0,0,0,0]),28],reserved:[[new a([8193,0,0,0,0,0,0,0]),23],[new a([8193,3512,0,0,0,0,0,0]),32]]},a.prototype.isIPv4MappedAddress=function(){return this.range()==="ipv4Mapped"},a.prototype.kind=function(){return"ipv6"},a.prototype.match=function(c,g){let p;if(g===void 0&&(p=c,c=p[0],g=p[1]),c.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return v(this.parts,c.parts,16,g)},a.prototype.prefixLengthFromSubnetMask=function(){let c=0,g=!1,p={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0},y,x;for(let M=7;M>=0;M-=1)if(y=this.parts[M],y in p){if(x=p[y],g&&x!==0)return null;x!==16&&(g=!0),c+=x}else return null;return 128-c},a.prototype.range=function(){return _.subnetMatch(this,this.SpecialRanges)},a.prototype.toByteArray=function(){let c,g=[],p=this.parts;for(let y=0;y<p.length;y++)c=p[y],g.push(c>>8),g.push(c&255);return g},a.prototype.toFixedLengthString=function(){let c=(function(){let p=[];for(let y=0;y<this.parts.length;y++)p.push(N(this.parts[y].toString(16),4));return p}).call(this).join(":"),g="";return this.zoneId&&(g=`%${this.zoneId}`),c+g},a.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");let c=this.parts.slice(-2),g=c[0],p=c[1];return new _.IPv4([g>>8,g&255,p>>8,p&255])},a.prototype.toNormalizedString=function(){let c=(function(){let p=[];for(let y=0;y<this.parts.length;y++)p.push(this.parts[y].toString(16));return p}).call(this).join(":"),g="";return this.zoneId&&(g=`%${this.zoneId}`),c+g},a.prototype.toRFC5952String=function(){let c=/((^|:)(0(:|$)){2,})/g,g=this.toNormalizedString(),p=0,y=-1,x;for(;x=c.exec(g);)x[0].length>y&&(p=x.index,y=x[0].length);return y<0?g:`${g.substring(0,p)}::${g.substring(p+y)}`},a.prototype.toString=function(){return this.toRFC5952String()},a})(),_.IPv6.broadcastAddressFromCIDR=function(a){try{let c=this.parseCIDR(a),g=c[0].toByteArray(),p=this.subnetMaskFromPrefixLength(c[1]).toByteArray(),y=[],x=0;for(;x<16;)y.push(parseInt(g[x],10)|parseInt(p[x],10)^255),x++;return new this(y)}catch(c){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${c})`)}},_.IPv6.isIPv6=function(a){return this.parser(a)!==null},_.IPv6.isValid=function(a){if(typeof a=="string"&&a.indexOf(":")===-1)return!1;try{let c=this.parser(a);return new this(c.parts,c.zoneId),!0}catch{return!1}},_.IPv6.isValidCIDR=function(a){if(typeof a=="string"&&a.indexOf(":")===-1)return!1;try{return this.parseCIDR(a),!0}catch{return!1}},_.IPv6.networkAddressFromCIDR=function(a){let c,g,p,y,x;try{for(c=this.parseCIDR(a),p=c[0].toByteArray(),x=this.subnetMaskFromPrefixLength(c[1]).toByteArray(),y=[],g=0;g<16;)y.push(parseInt(p[g],10)&parseInt(x[g],10)),g++;return new this(y)}catch(M){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${M})`)}},_.IPv6.parse=function(a){let c=this.parser(a);if(c.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(c.parts,c.zoneId)},_.IPv6.parseCIDR=function(a){let c,g,p;if((g=a.match(/^(.+)\/(\d+)$/))&&(c=parseInt(g[2]),c>=0&&c<=128))return p=[this.parse(g[1]),c],Object.defineProperty(p,"toString",{value:o(function(){return this.join("/")},"value")}),p;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},_.IPv6.parser=function(a){let c,g,p,y,x,M;if(p=a.match(m.deprecatedTransitional))return this.parser(`::ffff:${p[1]}`);if(m.native.test(a))return h(a,8);if((p=a.match(m.transitional))&&(M=p[6]||"",c=p[1],p[1].endsWith("::")||(c=c.slice(0,-1)),c=h(c+M,6),c.parts)){for(x=[parseInt(p[2]),parseInt(p[3]),parseInt(p[4]),parseInt(p[5])],g=0;g<x.length;g++)if(y=x[g],!(0<=y&&y<=255))return null;return c.parts.push(x[0]<<8|x[1]),c.parts.push(x[2]<<8|x[3]),{parts:c.parts,zoneId:c.zoneId}}return null},_.IPv6.subnetMaskFromPrefixLength=function(a){if(a=parseInt(a),a<0||a>128)throw new Error("ipaddr: invalid IPv6 prefix length");let c=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],g=0,p=Math.floor(a/8);for(;g<p;)c[g]=255,g++;return p<16&&(c[p]=Math.pow(2,a%8)-1<<8-a%8),new this(c)},_.fromByteArray=function(a){let c=a.length;if(c===4)return new _.IPv4(a);if(c===16)return new _.IPv6(a);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},_.isValid=function(a){return _.IPv6.isValid(a)||_.IPv4.isValid(a)},_.isValidCIDR=function(a){return _.IPv6.isValidCIDR(a)||_.IPv4.isValidCIDR(a)},_.parse=function(a){if(_.IPv6.isValid(a))return _.IPv6.parse(a);if(_.IPv4.isValid(a))return _.IPv4.parse(a);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},_.parseCIDR=function(a){try{return _.IPv6.parseCIDR(a)}catch{try{return _.IPv4.parseCIDR(a)}catch{throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},_.process=function(a){let c=this.parse(a);return c.kind()==="ipv6"&&c.isIPv4MappedAddress()?c.toIPv4Address():c},_.subnetMatch=function(a,c,g){let p,y,x,M;g==null&&(g="unicast");for(y in c)if(Object.prototype.hasOwnProperty.call(c,y)){for(x=c[y],x[0]&&!(x[0]instanceof Array)&&(x=[x]),p=0;p<x.length;p++)if(M=x[p],a.kind()===M[0].kind()&&a.match.apply(a,M))return y}return g},typeof dt<"u"&&dt.exports?dt.exports=_:e.ipaddr=_})(En)});var ss={};er(ss,{duckdb:()=>as});module.exports=Oo(ss);var ko=Object.freeze({status:"aborted"});function I(e,t,r){function i(m,h){if(m._zod||Object.defineProperty(m,"_zod",{value:{def:h,constr:d,traits:new Set},enumerable:!1}),m._zod.traits.has(e))return;m._zod.traits.add(e),t(m,h);let v=d.prototype,P=Object.keys(v);for(let N=0;N<P.length;N++){let _=P[N];_ in m||(m[_]=v[_].bind(m))}}o(i,"init");let s=r?.Parent??Object;class l extends s{static{o(this,"Definition")}}Object.defineProperty(l,"name",{value:e});function d(m){var h;let v=r?.Parent?new l:this;i(v,m),(h=v._zod).deferred??(h.deferred=[]);for(let P of v._zod.deferred)P();return v}return o(d,"_"),Object.defineProperty(d,"init",{value:i}),Object.defineProperty(d,Symbol.hasInstance,{value:o(m=>r?.Parent&&m instanceof r.Parent?!0:m?._zod?.traits?.has(e),"value")}),Object.defineProperty(d,"name",{value:e}),d}o(I,"$constructor");var X=class extends Error{static{o(this,"$ZodAsyncError")}constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},He=class extends Error{static{o(this,"$ZodEncodeError")}constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}},gt={};function Q(e){return e&&Object.assign(gt,e),gt}o(Q,"config");function ht(e){let t=Object.values(e).filter(i=>typeof i=="number");return Object.entries(e).filter(([i,s])=>t.indexOf(+i)===-1).map(([i,s])=>s)}o(ht,"getEnumValues");function nr(e,t){return typeof t=="bigint"?t.toString():t}o(nr,"jsonStringifyReplacer");function Je(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}o(Je,"cached");function or(e){return e==null}o(or,"nullish");function Xe(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}o(Xe,"cleanRegex");var rr=Symbol("evaluating");function V(e,t,r){let i;Object.defineProperty(e,t,{get(){if(i!==rr)return i===void 0&&(i=rr,i=r()),i},set(s){Object.defineProperty(e,t,{value:s})},configurable:!0})}o(V,"defineLazy");var vt="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Se(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}o(Se,"isObject");var Ro=Je(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function ir(e){if(Se(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(Se(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}o(ir,"isPlainObject");var ar=new Set(["string","number","symbol"]);function xe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}o(xe,"escapeRegex");function qe(e,t,r){let i=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(i._zod.parent=e),i}o(qe,"clone");function L(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:o(()=>t,"error")};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:o(()=>t.error,"error")}:t}o(L,"normalizeParams");function sr(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}o(sr,"optionalKeys");var ur={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 _e(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}o(_e,"aborted");function ae(e,t){return t.map(r=>{var i;return(i=r).path??(i.path=[]),r.path.unshift(e),r})}o(ae,"prefixIssues");function Ke(e){return typeof e=="string"?e:e?.message}o(Ke,"unwrapMessage");function se(e,t,r){let i={...e,path:e.path??[]};if(!e.message){let s=Ke(e.inst?._zod.def?.error?.(e))??Ke(t?.error?.(e))??Ke(r.customError?.(e))??Ke(r.localeError?.(e))??"Invalid input";i.message=s}return delete i.inst,delete i.continue,t?.reportInput||delete i.input,i}o(se,"finalizeIssue");function cr(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}o(cr,"getLengthableOrigin");function xt(...e){let[t,r,i]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:i}:{...t}}o(xt,"issue");var lr=o((e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,nr,2),Object.defineProperty(e,"toString",{value:o(()=>e.message,"value"),enumerable:!1})},"initializer"),pr=I("$ZodError",lr),ze=I("$ZodError",lr,{Parent:Error});var Do=o(e=>(t,r,i,s)=>{let l=i?Object.assign(i,{async:!1}):{async:!1},d=t._zod.run({value:r,issues:[]},l);if(d instanceof Promise)throw new X;if(d.issues.length){let m=new(s?.Err??e)(d.issues.map(h=>se(h,l,Q())));throw vt(m,s?.callee),m}return d.value},"_parse"),Ye=Do(ze),No=o(e=>async(t,r,i,s)=>{let l=i?Object.assign(i,{async:!0}):{async:!0},d=t._zod.run({value:r,issues:[]},l);if(d instanceof Promise&&(d=await d),d.issues.length){let m=new(s?.Err??e)(d.issues.map(h=>se(h,l,Q())));throw vt(m,s?.callee),m}return d.value},"_parseAsync"),Qe=No(ze),Co=o(e=>(t,r,i)=>{let s=i?{...i,async:!1}:{async:!1},l=t._zod.run({value:r,issues:[]},s);if(l instanceof Promise)throw new X;return l.issues.length?{success:!1,error:new(e??pr)(l.issues.map(d=>se(d,s,Q())))}:{success:!0,data:l.value}},"_safeParse"),Ae=Co(ze),Uo=o(e=>async(t,r,i)=>{let s=i?Object.assign(i,{async:!0}):{async:!0},l=t._zod.run({value:r,issues:[]},s);return l instanceof Promise&&(l=await l),l.issues.length?{success:!1,error:new e(l.issues.map(d=>se(d,s,Q())))}:{success:!0,data:l.value}},"_safeParseAsync"),Oe=Uo(ze);var Mo="(?:(?:\\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])))",Lo=new RegExp(`^${Mo}$`);var dr=o(e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},"string"),mr=/^-?\d+n?$/,fr=/^-?\d+$/,_t=/^-?\d+(?:\.\d+)?$/,gr=/^(?:true|false)$/i;var ue=I("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),jo={number:"number",bigint:"bigint",object:"date"};var yr=I("$ZodCheckGreaterThan",(e,t)=>{ue.init(e,t);let r=jo[typeof t.value];e._zod.onattach.push(i=>{let s=i._zod.bag,l=(t.inclusive?s.minimum:s.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>l&&(t.inclusive?s.minimum=t.value:s.exclusiveMinimum=t.value)}),e._zod.check=i=>{(t.inclusive?i.value>=t.value:i.value>t.value)||i.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}});var hr=I("$ZodCheckNumberFormat",(e,t)=>{ue.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),i=r?"int":"number",[s,l]=ur[t.format];e._zod.onattach.push(d=>{let m=d._zod.bag;m.format=t.format,m.minimum=s,m.maximum=l,r&&(m.pattern=fr)}),e._zod.check=d=>{let m=d.value;if(r){if(!Number.isInteger(m)){d.issues.push({expected:i,format:t.format,code:"invalid_type",continue:!1,input:m,inst:e});return}if(!Number.isSafeInteger(m)){m>0?d.issues.push({input:m,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,inclusive:!0,continue:!t.abort}):d.issues.push({input:m,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,inclusive:!0,continue:!t.abort});return}}m<s&&d.issues.push({origin:"number",input:m,code:"too_small",minimum:s,inclusive:!0,inst:e,continue:!t.abort}),m>l&&d.issues.push({origin:"number",input:m,code:"too_big",maximum:l,inclusive:!0,inst:e,continue:!t.abort})}});var vr=I("$ZodCheckMinLength",(e,t)=>{var r;ue.init(e,t),(r=e._zod.def).when??(r.when=i=>{let s=i.value;return!or(s)&&s.length!==void 0}),e._zod.onattach.push(i=>{let s=i._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>s&&(i._zod.bag.minimum=t.minimum)}),e._zod.check=i=>{let s=i.value;if(s.length>=t.minimum)return;let d=cr(s);i.issues.push({origin:d,code:"too_small",minimum:t.minimum,inclusive:!0,input:s,inst:e,continue:!t.abort})}});var Pt=I("$ZodCheckStringFormat",(e,t)=>{var r,i;ue.init(e,t),e._zod.onattach.push(s=>{let l=s._zod.bag;l.format=t.format,t.pattern&&(l.patterns??(l.patterns=new Set),l.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=s=>{t.pattern.lastIndex=0,!t.pattern.test(s.value)&&s.issues.push({origin:"string",code:"invalid_format",format:t.format,input:s.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(i=e._zod).check??(i.check=()=>{})}),xr=I("$ZodCheckRegex",(e,t)=>{Pt.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}});var Pr={major:4,minor:3,patch:6};var Z=I("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Pr;let i=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&i.unshift(e);for(let s of i)for(let l of s._zod.onattach)l(e);if(i.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let s=o((d,m,h)=>{let v=_e(d),P;for(let N of m){if(N._zod.def.when){if(!N._zod.def.when(d))continue}else if(v)continue;let _=d.issues.length,a=N._zod.check(d);if(a instanceof Promise&&h?.async===!1)throw new X;if(P||a instanceof Promise)P=(P??Promise.resolve()).then(async()=>{await a,d.issues.length!==_&&(v||(v=_e(d,_)))});else{if(d.issues.length===_)continue;v||(v=_e(d,_))}}return P?P.then(()=>d):d},"runChecks"),l=o((d,m,h)=>{if(_e(d))return d.aborted=!0,d;let v=s(m,i,h);if(v instanceof Promise){if(h.async===!1)throw new X;return v.then(P=>e._zod.parse(P,h))}return e._zod.parse(v,h)},"handleCanaryResult");e._zod.run=(d,m)=>{if(m.skipChecks)return e._zod.parse(d,m);if(m.direction==="backward"){let v=e._zod.parse({value:d.value,issues:[]},{...m,skipChecks:!0});return v instanceof Promise?v.then(P=>l(P,d,m)):l(v,d,m)}let h=e._zod.parse(d,m);if(h instanceof Promise){if(m.async===!1)throw new X;return h.then(v=>s(v,i,m))}return s(h,i,m)}}V(e,"~standard",()=>({validate:o(s=>{try{let l=Ae(e,s);return l.success?{value:l.data}:{issues:l.error?.issues}}catch{return Oe(e,s).then(d=>d.success?{value:d.data}:{issues:d.error?.issues})}},"validate"),vendor:"zod",version:1}))}),rt=I("$ZodString",(e,t)=>{Z.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??dr(e._zod.bag),e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),It=I("$ZodStringFormat",(e,t)=>{Pt.init(e,t),rt.init(e,t)});var br=I("$ZodURL",(e,t)=>{It.init(e,t),e._zod.check=r=>{try{let i=r.value.trim(),s=new URL(i);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(s.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(s.protocol.endsWith(":")?s.protocol.slice(0,-1):s.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=s.href:r.value=i;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}});var Tt=I("$ZodNumber",(e,t)=>{Z.init(e,t),e._zod.pattern=e._zod.bag.pattern??_t,e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let s=r.value;if(typeof s=="number"&&!Number.isNaN(s)&&Number.isFinite(s))return r;let l=typeof s=="number"?Number.isNaN(s)?"NaN":Number.isFinite(s)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:s,inst:e,...l?{received:l}:{}}),r}}),Sr=I("$ZodNumberFormat",(e,t)=>{hr.init(e,t),Tt.init(e,t)}),$t=I("$ZodBoolean",(e,t)=>{Z.init(e,t),e._zod.pattern=gr,e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=!!r.value}catch{}let s=r.value;return typeof s=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:s,inst:e}),r}}),zr=I("$ZodBigInt",(e,t)=>{Z.init(e,t),e._zod.pattern=mr,e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}});var Ar=I("$ZodAny",(e,t)=>{Z.init(e,t),e._zod.parse=r=>r}),Or=I("$ZodUnknown",(e,t)=>{Z.init(e,t),e._zod.parse=r=>r});var kr=I("$ZodVoid",(e,t)=>{Z.init(e,t),e._zod.parse=(r,i)=>{let s=r.value;return typeof s>"u"||r.issues.push({expected:"void",code:"invalid_type",input:s,inst:e}),r}}),Rr=I("$ZodDate",(e,t)=>{Z.init(e,t),e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let s=r.value,l=s instanceof Date;return l&&!Number.isNaN(s.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:s,...l?{received:"Invalid Date"}:{},inst:e}),r}});function Ir(e,t,r){e.issues.length&&t.issues.push(...ae(r,e.issues)),t.value[r]=e.value}o(Ir,"handleArrayResult");var wr=I("$ZodArray",(e,t)=>{Z.init(e,t),e._zod.parse=(r,i)=>{let s=r.value;if(!Array.isArray(s))return r.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),r;r.value=Array(s.length);let l=[];for(let d=0;d<s.length;d++){let m=s[d],h=t.element._zod.run({value:m,issues:[]},i);h instanceof Promise?l.push(h.then(v=>Ir(v,r,d))):Ir(h,r,d)}return l.length?Promise.all(l).then(()=>r):r}});function tt(e,t,r,i,s){if(e.issues.length){if(s&&!(r in i))return;t.issues.push(...ae(r,e.issues))}e.value===void 0?r in i&&(t.value[r]=void 0):t.value[r]=e.value}o(tt,"handlePropertyResult");function Zo(e){let t=Object.keys(e.shape);for(let i of t)if(!e.shape?.[i]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${i}": expected a Zod schema`);let r=sr(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}o(Zo,"normalizeDef");function Fo(e,t,r,i,s,l){let d=[],m=s.keySet,h=s.catchall._zod,v=h.def.type,P=h.optout==="optional";for(let N in t){if(m.has(N))continue;if(v==="never"){d.push(N);continue}let _=h.run({value:t[N],issues:[]},i);_ instanceof Promise?e.push(_.then(a=>tt(a,r,N,t,P))):tt(_,r,N,t,P)}return d.length&&r.issues.push({code:"unrecognized_keys",keys:d,input:t,inst:l}),e.length?Promise.all(e).then(()=>r):r}o(Fo,"handleCatchall");var Dr=I("$ZodObject",(e,t)=>{if(Z.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let m=t.shape;Object.defineProperty(t,"shape",{get:o(()=>{let h={...m};return Object.defineProperty(t,"shape",{value:h}),h},"get")})}let i=Je(()=>Zo(t));V(e._zod,"propValues",()=>{let m=t.shape,h={};for(let v in m){let P=m[v]._zod;if(P.values){h[v]??(h[v]=new Set);for(let N of P.values)h[v].add(N)}}return h});let s=Se,l=t.catchall,d;e._zod.parse=(m,h)=>{d??(d=i.value);let v=m.value;if(!s(v))return m.issues.push({expected:"object",code:"invalid_type",input:v,inst:e}),m;m.value={};let P=[],N=d.shape;for(let _ of d.keys){let a=N[_],c=a._zod.optout==="optional",g=a._zod.run({value:v[_],issues:[]},h);g instanceof Promise?P.push(g.then(p=>tt(p,m,_,v,c))):tt(g,m,_,v,c)}return l?Fo(P,v,m,h,i.value,e):P.length?Promise.all(P).then(()=>m):m}});function Tr(e,t,r,i){for(let l of e)if(l.issues.length===0)return t.value=l.value,t;let s=e.filter(l=>!_e(l));return s.length===1?(t.value=s[0].value,s[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(l=>l.issues.map(d=>se(d,i,Q())))}),t)}o(Tr,"handleUnionResults");var Et=I("$ZodUnion",(e,t)=>{Z.init(e,t),V(e._zod,"optin",()=>t.options.some(s=>s._zod.optin==="optional")?"optional":void 0),V(e._zod,"optout",()=>t.options.some(s=>s._zod.optout==="optional")?"optional":void 0),V(e._zod,"values",()=>{if(t.options.every(s=>s._zod.values))return new Set(t.options.flatMap(s=>Array.from(s._zod.values)))}),V(e._zod,"pattern",()=>{if(t.options.every(s=>s._zod.pattern)){let s=t.options.map(l=>l._zod.pattern);return new RegExp(`^(${s.map(l=>Xe(l.source)).join("|")})$`)}});let r=t.options.length===1,i=t.options[0]._zod.run;e._zod.parse=(s,l)=>{if(r)return i(s,l);let d=!1,m=[];for(let h of t.options){let v=h._zod.run({value:s.value,issues:[]},l);if(v instanceof Promise)m.push(v),d=!0;else{if(v.issues.length===0)return v;m.push(v)}}return d?Promise.all(m).then(h=>Tr(h,s,e,l)):Tr(m,s,e,l)}});var Nr=I("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Et.init(e,t);let r=e._zod.parse;V(e._zod,"propValues",()=>{let s={};for(let l of t.options){let d=l._zod.propValues;if(!d||Object.keys(d).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(l)}"`);for(let[m,h]of Object.entries(d)){s[m]||(s[m]=new Set);for(let v of h)s[m].add(v)}}return s});let i=Je(()=>{let s=t.options,l=new Map;for(let d of s){let m=d._zod.propValues?.[t.discriminator];if(!m||m.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(d)}"`);for(let h of m){if(l.has(h))throw new Error(`Duplicate discriminator value "${String(h)}"`);l.set(h,d)}}return l});e._zod.parse=(s,l)=>{let d=s.value;if(!Se(d))return s.issues.push({code:"invalid_type",expected:"object",input:d,inst:e}),s;let m=i.value.get(d?.[t.discriminator]);return m?m._zod.run(s,l):t.unionFallback?r(s,l):(s.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:d,path:[t.discriminator],inst:e}),s)}});var Cr=I("$ZodRecord",(e,t)=>{Z.init(e,t),e._zod.parse=(r,i)=>{let s=r.value;if(!ir(s))return r.issues.push({expected:"record",code:"invalid_type",input:s,inst:e}),r;let l=[],d=t.keyType._zod.values;if(d){r.value={};let m=new Set;for(let v of d)if(typeof v=="string"||typeof v=="number"||typeof v=="symbol"){m.add(typeof v=="number"?v.toString():v);let P=t.valueType._zod.run({value:s[v],issues:[]},i);P instanceof Promise?l.push(P.then(N=>{N.issues.length&&r.issues.push(...ae(v,N.issues)),r.value[v]=N.value})):(P.issues.length&&r.issues.push(...ae(v,P.issues)),r.value[v]=P.value)}let h;for(let v in s)m.has(v)||(h=h??[],h.push(v));h&&h.length>0&&r.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:h})}else{r.value={};for(let m of Reflect.ownKeys(s)){if(m==="__proto__")continue;let h=t.keyType._zod.run({value:m,issues:[]},i);if(h instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof m=="string"&&_t.test(m)&&h.issues.length){let N=t.keyType._zod.run({value:Number(m),issues:[]},i);if(N instanceof Promise)throw new Error("Async schemas not supported in object keys currently");N.issues.length===0&&(h=N)}if(h.issues.length){t.mode==="loose"?r.value[m]=s[m]:r.issues.push({code:"invalid_key",origin:"record",issues:h.issues.map(N=>se(N,i,Q())),input:m,path:[m],inst:e});continue}let P=t.valueType._zod.run({value:s[m],issues:[]},i);P instanceof Promise?l.push(P.then(N=>{N.issues.length&&r.issues.push(...ae(m,N.issues)),r.value[h.value]=N.value})):(P.issues.length&&r.issues.push(...ae(m,P.issues)),r.value[h.value]=P.value)}}return l.length?Promise.all(l).then(()=>r):r}});var Ur=I("$ZodEnum",(e,t)=>{Z.init(e,t);let r=ht(t.entries),i=new Set(r);e._zod.values=i,e._zod.pattern=new RegExp(`^(${r.filter(s=>ar.has(typeof s)).map(s=>typeof s=="string"?xe(s):s.toString()).join("|")})$`),e._zod.parse=(s,l)=>{let d=s.value;return i.has(d)||s.issues.push({code:"invalid_value",values:r,input:d,inst:e}),s}}),Mr=I("$ZodLiteral",(e,t)=>{if(Z.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map(i=>typeof i=="string"?xe(i):i?xe(i.toString()):String(i)).join("|")})$`),e._zod.parse=(i,s)=>{let l=i.value;return r.has(l)||i.issues.push({code:"invalid_value",values:t.values,input:l,inst:e}),i}});var Lr=I("$ZodTransform",(e,t)=>{Z.init(e,t),e._zod.parse=(r,i)=>{if(i.direction==="backward")throw new He(e.constructor.name);let s=t.transform(r.value,r);if(i.async)return(s instanceof Promise?s:Promise.resolve(s)).then(d=>(r.value=d,r));if(s instanceof Promise)throw new X;return r.value=s,r}});function $r(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}o($r,"handleOptionalResult");var jr=I("$ZodOptional",(e,t)=>{Z.init(e,t),e._zod.optin="optional",e._zod.optout="optional",V(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),V(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Xe(r.source)})?$`):void 0}),e._zod.parse=(r,i)=>{if(t.innerType._zod.optin==="optional"){let s=t.innerType._zod.run(r,i);return s instanceof Promise?s.then(l=>$r(l,r.value)):$r(s,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,i)}});var Zr=I("$ZodNullable",(e,t)=>{Z.init(e,t),V(e._zod,"optin",()=>t.innerType._zod.optin),V(e._zod,"optout",()=>t.innerType._zod.optout),V(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Xe(r.source)}|null)$`):void 0}),V(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,i)=>r.value===null?r:t.innerType._zod.run(r,i)});var Fr=I("$ZodPipe",(e,t)=>{Z.init(e,t),V(e._zod,"values",()=>t.in._zod.values),V(e._zod,"optin",()=>t.in._zod.optin),V(e._zod,"optout",()=>t.out._zod.optout),V(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,i)=>{if(i.direction==="backward"){let l=t.out._zod.run(r,i);return l instanceof Promise?l.then(d=>et(d,t.in,i)):et(l,t.in,i)}let s=t.in._zod.run(r,i);return s instanceof Promise?s.then(l=>et(l,t.out,i)):et(s,t.out,i)}});function et(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}o(et,"handlePipeResult");var Vr=I("$ZodCustom",(e,t)=>{ue.init(e,t),Z.init(e,t),e._zod.parse=(r,i)=>r,e._zod.check=r=>{let i=r.value,s=t.fn(i);if(s instanceof Promise)return s.then(l=>Er(l,r,i,e));Er(s,r,i,e)}});function Er(e,t,r,i){if(!e){let s={code:"custom",input:r,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(s.params=i._zod.def.params),t.issues.push(xt(s))}}o(Er,"handleRefineResult");var Gr;var bt=class{static{o(this,"$ZodRegistry")}constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let i=r[0];return this._map.set(t,i),i&&typeof i=="object"&&"id"in i&&this._idmap.set(i.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let i={...this.get(r)??{}};delete i.id;let s={...i,...this._map.get(t)};return Object.keys(s).length?s:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function Wr(){return new bt}o(Wr,"registry");(Gr=globalThis).__zod_globalRegistry??(Gr.__zod_globalRegistry=Wr());var St=globalThis.__zod_globalRegistry;function Hr(e,t){return new e({type:"string",...L(t)})}o(Hr,"_string");function Kr(e,t){return new e({type:"string",coerce:!0,...L(t)})}o(Kr,"_coercedString");function Jr(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...L(t)})}o(Jr,"_url");function Xr(e,t){return new e({type:"number",checks:[],...L(t)})}o(Xr,"_number");function qr(e,t){return new e({type:"number",coerce:!0,checks:[],...L(t)})}o(qr,"_coercedNumber");function Yr(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...L(t)})}o(Yr,"_int");function Qr(e,t){return new e({type:"boolean",...L(t)})}o(Qr,"_boolean");function en(e,t){return new e({type:"boolean",coerce:!0,...L(t)})}o(en,"_coercedBoolean");function tn(e,t){return new e({type:"bigint",coerce:!0,...L(t)})}o(tn,"_coercedBigint");function rn(e){return new e({type:"any"})}o(rn,"_any");function nn(e){return new e({type:"unknown"})}o(nn,"_unknown");function on(e,t){return new e({type:"void",...L(t)})}o(on,"_void");function an(e,t){return new e({type:"date",coerce:!0,...L(t)})}o(an,"_coercedDate");function nt(e,t){return new yr({check:"greater_than",...L(t),value:e,inclusive:!0})}o(nt,"_gte");function J(e,t){return new vr({check:"min_length",...L(t),minimum:e})}o(J,"_minLength");function ce(e,t){return new xr({check:"string_format",format:"regex",...L(t),pattern:e})}o(ce,"_regex");function sn(e,t,r){let i=L(r);return i.abort??(i.abort=!0),new e({type:"custom",check:"custom",fn:t,...i})}o(sn,"_custom");var B=I("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");Z.init(e,t),e.def=t,e.type=t.type,e.parse=(r,i)=>Ye(e,r,i,{callee:e.parse}),e.safeParse=(r,i)=>Ae(e,r,i),e.parseAsync=async(r,i)=>Qe(e,r,i,{callee:e.parseAsync}),e.safeParseAsync=async(r,i)=>Oe(e,r,i),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]},{parent:!0}),e.with=e.check,e.clone=(r,i)=>qe(e,r,i),e.brand=()=>e,e.register=((r,i)=>(r.add(e,i),e)),e.apply=r=>r(e)}),it=I("ZodMiniString",(e,t)=>{rt.init(e,t),B.init(e,t)});function n(e){return Hr(it,e)}o(n,"string");var un=I("ZodMiniStringFormat",(e,t)=>{It.init(e,t),it.init(e,t)});var ti=I("ZodMiniURL",(e,t)=>{br.init(e,t),un.init(e,t)});function cn(e){return Jr(ti,e)}o(cn,"url");var at=I("ZodMiniNumber",(e,t)=>{Tt.init(e,t),B.init(e,t)});function G(e){return Xr(at,e)}o(G,"number");var ri=I("ZodMiniNumberFormat",(e,t)=>{Sr.init(e,t),at.init(e,t)});function ln(e){return Yr(ri,e)}o(ln,"int");var zt=I("ZodMiniBoolean",(e,t)=>{$t.init(e,t),B.init(e,t)});function U(e){return Qr(zt,e)}o(U,"boolean");var pn=I("ZodMiniBigInt",(e,t)=>{zr.init(e,t),B.init(e,t)});var ni=I("ZodMiniAny",(e,t)=>{Ar.init(e,t),B.init(e,t)});function Re(){return rn(ni)}o(Re,"any");var oi=I("ZodMiniUnknown",(e,t)=>{Or.init(e,t),B.init(e,t)});function z(){return nn(oi)}o(z,"unknown");var ii=I("ZodMiniVoid",(e,t)=>{kr.init(e,t),B.init(e,t)});function dn(e){return on(ii,e)}o(dn,"_void");var mn=I("ZodMiniDate",(e,t)=>{Rr.init(e,t),B.init(e,t)});var ai=I("ZodMiniArray",(e,t)=>{wr.init(e,t),B.init(e,t)});function k(e,t){return new ai({type:"array",element:e,...L(t)})}o(k,"array");var si=I("ZodMiniObject",(e,t)=>{Dr.init(e,t),B.init(e,t),V(e,"shape",()=>t.shape)});function u(e,t){let r={type:"object",shape:e??{},...L(t)};return new si(r)}o(u,"object");var ui=I("ZodMiniUnion",(e,t)=>{Et.init(e,t),B.init(e,t)});function R(e,t){return new ui({type:"union",options:e,...L(t)})}o(R,"union");var ci=I("ZodMiniDiscriminatedUnion",(e,t)=>{Nr.init(e,t),B.init(e,t)});function le(e,t,r){return new ci({type:"union",options:t,discriminator:e,...L(r)})}o(le,"discriminatedUnion");var li=I("ZodMiniRecord",(e,t)=>{Cr.init(e,t),B.init(e,t)});function A(e,t,r){return new li({type:"record",keyType:e,valueType:t,...L(r)})}o(A,"record");var pi=I("ZodMiniEnum",(e,t)=>{Ur.init(e,t),B.init(e,t),e.options=Object.values(t.entries)});function D(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(i=>[i,i])):e;return new pi({type:"enum",entries:r,...L(t)})}o(D,"_enum");var di=I("ZodMiniLiteral",(e,t)=>{Mr.init(e,t),B.init(e,t)});function $(e,t){return new di({type:"literal",values:Array.isArray(e)?e:[e],...L(t)})}o($,"literal");var mi=I("ZodMiniTransform",(e,t)=>{Lr.init(e,t),B.init(e,t)});function pe(e){return new mi({type:"transform",transform:e})}o(pe,"transform");var fi=I("ZodMiniOptional",(e,t)=>{jr.init(e,t),B.init(e,t)});function f(e){return new fi({type:"optional",innerType:e})}o(f,"optional");var gi=I("ZodMiniNullable",(e,t)=>{Zr.init(e,t),B.init(e,t)});function we(e){return new gi({type:"nullable",innerType:e})}o(we,"nullable");var yi=I("ZodMiniPipe",(e,t)=>{Fr.init(e,t),B.init(e,t)});function de(e,t){return new yi({type:"pipe",in:e,out:t})}o(de,"pipe");var hi=I("ZodMiniCustom",(e,t)=>{Vr.init(e,t),B.init(e,t)});function st(e,t){return sn(hi,e??(()=>!0),t)}o(st,"custom");var De={};er(De,{bigint:()=>Ti,boolean:()=>Ii,date:()=>$i,number:()=>Pi,string:()=>_i});function _i(e){return Kr(it,e)}o(_i,"string");function Pi(e){return qr(at,e)}o(Pi,"number");function Ii(e){return en(zt,e)}o(Ii,"boolean");function Ti(e){return tn(pn,e)}o(Ti,"bigint");function $i(e){return an(mn,e)}o($i,"date");var Ot=u({retryOnFailure:u({defaultValue:f(U()),hide:f(U())}),continueOnFailure:u({defaultValue:f(U()),hide:f(U())})}),At=class{constructor(t,r,i,s,l,d,m,h,v,P,N){this.name=t;this.displayName=r;this.description=i;this.props=s;this.run=l;this.test=d;this.requireAuth=m;this.errorHandlingOptions=h;this.outputSchema=v;this.audience=P;this.aiMetadata=N}static{o(this,"IAction")}},gn=o(e=>new At(e.name,e.displayName,e.description,e.props,e.run,e.test??e.run,e.requireAuth??!0,e.errorHandlingOptions??{continueOnFailure:{defaultValue:!1},retryOnFailure:{defaultValue:!1}},e.outputSchema,e.audience,e.aiMetadata),"createAction");var C=u({displayName:n(),description:f(n())}),w=o((e,t)=>u({type:$(t),required:U(),defaultValue:f(Re())}),"TPropertyValue");var W=u({...C.shape,...w(n(),"SHORT_TEXT").shape}),ee=u({...C.shape,...w(n(),"LONG_TEXT").shape});var yn=u({label:n(),value:z()}),ut=u({disabled:f(U()),placeholder:f(n()),options:k(yn)});var H=u({...C.shape,options:ut,...w(z(),"STATIC_DROPDOWN").shape}),te=u({...C.shape,options:ut,...w(k(z()),"STATIC_MULTI_SELECT_DROPDOWN").shape});var kt=u({...C.shape,...w(z(),"DROPDOWN").shape,refreshers:k(n())}),Ne=u({...C.shape,...w(k(z()),"MULTI_SELECT_DROPDOWN").shape,refreshers:k(n())});var re=u({...C.shape,...w(U(),"CHECKBOX").shape});var ne=u({...C.shape,...w(G(),"NUMBER").shape});var Ce=u({...C.shape,streaming:f(U()),...w(z(),"FILE").shape});var Ue=u({...C.shape,...w(n(),"DATE_TIME").shape});var hn=A(n(),R([W,ee,H,Ne,te,re,ne,Ce,Ue])),Me=u({...C.shape,properties:hn,...w(k(z()),"ARRAY").shape});var Le=u({...C.shape,...w(R([A(n(),z())]),"JSON").shape});var vn=R([W,H,Le,Me,te]),bi=A(n(),vn),Rt=u({refreshers:k(n()),...C.shape,...w(z(),"DYNAMIC").shape});var ct=u({...C.shape,...w(dn(),"MARKDOWN").shape});var je=(r=>(r.ARCHIVE="ARCHIVE",r.REGISTRY="REGISTRY",r))(je||{}),Pe=(r=>(r.CUSTOM="CUSTOM",r.OFFICIAL="OFFICIAL",r))(Pe||{}),Ie=(y=>(y.ARTIFICIAL_INTELLIGENCE="ARTIFICIAL_INTELLIGENCE",y.COMMUNICATION="COMMUNICATION",y.COMMERCE="COMMERCE",y.CORE="CORE",y.UNIVERSAL_AI="UNIVERSAL_AI",y.FLOW_CONTROL="FLOW_CONTROL",y.BUSINESS_INTELLIGENCE="BUSINESS_INTELLIGENCE",y.ACCOUNTING="ACCOUNTING",y.PRODUCTIVITY="PRODUCTIVITY",y.CONTENT_AND_FILES="CONTENT_AND_FILES",y.DEVELOPER_TOOLS="DEVELOPER_TOOLS",y.CUSTOMER_SUPPORT="CUSTOMER_SUPPORT",y.FORMS_AND_SURVEYS="FORMS_AND_SURVEYS",y.HUMAN_RESOURCES="HUMAN_RESOURCES",y.PAYMENT_PROCESSING="PAYMENT_PROCESSING",y.MARKETING="MARKETING",y.SALES_AND_CRM="SALES_AND_CRM",y))(Ie||{});var Ze=(r=>(r.AUTHORIZATION_CODE="authorization_code",r.CLIENT_CREDENTIALS="client_credentials",r))(Ze||{}),wt="both_client_credentials_and_authorization_code";var fe=(s=>(s.POLLING="POLLING",s.WEBHOOK="WEBHOOK",s.APP_WEBHOOK="APP_WEBHOOK",s.MANUAL="MANUAL",s))(fe||{}),Fe=(l=>(l.NONE="NONE",l.HEADER_PRESENT="HEADER_PRESENT",l.QUERY_PRESENT="QUERY_PRESENT",l.BODY_PARAM_PRESENT="BODY_PARAM_PRESENT",l.HEAD_REQUEST="HEAD_REQUEST",l))(Fe||{}),Si=u({strategy:D(Fe),paramName:f(n())}),Ve=(r=>(r.SIMULATION="SIMULATION",r.TEST_FUNCTION="TEST_FUNCTION",r))(Ve||{});var lt=(r=>(r.WEBSOCKET="WEBSOCKET",r.NONE="NONE",r))(lt||{}),xn=u({status:f(G()),body:f(z()),headers:f(A(n(),n()))}),_n=u({type:$("DELAY"),resumeDateTime:n(),requestIdToReply:f(n()),handlerId:f(n()),streamStepProgress:f(D(lt))}),Pn=u({type:$("WEBHOOK"),requestId:n(),requestIdToReply:f(n()),response:xn,handlerId:f(n()),streamStepProgress:f(D(lt))}),zi=R([_n,Pn]);var Ai=u({body:z(),rawBody:f(z()),headers:A(n(),n()),queryParams:A(n(),n())});var Dt=We(require("crypto"),1);var Oi=128,ye,Te,ki=o(e=>{!ye||ye.length<e?(ye=Buffer.allocUnsafe(e*Oi),Dt.default.randomFillSync(ye),Te=0):Te+e>ye.length&&(Dt.default.randomFillSync(ye),Te=0),Te+=e},"fillPool"),Ri=o(e=>(ki(e|=0),ye.subarray(Te-e,Te)),"random"),wi=o((e,t,r)=>{let i=(2<<31-Math.clz32(e.length-1|1))-1,s=Math.ceil(1.6*i*t/e.length);return(l=t)=>{let d="";for(;;){let m=r(s),h=s;for(;h--;)if(d+=e[m[h]&i]||"",d.length===l)return d}}},"customRandom"),Tn=o((e,t=21)=>wi(e,t,Ri),"customAlphabet");var Di="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",$n=21,Fy=n().check(ce(new RegExp(`^[0-9a-zA-Z]{${$n}}$`))),Ni=Tn(Di,$n);var me=de(pe(e=>e instanceof Date?e.toISOString():e),n()),K={id:n(),created:me,updated:me},j=o(e=>f(we(e)),"Nullable");function Nt(e){return f(we(D(e)))}o(Nt,"NullableEnum");var Gy=de(pe(e=>e==="true"||e===!0?!0:e==="false"||e===!1?!1:void 0),f(U())),pt=o(e=>de(pe(t=>Array.isArray(t)?t:t!==void 0?[t]:void 0),f(k(e))),"OptionalArrayFromQuery");var Ky=A(n(),z());var Be=(P=>(P.OPENAI="openai",P.OPENROUTER="openrouter",P.ANTHROPIC="anthropic",P.AZURE="azure",P.GOOGLE="google",P.ACTIVEPIECES="activepieces",P.CLOUDFLARE_GATEWAY="cloudflare-gateway",P.CUSTOM="custom",P.BEDROCK="bedrock",P.MISTRAL="mistral",P))(Be||{});var ah=n().check(ce(/^#[0-9A-Fa-f]{6}$/));var uh=u({filename:n(),data:z(),type:$("file"),mimetype:f(n())});var Ci=We(bn());var gh=u({...K,name:n(),permissions:k(n()),platformId:j(n()),type:n(),userCount:f(G())});var Sn=(i=>(i.AGENT_DECIDE="agent-decide",i.CHOOSE_YOURSELF="choose-yourself",i.LEAVE_EMPTY="leave-empty",i))(Sn||{}),Ct=(r=>(r.FILE="FILE",r.TABLE="TABLE",r))(Ct||{}),Ut=(i=>(i.SSE="sse",i.STREAMABLE_HTTP="streamable-http",i.SIMPLE_HTTP="http",i))(Ut||{});var Mt=(i=>(i.TEXT="text",i.NUMBER="number",i.BOOLEAN="boolean",i))(Mt||{});var Lt=(r=>(r.IN_PROGRESS="in-progress",r.COMPLETED="completed",r))(Lt||{});var Ui=u({mode:D(Sn),value:z()}),Mi=u({auth:f(n()),fields:A(n(),Ui)}),Li=u({pieceName:n(),pieceVersion:n(),actionName:n(),predefinedInput:f(Mi)}),ji=u({type:$("PIECE"),toolName:n().check(J(1)),pieceMetadata:Li}),Zi=u({type:$("none")}),Fi=u({type:$("access_token"),accessToken:n()}),Vi=u({type:$("api_key"),apiKey:n(),apiKeyHeader:n()}),Bi=u({type:$("headers"),headers:A(n(),n())}),Gi=le("type",[Zi,Fi,Vi,Bi]),zn=u({type:$("FLOW"),toolName:n().check(J(1)),externalFlowId:n(),flowDisplayName:f(n())}),An=u({type:$("MCP"),toolName:n().check(J(1)),serverUrl:cn(),protocol:D(Ut),auth:Gi}),On=u({type:$("KNOWLEDGE_BASE"),toolName:n().check(J(1)),sourceType:D(Ct),sourceId:n(),sourceName:n()}),Wi=le("type",[ji,zn,An,On]),Hi=u({displayName:n(),description:f(n()),type:D(Mt)}),kn=u({type:$("MARKDOWN"),markdown:n()}),$e={type:$("TOOL_CALL"),input:j(A(n(),z())),output:f(z()),toolName:n(),status:D(Lt),toolCallId:n(),startTime:n(),endTime:f(n())},Wh=u($e),Rn=le("toolCallType",[u({...$e,toolCallType:$("PIECE"),pieceName:n(),pieceVersion:n(),actionName:n()}),u({...$e,toolCallType:$("FLOW"),displayName:n(),externalFlowId:n()}),u({...$e,toolCallType:$("MCP"),displayName:n(),serverUrl:n()}),u({...$e,toolCallType:$("KNOWLEDGE_BASE"),displayName:n(),sourceType:n()}),u({...$e,toolCallType:$("UNKNOWN"),displayName:n()})]),Ki=R([kn,Rn]);var jt=(r=>(r.IMAGE="image",r.TEXT="text",r))(jt||{}),oe=u({apiKey:n()}),Ji=oe,Xi=u({apiKey:n(),apiKeyHash:n()}),qi=oe,Yi=oe,Qi=oe,ea=oe,ta=oe,ra=oe,na=oe,Un=u({accessKeyId:n().check(J(1)),secretAccessKey:n().check(J(1))}),oa=u({}),ia=u({}),aa=u({}),sa=u({}),ua=u({}),ca=u({}),Mn=u({modelId:n(),modelName:n(),modelType:D(jt)}),Ln=u({apiKeyHeader:n(),baseUrl:n(),models:k(Mn),defaultHeaders:f(A(n(),n()))}),jn=u({accountId:n(),gatewayId:n(),models:k(Mn),vertexProject:f(n()),vertexRegion:f(n())}),Zn=u({resourceName:n(),apiVersion:de(pe(e=>typeof e=="string"&&e.trim().length===0?void 0:e),f(n()))}),Fn=u({region:n().check(J(1))}),la=R([Ji,Qi,ea,ta,ra,Yi,qi,Xi,Un,na]),Vn=R([Ln,jn,Zn,Fn,oa,aa,sa,ua,ia,ca]),pa=u({id:n(),name:n(),type:D(jt)}),da=u({id:n(),name:n(),provider:D(Be),config:Vn,enabledForChat:U()}),ma=u({provider:D(Be),config:Vn,auth:la,platformId:n()});var Xh={openai:"openai",anthropic:"anthropic","google-ai-studio":"google","google-vertex-ai":"google"},wn=["gpt-5.5","gpt-5.4-mini","gpt-5.4-nano","gpt-4.1","gpt-4.1-mini"],fa=["claude-sonnet-4-6","claude-opus-4-7","claude-haiku-4-5"],ga=["claude-sonnet-4.6","claude-opus-4.7","claude-haiku-4.5"],Dn=["gemini-2.5-pro","gemini-2.5-flash","gemini-3.1-pro-preview","gemini-3-flash-preview"],ya=["grok-4.20","grok-4.1-fast"],ha={openai:wn,anthropic:fa,google:Dn,activepieces:[...ga.map(e=>`anthropic/${e}`),...wn.map(e=>`openai/${e}`),...Dn.map(e=>`google/${e}`),...ya.map(e=>`x-ai/${e}`)]};var Nn=128e3,va={openai:128e3,anthropic:2e5,google:1048576,bedrock:2e5,azure:128e3,openrouter:128e3,activepieces:2e5,mistral:128e3};function xa({provider:e}){return e?va[e]??Nn:Nn}o(xa,"getMaxContextTokens");var Cn={openai:"text-embedding-3-small",google:"text-embedding-004",azure:"text-embedding-3-small",activepieces:"text-embedding-3-small",openrouter:"openai/text-embedding-3-small"},_a={anthropic:"native",google:"native",openrouter:"plugin",activepieces:"plugin"},Pa=new Set(["anthropic","mistral"]);function q(e){return{chatModels:ha[e],maxContextTokens:xa({provider:e}),defaultEmbeddingModel:Cn[e],supportsEmbedding:Cn[e]!==void 0,supportsImageGeneration:!Pa.has(e),webSearch:_a[e]}}o(q,"buildProviderCapabilities");var Ia={openai:q("openai"),anthropic:q("anthropic"),openrouter:q("openrouter"),azure:q("azure"),google:q("google"),"cloudflare-gateway":q("cloudflare-gateway"),custom:q("custom"),bedrock:q("bedrock"),mistral:q("mistral"),activepieces:q("activepieces")};var Ta=u({base64Url:n(),fileName:n(),extension:f(n())}),$a=u({mimeType:n(),url:n(),fileName:f(n())}),Zt=R([Ta,$a]);var Ea=R([u({type:$("file"),value:Zt}),u({type:$("markdown"),value:n(),files:f(k(Zt))})]),ba=u({sessionId:n(),message:n(),files:f(k(n()))});var Gn=(r=>(r.ON_NEW_RECORD="ON_NEW_RECORD",r.ON_UPDATE_RECORD="ON_UPDATE_RECORD",r))(Gn||{}),Wn=(r=>(r.ENABLED="ENABLED",r.DISABLED="DISABLED",r))(Wn||{}),Ft=(i=>(i.RECORD_CREATED="RECORD_CREATED",i.RECORD_UPDATED="RECORD_UPDATED",i.RECORD_DELETED="RECORD_DELETED",i))(Ft||{});var Sa=R([u({...K,name:n(),externalId:n(),type:$("STATIC_DROPDOWN"),tableId:n(),projectId:n(),data:u({options:k(u({value:n()}))})}),u({...K,name:n(),externalId:n(),type:R([$("TEXT"),$("NUMBER"),$("DATE")]),tableId:n(),projectId:n()})]),za=u({...K,name:n(),folderId:j(n()),projectId:n(),externalId:n(),status:Nt(Wn),trigger:Nt(Gn)}),Aa=u({...K,tableId:n(),projectId:n(),cells:A(n(),u({updated:n(),created:n(),value:z(),fieldName:n()}))}),Oa=u({events:k(D(Ft)),webhookUrl:n(),flowId:n()}),ka=u({fields:k(u({id:n(),name:n()})),rows:k(A(n(),n())),name:n()}),Ra=u({projectId:n(),limit:f(De.number()),cursor:f(n()),name:f(n()),externalIds:pt(n()),folderId:f(n()),folderIds:pt(n())}),wa=u({records:k(k(u({fieldId:n(),value:Kn()}))),tableId:n()}),Da=u({cells:f(k(u({fieldId:n(),value:Kn()}))),tableId:n(),agentUpdate:f(U())}),Hn=le("operator",[he("eq"),he("neq"),he("gt"),he("gte"),he("lt"),he("lte"),he("co"),Bn("exists"),Bn("not_exists")]),Na=u({tableId:n(),limit:f(De.number()),cursor:f(n()),filters:pt(Hn)});function Kn(){return de(pe(e=>e==null?e:String(e)),we(n()))}o(Kn,"coerceToString");function he(e){return u({fieldId:n(),operator:$(e),value:n()})}o(he,"valueFilter");function Bn(e){return u({fieldId:n(),operator:$(e)})}o(Bn,"existenceFilter");var Ca=u({status:f(G()),body:f(z()),headers:f(A(n(),n()))}),Ua=u({...K,deleted:j(me),ownerId:n(),displayName:n(),platformId:n(),externalId:j(n())});var Jn=u({name:n(),description:f(n()),type:n(),required:U()}),Ma=u({pieceName:n(),triggerName:n(),input:u({toolName:n(),toolDescription:n(),inputSchema:k(Jn),returnsResponse:U()})});var Xn="^[0-9]+\\.[0-9]+\\.[0-9]+$",gv=new RegExp(Xn),ja="^([~^])?[0-9]+\\.[0-9]+\\.[0-9]+$",yv=n().check(ce(new RegExp(Xn))),hv=n().check(ce(new RegExp(ja))),Za=u({packageType:$("ARCHIVE"),pieceType:D(Pe),pieceName:n(),pieceVersion:n(),archiveId:n(),platformId:n()}),qn=u({packageType:$("REGISTRY"),pieceType:$("OFFICIAL"),pieceName:n(),pieceVersion:n()}),Yn=u({packageType:$("REGISTRY"),pieceType:$("CUSTOM"),pieceName:n(),pieceVersion:n(),platformId:n()}),vv=R([qn,Yn]),xv=R([Za,qn,Yn]);var Fa=le("type",[u({type:$("CRON_EXPRESSION"),cronExpression:n(),timezone:n()}),u({type:$("INTERVAL"),intervalMs:ln().check(nt(6e4))})]),_v=u({...K,type:D(fe),projectId:n(),flowId:n(),triggerName:n(),schedule:j(Fa),flowVersionId:n(),pieceName:n(),pieceVersion:n(),deleted:j(n()),simulate:U()}),Qn=(p=>(p.UNKNOWN="UNKNOWN",p.FLOW_RUN_LOG="FLOW_RUN_LOG",p.FLOW_RUN_LOG_SLICE="FLOW_RUN_LOG_SLICE",p.PACKAGE_ARCHIVE="PACKAGE_ARCHIVE",p.FLOW_STEP_FILE="FLOW_STEP_FILE",p.SAMPLE_DATA="SAMPLE_DATA",p.TRIGGER_PAYLOAD="TRIGGER_PAYLOAD",p.SAMPLE_DATA_INPUT="SAMPLE_DATA_INPUT",p.TRIGGER_EVENT_FILE="TRIGGER_EVENT_FILE",p.PROJECT_RELEASE="PROJECT_RELEASE",p.FLOW_VERSION_BACKUP="FLOW_VERSION_BACKUP",p.PLATFORM_ASSET="PLATFORM_ASSET",p.USER_PROFILE_PICTURE="USER_PROFILE_PICTURE",p.WEBHOOK_PAYLOAD="WEBHOOK_PAYLOAD",p.KNOWLEDGE_BASE="KNOWLEDGE_BASE",p.FLOW_BUNDLE="FLOW_BUNDLE",p))(Qn||{}),eo=(r=>(r.NONE="NONE",r.ZSTD="ZSTD",r))(eo||{}),to=(r=>(r.S3="S3",r.DB="DB",r))(to||{}),Pv=u({...K,projectId:j(n()),platformId:j(n()),type:D(Qn),compression:D(eo),data:f(z()),location:D(to),size:j(G()),fileName:j(n()),s3Key:j(n()),metadata:j(A(n(),n()))}),ro=(i=>(i.ADMIN="ADMIN",i.MEMBER="MEMBER",i.OPERATOR="OPERATOR",i))(ro||{}),no=(r=>(r.ACTIVE="ACTIVE",r.INACTIVE="INACTIVE",r))(no||{}),Iv=u({id:n(),email:n(),firstName:n(),status:D(no),externalId:j(n()),platformId:j(n()),platformRole:D(ro),lastName:n(),created:me,updated:me,lastActiveDate:j(me),imageUrl:j(n())});var Vt=u({...C.shape,...w(A(n(),z()),"OBJECT").shape});var so=u({...C.shape,...w(n(),"COLOR").shape});var Bt=R([W,ee,ct,re,H,te,kt,Ne,Rt,ne,Me,Vt,Le,Ue,Ce,so]),ie={ShortText(e){return{...e,valueSchema:void 0,type:"SHORT_TEXT"}},Checkbox(e){return{...e,valueSchema:void 0,type:"CHECKBOX"}},LongText(e){return{...e,valueSchema:void 0,type:"LONG_TEXT"}},MarkDown(e){return{displayName:"Markdown",required:!1,description:e.value,type:"MARKDOWN",valueSchema:void 0,variant:e.variant??"INFO"}},Number(e){return{...e,valueSchema:void 0,type:"NUMBER"}},Json(e){return{...e,valueSchema:void 0,type:"JSON"}},Array(e){return{...e,valueSchema:void 0,type:"ARRAY"}},Object(e){return{...e,valueSchema:void 0,type:"OBJECT"}},Dropdown(e){return{...e,valueSchema:void 0,type:"DROPDOWN"}},StaticDropdown(e){return{...e,valueSchema:void 0,type:"STATIC_DROPDOWN"}},MultiSelectDropdown(e){return{...e,valueSchema:void 0,type:"MULTI_SELECT_DROPDOWN"}},DynamicProperties(e){return{...e,valueSchema:void 0,type:"DYNAMIC"}},StaticMultiSelectDropdown(e){return{...e,valueSchema:void 0,type:"STATIC_MULTI_SELECT_DROPDOWN"}},DateTime(e){return{...e,valueSchema:void 0,type:"DATE_TIME"}},File(e){return{...e,valueSchema:void 0,type:"FILE"}},Custom(e){let t=e.code.toString();return{...e,code:t,valueSchema:void 0,type:"CUSTOM"}},Color(e){return{...e,valueSchema:void 0,type:"COLOR"}}};var Y=u({displayName:n(),description:f(n())});var uo=u({username:n(),password:n()}),Gt=u({...Y.shape,username:u({displayName:n(),description:f(n())}),password:u({displayName:n(),description:f(n())}),...w(uo,"BASIC_AUTH").shape});var Wa=A(n(),R([W,ee,ne,re,H])),Wt=u({...Y.shape,props:Wa,...w(z(),"CUSTOM_AUTH").shape});var ve=u({...Y.shape,...w(u({auth:n()}),"SECRET_TEXT").shape});var Ha=A(n(),R([W,ee,ve,ne,re,H,te,ct])),co=u({...Y.shape,props:Ha,...w(z(),"OIDC").shape});var Ht=(r=>(r.HEADER="HEADER",r.BODY="BODY",r))(Ht||{}),lo=R([W,ve,H]),po=A(n(),lo),Ka=u({props:f(A(n(),lo)),authUrl:n(),tokenUrl:n(),scope:k(n()),prompt:f(R([$("none"),$("consent"),$("login"),$("omit")])),pkce:f(U()),pkceMethod:f(R([$("plain"),$("S256")])),authorizationMethod:f(D(Ht)),grantType:f(R([D(Ze),$(wt)])),extra:f(A(n(),n()))}),mo=u({access_token:n(),props:f(po),data:A(n(),Re())}),Kt=u({...Y.shape,...Ka.shape,...w(mo,"OAUTH2").shape});var Ee=R([Gt,Wt,co,Kt,ve]),Ge="Connection",Jt={SecretText(e){return{...e,valueSchema:void 0,type:"SECRET_TEXT"}},OAuth2(e){return{...e,valueSchema:void 0,type:"OAUTH2",displayName:e.displayName||Ge}},BasicAuth(e){return{...e,valueSchema:void 0,type:"BASIC_AUTH",displayName:e.displayName||Ge,required:!0}},CustomAuth(e){return{...e,valueSchema:void 0,type:"CUSTOM_AUTH",displayName:e.displayName||Ge}},OIDC(e){return{...e,valueSchema:void 0,type:"OIDC",displayName:e.displayName||Ge}},None(){}};var e_={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 Ja=u({...C.shape,...w(z(),"CUSTOM").shape,code:n()});var qa=R([Bt,Ee]),Xt=A(n(),qa),__=A(n(),Bt);var fo=R([u({strategy:$("CRON"),cronExpression:n()}),u({strategy:$("NONE")})]);var go="2",mt="0.82.0";var qt=class{constructor(t,r,i,s,l,d,m,h,v=mt,P,N="",_){this.displayName=t;this.logoUrl=r;this.authors=i;this.events=s;this.categories=m;this.auth=h;this.minimumSupportedRelease=v;this.maximumSupportedRelease=P;this.description=N;this.deprecated=_;this._actions={};this._triggers={};this.getContextInfo=o(()=>({version:go}),"getContextInfo");(!Ya(v)||Qa(v,mt))&&(this.minimumSupportedRelease=mt),l.forEach(a=>this._actions[a.name]=a),d.forEach(a=>this._triggers[a.name]=a)}static{o(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(t){return this._actions[t]}getTrigger(t){return this._triggers[t]}actions(){return this._actions}triggers(){return this._triggers}},yo=o(e=>{if(e.auth&&Array.isArray(e.auth)&&!e.auth.every((r,i,s)=>i===s.findIndex(l=>l.type===r.type)))throw new Error("Auth properties must be unique by type");return new qt(e.displayName,e.logoUrl,e.authors??[],e.events,e.actions,e.triggers,e.categories??[],e.auth,e.minimumSupportedRelease,e.maximumSupportedRelease,e.description,e.deprecated)},"createPiece");function Ya(e){return/^\d+\.\d+\.\d+$/.test(e)}o(Ya,"isValidSimpleSemver");function Qa(e,t){let[r,i,s]=e.split(".").map(Number),[l,d,m]=t.split(".").map(Number);return r!==l?r<l:i!==d?i<d:s<m}o(Qa,"isSemverLessThan");var es=f(A(n(),A(n(),n()))),ho=u({id:f(n()),name:n(),displayName:n(),logoUrl:n(),description:n(),authors:k(n()),platformId:f(n()),directoryPath:f(n()),auth:f(R([Ee,k(Ee)])),version:n(),categories:f(k(D(Ie))),minimumSupportedRelease:f(n()),maximumSupportedRelease:f(n()),deprecated:f(U()),i18n:es}),ts=D(["human","ai","both"]),vo=u({description:f(n()),idempotent:f(U())}),xo=u({name:n(),displayName:n(),description:n(),props:Xt,requireAuth:U(),errorHandlingOptions:f(Ot),outputSchema:f(st()),audience:f(ts),aiMetadata:f(vo)}),_o=u({name:n(),displayName:n(),description:n(),props:Xt,errorHandlingOptions:f(Ot),type:D(fe),sampleData:z(),handshakeConfiguration:f(st()),renewConfiguration:f(fo),testStrategy:D(Ve),outputSchema:f(st()),aiMetadata:f(vo)}),rs=u({...ho.shape,actions:A(n(),xo),triggers:A(n(),_o)}),ns=u({...ho.shape,actions:G(),triggers:G(),suggestedActions:f(k(xo)),suggestedTriggers:f(k(_o))}),Po=u({projectUsage:G(),pieceType:D(Pe),packageType:D(je),platformId:f(n()),archiveId:f(n())}),_P=u({...rs.shape,...Po.shape}),PP=u({...ns.shape,...Po.shape}),IP=u({name:n(),version:n()});var os=We(require("path")),is=We(require("fs/promises"));var Io=require("@duckdb/node-api"),To=gn({name:"createAndQueryDB",displayName:"Create and Query DB",description:"Create DB from data and run query",audience:"both",aiMetadata:{description:"Spins up a throwaway in-memory DuckDB, loads one or more tables from supplied JSON arrays (column names taken from object keys; schema can be given explicitly or autodetected), then runs a SQL query against them and returns the rows. Use to run SQL joins, aggregations, or transforms over JSON data you already have in the flow, without any external database. Use parameterized placeholders ($1, $2, ...) with the args list rather than interpolating values into the query string. Read-only with respect to external systems: the database exists only for this call, so repeating with the same input yields the same result.",idempotent:!0},props:{markdown:ie.MarkDown({value:`
|
|
2
|
+
**DO NOT** insert dynamic input directly into the query string. Instead, use $1, $2, $3 and add them in args for parameterized queries to prevent **SQL injection.**`}),tables:ie.Array({displayName:"Tables",description:"List of tables to create in the database",required:!0,properties:{name:ie.ShortText({displayName:"Table Name",description:"Name of the table to create",required:!0}),data:ie.Json({displayName:"JSON Data",description:"Table data in the form of a JSON array of objects. Object keys would be taken as column names.",required:!0,defaultValue:[]}),schema:ie.Json({displayName:"Schema in JSON format",description:`
|
|
3
3
|
Provide the schema as a JSON object. Note that only the specified columns would be loaded.
|
|
4
4
|
Leave empty to autodetect schema, although it is recommended to specify the schema for consistency and avoid unexpected behaviour.
|
|
5
5
|
|
|
6
6
|
More information on data types and accepted values:
|
|
7
7
|
- https://duckdb.org/2023/03/03/json
|
|
8
8
|
- https://duckdb.org/docs/stable/sql/data_types/overview
|
|
9
|
-
`.trim(),required:!1,defaultValue:{}})}}),query:
|
|
9
|
+
`.trim(),required:!1,defaultValue:{}})}}),query:ie.ShortText({displayName:"Query",description:"Please use $1, $2, etc. for parameterized queries to avoid SQL injection.",required:!0}),args:ie.Array({displayName:"Arguments",description:"Arguments to be used in the query",required:!1})},async run(e){let r=await(await Io.DuckDBInstance.create(":memory:")).connect();await r.run(`
|
|
10
10
|
SET enable_logging = 0;
|
|
11
11
|
SET enable_external_access = false;
|
|
12
12
|
SET lock_configuration = true;
|
|
13
13
|
`);let i=e.propsValue.tables??[];for(let h of i){let v=JSON.stringify(h.data),P=null;h.schema?P=JSON.stringify([h.schema]):P=(await(await r.run("SELECT json_structure($sourceData) AS schema",{sourceData:v})).getRows())[0][0],await r.run(`
|
|
14
14
|
CREATE TABLE ${h.name} AS
|
|
15
15
|
SELECT UNNEST(JSON_TRANSFORM($sourceData, $sourceSchema), recursive := true);
|
|
16
|
-
`,{sourceData:v,sourceSchema:P})}let s=e.propsValue.args??[],
|
|
16
|
+
`,{sourceData:v,sourceSchema:P})}let s=e.propsValue.args??[],l={};for(let h=0;h<s.length;h++){let v=(h+1).toString();l[v]=s[h]}let m=(await r.runAndReadAll(e.propsValue.query,l)).getRowObjectsJson();return r.closeSync(),m}});var as=yo({displayName:"DuckDB",auth:Jt.None(),minimumSupportedRelease:"0.36.1",logoUrl:"https://cdn.activepieces.com/pieces/duckdb.png",description:"Run SQL queries on an in-memory DuckDB database.",categories:["DEVELOPER_TOOLS"],authors:["danielpoonwj"],actions:[To],triggers:[]});0&&(module.exports={duckdb});
|